/* ============================================================
   Panqui — UI component layer

   Components for the C "Soft Modern" + B center-spine system.
   Every brand color/spacing value comes from tokens.css custom
   properties — there are no raw hex palette or layout-spacing
   literals here. Remaining literals are structural (border
   widths, element dimensions, percentages, fr, 1px hairlines),
   not brand tokens.

   The Tribute state needs no per-component restyle: tokens.css
   re-scopes the variables under `.is-tribute`, and these
   components inherit the gentler palette. A few `.is-tribute`
   rules below add the extra whitespace and stilled motion.
   ============================================================ */

/* ============================================================
   BASE
   ============================================================ */
* {
  box-sizing: border-box;
}

/* The `hidden` attribute must always win. A component's own `display` rule
   (e.g. .offline-banner / .conn-note set display: flex) otherwise beats the UA
   `[hidden] { display: none }` rule, leaving JS-toggled elements — like the
   connectivity banner — stuck visible even when their controller hides them. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg-warm);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
.display {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--ink);
}

a {
  color: var(--coral-ink);
}

img {
  display: block;
  max-width: 100%;
}

input,
textarea,
select,
button {
  font-family: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible,
.seg-opt:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--r-field);
}

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

/* ============================================================
   ICON
   ============================================================ */
.ic {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  vertical-align: middle;
  fill: none;
}

/* ============================================================
   MASCOT + PEBBLE FRAMES (signature C)
   ============================================================ */
.dog {
  width: 44px;
  height: 44px;
  flex: none;
}

.pebble {
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-card);
}

.pebble img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blob-a {
  border-radius: var(--pebble-a);
}

.blob-b {
  border-radius: var(--pebble-b);
}

.blob-c {
  border-radius: var(--pebble-c);
}

/* ============================================================
   EYEBROW
   ============================================================ */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
  color: var(--coral-ink);
}

.eyebrow .ic {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

/* ============================================================
   BUTTONS  (primary / secondary / soft / text)
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.82em 1.45em;
  border: 0;
  border-radius: var(--r-pill);
  font-size: var(--fs-base);
  font-weight: var(--fw-heavy);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform var(--dur-base) var(--ease-standard),
    box-shadow var(--dur-base) var(--ease-standard),
    background var(--dur-base) var(--ease-standard);
}

.btn-primary {
  background: var(--coral-ink);
  color: var(--white);
  box-shadow: var(--shadow-pill);
}

.btn-primary:hover {
  background: var(--coral-deep);
  transform: translateY(-2px);
}

.btn-ghost {
  background: var(--white);
  color: var(--coral-ink);
  box-shadow: var(--shadow-card);
}

.btn-ghost:hover {
  transform: translateY(-2px);
}

.btn-soft {
  background: var(--peach-soft);
  color: var(--coral-ink);
}

/* On hover the surface deepens to --peach; --coral-ink on it is only 4.3:1,
   so the label deepens to --coral-deep to keep WCAG AA (≥5.6:1 on peach). */
.btn-soft:hover {
  background: var(--peach);
  color: var(--coral-deep);
}

.btn-sm {
  padding: 0.58em 1.05em;
  font-size: var(--fs-sm);
}

.btn-block {
  width: 100%;
}

.btn .ic {
  width: 1.15em;
  height: 1.15em;
}

@media (prefers-reduced-motion: reduce) {
  .btn:hover {
    transform: none;
  }
}

/* text button */
.linklike {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: var(--fs-base);
  font-weight: var(--fw-heavy);
  line-height: var(--lh-snug);
  color: var(--coral-ink);
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--dur-base) var(--ease-standard);
}

.linklike:hover {
  border-color: var(--coral-ink);
}

.linklike .ic {
  width: 1.05em;
  height: 1.05em;
}

/* ============================================================
   KIND CHIPS  (Milestone / Everyday / Vet visit)
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.32em 0.72em;
  border-radius: var(--r-pill);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-heavy);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
}

.chip-mile {
  background: var(--chip-mile-bg);
  color: var(--chip-mile-tx);
}

.chip-day {
  background: var(--chip-day-bg);
  color: var(--chip-day-tx);
}

.chip-vet {
  background: var(--chip-vet-bg);
  color: var(--chip-vet-tx);
}

/* ============================================================
   PILLS / BADGES
   ============================================================ */
.state-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  margin-bottom: var(--space-2);
  padding: 0.3em 0.7em;
  border-radius: var(--r-pill);
  background: var(--butter-soft);
  color: var(--coral-ink);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-heavy);
  box-shadow: var(--shadow-card);
}

