/* ------------------------------------------------------------------------
   Envy subpage design system.

   The same 70/20/10 language as the front page: warm charcoal ground (the
   app icon's own field), red as solid surface, green only where the app is
   literally green, blue for wayfinding. Hairline rules and left-aligned
   grotesk do the structural work; nothing here is a card with a shadow.

   Replaces style.css + docs.css. Deliberately styles the *existing* class
   vocabulary of docs.html and changelog.html rather than inventing a new
   one, so the pages keep their markup and only change appearance.
   ------------------------------------------------------------------------ */

:root {
  --ground: #282520;
  --panel: #322F28;
  --rule: #45413A;
  --ink: rgba(255,255,255,0.87);
  --ink-soft: rgba(255,255,255,0.55);
  --ink-faint: rgba(255,255,255,0.34);
  --frame: #17150F;
  --red: #FF4B39;
  --red-deep: #D93526;
  --on-red: #14100F;
  --green: #30D158;
  --green-wash: rgba(48,209,88,0.15);
  --blue: #5A80FF;
  --blue-wash: rgba(90,128,255,0.45);
  --grotesk: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 12px;
}

/* Light swaps ground and ink only; the accents fall through, so both
   themes run one palette. See the front page for what that costs. */
@media (prefers-color-scheme: light) {
  :root {
    --ground: #FAFAF8; --panel: #F0EFEA; --rule: #D8D8D3;
    --ink: rgba(0,0,0,0.88); --ink-soft: rgba(0,0,0,0.56); --ink-faint: rgba(0,0,0,0.34);
    --frame: #FFFFFF;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--ground); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--grotesk);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--panel);
  padding: 1px 5px;
  color: var(--ink);
}

/* ---- nav -------------------------------------------------------------- */

.navbar { border-bottom: 1px solid var(--rule); background: var(--ground); position: sticky; top: 0; z-index: 50; }
.navbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 32px;
  display: flex; align-items: center; gap: 24px;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  text-decoration: none; color: var(--ink);
  font-weight: 700; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
}
.brand-icon, .footer-icon { width: 22px; height: 22px; border-radius: 22.37%; display: block; flex: none; }
.footer-icon { width: 56px; height: 56px; }

.nav-links { margin-left: auto; display: flex; align-items: center; gap: 26px; }
/* At rest these are part of the bar's own type, not scattered blue; the
   blue arrives on hover, where it confirms the target rather than
   advertising it. Same rule as the front page's footer. */
.nav-links a {
  color: var(--ink); text-decoration: none;
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
}
.nav-links a:hover { color: var(--blue); }
.nav-links .nav-download {
  background: var(--red); color: var(--on-red);
  padding: 10px 18px; border: 1px solid var(--red);
}
.nav-links .nav-download:hover { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }

.nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--ink); margin: 4px 0; }

@media (max-width: 760px) {
  .navbar-inner { flex-wrap: wrap; padding: 12px 20px; }
  .nav-toggle { display: block; margin-left: auto; }
  .nav-links { display: none; width: 100%; flex-direction: column; align-items: flex-start; gap: 14px; padding: 14px 0 4px; }
  .navbar.nav-open .nav-links, .navbar.open .nav-links, .nav-links.open { display: flex; }
}

/* ---- page head -------------------------------------------------------- */

.docs-hero { max-width: 1180px; margin: 0 auto; padding: 72px 32px 40px; }
.docs-hero h1 {
  font-size: clamp(2.6rem, 8vw, 5rem); font-weight: 800;
  letter-spacing: -0.045em; line-height: 0.92; margin: 0 0 18px;
}
.docs-hero p { margin: 0; font-size: 17px; line-height: 1.55; color: var(--ink-soft); max-width: 62ch; }

/* ---- layout ----------------------------------------------------------- */

.docs-layout {
  max-width: 1180px; margin: 0 auto; padding: 0 32px 96px;
  display: grid; grid-template-columns: minmax(0, 210px) minmax(0, 1fr); gap: 56px;
  align-items: start;
}
@media (max-width: 900px) { .docs-layout { grid-template-columns: 1fr; gap: 32px; } }

