/* The Branch Design System v1.0
   Component layer. Reads only from tokens.css. */

/* ===============================================================
   Base
   =============================================================== */
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* beats component display values */
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* Wrapped in :where() so these carry zero specificity. A component that sets
   its own colour (.btn, .badge) must never be repainted by an ambient link
   rule or by a context rule like `.some-nav a`. */
:where(a) { color: var(--blue); text-decoration: none; }
:where(a:hover) { color: var(--green); }
::selection { background: var(--gold); color: var(--ink); }

img { max-width: 100%; }

:where(button, a, input, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* ===============================================================
   Animation primitives
   =============================================================== */
@keyframes bpulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(1.35); } }
@keyframes bbar   { 0%, 100% { height: 18%; } 50% { height: 92%; } }
@keyframes bring  { to { transform: rotate(360deg); } }

/* Status is never animation-only: the pulse and the waveform hold still,
   the LIVE badge stays. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ===============================================================
   Typography primitives
   =============================================================== */
.display-xl,
.display-l,
.display-m,
.display-s {
  font-family: var(--font-display);
  font-weight: 400;
  margin: 0;
}
.display-xl { font-size: var(--size-display-xl); line-height: var(--lh-display-xl); letter-spacing: var(--ls-display-xl); }
.display-l  { font-size: var(--size-display-l);  line-height: var(--lh-display-l); }
.display-m  { font-size: var(--size-display-m);  line-height: var(--lh-display-m); }
.display-s  { font-size: 24px;                   line-height: 1.15; }

.heading { font-size: var(--size-heading); line-height: var(--lh-heading); font-weight: 700; letter-spacing: var(--ls-heading); margin: 0; }
.subhead { font-size: var(--size-subhead); line-height: var(--lh-subhead); font-weight: 500; color: var(--body); margin: 0; }
.body    { font-size: var(--size-body);    line-height: var(--lh-body);    color: var(--body); margin: 0; }
.fine    { font-size: var(--size-fine);    line-height: 1.6;               color: var(--muted); }
.mono    { font-family: var(--font-mono); font-size: 12px; }

/* Eyebrow: Helvetica Semibold · 11 · +20% tracking · caps */
.eyebrow {
  font-size: var(--size-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  font-weight: 600;
  color: var(--green);
}
.eyebrow--blue { color: var(--blue); }
.eyebrow--gold { color: var(--gold-ink); }
.eyebrow--muted { color: var(--muted); }
.eyebrow--gold-on-dark { color: var(--gold); }
.eyebrow--wide { letter-spacing: .18em; }

/* Section sub-label */
.label {
  font-size: var(--size-label);
  letter-spacing: var(--ls-label-tight);
  text-transform: uppercase;
  font-weight: 600;
  color: var(--faint);
}

.lede { font-size: var(--size-body); line-height: var(--lh-body); color: var(--body); max-width: var(--measure); margin: 24px 0 0; text-wrap: pretty; }

/* Gold underline marks every inline link. */
.link {
  font-size: var(--size-small);
  font-weight: 500;
  color: var(--blue);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.link:hover { color: var(--green); }

/* ===============================================================
   Shell
   =============================================================== */
.shell { display: flex; align-items: flex-start; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  flex: 0 0 var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 32px 28px 48px;
}
.sidebar__logo { width: 168px; display: block; }
.sidebar__version { margin-top: 10px; font-size: var(--size-label); letter-spacing: .18em; text-transform: uppercase; color: var(--faint); }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; margin-top: 36px; }
.sidebar__nav a:not(.btn) {
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--ink);
  transition: background var(--instant) var(--ease), color var(--instant) var(--ease);
}
.sidebar__nav a:not(.btn):hover,
.sidebar__nav a:not(.btn)[aria-current="true"] { background: var(--green-accent); color: var(--green); }
.sidebar__foot { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); font-size: var(--size-fine); line-height: 1.6; color: var(--muted); }
.sidebar__foot a { color: var(--blue); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }

.main { flex: 1 1 auto; min-width: 0; max-width: var(--main-max); padding: 0 0 160px; }

