/* ===========================================================================
   Should My Agent Submit This? - components for the teardown page.

   One stylesheet, no build step. tokens.css is imported unchanged from the
   sibling projects so the four teardowns in this portfolio read as one family.

   Role tokens only, never a raw ramp value. A raw ramp step is exactly what
   breaks dark mode, and dark mode here is the reader's system preference with
   no toggle and nothing persisted.
   =========================================================================== */

@import './tokens.css';

:root {
  --kicker-text: var(--primary-600);
  --marker: var(--primary-500);
}

@media (prefers-color-scheme: dark) {
  :root {
    --kicker-text: var(--primary-300);
    --marker: var(--primary-400);
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: var(--size-16);
  line-height: var(--lh-16);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  color: var(--text-heading);
  margin: 0;
}

h1 {
  font-size: var(--size-39);
  line-height: var(--lh-39);
  letter-spacing: var(--ls-39);
  font-weight: var(--w-39);
}

h2 {
  font-size: var(--size-31);
  line-height: var(--lh-31);
  letter-spacing: var(--ls-31);
  font-weight: var(--w-31);
}

h3 {
  font-size: var(--size-20);
  line-height: var(--lh-20);
  letter-spacing: var(--ls-20);
  font-weight: var(--w-20);
  margin-top: var(--space-32);
}

h4 {
  font-size: var(--size-16);
  line-height: var(--lh-16);
  font-weight: 600;
}

p {
  margin: 0 0 var(--space-16);
  max-width: var(--measure-16);
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--link-hover);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-sunken);
  padding: 1px var(--space-4);
  border-radius: var(--radius);
  overflow-wrap: break-word;
}

pre {
  margin: var(--space-16) 0 var(--space-24);
  padding: var(--space-16);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: var(--size-13);
  line-height: var(--lh-16);
  color: var(--text-body);
  overflow-x: auto;
  max-width: 100%;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

strong {
  color: var(--text-heading);
  font-weight: 600;
}

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

.skip {
  position: absolute;
  left: -9999px;
  background: var(--fill);
  color: var(--on-fill);
  padding: var(--space-12) var(--space-16);
  border-radius: var(--radius);
  z-index: 100;
}

.skip:focus {
  left: var(--space-16);
  top: var(--space-16);
}

main:focus,
main:focus-visible {
  outline: none;
}

/* ---------- shell ---------- */

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-24);
}

.topbar {
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--size-13);
  line-height: var(--lh-13);
  letter-spacing: var(--ls-13);
}

.topbar .wrap {
  display: flex;
  gap: var(--space-16);
  justify-content: flex-end;
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
}

.layout {
  display: block;
}

@media (min-width: 1000px) {
  .layout {
    display: grid;
    grid-template-columns: 214px minmax(0, 1fr);
    gap: var(--space-48);
    align-items: start;
  }
}

/* ---------- hero ---------- */

.hero {
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-48) 0;
}

.eyebrow {
  font-size: var(--size-13);
  line-height: var(--lh-13);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--kicker-text);
  margin: 0 0 var(--space-12);
}

.hero h1 {
  max-width: 24ch;
}

.lede {
  font-size: var(--size-20);
  line-height: var(--lh-20);
  letter-spacing: var(--ls-20);
  color: var(--text-body);
  max-width: var(--measure-20);
  margin: var(--space-16) 0 var(--space-24);
}

.byline {
  font-size: var(--size-13);
  line-height: var(--lh-13);
  color: var(--text-muted);
  margin: 0;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12);
  margin-top: var(--space-24);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-12) var(--space-16);
  border-radius: var(--radius);
  font-size: var(--size-16);
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.btn-primary {
  background: var(--fill);
  color: var(--on-fill);
  border-color: var(--fill-border);
}

.btn-primary:hover {
  background: var(--fill-hover);
  color: var(--on-fill);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-heading);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  background: var(--neutral-fill-hover);
  border-color: var(--border-strong);
  color: var(--text-heading);
}

/* ---------- facts strip ---------- */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-12);
  margin-top: var(--space-32);
}

.fact {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
}

.fact-value {
  font-size: var(--size-25);
  line-height: var(--lh-25);
  letter-spacing: var(--ls-25);
  font-weight: var(--w-25);
  color: var(--text-heading);
  display: block;
}

