/* FlowWatch — The Night Log (see DESIGN.md) */

:root {
  --carbon: #1e2238;
  --carbon-2: #272d4b;
  --hairline: #3a4066;
  --paper: #faf8f2;
  --canary: #ffd84f;
  --pad-pink: #f9a8c9;
  --ink: #212a5e;
  --ink-carbon: #6a5a9e;
  --stamp: #d5382e;
  --on-carbon: #dfe2f4;
  --on-carbon-2: #9aa0c4;
  --slip-shadow: 0 14px 28px rgba(8, 10, 24, 0.5), 0 3px 8px rgba(8, 10, 24, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--carbon);
  color: var(--on-carbon);
  font-family: "Libre Franklin", -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
}
code { font-family: "Courier Prime", monospace; font-size: 0.95em; }
::selection { background: var(--canary); color: var(--ink); }

/* ---------- header ---------- */
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px clamp(20px, 5vw, 56px);
  border-bottom: 1px solid var(--hairline);
}
.wordmark {
  color: var(--on-carbon); text-decoration: none;
  font-weight: 900; letter-spacing: 0.14em; font-size: 18px;
}
.wordmark span {
  display: block; font-family: "Courier Prime", monospace; font-weight: 400;
  font-size: 10px; letter-spacing: 0.22em; color: var(--on-carbon-2);
}
.top nav { display: flex; align-items: center; gap: clamp(14px, 2.5vw, 28px); }
.top nav a:not(.cta) {
  color: var(--on-carbon-2); text-decoration: none; font-size: 14px; font-weight: 500;
  letter-spacing: 0.03em;
}
.top nav a:not(.cta):hover, .top nav a:not(.cta):focus-visible { color: var(--on-carbon); }

/* ---------- CTA ---------- */
.cta {
  display: inline-block; background: var(--stamp); color: #fff8f4;
  font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  text-decoration: none; padding: 15px 28px;
  border: 2px solid #a02017; border-radius: 3px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14), 0 6px 16px rgba(8, 10, 24, 0.45);
  transition: transform 120ms ease-out, box-shadow 120ms ease-out;
}
.cta:hover, .cta:focus-visible {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2), 0 10px 22px rgba(8, 10, 24, 0.55);
}
.cta:active { transform: translateY(0); }
.cta-small { padding: 9px 16px; font-size: 12.5px; }
.cta-row { margin-top: 34px; }
.cta-note { margin-top: 14px; font-size: 14.5px; color: var(--on-carbon-2); max-width: 42ch; }
.cta-note strong { color: var(--on-carbon); }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(32px, 6vw, 80px); align-items: center;
  padding: clamp(48px, 9vh, 96px) clamp(20px, 5vw, 56px) clamp(56px, 9vh, 104px);
  max-width: 1240px; margin: 0 auto;
}
h1 {
  font-weight: 900; font-size: clamp(2.1rem, 4.6vw, 3.7rem);
  line-height: 1.06; letter-spacing: -0.015em; text-wrap: balance;
}
.lede {
  margin-top: 22px; font-size: clamp(1.02rem, 1.4vw, 1.16rem);
  color: var(--on-carbon-2); max-width: 56ch;
}
.lede em { color: var(--on-carbon); font-style: normal; font-weight: 600; }

/* ---------- slips ---------- */
.slip-stack { justify-self: center; width: min(440px, 100%); }
.papers { position: relative; }
.slip-stack .demo-note { margin-top: 36px; }
.slip {
  position: relative; background: var(--paper); color: var(--ink);
  border-radius: 2px; box-shadow: var(--slip-shadow); padding: 0 0 26px;
}
/* perforated top edge */
.slip::before {
  content: ""; display: block; height: 10px;
  background-image: radial-gradient(circle at 5px 0, transparent 3.2px, currentColor 3.4px);
  background-size: 14px 10px; background-repeat: repeat-x;
  color: var(--carbon); opacity: 0.9;
}
.slip-pink { background: var(--pad-pink); transform: rotate(-1.1deg); z-index: 2; padding-bottom: 72px; }
.slip-canary {
  position: absolute; inset: 0; background: var(--canary);
  transform: rotate(1.6deg) translate(22px, 18px); z-index: 1;
}
.carbon-ghost {
  position: absolute; bottom: 3px; left: 26px;
  font-family: "Courier Prime", monospace; font-weight: 700; font-size: 13.5px;
  letter-spacing: 0.04em; color: var(--ink-carbon);
  text-shadow: 0 0 0.3px currentColor; white-space: nowrap;
}
.slip-canary-solid { background: var(--canary); }
.slip-white { background: var(--paper); }