.state-tag .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
}

.added-by {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.22em 0.6em;
  border-radius: var(--r-pill);
  background: var(--sage-soft);
  color: var(--chip-day-tx);
  font-size: var(--fs-xs);
}

.added-by .av {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
}

.pstatus {
  padding: 0.25em 0.6em;
  border-radius: var(--r-pill);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-heavy);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
}

.pstatus-joined {
  background: var(--chip-day-bg);
  color: var(--chip-day-tx);
}

.pstatus-pending {
  background: var(--butter);
  color: var(--chip-vet-tx);
}

/* photo-count + video badges sit over media */
.badge-count,
.badge-video {
  position: absolute;
  right: 9px;
  bottom: 9px;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.28em 0.65em;
  border-radius: var(--r-pill);
  background: var(--overlay);
  color: var(--on-media);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-heavy);
  backdrop-filter: blur(2px);
}

.badge-video {
  right: auto;
  left: 9px;
}

.badge-count .ic,
.badge-video .ic {
  width: 0.9em;
  height: 0.9em;
}

/* ============================================================
   AVATAR
   ============================================================ */
.ava {
  width: 84px;
  height: 84px;
  flex: none;
  border: 5px solid var(--white);
}

.av {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
}

/* ============================================================
   CARDS + HEADS
   ============================================================ */
.card {
  padding: var(--space-6) var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.card + .card {
  margin-top: var(--space-4);
}

.card-soft {
  border-color: transparent;
  background: var(--peach-soft);
  box-shadow: none;
}

.card h2 {
  font-size: var(--fs-xl);
}

.lead {
  margin: var(--space-2) 0 0;
  color: var(--muted);
}

.hint {
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}

.page-head {
  margin-bottom: var(--space-6);
  text-align: center;
}

.page-head h1 {
  font-size: var(--fs-display);
}

.page-head p {
  max-width: 46ch;
  margin: var(--space-2) auto 0;
  color: var(--muted);
}

/* Journal header — shared by the living timeline and the Tribute */
.jhead {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-7);
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.jhead .ava {
  width: 84px;
  height: 84px;
}

.jhead .who {
  flex: 1 1 200px;
  min-width: 0;
}

.jhead h1 {
  font-size: var(--fs-title);
}

.jhead .sub {
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

.jhead .actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  width: 100%;
}

/* the primary management buttons share the row and fill the width */
.jhead .actions > .btn {
  flex: 1 1 auto;
}

/* kebab for the quieter / state-transition actions, pinned to the card's
   top-right corner. The compound selector beats ui.css `.menu { relative }`. */
.jhead .jhead__more {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 5;
}

.jhead__more .menu__trigger {
  width: 40px;
  height: 40px;
  border-color: transparent;
  background: transparent;
}

.lifespan {
  font-weight: var(--fw-heavy);
}

/* ============================================================
   FORM FIELDS
   ============================================================ */
.field {
  margin-bottom: var(--space-4);
}

.field > label,
.label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-heavy);
}

.input,
.textarea,
select.input {
  width: 100%;
  padding: 0.8em 0.95em;
  border: 1.5px solid var(--line-deep);
  border-radius: var(--r-field);
  background: var(--white);
  color: var(--ink);
  font-size: var(--fs-base);
  transition:
    border-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard);
}

/* Only <select> gets the custom chevron (and drops the inconsistent native
   arrow). Text/date/textarea inputs keep their native affordances. */
select.input {
  padding-right: 2.6em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e625c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.95em center;
  background-size: 1.05em;
  appearance: none;
  -webkit-appearance: none;
}

.input:focus,
.textarea:focus,
select.input:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--peach);
}

.textarea {
  min-height: 84px;
  line-height: var(--lh-snug);
  resize: vertical;
}

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

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

/* file upload field (avatar, and later media pickers) */
.file-input {
  display: block;
  width: 100%;
  color: var(--ink-soft);
  font-size: var(--fs-sm);
}

.file-input::file-selector-button {
  margin-right: var(--space-3);
  padding: 0.5em 1.1em;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--peach-soft);
  color: var(--coral-ink);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-heavy);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard);
}

/* Deepen the label with the surface so it clears WCAG AA on --peach (4.3:1
   with --coral-ink); mirrors .btn-soft:hover. */
.file-input::file-selector-button:hover {
  background: var(--peach);
  color: var(--coral-deep);
}

.file-input.has-error::file-selector-button {
  background: var(--peach);
  color: var(--coral-deep);
  box-shadow: inset 0 0 0 1.5px var(--coral-ink);
}

