/*
 * TRAIL OFF.
 *
 * Printed, not glassy — the house look. Flat panels, hard rules, no gradients,
 * no glows, no blur, no webfonts. The product is an argument that you can be
 * trusted, and every soft-focus wellness gradient on the internet is evidence
 * against that, so the whole thing is set like a document.
 *
 * Two grounds, and they are not a theme toggle — they are the time of day.
 *   data-mode="day"    warm paper. Marketing, the morning check-in, the guide.
 *   data-mode="night"  near-black, low contrast, nothing bright. The session
 *                      screen, which is looked at with the lights off by
 *                      someone trying to stop looking at things.
 *
 * The wordmark fades out across its own letters. That is the identity, it is
 * four lines of CSS, and it is the same mark the share card draws in pixels.
 */

:root {
  --ui: ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ground: #f3f0e9;
  --panel: #fbf9f4;
  --ink: #16181a;
  --dim: #6a6862;
  --rule: #16181a;
  --rule-soft: #d8d3c7;
  --edge: #16181a;
  --accent: #8a5a17;
  --accent-ink: #fbf9f4;
  --warn: #8d2f22;
  color-scheme: light;
}

[data-mode="night"] {
  --ground: #0e0f10;
  --panel: #141618;
  --ink: #cfccc5;
  --dim: #75726c;
  --rule: #2a2d30;
  --rule-soft: #212426;
  --edge: #6f6c66;
  --accent: #c9a45c;
  --accent-ink: #0e0f10;
  --warn: #c98070;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body { padding: 0 20px env(safe-area-inset-bottom); }
main { max-width: 38rem; margin: 0 auto; padding: 8px 0 64px; }

a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

/* -- wordmark ------------------------------------------------------------ */
.wordmark {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.22em;
  font-size: 0.95rem;
  text-transform: uppercase;
}
.mark { text-decoration: none; }

.topbar {
  max-width: 38rem; margin: 0 auto;
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding: 22px 0 18px;
  border-bottom: 2px solid var(--rule);
}
.topbar nav { display: flex; gap: 18px; font-size: 0.86rem; }
.topbar nav a { color: var(--dim); text-decoration: none; }
.topbar nav a:hover { color: var(--ink); text-decoration: underline; }

/* -- type ---------------------------------------------------------------- */
h1 { font-size: clamp(1.9rem, 6.2vw, 2.5rem); line-height: 1.14; letter-spacing: -0.02em; margin: 0.5em 0 0.35em; font-weight: 640; }
/* Headers have to look like headers. A previous pass shrank these to a tiny
   grey uppercase label to get away from the journal-article feel, and the
   result was a page that appeared to have no structure at all. */
h2 {
  font-size: 1.32rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 640;
  color: var(--ink);
  margin: 2.4em 0 0.6em;
  padding-top: 1.1em;
  border-top: 2px solid var(--rule);
}
h3 { font-size: 1rem; margin: 1.6em 0 0.3em; }
p { margin: 0 0 1em; }
.lede { font-size: 1.18rem; line-height: 1.45; }
.dim { color: var(--dim); }
.small { font-size: 0.86rem; }
.eyebrow { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); margin-bottom: 0; }
/* There is no serif on this site. The first version set every long page in one
   and the effect was a journal article: it made plain sentences look hedged and
   made the honesty read as evasion. Everything is the UI face, short lines, and
   a narrow measure. */
.prose { font-size: 1.05rem; }
.prose ol, .prose ul { padding-left: 1.15em; }
.prose li { margin-bottom: 0.5em; }
.prose > p { max-width: 34rem; }

.callout, .warn {
  border-left: 3px solid var(--warn);
  padding: 2px 0 2px 16px;
  margin: 1.6em 0;
  color: var(--ink);
}
.warn { font-family: var(--ui); font-size: 0.92rem; }

.links a { display: inline-block; }
.cites { list-style: none; padding: 0; }
.cite { border-top: 1px solid var(--rule-soft); padding: 16px 0; }
.cite .claim { margin-bottom: 0.35em; }
.cite .source { font-family: var(--mono); font-size: 0.78rem; color: var(--dim); margin-bottom: 0.4em; }
.cite .note { font-size: 0.92rem; color: var(--dim); }
.cite .status { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--warn); margin: 0; }
.cite .status.ok { color: var(--dim); }
.cite.unsupported { border-left: 3px solid var(--warn); padding-left: 14px; }

/* -- controls ------------------------------------------------------------ */
.btn, button {
  font: inherit;
  font-family: var(--ui);
  font-weight: 560;
  background: var(--ink);
  color: var(--ground);
  border: 2px solid var(--ink);
  border-radius: 2px;
  padding: 13px 20px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn:hover, button:hover { color: var(--ground); filter: brightness(1.25); }
[data-mode="night"] .btn:hover, [data-mode="night"] button:hover { filter: brightness(1.4); }
/* Every control reads as a control: a 2px ink edge, a hard offset shadow, and
   a press that actually moves. The previous pass left ghost buttons and option
   rows with the soft rule colour, and at a glance nothing on the page looked
   tappable. */
.btn, button {
  box-shadow: 3px 3px 0 var(--edge);
  transition: transform .06s, box-shadow .06s;
}
.btn:active, button:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--edge); }
.btn.ghost, button.ghost { background: var(--panel); color: var(--ink); border-color: var(--edge); }
.btn.ghost:hover, button.ghost:hover { color: var(--ink); background: var(--ground); filter: none; }
button:disabled { box-shadow: none; transform: none; }
button:disabled { opacity: 0.4; cursor: default; }
.btn.wide, button.wide { display: block; width: 100%; }

