/* ==========================================================================
   Prototype chrome — device frames, prototype bar, toaster, tour.
   Structural, brand-neutral. Copy into <POC>/assets/css/components.css and
   re-skin with the project's tokens. Requires the token contract.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Phone. A fixed 390x844 canvas scaled to always fit the viewport, so the
   whole device is visible without scrolling the browser. On a real handset
   the frame disappears and the app fills the screen.
   -------------------------------------------------------------------------- */
.phone-stage {
  --phone-fit: 1;
  height: 100dvh; overflow: hidden;
  display: grid; grid-template-columns: auto; place-content: center; place-items: center;
  column-gap: var(--s-10);
  padding: var(--s-4) var(--gutter) calc(var(--pocbar-h) + var(--s-4));
  background: var(--surface-2);
}
.phone {
  position: relative; flex: none;
  width: 390px; height: 844px;
  transform: scale(var(--phone-fit)); transform-origin: center;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  border: 10px solid #15130f; border-radius: 46px;
  box-shadow: 0 40px 80px -20px rgb(0 0 0 / 0.35), 0 0 0 1px rgb(0 0 0 / 0.08);
  overflow: hidden;
}
.phone::before {                      /* notch */
  content: ''; position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  width: 120px; height: 34px; background: #15130f; border-radius: 20px; z-index: 5;
}
.phone-status {
  display: flex; align-items: center; justify-content: space-between;
  height: 54px; padding: 12px 28px 0; font-size: var(--t-14); font-weight: 600; flex: none;
}
.phone-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-width: none; position: relative; display: flex; flex-direction: column;
}
.phone-scroll::-webkit-scrollbar { display: none; }
.phone-scroll > * { flex-shrink: 0; }   /* or horizontal card rows collapse */
.phone-tabbar {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: 84px; padding: 8px 8px 24px; flex: none;
  border-top: 1px solid var(--line); background: var(--surface);
}
.phone-tabbar a {
  position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  border-radius: var(--r-ctl); min-height: 44px; text-decoration: none;
}
.phone-tabbar a .ico { width: 24px; height: 24px; }
.phone-tabbar a[aria-current="page"] { color: var(--primary); }
.phone-home {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  width: 134px; height: 5px; border-radius: 3px; background: var(--ink); opacity: .9; z-index: 4;
}
.phone { --app-gutter: var(--s-4); }

/* The narration column beside the device: what this screen proves. */
.phone-caption {
  display: none; align-self: center; max-width: 34ch; text-align: left;
  font-size: var(--t-14); line-height: 1.55; color: var(--ink-2);
}
.phone-caption strong {
  display: block; color: var(--ink); font-family: var(--font-display);
  font-size: var(--t-18); font-weight: 600; margin-bottom: var(--s-2);
}
@media (min-width: 1100px) {
  .phone-stage { grid-template-columns: auto minmax(260px, 34ch); }
  .phone-caption { display: block; }
}

/* Step the scale down so the device always fits the window height. */
@media (max-height: 940px) { .phone-stage { --phone-fit: .95; } }
@media (max-height: 880px) { .phone-stage { --phone-fit: .90; } }
@media (max-height: 820px) { .phone-stage { --phone-fit: .84; } }
@media (max-height: 770px) { .phone-stage { --phone-fit: .78; } }
@media (max-height: 700px) { .phone-stage { --phone-fit: .72; } }
@media (max-height: 640px) { .phone-stage { --phone-fit: .66; } }

/* On an actual handset the app IS the page. The frame, notch, status bar and
   home indicator disappear; the app fills the screen minus the prototype bar. */
@media (max-width: 600px) {
  .phone-stage { --phone-fit: 1; padding: 0; height: 100dvh; grid-template-columns: 1fr; background: var(--bg); }
  .phone { width: 100%; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; transform: none; }
  .phone::before, .phone-status, .phone-home { display: none; }
  .phone-caption { display: none; }
  /* The bar is fixed over the viewport, so the app must give up its height or
     the tab bar hides behind it. */
  body.has-pocbar .phone-stage,
  body.has-pocbar .phone { height: calc(100dvh - var(--pocbar-h)); }
  .phone-tabbar { padding-bottom: 8px; height: 64px; }
}

/* --------------------------------------------------------------------------
   Tablet — staff-facing landscape surfaces (kitchen display, POS, field app).
   -------------------------------------------------------------------------- */
