/* ==========================================================================
   ABlawg — Gutenberg block styles
   --------------------------------------------------------------------------
   The approved design is hand-authored HTML in which every element carries an
   explicit class. The block editor emits its own markup and its own stylesheet,
   so without this file a post written in the editor inherits almost none of the
   design: core's defaults are system fonts, blue links, rounded buttons and a
   spacing scale unrelated to ours.

   Every value here is one of app.css's tokens. Nothing invents a new colour,
   size or spacing step — if a value is not in the design system, it is derived
   from one that is, and says so.

   Cascade: WordPress prints its per-block styles in <head> BEFORE theme
   stylesheets, so these rules win at equal specificity and no !important is
   needed. Core's own defaults are mostly written as `:root :where(...)`, which
   carries almost no specificity by design — it is meant to be overridden.

   Contents
     1. Content flow and rhythm
     2. Text blocks
     3. Media blocks
     4. Layout blocks
     5. Buttons
     6. Tables
     7. Dynamic blocks
     8. Embeds
     9. Alignment
    10. Responsive
   ========================================================================== */


/* ── 1. Content flow and rhythm ───────────────────────────────────────────
   .prose is the article body on single.php and page.php. app.css makes it a
   grid with a 30px gap, which is the design's own block rhythm, so blocks
   inherit their spacing from the container and almost nothing below needs a
   margin. The exception is consecutive paragraphs, which the design sets
   tighter than the block gap.                                              */

.prose > * { min-width: 0; }   /* grid children must be allowed to shrink */

.prose > p + p { margin-top: calc(1.5em - var(--sp-30)); }

/* Core ships `margin-block-start` on most blocks via its layout styles. The
   grid gap already provides that spacing, so doubling it would open every gap
   to ~60px. */
.prose > *:not(.alignfull):not(.alignwide) { margin-block: 0; }


/* ── 2. Text blocks ───────────────────────────────────────────────────── */

/* Headings. The design draws article headings at --fs-20 in Manrope 700
   (.prose__title); h1 and h2 step up so the hierarchy is legible in a long
   post, using the scale's existing steps rather than new values. */
.prose :is(h1, h2, h3, h4, h5, h6),
.wp-block-heading {
  font-family: var(--ff-display);
  font-weight: 700;
  line-height: var(--lh-tight);
  color: var(--clr-ink);
  text-wrap: normal;
}

.prose > h1, .prose > .wp-block-heading h1 { font-size: var(--fs-36); }
.prose > h2 { font-size: var(--fs-30); }
.prose > h3 { font-size: var(--fs-20); }
.prose > h4 { font-size: var(--fs-18); }
.prose > h5 { font-size: var(--fs-14); text-transform: uppercase; letter-spacing: 0.04em; }
.prose > h6 {
  font-size: var(--fs-12);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  color: var(--clr-muted);
}

/* An h1 inside the body is unusual — the card title is already the page's h1 —
   so it is set just under it rather than competing with it. */

/* Element selector only: adding `.prose .wp-block-paragraph` here would be
   (0,2,0) and would then outrank every rule that reverses paragraph colour on
   a dark surface — which is exactly what happened to the Cover block. */
.prose p { color: var(--clr-ink); }

/* Drop cap. The design has no equivalent, so it is built from the display
   face and the brand red rather than left to the browser. */
.prose p.has-drop-cap:first-letter {
  float: left;
  margin: 0.08em 0.12em 0 0;
  font-family: var(--ff-display);
  font-size: 3.2em;
  font-weight: 700;
  line-height: 0.82;
  color: var(--clr-red);
}

/* Lists */
.prose :is(ul, ol):not([role='list']):not(.wp-block-page-list):not(.wp-block-categories):not(.wp-block-archives):not(.wp-block-latest-posts) {
  display: grid;
  gap: 0.75em;
  padding-left: 1.5em;
  color: var(--clr-ink);
}
.prose ul:not([role='list']) { list-style: disc; }
.prose ol:not([role='list']) { list-style: decimal; }
.prose li::marker { color: var(--clr-red); }
.prose li > :is(ul, ol) { margin-top: 0.75em; }

