/* ============================================================
   Reference Angle Calculator: "Observatory instrument"
   Palette + type tokens
   ============================================================ */
:root {
  --ink:        #0B1020;   /* deep blue-black ground        */
  --ink-2:      #0E1426;
  --surface:    #141B2F;   /* elevated panels               */
  --surface-2:  #1A2238;
  --line:       #2A3350;   /* hairlines / borders           */
  --line-soft:  rgba(160, 176, 214, 0.12);

  --text:       #E9EAF2;   /* cool off-white                */
  --text-mut:   #97A0BC;   /* muted blue-grey               */
  --text-dim:   #6C7595;

  --brass:      #CBA35C;   /* champagne brass accent        */
  --brass-hi:   #E7CE96;
  --teal:       #5FD3C4;   /* reference-angle highlight     */
  --teal-hi:    #8CE9DC;

  --shadow:     0 24px 60px -28px rgba(0,0,0,0.75);
  --radius:     18px;
  --radius-sm:  12px;

  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body:    "Manrope", system-ui, -apple-system, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;

  --wrap: 1160px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

/* Light theme -------------------------------------------------- */
:root[data-theme="light"] {
  --ink:        #F3F1EA;   /* warm paper, cooled slightly   */
  --ink-2:      #ECEAE1;
  --surface:    #FBFAF6;
  --surface-2:  #FFFFFF;
  --line:       #DCD8CB;
  --line-soft:  rgba(40, 45, 70, 0.10);

  --text:       #1B2136;
  --text-mut:   #545C77;
  --text-dim:   #808AA3;

  --brass:      #9A7A2E;   /* darkened for contrast on paper */
  --brass-hi:   #7E621F;
  --teal:       #148C7C;
  --teal-hi:    #0E6E61;

  --shadow:     0 24px 50px -30px rgba(40, 45, 70, 0.30);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ink:        #F3F1EA;
    --ink-2:      #ECEAE1;
    --surface:    #FBFAF6;
    --surface-2:  #FFFFFF;
    --line:       #DCD8CB;
    --line-soft:  rgba(40, 45, 70, 0.10);
    --text:       #1B2136;
    --text-mut:   #545C77;
    --text-dim:   #808AA3;
    --brass:      #9A7A2E;
    --brass-hi:   #7E621F;
    --teal:       #148C7C;
    --teal-hi:    #0E6E61;
    --shadow:     0 24px 50px -30px rgba(40, 45, 70, 0.30);
    color-scheme: light;
  }
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
img, svg, table, video, canvas { max-width: 100%; }

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

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 600px at 78% -8%, rgba(203,163,92,0.10), transparent 60%),
    radial-gradient(1000px 700px at 10% 8%, rgba(95,211,196,0.08), transparent 55%),
    var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { width: min(var(--wrap), 92%); margin-inline: auto; max-width: 100%; }
.narrow { width: min(760px, 92vw); }

a { color: var(--brass-hi); text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { color: var(--brass); }

.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; letter-spacing: -0.01em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--brass); color: #14100a; padding: 10px 16px;
  border-radius: 8px; font-weight: 600; transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 4px; }

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner { display: flex; align-items: center; gap: 24px; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-mark { width: 34px; height: 34px; color: var(--text-mut); flex: none; }
.brand-text { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; letter-spacing: .01em; }
.brand-text em { color: var(--brass); font-style: italic; }

.site-nav { display: flex; gap: 22px; margin-left: auto; }
.site-nav a {
  color: var(--text-mut); text-decoration: none; font-size: 0.9rem; font-weight: 500;
  letter-spacing: 0.02em; transition: color .2s var(--ease);
}
.site-nav a:hover { color: var(--text); }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 999px; flex: none;
  border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; display: grid; place-items: center; transition: border-color .2s var(--ease);
}
.theme-toggle:hover { border-color: var(--brass); }
.theme-toggle-dot {
  width: 16px; height: 16px; border-radius: 999px;
  background: radial-gradient(circle at 32% 32%, var(--brass-hi), var(--brass) 70%);
  box-shadow: 0 0 12px -2px var(--brass);
}
:root[data-theme="light"] .theme-toggle-dot,
:root:not([data-theme="dark"]) .theme-toggle-dot {
  background: var(--ink); box-shadow: inset -3px -3px 0 0 var(--surface-2);
}