.section { padding: var(--section-gap) var(--gutter) 0; }
.section--first { padding-top: 96px; }
.section__head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}
.section__num { font-size: var(--size-label); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--faint); font-weight: 600; }

/* ===============================================================
   Layout helpers
   =============================================================== */
.split { display: grid; grid-template-columns: 2fr 1fr; gap: 56px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* An auto-fit grid whose 1px gap over a --line background draws the rules */
.hairline-grid {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.hairline-grid > * { background: var(--surface); }

.grid       { display: grid; gap: 16px; }
.grid--stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }  /* 4 stats = 1 row */
.grid--180  { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid--240  { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid--320  { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
/* Item counts are chosen to fill their tracks: a hairline grid with a partial
   last row would show the --line background as a bare block. */
.grid--icons { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 1px; }  /* 16 icons = 2 rows */
.grid--demo  { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; }  /* 4 families = 2 rows */
.grid--140  { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.grid--3    { grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid--logo { grid-template-columns: 2fr 1fr; gap: 24px; }
.grid--form { grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: start; }
.gap-24     { gap: 24px; }

.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-22 { margin-top: 22px; }
.mt-24 { margin-top: 24px; }
.mt-28 { margin-top: 28px; }
.mt-32 { margin-top: 32px; }
.mt-40 { margin-top: 40px; }
.mt-44 { margin-top: 44px; }
.mt-56 { margin-top: 56px; }
.mb-20 { margin-bottom: 20px; }

.tabs      { display: flex; gap: 8px; }
.demo-cell { padding: 36px; }
.note      { font-size: 14px; line-height: 1.6; color: var(--body); margin-top: 10px; }

/* ===============================================================
   Overview
   =============================================================== */
.pullquote {
  border-left: 2px solid var(--gold);
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--body);
}
.pullquote__title { font-weight: 600; color: var(--ink); }

.stat { padding: 24px; }
.stat__figure { font-family: var(--font-display); font-size: 34px; color: var(--green); }
.stat__label { margin-top: 6px; font-size: var(--size-fine); color: var(--muted); }

/* ===============================================================
   Logo
   =============================================================== */
.logo-stage {
  border: 1px solid var(--line);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--surface);
  transition: background var(--considered) var(--ease);
}
.logo-stage--dark { background: var(--green); }
.logo-stage img { display: block; }
.logo-stage__lockup { width: min(420px, 72%); }
.logo-stage__mark   { width: 180px; }

.tab {
  height: 38px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--body);
  font-family: inherit;
  font-size: var(--size-fine);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--considered) var(--ease),
              border-color var(--considered) var(--ease),
              color var(--considered) var(--ease);
}
.tab[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: var(--surface); }

.panel { border: 1px solid var(--line); background: var(--surface); padding: 28px; }
.panel--green { background: var(--green); }
.panel--green .panel__name { color: var(--surface); }
.panel--green .panel__note { color: var(--on-green); }
.panel__slot { height: 64px; display: flex; align-items: center; }
.panel__slot img { width: 100%; max-width: 220px; }
.panel__name { margin-top: 20px; font-size: var(--size-fine); font-weight: 600; }
.panel__note { font-size: var(--size-fine); color: var(--muted); margin-top: 4px; }
.panel--split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }

.never { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 18px; font-size: 14px; line-height: 1.6; color: var(--body); }

/* ===============================================================
   Colour
   =============================================================== */
.swatch {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  padding: 0;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color var(--considered) var(--ease);
}
.swatch:hover { border-color: var(--green); }
.swatch__chip { display: block; height: 132px; }
.swatch__meta { display: block; padding: 16px; }
.swatch__name { display: block; font-size: 14px; font-weight: 600; }
.swatch__hex  { display: block; font-size: var(--size-fine); color: var(--muted); margin-top: 3px; font-family: var(--font-mono); }

.swatch--sm { border: 0; background: transparent; }
.swatch--sm:hover { border: 0; }
.swatch--sm:hover .swatch__chip { border-color: var(--green); }
.swatch--sm .swatch__chip { height: 88px; border: 1px solid var(--line); transition: border-color var(--considered) var(--ease); }
.swatch--sm .swatch__meta { padding: 10px 0 0; }
.swatch--sm .swatch__name { font-size: var(--size-fine); }
.swatch--sm .swatch__hex  { font-size: 12px; margin-top: 0; }

.contrast { padding: 28px; }
.contrast__ratio { font-size: var(--size-label); letter-spacing: var(--ls-label-tight); text-transform: uppercase; opacity: .6; }
.contrast__title { font-family: var(--font-display); font-size: 26px; margin-top: 10px; }
.contrast__note  { font-size: 14px; margin-top: 8px; }
.contrast--green { background: var(--green); color: var(--surface); }
.contrast--green .contrast__ratio { opacity: .7; }
.contrast--green .contrast__note { color: var(--on-green); }
.contrast--gold  { background: var(--gold); color: var(--ink); }
.contrast--gold  .contrast__note { color: var(--gold-ink-strong); }
.contrast--tint  { background: var(--green-accent); color: var(--green-700); }
.contrast--tint  .contrast__note { color: var(--on-green-tint); }

/* ===============================================================
   Typography specimens
   =============================================================== */
.spec { border-top: 1px solid var(--line); margin-top: 40px; }
.spec__row {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 32px;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.spec__meta { font-size: 12px; line-height: 1.6; color: var(--muted); }
.spec__meta strong { display: block; font-weight: 600; color: var(--ink); font-size: var(--size-fine); }
.spec__sample--body { max-width: 62ch; }

.stack-card { border: 1px solid var(--line); background: var(--surface); padding: 20px; font-size: var(--size-fine); line-height: 1.7; color: var(--body); }
.stack-card__title { font-weight: 600; color: var(--ink); }
.stack-card code { font-family: var(--font-mono); font-size: 12px; display: block; margin-top: 8px; }

/* ===============================================================
   Iconography: single weight, 1.5px stroke, 24px box
   =============================================================== */
.icon-cell {
  padding: 22px 12px;
  text-align: center;
  color: var(--green);
  transition: background var(--instant) var(--ease);
}
.icon-cell:hover { background: var(--green-50); }
.icon-cell__name { margin-top: 12px; font-size: var(--size-label); color: var(--muted); }
.icon    { width: 24px; height: 24px; }
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 14px; height: 14px; }
[data-lucide] { stroke-width: 1.5; }

/* ===============================================================
   Buttons: 48px tall, 4px corners, hover darkens (no lift, no shadow)
   =============================================================== */
.btn {
  height: var(--btn-h);
  padding: 0 28px;
  border: 0;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--size-small);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background var(--considered) var(--ease),
              border-color var(--considered) var(--ease),
              color var(--considered) var(--ease);
}
.btn--primary   { background: var(--green); color: var(--surface); }
.btn--primary:hover { background: var(--green-700); }