.slip-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  margin: 14px 22px 0; padding-bottom: 10px; border-bottom: 2px solid var(--ink);
  font-weight: 900; letter-spacing: 0.12em; font-size: 15px; color: var(--ink);
}
.slip-head span {
  font-family: "Courier Prime", monospace; font-weight: 400; font-size: 10px;
  letter-spacing: 0.14em; color: var(--ink); opacity: 0.65;
}
.slip-meta { margin: 14px 22px 4px; }
.slip-meta p {
  display: flex; gap: 10px; align-items: baseline; padding: 5px 0;
  border-bottom: 1px solid rgba(33, 42, 94, 0.28); font-size: 15px;
}
.slip-meta em {
  font-style: normal; font-weight: 700; font-size: 10.5px; letter-spacing: 0.16em;
  color: var(--ink); min-width: 64px;
}
.typed { font-family: "Courier Prime", monospace; font-weight: 700; white-space: nowrap; }
.motion .typed { display: inline-block; overflow: hidden; max-width: 0; animation: typeon 400ms steps(14) forwards; }
.motion .t1 { animation-delay: 120ms; }
.motion .t2 { animation-delay: 420ms; }
.motion .t3 { animation-delay: 720ms; }
@keyframes typeon { to { max-width: 24ch; } }

.checks { list-style: none; margin: 14px 22px 0; }
.checks li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 7px 0; font-size: 14.5px; line-height: 1.4; color: var(--ink);
}
.checks li + li { border-top: 1px dashed rgba(33, 42, 94, 0.3); }
.checks i {
  flex: none; width: 17px; height: 17px; margin-top: 2px;
  border: 2px solid var(--ink); border-radius: 2px;
  font-style: normal; font-family: "Courier Prime", monospace; font-weight: 700;
  font-size: 13px; line-height: 14px; text-align: center;
}
.checks b { font-weight: 700; }

/* ---------- rubber stamp ---------- */
.stamp {
  position: absolute; right: 18px; bottom: 14px;
  padding: 8px 16px 7px; text-align: center;
  font-family: "Courier Prime", monospace; font-weight: 700;
  font-size: 19px; letter-spacing: 0.1em; color: var(--stamp);
  border: 3px double var(--stamp); border-radius: 4px;
  transform: rotate(-8deg);
  box-shadow: inset 0 0 6px rgba(213, 56, 46, 0.28);
  text-shadow: 0 0 0.6px rgba(213, 56, 46, 0.6);
}
.stamp span { display: block; font-size: 12px; letter-spacing: 0.28em; }
.motion .stamp-hero { animation: slam 320ms cubic-bezier(0.19, 1, 0.22, 1) 1150ms backwards; }
@keyframes slam {
  0% { transform: rotate(-14deg) scale(1.5); opacity: 0; }
  70% { transform: rotate(-8deg) scale(0.98); opacity: 1; }
  100% { transform: rotate(-8deg) scale(1); opacity: 1; }
}
.stamp-price { right: 20px; top: 62px; bottom: auto; }

.demo-note {
  position: relative; z-index: 3;
  margin: 26px 4px 0; font-size: 12.5px; color: var(--on-carbon-2);
  font-family: "Courier Prime", monospace; letter-spacing: 0.02em;
}

/* ---------- tear rule ---------- */
.tear {
  height: 1px; max-width: 1240px; margin: 0 auto;
  background-image: linear-gradient(90deg, var(--hairline) 55%, transparent 55%);
  background-size: 14px 1px;
}