.fact-label {
  font-size: var(--size-13);
  line-height: var(--lh-13);
  color: var(--text-muted);
  margin-top: var(--space-4);
  display: block;
}

/* ---------- contents rail ---------- */

.toc {
  padding-top: var(--space-32);
}

.toc-title {
  font-size: var(--size-13);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 var(--space-12);
}

.toc ol {
  margin: 0;
  list-style: none;
  padding-left: 0;
  font-size: var(--size-13);
  line-height: var(--lh-13);
}

.toc li {
  margin-bottom: var(--space-8);
}

@media (min-width: 1000px) {
  .toc {
    position: sticky;
    top: var(--space-32);
    padding-top: var(--space-64);
  }

  .toc ol {
    border-left: 1px solid var(--border-subtle);
  }

  .toc li {
    margin: 0;
  }

  .toc a {
    display: block;
    padding: var(--space-8) var(--space-12);
    color: var(--text-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    margin-left: -1px;
  }

  .toc a:hover {
    color: var(--text-body);
  }

  .toc a.active {
    color: var(--link);
    border-left-color: var(--fill);
    font-weight: 600;
  }
}

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

main {
  padding-bottom: var(--space-96);
}

section {
  padding-top: var(--space-64);
  scroll-margin-top: var(--space-24);
}

section > h2 {
  max-width: var(--measure-25);
}

section > h2 + p {
  margin-top: var(--space-16);
}

.section-kicker {
  font-size: var(--size-13);
  line-height: var(--lh-13);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 var(--space-8);
}

ul, ol {
  max-width: var(--measure-16);
  padding-left: var(--space-24);
}

li {
  margin-bottom: var(--space-8);
}

.summary ul {
  list-style: none;
  padding: 0;
  max-width: var(--measure-16);
}

.summary li {
  position: relative;
  padding-left: var(--space-32);
  margin-bottom: var(--space-16);
}

.summary li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--marker);
}

.pullquote {
  margin: var(--space-32) 0;
  padding-left: var(--space-24);
  border-left: 3px solid var(--marker);
  max-width: var(--measure-20);
  font-size: var(--size-20);
  line-height: var(--lh-20);
  letter-spacing: var(--ls-20);
  color: var(--text-heading);
  font-weight: 600;
}

.pullquote p {
  margin: 0;
  max-width: none;
}

/* ---------- callouts ---------- */

.callout {
  margin: var(--space-24) 0;
  padding: var(--space-16) var(--space-24);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface);
  max-width: var(--measure-16);
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout h4 {
  margin-bottom: var(--space-8);
}

.callout-notice { background: var(--notice-tint); border-color: var(--notice-line); }
.callout-notice h4 { color: var(--notice-text); }
.callout-info { background: var(--info-tint); border-color: var(--info-line); }
.callout-info h4 { color: var(--info-text); }
.callout-warning { background: var(--warning-tint); border-color: var(--warning-line); }
.callout-warning h4 { color: var(--warning-text); }
.callout-success { background: var(--success-tint); border-color: var(--success-line); }
.callout-success h4 { color: var(--success-text); }

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

.table-scroll {
  overflow-x: auto;
  margin: var(--space-24) 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 620px;
  font-size: var(--size-13);
  line-height: var(--lh-16);
}