.tablet-stage {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-4);
  padding: var(--s-8) var(--gutter) calc(var(--pocbar-h) + var(--s-10));
  min-height: 100dvh; background: var(--surface-3);
}
.tablet {
  --tablet-fit: 1;
  position: relative; width: 1024px; height: 768px;
  transform: scale(var(--tablet-fit)); transform-origin: top center;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); border: 12px solid #15130f; border-radius: 28px;
  box-shadow: 0 40px 80px -24px rgb(0 0 0 / 0.35);
}
.tablet-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 1140px) { .tablet-stage { --tablet-fit: .82; } }
@media (max-width: 940px)  { .tablet-stage { --tablet-fit: .66; } }
@media (max-width: 760px)  { .tablet-stage { --tablet-fit: .50; } }

/* --------------------------------------------------------------------------
   Bottom sheet — the mobile-native alternative to a modal.
   -------------------------------------------------------------------------- */
.sheet-scrim {
  position: absolute; inset: 0; z-index: var(--z-layer);
  background: rgb(0 0 0 / 0.4); opacity: 0; pointer-events: none;
  transition: opacity var(--dur-2) var(--ease);
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: calc(var(--z-layer) + 1);
  max-height: 82%; display: flex; flex-direction: column;
  background: var(--bg); border-radius: var(--r-lg) var(--r-lg) 0 0;
  transform: translateY(100%); transition: transform var(--dur-3) var(--ease-out);
}
.sheet::before {
  content: ''; width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong);
  margin: 10px auto 2px; flex: none;
}
.sheet-body { overflow-y: auto; padding: var(--s-4) var(--app-gutter) var(--s-6); }
.layer-open .sheet-scrim { opacity: 1; pointer-events: auto; }
.layer-open .sheet { transform: translateY(0); }

/* In-frame push notification — lands every time in a demo. */
.push {
  position: absolute; left: 8px; right: 8px; top: 58px; z-index: var(--z-toast);
  display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4);
  background: var(--bg); border-radius: var(--r-card); box-shadow: var(--e-3);
  transform: translateY(-140%); transition: transform var(--dur-3) var(--ease-out);
}
.push.in { transform: translateY(0); }

/* --------------------------------------------------------------------------
   Prototype bar — the client's remote control, on every page.
   -------------------------------------------------------------------------- */
.pocbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-pocbar);
  height: var(--pocbar-h); display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-4); font-size: var(--t-12);
  background: var(--drench); color: var(--on-drench);
  box-shadow: 0 -4px 20px rgb(0 0 0 / 0.2);
}
.pocbar .tagword {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em;
  color: var(--accent); font-weight: 500;
}
.pocbar .roles { display: flex; gap: 2px; }
.pocbar .roles a {
  padding: 4px 10px; border-radius: var(--r-full); color: var(--on-drench-muted);
  text-decoration: none; white-space: nowrap;
}
.pocbar .roles a:hover { color: var(--on-drench); background: var(--drench-2); }
.pocbar .roles a[aria-current="true"] { background: var(--primary); color: var(--on-primary); }
.pocbar .mods { display: flex; gap: 4px; }
.pocbar .tag-module {
  font-family: var(--font-mono); font-size: 10px; padding: 2px 6px;
  border: 1px solid var(--drench-line); border-radius: var(--r-full);
  color: var(--on-drench-muted); text-decoration: none;
}
.pocbar .spacer { flex: 1; }
.pocbar button.link {
  background: none; border: 0; color: var(--on-drench-muted);
  font: inherit; cursor: pointer; padding: 4px 6px; white-space: nowrap;
}
.pocbar button.link:hover { color: var(--on-drench); }
body.has-pocbar { padding-bottom: 0; }
@media (max-width: 720px) {
  .pocbar .hide-sm { display: none; }
  /* Never let the bar clip its own controls: let it scroll instead. */
  .pocbar { overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .pocbar::-webkit-scrollbar { display: none; }
  .pocbar > * { flex: none; }
  .pocbar .spacer { flex: 1 0 var(--s-4); }
}
@media (max-width: 420px) { .pocbar .tagword { display: none; } }

/* Module map overlay: outlines the elements proving each module. */
body.show-sow [data-module] { outline: 1px dashed var(--accent-strong); outline-offset: 2px; position: relative; }
body.show-sow [data-module]::after {
  content: attr(data-module); position: absolute; top: -8px; right: -6px; z-index: 2;
  font-family: var(--font-mono); font-size: 9px; line-height: 1;
  padding: 3px 5px; border-radius: var(--r-full);
  background: var(--accent); color: var(--on-accent);
}

/* --------------------------------------------------------------------------
   Toaster
   -------------------------------------------------------------------------- */
.toaster {
  position: fixed; right: var(--s-4); bottom: calc(var(--pocbar-h) + var(--s-4));
  z-index: var(--z-toast); display: flex; flex-direction: column-reverse;
  gap: var(--s-2); pointer-events: none;
}
body:not(.has-pocbar) .toaster { bottom: var(--s-4); }
.toast {
  max-width: 42ch; padding: var(--s-3) var(--s-4);
  background: var(--drench); color: var(--on-drench);
  border-radius: var(--r-ctl); box-shadow: var(--e-3);
  font-size: var(--t-14); animation: toast-in var(--dur-3) var(--ease-out);
}
.toast.ok { background: var(--success); } .toast.warn { background: var(--warning); color: var(--on-accent); }
.toast.err { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Guided tour
   -------------------------------------------------------------------------- */
.tour-scrim { position: fixed; inset: 0; z-index: var(--z-tour); background: rgb(0 0 0 / 0.55); }
.tour-hole { position: fixed; z-index: calc(var(--z-tour) + 1); border-radius: var(--r-card);
  box-shadow: 0 0 0 9999px rgb(0 0 0 / 0.55), 0 0 0 3px var(--accent); pointer-events: none; }
.tour-pop {
  position: fixed; z-index: calc(var(--z-tour) + 2); max-width: 34ch;
  padding: var(--s-4); background: var(--bg); color: var(--ink);
  border-radius: var(--r-card); box-shadow: var(--e-3);
}
.tour-pop .step { font-family: var(--font-mono); font-size: var(--t-11); color: var(--muted); }
.tour-pop h3 { font-size: var(--t-16); margin: var(--s-1) 0 var(--s-2); }
.tour-pop p { font-size: var(--t-14); line-height: 1.5; color: var(--ink-2); }
.tour-pop .row { display: flex; gap: var(--s-2); justify-content: flex-end; margin-top: var(--s-4); }

/* Section reveal — set by prototype.js, off under reduced motion. */
.rv.pre { opacity: 0; transform: translateY(14px); }
.rv.in  { opacity: 1; transform: none; transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out); }

/* Accessibility floor */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  padding: var(--s-3) var(--s-4); background: var(--primary); color: var(--on-primary);
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ==========================================================================
   Divine Science Society — components. Form is read from tokens.css only.
   ========================================================================== */

/* ---- Site chrome: the constellation strip ------------------------------ */
.topnav { position: absolute; left: 0; right: 0; top: 0; z-index: var(--z-sticky); }
.topnav .in { display: flex; align-items: center; gap: var(--s-4); height: 76px; flex-wrap: nowrap; width: min(100% - 2 * var(--gutter), var(--container-wide)); }
.topnav .strip { min-width: 0; overflow: hidden; }
.topnav .brand { display: inline-flex; align-items: center; gap: var(--s-3); white-space: nowrap; text-decoration: none; color: var(--ink); font-family: var(--font-kicker); font-size: var(--t-12); letter-spacing: 0.22em; text-transform: uppercase; }
.topnav .brand .mark { width: 28px; height: 28px; color: var(--primary); }
.topnav .brand .mark svg { width: 100%; height: 100%; }
.topnav .strip { display: flex; gap: 2px; margin-left: auto; align-items: center; }
.topnav .strip a { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 var(--s-3); color: var(--muted); text-decoration: none; font-size: var(--t-14); font-weight: 500; border-radius: var(--r-ctl); }
.topnav .strip a::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .55; }
.topnav .strip a:hover { color: var(--ink); }
.topnav .strip a[aria-current="page"] { color: var(--accent); }
.topnav .strip a[aria-current="page"]::before { opacity: 1; box-shadow: var(--glow); }
.topnav .strip a.visited::before { opacity: 1; }
.topnav .tools { display: flex; align-items: center; gap: var(--s-2); margin-left: var(--s-3); }
.topnav .intent-chip { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; min-height: 40px; padding: 0 var(--s-3) 0 var(--s-2); border: var(--rule); border-radius: var(--r-full); color: var(--ink); text-decoration: none; font-size: var(--t-13); }
.topnav .intent-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: var(--glow); }
.topnav .intent-chip em { font-size: 1.15em; color: var(--accent); }
.topnav .navtoggle { display: none; }
@media (max-width: 1320px) {
  .topnav .intent-chip .lbl { display: none; }
  .topnav .tools .btn { display: none; }
  .topnav .strip a { padding: 0 10px; font-size: var(--t-13); gap: 6px; }
  .topnav .brand .hide-sm { display: none !important; }
}
@media (max-width: 960px) {
  .topnav .strip { display: none; }
  .topnav .navtoggle { display: inline-flex; margin-left: auto; }
  body.nav-open .topnav .strip { display: flex; flex-direction: column; position: fixed; inset: 76px 0 var(--pocbar-h); background: var(--bg); padding: var(--s-6) var(--gutter); align-items: stretch; gap: var(--s-2); z-index: var(--z-layer); overflow: auto; }
  body.nav-open .topnav .strip a { min-height: 52px; font-family: var(--font-display); font-style: italic; font-size: var(--t-22); }
}
.site-foot { border-top: var(--rule); padding: var(--s-9) 0 var(--s-8); color: var(--muted); font-size: var(--t-14); }
.site-foot .grid { display: grid; gap: var(--s-6); grid-template-columns: 2fr 1fr 1fr 1fr; }
@media (max-width: 860px) { .site-foot .grid { grid-template-columns: 1fr 1fr; } }
.site-foot h4 { font-family: var(--font-kicker); font-size: var(--t-11); letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted-2); margin-bottom: var(--s-3); font-weight: 500; }
.site-foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-2); }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--ink); }
.site-foot .legal { margin-top: var(--s-8); padding-top: var(--s-5); border-top: var(--rule); display: flex; flex-wrap: wrap; gap: var(--s-4); justify-content: space-between; font-size: var(--t-13); color: var(--muted-2); }