/* avatar preview that sits above a file field in a form */
.form-avatar {
  display: grid;
  place-items: center;
  margin-bottom: var(--space-3);
  background: var(--peach-soft);
}

/* ============================================================
   SEGMENTED CONTROL
   ============================================================ */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: var(--space-1);
  border-radius: var(--r-pill);
  background: var(--peach-soft);
}

.seg-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.5em 1em;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-heavy);
  text-decoration: none;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard);
}

.seg-opt .ic {
  width: 1.05em;
  height: 1.05em;
}

/* aria-pressed marks a toggle button; aria-current marks the active link in a
   navigational segmented control (e.g. the Journal timeline's kind filter). */
.seg-opt[aria-pressed="true"],
.seg-opt[aria-current="page"] {
  background: var(--white);
  color: var(--coral-ink);
  box-shadow: var(--shadow-card);
}

/* ============================================================
   LANGUAGE TOGGLE (issue 13, ADR-0007)
   A compact segmented control reused in the marketing bar, the
   app headers, and the sign-in / sign-up pages. Only the compact
   sizing and the uppercase locale code live here; the pressed
   (aria-current) styling and focus ring come from .seg-opt.
   ============================================================ */
.locale-switch .seg {
  flex-wrap: nowrap;
  padding: 3px;
  gap: 2px;
}

.locale-switch .seg-opt {
  padding: 0.35em 0.7em;
  font-size: var(--fs-2xs);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  text-decoration: none;
}

/* ---- sign-in / sign-up top row (brand + language toggle) ---- */
.auth-top {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

/* the brand owns its own spacing on its own; inside the row the row owns it */
.auth-top .auth-brand {
  margin-bottom: 0;
}

/* ============================================================
   HEADER DISCLOSURE MENU  (burger on small screens, inline on wide)

   Progressive enhancement: the `menu` Stimulus controller adds `.js-menu`
   on connect, so without JS the trigger stays hidden and the panel renders
   inline (every control still reachable). Escape / outside-click close it.
   ============================================================ */
.menu {
  position: relative;
}

.menu__trigger {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--line-deep);
  border-radius: var(--r-field);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

.menu__panel {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

@media (max-width: 759px) {
  .menu.js-menu .menu__trigger {
    display: inline-grid;
  }

  .menu.js-menu .menu__panel {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    z-index: 60;
    flex-direction: column;
    align-items: center;
    min-width: 220px;
    padding: var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    background: var(--card);
    box-shadow: var(--shadow-card);
  }

  .menu.js-menu:not(.is-open) .menu__panel {
    display: none;
  }
}

/* Always-dropdown variant (e.g. a card kebab): trigger + popover at every
   width, regardless of the responsive collapse above. */
.menu--pop.js-menu .menu__trigger {
  display: inline-grid;
}

.menu--pop.js-menu .menu__panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 60;
  flex-direction: column;
  align-items: stretch;
  min-width: 180px;
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.menu--pop.js-menu:not(.is-open) .menu__panel {
  display: none;
}

/* dropdown menu items (links / form buttons inside a .menu__panel) */
.menu__item {
  display: flex;
  align-items: center;
  gap: 0.5em;
  width: 100%;
  padding: 0.5em 0.7em;
  border: 0;
  border-radius: var(--r-field);
  background: transparent;
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  white-space: nowrap;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu__item:hover {
  background: var(--peach-soft);
  color: var(--coral-ink);
}

.menu__item--danger {
  color: var(--coral-ink);
}

.menu__item .ic {
  width: 1.05em;
  height: 1.05em;
}

.menu__panel form {
  margin: 0;
}

/* ============================================================
   APP HEADER  (shared white bar: brand + session menu)
   The inner row tracks --page-width so the brand/controls line up with
   each page's content wrap (dashboard 940, journal 760, ...).
   ============================================================ */
.app-bar {
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.app-bar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  max-width: var(--page-width, 940px);
  margin: 0 auto;
  padding: var(--space-3) var(--space-5);
}

.app-bar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--ink);
  text-decoration: none;
}

.app-bar__brand .dog {
  width: 34px;
  height: 34px;
}

.app-bar__wordmark b {
  font-weight: var(--fw-bold);
}

/* ============================================================
   EXPLAINER ROW + MODERATION NOTICE
   ============================================================ */
.explain {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.explain .ibox {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: var(--r-field);
  background: var(--butter-soft);
  box-shadow: var(--shadow-card);
}

.explain .ibox .ic {
  width: 24px;
  height: 24px;
  color: var(--coral-ink);
}

.explain h3 {
  margin-bottom: var(--space-1);
  font-size: var(--fs-md);
}

.explain p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-base);
}