th, td {
  text-align: left;
  padding: var(--space-12) var(--space-16);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

thead th {
  background: var(--surface-sunken);
  color: var(--text-heading);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: var(--size-13);
  white-space: nowrap;
}

tbody th {
  color: var(--text-heading);
  font-weight: 600;
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: none;
}

td.num {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

caption {
  caption-side: bottom;
  text-align: left;
  padding: var(--space-12) var(--space-16);
  font-size: var(--size-13);
  line-height: var(--lh-16);
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
}

.yes { color: var(--success-text); font-weight: 600; }
.no { color: var(--error-text); font-weight: 600; }
.held { color: var(--warning-text); font-weight: 600; }

.bar {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--accent-400);
  margin-top: var(--space-4);
  min-width: 2px;
}

/* ---------- diagrams ----------
   Inline SVG so the figures follow the reader's theme. Every fill and stroke
   is a role token. Text inside an SVG does not inherit the page font, so the
   families are set here. */

.figure {
  margin: var(--space-32) 0;
}

.figure-scroll {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: var(--space-16);
}

.diagram {
  display: block;
  width: 100%;
  min-width: 660px;
  height: auto;
}

.diagram-short {
  min-width: 420px;
}

.figure figcaption {
  font-size: var(--size-13);
  line-height: var(--lh-16);
  color: var(--text-muted);
  margin-top: var(--space-12);
  max-width: var(--measure-16);
}

.diagram text {
  font-family: var(--font-sans);
  fill: var(--text-body);
}

.diagram .box { fill: var(--surface-sunken); stroke: var(--border-default); stroke-width: 1.5; }
.diagram .box-on { fill: var(--fill); stroke: var(--fill-border); stroke-width: 1.5; }
.diagram .box-hold { fill: var(--warning-tint); stroke: var(--warning-line); stroke-width: 1.5; }
.diagram .box-deny { fill: var(--error-tint); stroke: var(--error-line); stroke-width: 1.5; }
.diagram .box-ok { fill: var(--success-tint); stroke: var(--success-line); stroke-width: 1.5; }
.diagram .edge { stroke: var(--border-strong); stroke-width: 1.5; fill: none; }
.diagram .edge-dash { stroke: var(--border-strong); stroke-width: 1.5; fill: none; stroke-dasharray: 5 4; }
.diagram .arrow { fill: var(--border-strong); }
.diagram .bar-fill { fill: var(--accent-400); }
.diagram .axis { stroke: var(--border-default); stroke-width: 1; }

.diagram .d-title { font-size: 14px; font-weight: 600; fill: var(--text-heading); text-anchor: middle; }
.diagram .d-title-on { font-size: 14px; font-weight: 600; fill: var(--on-fill); text-anchor: middle; }
.diagram .d-sub { font-size: 11px; fill: var(--text-muted); text-anchor: middle; }
.diagram .d-sub-on { font-size: 11px; fill: var(--on-fill); opacity: 0.85; text-anchor: middle; }
.diagram .d-lab { font-size: 11px; letter-spacing: 0.08em; font-weight: 600; fill: var(--text-muted); }
.diagram .d-tier { font-size: 12px; font-weight: 700; fill: var(--text-heading); text-anchor: middle; }
.diagram .d-hold { font-size: 12px; font-weight: 600; fill: var(--warning-text); text-anchor: middle; }
.diagram .d-deny { font-size: 12px; font-weight: 600; fill: var(--error-text); text-anchor: middle; }
.diagram .d-ok { font-size: 12px; font-weight: 600; fill: var(--success-text); text-anchor: middle; }
.diagram .d-num { font-size: 18px; font-weight: 650; fill: var(--text-heading); text-anchor: middle; }
.diagram .d-axis { font-size: 12px; fill: var(--text-muted); text-anchor: middle; }
.diagram .d-note { font-size: 11px; font-style: italic; fill: var(--text-muted); text-anchor: middle; }
.diagram .d-step { font-size: 12px; font-weight: 700; fill: var(--text-muted); text-anchor: middle; }

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

.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-32) 0;
  font-size: var(--size-13);
  line-height: var(--lh-16);
  color: var(--text-muted);
}

.site-footer p {
  max-width: var(--measure-16);
}

@media (max-width: 720px) {
  h1 { font-size: var(--size-31); line-height: var(--lh-31); }
  h2 { font-size: var(--size-25); line-height: var(--lh-25); }
}

/* The TL;DR: the whole page in five sentences, set apart so a skimmer lands on it. */
.brief { margin: 2.25rem 0 0; padding: 1.5rem 1.75rem; background: var(--surface); border: 1px solid var(--border-subtle); border-left: 5px solid var(--fill); border-radius: var(--radius-lg); }
.brief h2 { margin-top: 0.25rem; }
.brief-definition { color: var(--text-muted); font-size: 0.95rem; margin: 0 0 0.75rem; }
.brief-body { font-size: 1.2rem; line-height: 1.6; color: var(--text-heading); margin: 0; }
@media (max-width: 720px) {
  .brief { padding: 1.1rem 1.2rem; }
  .brief-body { font-size: 1.08rem; }
}