.btn--secondary { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
.btn--secondary:hover { background: var(--blue); color: var(--surface); }

.btn--live      { background: var(--live); color: var(--surface); padding: 0 24px; }
.btn--live:hover { background: var(--live-hover); }

.btn--gold      { background: var(--gold); color: var(--ink); font-weight: 600; }
.btn--gold:hover { background: var(--gold-hover); color: var(--ink); }

.btn--sm        { height: var(--btn-h-sm); font-size: 14px; padding: 0 20px; }
.btn--lg        { height: var(--btn-h-lg); padding: 0 30px; }
.btn[disabled]  { background: var(--line); color: var(--disabled-ink); cursor: not-allowed; }
.btn[disabled]:hover { background: var(--line); }

.btn-icon {
  width: var(--control-h);
  height: var(--control-h);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background var(--considered) var(--ease),
              border-color var(--considered) var(--ease),
              color var(--considered) var(--ease);
}
.btn-icon:hover { background: var(--green); color: var(--surface); border-color: var(--green); }
.btn-icon--sm { width: 44px; height: 44px; }
.btn-icon--filled { width: 52px; height: 52px; border: 0; background: var(--green); color: var(--surface); }
.btn-icon--filled:hover { background: var(--green-700); }
.btn-icon--gold { border: 0; background: var(--gold); color: var(--ink); }
.btn-icon--gold:hover { background: var(--gold-hover); color: var(--ink); }

/* The live dot. Duplicated as a token-driven primitive so any surface can use it. */
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
  animation: bpulse 1.6s ease-in-out infinite;
}
.dot--sm { width: 7px; height: 7px; }
.dot--still { animation: none; }