.modnote {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-field);
  background: var(--sage-soft);
  color: var(--chip-day-tx);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

.modnote .ic {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 0.1em;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  z-index: 1300;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.8em 1.2em;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--white);
  font-weight: var(--fw-heavy);
  box-shadow: var(--shadow-toast);
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
  transition:
    opacity var(--dur-slow) var(--ease-standard),
    transform var(--dur-slow) var(--ease-standard);
}

.toast .ic {
  width: 1.1em;
  height: 1.1em;
  color: var(--blush);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .toast.show {
    transform: translateX(-50%);
  }
}

/* ============================================================
   CONNECTIVITY (offline banner + authoring note) — issue 12
   ============================================================ */

/* App-wide strip shown while the browser is offline. Ink-on-white reads as a
   calm system notice, not an alarm; [hidden] keeps it out of the flow online. */
.offline-banner {
  position: sticky;
  top: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: var(--space-2) var(--space-4);
  background: var(--ink);
  color: var(--white);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  text-align: center;
}

.offline-banner .ic {
  flex: none;
  width: 1.1em;
  height: 1.1em;
  color: var(--blush);
}

/* Inline note beside an authoring action that needs the network. The copy wraps
   (longer in ES), so the icon aligns to the first line, not the block centre. */
.conn-note {
  display: flex;
  align-items: flex-start;
  gap: 0.55em;
  margin: 0 0 var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-field);
  background: var(--butter-soft);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

.conn-note .ic {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  margin-top: 0.1em;
  color: var(--coral-ink);
}

/* ============================================================
   MOMENT CARD
   ============================================================ */
.m-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

/* chip + kebab share the body's top row, so the menu never covers the photo.
   Clipping lives on .m-photo, so the dropdown can still escape the card. */
.m-body__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.m-body__top .chip {
  margin-bottom: 0;
}

.m-card__more .menu__trigger {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.m-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--r-card) var(--r-card) 0 0;
  background: var(--peach-soft);
}

.m-photo img,
.m-photo video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* the served 720p rendition; black letterbox behind it reads as intentional */
.m-photo video {
  display: block;
  background: var(--media-letterbox);
}

.m-body {
  padding: var(--space-4);
}

.m-body h3 {
  margin: var(--space-2) 0 var(--space-1);
  font-size: var(--fs-md);
}

.m-cap {
  margin: 0;
  color: var(--ink-soft);
  font-size: var(--fs-base);
}

.m-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em 0.8em;
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}

.m-meta .date {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.m-meta .ic {
  width: 1em;
  height: 1em;
}

/* video PROCESSING / FAILED states on a Moment's media */
.m-photo.processing img {
  filter: blur(3px) brightness(0.7);
  transform: scale(1.04);
}

.m-photo.failed img {
  filter: grayscale(0.5) brightness(0.55);
}

.proc {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-2);
  padding: var(--space-3);

  /* scrim so the white processing/failed copy keeps AA contrast over any
     poster — or none (the light --peach-soft fallback) */
  background: var(--overlay);
  color: var(--on-media);
  text-align: center;
}

.proc .spinner {
  width: 34px;
  height: 34px;
  border: 4px solid var(--on-media-faint);
  border-top-color: var(--on-media);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.proc .ptxt {
  font-size: var(--fs-sm);
  font-weight: var(--fw-heavy);
}

.proc .psub {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  opacity: 0.85;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .proc .spinner {
    animation: none;
    border-top-color: var(--on-media-faint);
  }
}

/* ============================================================
   CENTER-SPINE TIMELINE  (B's structure, C's clothing)
   ============================================================ */
.spine {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-2) 0;
}

.spine::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 50%;
  width: 5px;
  border-radius: 5px;
  background: linear-gradient(var(--peach), var(--coral) 45%, var(--peach));
  transform: translateX(-2.5px);
}

.mrow {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: clamp(var(--space-7), 5vw, var(--space-10));
  align-items: center;
  margin-bottom: clamp(var(--space-7), 5vh, var(--space-9));
}

.mrow:last-child {
  margin-bottom: 0;
}

.mrow > .m-card {
  grid-column: 1;
}

.mrow:nth-child(even) > .m-card {
  grid-column: 2;
}

/* node on the spine */
.mrow::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 20px;
  height: 20px;
  border: 5px solid var(--coral);
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-card);
  transform: translate(-50%, -50%);
}

