/* Landing, scanning and toolbar UI. Same paper-and-ink language as the report. */
:root {
  --accent: #d2402a;
  --bg: #f4efe6;
  --surface: #fbf8f2;
  --ink: #15171b;
  --ink-2: #4b4f56;
  --ink-3: #8a857c;
  --rule: #ddd4c5;
  --error: #b3321f;
  --notice-bg: #f7e7c8;
  --grain-opacity: 0.4;
  --grain-blend: multiply;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101216;
    --surface: #171a1f;
    --ink: #efe9df;
    --ink-2: #b9b2a6;
    --ink-3: #847d72;
    --rule: #2b2f36;
    --error: #ff8f7a;
    --notice-bg: #2c2415;
    --grain-opacity: 0.18;
    --grain-blend: screen;
  }
}
:root[data-theme="dark"] {
  --bg: #101216; --surface: #171a1f; --ink: #efe9df; --ink-2: #b9b2a6; --ink-3: #847d72;
  --rule: #2b2f36; --error: #ff8f7a; --notice-bg: #2c2415; --grain-opacity: 0.18; --grain-blend: screen;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
code { font-family: var(--mono); font-size: 0.86em; }

/* Paper grain over the app UI (not the report pages) */
body:has([data-view="landing"]:not([hidden])),
body:has([data-view="scanning"]:not([hidden])) { position: relative; }
.landing::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: var(--grain-opacity); mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.45 0 0 0 0 0.4 0 0 0 0.35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.landing > * { position: relative; z-index: 1; }

.landing { max-width: 1160px; margin: 0 auto; padding: 22px 32px 40px; min-height: 100vh; display: flex; flex-direction: column; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 12px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; }
.brand-mark { width: 12px; height: 12px; background: var(--accent); transform: rotate(45deg); display: inline-block; flex: none; }

.nav { display: flex; align-items: center; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--ink); }
.nav-tag { font: 500 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }

/* Hero */
.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 56px; align-items: center; padding: 72px 0 64px; }
.eyebrow { font: 600 11.5px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin: 0 0 26px; }
.hero h1, .scan h1 {
  font-family: var(--serif); font-weight: 380; font-size: clamp(44px, 6.4vw, 84px); line-height: 0.98;
  letter-spacing: -0.035em; margin: 0; font-variation-settings: "opsz" 144, "SOFT" 40, "WONK" 1;
}
.hero h1 em, .scan h1 em { font-style: italic; color: var(--accent); font-weight: 340; }
.hero-sub { font-size: 18.5px; line-height: 1.55; color: var(--ink-2); max-width: 31em; margin: 28px 0 34px; }

.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.btn {
  font: 600 15px/1 var(--sans); border-radius: 999px; cursor: pointer; border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 10px; transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary { background: var(--ink); color: var(--bg); padding: 17px 26px 17px 20px; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.55); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 28px -14px rgba(0, 0, 0, 0.6); }
