/*
 * Ink & Line planner — habi.st/plan
 *
 * Premium utilitarian editorial aesthetic, now paged: one screen at a time,
 * no page scrolling — only the inner area of a screen may scroll.
 * - Warm paper lit by time of day
 * - Self-drawing ink line drawings with calibrated stroke lengths
 * - Newsreader display serif headings
 * - Exactly one ink button per screen, pinned in the bottom dock
 * - Fine 1px hairline rules, zero nested cards
 * - Strict Lila Ban: warm amber lighting, no purple neon
 */

:root {
  /* DayLight coordinates interpolated by js/plan.js */
  --sky-top: #fbfaf6;
  --sky-bottom: #fbfaf6;
  --glow: #d48858;

  /* Paper & ink: daylight keyframe (midday) */
  --paper: #fbfaf6;
  --ink: #14130e;
  --ink-wash: rgba(20, 19, 14, 0.04);
  --mute: #48463e;
  --line: rgba(20, 19, 14, 0.14);
  --line-soft: rgba(20, 19, 14, 0.07);
  --clay: #684d20;
  --clay-on-paper: #684d20;
  --surface: rgba(255, 253, 248, 0.72);
  --surface-solid: #ffffff;
  --diagram-canvas: transparent;
  --diagram-ink: #14130e;
  --diagram-muted: rgba(20, 19, 14, 0.3);
  --diagram-grid: rgba(20, 19, 14, 0.08);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --press: cubic-bezier(0.4, 0, 0.2, 1);
  --slide: 280ms;
}

:root[data-scheme="dark"] {
  --paper: #121422;
  --ink: #f7f5ef;
  --ink-wash: rgba(247, 245, 239, 0.06);
  --mute: #d5d2df;
  --line: rgba(247, 245, 239, 0.16);
  --line-soft: rgba(247, 245, 239, 0.09);
  --clay: #f3ce92;
  --clay-on-paper: #f3ce92;
  --surface: rgba(24, 27, 44, 0.65);
  --surface-solid: #181c30;
  --diagram-ink: #f7f5ef;
  --diagram-muted: rgba(247, 245, 239, 0.35);
  --diagram-grid: rgba(247, 245, 239, 0.1);
}

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

html.plan-page {
  height: 100%;
  overflow: hidden;
}

body.plan {
  background:
    radial-gradient(ellipse 65% 45% at 16% 4%, color-mix(in srgb, var(--glow) 24%, transparent), transparent 64%),
    radial-gradient(ellipse 75% 55% at 85% 15%, color-mix(in srgb, var(--glow) 16%, transparent), transparent 60%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 60%, var(--sky-bottom) 100%);
  color: var(--ink);
  font-family: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100dvh;
  overflow: hidden;
}

.plan * {
  box-sizing: border-box;
}

.plan [hidden] {
  display: none !important;
}

.plan :focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Focus is moved onto the heading of every new screen for screen readers; the
   visible ring belongs on the controls, not around a display headline. */
.plan .screen h1:focus,
.plan .screen h2:focus,
.plan .screen h1:focus-visible,
.plan .screen h2:focus-visible {
  outline: none;
}

.plan .skip {
  position: absolute;
  top: -999px;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
}

.plan .skip:focus {
  top: 1rem;
  z-index: 70;
}

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

/* ------------------------------------------------- no-JS fallback --- */

/* Without JavaScript the paged shell opens as a plain document holding the
   first screen: the rest of the flow needs the planner to run. */
html.plan-page:not(.js) {
  height: auto;
  overflow: visible;
}

html.plan-page:not(.js) body.plan {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}

html.plan-page:not(.js) .planner {
  height: auto;
  min-height: 100dvh;
}

html.plan-page:not(.js) .progress,
html.plan-page:not(.js) .dock {
  display: none;
}

html.plan-page:not(.js) .stage {
  display: block;
}

html.plan-page:not(.js) .screen {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  overflow: visible;
}

html.plan-page:not(.js) .screen:not(#screen-ask) {
  display: none;
}

html.plan-page:not(.js) .screen-inner {
  min-height: 0;
  justify-content: flex-start;
}

/* ------------------------------------------------------------ shell --- */

