/* ─── Brand tokens ──────────────────────────────────────────── */
/* From assets/brand.md — binding, not advisory                  */
/* woff2 URLs verified from Google Fonts API 2026-09-12         */

@font-face {
  font-family: 'DM Serif Display';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('DM Serif Display'), local('DMSerifDisplay-Regular'),
       url('https://fonts.gstatic.com/s/dmserifdisplay/v17/-nFnOHM81r4j6k0gjAW3mujVU2B2G_Bx0g.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Source Sans 3'), local('SourceSans3-Regular'),
       url('https://fonts.gstatic.com/s/sourcesans3/v19/nwpStKy2OAdR1K-IwhWudF-R3w8aZQ.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: local('Source Sans 3 SemiBold'), local('SourceSans3-SemiBold'),
       url('https://fonts.gstatic.com/s/sourcesans3/v19/nwpStKy2OAdR1K-IwhWudF-R3w8aZQ.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('IBM Plex Mono'), local('IBMPlexMono-Regular'),
       url('https://fonts.gstatic.com/s/ibmplexmono/v20/-F63fjptAgt5VM-kVkqdyU8n1i8q1w.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: local('IBM Plex Mono SemiBold'), local('IBMPlexMono-SemiBold'),
       url('https://fonts.gstatic.com/s/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3vAOwlBFgg.woff2') format('woff2');
}

:root {
  --color-bg:            #ffffff;
  --color-surface:       #f8f9fa;
  --color-text:          #1e293b;
  --color-text-muted:    #64748b;
  --color-border:        #e2e8f0;
  --color-primary:       #0e7490;
  --color-primary-hover: #155e75;
  --color-urgent:        #b91c1c;
  --color-success:       #047857;
  --color-caution:       #d97706;

  --font-display: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --font-body:    'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono:    'IBM Plex Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;

  --radius: 2px;
  --space: 4px;
  --stance: editorial;
}

/* ─── Dark theme ────────────────────────────────────────────── */
[data-theme="dark"] {
  --color-bg:            #0f172a;
  --color-surface:       #1e293b;
  --color-text:          #f1f5f9;
  --color-text-muted:    #94a3b8;
  --color-border:        #334155;
  --color-primary:       #22d3ee;
  --color-primary-hover: #67e8f9;
  --color-urgent:        #fca5a5;
  --color-success:       #6ee7b7;
  --color-caution:       #fcd34d;
}

/* ─── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

/* ─── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-text);
}
h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; margin-top: calc(12 * var(--space)); }
h3 { font-size: 1.25rem; }

code, pre, kbd, .mono {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

p { margin-bottom: calc(4 * var(--space)); }

/* ─── Eyebrow labels ────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  margin-bottom: calc(2 * var(--space));
}

/* ─── Section numbers ───────────────────────────────────────── */
.section-number {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary);
  margin-bottom: calc(2 * var(--space));
}

/* ─── Layout ────────────────────────────────────────────────── */
.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* Editorial: single column, reading width for prose sections */
.reading-column {
  max-width: 680px;
  margin-left: 0;
  margin-right: auto;
}

/* ─── Nav ───────────────────────────────────────────────────── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(4 * var(--space)) 1.5rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  transition: background 0.2s, border-color 0.2s;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: calc(6 * var(--space));
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: calc(2 * var(--space));
  text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 1.1rem;
}
.nav-logo svg { flex-shrink: 0; }
.nav-logo:hover { color: var(--color-primary); }

.nav-links {
  display: flex;
  align-items: center;
  gap: calc(5 * var(--space));
  list-style: none;
}
.nav-links a {
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--color-primary); }
.nav-links a.active { color: var(--color-text); font-weight: 600; }

/* Theme toggle */
.theme-toggle {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: calc(1 * var(--space)) calc(2 * var(--space));
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-text-muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.theme-toggle:hover {
  background: var(--color-border);
  color: var(--color-text);
}

/* ─── Section hairline rules ────────────────────────────────── */
.section-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: calc(12 * var(--space)) 0;
}

section {
  margin-top: calc(12 * var(--space));
  padding-bottom: calc(4 * var(--space));
}

/* ─── Hero (split layout, editorial) ────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: calc(8 * var(--space));
  padding: calc(12 * var(--space)) 0 calc(8 * var(--space));
  align-items: start;
}

.hero-text {
  max-width: 380px;
}

.hero-text h1 {
  font-size: 2.2rem;
  line-height: 1.15;
  margin-bottom: calc(3 * var(--space));
}
.hero-text h1 .accent {
  color: var(--color-primary);
}
.hero-text .hero-sub {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.hero-tool {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: calc(5 * var(--space)) calc(6 * var(--space));
}

.hero-tool { display: flex; flex-direction: column; }
.hero-tool form { margin-bottom: 0; }

/* Hero screenshot: on desktop, appears at the top of the right column */
.hero-screenshot {
  order: -1;
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: calc(4 * var(--space));
  min-height: 200px;
  object-fit: cover;
  object-position: top;
  aspect-ratio: 2560 / 1600;
  background: var(--color-surface);
}
.hero-screenshot[src] { min-height: 0; }

.input-row {
  display: flex;
  gap: calc(2 * var(--space));
}

#url-input {
  flex: 1;
  padding: calc(3 * var(--space)) calc(4 * var(--space));
  font-family: var(--font-mono);
  font-size: 0.88rem;
  border: 1px solid var(--color-border);
  border-radius: 0;
  outline: none;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color 0.15s;
}
#url-input:focus {
  border-color: var(--color-primary);
}