/* Quote — the design's grey aside, with a brand rule to mark it as a quote. */
.wp-block-quote {
  display: grid;
  gap: 1.5em;
  margin: 0;
  padding: var(--sp-40) var(--sp-50);
  background: var(--clr-surface);
  border: 0;
  border-left: 4px solid var(--clr-red);
}
.wp-block-quote p { color: var(--clr-ink); }
/* AA: the brand red is 4.48:1 on #F5F5F5, so links inside use the deeper tone. */
.wp-block-quote a { color: var(--clr-red-deep); }
.wp-block-quote :is(cite, .wp-block-quote__citation) {
  font-family: var(--ff-body);
  font-size: var(--fs-14);
  font-style: normal;
  color: var(--clr-muted-on-surface, #6B6B6B);   /* AA on #F5F5F5 */
}

/* Pullquote — louder than a quote: full-width band, brand red, reversed out. */
.wp-block-pullquote {
  margin: 0;
  padding: var(--sp-50) var(--sp-40);
  background: var(--clr-red);
  border: 0;
  color: var(--clr-text-invert);
  text-align: left;
}
.wp-block-pullquote blockquote { margin: 0; }
.wp-block-pullquote p {
  font-family: var(--ff-display);
  font-size: var(--fs-26);
  font-weight: 700;
  line-height: var(--lh-tight);
  color: var(--clr-text-invert);
}
.wp-block-pullquote cite {
  display: block;
  margin-top: var(--sp-20);
  font-family: var(--ff-body);
  font-size: var(--fs-14);
  font-style: normal;
  text-transform: none;
  color: var(--clr-text-invert);
  opacity: 0.85;
}
/* Dark band: the focus ring must flip, as it does on the hero and footer. */
.wp-block-pullquote { --clr-focus: var(--clr-white); --clr-focus-halo: var(--clr-ink); }
.wp-block-pullquote a { color: var(--clr-text-invert); text-decoration: underline; }

/* Code, preformatted and verse share the design's surface panel. */
.wp-block-code,
.wp-block-preformatted,
.wp-block-verse {
  margin: 0;
  padding: var(--sp-30);
  background: var(--clr-surface);
  border-left: 4px solid var(--clr-border);
  font-size: var(--fs-14);
  line-height: 1.6;
  color: var(--clr-ink);
  overflow-x: auto;           /* long lines scroll rather than widen the page */
  tab-size: 4;
}
.wp-block-code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: none;
  padding: 0;
}
.wp-block-verse {
  font-family: var(--ff-body);
  white-space: pre-wrap;      /* verse should wrap on a narrow screen */
}
.wp-block-preformatted { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Inline code inside running text. */
.prose :not(pre) > code {
  padding: 0.15em 0.4em;
  background: var(--clr-surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  color: var(--clr-ink);
}

/* Separator — the design's hairline, not core's short centred dash. */
.wp-block-separator {
  width: 100%;
  height: 0;
  margin: 0;
  border: 0;
  border-top: var(--hairline) solid var(--clr-border);
  opacity: 1;
}
.wp-block-separator.is-style-dots {
  border: 0;
  text-align: center;
  line-height: 1;
  color: var(--clr-red);
}

/* Classic (freeform) content has no block classes at all, so it is reached
   through its container. */
.prose :is(p, ul, ol, h2, h3) { max-width: 100%; }

/* Footnotes */
.wp-block-footnotes { font-size: var(--fs-14); color: var(--clr-muted); }


/* ── 3. Media blocks ──────────────────────────────────────────────────── */

.wp-block-image,
.wp-block-gallery,
.wp-block-audio,
.wp-block-video,
.wp-block-embed { margin: 0; }

.wp-block-image img,
.wp-block-video video,
.wp-block-cover img { display: block; max-width: 100%; height: auto; }

/* The design uses square corners throughout (--radius is 0). */
.wp-block-image img,
.wp-block-cover,
.wp-block-gallery img,
.wp-block-media-text__media img { border-radius: var(--radius); }

/* Captions — one rule for every block that has one. */
.wp-block-image figcaption,
.wp-block-gallery figcaption,
.wp-block-audio figcaption,
.wp-block-video figcaption,
.wp-block-table figcaption,
.wp-block-embed figcaption,
.wp-element-caption {
  margin-top: var(--sp-10);
  font-family: var(--ff-body);
  font-size: var(--fs-14);
  line-height: var(--lh-body);
  color: var(--clr-muted);
  text-align: left;
}

/* Gallery */
.wp-block-gallery.has-nested-images { gap: var(--sp-15); }
.wp-block-gallery.has-nested-images figure.wp-block-image img { width: 100%; }

/* Cover */
.wp-block-cover {
  padding: var(--sp-60) var(--sp-40);
  /* The design's hero band is 749px at 1440; a cover is a smaller cousin. */
  min-height: 26rem;
}
/* Everything inside a cover sits on a dimmed image, so it reverses out. The
   inner container is part of the block's own markup, which makes this (0,2,1)
   — comfortably clear of the body-copy rules above without !important. */
.wp-block-cover .wp-block-cover__inner-container :is(h1, h2, h3, h4, h5, h6, p, li, cite),
.wp-block-cover .wp-block-cover__inner-container { color: var(--clr-text-invert); }
.wp-block-cover .wp-block-cover__inner-container a { color: var(--clr-text-invert); }
.wp-block-cover { --clr-focus: var(--clr-white); --clr-focus-halo: var(--clr-ink); }

/* Media & text */
.wp-block-media-text {
  gap: var(--sp-34);                    /* the design's column gap */
  grid-template-columns: 1fr 1fr;
}
.wp-block-media-text__content { padding: 0; }
.wp-block-media-text__content > * + * { margin-top: var(--sp-20); }

/* Audio and video controls sit on the design's surface so they read as part
   of the page rather than as bare browser chrome. */
.wp-block-audio audio { width: 100%; }
.wp-block-video video { width: 100%; background: var(--clr-ink); }


/* ── 4. Layout blocks ─────────────────────────────────────────────────── */

.wp-block-columns { gap: var(--sp-34); margin: 0; }
.wp-block-column > * + * { margin-top: var(--sp-20); }

.wp-block-group { margin: 0; }
.wp-block-group.has-background { padding: var(--sp-40); }

/* Row and stack are Group with a flex layout. */
.wp-block-group.is-layout-flex { gap: var(--sp-20); align-items: center; }
.wp-block-group.is-layout-flex.is-vertical { align-items: stretch; }

/* Core's constrained layout centres children on its own content width; the
   article column is already the right width, so it is handed through. */
.prose > .wp-block-group.is-layout-constrained > * { max-width: 100%; }

/* Spacer — honoured as authored, but never allowed to create overflow. */
.wp-block-spacer { flex: none; }


/* ── 5. Buttons ───────────────────────────────────────────────────────────
   Reproduces .btn.btn--cta from section 5 of app.css. The declarations are
   repeated rather than shared because a block button cannot be given the .btn
   class without a filter, and the state pair tokens keep the two in step. */

.wp-block-buttons { gap: var(--sp-15); margin: 0; }

/* Specificity note: app.css styles every link inside the article body as
   `.prose a` (0,1,1), which outranks a single class. A block button is a
   component that happens to be a link, not body copy, so these selectors go
   through the wrapper the block always renders — (0,2,0) — rather than
   reaching for !important. The same applies to the post-title link below. */
.wp-block-button > .wp-block-button__link,
.wp-block-button > .wp-element-button,
button.wp-element-button,
input.wp-element-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--btn-h);
  padding: 0 var(--btn-pad-x);
  border: var(--hairline) solid transparent;
  border-radius: var(--radius);
  background: var(--btn-bg);
  /* The design's .btn is Inter 700 at 0.04em, not the display face — see
     section 5 of app.css. */
  font-family: var(--ff-body);
  font-size: var(--fs-12);
  font-weight: 700;
  line-height: var(--lh-label);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--btn-fg);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.wp-block-button > .wp-block-button__link:hover,
