/*
 * nowreading.dev — design foundation
 *
 * Editorial publishing meets precise developer tooling.
 * Three typographic roles: serif display, sans interface, mono protocol.
 * One warm paper surface, one rust accent, quiet warm neutrals.
 * All colors validated WCAG 2.2 AA against their surfaces.
 *
 * Naming: BEM (block__element--modifier).
 *
 *= require_self
 */

/* ---------------------------------------------------------------- tokens */

:root {
  /* Surfaces */
  --paper: #faf7f2;          /* page background — warm, not sterile */
  --paper-raised: #ffffff;   /* inputs, popovers */
  --paper-sunken: #f3eee5;   /* quiet wells */
  --ink-well: #211d16;       /* inverted surface for protocol blocks */

  /* Ink */
  --ink: #211d16;            /* 15.7:1 on paper */
  --ink-soft: #4a443a;       /* 9.0:1  on paper */
  --muted: #6e675c;          /* 5.2:1  on paper */
  --hairline: #e7e1d6;
  --hairline-strong: #cfc7b8;

  /* Accent — vermilion (2026-09-10: one notch more vibrant than the old rust
     #a6390f; still AA on paper and for white text on the accent) */
  --accent: #b4380d;         /* 5.6:1 on paper, 6.0:1 white-on-accent */
  --accent-hover: #8a2a09;
  --accent-wash: #f9e4d8;
  --on-accent: #ffffff;      /* text on the accent; flips to paper in dark mode */

  /* Semantic — reserved for real states */
  --success: #1f7a3c;        /* 5.0:1 on paper */
  --success-wash: #e4f3e8;
  --warning: #8a5f00;        /* 5.3:1 on paper */
  --warning-wash: #f9edd6;
  --error: #a8271d;
  --error-wash: #f9e9e7;

  /* Type */
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-md: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: 2.625rem;

  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-body: 1.55;

  /* Space — 4px scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Shape */
  --radius-sm: 3px;
  --radius-md: 6px;

  /* Elevation — used sparingly (popovers, toasts) */
  --shadow-pop: 0 1px 2px rgba(33, 29, 22, 0.06), 0 8px 24px rgba(33, 29, 22, 0.10);

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.6, 0.2, 1);
  --duration-fast: 120ms;
  --duration-base: 200ms;

  /* Measure */
  --measure: 44rem;          /* readable column */
  --measure-wide: 68rem;     /* marketing / two-column moments */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}

main { flex: 1 0 auto; }

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  line-height: var(--leading-tight);
  text-wrap: balance;
}

p { margin: 0 0 var(--space-4); }

/* Links are rust. Buttons are not links, even when they render as <a>
   (Poetry's button-styled anchors carry data-slot="button"); :where() keeps
   the specificity at a bare element selector so nothing else shifts. */
a:where(:not([data-slot="button"])) {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.2em;
}
a:where(:not([data-slot="button"])):hover { text-decoration: underline; }

code, kbd, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: var(--paper-sunken);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.35em;
}

pre {
  background: var(--ink-well);
  color: #f3eee5;
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  overflow-x: auto;
  line-height: 1.5;
}
pre code { background: none; padding: 0; color: inherit; }

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

::selection { background: var(--accent-wash); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Skip link */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100%;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
}
.skip-link:focus { top: var(--space-2); }

/* Layout containers */
.container {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--space-5);
}
.container--wide { max-width: var(--measure-wide); }

/* ---------------------------------------------------------------- header */

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

.site-header__inner {
  max-width: var(--measure-wide);
  margin-inline: auto;
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 3.25rem;
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.site-header__brand:hover { text-decoration: none; color: var(--accent); }
.site-header__logo { display: block; }
.site-header__logo path { fill: currentColor; }

.site-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}