/* ---- Buttons ------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: var(--h-ctl); padding: 0 var(--s-6); border: var(--bw) solid var(--primary); border-radius: var(--r-ctl); background: transparent; color: var(--primary); font-family: var(--font-kicker); font-size: var(--t-12); font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease); }
.btn:hover { background: var(--primary); color: var(--on-primary); }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn.quiet { border-color: var(--line-strong); color: var(--ink); font-family: var(--font-body); letter-spacing: 0; text-transform: none; font-size: var(--t-15); }
.btn.quiet:hover { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn.ghost { border-color: transparent; color: var(--muted); font-family: var(--font-body); letter-spacing: 0; text-transform: none; font-size: var(--t-15); padding: 0 var(--s-3); }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn.sm { height: var(--h-ctl-sm); padding: 0 var(--s-4); font-size: var(--t-11); }
.btn.icon { width: var(--h-ctl); padding: 0; }
.btn.sm.icon { width: var(--h-ctl-sm); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 1.5px solid var(--on-primary); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.btn:not(.primary).loading::after { border-color: var(--primary); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn .ico { width: 18px; height: 18px; }
.link-arrow { display: inline-flex; align-items: center; gap: 8px; color: var(--gold-text); text-decoration: none; font-family: var(--font-kicker); font-size: var(--t-12); letter-spacing: 0.2em; text-transform: uppercase; min-height: 44px; }
.link-arrow .ico { transition: transform var(--dur-2) var(--ease-out); }
.link-arrow:hover .ico { transform: translateX(4px); }

/* ---- Fields ------------------------------------------------------------- */
.field { display: grid; gap: var(--s-2); }
.field label, .label { font-size: var(--t-14); font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: var(--t-13); color: var(--muted); }
.field .error { font-size: var(--t-13); color: var(--danger-ink); display: none; }
.field.invalid .error { display: block; }
.field.invalid .input { border-color: var(--danger); }
.input, .select, .textarea { width: 100%; height: var(--h-ctl); padding: 0 var(--s-4); background: var(--surface); border: var(--rule); border-radius: var(--r-ctl); color: var(--ink); transition: border-color var(--dur-2) var(--ease); }
.textarea { height: auto; min-height: 120px; padding: var(--s-3) var(--s-4); resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--primary); }
.select { appearance: none; 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='%23c9b98a' stroke-width='1.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.search { position: relative; }
.search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 42px; }
.check, .radio { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: var(--t-15); }
.check input, .radio input { appearance: none; width: 20px; height: 20px; margin: 0; border: var(--rule-strong); border-radius: var(--r-ctl); background: var(--surface); display: grid; place-content: center; cursor: pointer; }
.radio input { border-radius: 50%; }
.check input::before { content: ""; width: 10px; height: 6px; border-left: 2px solid var(--on-primary); border-bottom: 2px solid var(--on-primary); transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.radio input::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--on-primary); opacity: 0; }
.check input:checked, .radio input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::before, .radio input:checked::before { opacity: 1; }
.toggle { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-size: var(--t-15); }
.toggle input { appearance: none; width: 44px; height: 24px; margin: 0; border-radius: var(--r-full); background: var(--surface-3); border: var(--rule-strong); position: relative; cursor: pointer; transition: background var(--dur-2) var(--ease); }
.toggle input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform var(--dur-2) var(--ease-out), background var(--dur-2); }
.toggle input:checked { background: var(--primary-soft-2); border-color: var(--primary); }
.toggle input:checked::before { transform: translateX(20px); background: var(--primary); box-shadow: var(--glow); }
.segmented { display: inline-flex; border: var(--rule); border-radius: var(--r-ctl); padding: 2px; background: var(--surface); }
.segmented button { height: calc(var(--h-ctl-sm) + 2px); padding: 0 var(--s-4); border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--muted); font-size: var(--t-14); font-weight: 500; }
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); }
.range { appearance: none; width: 100%; height: 44px; background: transparent; margin: 0; }
.range::-webkit-slider-runnable-track { height: 1px; background: var(--line-strong); }
.range::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; margin-top: -8.5px; border-radius: 50%; background: var(--primary); box-shadow: var(--glow); cursor: pointer; }
.range::-moz-range-track { height: 1px; background: var(--line-strong); }
.range::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--primary); cursor: pointer; }