/* ============================================================
   Hero
   ============================================================ */
.hero { padding: 16px 0 40px; }
@media (min-width: 1024px) { .hero { padding-top: 48px; } }
.hero-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 4vw, 64px);
  align-items: center;
}
.hero-grid > * { min-width: 0; }

.eyebrow {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--text-mut); margin: 0 0 6px;
}
.hero-copy h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.6rem, 5.4vw, 4.1rem); line-height: 1.02; margin: 0 0 20px;
  letter-spacing: -0.01em; text-wrap: balance;
}
.lede { font-size: 1.12rem; color: var(--text); margin: 0 0 14px; max-width: 46ch; }
.lede strong { color: var(--brass-hi); font-weight: 600; }

/* control card */
.control-card {
  margin-top: 28px; background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  min-width: 0; max-width: 100%;
}
.input-row { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.input-label {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--text-mut); flex-shrink: 0;
}
.input-field {
  display: flex; align-items: stretch; gap: 10px; margin-left: auto; flex: 1 1 auto;
  min-width: 0; max-width: min(320px, 100%);
}
#angle-input {
  flex: 1; min-width: 0; background: var(--ink-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 1.5rem; font-weight: 500;
  padding: 8px 14px; text-align: right;
}
#angle-input:focus { border-color: var(--brass); outline: none; }
#angle-input::-webkit-outer-spin-button,
#angle-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#angle-input { -moz-appearance: textfield; appearance: textfield; }

.unit-switch { display: flex; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; }
.unit-btn {
  border: 0; background: transparent; color: var(--text-mut); cursor: pointer;
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 500;
  padding: 6px 10px; border-radius: 8px; transition: all .2s var(--ease); white-space: nowrap;
}
.unit-btn.is-active { background: var(--brass); color: #14100a; }

.unit-select {
  border: 1px solid var(--line); background: var(--ink-2); color: var(--text);
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600;
  padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer;
  width: 92px; flex: 0 0 auto;
}
.unit-select:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

.input-hint { color: var(--text-dim); font-size: 0.82rem; margin: 12px 0 18px; }

.slider { width: 100%; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 999px;
  background: linear-gradient(90deg, var(--line), var(--line)); cursor: pointer; }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 999px;
  background: radial-gradient(circle at 34% 34%, var(--brass-hi), var(--brass) 72%);
  border: 2px solid var(--ink); box-shadow: 0 0 0 1px var(--brass), 0 2px 8px rgba(0,0,0,.5);
}
.slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 999px; border: 2px solid var(--ink);
  background: var(--brass); box-shadow: 0 0 0 1px var(--brass);
}

.preset-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.preset-label {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--text-dim); margin-right: 4px;
}
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--text-mut);
  font-family: var(--font-mono); font-size: 0.82rem; padding: 5px 11px; border-radius: 999px;
  cursor: pointer; transition: all .18s var(--ease);
}
.chip:hover { border-color: var(--teal); color: var(--teal-hi); }

/* ============================================================
   Instrument (unit circle)
   ============================================================ */
.instrument { margin: 0; }
.instrument-frame {
  position: relative; background:
    radial-gradient(120% 120% at 50% 0%, var(--surface-2), var(--surface) 70%);
  border: 1px solid var(--line-soft); border-radius: 24px; padding: 20px;
  box-shadow: var(--shadow);
}
#unit-circle { width: 100%; height: auto; display: block; aspect-ratio: 1; touch-action: none; }

.uc-circle { fill: none; stroke: var(--line); stroke-width: 1.4; }
.uc-axis   { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 5; opacity: .8; }
.uc-axis-label { fill: var(--text-dim); font-family: var(--font-mono); font-size: 11px; }
.uc-quad   { fill: var(--text-dim); font-family: var(--font-display); font-style: italic; font-size: 15px; opacity: .55; text-anchor: middle; }

