
@layer site-base, site-theme, site-custom, site-blocks;

@layer site-base {
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  /* The page's structural container width — header/footer/`wide`-section
     max-width. Fixed, not a per-theme setting: distinct from `--measure`
     (a theme's reading measure, used only by `normal`-width sections) so
     the two can vary independently. 1200px: a middle ground between the
     old 1024px `wide` tier and the 1440px reference design's canvas. */
  --page-width: 75rem;
}

html {
  -webkit-text-size-adjust: 100%;
  /* Guards a full-width breakout hero (e.g. Editorial's) against a 1px
     horizontal scrollbar on browsers where 100vw includes the scrollbar
     gutter; harmless on a theme that never sets an element wider than 100%. */
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
}

.wrap {
  width: 100%;
  max-width: var(--page-width);
  margin-inline: auto;
  padding-inline: var(--gap);
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 2px;
}

img {
  max-width: 100%;
  height: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.not-found {
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  padding-block: 3rem;
  text-align: center;
}

.not-found-code {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(5rem, 22vw, 9rem);
  font-weight: 300;
  line-height: 1;
  color: var(--border);
}

.not-found h1 {
  margin: 0;
}

.not-found p {
  margin: 0;
  max-width: 32rem;
  color: var(--text-muted);
}

.not-found .not-found-home {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  color: var(--text);
  font-weight: 550;
  text-decoration: none;
}

.not-found .not-found-home:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.skip-link:focus {
  left: var(--gap);
  top: var(--gap);
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* --- Header --- */

.site-header {
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: var(--gap);
  flex-wrap: wrap;
  padding-block: 1rem;
}

.site-logo {
  height: 2rem;
  width: auto;
}

/* The Logo block's home link (`link: true`): a flex box exactly the logo's size, so the inline image leaves no
   line-height gap below it and lines up when centred beside the name. */
.site-logo-link {
  display: flex;
  flex: none;
  text-decoration: none;
}

.site-name {
  font-family: var(--font-heading);
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
  margin-inline-end: auto;
}

.site-header nav ul {
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-header nav a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* The language switcher (Step 72): a second, smaller header nav, shown only on websites with several languages.
   Themes style it through .site-header nav like the menu, or through .language-switcher on its own. */
.language-switcher ul {
  gap: 0.75rem;
  font-size: 0.875em;
}

.language-switcher a[aria-current] {
  color: var(--text);
  font-weight: 600;
}

/* The mobile menu (Step 94), no JavaScript: a menu that collapses renders its list twice, .nav-list for wide screens
   and a <details class="nav-mobile"> for narrow ones; one breakpoint shows one or the other. In the header that is
   the theme's menu collapse width (Step 113: `menuCollapseWidth`, emitted with its theme.css in this layer); in the
   footer it is the phone width below. A theme styles both lists but leaves their display alone (its layer would
   win). Without JavaScript the open panel stays open until the button is pressed again. */
.nav-mobile {
  display: none;
}

@media (max-width: 767px) {
  .site-footer nav > ul.nav-list {
    display: none;
  }

  .site-footer .nav-mobile {
    display: block;
    position: relative;
  }
}

.nav-mobile-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.nav-mobile-toggle::-webkit-details-marker {
  display: none;
}

.nav-mobile-toggle svg {
  flex: none;
}

.nav-mobile[open] > .nav-mobile-toggle {
  border-color: var(--text);
}

/* A plain dropdown panel under the button, aligned to its end (a theme with the menu on the left aligns it to the
   start). */
.nav-mobile .nav-mobile-list {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 0.5rem);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 12rem;
  max-width: calc(100vw - 2 * var(--gap));
  margin: 0;
  padding: 0.5rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.nav-mobile .nav-mobile-list a {
  display: block;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  text-decoration: none;
}

.nav-mobile .nav-mobile-list a:hover,
.nav-mobile .nav-mobile-list a[aria-current='page'] {
  color: var(--accent);
}

/* --- Layout primitives (Step 103): tagline, logo tile, sticky Section --- */

/* The tagline site block: one short muted line, e.g. under the website name. */
.site-tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.3;
}

/* The Logo block's letter tile when the website has no logo image: as tall as a logo (.site-logo's height), square
   unless its letters need more room, in the text colour. */
.site-logo-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  aspect-ratio: 1;
  padding-inline: 0.3em;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--background);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

/* A sticky Section stays at the top while the page scrolls, over the page colour. */
.block-section-sticky {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--background);
}