.site-header__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
}
.site-header__link:hover {
  color: var(--ink);
  background: var(--paper-sunken);
  text-decoration: none;
}
.site-header__link[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.site-header__link--handle { font-family: var(--font-mono); font-size: var(--text-xs); }

/* Primary nav: inline on desktop, collapsed behind a menu button on mobile */
.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.site-header__nav { order: 1; }
.site-nav__cta { order: 2; margin-left: var(--space-2); }

.site-nav__toggle {
  order: 3;
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.site-nav__toggle:hover { color: var(--ink); background: var(--paper-sunken); }
/* Browsers don't apply the UA [hidden] rule to inline SVG children */
.site-nav__toggle svg[hidden] { display: none; }

@media (max-width: 720px) {
  .site-header { position: relative; }

  .site-nav__toggle { display: inline-flex; }

  .site-header__nav { display: none; }

  .site-header__nav--open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 60;
    margin: 0;
    padding: var(--space-2) var(--space-4) var(--space-4);
    background: var(--paper);
    border-bottom: 1px solid var(--hairline);
    box-shadow: var(--shadow-pop);
  }

  .site-header__nav--open .site-header__link {
    display: flex;
    width: 100%;
    min-height: 2.75rem;
    align-items: center;
    font-size: var(--text-base);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
  }

  .site-header__nav--open .site-header__link--handle { font-size: var(--text-sm); }

  .site-header__nav--open .site-header__link[aria-current="page"] {
    box-shadow: inset 3px 0 0 var(--accent);
    background: var(--paper-sunken);
  }
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--hairline);
  margin-top: var(--space-16);
  padding: var(--space-6) 0 var(--space-10);
  color: var(--muted);
  font-size: var(--text-sm);
}

.site-footer__inner {
  max-width: var(--measure-wide);
  margin-inline: auto;
  padding-inline: var(--space-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  align-items: baseline;
  justify-content: space-between;
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
}

.site-footer__link { color: var(--muted); }
.site-footer__link:hover { color: var(--ink); }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  padding: 0.625rem 1rem;
  min-height: 2.5rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}
.btn:hover { text-decoration: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: default; }

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn--primary:hover { background: var(--accent-hover); color: var(--on-accent); }

.btn--secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--hairline-strong);
}
.btn--secondary:hover { border-color: var(--ink-soft); background: var(--paper-raised); }

.btn--quiet {
  background: transparent;
  color: var(--ink-soft);
}
.btn--quiet:hover { color: var(--ink); background: var(--paper-sunken); }

.btn--danger {
  background: transparent;
  color: var(--error);
  border-color: transparent;
}
.btn--danger:hover { background: var(--error-wash); }

.btn--sm {
  font-size: var(--text-xs);
  padding: 0.375rem 0.625rem;
  min-height: 1.875rem;
}

/* Icon-only control */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out),
              background-color var(--duration-fast) var(--ease-out);
}
.icon-btn:hover { color: var(--ink); background: var(--paper-sunken); }
.icon-btn--danger:hover { color: var(--error); background: var(--error-wash); }
.icon-btn svg { display: block; }

/* ---------------------------------------------------------------- forms */

.field { margin-bottom: var(--space-5); }

.field__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-2);
}

.field__input,
.field__textarea,
.field__select {
  width: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.75rem;
  transition: border-color var(--duration-fast) var(--ease-out);
}
.field__input:focus,
.field__textarea:focus,
.field__select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.field__input[aria-invalid="true"],
.field__textarea[aria-invalid="true"] { border-color: var(--error); }

.field__input--mono { font-family: var(--font-mono); font-size: var(--text-sm); }

.field__hint {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: var(--space-2);
  margin-bottom: 0;
}

.field__error {
  font-size: var(--text-sm);
  color: var(--error);
  margin-top: var(--space-2);
  margin-bottom: 0;
}

.field__success {
  font-size: var(--text-sm);
  color: var(--success);
  margin-top: var(--space-2);
  margin-bottom: 0;
}

