/* =====================================================================
   Between Shifts — Post-Shift Switch-Off Plan · self-serve prototype 02
   Visual system reused from the approved /post-shift-plan page (premium visual design, frozen):
   Newsreader + Manrope, Warm Daylight / Paper surfaces, deep-teal actions, restrained sunrise accent,
   12px card radius, 1px warm hairline, one very soft shadow. No gradients, no glass, no icons.
   ===================================================================== */

@font-face { font-family: "Newsreader"; src: url("../fonts/newsreader-var.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("../fonts/newsreader-var-italic.woff2") format("woff2"); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("../fonts/manrope-var.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }

:root {
  --daylight: #F5EEE4;
  --paper: #FAF6F0;
  --dawn-soft: #E4EBEB;
  --sunrise: #D59A72;
  --sunrise-soft: #F0D9C7;
  --night: #242A2C;
  --deep: #2B434C;
  --deep-hover: #22363E;
  --ink: var(--night);
  --ink-2: #4A5457;
  --ink-3: #5E686B;
  --accent-text: #98552F;
  --line: rgba(36, 42, 44, 0.14);
  --line-strong: rgba(36, 42, 44, 0.28);
  --card-line: rgba(36, 42, 44, .13);
  --card-shadow: 0 1px 2px rgba(36, 42, 44, .05), 0 22px 44px -28px rgba(36, 42, 44, .30);
  --card-radius: 12px;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --ease: cubic-bezier(.22, .61, .36, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--daylight); color: var(--ink);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--serif); font-weight: 460; line-height: 1.1; letter-spacing: -0.018em; margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; text-wrap: pretty; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.scale-track { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--deep); outline-offset: 3px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }
::selection { background: var(--sunrise-soft); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--night); color: var(--daylight); padding: .75rem 1rem; border-radius: 6px; }
.skip-link:focus { top: 1rem; }

/* ---------- header + progress ---------- */
.app-header .inner { max-width: 46rem; margin: 0 auto; padding: 0 var(--gutter); min-height: 4rem; display: flex; align-items: center; }
.app-header img { height: 26px; width: auto; }
.progress { height: 2px; background: var(--line); }
.progress > i { display: block; height: 100%; width: 0; background: var(--deep); transition: width .35s var(--ease); }
.progress[hidden] { display: none; }