/* A sticky element only sticks inside its parent's box. A header holding a sticky Section therefore lets its parts
   into the page's flow (no box of its own: a theme's sticky, background or border on .site-header no longer apply):
   the parts above the Section (an info bar) scroll away and the Section stays to the end of the page. The header
   element and its landmark remain. */
.site-header:has(> .block-section-sticky) {
  display: contents;
}

/* A header's parts (an info bar, the sticky row) sit flush: the gap between neighbouring blocks (below) would
   otherwise open a gap above the row until it sticks. */
.site-header > .block + .block {
  margin-block-start: 0;
}

/* A header or footer bar inside a Section: the Section already gives the side gutter, the measure and the room. */
.block-section-inner > .wrap {
  padding-inline: 0;
}

.block-section:has(> .block-section-inner > .wrap) {
  padding-block: 0;
}

/* --- Main --- */

main {
  padding-block: 2.5rem 4rem;
}

.block + .block {
  margin-block-start: 2rem;
}

/* A spacer's own height is the point of adding one — the generic rhythm
   above would otherwise stack on top of it. */
.block + .block-spacer {
  margin-block-start: 0;
}

/* Grid and Stack space their children with `gap`; the rhythm above would
   push every item but the first out of line. */
.block-grid > .block,
.block-stack > .block {
  margin-block-start: 0;
}

/* --- Section (layout, one slot) --- */

/* A full-width band: breaks out of .wrap's max-width so its background
   spans edge to edge, the way the old breakout hero did; .block-section-inner
   below re-applies the content measure and centring inside it.

   No background/colour of its own and a plain default vertical rhythm —
   Step 10 (the style system) turned the old background/padding enums into
   style values; with none set a Section has no look beyond this, and text
   inherits from its parent the way every block now starts out. */
.block-section {
  width: 100vw;
  max-width: 100vw;
  margin-inline: calc(50% - 50vw);
  padding-inline: var(--gap);
  padding-block: var(--space-7);
}

.block-section-inner {
  width: 100%;
  margin-inline: auto;
}

/* Matches `.wrap`'s content container — aligns with header, footer, and other page blocks. */
.block-section-width-default {
  max-width: calc(var(--page-width) - 2 * var(--gap));
}

/* The theme's reading measure, for comfortable line length in prose/text sections. */
.block-section-width-narrow {
  max-width: var(--measure);
}

.block-section-width-full {
  max-width: none;
}

/* --- Grid (layout, one slot) --- */

/* Mobile-first: one column everywhere, widening at the breakpoints below —
   "fewer columns on small screens automatically". Default gap is the
   theme's own (Step 10 turned the old `gap` enum into `style.spacing.gap`). */
.block-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: var(--space-5);
}

@media (min-width: 640px) {
  .block-grid-cols-2,
  .block-grid-cols-3,
  .block-grid-cols-4,
  .block-grid-cols-5,
  .block-grid-cols-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .block-grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .block-grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .block-grid-cols-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .block-grid-cols-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

/* --- Stack (layout, one slot) --- */

/* Default gap is the theme's own (Step 10 turned the old `gap` enum into `style.spacing.gap`). */
.block-stack {
  display: flex;
  gap: var(--space-5);
}

.block-stack-row {
  flex-direction: row;
}

.block-stack-column {
  flex-direction: column;
}

.block-stack-align-start {
  align-items: flex-start;
}

.block-stack-align-center {
  align-items: center;
}

.block-stack-align-end {
  align-items: flex-end;
}

.block-stack-align-stretch {
  align-items: stretch;
}

.block-stack-justify-start {
  justify-content: flex-start;
}

.block-stack-justify-center {
  justify-content: center;
}

.block-stack-justify-end {
  justify-content: flex-end;
}

.block-stack-justify-between {
  justify-content: space-between;
}

.block-stack-wrap {
  flex-wrap: wrap;
}

/* --- Card (layout, one slot) --- */

/* Its default look used to be a `variant` enum (default/surface/accent/
   inverted); Step 10 gave it one fixed theme default instead — a plain
   framed box — and moved variant-picking to style overrides (background,
   colour, border, radius). */
.block-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.block-card-inner {
  padding: var(--space-5);
}

/* Two columns of a Grid (Step 99), only where the grid has two or more. The second selector is for the editor
   canvas, which wraps each item of a slot in a div of its own; on the public site a Grid's items are its children. */
@media (min-width: 640px) {
  .block-grid:not(.block-grid-cols-1) > .block-card-span-2,
  .block-grid:not(.block-grid-cols-1) > div:has(> .block-card-span-2) {
    grid-column: span 2;
  }
}

/* --- Icon or monogram tile (Step 99) --- */

.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 12%, var(--background));
  color: var(--accent);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0;
}