/* Gathering rows: the date block, shared by every list that renders them */
.gatherings .when { display: grid; text-align: center; min-width: 64px; }
.gatherings .when b { font-family: var(--font-display); font-size: var(--t-22); line-height: 1; }
.gatherings .when small { font-size: var(--t-12); color: var(--muted); }

/* ---- Pills / status vocabulary ------------------------------------------ */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--r-full); border: var(--rule); font-size: var(--t-12); font-weight: 500; color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.gold { color: var(--gold-text); border-color: var(--primary-soft-2); }
.pill.ok { color: var(--success-ink); border-color: var(--success-soft); background: var(--success-soft); }
.pill.warn { color: var(--warning-ink); border-color: var(--warning-soft); background: var(--warning-soft); }
.pill.err { color: var(--danger-ink); border-color: var(--danger-soft); background: var(--danger-soft); }
.pill.info { color: var(--info-ink); border-color: var(--info-soft); background: var(--info-soft); }
.pill.intent { color: var(--accent); border-color: var(--accent-soft); }
.tagline { display: inline-flex; gap: var(--s-2); flex-wrap: wrap; }
.tag { font-size: var(--t-12); color: var(--muted); padding: 4px 8px; border: var(--rule); border-radius: var(--r-ctl); }

/* ---- Surfaces ----------------------------------------------------------- */
.panel { background: var(--surface); border-radius: var(--r-card); padding: var(--pad-card); box-shadow: var(--elev-card); }
.panel.raise { background: var(--surface-2); }
.panel.line { background: transparent; border: var(--rule); }
.panel.plate { background: var(--drench); color: var(--on-drench); }
.panel.plate .kicker { color: var(--accent-strong); } .panel.plate .muted { color: var(--on-drench-muted); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s-4); align-items: center; min-height: var(--h-row); padding: var(--s-3) 0; border-top: var(--row-rule); }
.rows > li:last-child { border-bottom: var(--row-rule); }
.rows .lead-ico { width: 40px; height: 40px; display: grid; place-content: center; color: var(--accent); border: var(--rule); border-radius: 50%; }
.rows .t { display: block; font-weight: 500; color: var(--ink); }
.rows .d { display: block; font-size: var(--t-13); color: var(--muted); margin-top: 2px; }
.rows a.t { text-decoration: none; }
.rows a.t:hover { color: var(--gold-text); }
.rows > li.clickable { cursor: pointer; } .rows > li.clickable:hover { background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--t-14); }
.table th { text-align: left; font-family: var(--font-kicker); font-weight: 500; font-size: var(--t-11); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted-2); padding: var(--s-3) var(--s-3) var(--s-3) 0; border-bottom: var(--rule-strong); }
.table td { padding: var(--s-3) var(--s-3) var(--s-3) 0; border-bottom: var(--row-rule); vertical-align: middle; height: var(--h-row); }
.table th[aria-sort] { cursor: pointer; } .table th[aria-sort="ascending"]::after { content: " ↑"; } .table th[aria-sort="descending"]::after { content: " ↓"; }
.table tr.selected td { background: var(--surface); }
.table-wrap { overflow-x: auto; }
.bulk { display: none; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); background: var(--surface-2); border-radius: var(--r-card); margin-bottom: var(--s-3); }
.bulk.on { display: flex; }
.tabs { display: flex; gap: var(--s-1); border-bottom: var(--rule); }
.tabs button, .tabs a { min-height: 44px; padding: 0 var(--s-3); border: 0; background: none; color: var(--muted); font-size: var(--t-15); font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; margin-bottom: -1px; border-bottom: 1px solid transparent; }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--ink); border-bottom-color: var(--primary); }
details.acc { border-top: var(--rule); }
details.acc:last-of-type { border-bottom: var(--rule); }
details.acc summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); min-height: var(--h-row); padding: var(--s-3) 0; font-family: var(--font-display); font-size: var(--t-22); }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after { content: "+"; color: var(--accent); font-family: var(--font-body); font-size: var(--t-22); }
details.acc[open] summary::after { content: "−"; }
details.acc .body { padding: 0 0 var(--s-5); color: var(--muted); max-width: var(--measure); }
.tip { position: relative; }
.tip::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); white-space: nowrap; padding: 6px 10px; background: var(--drench); color: var(--on-drench); font-size: var(--t-12); border-radius: var(--r-ctl); opacity: 0; pointer-events: none; transition: opacity var(--dur-2); }
.tip:hover::after, .tip:focus-visible::after { opacity: 1; }