/* gentle remembrance end-cap (Tribute) */
.spine-end {
  position: relative;
  margin-top: var(--space-7);
  padding-top: var(--space-2);
  color: var(--muted);
  font-weight: var(--fw-bold);
  text-align: center;
}

.spine-end .leafwrap {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 auto var(--space-3);
  border-radius: 50%;
  background: var(--sage-soft);
}

.spine-end .leafwrap .ic {
  width: 24px;
  height: 24px;
}

/* collapse the spine to a single left rail on narrow screens */
@media (max-width: 640px) {
  .spine {
    max-width: none;
  }

  .spine::before {
    left: 21px;
    transform: none;
  }

  .mrow {
    grid-template-columns: 1fr;
    padding-left: var(--space-9);
    margin-bottom: var(--space-6);
  }

  .mrow > .m-card,
  .mrow:nth-child(even) > .m-card {
    grid-column: 1;
  }

  .mrow::after {
    top: 34px;
    left: 21px;
    transform: translate(-50%, 0);
  }
}

/* ============================================================
   GROUPED TIMELINE  (the data-backed Journal view)

   A single-column, date-grouped stack of Moment cards — the
   layout the real Journal timeline uses (the center-spine above
   is the showcase variant). Mobile-first; survives long ES
   month labels; reuses the .m-card / .chip / .badge primitives.
   ============================================================ */
.tl {
  max-width: 640px;
  margin: 0 auto;
}

.tl-group + .tl-group {
  margin-top: var(--space-7);
}

/* the month/year chapter heading that opens each date group */
.tl-date {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: var(--space-4);
  padding: 0.3em 0.85em;
  border-radius: var(--r-pill);
  background: var(--butter-soft);
  color: var(--coral-ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-heavy);
  box-shadow: var(--shadow-card);
}

.tl-date .ic {
  width: 1.05em;
  height: 1.05em;
}

.tl-list {
  display: grid;
  gap: var(--space-5);
}

/* ============================================================
   FLASH BANNERS  (notice / alert)
   ============================================================ */
.flash {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-field);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

.flash .ic {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 0.1em;
}

.flash-notice {
  background: var(--sage-soft);
  color: var(--chip-day-tx);
}

.flash-alert {
  background: var(--peach-soft);
  color: var(--coral-ink);
}

/* ============================================================
   FORM ERROR SUMMARY  (validation errors above a form)
   ============================================================ */
.form-errors {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-field);
  background: var(--peach-soft);
  color: var(--coral-ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

.form-errors h2 {
  margin-bottom: var(--space-1);
  font-size: var(--fs-sm);
  color: var(--coral-ink);
}

.form-errors ul {
  margin: 0;
  padding-left: 1.2em;
}

.input.has-error {
  border-color: var(--coral-ink);
}

/* ============================================================
   AUTH SHELL  (centered sign-in / sign-up screens)
   ============================================================ */
.auth {
  display: grid;
  place-items: start center;
  min-height: 100dvh;
  padding: var(--space-9) var(--space-4);
  background: var(--bg-warm);
}

.auth-inner {
  width: 100%;
  max-width: 26rem;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  margin-bottom: var(--space-6);
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--ink);
  text-decoration: none;
}

.auth-brand .dog {
  width: 36px;
  height: 36px;
}

/* a "back" link above the card on authenticated form screens */
.auth-back {
  margin-bottom: var(--space-4);
}

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

.auth-head h1 {
  font-size: var(--fs-2xl);
}

.auth-head p {
  margin-top: var(--space-2);
  color: var(--muted);
}

.auth-actions {
  margin-top: var(--space-5);
}

.auth-alt {
  margin-top: var(--space-5);
  color: var(--muted);
  font-size: var(--fs-sm);
  text-align: center;
}

.auth-alt a {
  font-weight: var(--fw-heavy);
}

/* ============================================================
   TRIBUTE — same shell, gently transformed.
   (Palette is re-scoped in tokens.css; here we add the extra
   whitespace, the calmer spine, the receding mascot, and the
   stilled motion.)
   ============================================================ */
.is-tribute .dog {
  filter: saturate(0.45) opacity(0.85);
}

.is-tribute .jhead {
  gap: var(--space-5);
  padding: var(--space-6);
}

.is-tribute .spine {
  padding: var(--space-3) 0;
}

.is-tribute .mrow {
  margin-bottom: clamp(var(--space-8), 7vh, var(--space-10));
}

.is-tribute .spine::before {
  background: linear-gradient(var(--sage), var(--coral) 50%, var(--sage));
}