.tile svg {
  width: 1.375rem;
  height: 1.375rem;
}

/* In a card: above the content, inside the card's padding. */
.block-card > .tile {
  margin: var(--space-5) var(--space-5) 0;
}

/* In a button: a plain icon or a small text box before the label, in the button's own colour. */
.button:has(> .tile) {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

.button .tile {
  width: auto;
  height: auto;
  min-width: 1.25em;
  background: transparent;
  color: inherit;
  font-size: 0.85em;
}

.button .tile svg {
  width: 1.15em;
  height: 1.15em;
}

/* --- Badge (Step 99) --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.3em 0.8em;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-meta);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
}

.badge-pill {
  border-radius: 999px;
}

.badge-square {
  border-radius: calc(var(--radius) / 2);
}

.badge-dot {
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--accent);
}

.badge-stars {
  display: inline-flex;
  gap: 0.1em;
  color: var(--accent);
}

.badge-star {
  width: 1em;
  height: 1em;
}

.badge-star-off {
  opacity: 0.35;
}

/* --- Accordion (Step 99) --- */

.accordion-item {
  border-bottom: 1px solid var(--border);
}

.accordion-item:first-child {
  border-top: 1px solid var(--border);
}

.accordion-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-4);
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 600;
  list-style: none;
}

.accordion-title::-webkit-details-marker {
  display: none;
}

/* A plus that turns into a minus when open. */
.accordion-title::after {
  content: '+';
  flex-shrink: 0;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 1.25em;
  font-weight: 400;
  line-height: 1;
}

.accordion-item[open] > .accordion-title::after {
  content: '\2212';
}

.accordion-title:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.accordion-content {
  padding-block-end: var(--space-4);
}

.accordion-content > :last-child {
  margin-block-end: 0;
}

/* --- Table (Step 116) --- */

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.table-scroll:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.block-table table {
  width: 100%;
  border-collapse: collapse;
}

.block-table caption {
  padding-block-end: var(--space-3);
  color: var(--text-muted);
  font-size: 0.9em;
  text-align: start;
}

.block-table th,
.block-table td {
  min-width: 6rem;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  text-align: start;
  vertical-align: top;
}

.block-table thead th {
  border-bottom-width: 2px;
  white-space: nowrap;
  font-family: var(--font-heading);
  font-weight: 600;
}

.block-table tbody th {
  font-weight: 600;
}

/* --- Shared block variants (Step 96, `src/themes/variants.ts`) ---

   `is-style-<name>` on a Section's or Card's root. Neutral defaults that work
   with any theme's tokens; each theme restates them where its own Section or
   Card rules (a later layer) would override these. An owner's per-block style
   still wins over all of it (`@layer site-blocks`).

   Inverted re-points the colour tokens inside the block, so what it holds
   (text, cards, borders, muted text) reads on the reversed colours in any
   theme without per-block rules. */
.is-style-surface {
  background: var(--surface);
  color: var(--text);
}

.is-style-muted {
  background: color-mix(in srgb, var(--text) 5%, var(--background));
  color: var(--text);
}

.is-style-inverted {
  --background: var(--invert-bg);
  --text: var(--invert-text);
  --text-muted: color-mix(in srgb, var(--invert-text) 72%, var(--invert-bg));
  --border: color-mix(in srgb, var(--invert-text) 24%, var(--invert-bg));
  --surface: color-mix(in srgb, var(--invert-text) 8%, var(--invert-bg));
  background: var(--invert-bg);
  color: var(--invert-text);
}

.is-style-inverted .block-rich-text a:not(.button) {
  color: inherit;
}