button.wp-element-button:hover,
input.wp-element-button:hover { background: var(--btn-bg-hover); color: var(--btn-fg-hover); }
.wp-block-button > .wp-block-button__link:active,
button.wp-element-button:active,
input.wp-element-button:active { background: var(--btn-bg-active); color: var(--btn-fg-active); }

/* Outline variant — the design's ghost button. */
.wp-block-button.is-style-outline > .wp-block-button__link {
  background: transparent;
  border-color: var(--clr-ink);
  color: var(--clr-ink);
}
.wp-block-button.is-style-outline > .wp-block-button__link:hover {
  background: var(--btn-bg-hover);
  border-color: var(--btn-bg-hover);
  color: var(--btn-fg-hover);
}


/* ── 6. Tables ────────────────────────────────────────────────────────────
   A table is the one block that cannot be made to fit a narrow column by
   reflowing, so the figure scrolls rather than the page. */

.wp-block-table { margin: 0; overflow-x: auto; }
.wp-block-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-14);
  line-height: var(--lh-body);
}
.wp-block-table :is(th, td) {
  padding: var(--sp-15);
  border: var(--hairline) solid var(--clr-border);
  text-align: left;
  vertical-align: top;
}
.wp-block-table th {
  background: var(--clr-surface);
  font-family: var(--ff-display);
  font-weight: 700;
  color: var(--clr-ink);
}
.wp-block-table.is-style-stripes tbody tr:nth-child(odd) { background: var(--clr-surface); }
.wp-block-table.is-style-stripes :is(th, td) { border-color: transparent; }
/* AA: brand red is 4.48:1 on striped rows. */
.wp-block-table.is-style-stripes a { color: var(--clr-red-deep); }