/* ===============================================================
   Badges
   =============================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: var(--size-label);
  font-weight: 600;
  letter-spacing: var(--ls-badge);
  text-transform: uppercase;
  flex: 0 0 auto;
  white-space: nowrap;
}
.badge--live       { background: var(--live);         color: var(--surface); }
.badge--aletheia   { background: var(--green-accent); color: var(--green-700); }
.badge--paraklesis { background: var(--blue-100);     color: var(--blue); }
.badge--anapausis  { background: var(--gold-100);     color: var(--gold-ink); }
.badge--advance    { background: var(--ink);          color: var(--surface); }
.badge--offline    { background: var(--line);         color: var(--muted); }
.badge--offline .dot { background: var(--faint); animation: none; }
.badge--sm         { height: 26px; font-size: 10px; padding: 0 10px; }

/* Platform badges are neutral: square, outlined, sentence weight. */
.badge--platform {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  gap: 7px;
}

.badge-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ===============================================================
   Cards: 1px line, 4px radius, 4:5 media
   =============================================================== */
.card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  transition: border-color var(--considered) var(--ease);
}
.card:hover { border-color: var(--green); }

/* Service card: a standing rhythm */
.card--service { padding: 28px; }
.card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.card__name { font-family: var(--font-display); font-size: 30px; line-height: 1.1; }
.card__when { margin-top: 6px; }
.card__where {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.55;
  color: var(--body);
}
.card__where-icon { color: var(--green); flex: 0 0 auto; margin-top: 1px; }
.card__where-icon--blue { color: var(--blue); }

/* Event card: a dated occasion with artwork */
.card--event { overflow: hidden; }
.card__media { aspect-ratio: 4 / 5; overflow: hidden; background: var(--green-accent); }
.card__media--blue { background: var(--blue-100); }
.card__media--gold { background: var(--gold-100); }
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__body { padding: 20px; }
.card__title { font-family: var(--font-display); font-size: 22px; line-height: 1.15; margin-top: 8px; }
.card__meta { margin-top: 10px; font-size: var(--size-fine); color: var(--muted); }

/* Sermon card: a thing to play */
.card--sermon { display: flex; gap: 20px; padding: 20px; align-items: center; }
.card__thumb { flex: 0 0 96px; height: 96px; overflow: hidden; background: var(--green-accent); }
.card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__lines { flex: 1 1 auto; min-width: 0; }
.card__heading { font-size: 18px; font-weight: 600; line-height: 1.3; margin-top: 6px; }
.card__byline { margin-top: 6px; font-size: var(--size-fine); color: var(--muted); }

.card--playing { background: var(--ink); border-color: var(--ink); }
.card--playing:hover { border-color: var(--ink); }
.card--playing .card__thumb { background: var(--green-700); }
.card--playing .card__heading { color: var(--surface); }
.card--playing .card__byline { color: var(--on-ink); }

/* Media that failed to load falls back to a branded block, never a broken glyph. */
.card__media.is-missing,
.card__thumb.is-missing,
.shelf__art.is-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  font-size: var(--size-label);
  letter-spacing: var(--ls-label-tight);
  text-transform: uppercase;
  font-weight: 600;
  color: var(--green-700);
}
.card__media.is-missing::after,
.card__thumb.is-missing::after,
.shelf__art.is-missing::after { content: attr(data-fallback); }

/* ===============================================================
   Players
   =============================================================== */