.choices { display: grid; gap: 8px; margin: 0 0 22px; }
.choice {
  display: flex; align-items: baseline; gap: 12px;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: 2px;
  padding: 15px 16px;
  text-align: left;
  color: var(--ink);
  font-weight: 500;
  box-shadow: 3px 3px 0 var(--edge);
}
.choice:hover { filter: none; color: var(--ink); background: var(--ground); }
.choice:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--edge); }
.choice[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.choice .sub { color: var(--dim); font-size: 0.88rem; }
.choice[aria-pressed="true"] .sub { color: var(--ground); opacity: 0.7; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row .choice { flex: 1 1 auto; justify-content: center; }

/* -- app shell ----------------------------------------------------------- */
.screen { max-width: 30rem; margin: 0 auto; padding: 12px 0 40px; }
.screen h1 { font-size: clamp(1.6rem, 5.4vw, 2.1rem); }
.step { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }

.dots { display: flex; gap: 6px; margin: 18px 0 26px; flex-wrap: wrap; }
.dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--rule-soft); }
.dot.done { background: var(--ink); border-color: var(--ink); }
.dot.slept { background: var(--accent); border-color: var(--accent); }
.dot.today { border-color: var(--ink); }

.note { border: 2px solid var(--rule-soft); border-radius: 2px; padding: 14px 16px; margin: 18px 0; font-size: 0.92rem; }
.note.loud { border-color: var(--warn); }

/* -- night / player ------------------------------------------------------ */
.player { text-align: center; padding: 30px 0 10px; }
.player .time { font-family: var(--mono); font-size: 0.8rem; color: var(--dim); letter-spacing: 0.1em; }
.playbtn {
  width: 176px; height: 176px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--panel); color: var(--ink);
  font-size: 1.1rem; letter-spacing: 0.14em; text-transform: uppercase;
  margin: 26px auto; display: block;
  box-shadow: 4px 4px 0 var(--ink);
}
.playbtn:hover { color: var(--ink); background: var(--ground); filter: none; }
.playbtn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.playing .playbtn { border-color: var(--rule); color: var(--dim); }
body.dimmed { filter: brightness(0.42); transition: filter 3s linear; }

/* -- chart --------------------------------------------------------------- */
.chart { width: 100%; height: 168px; display: block; margin: 8px 0 6px; }
.chart .grid { stroke: var(--rule-soft); stroke-width: 1; }
.chart .base { stroke: var(--dim); stroke-width: 1.5; stroke-dasharray: 6 6; }
.chart .line { stroke: var(--accent); stroke-width: 2; fill: none; }
.chart .pt { fill: var(--accent); }
.chart .pt.uncounted { fill: var(--dim); }
.chart text { font-family: var(--mono); font-size: 9px; fill: var(--dim); }

/* -- verdict ------------------------------------------------------------- */
.verdict { border-top: 2px solid var(--rule); border-bottom: 2px solid var(--rule); padding: 26px 0; margin: 20px 0 26px; }
.verdict h1 { margin-top: 0; }
.numbers { font-family: var(--mono); font-size: 0.9rem; color: var(--dim); }
.card { width: 100%; height: auto; border: 2px solid var(--rule); border-radius: 2px; display: block; margin: 0 0 26px; }
.verdict-share .card { margin-top: 22px; }

.foot { max-width: 38rem; margin: 0 auto; border-top: 2px solid var(--rule); padding: 22px 0 40px; font-size: 0.88rem; color: var(--dim); }
.foot a { color: var(--dim); }

.hidden { display: none !important; }

/* -- landing: what actually happens -------------------------------------- */
.stepline {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 4px 20px;
  border-top: 1px solid var(--rule-soft);
  padding: 14px 0;
}
.stepline .when { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); padding-top: 4px; }
@media (max-width: 34rem) { .stepline { grid-template-columns: 1fr; } }

.answers { display: grid; gap: 0; margin: 8px 0 4px; }
.answer { border-top: 1px solid var(--rule-soft); padding: 14px 0 4px; }
.answer h3 { margin: 0 0 0.2em; font-family: var(--ui); }
.answer p { color: var(--dim); }

.pull {
  border-left: 3px solid var(--ink);
  padding: 2px 0 2px 16px;
  margin: 2em 0;
  font-size: 1.12rem;
}

/* One statement per line, tight. Not paragraphs — the landing page is a
   hierarchy you scan, and a paragraph is a place to hide a decision. */
.line { margin: 0 0 0.5em; max-width: 34rem; }
.line:last-of-type { margin-bottom: 1em; }

/* The players. Off-screen rather than display:none, which iOS will not play. */
.offscreen {
  position: fixed;
  width: 1px; height: 1px;
  left: -10px; top: -10px;
  opacity: 0.01;
  pointer-events: none;
  border: 0;
}
