/* ==========================================================================
   TRUE Style Guide, guide chrome.
   The chrome itself is built from the same tokens it documents.
   Brand tokens (--true-*, --font-*) are the frozen contract; --g-* variables
   are internal to the guide chrome and must never be copied into products.
   ========================================================================== */

/* ---- Brand tokens: the frozen contract -------------------------------- */
:root {
  --true-blue: #7DCADE;
  --true-pink: #D82A80;
  --true-gradient: linear-gradient(90deg, #7DCADE, #D82A80);
  --true-dark: #1C1C1E;
  --true-gray: #636366;
  --true-surface: #F8F8FB;
  --true-border: #E5E5EA;
  --font-display-sc: 'Marcellus SC', Georgia, serif;
  --font-display: 'Marcellus', Georgia, serif;
  --font-body: 'Helvetica Neue Updated', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  /* Verified production values that are not yet in the frozen contract.
     Named --true-* because they come straight from the shipped CSS. */
  --true-focus: #0050BD;          /* real focus ring on light */
  --true-green: #1CA800;          /* .yes badge */
  --true-micro: #A1A1A1;          /* footer micro links */

  /* Guide chrome only. Do not copy. */
  --g-topbar-h: 64px;
  --g-sidebar-w: 248px;
  --g-content-max: 1060px;
  --g-code-bg: #17171A;
}

/* ---- Fonts: the real files served locally ------------------------------ */
@font-face { font-family: 'Helvetica Neue Updated'; src: url('fonts/HelveticaNeue-Roman.otf') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Helvetica Neue Updated'; src: url('fonts/HelveticaNeue-Medium.otf') format('opentype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Marcellus'; src: url('fonts/Marcellus-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Marcellus SC'; src: url('fonts/MarcellusSC-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }

/* ---- Reset and base ---------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
  color: var(--true-dark);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(125, 202, 222, 0.35); }

a { color: inherit; }
:focus-visible { outline: 2px solid var(--true-focus); outline-offset: 0; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--true-dark); color: #fff; padding: 10px 18px;
  border-radius: 0 0 8px 0; text-decoration: none; font-size: 14px;
}
.skip-link:focus { left: 0; }

/* ---- Top strip and topbar ---------------------------------------------- */
.topstrip { height: 4px; background: var(--true-gradient); position: fixed; top: 0; left: 0; right: 0; z-index: 40; }
.topbar {
  position: fixed; top: 4px; left: 0; right: 0; z-index: 30;
  height: var(--g-topbar-h);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--true-border);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 32px;
}
.lockup { --wm-h: 24px; display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--true-dark); }
.lockup svg { display: block; width: calc(var(--wm-h) * 3.125); height: var(--wm-h); align-self: baseline; }
/* Name on the wordmark's baseline, lifted to centre on the TRUE letters: Logo and wordmark section. */
.lockup span { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--true-gray); align-self: baseline; line-height: 1; margin-bottom: -1em; position: relative; top: calc(0.36em - 0.5055 * var(--wm-h)); }
.topbar-meta { margin-left: auto; display: flex; align-items: center; gap: 20px; font-size: 13px; color: var(--true-gray); }
.topbar-meta a { color: var(--true-dark); text-decoration: none; }
.topbar-meta a:hover { color: var(--true-pink); }
.topbar-tag {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--true-border); border-radius: 999px; padding: 4px 10px; color: var(--true-gray);
}

/* ---- Layout ------------------------------------------------------------ */
.shell { display: flex; padding-top: calc(var(--g-topbar-h) + 4px); }

.sidenav {
  position: sticky; top: calc(var(--g-topbar-h) + 4px);
  align-self: flex-start;
  width: var(--g-sidebar-w); flex: 0 0 var(--g-sidebar-w);
  height: calc(100vh - var(--g-topbar-h) - 4px);
  overflow-y: auto;
  padding: 32px 20px 48px 28px;
  border-right: 1px solid var(--true-border);
  scrollbar-width: thin;
}
.sidenav-group { margin-bottom: 26px; }
.sidenav-group > span {
  display: block; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--true-gray); margin-bottom: 8px;
}
.sidenav a {
  display: block; font-size: 14px; line-height: 20px; padding: 5px 10px;
  color: var(--true-gray); text-decoration: none; border-radius: 8px;
}
.sidenav a:hover { color: var(--true-dark); background: var(--true-surface); }
.sidenav a.active { color: var(--true-dark); background: var(--true-surface); font-weight: 500; }