.uc-angle-arc { stroke: var(--brass); stroke-width: 2; opacity: .55; }
.uc-terminal  { stroke: var(--brass); stroke-width: 2.6; stroke-linecap: round;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--brass) 55%, transparent)); }
.uc-base   { stroke: var(--teal); stroke-width: 2; stroke-linecap: round; opacity: .8; }
.uc-drop   { stroke: var(--text-mut); stroke-width: 1.3; stroke-dasharray: 3 4; opacity: .7; }
.uc-ref-arc{ stroke: var(--teal); stroke-width: 3.4; stroke-linecap: round;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--teal) 70%, transparent)); }
.uc-point  {
  fill: var(--brass-hi); stroke: var(--ink); stroke-width: 2;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--brass) 70%, transparent));
  cursor: grab;
}
.uc-point:active { cursor: grabbing; }

/* readout overlay */
.readout {
  position: absolute; left: 20px; bottom: 20px;
  background: color-mix(in srgb, var(--ink) 72%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 14px 16px; min-width: 190px;
}
.readout-row { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
.readout-key { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-dim); }
.readout-val { font-size: 0.95rem; color: var(--text); font-weight: 600; }
.readout-formula { margin-top: 4px; }
.readout-formula .readout-val { color: var(--brass-hi); font-size: 0.9rem; }
.readout-headline { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.readout-headline .readout-key { display: block; margin-bottom: 4px; }
.readout-big { display: block; font-size: 2.1rem; font-weight: 600; color: var(--teal-hi); line-height: 1;
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--teal) 30%, transparent)); }
.readout-sub { display: block; color: var(--text-mut); font-size: 0.85rem; margin-top: 4px; }

.instrument-caption { color: var(--text-dim); font-size: 0.85rem; margin-top: 14px; text-align: center; line-height: 1.5; }
.instrument-caption strong { color: var(--text-mut); font-weight: 600; }

/* ============================================================
   Sections
   ============================================================ */
.section { padding: 56px 0; }
@media (max-width: 720px) { .section { padding: 40px 0; } }
.section-alt { background: linear-gradient(180deg, transparent, var(--ink-2) 30%, var(--ink-2) 70%, transparent); border-block: 1px solid var(--line-soft); }

.section h2, .hero-copy h1 { text-wrap: balance; }
.section h2 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2rem, 4vw, 3rem); line-height: 1.06; margin: 0 0 20px; letter-spacing: -0.01em;
}
.section-intro { color: var(--text-mut); font-size: 1.05rem; max-width: 60ch; margin: 0 0 40px; }

.body-lg { font-size: 1.18rem; line-height: 1.6; margin: 0 0 18px; max-width: 62ch; }
.body { color: var(--text-mut); max-width: 62ch; margin: 0 0 18px; }
.body-lg strong { color: var(--brass-hi); }

/* definition figure */
.definition-figure { margin: 40px 0 0; }
.def-svg { width: 100%; max-width: 560px; height: auto; display: block; margin-inline: auto; }
.df-axis { stroke: var(--line); stroke-width: 1.2; stroke-dasharray: 2 5; }
.df-circle { fill: none; stroke: var(--line); stroke-width: 1.2; }
.df-terminal { stroke: var(--brass); stroke-width: 2.6; stroke-linecap: round; }
.df-point { fill: var(--brass-hi); }
.df-refarc { fill: none; stroke: var(--teal); stroke-width: 3; }
.df-tag { font-family: var(--font-mono); font-size: 12px; }
.df-tag-teal { fill: var(--teal); }
.df-tag-brass { fill: var(--brass); }
.fig-cap { color: #6b6b6b; font-size: 12px; text-align: center; font-style: italic; max-width: 340px; margin: 8px auto 0; }
.quadrant-figure { margin-bottom: 24px; }

/* quadrant cards */
.quad-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.quad-card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 22px; transition: transform .25s var(--ease), border-color .25s var(--ease);
}
.quad-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--teal) 40%, var(--line-soft)); }
.quad-diagram { width: 84px; height: 84px; margin-bottom: 14px; }
.quad-diagram svg { width: 100%; height: 100%; }
.qc-axis { stroke: var(--line); stroke-width: 1.4; }
.qc-term { stroke: var(--brass); stroke-width: 2.4; stroke-linecap: round; }
.qc-ref  { fill: none; stroke: var(--teal); stroke-width: 3; }
.quad-card h3 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; margin: 0 0 2px; }
.quad-range { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-dim); margin: 0 0 12px; letter-spacing: .04em; }
.quad-formula { font-size: 1.12rem; color: var(--brass-hi); margin: 0 0 10px; }
.quad-note { font-size: 0.88rem; color: var(--text-mut); margin: 0; }