textarea#url-input {
  resize: none;
  overflow: hidden;
  line-height: inherit;
  field-sizing: content;
}

#trace-btn, .btn-primary {
  padding: calc(3 * var(--space)) calc(6 * var(--space));
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
#trace-btn:hover { background: var(--color-primary-hover); }
#trace-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.hint {
  margin-top: calc(2 * var(--space));
  font-size: 0.78rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}
.hint code {
  background: var(--color-surface);
  padding: 0.05rem 0.25rem;
  font-size: 0.76rem;
}

/* ─── Button loading spinner ────────────────────────────────── */
.btn-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.35em;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Inline homepage figure ────────────────────────────────── */
.home-figure {
  display: block;
  width: 100%;
  max-width: 680px;
  margin: calc(6 * var(--space)) 0;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

/* ─── Hop timeline (app page) ───────────────────────────────── */
.hop-timeline {
  display: flex;
  flex-direction: column;
  gap: calc(3 * var(--space));
  margin-top: calc(4 * var(--space));
}

.hop-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: calc(4 * var(--space)) calc(5 * var(--space));
  border-left: 3px solid var(--color-primary);
  opacity: 0;
  animation: hopFadeIn 0.2s ease forwards;
}

@keyframes hopFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hop-header {
  display: flex;
  align-items: baseline;
  gap: calc(2 * var(--space));
  font-size: 0.88rem;
  flex-wrap: wrap;
}

.hop-step {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  min-width: 1.5rem;
}

.hop-url {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--color-text);
  flex: 1;
  min-width: 120px;
  transition: max-width 0.15s;
  overflow: hidden;
}
.hop-url.truncated {
  max-width: 300px;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}
.hop-url.truncated:hover {
  max-width: 600px;
}

.hop-arrow {
  color: var(--color-text-muted);
  font-weight: 300;
  flex-shrink: 0;
}