main { flex: 1; min-width: 0; padding: 0 48px 120px; }
.content { max-width: var(--g-content-max); margin: 0 auto; }

/* ---- Guide hero -------------------------------------------------------- */
.guide-hero { padding: 88px 0 72px; border-bottom: 1px solid var(--true-border); }
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--true-gray);
  margin-bottom: 20px;
}
.kicker i { width: 7px; height: 7px; border-radius: 50%; background: var(--true-pink); }
.guide-hero h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: 48px; line-height: 56px; letter-spacing: 0.005em;
  max-width: 720px; margin-bottom: 20px;
}
.grad-word {
  color: var(--true-pink);
  background: var(--true-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.guide-hero .sub { font-size: 18px; line-height: 28px; color: var(--true-gray); max-width: 580px; }

/* ---- Sections ---------------------------------------------------------- */
.sg-section { padding-top: 96px; scroll-margin-top: calc(var(--g-topbar-h) + 24px); }
.sg-section + .sg-section { margin-top: 64px; }
.sg-section > header { max-width: 640px; margin-bottom: 40px; }
.sg-section h2 { font-family: var(--font-display); font-weight: 400; font-size: 32px; line-height: 40px; margin-bottom: 14px; }
.sg-section header p { color: var(--true-gray); max-width: 600px; }
.sg-sub { margin: 48px 0 20px; }
.sg-sub h3 { font-size: 20px; line-height: 28px; font-weight: 500; margin-bottom: 6px; }
.sg-sub p { color: var(--true-gray); font-size: 15px; max-width: 600px; }
.prose { max-width: 600px; color: var(--true-gray); }
.prose + .prose { margin-top: 12px; }
.prose b, .prose strong { color: var(--true-dark); font-weight: 500; }
.prose code, .spec-table code, li code {
  font-family: 'SF Mono', ui-monospace, Menlo, Consolas, 'DejaVu Sans Mono', monospace;
  font-size: 0.85em; background: var(--true-surface);
  border: 1px solid var(--true-border); border-radius: 4px; padding: 1px 5px;
  color: var(--true-dark); white-space: nowrap;
}

/* ---- Example blocks (rendered by guide.js) ----------------------------- */
.ex { margin: 24px 0; border: 1px solid var(--true-border); border-radius: 16px; overflow: hidden; background: #fff; }
.ex-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--true-border);
  background: var(--true-surface);
}
.ex-title { font-size: 13px; font-weight: 500; color: var(--true-dark); }
.ex-note { font-size: 12px; color: var(--true-gray); }
.ex-actions { margin-left: auto; display: flex; gap: 8px; }
.ex-btn {
  font-family: var(--font-body); font-size: 12px; line-height: 16px;
  padding: 5px 12px; border-radius: 8px; cursor: pointer;
  background: #fff; color: var(--true-dark); border: 1px solid var(--true-border);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.ex-btn:hover { border-color: var(--true-dark); }
.ex-btn.copied { background: var(--true-green); border-color: var(--true-green); color: #fff; }
.ex-btn.copy-failed { border-color: var(--true-pink); color: var(--true-pink); }
.ex-stage { padding: 40px; overflow-x: auto; }
.ex[data-bg="dark"] .ex-stage { background: var(--true-dark); }
.ex[data-bg="surface"] .ex-stage { background: var(--true-surface); }
.ex[data-pad="0"] .ex-stage { padding: 0; }
.ex-code { display: none; border-top: 1px solid var(--true-border); background: var(--g-code-bg); max-height: 480px; overflow: auto; }
.ex.show-code .ex-code { display: block; }
.ex-code pre { margin: 0; padding: 20px 24px; }
.ex-code code {
  font-family: 'SF Mono', ui-monospace, Menlo, Consolas, 'DejaVu Sans Mono', monospace;
  font-size: 12.5px; line-height: 20px; color: #E5E5EA; white-space: pre-wrap;
}

/* ---- Spec tables ------------------------------------------------------- */
.spec-table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; line-height: 20px; }
.spec-table th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--true-gray); font-weight: 500; padding: 8px 14px 8px 0;
  border-bottom: 1px solid var(--true-border);
}
.spec-table td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--true-border); vertical-align: top; }
.spec-table td:first-child { font-weight: 500; white-space: nowrap; }
.spec-table .muted { color: var(--true-gray); }
.spec-table .nw { white-space: nowrap; }

