/* guide — the Guide page (#/guide), the tour overlay, and the sample voyage's
   strip. See public/css/app.css for the tokens.

   Tokens only; every rule works in both themes. Targets 44px (48px for the
   primary action), nothing under 11px, no sentence under 13px, no fill colour
   as text. Motion is opacity/transform only, and the app-wide reduce-motion
   rules in app.css stop all of it. */

/* =============================================================== the Guide */

.guide.stack { gap: var(--sp-3); }
.guide .card { margin-bottom: 0; }
.guide .section-title { margin: var(--sp-4) 2px 0; }
.guide .screen-head { margin-bottom: var(--sp-1); }

/* The lead of a section or the glossary: the one sentence that says what the
   page is, always shown (the purpose line under an h1 retires after a few
   visits; this is the page's content, not a reminder). */
.guide-lead {
  margin: calc(var(--sp-2) * -1) 2px var(--sp-1);
  font-size: var(--fs-md); line-height: 1.5; color: var(--ink-2); max-width: 36em;
}

/* Long row subtitles stop at two lines; the full text is one tap away. */
.guide-clamp {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}

/* ------------------------------------------------------------- the loop */
/* Plan → Today → XP → Voyage down the left, with a return stroke that makes
   it a loop; Together → Reward beside it on the right. HTML words, drawn
   arrows. Each box is a real button into the part of the app it names. */
.guide-loop { margin: 0; padding: var(--sp-4); }
/* Seven shared rows (box, arrow, box, arrow, box, arrow, box). Each list is a
   subgrid of them, so Together always sits level with Today and Reward with
   XP however the words wrap. Without subgrid the lists simply stack their own
   rows — still in order, still readable. */
.loop {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: repeat(7, auto);
  column-gap: var(--sp-4);
  padding-left: 18px;               /* room for the return stroke */
}
.loop ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-rows: subgrid; }
.loop-main { grid-column: 1; grid-row: 1 / span 7; }
.loop-side { grid-column: 2; grid-row: 3 / span 3; }
.loop-step { display: flex; }
.loop-node {
  appearance: none; cursor: pointer; width: 100%;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px;
  min-height: 56px; padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--seaglass) 30%, var(--line-soft));
  border-radius: 14px;
  background: color-mix(in srgb, var(--seaglass) 10%, var(--surface));
  color: var(--ink); font: inherit; text-align: left;
  transition: transform var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.loop-node:active { transform: scale(.97); background: color-mix(in srgb, var(--seaglass) 18%, var(--surface)); }
.loop-node:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
/* The two of you: the same shape in the warm hue, so the side branch reads as
   a different thing at a glance — and by its words, not colour alone. */
.loop-side .loop-node {
  border-color: color-mix(in srgb, var(--coral) 32%, var(--line-soft));
  background: color-mix(in srgb, var(--coral) 9%, var(--surface));
}
.loop-side .loop-node:active { background: color-mix(in srgb, var(--coral) 16%, var(--surface)); }
.loop-label {
  font-family: var(--font-display); font-size: var(--fs-body); font-weight: 700;
  line-height: 1.25; letter-spacing: -.01em;
}
.loop-sub { font-size: var(--fs-note); line-height: 1.35; color: var(--ink-2); overflow-wrap: anywhere; }
.loop-arrow {
  display: grid; place-items: center; height: 28px;
  color: var(--line-strong);
}
/* The return stroke: from Voyage, round the left edge, back into Plan. */
.loop-back {
  position: absolute; left: 0; top: 28px; bottom: 28px; width: 14px;
  border: 2px solid var(--line-strong); border-right: 0;
  border-radius: 14px 0 0 14px;
  opacity: .8; pointer-events: none;
}
.loop-back-head {
  position: absolute; top: -7px; right: -8px;
  color: var(--line-strong);
}
.guide-loop-caption { margin-top: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); }
.guide-loop-caption p { font-size: var(--fs-body); line-height: 1.55; color: var(--ink-2); }

/* ------------------------------------------------------ actions + setup */
.guide-actions .item-lead,
.guide-sections .item-lead,
.guide-section .item-group .item-lead { color: var(--accent-text); }

/* "Getting under way" once Today hides it: the card itself is
   components/setup.js, styled with Today's .checklist rules in today.css. */

/* ------------------------------------------------------------ a section */
.guide-article { padding: var(--sp-4) var(--pad) var(--sp-5); }
.guide-article p { font-size: var(--fs-body); line-height: 1.65; color: var(--ink); max-width: 36em; }
.guide-article p + p { margin-top: var(--sp-3); }