/* Accessible error summary (top of forms) */
.error-summary {
  border: 1px solid var(--error);
  border-left-width: 3px;
  background: var(--error-wash);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
}
.error-summary__title { font-size: var(--text-base); margin-bottom: var(--space-2); }
.error-summary ul { margin: 0; padding-left: var(--space-5); }

/* ---------------------------------------------------------------- flash */

.flash-container {
  position: fixed;
  top: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(26rem, calc(100vw - 2rem));
  pointer-events: none;
}

.flash {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--ink-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--ink);
  animation: flash-in var(--duration-base) var(--ease-out);
}

@keyframes flash-in {
  from { opacity: 0; transform: translateY(-0.5rem); }
  to   { opacity: 1; transform: none; }
}

.flash--notice  { border-left-color: var(--success); }
.flash--alert   { border-left-color: var(--error); }
.flash--warning { border-left-color: var(--warning); }

.flash__message { flex: 1; }

/* Poetry pins the action to the corner and reserves room with right padding,
   which .flash's own padding overrides. Lay both out in the flex row instead,
   so text can't run under the button. */
.flash > [data-slot="alert-description"] { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.flash > [data-slot="alert-action"] { position: static; flex: none; }

.flash__dismiss {
  border: none;
  background: none;
  color: var(--muted);
  font-size: var(--text-md);
  line-height: 1;
  padding: 0 var(--space-1);
  cursor: pointer;
}
.flash__dismiss:hover { color: var(--ink); }

/* ---------------------------------------------------------------- page headers */

.page-header { margin: var(--space-10) 0 var(--space-8); }

.page-header__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-2);
}

.page-header__title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 600;
}

.page-header__lede {
  color: var(--ink-soft);
  font-size: var(--text-md);
  margin-top: var(--space-3);
  max-width: 38rem;
}

/* ---------------------------------------------------------------- entries
   The shared article presentation primitive: an editorial list row used by
   the private library and the public reading profile. */

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--hairline);
}

turbo-frame { display: block; }

.entry {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--hairline);
}

.entry__body { flex: 1; min-width: 0; }

.entry__title-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.entry__title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: var(--leading-snug);
  margin: 0;
  overflow-wrap: anywhere;
  text-wrap: initial;
}

.entry__title a { color: var(--ink); }
.entry__title a:hover { color: var(--accent); text-decoration: underline; }

.entry__meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--muted);
}