.rad-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 32px;
  padding: 16px 22px; background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}
.rad-note-key { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--teal); }
.rad-note .mono { color: var(--brass-hi); font-size: 1rem; }
.rad-note-tail { color: var(--text-dim); font-size: 0.88rem; }

/* steps */
.steps { list-style: none; counter-reset: none; padding: 0; margin: 0; display: grid; gap: 20px; }
.step { display: grid; grid-template-columns: 64px 1fr; gap: 22px; align-items: start;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 24px; }
.step-num {
  width: 56px; height: 56px; border-radius: 999px; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--ink);
  background: radial-gradient(circle at 34% 30%, var(--brass-hi), var(--brass) 78%);
  box-shadow: 0 0 20px -6px var(--brass);
}
.step-body h3 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; margin: 4px 0 8px; }
.step-body p { margin: 0 0 8px; color: var(--text-mut); max-width: 58ch; }
.step-eg { color: var(--teal-hi); font-size: 0.95rem; }

/* examples */
.example-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.example { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 20px; }
.example h3 { font-size: 1.7rem; margin: 0 0 8px; color: var(--brass-hi); font-weight: 600; }
.example p { margin: 0; color: var(--text-mut); font-size: 0.92rem; }
.example b { color: var(--teal-hi); }

/* table */
.table-scroll { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line-soft); }
.ref-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; min-width: 420px; }
.ref-table th, .ref-table td { padding: 13px 20px; text-align: left; }
.ref-table thead th {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-mut); background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.ref-table tbody td { border-bottom: 1px solid var(--line-soft); font-family: var(--font-mono); font-size: 0.95rem; }
.ref-table tbody tr:last-child td { border-bottom: 0; }
.ref-table tbody tr:hover { background: color-mix(in srgb, var(--teal) 7%, transparent); }
.ref-table tbody td:last-child { color: var(--teal-hi); font-weight: 500; }