.planner {
  height: 100dvh;
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

/* -------------------------------------------------------------- nav --- */

.plan-nav {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 1rem 0 0.5rem;
}

.plan-nav .wordmark {
  color: var(--ink);
  font-family: "Newsreader", serif;
  font-size: 1.15rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.plan-nav .wordmark .mark {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--clay);
}

.plan-nav-links {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.plan-nav-links a,
.plan-nav-links button {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}

.plan-nav-links a:hover,
.plan-nav-links button:hover {
  color: var(--ink);
}

/* --------------------------------------------------------- progress --- */

.progress {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  /* Reserved before the dots exist, so the stage does not shift once the
     plan builds. */
  min-height: calc(2.75rem + 0.5rem);
}

.dot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 2.75rem;
  min-width: min(2.75rem, 11vw);
  padding: 0.7rem 0.1rem;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.dot:disabled {
  cursor: default;
}

.dot-bar {
  display: block;
  width: 1.5rem;
  height: 2px;
  background: var(--line);
  transition: background 0.25s var(--ease), width 0.25s var(--ease);
}

.dot.is-visited .dot-bar {
  background: var(--mute);
}

.dot.is-current .dot-bar {
  width: 2.4rem;
  background: var(--ink);
}

/* ------------------------------------------------------------ stage --- */

.stage {
  position: relative;
  min-height: 0;
  display: grid;
  outline: none;
}

.screen {
  grid-area: 1 / 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(var(--enter, 28px));
  transition:
    opacity var(--slide) var(--ease),
    transform var(--slide) var(--ease),
    visibility 0s linear var(--slide);
}

.screen.is-current {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition:
    opacity var(--slide) var(--ease),
    transform var(--slide) var(--ease),
    visibility 0s;
}

.screen-inner {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1rem, 2.5vh, 2rem) 0 clamp(1.25rem, 3.5vh, 2.75rem);
}

.screen-inner--centered {
  align-items: center;
  text-align: center;
}

/* --------------------------------------------------------- headings --- */

.plan .kicker {
  font-family: "Sora", sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--clay);
  margin: 0 0 0.6rem;
}

.plan h1 {
  font-family: "Newsreader", serif;
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 0.85rem;
  text-wrap: balance;
}

.plan h1 em {
  font-style: italic;
  font-weight: 400;
}

.plan h2 {
  font-family: "Newsreader", serif;
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 0.4rem;
}

.plan h3 {
  font-family: "Newsreader", serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}

.plan .lede {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--mute);
  margin: 0 0 1.1rem;
  max-width: 56ch;
}

.plan .sub {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--mute);
  margin: 0;
}

.plan .hint {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--mute);
  margin: 0.4rem 0 0;
}

.plan .fine {
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--mute);
  margin: 0;
}

.plan-status {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.plan-status[data-state="ready"] {
  color: var(--clay);
}

.plan-status[data-state="error"] {
  color: var(--ink);
}

.field-label {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clay);
}

/* -------------------------------------------------------------- 01 --- */

.intent-form {
  margin: 0 0 1.1rem;
}

#intent-text {
  width: 100%;
  min-height: 4.4rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-solid);
  color: var(--ink);
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s var(--ease);
}

#intent-text:focus {
  border-color: var(--ink);
}

#intent-text::placeholder {
  color: var(--mute);
  opacity: 0.75;
  font-style: italic;
}

.examples-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.65rem;
  margin-top: 0.7rem;
}

.examples-label {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--mute);
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
}

.examples button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mute);
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.15s var(--ease), text-decoration-color 0.15s var(--ease);
}

.examples button:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

/* -------------------------------------------------------------- 02 --- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 2.1rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--ink-wash);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.chip:hover {
  border-color: var(--ink);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.chip-label {
  font-weight: 500;
}

.chip-drop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s var(--ease);
}

.chip:hover .chip-drop {
  opacity: 1;
}

.chip.is-empty {
  border-style: dashed;
  background: transparent;
  color: var(--mute);
  cursor: default;
}

.chip.is-empty:hover {
  border-color: var(--line);
  background: transparent;
}

.understood-line {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--mute);
}

.understood-plan {
  margin: 1.25rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-soft);
  font-family: "Newsreader", serif;
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--ink);
  max-width: 46ch;
}

.refine-open {
  align-self: flex-start;
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding: 0.4rem 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.refine-open:hover {
  border-color: var(--ink);
}

.refine-open small {
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--mute);
}

/* -------------------------------------------------------------- 03 --- */

.rhythm-strip-wrap {
  width: 100%;
  margin: 1.5rem 0 1.5rem;
}

.rhythm-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
  padding: 1.4rem 0.25rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  /* Holds the strip's height before the plan lands, so the screen does not
     jump when the week is computed. */
  min-height: 8.5rem;
}

.rhythm-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}

.rhythm-day-name {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
}

.rhythm-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(1.9rem, 7vw, 2.75rem);
  height: clamp(1.9rem, 7vw, 2.75rem);
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: clamp(0.78rem, 2.4vw, 0.95rem);
  font-weight: 600;
  color: var(--ink);
  background: var(--ink-wash);
  transition: all 0.2s var(--ease);
}