.entry__source {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

.entry__meta-sep { color: var(--hairline-strong); }

.entry__summary {
  margin: var(--space-2) 0 0;
  color: var(--ink-soft);
  font-size: var(--text-base);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry__body { order: 1; }

.entry__thumb {
  flex: none;
  order: 2;
  width: 3.5rem;
  height: 3.5rem;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  margin-top: var(--space-1);
}

.entry__actions {
  flex: none;
  order: 3;
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

/* Reveal owner actions on interaction; always visible on touch devices */
@media (hover: hover) {
  .entry__actions .icon-btn { opacity: 0; transition: opacity var(--duration-fast) var(--ease-out); }
  .entry:hover .entry__actions .icon-btn,
  .entry:focus-within .entry__actions .icon-btn,
  .entry__actions .icon-btn:focus-visible { opacity: 1; }
}

/* Processing / draft state: the chip is Nowreading::Ui::Status now (see
   app/components/nowreading/ui/status); the row state lives on the Entry
   component's data-state. */

/* Keyword chips (expanded view) */
.keyword-chip {
  display: inline-block;
  font-size: var(--text-xs);
  color: var(--ink-soft);
  background: var(--paper-sunken);
  border-radius: 999px;
  padding: 0.125rem 0.625rem;
}

/* Expanded detail area inside an entry */
.entry__expanded {
  display: none;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--hairline);
}
.entry__expanded.visible { display: block; }

.entry-section { margin-bottom: var(--space-5); }
.entry-section:last-child { margin-bottom: 0; }

.entry-section__title {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-2);
}

.entry-section__content { color: var(--ink-soft); font-size: var(--text-base); }
.entry-section__content p { margin-bottom: var(--space-2); }

/* Summary read-more */
.summary-content {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.summary-content.expanded {
  display: block;
  -webkit-line-clamp: none;
  overflow: visible;
}
.summary-toggle { font-size: var(--text-sm); }

.entry__keywords {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Expand chevron rotates when open */
.entry__expand svg { transition: transform var(--duration-base) var(--ease-out); }
.entry__expand.active svg { transform: rotate(180deg); }

/* ---------------------------------------------------------------- empty states */

.empty-state {
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-md);
  padding: var(--space-10) var(--space-6);
  text-align: center;
  color: var(--ink-soft);
  margin: var(--space-8) 0;
}

.empty-state__title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  color: var(--ink);
  margin-bottom: var(--space-3);
}

.empty-state__body {
  max-width: 30rem;
  margin-inline: auto;
}

/* ---------------------------------------------------------------- capture */

/* URL + Save on the first row, the optional why line (#299a) under them. */
.capture {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  margin: var(--space-6) 0;
}
.capture > [type="submit"] { grid-column: 2; grid-row: 1; }
.capture__input.capture__why {
  grid-column: 1 / -1;
  font-family: var(--font-sans);
}

.capture__input {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.875rem;
}
.capture__input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.capture__input::placeholder { color: var(--muted); }

@media (max-width: 480px) {
  .capture { grid-template-columns: minmax(0, 1fr); }
  .capture > [type="submit"] { grid-column: 1; grid-row: auto; }
}

/* ---------------------------------------------------------------- follow / formats */

.follow { position: relative; display: inline-block; }

.follow__menu {
  position: absolute;
  left: 0;
  top: calc(100% + var(--space-2));
  max-width: calc(100vw - 2.5rem);
  z-index: 30;
  min-width: 17rem;
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: var(--space-2);
}

.follow__list { list-style: none; margin: 0; padding: 0; }

.follow__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: var(--text-sm);
}
.follow__item:hover { background: var(--paper-sunken); text-decoration: none; }

.follow__format {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

.follow__note {
  border-top: 1px solid var(--hairline);
  margin-top: var(--space-2);
  padding: var(--space-3) var(--space-3) var(--space-1);
  font-size: var(--text-xs);
  color: var(--muted);
}

/* ---------------------------------------------------------------- prose */

.prose {
  max-width: var(--measure);
  margin-inline: auto;
  padding: var(--space-10) var(--space-5) 0;
}

.prose h1 {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  margin-bottom: var(--space-4);
}

.prose h2 {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  margin: var(--space-8) 0 var(--space-3);
}

.prose__lede {
  font-size: var(--text-md);
  color: var(--ink-soft);
}

.prose ul { padding-left: var(--space-5); }
.prose li { margin-bottom: var(--space-2); }

.prose__footnote {
  margin-top: var(--space-10);
  padding-top: var(--space-4);
  border-top: 1px solid var(--hairline);
  font-size: var(--text-sm);
  color: var(--muted);
}

/* ---------------------------------------------------------------- code + copy */

.snippet { position: relative; margin: var(--space-4) 0; }

.snippet__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.snippet pre { margin: 0; font-size: var(--text-sm); }

.copy-confirm { color: var(--success); font-size: var(--text-xs); font-weight: 600; }
.copy-confirm--error { color: var(--error); }

/* ---------------------------------------------------------------- utilities */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.u-mono { font-family: var(--font-mono); }
.u-muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- mobile */

/* Sub-16px inputs trigger focus zoom on iOS; hold text inputs at 1rem. */
@media (max-width: 720px) {
  .field__input,
  .field__textarea,
  .field__select,
  .capture__input { font-size: 1rem; }

  .page-header { margin: var(--space-8) 0 var(--space-6); }

  .entry { padding: var(--space-4) 0; gap: var(--space-3); }
  .entry__thumb { width: 3rem; height: 3rem; }

  .prose { padding-top: var(--space-8); }
  .site-footer { margin-top: var(--space-12); }
}

/* Comfortable touch targets where hover doesn't exist */
@media (hover: none) {
  .icon-btn { width: 2.75rem; height: 2.75rem; }
  .btn--sm { min-height: 2.25rem; }
  .flash__dismiss { padding: var(--space-2) var(--space-3); }
}

/* ---------------------------------------------------------------- dark mode
   Added 2026-09-10 (Poetry spike). One block, same token names: every rule
   in this file and every Poetry component (through the token bridge) flips
   together. Poetry's color-scheme script stamps .dark on <html>. Contrast on
   the dark paper: ink 15.1:1, ink-soft 10.6:1, muted 6.3:1, accent 5.9:1. */

.dark {
  color-scheme: dark;
  --paper: #1b1815;
  --paper-raised: #242019;
  --paper-sunken: #15120f;
  --ink-well: #0f0d0b;

  --ink: #f1ece3;
  --ink-soft: #cfc7b8;
  --muted: #a39b8b;
  --hairline: #3a342c;
  --hairline-strong: #4d453a;

  --accent: #e8703f;         /* 5.74:1 on dark paper (5.26 raised, 6.06 sunken); paper on accent 5.74:1 */
  --accent-hover: #f0895f;
  --accent-wash: #3a2218;
  --on-accent: var(--paper); /* white on the dark accent is 3.1:1; paper is 5.7:1 */

  --success: #6fcf8a;
  --success-wash: #17301f;
  --warning: #e3b84a;
  --warning-wash: #332a12;
  --error: #f08a80;
  --error-wash: #3b1c19;

  --shadow-pop: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ---------------------------------------------------------------- triage
   Admin surfaces for bucketing requests into work items, and the public
   roadmap's changelog headings. */

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-5);
  font-size: var(--text-sm);
}