/* ---- Swatches ---------------------------------------------------------- */
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin: 24px 0; }
.swatch { border: 1px solid var(--true-border); border-radius: 12px; overflow: hidden; cursor: pointer; background: #fff; text-align: left; padding: 0; font-family: var(--font-body); transition: border-color 0.2s; }
.swatch:hover { border-color: var(--true-gray); }
.swatch-chip { height: 72px; }
.swatch-meta { padding: 10px 14px; }
.swatch-meta b { display: block; font-size: 13px; font-weight: 500; color: var(--true-dark); }
.swatch-meta span { font-size: 12px; color: var(--true-gray); font-family: ui-monospace, Menlo, monospace; }
.swatch-meta small { display: block; font-size: 11px; color: var(--true-gray); margin-top: 2px; }

/* ---- Do / don't pairs -------------------------------------------------- */
.dodont { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 24px 0; }
.dodont-card { border: 1px solid var(--true-border); border-radius: 12px; overflow: hidden; }
.dodont-card .demo { padding: 28px; min-height: 96px; display: flex; align-items: center; justify-content: center; }
.dodont-card.dark .demo { background: var(--true-dark); }
.dodont-card figcaption { border-top: 1px solid var(--true-border); padding: 12px 16px; font-size: 13px; line-height: 19px; color: var(--true-gray); }
.dodont-card figcaption b { display: flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 3px; color: var(--true-dark); }
.dodont-card figcaption b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.dodont-card.do figcaption b::before { background: var(--true-green); }
.dodont-card.dont figcaption b::before { background: var(--true-pink); }

/* ---- Start here -------------------------------------------------------- */
.rules { counter-reset: rule; margin: 28px 0; border: 1px solid var(--true-border); border-radius: 16px; overflow: hidden; }
.rules li {
  list-style: none; counter-increment: rule;
  position: relative; padding: 16px 22px 16px 68px;
  font-size: 15px; line-height: 23px; color: var(--true-gray);
}
.rules li + li { border-top: 1px solid var(--true-border); }
.rules li::before {
  content: counter(rule, decimal-leading-zero);
  position: absolute; left: 24px; top: 17px;
  font-family: var(--font-display); font-size: 17px; color: var(--true-pink);
}
.rules li b { color: var(--true-dark); font-weight: 500; }

/* ---- Guide footer ------------------------------------------------------ */
.guide-footer { margin-top: 120px; border-top: 1px solid var(--true-border); padding: 32px 0 0; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.guide-footer, .guide-footer a { font-size: 12px; color: var(--true-gray); text-decoration: none; }
.guide-footer a:hover { color: var(--true-dark); }

/* ---- Mobile jump navigation (built by guide.js) ------------------------ */
.mobile-nav { display: none; }
@media (max-width: 991px) {
  .mobile-nav {
    display: block; position: fixed; top: calc(var(--g-topbar-h) + 4px);
    left: 0; right: 0; z-index: 25;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--true-border);
  }
  .mobile-nav summary {
    list-style: none; cursor: pointer; padding: 10px 28px;
    font-size: 13px; font-weight: 500; color: var(--true-dark);
  }
  .mobile-nav summary::-webkit-details-marker { display: none; }
  .mobile-nav summary::after { content: " ▾"; color: var(--true-gray); }
  .mobile-nav[open] summary::after { content: " ▴"; }
  .mobile-nav nav { max-height: 60vh; overflow-y: auto; padding: 0 20px 16px; }
  .mobile-nav .sidenav-group { margin-bottom: 14px; }
}

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 991px) {
  .sidenav { display: none; }
  main { padding: 0 28px 96px; }
  .shell { padding-top: calc(var(--g-topbar-h) + 44px); }
}
@media (max-width: 767px) {
  .guide-hero h1 { font-size: 36px; line-height: 44px; }
  .dodont { grid-template-columns: 1fr; }
  .ex-stage { padding: 24px; }
  .topbar { gap: 16px; }
  .topbar-meta .hide-sm, .topbar-tag { display: none; }
}

/* ---- Reduced motion: the guide follows its own rule --------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