.docs-nav {
  position: sticky; top: 92px;
  display: flex; flex-direction: column; gap: 2px;
  border-top: 1px solid var(--rule); padding-top: 14px;
}
@media (max-width: 900px) { .docs-nav { position: static; } }
.docs-nav a {
  color: var(--ink-soft); text-decoration: none;
  font-size: 12px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  padding: 7px 0 7px 12px; border-left: 2px solid transparent;
}
.docs-nav a:hover { color: var(--ink); }
/* The red marks where you are: one of the few places it isn't surface,
   and it's earned: this is the only genuinely stateful thing on the page. */
.docs-nav a.active { color: var(--ink); border-left-color: var(--red); }

/* ---- sections --------------------------------------------------------- */

.docs-section { padding-top: 8px; }
.docs-section + .docs-section { margin-top: 72px; }
.docs-section h2 {
  font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 800;
  letter-spacing: -0.035em; line-height: 1; margin: 0 0 18px;
  padding-bottom: 18px; border-bottom: 2px solid var(--red);
}
.docs-intro { font-size: 17px; line-height: 1.6; color: var(--ink-soft); max-width: 68ch; margin: 0 0 8px; }

/* Blocks divided by hairlines rather than drawn as cards, the same device
   the front page's index uses. */
.docs-block { border-top: 1px solid var(--rule); padding: 24px 0 4px; }
.docs-section > .docs-block:first-of-type { border-top: 0; }
.docs-block h3 {
  font-size: clamp(1.1rem, 2vw, 1.35rem); font-weight: 700;
  letter-spacing: -0.022em; margin: 0 0 10px;
}
.docs-block p { margin: 0 0 12px; color: var(--ink-soft); max-width: 72ch; }
.docs-block p:last-child { margin-bottom: 0; }
.docs-block ul, .docs-block ol { color: var(--ink-soft); max-width: 72ch; padding-left: 20px; }
.docs-block li { margin-bottom: 6px; }
.docs-block strong { color: var(--ink); }

/* ---- tables ----------------------------------------------------------- */

.docs-table-wrap { overflow-x: auto; margin: 4px 0 16px; }
.docs-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.docs-table th {
  text-align: left; font-size: 11px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft);
  padding: 0 16px 10px 0; border-bottom: 1px solid var(--rule);
}
.docs-table td {
  padding: 11px 16px 11px 0; border-bottom: 1px solid var(--rule);
  color: var(--ink-soft); vertical-align: top;
}
.docs-table td:first-child { color: var(--ink); font-family: var(--mono); font-size: 0.88em; white-space: nowrap; }

/* ---- marks ------------------------------------------------------------ */

.key {
  font-family: var(--mono); font-size: 0.86em; color: var(--ink);
  background: var(--panel); border: 1px solid var(--rule);
  padding: 2px 7px; white-space: nowrap;
}
/* Green, and literal: this is what a tag actually looks like in the app. */
.docs-tag-demo {
  font-family: var(--mono); font-size: 0.9em; font-weight: 700;
  color: var(--green); background: var(--green-wash); padding: 1px 6px;
}
.docs-callout {
  border-left: 2px solid var(--red); padding: 2px 0 2px 14px;
  margin: 14px 0; color: var(--ink-soft);
}
.docs-callout p { margin: 0 0 8px; }
.docs-callout p:last-child { margin-bottom: 0; }

/* ---- buttons ---------------------------------------------------------- */

.btn {
  display: inline-block; text-decoration: none;
  font-size: 14px; font-weight: 700; padding: 14px 26px;
  background: var(--red); color: var(--on-red); border: 1px solid var(--red);
}
.btn:hover { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-secondary:hover { background: var(--ink); color: var(--ground); border-color: var(--ink); }

/* ---- footer ----------------------------------------------------------- */

.footer { border-top: 1px solid var(--rule); }
.footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 48px 32px 64px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 20px;
}
.footer-inner p { margin: 0; color: var(--ink-soft); font-size: 14px; flex: 1 1 260px; }
.footer-fine { font-size: 12px; color: var(--ink-faint); }