.live-bar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 22px 28px;
}
.live-bar--on  { background: var(--ink); }
.live-bar--on  .live-bar__title { color: var(--surface); }
.live-bar--on  .live-bar__note  { color: var(--on-ink); }
.live-bar--off { background: var(--green-50); border: 1px solid var(--line); }
.live-bar--off .live-bar__note  { color: var(--muted); }
.live-bar__lines { flex: 1 1 auto; min-width: 0; }
.live-bar__title { font-size: 16px; font-weight: 600; }
.live-bar__note  { font-size: var(--size-fine); margin-top: 3px; }

/* Waveform */
.eq { display: flex; align-items: flex-end; gap: 3px; height: 28px; flex: 0 0 auto; }
.eq span { width: 3px; background: var(--gold); animation: bbar 1.1s ease-in-out infinite; }
.eq span:nth-child(1) { height: 40%; animation-delay: 0ms; }
.eq span:nth-child(2) { height: 70%; animation-delay: 90ms; }
.eq span:nth-child(3) { height: 30%; animation-delay: 180ms; }
.eq span:nth-child(4) { height: 85%; animation-delay: 270ms; }
.eq span:nth-child(5) { height: 50%; animation-delay: 360ms; }
.eq span:nth-child(6) { height: 75%; animation-delay: 450ms; }
.eq span:nth-child(7) { height: 35%; animation-delay: 540ms; }
.eq span:nth-child(8) { height: 65%; animation-delay: 630ms; }

/* Spotify shelf */
.shelf {
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  grid-template-columns: minmax(260px, 300px) 1fr;
}
.shelf__now { padding: 28px; border-right: 1px solid var(--line); background: var(--green-50); }
.shelf__art { aspect-ratio: 1; background: var(--green); position: relative; overflow: hidden; }
.shelf__art > img:not(.shelf__seal) { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .9; }
.shelf__seal { position: absolute; left: 16px; bottom: 16px; width: 44px; }
.shelf__transport { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.shelf__track { flex: 1 1 auto; min-width: 0; }
.shelf__bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.shelf__fill { height: 100%; background: var(--green); width: 0%; }
.shelf__times { display: flex; justify-content: space-between; margin-top: 8px; font-size: var(--size-label); color: var(--muted); font-family: var(--font-mono); }
.shelf__out { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; font-size: var(--size-fine); }
.shelf__list { padding: 12px 0; }
.shelf__note { padding: 16px 28px 8px; font-size: var(--size-fine); color: var(--muted); }

.ep-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px 28px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  transition: background var(--instant) var(--ease), border-color var(--instant) var(--ease);
}
.ep-row:hover { background: var(--green-50); }
.ep-row[aria-current="true"] { border-left-color: var(--green); background: var(--green-50); }
.ep-row__num   { flex: 0 0 28px; font-size: 12px; color: var(--faint); font-family: var(--font-mono); }
.ep-row__lines { flex: 1 1 auto; min-width: 0; }
.ep-row__title { display: block; font-size: var(--size-small); font-weight: 500; line-height: 1.35; }
.ep-row__meta  { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.ep-row__dur   { flex: 0 0 auto; font-size: 12px; color: var(--muted); font-family: var(--font-mono); }

/* ===============================================================
   Forms: 48px tall, 1px line that turns green on focus,
   labels above and always visible
   =============================================================== */
.form { border: 1px solid var(--line); background: var(--surface); padding: 36px; }
.form__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field + .field, .field-group + .field-group { margin-top: 20px; }
.form__pair > .field + .field { margin-top: 0; }

.field__label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--body);
}

.input, .textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: var(--size-small);
  color: var(--ink);
  outline: none;
  transition: border-color var(--instant) var(--ease);
}
.input { height: var(--control-h); padding: 0 14px; }
.textarea { padding: 14px; line-height: 1.55; resize: vertical; }
.input:hover, .textarea:hover { border-color: var(--line-hover); }
.input:focus, .textarea:focus { border-color: var(--green); outline: none; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input.is-error, .textarea.is-error { border-color: var(--live); }

.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 20px; font-size: 14px; line-height: 1.5; color: var(--body); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--green); flex: 0 0 auto; }