.is-style-outlined {
  background: transparent;
  border: 1px solid var(--border);
  box-shadow: none;
}

/* A full-width band: lines above and below, not at the screen edges. */
.block-section.is-style-outlined {
  border-inline: 0;
}

.is-style-dots {
  background-color: var(--background);
  background-image: radial-gradient(color-mix(in srgb, var(--text) 16%, transparent) 1px, transparent 1.5px);
  background-size: 1.25rem 1.25rem;
}

/* --- Heading --- */

/* Size used to be a `size` enum independent of `level`; Step 10 made the
   tag itself the default size (`style.typography.fontSize` overrides it per
   block — see `docs/PROJECT.md` Step 10). */
.block-heading {
  font-family: var(--font-heading);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
}

h1.block-heading {
  font-size: var(--font-size-3xl);
}

h2.block-heading {
  font-size: var(--font-size-xl);
}

h3.block-heading {
  font-size: var(--font-size-lg);
}

h4.block-heading {
  font-size: var(--font-size-md);
}

/* `*word*` in a Heading's text (Step 96): themes may give it an italic serif or the accent colour. */
.block-heading em {
  font-style: italic;
}

/* --- Button (content block) --- */

/* Size used to be its own `size` enum; Step 10 folded it into typography +
   spacing style values, with this as the theme default (see
   `docs/PROJECT.md` Step 10). */
.button {
  display: inline-block;
  border-radius: var(--radius-button);
  font-weight: 550;
  font-size: var(--font-size-md);
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
}

.button:hover {
  /* Darkens whatever its own background already is, for any theme/variant,
     instead of a hard-coded hover colour. */
  filter: brightness(0.88);
}

.button-primary {
  background: var(--button-bg);
  color: var(--button-text);
}

.button-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.button-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.button-link:hover {
  filter: none;
  text-decoration-thickness: 2px;
}

/* The Button block's size (Step 113): the theme's own button scaled as a whole (padding, text, border, tile), so it
   works whatever padding and font size a theme gives .button in its own layer, which a base padding rule would lose
   to. A theme may restyle either size in its CSS. */
.button-small {
  zoom: 0.85;
}

.button-large {
  zoom: 1.2;
}

/* --- Spacer --- */

/* Height used to be a `size` enum; Step 10 turned it into `style.spacing.height` (see `docs/PROJECT.md` Step 10's Notes). */
.block-spacer {
  width: 100%;
  height: 2.5rem;
}

/* --- Divider --- */

.block-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
}

.block-rich-text h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  margin: 2rem 0 0.5rem;
}

.block-rich-text h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin: 1.5rem 0 0.5rem;
}

.block-rich-text h4 {
  font-family: var(--font-heading);
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
}

.block-rich-text p {
  margin: 0 0 1rem;
}

.block-rich-text ul,
.block-rich-text ol {
  margin: 0 0 1rem;
  padding-inline-start: 1.5rem;
}

.block-rich-text li > ul,
.block-rich-text li > ol {
  margin: 0.25rem 0 0;
}

.block-rich-text blockquote {
  margin: 1.5rem 0;
  padding-inline-start: 1rem;
  border-inline-start: 3px solid var(--border);
  color: var(--text-muted);
}

.block-rich-text pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
}

.block-rich-text code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.block-rich-text hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin-block: 2rem;
}

.block-image {
  margin: 0;
}