.admin-nav__link { color: var(--ink-soft); }
.admin-nav__link[aria-current="page"] { color: var(--ink); font-weight: 600; text-decoration: none; }

.triage-summary { color: var(--muted); font-size: var(--text-sm); }

.triage-bucket {
  margin-top: var(--space-8);
  padding: var(--space-5);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--paper-raised);
}

.triage-bucket__header { margin-bottom: var(--space-3); }

.triage-bucket__title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
}

.triage-bucket__demand {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: var(--space-1);
}

.triage-bucket__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.triage-bucket__suggestion {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  flex-basis: 100%;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--paper-sunken);
  font-size: var(--text-sm);
}

.triage-bucket__score { color: var(--muted); }

.triage-bucket__judgment {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: var(--space-1);
}

.triage-bucket__flag--warn { color: var(--warning); font-weight: 600; }

.triage-bucket__attach,
.relation-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.triage-bucket__attach-label { color: var(--muted); font-size: var(--text-sm); }

.relation-form { margin-top: var(--space-4); font-size: var(--text-sm); }

.review-panel {
  margin-top: var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  background: var(--paper-raised);
  max-width: 38rem;
}

.review-panel__lede { font-size: var(--text-base); overflow-wrap: anywhere; }

.review-panel__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.relation-list { list-style: none; margin: 0; padding: 0; }

.relation-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--hairline);
  font-size: var(--text-base);
}

.spec-evidence {
  margin-bottom: var(--space-8);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--paper-sunken);
  max-width: 36rem;
}

.spec-evidence__list {
  margin: var(--space-3) 0 var(--space-4) var(--space-5);
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.spec-evidence__list li { margin-bottom: var(--space-2); }

.changelog-month {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: var(--space-8) 0 var(--space-2);
}

/* ---------------------------------------------------------- livechat widget
   The gem styles #lvc-root from its own injected sheet (blue, plus a blue
   prefers-color-scheme block). `html #lvc-root` outranks both, so the
   launcher, header and visitor bubbles read the site accent and flip with
   .dark like everything else (ADR-008). */
html #lvc-root {
  --lvc-accent: var(--accent);
  --lvc-accent-text: var(--on-accent);
}