/* Select: never a native <select>. A button plus a menu we own. */
.select { position: relative; margin-top: 8px; }
.select__btn {
  width: 100%;
  height: var(--control-h);
  padding: 0 46px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: var(--size-small);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  transition: border-color var(--instant) var(--ease);
}
.select__btn:hover { border-color: var(--line-hover); }
.select__btn:focus,
.select__btn[aria-expanded="true"] { border-color: var(--green); }

/* The chevron sits in a 44px well behind a 1px rule. Value text never runs under it. */
.select__well {
  position: absolute;
  right: 1px; top: 1px; bottom: 1px;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--line-soft);
  color: var(--green);
  pointer-events: none;
}
.select__well svg { transition: transform var(--instant) var(--ease); }
.select__btn[aria-expanded="true"] ~ .select__well svg { transform: rotate(180deg); }

.select__menu {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-menu);
  padding: 6px;
  z-index: 30;
}
.select__menu[hidden] { display: none; }
.select__option {
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--size-small);
  cursor: pointer;
  color: var(--ink);
  transition: background var(--instant) var(--ease);
}
.select__option:hover { background: var(--green-50); }
.select__option[aria-selected="true"] { background: var(--green-accent); color: var(--green-700); font-weight: 500; }

/* Static select specimens */
.select-face {
  width: 100%;
  height: var(--control-h);
  padding: 0 46px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--size-small);
  color: var(--ink);
  display: flex;
  align-items: center;
}
.select-face--open     { border-color: var(--green); }
.select-face--disabled { background: var(--disabled-bg); color: var(--disabled-ink); }
.select-face--error    { border-color: var(--live); color: var(--disabled-ink); }
.select__well--disabled { color: var(--chevron-disabled); }
.select__well--error    { color: var(--live); }
.select-menu-static {
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-menu);
  padding: 6px;
}
.select-menu-static .select__option--hover { background: var(--green-50); }

/* Form states */
.state-error   { border: 1px solid var(--live); background: var(--surface); padding: 20px; }
.state-error__face { height: var(--control-h); margin-top: 8px; padding: 0 14px; border: 1px solid var(--live); border-radius: var(--radius); display: flex; align-items: center; font-size: var(--size-small); color: var(--ink); }
.state-error__msg  { margin-top: 10px; font-size: var(--size-fine); color: var(--live); }
.state-success { border: 1px solid var(--line); background: var(--green-accent); padding: 20px; }
.state-success__inner { display: flex; gap: 10px; align-items: flex-start; color: var(--green-700); font-size: 14px; line-height: 1.55; }

/* ===============================================================
   Navigation & footer
   =============================================================== */
.frame { border: 1px solid var(--line); background: var(--paper); }
.frame__note { padding: 20px 28px; font-size: var(--size-fine); color: var(--muted); }

.site-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}
.site-header__logo { width: 150px; }
.site-header__nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; justify-content: flex-end; }
.site-header__nav a:not(.btn) { font-size: 14px; font-weight: 500; color: var(--ink); transition: color var(--instant) var(--ease); }
.site-header__nav a:not(.btn):hover { color: var(--green); }
.site-header__cta { height: 42px; padding: 0 20px; font-size: 14px; gap: 8px; }

.site-header--mobile { height: var(--header-h-sm); padding: 0 18px; }
.site-header--mobile .site-header__logo { width: 120px; }
.site-header--mobile .btn { height: 40px; padding: 0 16px; font-size: var(--size-fine); }
.menu-btn {
  width: var(--control-h-sm); height: var(--control-h-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}

.site-footer { background: var(--ink); color: var(--surface); padding: 56px 48px; }
.site-footer__grid { display: grid; grid-template-columns: minmax(240px, 1.5fr) repeat(auto-fit, minmax(150px, 1fr)); gap: 32px; }
.site-footer__logo { width: 180px; }
.site-footer__address { margin-top: 18px; font-size: 14px; line-height: 1.6; color: var(--on-ink); max-width: 30ch; }
.site-footer__email { display: inline-block; margin-top: 14px; font-size: 14px; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; max-width: 100%; }
.site-footer__email:hover { color: var(--gold-hover); }
.site-footer__links { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; font-size: 14px; }
.site-footer__links a:not(.btn) { color: var(--surface); transition: color var(--instant) var(--ease); }
.site-footer__links a:not(.btn):hover { color: var(--gold); }
.site-footer__base { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--ink-line); display: flex; justify-content: space-between; gap: 16px; font-size: 12px; color: var(--ink-faint); }