/* ── 7. Dynamic blocks ────────────────────────────────────────────────────
   Latest Posts, Categories, Archives, Page List, Navigation and Search all
   render lists of links, and core styles none of them to a theme's typography. */

.wp-block-latest-posts,
.wp-block-categories,
.wp-block-archives,
.wp-block-page-list {
  padding-left: 0;
  list-style: none;
}

.wp-block-latest-posts__list { display: grid; gap: var(--sp-25); }
.wp-block-latest-posts__list li { display: grid; gap: var(--sp-10); }
.wp-block-latest-posts__list a.wp-block-latest-posts__post-title,
a.wp-block-latest-posts__post-title {
  font-family: var(--ff-display);
  font-size: var(--fs-20);
  font-weight: 700;
  line-height: var(--lh-tight);
  color: var(--clr-ink);
  text-decoration: none;
}
.wp-block-latest-posts__list a.wp-block-latest-posts__post-title:hover,
a.wp-block-latest-posts__post-title:hover { color: var(--clr-red); text-decoration: underline; }
.wp-block-latest-posts__post-date {
  font-size: var(--fs-12);
  line-height: var(--lh-label);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--clr-muted);
}
.wp-block-latest-posts__post-excerpt { font-size: var(--fs-14); color: var(--clr-ink); }
.wp-block-latest-posts__featured-image img { border-radius: var(--radius); }
.wp-block-latest-posts__featured-image.alignleft { margin-right: var(--sp-20); }

.wp-block-categories li,
.wp-block-archives li,
.wp-block-page-list li { padding-block: 0.35rem; }

.wp-block-categories a,
.wp-block-archives a,
.wp-block-page-list a {
  font-family: var(--ff-display);
  font-size: var(--fs-18);
  color: var(--clr-ink);
  text-decoration: none;
}
.wp-block-categories a:hover,
.wp-block-archives a:hover,
.wp-block-page-list a:hover { color: var(--clr-red); text-decoration: underline; }

/* The dropdown variants of Categories and Archives are native selects; give
   them the design's own select treatment from section 21.5. */
.wp-block-categories select,
.wp-block-archives select,
.wp-block-search select {
  width: 100%;
  min-height: 3.75rem;
  padding: 0.75rem 1rem;
  background: var(--clr-white);
  border: var(--hairline) solid var(--clr-border);
  border-radius: var(--radius);
  font-family: var(--ff-display);
  font-size: var(--fs-14);
  color: var(--clr-text);
}

/* Navigation */
.wp-block-navigation { --navigation-layout-align: flex-start; }
.wp-block-navigation .wp-block-navigation-item__content {
  font-family: var(--ff-display);
  font-size: var(--fs-14);
  font-weight: 700;
  color: var(--clr-ink);
  text-decoration: none;
}
.wp-block-navigation .wp-block-navigation-item__content:hover { color: var(--clr-red); }
.wp-block-navigation .wp-block-navigation__submenu-container {
  background: var(--clr-white);
  border: var(--hairline) solid var(--clr-border);
  border-radius: var(--radius);
}