.block-image figcaption {
  margin-block-start: 0.6rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* --- Gallery (an ordered list of images, not a slot) ---
   Reuses .block-grid/.block-grid-cols-N above and .block-image's own figure
   styling — no separate grid CSS for what is, visually, the same grid. */

/* --- Columns (layout, three slots, unequal widths) --- */

/* Mobile-first like Grid: one column until the breakpoint below, then the
   preset's own ratio. Each column is its own flow (not a `.block` sibling
   group the way Grid's children are), so no gap-related margin override is
   needed the way Grid/Stack's is. */
.block-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

@media (min-width: 640px) {
  .block-columns-1-1 {
    grid-template-columns: 1fr 1fr;
  }

  .block-columns-1-2 {
    grid-template-columns: 1fr 2fr;
  }

  .block-columns-2-1 {
    grid-template-columns: 2fr 1fr;
  }

  .block-columns-1-1-1 {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .block-columns-1-2-1 {
    grid-template-columns: 1fr 2fr 1fr;
  }

  .block-columns-3-2 {
    grid-template-columns: 3fr 2fr;
  }

  .block-columns-2-3 {
    grid-template-columns: 2fr 3fr;
  }

  /* Wide first column plus three: two rows of two on tablets, one row from 1024px. */
  .block-columns-2-1-1-1 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .block-columns-2-1-1-1 {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

/* --- Embed (a single third-party iframe) --- */

.block-embed iframe {
  display: block;
  width: 100%;
  border: 0;
}

.block-embed-ratio-16-9 iframe {
  aspect-ratio: 16 / 9;
}

.block-embed-ratio-4-3 iframe {
  aspect-ratio: 4 / 3;
}

.block-embed-ratio-1-1 iframe {
  aspect-ratio: 1 / 1;
}

/* --- Blog & Posts --- */

.blog-index {
  width: 100%;
}

.blog-header {
  margin-block-end: var(--space-6);
}

.blog-title {
  font-family: var(--font-heading);
  font-size: var(--font-size-3xl);
  line-height: 1.15;
  margin: 0;
}

.blog-empty {
  color: var(--text-muted);
  font-size: var(--font-size-md);
  padding-block: var(--space-6);
  margin: 0;
}

/* The owner's introduction (Step 113, Website text), on the archive's first page only. */
.blog-intro {
  max-width: var(--measure);
  margin-block-start: var(--space-4);
  color: var(--text-muted);
  font-size: var(--font-size-md);
  line-height: 1.6;
}

.blog-intro p {
  margin: 0;
}

.blog-intro p + p {
  margin-block-start: var(--space-3);
}

.blog-tag-meta {
  margin-block-start: var(--space-2);
  font-size: var(--font-size-sm);
}

.blog-back-link {
  color: var(--accent);
  text-decoration: none;
}

.blog-back-link:hover {
  text-decoration: underline;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 640px) {
  .post-list {
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  }
}

.post-list > li {
  display: flex;
  min-width: 0;
}

.post-list > li > .post-card {
  flex: 1;
  min-width: 0;
}

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.post-card-cover-link {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--border);
}

.post-card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-4);
}

.post-card-date {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  margin-block-end: var(--space-2);
}

.post-card-title {
  font-family: var(--font-heading);
  font-size: var(--font-size-lg);
  line-height: 1.3;
  margin: 0 0 var(--space-2) 0;
}

.post-card-title a {
  color: var(--text);
  text-decoration: none;
}

.post-card-title a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.post-card-excerpt {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-block-start: var(--space-3);
}

.post-card-tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  text-decoration: none;
  line-height: 1.2;
}

.post-card-tag:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-block-start: var(--space-7);
  padding-block: var(--space-4);
}

.pagination a {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  color: var(--text);
  text-decoration: none;
  font-size: var(--font-size-sm);
}

.pagination a:hover {
  border-color: var(--text);
}

/* Inert stand-ins for a missing previous/next link; a theme may show them. */
.pagination-disabled {
  display: none;
}

.pagination-info {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.post-header {
  margin-block-end: var(--space-5);
}

.post-title {
  font-family: var(--font-heading);
  font-size: var(--font-size-3xl);
  line-height: 1.15;
  margin: 0;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-block-start: var(--space-3);
}

.post-tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  text-decoration: none;
  line-height: 1.3;
}

.post-tag:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* A content type's extra fields (Step 67): label/value pairs under the item's title. */
.post-fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-1) var(--space-4);
  margin: var(--space-4) 0 0;
  font-size: var(--font-size-sm);
}

.post-field {
  display: contents;
}

.post-field dt {
  color: var(--text-muted);
}

.post-field dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.post-date {
  display: block;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  margin-block-end: var(--space-2);
}

.post-cover {
  margin: 0 0 var(--space-6) 0;
}

.post-cover-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
}

.post-body {
  margin-block-start: var(--space-5);
}

/* --- Latest Posts Block --- */

.block-latest-posts {
  width: 100%;
}