/* ---------- layout ---------- */
main { outline: none; }
.screen {
  width: 100%; max-width: 46rem; margin: 0 auto;
  padding: 1.75rem var(--gutter) 0;
  min-height: calc(100vh - 4.1rem); min-height: calc(100dvh - 4.1rem);
  display: flex; flex-direction: column;
  animation: rise .22s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.screen-body { flex: 1 0 auto; padding-bottom: 1.5rem; }
.screen h1 { font-size: clamp(1.75rem, 1.35rem + 1.9vw, 2.45rem); font-weight: 455; margin: 0 0 .7rem; outline: none; }
.help { color: var(--ink-2); font-size: .98rem; margin: 0 0 1.4rem; max-width: 34rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .75rem;
  font: 600 .75rem/1.2 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 1.25rem;
}
.eyebrow::before { content: ""; width: 1.75rem; height: 1.5px; background: var(--sunrise); flex: none; }

/* ---------- action bar (Back / Continue) ---------- */
.actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: .75rem; align-items: stretch;
  padding: .85rem 0 calc(.85rem + env(safe-area-inset-bottom));
  background: var(--daylight); border-top: 1px solid var(--line);
  margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter);
}
.actions .btn--primary { flex: 1 1 auto; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  min-height: 3.5rem; padding: .9rem 1.5rem; border: 0; border-radius: 10px;
  font: 650 1rem/1.2 var(--sans); letter-spacing: -.005em; text-align: center; text-decoration: none; cursor: pointer;
  transition: background-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.btn--primary { background: var(--deep); color: #fff; }
.btn--primary:hover { background: var(--deep-hover); transform: translateY(-1px); box-shadow: 0 8px 18px -10px rgba(43, 67, 76, .6); }
.btn--primary:active { transform: none; box-shadow: none; }
.btn--primary[disabled] { background: rgba(43, 67, 76, .35); cursor: default; transform: none; box-shadow: none; }
.btn--ghost { background: transparent; color: var(--ink-2); padding-inline: 1rem; }
.btn--ghost:hover { color: var(--ink); background: rgba(36, 42, 44, .05); }
.btn--block { width: 100%; }
.btn--quiet { background: transparent; color: var(--ink-2); border: 1.5px solid var(--line-strong); font-weight: 600; }
.btn--quiet:hover { color: var(--ink); border-color: var(--deep); background: rgba(36, 42, 44, .04); }
.text-link {
  display: inline-block; background: none; border: 0; padding: .6rem 0 .1rem; cursor: pointer;
  font: 650 .95rem/1.3 var(--sans); color: var(--ink); border-bottom: 1.5px solid var(--sunrise); border-radius: 0;
  min-height: 2.75rem; text-align: left;
}
.text-link:hover { border-bottom-color: var(--deep); }
.aside-link { margin-top: 1.5rem; }
.text-link--quiet { font-weight: 600; color: var(--ink-2); border-bottom-color: var(--line-strong); }
.more-link { margin-top: .9rem; }

/* ---------- option buttons ---------- */
.screen-body > .opts:not(.opts--cols), .scales { max-width: 34rem; }
.opts { display: grid; gap: .65rem; grid-template-columns: minmax(0, 1fr); margin: 0; padding: 0; list-style: none; }
.opt {
  position: relative; width: 100%; min-height: 3.5rem; padding: .8rem 1.1rem; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: .9rem;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 10px;
  font-size: 1.0625rem; font-weight: 560; line-height: 1.3; cursor: pointer;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.opts--dense .opt { min-height: 3.25rem; padding-block: .65rem; }
.opt:hover { border-color: var(--deep); }
.opt[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: #fff; }
.opt .label { min-width: 0; overflow-wrap: anywhere; }
.opt .box { flex: none; width: 1.25rem; height: 1.25rem; border: 1.5px solid var(--line-strong); border-radius: 5px; position: relative; background: transparent; }
.opt[aria-pressed="true"] .box { border-color: #fff; }
.opt[aria-pressed="true"] .box::after { content: ""; position: absolute; left: .38rem; top: .12rem; width: .32rem; height: .66rem; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(40deg); }

/* reason: optional second factor, collapsed by default */
.second { margin-top: .9rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.second-h { font: 700 .8rem/1.3 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 .7rem; }

/* preferences: every row states its answer in words (Helps me / No preference / Not for me) */
.prefs { display: grid; gap: .65rem; grid-template-columns: minmax(0, 1fr); max-width: 40rem; }
.pref-row { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem .75rem; }
.pref-row[data-state="helps"] { border-color: var(--deep); }
.pref-row[data-state="not"] { border-color: var(--accent-text); }
.pref-label { margin: 0 0 .5rem; font-weight: 620; font-size: 1rem; line-height: 1.3; }
.seg { display: flex; gap: .3rem; }
.seg-btn {
  flex: 1 1 auto; min-height: 2.75rem; padding: .45rem .55rem; border-radius: 8px; cursor: pointer; text-align: center;
  background: transparent; border: 1px solid var(--line-strong); color: var(--ink-2);
  font: 600 .8125rem/1.15 var(--sans);
}
.seg-btn:hover { border-color: var(--deep); }
.seg-btn[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: #fff; }
.pref-row[data-state="not"] .seg-btn[aria-pressed="true"] { background: var(--accent-text); border-color: var(--accent-text); }
.pref-row[data-state="none"] .seg-btn[aria-pressed="true"] { background: rgba(36, 42, 44, .08); border-color: var(--line-strong); color: var(--ink); }

/* ---------- 0–10 scale ---------- */
.scales { display: grid; gap: 1.35rem; }
.scale-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .1rem; }
.scale-label { font-weight: 600; font-size: 1rem; line-height: 1.35; margin: 0; }
.scale-val { flex: none; font-family: var(--serif); font-size: 1.7rem; line-height: 1; min-width: 1.6rem; text-align: right; color: var(--ink-3); }
.scale-val[data-set="1"] { color: var(--ink); }
.scale-track { position: relative; height: 3.25rem; touch-action: pan-y; cursor: pointer; outline-offset: 0; border-radius: 10px; }
.scale-rail { position: absolute; left: 1rem; right: 1rem; top: 50%; height: 0; }
.scale-rail::before { content: ""; position: absolute; left: 0; right: 0; top: -.5px; height: 1px; background: var(--line-strong); }
.scale-fill { position: absolute; left: 0; top: -1px; height: 2px; background: var(--deep); width: calc(var(--v, 0) * 10%); }
.scale-rail .tick { position: absolute; top: -4px; width: 1px; height: 8px; background: var(--line-strong); left: calc(var(--i) * 10%); }
.scale-thumb {
  position: absolute; top: 50%; left: calc(1rem + (100% - 2rem) * var(--v, 0) / 10);
  width: 1.75rem; height: 1.75rem; margin: -.875rem 0 0 -.875rem; border-radius: 50%;
  background: var(--deep); border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--deep), 0 4px 10px -4px rgba(36,42,44,.5);
  display: none;
}
.scale-track[data-set="1"] .scale-thumb { display: block; }
.scale-track:not([data-set="1"]) .scale-fill { display: none; }
.scale-ends { display: flex; justify-content: space-between; font-size: .8rem; color: var(--ink-3); margin-top: -.15rem; }

/* ---------- welcome ---------- */
.welcome h1 { font-size: clamp(2.1rem, 1.5rem + 3vw, 3.2rem); font-weight: 440; letter-spacing: -.028em; line-height: 1.05; margin-bottom: 1.1rem; }
.welcome .lede { font-size: clamp(1.08rem, 1rem + .35vw, 1.22rem); line-height: 1.55; color: var(--ink-2); max-width: 31rem; margin-bottom: 1.75rem; }
.facts { list-style: none; margin: 0 0 2rem; padding: 0; border-top: 1px solid var(--line); max-width: 31rem; }
.facts li { padding: .8rem 0; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--ink); }
.facts li span { display: block; color: var(--ink-2); font-weight: 500; font-size: .95rem; margin-top: .1rem; }
.fine { font-size: .85rem; color: var(--ink-3); margin-top: 1.25rem; }
.welcome .btn--primary { width: 100%; max-width: 31rem; }

/* ---------- working / error ---------- */
.working { padding-top: 22vh; text-align: center; }
.working p { font-family: var(--serif); font-size: 1.5rem; color: var(--ink-2); }

/* =====================================================================
   RESULT
   ===================================================================== */
.result { padding-bottom: 3rem; }
.result-top { margin: .25rem 0 1.25rem; }

/* safety / support cards: they outrank the plan */
.alert { border-radius: var(--card-radius); padding: 1.15rem 1.25rem 1.2rem; margin: 0 0 1rem; box-shadow: var(--card-shadow); position: relative; }
.alert .a-label { font: 750 .78rem/1.2 var(--sans); letter-spacing: .18em; text-transform: uppercase; margin: 0 0 .65rem; display: flex; align-items: center; gap: .6rem; }
.alert .a-label::before { content: ""; width: 1.4rem; height: 2px; background: currentColor; flex: none; }
.alert p { margin: 0 0 .7rem; }
.alert p:last-of-type { margin-bottom: 0; }
.alert--stop, .alert--crisis { background: var(--night); color: var(--daylight); border: 1px solid #0f1415; }
.alert--stop { padding: 1.4rem 1.4rem 1.5rem; }
.alert--stop .a-label, .alert--crisis .a-label { color: var(--sunrise); }
.alert--stop .a-label { font-size: .86rem; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; margin: 0 0 .65rem; font-family: var(--sans); line-height: 1.2; }
.alert--stop .a-text { font-size: 1.2rem; line-height: 1.5; font-weight: 600; letter-spacing: -.005em; }
.alert--crisis { padding: 1.5rem 1.4rem 1.6rem; }
.alert--crisis .a-title { font-family: var(--serif); font-weight: 480; font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.6rem); line-height: 1.05; letter-spacing: -.02em; margin: 0 0 1.1rem; }
.alert--crisis .a-text { font-size: 1.15rem; line-height: 1.5; font-weight: 560; }
.alert--crisis .a-text:first-of-type { font-size: 1.25rem; font-weight: 650; }
.alert--elevated, .alert--care_sleep_conflict { background: var(--paper); border: 1px solid rgba(152, 85, 47, .55); box-shadow: inset 4px 0 0 var(--sunrise), var(--card-shadow); padding-left: 1.5rem; }
.alert--elevated .a-label, .alert--care_sleep_conflict .a-label { color: var(--accent-text); }
.alert--elevated .a-text, .alert--care_sleep_conflict .a-text { font-weight: 600; font-size: 1.06rem; line-height: 1.5; }
.alert--support { background: var(--dawn-soft); border: 1px solid rgba(43, 67, 76, .30); }
.alert--support .a-label { color: var(--deep); }
.alert--support .a-text { font-size: 1.04rem; line-height: 1.5; }
.alert--note, .alert--timing { background: var(--paper); border: 1px solid var(--card-line); box-shadow: none; }
.alert--note .a-label, .alert--timing .a-label { color: var(--ink-3); }
.alert--note .a-text, .alert--timing .a-text { font-size: .98rem; color: var(--ink-2); }

.country { margin-top: 1.15rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.18); }
.alert--support .country { border-top-color: rgba(43, 67, 76, .25); }
.country .c-label { font: 700 .78rem/1.2 var(--sans); letter-spacing: .16em; text-transform: uppercase; margin: 0 0 .6rem; opacity: .85; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  min-height: 2.75rem; padding: .45rem .95rem; border-radius: 999px; cursor: pointer;
  background: transparent; color: inherit; border: 1.5px solid currentColor; font: 650 .92rem/1.1 var(--sans);
}
.chip[aria-pressed="true"] { background: var(--daylight); color: var(--night); border-color: var(--daylight); }
.alert--support .chip[aria-pressed="true"] { background: var(--deep); color: #fff; border-color: var(--deep); }
.alert--crisis .chip, .alert--stop .chip { border-color: rgba(245,238,228,.7); }

/* the plan card — same surface as the sales page */
.plan-card {
  background: var(--paper); border: 1px solid var(--card-line); border-radius: var(--card-radius);
  padding: clamp(1.25rem, 4vw, 1.75rem); margin: 0 0 1.75rem; box-shadow: var(--card-shadow);
}
.plan-title { font-family: var(--sans); font-weight: 700; font-size: 1.05rem; letter-spacing: .02em; line-height: 1.3; margin: 0 0 1.1rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.screen h1.plan-title { font-family: var(--sans); font-weight: 700; font-size: 1.05rem; letter-spacing: .02em; line-height: 1.3; margin: 0 0 1.1rem; }
.plan-title .k { letter-spacing: .12em; font-size: .78rem; color: var(--accent-text); }
.plan-title .v { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; letter-spacing: -.01em; }
.plan-steps .plan-sec + .plan-sec { margin-top: 1.25rem; }
.plan-h { font: 700 .78rem/1.3 var(--sans); letter-spacing: .16em; color: var(--ink-3); margin: 0 0 .55rem; }
.plan-h .num { color: var(--accent-text); }
.plan-sec ul { list-style: none; margin: 0; padding: 0; }
.plan-sec li { position: relative; padding-left: 1.1rem; margin: 0 0 .7rem; line-height: 1.55; }
.plan-sec li:last-child { margin-bottom: 0; }
.plan-sec li::before { content: ""; position: absolute; left: 0; top: .78em; width: .5rem; height: 1.5px; background: var(--sunrise); }
.plan-sec .lead { font-weight: 650; }
.plan-sec .say { font-family: var(--serif); font-size: 1.1em; line-height: 1.2; }
.plan-why { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.plan-why p { margin: 0; color: var(--ink-2); line-height: 1.5; }

.closer { margin: 2.25rem 0 0; }
.closer .close-line { font-family: var(--serif); font-weight: 450; font-size: clamp(1.7rem, 1.3rem + 1.8vw, 2.3rem); line-height: 1.12; letter-spacing: -.02em; margin: 0 0 1.4rem; text-wrap: balance; }
.closer .btn { width: 100%; }
.closer .fine { margin-top: 1.1rem; }

/* STOP screen and crisis screen: the card first, then only quiet controls */
.stop-after { margin: 1.6rem 0 0; max-width: 34rem; }
.stop-after .btn { width: 100%; }
.crisis-after { margin: 1.6rem 0 0; }
.crisis-after .help { margin: 0; }
.crisis-after .fine { margin-top: .8rem; }

/* fallback (adapter could not structure the output): plain, but still every line, safety first */
.fallback p { margin: 0 0 .6rem; }

/* ---------- wider screens ---------- */
@media (min-width: 40em) {
  .opts--cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pref-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: .55rem .8rem; }
  .pref-label { margin: 0; }
  .seg-btn { flex: none; min-width: 7.25rem; }
  .closer .btn { width: auto; min-width: 22rem; }
  .welcome .btn--primary { width: auto; min-width: 16rem; }
}
@media (min-width: 64em) {
  .screen { padding-top: 3.5rem; min-height: 0; }
  .screen-body { flex: 0 0 auto; }
  .screen h1 { margin-bottom: .9rem; }
  .help { margin-bottom: 1.8rem; }
  .actions { position: static; border-top: 0; margin: 1.5rem 0 3rem; padding: 0; background: transparent; }
  .actions .btn--primary { flex: 0 1 auto; min-width: 14rem; }
  .actions .btn--ghost { order: -1; }
  .plan-card { padding: 2rem 2.25rem 2.1rem; }
  .plan-title, .screen h1.plan-title { font-size: 1.05rem; margin-bottom: 1.5rem; padding-bottom: 1.15rem; }
  .plan-title .v { font-size: 1.45rem; }
  .plan-card .plan-sec { position: relative; padding-left: 1.9rem; }
  .plan-steps .plan-sec + .plan-sec { margin-top: 1.6rem; }
  .plan-card .plan-sec::before { content: ""; position: absolute; left: 0; top: .17rem; width: .64rem; height: .64rem; border-radius: 50%; border: 1.5px solid var(--sunrise); background: var(--paper); z-index: 1; }
  .plan-steps .plan-sec:not(:last-child)::after { content: ""; position: absolute; left: calc(.32rem - .5px); top: .95rem; bottom: -1.45rem; width: 1px; background: var(--line-strong); }
  .plan-card .plan-sec li { padding-left: 0; margin-bottom: .7rem; }
  .plan-card .plan-sec li::before { display: none; }
  .plan-h { margin-bottom: .6rem; }
  .plan-why { margin-top: 1.75rem; padding-top: 1.35rem; }
  .plan-why p { text-wrap: balance; }
  .alert { padding: 1.35rem 1.6rem 1.4rem; }
  .alert--stop { padding: 1.7rem 1.8rem 1.8rem; }
  .alert--stop .a-text { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  .progress > i, .btn, .opt { transition: none; }
  .btn--primary:hover { transform: none; }
}
@media print { .actions, .progress { display: none; } }