/* faq */
.faq { display: grid; gap: 12px; }
.faq details {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 4px 22px; transition: border-color .2s var(--ease);
}
.faq details[open] { border-color: color-mix(in srgb, var(--brass) 35%, var(--line-soft)); }
.faq summary {
  cursor: pointer; list-style: none; padding: 16px 0; font-weight: 600; font-size: 1.05rem;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; font-family: var(--font-mono); font-size: 1.4rem; color: var(--brass);
  transition: transform .25s var(--ease); flex: none;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 18px; color: var(--text-mut); max-width: 62ch; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer { background: #f5f0e8; border-top: 1px solid rgba(0,0,0,0.12); padding: 48px 0 32px; margin-top: 24px; }
.footer-inner { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.footer-brand { max-width: 34ch; }
.footer-brand .brand-text { font-size: 1.4rem; color: #4a4a4a; }
.footer-brand .brand-text em { color: #9a7a2e; font-style: italic; }
.footer-brand p { color: #6b6b6b; font-size: 13px; margin: 10px 0 0; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 10px 26px; align-content: start; }
.footer-nav a { color: #9a7a2e; text-decoration: none; font-size: 0.92rem; }
.footer-nav a:hover { color: #7e621f; text-decoration: underline; }
.footer-lang label { display: block; font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.15em; text-transform: uppercase; color: #4a4a4a; margin-bottom: 8px; }
.footer-lang select { background: #ffffff; color: #4a4a4a; border: 1px solid rgba(0,0,0,0.18); border-radius: 10px; padding: 9px 12px; font-family: var(--font-body); font-size: 0.9rem; min-width: 190px; cursor: pointer; }
.footer-lang select:focus { outline: none; border-color: #9a7a2e; }
.footer-fine { margin-top: 32px; padding-top: 20px; border-top: 1px solid rgba(0,0,0,0.10); color: #6b6b6b; font-size: 12px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; }
  .instrument { order: -1; max-width: 520px; margin-inline: auto; width: 100%; }
  .quad-grid { grid-template-columns: repeat(2, 1fr); }
  .example-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .site-nav { display: none; }
  .step { grid-template-columns: 48px 1fr; gap: 16px; padding: 20px; }
  .step-num { width: 44px; height: 44px; font-size: 1.3rem; }
  .readout { position: static; margin-top: 16px; min-width: 0; }
}
@media (max-width: 480px) {
  .quad-grid, .example-grid { grid-template-columns: 1fr; }
  .input-field { max-width: 100%; }
  .unit-select { width: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============================================================
   Added content components (v2)
   Quadrant accent palette, distinct but harmonious on ink
   ============================================================ */
:root {
  --q1: #5FD3C4;  /* teal   */
  --q2: #6FB1E8;  /* blue   */
  --q3: #E0A45C;  /* amber  */
  --q4: #B08CE8;  /* violet */
  --pos: #6FCF97; /* positive sign */
  --neg: #E88C8C; /* negative sign */
}

/* --- calculator results: coterminal + trig signs --- */
.calc-results { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-soft); display: grid; gap: 14px; }
.cr-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cr-key { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-dim); }
.cr-val { font-family: var(--font-mono); color: var(--brass-hi); font-size: 1rem; font-weight: 600; }
.trig-signs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.trig-signs > * { min-width: 0; }
.ts { background: var(--ink-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; text-align: center; }
.ts-fn { display: block; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 4px; }
.ts-val { font-size: 1.15rem; font-weight: 600; color: var(--text-mut); }
.ts-val.is-pos { color: var(--pos); }
.ts-val.is-neg { color: var(--neg); }

/* --- comparison grid (importance) --- */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 8px 0 28px; }
.compare-col { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 22px; }
.compare-col h3 { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; margin: 0 0 4px; }
.compare-col .cc-sub { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--teal); margin: 0 0 14px; }
.cmp-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-family: var(--font-mono); font-size: 0.9rem; color: var(--text-mut); }
.cmp-row:last-child { border-bottom: 0; }
.cmp-row b { color: var(--text); font-weight: 600; }

/* --- ASTC mnemonic cards (2x2) --- */
.astc { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 8px 0 0; }
.astc-card { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px 22px; }
.astc-card--q1 { border-color: color-mix(in srgb, var(--q1) 55%, var(--line-soft)); }
.astc-card--q2 { border-color: color-mix(in srgb, var(--q2) 55%, var(--line-soft)); }
.astc-card--q3 { border-color: color-mix(in srgb, var(--q3) 55%, var(--line-soft)); }
.astc-card--q4 { border-color: color-mix(in srgb, var(--q4) 55%, var(--line-soft)); }
.astc-letter { font-family: var(--font-display); font-size: 32px; font-weight: 700; line-height: 1; }
.astc-card--q1 .astc-letter { color: var(--q1); }
.astc-card--q2 .astc-letter { color: var(--q2); }
.astc-card--q3 .astc-letter { color: var(--q3); }
.astc-card--q4 .astc-letter { color: var(--q4); }
.astc-name { font-weight: 700; color: var(--text); font-size: 1.05rem; margin: 10px 0 0; }
.astc-quad { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); margin: 2px 0 0; }
.astc-body { color: var(--text-mut); font-size: 0.9rem; margin: 10px 0 0; }
.astc-alt { color: var(--text-dim); font-size: 0.85rem; margin-top: 16px; }
@media (max-width: 720px) { .astc { grid-template-columns: 1fr; } }

/* --- sign-quadrant SVG --- */
.sq-axis { stroke: var(--line); stroke-width: 1.2; }
.sq-quad { fill: var(--text-dim); font-family: var(--font-display); font-style: italic; font-size: 18px; opacity: 0.6; text-anchor: middle; }
.sq-pos { fill: var(--pos); font-family: var(--font-mono); font-size: 12px; }
.sq-neg { fill: var(--neg); font-family: var(--font-mono); font-size: 12px; }

/* --- colored formula cards --- */
.formula-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 8px; }
.fcard { background: var(--surface); border: 1px solid var(--line-soft); border-left: 4px solid var(--line); border-radius: var(--radius-sm); padding: 18px; }
.fcard .fc-q { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.fcard .fc-range { font-size: 0.8rem; color: var(--text-mut); margin: 2px 0 12px; }
.fcard .fc-formula { font-family: var(--font-mono); font-size: 1.1rem; font-weight: 600; color: var(--text); }
.fcard--q1 { border-left-color: var(--q1); } .fcard--q1 .fc-formula { color: var(--q1); }
.fcard--q2 { border-left-color: var(--q2); } .fcard--q2 .fc-formula { color: var(--q2); }
.fcard--q3 { border-left-color: var(--q3); } .fcard--q3 .fc-formula { color: var(--q3); }
.fcard--q4 { border-left-color: var(--q4); } .fcard--q4 .fc-formula { color: var(--q4); }

/* --- worked example cards --- */
.worked-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.worked { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 22px 24px; }
.worked h3 { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--teal); margin: 0 0 12px; }
.worked ol { margin: 0; padding-left: 1.25em; display: grid; gap: 8px; color: var(--text-mut); font-size: 0.92rem; }
.worked ol .mono { color: var(--text); }
.worked .result { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line-soft); font-family: var(--font-mono); color: var(--brass-hi); font-weight: 600; }
.callout { margin-top: 20px; padding: 14px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--text-mut); font-size: 0.9rem; }
.callout strong { color: var(--teal-hi); }

/* --- how-to-use steps with icons --- */
.use-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.use-step { display: flex; gap: 16px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 22px; }
.use-icon { width: 46px; height: 46px; flex: none; color: var(--teal); }
.use-step h3 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; margin: 0 0 6px; }
.use-step p { margin: 0; color: var(--text-mut); font-size: 0.92rem; }

/* --- lookup tables (What is the reference angle for…) --- */
.lookup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.lookup h3 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; margin: 0 0 4px; }
.lookup .lu-intro { color: var(--text-mut); font-size: 0.9rem; margin: 0 0 12px; }

/* special-row + zebra shading for tables */
.ref-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.015); }
.ref-table tbody tr.is-special td { color: var(--teal-hi); font-weight: 700; background: rgba(95, 211, 196, 0.10); }

/* --- step-flow (>360) --- */
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin: 8px 0 8px; }
.flow-box { flex: 1 1 130px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 16px; text-align: center; }
.flow-box .fb-label { font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); display: block; margin-bottom: 6px; }
.flow-box .fb-val { font-family: var(--font-mono); font-size: 1.02rem; color: var(--text); }
.flow-box.is-final { border-color: rgba(95, 211, 196, 0.4); }
.flow-box.is-final .fb-val { color: var(--teal-hi); font-weight: 600; }
.flow-arrow { align-self: center; color: var(--brass); font-size: 1.3rem; }