/* ===============================================================
   Motion specimens
   =============================================================== */
.motion-tile { border: 1px solid var(--line); background: var(--surface); padding: 28px; cursor: pointer; }
.motion-tile__dur { font-family: var(--font-mono); font-size: 12px; opacity: .7; }
.motion-tile__name { font-size: 19px; font-weight: 600; margin-top: 10px; }
.motion-tile__note { font-size: 14px; line-height: 1.55; margin-top: 8px; opacity: .85; }
.motion-tile--instant    { transition: background var(--instant) var(--ease), color var(--instant) var(--ease); }
.motion-tile--instant:hover { background: var(--green); color: var(--surface); }
.motion-tile--considered { transition: background var(--considered) var(--ease), color var(--considered) var(--ease), border-color var(--considered) var(--ease); }
.motion-tile--considered:hover { background: var(--blue); color: var(--surface); border-color: var(--blue); }
.motion-tile--arriving   { overflow: hidden; transition: background var(--arriving) var(--ease), color var(--arriving) var(--ease), border-color var(--arriving) var(--ease); }
.motion-tile--arriving:hover { background: var(--gold); border-color: var(--gold); }

.colophon { margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }

/* Loading state: the logomark stands alone here */
.spinner { width: 28px; height: 28px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: bring 900ms linear infinite; }

/* ===============================================================
   Toast
   =============================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 50;
}
.toast[hidden] { display: none; }

/* ===============================================================
   Responsive
   =============================================================== */
@media (max-width: 1100px) {
  :root { --gutter: 40px; --section-gap: 88px; }
  .grid--icons { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; gap: 28px; }
  .shelf { grid-template-columns: 1fr; }
  .shelf__now { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 900px) {
  /* Column flex: stop align-items:flex-start from shrink-wrapping the panes
     to their max-content width, which would overflow the viewport. */
  .shell { flex-direction: column; align-items: stretch; }
  .main { width: 100%; }
  .sidebar {
    position: static;
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 20px 24px;
  }
  .sidebar__nav { flex-direction: row; flex-wrap: wrap; gap: 4px; margin-top: 20px; }
  .sidebar__foot { margin-top: 20px; padding-top: 16px; }
  .main { max-width: none; padding-bottom: 96px; }
  .display-xl { font-size: 48px; }
  .display-l  { font-size: 36px; }
  .display-m  { font-size: 30px; }
  .form__pair { grid-template-columns: 1fr; }
  .spec__row  { grid-template-columns: 1fr; gap: 12px; }
  .never, .grid--3 { grid-template-columns: 1fr; gap: 16px; }
  .grid--icons { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid--demo  { grid-template-columns: minmax(0, 1fr); }
  .grid--stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--logo, .grid--form, .panel--split { grid-template-columns: 1fr; gap: 24px; }
  .site-footer__grid { grid-template-columns: 1fr; }
  .live-bar { flex-wrap: wrap; gap: 16px; }
  .site-footer { padding: 40px 24px; }
  .site-footer__base { flex-direction: column; gap: 8px; }
}

@media (max-width: 560px) {
  :root { --gutter: 20px; }
  .grid--icons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--stats { grid-template-columns: minmax(0, 1fr); }
  .display-xl { font-size: 38px; }
  .card--sermon { flex-wrap: wrap; }
  .colophon { flex-direction: column; align-items: flex-start; }
}

/* Fallback label on reversed surfaces */
.card--playing .card__thumb.is-missing { color: var(--on-ink); }
.shelf__art.is-missing { color: var(--on-green); }