.rhythm-day.is-active .rhythm-marker {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.rhythm-day.is-rest .rhythm-marker {
  border-color: transparent;
  background: transparent;
  color: var(--line);
  font-weight: normal;
}

.rhythm-day-min {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--mute);
  min-height: 1rem;
}

.week-line {
  margin: 0;
  max-width: 42ch;
  font-family: "Newsreader", serif;
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  line-height: 1.5;
  color: var(--mute);
  text-wrap: balance;
}

/* ----------------------------------------------------------- 04/05 --- */

.session-art {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0 0.5rem;
}

.session-hero-sketch {
  width: clamp(140px, 26vh, 210px);
  height: clamp(140px, 26vh, 210px);
  color: var(--ink);
}

.plan #session-a-tag,
.plan #session-b-tag {
  margin-bottom: 0.5rem;
}

.session-meta {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
  margin: 0 0 0.85rem;
}

.session-rituals {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-soft);
}

/* ------------------------------------------------------ ritual row --- */

.ritual-row {
  list-style: none;
  border-bottom: 1px solid var(--line-soft);
}

.ritual-list .ritual-row:last-child {
  border-bottom: 0;
}

.ritual-button {
  display: grid;
  grid-template-columns: 1.9rem minmax(0, 1fr) auto 0.65rem;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  padding: 0.8rem 0.35rem;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s var(--ease), padding-left 0.15s var(--ease);
}

.ritual-button:hover {
  background: var(--ink-wash);
  padding-left: 0.6rem;
}

.ritual-button:active {
  background: color-mix(in srgb, var(--ink) 7%, transparent);
}

.ritual-glyph {
  width: 1.875rem;
  height: 1.875rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ritual-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.ritual-duration {
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ritual-chevron {
  display: flex;
  color: var(--mute);
  transition: transform 0.2s var(--ease), color 0.2s var(--ease);
}

.ritual-chevron svg {
  width: 0.45rem;
  height: 0.8rem;
}

.ritual-button:hover .ritual-chevron {
  color: var(--ink);
  transform: translateX(2px);
}

/* Ritual breakdown, inside its sheet */
.sheet-art {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0 1rem;
}

.sheet-art .sketch {
  width: 130px;
  height: 130px;
}

.ritual-lead {
  margin: 0 0 1rem;
  font-family: "Newsreader", serif;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink);
}

.ritual-steps {
  margin: 0 0 1.1rem;
  padding-left: 1.15rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--ink);
}

.ritual-steps li + li {
  margin-top: 0.35rem;
}

.ritual-expert {
  margin: 0 0 0.9rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--mute);
  border-left: 2px solid var(--clay);
  padding-left: 0.7rem;
}

.ritual-safety {
  margin: 0 0 0.9rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--mute);
  padding: 0.45rem 0.65rem;
  background: var(--ink-wash);
  border-radius: 4px;
}

.ritual-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
}

.ritual-tags li {
  font-size: 0.68rem;
  color: var(--mute);
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
}

/* -------------------------------------------------------------- 06 --- */

.progression-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 0.75rem;
}

.progression-phase {
  display: grid;
  gap: 0.3rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-soft);
}

.progression-phase:first-child {
  padding-top: 0;
  border-top: 0;
}

.phase-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--clay);
}

.phase-heading {
  font-family: "Newsreader", serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}

.phase-body {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--mute);
  margin: 0;
  max-width: 54ch;
}

.slip-line {
  margin: 1.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--mute);
  font-style: italic;
  max-width: 54ch;
}

/* -------------------------------------------------------------- 07 --- */

.plan-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-soft);
}

.action-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mute);
  font: inherit;
  font-size: 0.8rem;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.15s var(--ease), text-decoration-color 0.15s var(--ease);
}

.action-link:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

.action-dot {
  color: var(--line);
  font-size: 0.8rem;
}

.plan-actions .hint {
  flex: 0 0 100%;
  margin: 0;
}

.plan #plan-notice {
  margin-top: 1.25rem;
}

.plan-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 1.75rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.72rem;
  color: var(--mute);
}

.plan-footer .footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.plan-footer svg {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--clay);
}

.plan-footer a {
  color: var(--mute);
  text-decoration: none;
  margin-left: 0.85rem;
}

.plan-footer a:first-child {
  margin-left: 0;
}

.plan-footer a:hover {
  color: var(--ink);
}

/* ------------------------------------------------------------ dock --- */

.dock {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0 calc(0.9rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line-soft);
}

.dock-back {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  gap: 0.4rem;
  padding: 0.5rem 0.5rem 0.5rem 0.1rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
  cursor: pointer;
  transition: color 0.15s var(--ease);
}

.dock-back:hover {
  color: var(--ink);
}

.dock-back svg {
  width: 0.85rem;
  height: 0.65rem;
}