/* Modal + drawer */
.layer-scrim { position: fixed; inset: 0; z-index: var(--z-layer); background: oklch(0.08 0.01 80 / .78); opacity: 0; pointer-events: none; transition: opacity var(--dur-3) var(--ease); }
.modal { position: fixed; left: 50%; top: 50%; z-index: calc(var(--z-layer) + 1); width: min(92vw, 560px); max-height: 86vh; overflow: auto; transform: translate(-50%, -46%); opacity: 0; pointer-events: none; background: var(--surface-2); border: var(--rule); border-radius: var(--r-lg); box-shadow: var(--elev-modal); padding: var(--s-7); transition: opacity var(--dur-3) var(--ease), transform var(--dur-3) var(--ease-out); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: calc(var(--z-layer) + 1); width: min(92vw, 440px); background: var(--surface-2); border-left: var(--rule); box-shadow: var(--elev-modal); padding: var(--s-7) var(--s-6); overflow: auto; transform: translateX(100%); transition: transform var(--dur-3) var(--ease-out); }
body.layer-open .layer-scrim { opacity: 1; pointer-events: auto; }
body.layer-open .modal { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
body.layer-open .drawer { transform: none; }
.modal .close, .drawer .close { position: absolute; top: var(--s-4); right: var(--s-4); }

/* ---- Feedback & states -------------------------------------------------- */
.state { text-align: center; padding: var(--s-9) var(--s-5); border: 1px dashed var(--line-strong); border-radius: var(--r-card); max-width: 56ch; margin-inline: auto; }
.state .ico { width: 36px; height: 36px; margin: 0 auto var(--s-4); color: var(--accent); }
.state h3 { font-style: italic; margin-bottom: var(--s-2); }
.state p { margin: 0 auto var(--s-5); color: var(--muted); }
.state.err { border-color: var(--danger-soft); }
.state.err .ico { color: var(--danger-ink); }
.skeleton { display: grid; gap: var(--s-3); }
.skeleton i { display: block; height: 14px; border-radius: var(--r-ctl); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-3) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton i.w60 { width: 60%; } .skeleton i.w40 { width: 40%; } .skeleton i.tall { height: 120px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.banner { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4) var(--s-5); border: var(--rule); border-radius: var(--r-card); background: var(--surface); font-size: var(--t-14); }
.banner .ico { flex: none; color: var(--accent); margin-top: 2px; }
.banner.warn { border-color: var(--warning-soft); background: var(--warning-soft); } .banner.warn .ico { color: var(--warning-ink); }
.banner.err { border-color: var(--danger-soft); background: var(--danger-soft); } .banner.err .ico { color: var(--danger-ink); }
.banner.ok { border-color: var(--success-soft); background: var(--success-soft); } .banner.ok .ico { color: var(--success-ink); }

/* ---- Domain: the intention ring ----------------------------------------- */
.intention-ring { position: relative; width: min(440px, 84vw, 38vh); aspect-ratio: 1; margin-inline: auto; }
.intention-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.intention-ring line { stroke: var(--primary); stroke-width: 1; opacity: 0; stroke-dasharray: 400; stroke-dashoffset: 400; transition: stroke-dashoffset .9s var(--ease-out), opacity .3s; }
.intention-ring line.on { opacity: .9; stroke-dashoffset: 0; }
.intention-ring .core { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 50%; background: var(--accent); box-shadow: var(--glow); }
.intention-ring .core::after { content: ""; position: absolute; inset: -14px; border: 1px solid oklch(0.80 0.12 85 / .35); border-radius: 50%; animation: ring-pulse 4s var(--ease-out) infinite; }
@keyframes ring-pulse { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(2.4); opacity: 0; } }
.intention-ring button { position: absolute; transform: translate(-50%, -50%); background: none; border: 0; color: var(--ink); font: italic 500 clamp(1.3rem, 3vw, 2rem) / 1 var(--font-display); padding: 12px 16px; min-width: 44px; min-height: 44px; transition: color var(--dur-2), text-shadow var(--dur-2); }
.intention-ring button small { display: block; font: 500 10px / 1 var(--font-kicker); letter-spacing: .2em; color: var(--muted); margin-top: 6px; opacity: 0; transition: opacity var(--dur-2); }
.intention-ring button:hover, .intention-ring button:focus-visible, .intention-ring button.on { color: var(--primary); text-shadow: 0 0 22px oklch(0.80 0.12 85 / .55); outline: 0; }
.intention-ring button:hover small, .intention-ring button.on small { opacity: 1; }
@media (max-width: 640px) { .intention-ring button { font-size: 1.1rem; padding: 8px; } }