.guide-whoop.stack { gap: var(--sp-3); }
.guide-bounds { list-style: none; margin: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.guide-bounds li { display: flex; gap: var(--sp-2); font-size: var(--fs-body); line-height: 1.5; color: var(--ink-2); }
.guide-bounds-icon { flex: none; padding-top: 2px; color: var(--accent-text); }
.guide-bounds-none { margin: 0 2px; line-height: 1.5; }

/* ------------------------------------------------------------- glossary */
.guide-filter { display: flex; flex-direction: column; gap: 6px; margin: 0 2px; }
.guide-filter-label { font-size: var(--fs-note); font-weight: 640; color: var(--ink-2); }
/* The app's input rule (16px, so iOS does not zoom on focus) applies. */
.guide-filter-input { width: 100%; min-height: var(--tap); }
.guide-count { min-height: 1.5em; }
.guide-letters { display: flex; flex-direction: column; }
.guide-letter .overline { margin-top: var(--sp-4); }
.guide-letter:first-child .overline { margin-top: var(--sp-1); }
.guide-letter[hidden], .guide-none[hidden], .guide-letter .item[hidden] { display: none; }

/* ================================================================ the tour */
/* A fixed layer above the tab bar (--z-tour) and below sheets. Four scrim
   panels leave a gap around the real element — the spotlight — and a ring is
   drawn in it. The scrim is the same in both themes: it dims, it does not
   theme. The layer itself lets taps through; the panels and the card do not,
   and the page underneath is inert while the tour is up. */
.tour {
  --tour-scrim: rgba(4, 21, 30, .58);
  position: fixed; inset: 0; z-index: var(--z-tour);
  pointer-events: none;
  animation: tour-in var(--dur-3) var(--ease);
}
.tour-scrim {
  position: fixed; top: 0; left: 0; width: 0; height: 0;
  background: var(--tour-scrim);
  pointer-events: auto;
  touch-action: none;               /* a drag on the dim is not a scroll of the page */
}
.tour-ring {
  position: fixed; top: 0; left: 0; width: 0; height: 0;
  border-radius: 14px;
  box-shadow:
    0 0 0 2px var(--seaglass),
    0 0 0 6px color-mix(in srgb, var(--seaglass) 26%, transparent),
    0 0 28px 4px color-mix(in srgb, var(--seaglass) 40%, transparent);
  pointer-events: none;
  transition: opacity var(--dur-2) var(--ease);
}
.tour[data-mode="moving"] .tour-ring,
.tour[data-mode="center"] .tour-ring { opacity: 0; }
.tour-probe {
  position: fixed; top: 0; left: 0; width: 0; height: 0; visibility: hidden;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.tour-card {
  position: fixed; top: 0; left: 0;
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100vh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto; overscroll-behavior: contain;
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  pointer-events: auto;
  opacity: 0;
}
.tour-card[data-ready] { opacity: 1; animation: tour-card-in var(--dur-3) var(--ease); }
.tour-card[data-leaving] { opacity: .6; }
.tour-card:focus { outline: none; }
.tour-card:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.tour-step {
  font-family: var(--font-display); font-size: var(--fs-overline); font-weight: 650;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.tour-title {
  margin-top: 6px;
  font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 650; line-height: 1.3; color: var(--ink);
}
.tour-body { margin-top: 6px; font-size: var(--fs-body); line-height: 1.5; color: var(--ink-2); }
.tour-note { margin-top: var(--sp-2); font-size: var(--fs-note); line-height: 1.45; color: var(--ink-3); }
.tour-actions { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-4); }
.tour-skip { margin-left: -10px; }
.tour-next { min-height: var(--tap); min-width: 88px; }

@keyframes tour-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tour-card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ======================================================== sample voyage */
/* Un-dismissable, above the masthead, styled as Simulated (plum). Its own
   height is published as --demo-h by demo.js; the page and the sticky
   masthead start below it. The status-bar inset above it is painted by
   body::before as everywhere else. */
.demo-strip {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: calc(var(--z-tab) + 1);
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--plum) 16%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--plum) 36%, transparent);
  color: var(--plum-text);
}
.demo-strip-inner {
  display: flex; align-items: center; gap: var(--sp-2);
  max-width: var(--shell); margin: 0 auto;
  padding: 2px var(--sp-2) 2px var(--pad);
  min-height: var(--tap-min);
}
.demo-strip-icon { flex: none; display: grid; place-items: center; }
.demo-strip-text { flex: 1; min-width: 0; font-size: var(--fs-note); line-height: 1.35; }
.demo-strip-text b { font-weight: 700; }
.demo-strip-exit {
  flex: none; color: var(--plum-text);
  border-color: color-mix(in srgb, var(--plum) 45%, transparent);
  background: var(--surface);
}

html.is-demo body { padding-top: var(--demo-h, 44px); }
html.is-demo .masthead { top: var(--demo-h, 44px); }
html.is-demo .stale-note { top: calc(env(safe-area-inset-top) + var(--tap) + 12px + var(--demo-h, 44px)); }