/* ---------- acts ---------- */
.act {
  max-width: 1240px; margin: 0 auto;
  padding: clamp(56px, 9vh, 104px) clamp(20px, 5vw, 56px);
}
h2 {
  font-weight: 900; font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: -0.01em; line-height: 1.12; text-wrap: balance;
}
.act-lede { margin: 18px 0 0; max-width: 62ch; color: var(--on-carbon-2); }
.act-lede em { color: var(--on-carbon); font-style: italic; }

/* ---------- duty log ---------- */
.dutylog {
  margin-top: 40px; background: var(--carbon-2);
  border: 1px solid var(--hairline); border-radius: 4px;
  padding: 0 clamp(18px, 3vw, 34px) 24px;
  font-family: "Courier Prime", monospace; font-size: clamp(13px, 1.5vw, 15.5px);
  overflow-x: auto;
}
.log-head {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 16px 0 12px; margin-bottom: 6px;
  border-bottom: 2px solid var(--hairline);
  font-weight: 700; letter-spacing: 0.12em; font-size: 13px;
}
.log-head span { color: var(--on-carbon-2); font-weight: 400; }
.dutylog p {
  padding: 8px 0; border-bottom: 1px solid rgba(58, 64, 102, 0.5);
  white-space: nowrap; color: var(--on-carbon);
}
.dutylog p b { color: var(--on-carbon-2); font-weight: 400; margin-right: 10px; }
.dutylog .demo-note { border: 0; white-space: normal; padding-top: 14px; }
.dots {
  display: inline-block; min-width: 40px; flex: 1;
  border-bottom: 2px dotted rgba(154, 160, 196, 0.5);
  transform: translateY(-3px); margin: 0 6px;
}
.bad { color: #ff8f86; font-weight: 700; }
.ok { color: #7fd99a; font-weight: 700; }

/* ---------- carbon reveal + report ---------- */
.carbon { position: relative; margin-top: 44px; }
.carbon-top { position: relative; z-index: 2; width: min(560px, 92%); }
.carbon-top .slip { padding-bottom: 20px; }
.mono-line {
  margin: 12px 22px 0; font-family: "Courier Prime", monospace;
  font-size: 14px; color: var(--ink);
}
.mono-line.faint { color: var(--ink-carbon); text-shadow: 0 0 0.3px currentColor; }
.motion .carbon-top {
  transition: transform 700ms cubic-bezier(0.2, 0.9, 0.25, 1);
}
.motion .carbon.revealed .carbon-top { transform: translate(-4%, -12px) rotate(-2.4deg); }
.settled .carbon-top { transform: translate(-4%, -12px) rotate(-2.4deg); }

.report {
  position: relative; z-index: 1; width: min(680px, 100%);
  margin: -34px 0 0 auto; background: var(--canary); color: var(--ink);
  border-radius: 3px; box-shadow: var(--slip-shadow);
  padding: clamp(20px, 3.5vw, 34px);
}
.report-brand {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  flex-wrap: wrap; padding-bottom: 14px; border-bottom: 2px solid var(--ink);
}
.logo-slot {
  border: 1.5px dashed rgba(33, 42, 94, 0.55); color: var(--ink);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; padding: 9px 14px;
  border-radius: 3px; opacity: 0.8;
}
.report-meta { font-size: 13.5px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.kpis div { border: 1.5px solid rgba(33, 42, 94, 0.4); border-radius: 3px; padding: 10px 12px; }
.kpis b { display: block; font-size: clamp(1.15rem, 2vw, 1.5rem); font-weight: 900; letter-spacing: -0.01em; }
.kpis span { font-size: 11px; line-height: 1.3; display: block; margin-top: 2px; }
.report table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.report th {
  text-align: left; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 6px 8px 6px 0; border-bottom: 1.5px solid var(--ink);
}
.report td { padding: 8px 8px 8px 0; border-bottom: 1px solid rgba(33, 42, 94, 0.28); }
.report td:nth-child(2), .report td:nth-child(3) { font-family: "Courier Prime", monospace; }
.chip {
  font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px;
  border: 1.5px solid currentColor; white-space: nowrap;
}
.ok-chip { color: #1e6b38; }
.watch-chip { color: #9a4a00; }
.report-incident {
  margin-top: 16px; padding: 12px 14px; font-size: 13.5px; line-height: 1.5;
  border: 1.5px solid rgba(33, 42, 94, 0.4); border-radius: 3px;
}
.report-incident .chip { margin-left: 6px; }
.report-foot {
  margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(33, 42, 94, 0.35);
  font-size: 12.5px;
}
#copy .demo-note { margin-top: 22px; }
.see-report { margin-top: 14px; }
.see-report a { color: var(--canary); font-weight: 600; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.see-report a:hover { color: var(--paper); }

/* ---------- steps ---------- */
.steps {
  list-style: none; margin-top: 40px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 2.5vw, 28px);
}
.step { padding-bottom: 22px; transform: rotate(-0.6deg); }
.step:nth-child(2) { transform: rotate(0.8deg); }
.step:nth-child(3) { transform: rotate(-0.4deg); }
.step p { margin: 14px 22px 0; font-size: 14.5px; line-height: 1.55; color: var(--ink); }

/* ---------- memo ---------- */
.memo {
  margin-top: 34px; max-width: 74ch;
  font-family: "Courier Prime", monospace; font-size: 15.5px; line-height: 1.7;
}
.memo p + p { margin-top: 18px; }
.memo b { color: var(--canary); font-weight: 700; }
.memo p { color: var(--on-carbon); }

/* ---------- pricing ---------- */
.price-slip { max-width: 620px; margin-top: 40px; padding-bottom: 30px; position: relative; }
.price-slip .slip-head { border-color: var(--ink); }
.price { margin: 20px 150px 0 22px; font-size: 1.1rem; color: var(--ink); }
.price b { font-size: clamp(2.4rem, 5vw, 3.2rem); font-weight: 900; letter-spacing: -0.02em; }
.included { list-style: none; margin: 18px 22px 0; }
.included li {
  display: flex; gap: 10px; padding: 7px 0; font-size: 15px; color: var(--ink);
}
.included li + li { border-top: 1px dashed rgba(33, 42, 94, 0.3); }
.included i {
  font-style: normal; font-family: "Courier Prime", monospace; font-weight: 700; flex: none;
}
.price-note { margin: 18px 22px 0; font-size: 13.5px; color: var(--ink); opacity: 0.8; max-width: 48ch; }
.price-slip .cta-row { margin: 26px 22px 0; }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--hairline);
  padding: 36px clamp(20px, 5vw, 56px) 48px; text-align: center;
}
footer p { font-weight: 700; letter-spacing: 0.08em; font-size: 14px; }
.foot-fine {
  margin-top: 8px; font-weight: 400; letter-spacing: 0.02em;
  color: var(--on-carbon-2); font-size: 13.5px;
}

/* ---------- focus ---------- */
a:focus-visible {
  outline: 3px solid var(--canary); outline-offset: 3px; border-radius: 2px;
}
.foot-fine a { color: var(--on-carbon); }

/* ---------- reduced motion (CSS-complete, independent of JS timing) ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .motion .typed, .motion .stamp-hero { animation: none; }
  .motion .typed { max-width: 24ch; }
  .motion .carbon-top { transition: none; }
  .carbon-top { transform: translate(-4%, -12px) rotate(-2.4deg); }
}

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .slip-stack { justify-self: start; }
  .steps { grid-template-columns: 1fr; max-width: 560px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .report { margin-top: -20px; }
}
@media (max-width: 560px) {
  .top { flex-direction: column; align-items: flex-start; }
  .top nav { flex-wrap: wrap; }
  .dutylog p { white-space: normal; }
  .dots { display: none; }
  .carbon-top { width: 100%; }
  .motion .carbon.revealed .carbon-top, .settled .carbon-top {
    transform: translate(0, -10px) rotate(-1.6deg);
  }
  .stamp-price { top: 84px; font-size: 15px; }
  .price { margin-right: 120px; }
}
