/* AI Token Usage Monitor — landing page.
   Palette is taken verbatim from Views/Theme.swift and the menu bar accents
   documented in docs/04-ui-and-settings.md, so the mockups match the app. */

:root {
  /* surfaces */
  --bg:        #0F1115;
  --panel:     #16181D;   /* Theme background — opaque on purpose */
  --panel-2:   #1C1F26;
  --line:      #2A2E37;

  /* text (contrast measured against --panel) */
  --text:      #F2F5F7;   /* 16.2:1 */
  --label:     #B8BFC9;   /*  9.6:1 */
  --detail:    #9199A6;   /*  6.2:1 */

  /* severity */
  --calm:      #59DE80;
  --watch:     #FAD94D;
  --close:     #FFA842;
  --crit:      #FF736B;

  /* identity accents (dark bar) */
  --acc-ctx:   #5CD6E8;
  --acc-5h:    #7DA6FF;
  --acc-7d:    #D98CFF;

  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
          "Hiragino Sans", "Noto Sans CJK SC", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); font-weight: 650; }
h3 { font-size: 1.06rem; font-weight: 620; }
p  { margin: 0 0 1em; }
a  { color: var(--acc-ctx); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 760px; }
.wrap.center { text-align: center; }
.wrap.center .lead, .wrap.center .note { margin-left: auto; margin-right: auto; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--panel); padding: 10px 16px; z-index: 10;
}
.skip:focus { left: 8px; top: 8px; }

/* ── header ──────────────────────────────────────────────────────── */

.bar {
  position: sticky; top: 0; z-index: 5;
  background: rgba(15, 17, 21, .86);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar-in { display: flex; align-items: center; gap: 20px; min-height: 58px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 640; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 16px; height: 16px; border-radius: 5px;
  background: linear-gradient(150deg, var(--acc-ctx), var(--acc-5h) 55%, var(--acc-7d));
}
.brand-name { letter-spacing: -0.01em; }

.nav { display: flex; gap: 18px; margin-right: auto; font-size: .93rem; }
.nav a { color: var(--label); }
.nav a:hover { color: var(--text); text-decoration: none; }

.lang { display: flex; align-items: center; gap: 8px; }
.lang-lbl { color: var(--detail); font-size: .82rem; }
#lang-select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font: inherit; font-size: .88rem;
}

/* ── sections ────────────────────────────────────────────────────── */