.dock-next,
.dock-app {
  margin-left: auto;
}

/* The one primary ink button on the screen */
.plan .btn-ink {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.5rem 0 1.3rem;
  height: 2.75rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.2s var(--press), background 0.2s var(--ease);
}

.plan .btn-ink:hover {
  transform: translateY(-1px);
}

.plan .btn-ink:active {
  transform: scale(0.98);
}

.plan .btn-ink i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 20%, transparent);
  color: var(--paper);
  font-style: normal;
}

/* ---------------------------------------------------------- sheets --- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-scrim {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 34%, transparent);
}

.sheet-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(680px, 100%);
  max-height: min(88dvh, 100%);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -20px 50px -30px rgba(0, 0, 0, 0.45);
  animation: sheet-in 260ms var(--ease);
}

@keyframes sheet-in {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--line-soft);
}

.sheet-head .kicker {
  margin-bottom: 0.3rem;
}

.sheet-head h2 {
  font-size: 1.35rem;
  margin: 0;
}

.sheet-sub {
  margin: 0.3rem 0 0;
  font-size: 0.74rem;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}

.sheet-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.35rem 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.sheet-close:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1.1rem 1.25rem 2.25rem;
}

.sheet--full {
  align-items: stretch;
}

.sheet--full .sheet-panel {
  width: 100%;
  max-height: 100dvh;
  height: 100%;
  border: 0;
  border-radius: 0;
}

/* -------------------------------------------------- the refine tree --- */

.tree {
  display: grid;
  gap: 1.25rem;
  padding-top: 1.25rem;
}

.step {
  display: grid;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
}

.step:first-child {
  padding-top: 0;
  border-top: 0;
}

.step-head {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
}

.step-index {
  font-family: "Newsreader", serif;
  font-size: 1rem;
  font-style: italic;
  color: var(--clay);
}

.step-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.group-label {
  flex: 0 0 100%;
  margin: 0.4rem 0 0.15rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}

.opt {
  height: 2.35rem;
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

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

.opt[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

/* -------------------------------------------------- the browse list --- */

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 0.85rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line-soft);
}

select {
  width: 100%;
  height: 2.4rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-solid);
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
}

.ritual-list {
  display: block;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-soft);
}

.ritual-more {
  list-style: none;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.noscript {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.88rem;
}

/* -------------------------------------------------- line drawings --- */

.sketch {
  display: block;
  color: var(--ink);
}

.sketch--row {
  width: 1.875rem;
  height: 1.875rem;
  color: var(--ink);
}

.sketch-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: var(--len, 120px);
  stroke-dashoffset: var(--len, 120px);
  transition: stroke-dashoffset 1100ms var(--ease);
}
.sketch-line.is-guide {
  stroke: var(--diagram-muted);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
  stroke-dashoffset: 0;
  opacity: 0;
  transition: opacity 500ms var(--ease);
}

.sketch.is-drawn .sketch-line.is-guide {
  opacity: 1;
}

.sketch-node {
  fill: currentColor;
  opacity: 0;
  transition: opacity 400ms var(--ease);
}

.sketch-node.is-signal {
  fill: var(--clay);
}

.sketch-callout {
  fill: none;
  stroke: var(--diagram-muted);
  stroke-width: 1;
  opacity: 0;
  transition: opacity 400ms var(--ease);
}

.sketch.is-drawn .sketch-line {
  stroke-dashoffset: 0;
}

.sketch.is-drawn .sketch-node,
.sketch.is-drawn .sketch-callout {
  opacity: 1;
}

/* ---------------------------------------------------- responsive --- */

@media (min-width: 768px) {
  .sheet--full {
    align-items: flex-end;
  }

  .sheet--full .sheet-panel {
    width: min(880px, 100%);
    height: auto;
    max-height: 88dvh;
    border-radius: 16px 16px 0 0;
  }
}

@media (max-height: 720px) {
  .plan-nav {
    padding-top: 0.75rem;
  }

  .session-hero-sketch {
    width: clamp(120px, 20vh, 170px);
    height: clamp(120px, 20vh, 170px);
  }

  .plan .lede {
    font-size: 0.95rem;
  }
}

@media (max-width: 600px) {
  .screen-inner--centered .rhythm-strip-wrap {
    margin: 1.1rem 0;
  }

  .rhythm-strip {
    gap: 0.2rem;
    padding: 1rem 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.plan {
    transition: none;
  }

  .screen,
  .screen.is-current {
    transition: none;
    transform: none;
  }

  .sheet-panel {
    animation: none;
  }

  .sketch-line {
    transition: none !important;
    stroke-dashoffset: 0 !important;
  }

  .sketch-node,
  .sketch-callout {
    transition: none !important;
    opacity: 1 !important;
  }
}