/* Intention as a compact row (settings, member page) */
.intent-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.intent-row button { min-height: 44px; padding: 0 var(--s-4); border: var(--rule); border-radius: var(--r-full); background: transparent; color: var(--muted); font-family: var(--font-display); font-style: italic; font-size: var(--t-18); }
.intent-row button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

/* ---- Domain: frequency dial --------------------------------------------- */
.freq { display: grid; grid-template-columns: auto 1fr; gap: var(--s-5); align-items: center; padding: var(--s-5) 0; border-top: var(--row-rule); }
.freq:last-child { border-bottom: var(--row-rule); }
.freq .hz { font-family: var(--font-display); font-size: var(--t-28); font-variant-numeric: tabular-nums; color: var(--ink); min-width: 5ch; }
.freq .hz small { font-family: var(--font-kicker); font-size: var(--t-11); letter-spacing: .18em; color: var(--muted); display: block; }
.freq .name { font-weight: 500; }
.freq .why { font-size: var(--t-14); color: var(--muted); }
.freq.on .hz { color: var(--accent); text-shadow: 0 0 18px oklch(0.80 0.12 85 / .4); }
.dial { position: relative; width: 220px; height: 220px; margin-inline: auto; border-radius: 50%; border: var(--rule-strong); display: grid; place-content: center; }
.dial::before { content: ""; position: absolute; inset: 18px; border-radius: 50%; border: 1px dashed var(--line); }
.dial .val { font-family: var(--font-display); font-size: 3rem; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.dial .val small { display: block; text-align: center; font-family: var(--font-kicker); font-size: var(--t-11); letter-spacing: .2em; color: var(--muted); margin-top: 8px; }
.dial.playing { box-shadow: var(--glow); }
.dial .needle { position: absolute; left: 50%; top: 0; width: 1px; height: 50%; background: var(--accent); transform-origin: bottom; transform: rotate(var(--deg, 0deg)); transition: transform var(--dur-3) var(--ease-out); }
.dial .needle::before { content: ""; position: absolute; top: 6px; left: -4px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: var(--glow); }
.wave { height: 72px; width: 100%; }
.wave path { fill: none; stroke: var(--accent); stroke-width: 1.2; }

/* ---- Domain: breath pacer ------------------------------------------------ */
.breath { position: relative; width: 200px; height: 200px; margin-inline: auto; display: grid; place-content: center; }
.breath[hidden] { display: none; }
.breath .orb { position: absolute; inset: 30px; border-radius: 50%; border: 1px solid var(--accent); background: radial-gradient(circle, oklch(0.80 0.12 85 / .18), transparent 70%); transform: scale(.55); transition: transform 4s cubic-bezier(.45,0,.55,1); }
.breath .orb.in { transform: scale(1); }
.breath .word { position: relative; font-family: var(--font-display); font-style: italic; font-size: var(--t-22); color: var(--accent); }
.breath .ring { position: absolute; inset: 0; border-radius: 50%; border: 1px dashed var(--line-strong); }

/* ---- Domain: constellation stars ---------------------------------------- */
.stars { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.star { position: relative; width: 44px; height: 44px; display: grid; place-content: center; border-radius: 50%; border: var(--rule); color: var(--muted-2); }
.star::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.star.lit { color: var(--accent); border-color: var(--accent-soft); }
.star.lit::before { box-shadow: var(--glow); }
.star.new { animation: star-born 1.2s var(--ease-out); }
@keyframes star-born { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: none; } }
.constellation { width: 100%; aspect-ratio: 16 / 9; }
.constellation line { stroke: var(--accent); stroke-width: .8; opacity: .55; }
.constellation circle { fill: var(--accent); }
.constellation circle.dim { fill: var(--line-strong); }
.constellation text { fill: var(--muted); font: 11px var(--font-body); }

/* ---- Domain: discovery toast & chapter marker --------------------------- */
.toast.discovery { background: var(--surface-3); color: var(--ink); border: 1px solid var(--accent-soft); display: grid; grid-template-columns: auto 1fr; gap: var(--s-3); align-items: center; }
.toast.discovery .ico { color: var(--accent); }
.toast.discovery b { display: block; font-family: var(--font-display); font-style: italic; font-size: var(--t-18); color: var(--accent); }
.chapter { display: flex; align-items: center; gap: var(--s-4); }
.chapter::before { content: ""; width: 44px; height: 1px; background: var(--accent); }
.chapter .kicker { color: var(--muted); }

/* ---- Sound control (in the chrome) -------------------------------------- */
.soundbtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: var(--rule); border-radius: 50%; background: transparent; color: var(--muted); }
.soundbtn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-soft); box-shadow: var(--glow); }
.soundbtn .bars { display: flex; gap: 2px; align-items: flex-end; height: 14px; }
.soundbtn .bars i { width: 2px; height: 4px; background: currentColor; border-radius: 1px; }
.soundbtn[aria-pressed="true"] .bars i { animation: eq .9s ease-in-out infinite alternate; }
.soundbtn .bars i:nth-child(2) { animation-delay: .15s; } .soundbtn .bars i:nth-child(3) { animation-delay: .3s; } .soundbtn .bars i:nth-child(4) { animation-delay: .45s; }
@keyframes eq { from { height: 4px; } to { height: 14px; } }

/* ---- Word reveal (text brightens into view) ----------------------------- */
.brighten span { display: inline; opacity: .22; transition: opacity var(--dur-slow) var(--ease-out); }
.brighten.lit span { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .brighten span { opacity: 1; } }

/* ---- Prototype chrome re-skin ------------------------------------------- */
.pocbar { background: oklch(0.10 0.01 80); color: var(--muted); border-top: var(--rule); box-shadow: none; }
.pocbar .tagword { font-family: var(--font-kicker); color: var(--primary); }
.pocbar .roles a { color: var(--muted); } .pocbar .roles a:hover { background: var(--surface-2); color: var(--ink); }
.pocbar .roles a[aria-current="true"] { background: var(--primary); color: var(--on-primary); }
.pocbar .tag-module { border-color: var(--line); color: var(--muted); }
.pocbar button.link { color: var(--muted); } .pocbar button.link:hover { color: var(--ink); }
.toast { background: var(--drench); color: var(--on-drench); }
.tour-pop { background: var(--surface-3); color: var(--ink); border: var(--rule); }
.tour-pop p { color: var(--muted); }
.skip-link { background: var(--primary); color: var(--on-primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