/* Search — the design's own searchbar, rebuilt from core's markup. */
.wp-block-search .wp-block-search__inside-wrapper {
  gap: 0;
  border: var(--hairline) solid var(--clr-border);
  background: var(--clr-white);
}
.wp-block-search .wp-block-search__label {
  display: block;
  margin-bottom: var(--sp-10);
  font-family: var(--ff-display);
  font-size: var(--fs-14);
  font-weight: 700;
  color: var(--clr-ink);
}
.wp-block-search .wp-block-search__input {
  padding: var(--sp-20) var(--sp-30);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  font-family: var(--ff-body);
  font-size: var(--fs-18);
  color: var(--clr-text);
}
.wp-block-search .wp-block-search__input::placeholder { color: var(--clr-muted); opacity: 1; }
.wp-block-search .wp-block-search__button {
  margin: 0;
  min-height: var(--btn-h);
  padding: 0 var(--btn-pad-x);
  border: 0;
  border-radius: var(--radius);
  background: var(--btn-bg);
  /* The design's .btn is Inter 700 at 0.04em, not the display face — see
     section 5 of app.css. */
  font-family: var(--ff-body);
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--btn-fg);
}
.wp-block-search .wp-block-search__button:hover { background: var(--btn-bg-hover); color: var(--btn-fg-hover); }


/* ── 8. Embeds ────────────────────────────────────────────────────────────
   An embed that cannot resolve falls back to a bare link; one that does
   resolve returns an iframe that must stay inside the column. */

.wp-block-embed__wrapper { position: relative; }
.wp-block-embed iframe { display: block; max-width: 100%; border: 0; }
.wp-block-embed.wp-has-aspect-ratio .wp-block-embed__wrapper { aspect-ratio: 16 / 9; }
.wp-block-embed.wp-has-aspect-ratio iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* The unresolved fallback is a long URL; it must wrap rather than overflow. */
.wp-block-embed__wrapper > a { overflow-wrap: anywhere; }


/* ── 9. Alignment ─────────────────────────────────────────────────────────
   The article column is 940px at the design's container. A wide or full block
   inside it is allowed to reach the column edges but never the viewport, which
   would break the two-column layout. */

.prose > .alignwide,
.prose > .alignfull { width: 100%; max-width: 100%; }

.prose > .alignleft {
  float: left;
  margin: 0 var(--sp-30) var(--sp-20) 0;
  max-width: 50%;
}
.prose > .alignright {
  float: right;
  margin: 0 0 var(--sp-20) var(--sp-30);
  max-width: 50%;
}
.prose > .aligncenter { margin-inline: auto; }

/* A float must not escape the block that follows it. */
.prose > .wp-block-separator,
.prose > .wp-block-heading { clear: both; }


/* ── 10. Responsive ────────────────────────────────────────────────────── */

@media (max-width: 1023px) {
  .wp-block-cover { min-height: 20rem; }
}

@media (max-width: 767px) {
  /* Columns and Media & Text stack. Core already stacks columns at 781px;
     restating the gap keeps the vertical rhythm equal to the design's. */
  .wp-block-columns:not(.is-not-stacked-on-mobile) { gap: var(--sp-30); }

  .wp-block-media-text:not(.is-stacked-on-mobile) { grid-template-columns: 1fr; }
  .wp-block-media-text.is-stacked-on-mobile { gap: var(--sp-20); }

  .wp-block-cover { padding: var(--sp-40) var(--sp-20); min-height: 16rem; }

  .wp-block-pullquote { padding: var(--sp-30) var(--sp-20); }
  .wp-block-pullquote p { font-size: var(--fs-20); }

  .wp-block-quote { padding: var(--sp-30) var(--sp-20); }

  /* A floated image in a phone-width column leaves no room for text. */
  .prose > .alignleft,
  .prose > .alignright { float: none; margin-inline: 0; max-width: 100%; }

  .wp-block-buttons { width: 100%; }
  .wp-block-button { width: 100%; }
  .wp-block-button > .wp-block-button__link { width: 100%; }

  .prose > h1, .prose > .wp-block-heading h1 { font-size: var(--fs-30); }
  .prose > h2 { font-size: var(--fs-26); }
}

@media (prefers-reduced-motion: reduce) {
  .wp-block-button > .wp-block-button__link,
  .wp-element-button { transition: none; }
}