.ms-logo { width: 18px; height: 18px; }
.btn-ghost { background: none; color: var(--ink); padding: 12px 2px; border-bottom: 1px solid var(--ink); border-radius: 0; }
.btn-ghost span { transition: transform 0.15s ease; display: inline-block; }
.btn-ghost:hover span { transform: translateX(4px); }
.btn-small { font-size: 13px; padding: 9px 15px; background: var(--surface); color: var(--ink); border-color: var(--rule); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.06); }
.btn-quiet { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.notice { background: var(--notice-bg); border-left: 3px solid #c98a1a; padding: 12px 14px; margin: -8px 0 26px; font-size: 14px; max-width: 34em; }
.error { color: var(--error); font-weight: 600; margin-top: 18px; max-width: 34em; }

/* Hero art: a mini report cover over a checklist sheet */
.hero-art { position: relative; height: 470px; }
.sheet { position: absolute; width: 300px; height: 390px; border-radius: 3px; box-shadow: 0 30px 60px -28px rgba(20, 16, 10, 0.55), 0 2px 4px rgba(20, 16, 10, 0.08); }
.sheet-back { right: 4px; top: 10px; background: #fbf8f2; transform: rotate(5deg); padding: 34px 28px; display: flex; flex-direction: column; gap: 16px; }
.sb-head { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid #15171b; }
.sb-head i { display: block; height: 7px; background: #d9d1c3; border-radius: 2px; }
.sb-head i:first-child { width: 40%; background: #d2402a; height: 5px; }
.sb-head i:last-child { width: 82%; height: 14px; background: #2a2c31; }
.sb-row { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid #e6dfd3; }
.sb-row b { display: block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.sb-row b.f { background: #d2402a; } .sb-row b.w { background: #b97708; } .sb-row b.p { background: #1d7458; }
.sb-row i { height: 6px; background: #d9d1c3; border-radius: 2px; flex: 1; }
.sb-row em { font: 700 7px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: #d2402a; border: 1px solid #d2402a; padding: 3px 4px 2px; border-radius: 2px; font-style: normal; }
.sheet-front {
  left: 0; bottom: 0; background: #111317; color: #f4efe6; transform: rotate(-4deg); overflow: hidden; padding: 26px 24px;
  background-image: radial-gradient(ellipse at 80% 85%, rgba(210, 64, 42, 0.28), transparent 60%);
}
.sf-rings { position: absolute; inset: 0; width: 100%; height: 100%; }
.sf-rings circle { fill: none; stroke: rgba(244, 239, 230, 0.1); }
.sf-track { fill: none; stroke: rgba(244, 239, 230, 0.12); stroke-width: 9; }
.sf-value { fill: none; stroke: #d2402a; stroke-width: 9; }
.sf-brand { position: relative; display: flex; align-items: center; gap: 8px; font: 600 8px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: rgba(244, 239, 230, 0.7); }
.sf-brand .brand-mark { width: 7px; height: 7px; }
.sf-org { position: absolute; left: 24px; top: 150px; font-family: var(--serif); font-size: 40px; line-height: 0.98; letter-spacing: -0.03em; font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 1; }
.sf-pill { position: absolute; left: 24px; top: 250px; display: inline-flex; align-items: center; gap: 6px; font: 600 8px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; border: 1px solid rgba(244, 239, 230, 0.35); border-radius: 20px; padding: 6px 9px; }
.sf-pill i { width: 6px; height: 6px; border-radius: 50%; background: #d2402a; }
.sf-score { position: absolute; right: 34px; bottom: 26px; font-family: var(--serif); font-size: 44px; line-height: 1; letter-spacing: -0.03em; }
.sf-score small { font-size: 18px; opacity: 0.7; }

/* Promises */
.promises { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ink); }
.promise { padding: 22px 26px 26px 0; }
.promise + .promise { padding-left: 26px; border-left: 1px solid var(--rule); }
.p-num { font: 700 11px/1 var(--mono); color: var(--accent); letter-spacing: 0.1em; }
.promise h2 { font-family: var(--serif); font-weight: 420; font-size: 26px; letter-spacing: -0.015em; margin: 12px 0 8px; font-variation-settings: "opsz" 72; }
.promise p { margin: 0; color: var(--ink-2); font-size: 15px; }

/* FAQ */
.faq { margin-top: 36px; border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; list-style: none; padding: 18px 0; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 22px/1 var(--mono); color: var(--ink-3); transition: transform 0.2s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq-body { padding: 0 0 20px; color: var(--ink-2); max-width: 46em; }
.faq-body p { margin: 0 0 10px; }
.faq-body ul { margin: 0 0 10px; padding-left: 18px; }
.faq-body label { display: block; margin: 14px 0 8px; font-size: 14px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font: 12.5px/1.4 var(--mono); padding: 9px 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); color: var(--ink); }

.foot { margin-top: auto; padding-top: 40px; display: flex; justify-content: space-between; gap: 16px; font: 500 11px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }

/* Scanning */
.scan { padding: 80px 0 40px; max-width: 820px; }
.scan h1 { font-size: clamp(40px, 6vw, 72px); }
.progress-track { height: 3px; background: var(--rule); margin: 40px 0 28px; overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.35s ease; }
.progress-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 36px; counter-reset: step; }
.progress-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); color: var(--ink-3); font-size: 15px; counter-increment: step; transition: color 0.2s ease; }
.progress-list li::before { content: counter(step, decimal-leading-zero); font: 600 10.5px/1 var(--mono); color: var(--ink-3); width: 20px; }
.progress-list .dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--rule); flex: none; order: 3; margin-left: auto; }
.progress-list li.running { color: var(--ink); }
.progress-list li.running .dot { border-color: var(--accent); animation: pulse 0.9s ease-in-out infinite; }
.progress-list li.done { color: var(--ink); }
.progress-list li.done .dot { background: #1d7458; border-color: #1d7458; }
.progress-list li.failed .dot { background: #b97708; border-color: #b97708; }
.step-note { font: 500 10.5px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: #b97708; order: 2; margin-left: auto; }
.progress-list li.failed .dot { margin-left: 10px; }
@keyframes pulse { 50% { transform: scale(1.35); opacity: 0.45; } }

/* Report toolbar */
.toolbar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 12px 22px; background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.toolbar .brand { margin-right: auto; }
.toggle { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 32px; height: 18px; border-radius: 10px; background: var(--rule); position: relative; transition: background 0.2s ease; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.2s ease; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.toggle input:checked + .switch { background: var(--accent); }
.toggle input:checked + .switch::after { transform: translateX(14px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
body:has([data-view="report"]:not([hidden])) { background: var(--bg); }

/* Load-in */
.reveal { opacity: 0; transform: translateY(14px); animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; animation-delay: calc(var(--d, 0) * 90ms + 60ms); }
.hero-art.reveal { transform: translateY(24px) rotate(1deg); }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
  .progress-list li.running .dot { animation: none; }
  .btn, .switch, .switch::after, #progress-bar { transition: none; }
}

/* Small screens */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 48px 0 44px; }
  .hero-art { height: 380px; max-width: 420px; width: 100%; margin: 0 auto; }
  .sheet { width: 240px; height: 312px; }
  .sf-org { font-size: 32px; top: 120px; } .sf-pill { top: 200px; }
}
@media (max-width: 640px) {
  .landing { padding: 16px 16px 28px; }
  .nav-tag { display: none; }
  .hero-sub { font-size: 16.5px; }
  .hero-art { height: 330px; }
  .sheet { width: 205px; height: 268px; }
  .sheet-back { padding: 22px 18px; gap: 11px; }
  .sf-org { font-size: 27px; top: 100px; } .sf-pill { top: 170px; } .sf-score { font-size: 34px; }
  .promises { grid-template-columns: 1fr; }
  .promise, .promise + .promise { padding: 20px 0; border-left: 0; border-bottom: 1px solid var(--rule); }
  .progress-list { grid-template-columns: 1fr; }
  .toolbar { padding: 10px 16px; }
  .toolbar .brand { width: 100%; }
  .foot { flex-direction: column; }
}