/* --- dual coordinate diagrams (negative angles) --- */
.dual-diagram { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 8px 0 8px; }
.dual-diagram figure { margin: 0; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; }
.dual-diagram svg { width: 100%; height: auto; display: block; }
.dual-diagram figcaption { text-align: center; font-size: 0.85rem; color: var(--text-mut); margin-top: 10px; }
.dd-axis { stroke: var(--line); stroke-width: 1.2; }
.dd-circle { fill: none; stroke: var(--line); stroke-width: 1; opacity: 0.6; }
.dd-term { stroke: var(--brass); stroke-width: 2.4; stroke-linecap: round; }
.dd-arc { fill: none; stroke: var(--brass); stroke-width: 1.8; opacity: 0.8; }
.dd-refarc { fill: none; stroke: var(--teal); stroke-width: 2.8; stroke-linecap: round; }
.dd-tag { font-family: var(--font-mono); font-size: 11px; }
.dd-tag-brass { fill: var(--brass); }
.dd-tag-teal { fill: var(--teal); }

/* --- chart infographic --- */
.chart-figure { background: radial-gradient(120% 120% at 50% 0%, var(--surface-2), var(--surface) 70%); border: 1px solid var(--line-soft); border-radius: 24px; padding: 24px; margin: 8px 0 8px; box-shadow: var(--shadow); }
.chart-figure svg { width: 100%; max-width: 660px; height: auto; display: block; margin: 0 auto; }
.chart-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 24px; }
.chart-list .cl { font-family: var(--font-mono); font-size: 0.9rem; color: var(--text-mut); padding: 10px 14px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.chart-list .cl b { color: var(--brass-hi); font-weight: 600; }
.cf-axis { stroke: var(--line); stroke-width: 1.4; }
.cf-circle { fill: none; stroke: var(--line); stroke-width: 1.4; }
.cf-term { stroke-width: 2.2; stroke-linecap: round; }
.cf-label { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.cf-quad { font-family: var(--font-display); font-style: italic; font-size: 15px; fill: var(--text-dim); }

/* --- related tools grid --- */
.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tool-card { display: block; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px; text-decoration: none; transition: transform .2s var(--ease), border-color .2s var(--ease); }
.tool-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--brass) 40%, var(--line-soft)); }
.tool-card .tc-name { display: block; font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; color: var(--brass-hi); margin-bottom: 4px; }
.tool-card .tc-desc { display: block; font-size: 0.85rem; color: var(--text-mut); line-height: 1.5; }