.latest-posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 640px) {
  .latest-posts-cols-2,
  .latest-posts-cols-3,
  .latest-posts-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .latest-posts-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .latest-posts-cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.latest-posts-footer {
  margin-block-start: var(--space-6);
  text-align: right;
}

.latest-posts-view-all {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.latest-posts-view-all:hover {
  text-decoration: underline;
}

.latest-posts-empty {
  color: var(--text-muted);
  font-style: italic;
  padding: var(--space-4);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* --- Form (content block) --- */

.block-form {
  max-width: var(--measure);
}

.form {
  display: grid;
  gap: var(--space-4);
}

.form-field {
  display: grid;
  gap: var(--space-2);
}

.form-field label {
  font-weight: 550;
}

.form-required {
  color: var(--text-muted);
  margin-inline-start: 0.25em;
}

.form-field input[type='text'],
.form-field input[type='email'],
.form-field input[type='tel'],
.form-field input[type='date'],
.form-field textarea,
.form-field select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.form-field input:focus-visible,
.form-field textarea:focus-visible,
.form-field select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Half-width fields (Step 99): two in a row side by side from 640px; every other part of the form spans the row. */
@media (min-width: 640px) {
  .form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form > * {
    grid-column: 1 / -1;
  }

  .form > .form-field-half {
    grid-column: auto;
  }
}

.form-field-checkbox label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-weight: 400;
}

.form-submit {
  justify-self: start;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

.form-submit:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* The honeypot: out of sight and out of the tab order for people, still a plain field for a bot. */
.form-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-success,
.form-error {
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.form-success {
  background: var(--surface);
}

.form-error {
  border-color: var(--accent);
}

.form-placeholder {
  color: var(--text-muted);
  font-style: italic;
  padding: var(--space-4);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* --- Footer --- */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
}

/* Footer links (Step 50): an inline row beside or below the footer text. */
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.site-footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
}

/* --- Step 104: choices made on one block (a Badge's tone, a Rich text's width) ---
   In the block layer, as a block's own style is: an owner's choice wins over the theme's look of a badge or of text
   (every theme styles .badge), and the block's own style values still win over it (`.block[class~="blk-…"]` is more
   specific). */
@layer site-blocks {
.badge-tone-accent {
  --badge-tone: var(--accent);
  --badge-tone-text: var(--accent-text);
}

.badge-tone-accent-2 {
  --badge-tone: var(--accent-2);
  --badge-tone-text: var(--accent-2-text);
}

.badge-tone-accent-3 {
  --badge-tone: var(--accent-3);
  --badge-tone-text: var(--accent-3-text);
}

/* Filled with the tone, in its paired text colour; the dot and the stars take that text colour. */
.badge:is(.badge-tone-accent, .badge-tone-accent-2, .badge-tone-accent-3) {
  border-color: var(--badge-tone);
  background: var(--badge-tone);
  color: var(--badge-tone-text);
}

.badge:is(.badge-tone-accent, .badge-tone-accent-2, .badge-tone-accent-3) .badge-dot {
  background: currentColor;
}

.badge:is(.badge-tone-accent, .badge-tone-accent-2, .badge-tone-accent-3) .badge-stars {
  color: inherit;
}

/* Stars alone: no fill, the stars drawn in the tone (`:where` keeps this below a block's own style). */
.badge:is(.badge-tone-accent, .badge-tone-accent-2, .badge-tone-accent-3):where(:has(> .badge-stars:only-child)) {
  border-color: transparent;
  background: transparent;
  color: var(--badge-tone);
}

.block-rich-text-width-narrow {
  max-width: 28rem;
}

.block-rich-text-width-medium {
  max-width: 36rem;
}

.block-rich-text-width-measure {
  max-width: var(--measure);
}

.block-rich-text-centered {
  margin-inline: auto;
}
}

.site-badge {
  position: fixed;
  right: calc(12px + env(safe-area-inset-right, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 12px 6px 10px;
  border: 0;
  border-radius: 999px;
  background: #111317;
  color: #fff;
  font: 500 12.5px/1.2 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.site-badge:hover {
  color: #fff;
  text-decoration: none;
}

.site-badge:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow:
    0 0 0 4px #111317,
    0 2px 8px rgba(0, 0, 0, 0.3);
}

.site-badge svg {
  display: block;
  width: 14px;
  height: 14px;
  max-width: none;
  margin: 0;
  flex: none;
  fill: currentColor;
}

@media print {
  .site-badge {
    display: none;
  }
}