.hero { padding: 72px 0 56px; text-align: center; }
.hero .lead { max-width: 62ch; margin: 0 auto 34px; }
.sec { padding: 64px 0; border-top: 1px solid var(--line); }
.sec.alt { background: #12141A; }
.lead { color: var(--label); font-size: 1.08rem; max-width: 74ch; }
.note { color: var(--detail); font-size: .93rem; max-width: 78ch; }
.small { font-size: .88rem; color: var(--detail); }
.dim { opacity: .8; }
.cap { color: var(--detail); font-size: .8rem; margin-top: 10px; }
.mini { color: var(--label); font-size: .95rem; }

.badge {
  display: inline-block; margin: 0 0 18px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 13px; font-size: .8rem; color: var(--label);
  background: var(--panel);
}

.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 26px 0 14px; }
.btn {
  display: inline-block; padding: 11px 20px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--text); font-size: .96rem; font-weight: 560;
}
.btn:hover { text-decoration: none; border-color: #3A4050; background: var(--panel-2); }
.btn-primary { background: var(--text); color: #0F1115; border-color: var(--text); }
.btn-primary:hover { background: #fff; border-color: #fff; }
.btn-store { padding: 13px 26px; font-size: 1rem; }

/* Not released yet: no href, so no pointer and no hover promise either. */
.btn.is-soon,
.btn.is-soon:hover {
  background: var(--panel); color: var(--label);
  border: 1px dashed #3F4654; cursor: default;
}

/* ── menu bar mockup ─────────────────────────────────────────────── */

.menubar-demo { display: flex; justify-content: center; margin: 8px 0 0; }
.menubar-demo.small { margin: 12px 0; justify-content: flex-start; }
.menubar {
  display: inline-flex; align-items: flex-end; gap: 18px;
  background: linear-gradient(180deg, #23262E, #1A1D23);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 16px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  overflow-x: auto;
  max-width: 100%;
}
.menubar-demo.small .menubar { font-size: 14px; gap: 14px; }

.seg { display: inline-flex; align-items: baseline; gap: 6px; padding-bottom: 4px; position: relative; }
.seg::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; border-radius: 1px; background: currentColor; opacity: .95;
}
.seg-ctx { color: var(--acc-ctx); }
.seg-5h  { color: var(--acc-5h); }
.seg-7d  { color: var(--acc-7d); }
.seg-lbl { color: currentColor; font-weight: 600; }
.seg-val { font-weight: 700; }
.seg-cd  { color: rgba(242, 245, 247, .87); font-weight: 500; font-size: .92em; }
.dot-sep { color: var(--detail); padding-bottom: 4px; }

.seg-val.pill {
  background: var(--crit); color: #14161A;
  border-radius: 5px; padding: 1px 6px;
}

.mb-icons { display: inline-flex; gap: 7px; padding-bottom: 6px; }
.mb-icons i { width: 11px; height: 11px; border-radius: 3px; background: #4A5060; display: block; }

/* ── cards ───────────────────────────────────────────────────────── */

.cards { display: grid; gap: 16px; margin-top: 28px; }
.cards-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cards.tight { margin-top: 22px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; min-width: 0;
}
.card p { margin: 0; color: var(--label); font-size: .95rem; }
.card h3 { margin-bottom: .35em; }

.swatch-row { display: flex; gap: 5px; margin-bottom: 12px; }
.sw { width: 22px; height: 6px; border-radius: 3px; display: block; }
.sev-calm-bg  { background: var(--calm); }
.sev-watch-bg { background: var(--watch); }
.sev-close-bg { background: var(--close); }
.sev-crit-bg  { background: var(--crit); }
.acc-ctx-bg   { background: var(--acc-ctx); }
.acc-5h-bg    { background: var(--acc-5h); }
.acc-7d-bg    { background: var(--acc-7d); }
.plain-bg     { background: var(--label); }

.sev-calm  { color: var(--calm); }
.sev-watch { color: var(--watch); }
.sev-close { color: var(--close); }
.sev-crit  { color: var(--crit); }

.split { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 34px; }
.split-col p { margin-bottom: 0; }

.legend {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: .87rem; color: var(--label);
}
.legend-t { color: var(--detail); text-transform: uppercase; letter-spacing: .06em; font-size: .76rem; }
.legend-i { display: inline-flex; align-items: center; gap: 7px; }

.ticks { list-style: none; padding: 0; margin: 0 0 28px; }
.ticks li {
  position: relative; padding-left: 24px; margin-bottom: 10px;
  color: var(--label); font-size: .96rem;
}
.ticks li::before {
  content: ""; position: absolute; left: 4px; top: .62em;
  width: 7px; height: 7px; border-radius: 2px; background: var(--calm);
}

/* ── panels (popover / widget / settings mockups) ─────────────────── */

.showcase { display: grid; gap: 34px; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); align-items: start; margin-top: 30px; }
.showcase-text h3 { margin-top: 6px; }
.showcase-text p { color: var(--label); }
.mock { margin: 0; }
.mock.centered { display: flex; flex-direction: column; align-items: center; margin-top: 26px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .45);
  padding: 16px;
  font-size: 13px;
  line-height: 1.45;
}
.popover { width: 100%; max-width: 340px; }
.widget  { width: 100%; max-width: 300px; }
.settings { width: 100%; max-width: 340px; }

.p-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.p-head-l { display: flex; align-items: center; gap: 7px; }
.p-model { font-weight: 660; font-size: 15px; }
.p-effort { color: var(--detail); font-size: 11.5px; }
.p-sub { color: var(--detail); font-size: 11.5px; margin-bottom: 14px; word-break: break-all; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.busy { background: var(--calm); box-shadow: 0 0 0 3px rgba(89, 222, 128, .16); }
.dot.idle { background: #545C6B; }

.p-sect-t {
  color: var(--detail); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .07em; margin: 0 0 8px;
}

.s-list { list-style: none; margin: 0 0 10px; padding: 0; }
.s-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.s-list.compact li { padding: 3px 0; }
.s-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.s-track { flex: 0 0 74px; height: 5px; border-radius: 3px; background: #2C313B; overflow: hidden; display: block; }
.s-track.wide { flex: none; width: 100%; height: 6px; margin: 6px 0; }
.s-track i { display: block; height: 100%; border-radius: 3px; }
.s-pct { flex: 0 0 36px; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 640; font-size: 12px; }

.p-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--detail); font-size: 11px; padding: 2px 0 14px; border-bottom: 1px solid var(--line); }

.gauge { padding: 13px 0; border-bottom: 1px solid var(--line); }
.g-top { display: flex; justify-content: space-between; align-items: baseline; }
.g-title { color: var(--label); }
.g-pct { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; }
.g-bot { display: flex; justify-content: space-between; gap: 10px; color: var(--detail); font-size: 11px; }
.g-src { flex: none; }

.p-foot { display: flex; gap: 8px; padding-top: 13px; }
.fbtn {
  flex: 1 1 0; text-align: center; padding: 6px 4px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 7px; color: var(--label); font-size: 11.5px;
}

.w-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.w-title { color: var(--label); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.w-x { color: var(--detail); }
.w-model { display: flex; align-items: center; gap: 7px; font-weight: 640; margin-bottom: 10px; }
.w-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; color: var(--label); }
.w-row span:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 640; }

.set-sect {
  color: var(--detail); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .07em; margin: 16px 0 6px;
}
.set-sect:first-child { margin-top: 0; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; color: var(--text); }
.set-hint { color: var(--detail); font-size: 11px; margin: 4px 0 0; }
.sw-on, .sw-off { width: 30px; height: 17px; border-radius: 999px; flex: none; position: relative; display: block; }
.sw-on  { background: var(--calm); }
.sw-off { background: #3A4050; }
.sw-on::after, .sw-off::after {
  content: ""; position: absolute; top: 2px; width: 13px; height: 13px;
  border-radius: 50%; background: #14161A;
}
.sw-on::after  { right: 2px; }
.sw-off::after { left: 2px; background: #C6CCD6; }
.pickr { color: var(--label); font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }

/* ── table ───────────────────────────────────────────────────────── */

.tablewrap { overflow-x: auto; margin: 26px 0 18px; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .94rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--detail); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; background: var(--panel); }
td { color: var(--label); }
td:first-child { color: var(--text); font-weight: 560; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }

/* ── chips + footer ──────────────────────────────────────────────── */

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 22px 0 16px; }
.chips a {
  display: inline-block; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--label); font-size: .9rem;
}
.chips a:hover { text-decoration: none; color: var(--text); border-color: #3A4050; }

.foot { border-top: 1px solid var(--line); padding: 30px 0 44px; }
.foot p { margin: 0 0 6px; }

/* A button that reads as a link: reopening the consent banner is an action,
   not navigation, so it must not be an <a> — but it should not look like a
   call to action either. */
.linky {
  background: none; border: 0; padding: 0;
  font: inherit; font-size: inherit; color: var(--acc-ctx);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.linky:hover { color: var(--text); }

/* ── consent banner ──────────────────────────────────────────────────
   .consent sets display:flex, which would beat the [hidden] attribute's
   user-agent display:none — hence the explicit rule first. */

[hidden] { display: none !important; }

.consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: rgba(15, 17, 21, .94);
  backdrop-filter: saturate(140%) blur(12px);
  border-top: 1px solid var(--line);
}
.consent-in {
  width: 100%; max-width: 1080px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.consent-text { flex: 1 1 340px; min-width: 0; }
.consent-t { color: var(--text); font-weight: 620; margin: 0 0 2px; font-size: .95rem; }
.consent-text p:last-child { margin: 0; max-width: 78ch; }
.consent-btns { display: flex; gap: 10px; flex: 0 0 auto; margin-left: auto; }

/* The two answers are the same size on purpose: a decline styled as an
   afterthought is a dark pattern, and a regulator reads it as one. */
.btn-sm {
  padding: 8px 16px; font-size: .9rem; cursor: pointer;
  font-family: inherit; line-height: 1.4;
}

@media (max-width: 560px) {
  .consent-btns { margin-left: 0; width: 100%; }
  .consent-btns .btn { flex: 1 1 0; text-align: center; }
}

/* ── narrow screens ──────────────────────────────────────────────── */

@media (max-width: 860px) {
  .showcase { grid-template-columns: 1fr; }
  .mock { display: flex; flex-direction: column; align-items: center; }
  .hero { padding: 52px 0 40px; }
  .sec { padding: 48px 0; }
  .nav { display: none; }
  .bar-in { justify-content: space-between; }
  .brand { margin-right: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