/* --- responsive for added components --- */
@media (max-width: 940px) {
  .formula-cards { grid-template-columns: repeat(2, 1fr); }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .compare-grid, .worked-grid, .use-steps, .lookup-grid, .dual-diagram, .chart-list { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .formula-cards, .tools-grid, .trig-signs { grid-template-columns: repeat(2, 1fr); }
}

/* --- chart caption (Change 5) --- */
.chart-caption { font-size: 14px; color: var(--text-dim); text-align: center; line-height: 1.55; margin: 16px auto 0; max-width: 60ch; }

/* --- tabbed FAQ (Change 6) --- */
.faq-tablist { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line-soft); margin-bottom: 20px; }
.faq-tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-mut); font-family: var(--font-body); font-size: 0.95rem; font-weight: 600; padding: 10px 16px; cursor: pointer; transition: color .2s var(--ease), border-color .2s var(--ease); margin-bottom: -1px; }
.faq-tab:hover { color: var(--text); }
.faq-tab.is-active { color: var(--teal-hi); border-bottom-color: var(--teal); }
.faq-panel { display: none; }
.faq-panel.is-active { display: grid; gap: 12px; }

/* --- dual coordinate diagrams sizing (Change 8) --- */
.dual-diagram svg { width: 100%; height: auto; max-width: 100%; display: block; }

/* --- related tools: coming-soon badge (Change 9) --- */
.tool-card { position: relative; }
.tool-card.coming-soon .soon-badge {
  position: absolute; top: 12px; right: 12px;
  font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brass-hi); background: rgba(203, 163, 92, 0.12);
  border: 1px solid rgba(203, 163, 92, 0.32); padding: 3px 7px; border-radius: 999px;
}

/* --- hero feature pills (Fix 2) --- */
.feature-pills { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; margin-top: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  background: rgba(0, 128, 128, 0.07); border: 1px solid rgba(0, 128, 128, 0.2);
  border-radius: 4px; padding: 4px 10px; font-size: 13px; color: var(--text-mut);
}
.pill-check { color: rgb(0, 128, 128); font-weight: 700; line-height: 1; }
@media (max-width: 480px) { .feature-pills { grid-template-columns: 1fr; } }

/* --- trig values table (Fix 5 + Fix 6 spacing) --- */
.trig-table-wrap {
  border: 1px solid #e0e9e9; border-radius: 6px; overflow: hidden;
  margin-top: 24px; margin-bottom: 48px;
}
.trig-table { background: #ffffff; }
.trig-table thead th {
  background: #2d4a47; color: #ffffff; font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 8px 12px;
}
.trig-table tbody td { color: #2a2a2a; font-size: 14px; padding: 9px 12px; border-bottom-color: #e0e9e9; }
.trig-table tbody tr:nth-child(odd) td { background: #ffffff; }
.trig-table tbody tr:nth-child(even) td { background: #f7fafa; }
.trig-table tbody tr.trig-special td { background: #f0fafa; font-weight: 700; }
.trig-table tbody tr.trig-special td:first-child { border-left: 3px solid #2d8c8c; }
.trig-table th:nth-child(1), .trig-table td:nth-child(1) { min-width: 60px; }
.trig-table th:nth-child(2), .trig-table td:nth-child(2) { min-width: 70px; }
.trig-table th:nth-child(3), .trig-table td:nth-child(3),
.trig-table th:nth-child(4), .trig-table td:nth-child(4),
.trig-table th:nth-child(5), .trig-table td:nth-child(5),
.trig-table th:nth-child(6), .trig-table td:nth-child(6) { min-width: 70px; }