.status-code {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.08rem 0.4rem;
  border-radius: 0;
  flex-shrink: 0;
}
.status-ok      { background: #d1fae5; color: #065f46; }  /* emerald */
.status-redirect { background: #cffafe; color: #155e75; }  /* cyan */
.status-client-err { background: #fef3c7; color: #92400e; }  /* amber */
.status-server-err { background: #fee2e2; color: #991b1b; }  /* red */
.status-error   { background: #fee2e2; color: #991b1b; }
.status-loop    { background: #fecaca; color: #7f1d1d; }
.status-warn    { background: #fef3c7; color: #92400e; }

.hop-details {
  margin-top: calc(2 * var(--space));
  font-size: 0.84rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.hop-reason {
  margin-top: calc(1 * var(--space));
  font-size: 0.82rem;
  line-height: 1.4;
}

.badge-avoidable, .badge-unavoidable {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.06rem 0.35rem;
  margin-right: 0.3rem;
  border-radius: var(--radius);
}
.badge-avoidable  { background: #fef3c7; color: #92400e; }
.badge-unavoidable { background: var(--color-border); color: var(--color-text-muted); }

.hop-changes {
  margin-top: calc(1 * var(--space));
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.change-label { font-weight: 600; }

/* Summary bar */
.summary-bar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: calc(3 * var(--space)) calc(5 * var(--space));
  margin-bottom: calc(3 * var(--space));
  font-size: 0.92rem;
}
.summary-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius);
  margin-right: 0.3rem;
}
.badge-danger { background: #fecaca; color: #7f1d1d; }
.final-url {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--color-text-muted);
  word-break: break-all;
}

/* Warnings card */
.warnings-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: calc(2 * var(--space)) calc(4 * var(--space));
  margin-bottom: calc(3 * var(--space));
  font-size: 0.84rem;
  color: #92400e;
}
.warnings-card ul { margin-top: 0.25rem; padding-left: 1.25rem; }
.warnings-card li { margin-top: 0.15rem; }

/* Error card */
.error-card {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: calc(3 * var(--space)) calc(5 * var(--space));
  color: #991b1b;
  font-weight: 500;
  margin-top: calc(4 * var(--space));
}

/* Limitation notice */
.limitation-notice {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: calc(3 * var(--space)) calc(4 * var(--space));
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-top: calc(4 * var(--space));
}
.limitation-notice code {
  font-size: 0.8rem;
  background: var(--color-border);
  padding: 0.05rem 0.25rem;
}

/* Compound control (Copy button) */
.btn-compound {
  display: inline-flex;
  align-items: center;
  gap: calc(1 * var(--space));
  padding: calc(2 * var(--space)) calc(4 * var(--space));
  font-family: var(--font-mono);
  font-size: 0.76rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.btn-compound:hover {
  background: var(--color-border);
  color: var(--color-text);
}
.btn-compound:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-compound svg { width: 14px; height: 14px; }

/* ─── Status section (loading) ──────────────────────────────── */
.status-section { margin-bottom: calc(4 * var(--space)); }
.status-message {
  padding: calc(3 * var(--space)) calc(5 * var(--space));
  font-size: 0.88rem;
  text-align: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.status-loading { color: var(--color-primary); }

.hidden { display: none !important; }

/* ─── Action bar ────────────────────────────────────────────── */
.action-bar {
  margin-top: calc(4 * var(--space));
  display: flex;
  gap: calc(2 * var(--space));
  flex-wrap: wrap;
}

/* ─── Pricing table ─────────────────────────────────────────── */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(5 * var(--space));
  margin-top: calc(6 * var(--space));
}
.pricing-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: calc(6 * var(--space));
  display: flex;
  flex-direction: column;
}
.pricing-card.featured {
  border-color: var(--color-primary);
  position: relative;
}
.pricing-card.featured::before {
  content: 'POPULAR';
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  background: var(--color-primary);
  color: #ffffff;
  padding: 0.15rem 0.6rem;
  position: absolute;
  top: calc(-2 * var(--space));
  right: calc(4 * var(--space));
  border-radius: var(--radius);
}

.pricing-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: calc(2 * var(--space));
}
.pricing-card .price {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--color-text);
  margin-bottom: calc(1 * var(--space));
}
.pricing-card .price-sub {
  font-size: 0.84rem;
  color: var(--color-text-muted);
  margin-bottom: calc(4 * var(--space));
}
.pricing-card ul {
  list-style: none;
  margin-bottom: calc(5 * var(--space));
  flex: 1;
}
.pricing-card li {
  padding: calc(1 * var(--space)) 0;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--color-border);
}
.pricing-card li:last-child { border-bottom: none; }
.pricing-card li .check { color: var(--color-success); margin-right: 0.4rem; }
.pricing-card li .cross { color: var(--color-urgent); margin-right: 0.4rem; }
.pricing-card li .muted { color: var(--color-text-muted); }

.btn-subscribe {
  display: block;
  width: 100%;
  padding: calc(3 * var(--space));
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-subscribe:hover { background: var(--color-primary-hover); }
.btn-subscribe.disabled {
  background: var(--color-border);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.demo-disclosure {
  margin-top: calc(8 * var(--space));
  padding: calc(3 * var(--space)) calc(5 * var(--space));
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* ─── Privacy / Terms pages ─────────────────────────────────── */
.legal-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}
.legal-page h1 { margin-bottom: calc(2 * var(--space)); }
.legal-page h2 {
  font-size: 1.2rem;
  margin-top: calc(8 * var(--space));
  margin-bottom: calc(2 * var(--space));
}
.legal-page p, .legal-page ul {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text-muted);
}
.legal-page ul { padding-left: 1.5rem; margin-bottom: calc(3 * var(--space)); }
.legal-page li { margin-bottom: calc(1 * var(--space)); }
.legal-page .last-updated {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--color-text-muted);
}
.legal-page .no-entity {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: calc(3 * var(--space)) calc(4 * var(--space));
  font-size: 0.84rem;
  color: var(--color-caution);
  margin: calc(4 * var(--space)) 0;
}

/* ─── Footer ────────────────────────────────────────────────── */
footer {
  margin-top: calc(12 * var(--space));
  padding-top: calc(4 * var(--space));
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: calc(3 * var(--space));
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
footer a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
footer a:hover { color: var(--color-primary); }
.footer-links {
  display: flex;
  gap: calc(4 * var(--space));
  list-style: none;
}

/* ─── Motion pause control ──────────────────────────────────── */
.motion-control {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-text-muted);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.motion-control:hover { color: var(--color-primary); }

/* Pause all animations */
.paused *, .paused *::before, .paused *::after {
  animation-play-state: paused !important;
  transition: none !important;
}

/* Respect user's motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    gap: calc(4 * var(--space));
  }
  .hero-text { max-width: 100%; }
  .hero-text h1 { font-size: 1.7rem; }
  .hero-screenshot { order: 0; margin-bottom: 0; margin-top: calc(4 * var(--space)); }
  .pricing-grid {
    grid-template-columns: 1fr;
    gap: calc(4 * var(--space));
  }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.3rem; }
  .reading-column { max-width: 100%; }
}

@media (max-width: 600px) {
  .page { padding: 0 1rem 2rem; }
  nav { padding: calc(3 * var(--space)) 1rem; }
  .nav-inner { gap: calc(3 * var(--space)); }
  .nav-links { gap: calc(3 * var(--space)); }
  .nav-links a { font-size: 0.8rem; }
  .input-row { flex-direction: column; }
  #trace-btn { width: 100%; }
  .hop-header { flex-direction: column; align-items: flex-start; }
  .hop-url { min-width: 0; width: 100%; }
  .hop-arrow:nth-of-type(1) { display: none; }
  .pricing-card { padding: calc(4 * var(--space)); }
  footer { flex-direction: column; text-align: center; }
  .hero-tool { padding: calc(3 * var(--space)); }
}

/* ─── Loading anim disabled ─────────────────────────────────── */
.btn-spinner.paused { visibility: hidden; }