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

:root {
  --ink:        #073642;
  --ink-mid:    #586e75;
  --ink-soft:   #93a1a1;
  --rule:       #93a1a1;
  --bg:         #eee8d5;
  --bg-alt:     #e8e1cb;
  --accent:     #307070;
  --accent-dim: #2aa198;

  --font-body:  "Iosevka Light", "Iosevka", "JetBrains Mono Light", "JetBrains Mono", "Fira Code Light", "Fira Code", "Menlo", monospace;
  --font-serif: "Iosevka Light", "Iosevka", "JetBrains Mono Light", "JetBrains Mono", "Fira Code Light", "Fira Code", "Menlo", monospace;

  --step-0: clamp(0.875rem, 0.8vw + 0.7rem,  0.9375rem);
  --step-1: clamp(0.9375rem, 1vw + 0.75rem,   1.0625rem);
  --step-2: clamp(1.125rem, 1.4vw + 0.8rem,   1.375rem);
  --step-3: clamp(1.3rem,   1.8vw + 0.85rem,  1.75rem);

  --measure: 62ch;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
}

html, body {
  height: 100%;
  overflow: hidden;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout: full-viewport flex column ───────────────────────── */
.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────── */
header {
  padding: clamp(0.75rem, 2vw, 1.25rem) 0;
  flex-shrink: 0;
}

.wordmark {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}

.wordmark:hover { color: var(--accent-dim); }

/* ── Carousel: fills remaining space ─────────────────────────── */
.carousel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Hide radio inputs */
.tab-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Tab bar at bottom via flex order */
.tab-bar {
  order: 2;
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule);
  flex-shrink: 0;
  padding-top: 0.25rem;
}

.tab-btn {
  padding: 0.5rem 1rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  color: var(--ink-mid);
}

/* ── Panels: collapsed by default ────────────────────────────── */
.tab-panel {
  order: 1;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  padding: 0;
}

/* ── Active states ───────────────────────────────────────────── */
#radio-product:checked ~ .tab-bar label[for="radio-product"],
#radio-how:checked ~ .tab-bar label[for="radio-how"],
#radio-consulting:checked ~ .tab-bar label[for="radio-consulting"],
#radio-research:checked ~ .tab-bar label[for="radio-research"],
#radio-contact:checked ~ .tab-bar label[for="radio-contact"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

#radio-product:checked ~ #panel-product,
#radio-how:checked ~ #panel-how,
#radio-consulting:checked ~ #panel-consulting,
#radio-research:checked ~ #panel-research,
#radio-contact:checked ~ #panel-contact {
  height: auto;
  flex: 1;
  visibility: visible;
  overflow-y: auto;
  padding: clamp(1.5rem, 3vw, 2.5rem) 0;
}

/* ── Typography within panels ────────────────────────────────── */
.tab-panel h1 {
  font-size: var(--step-3);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 20ch;
  margin-bottom: 1rem;
}

.tab-panel h2 {
  font-size: var(--step-3);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 1.25rem;
  max-width: 22ch;
}

.tab-panel p {
  max-width: var(--measure);
  color: var(--ink-mid);
  margin-bottom: 1rem;
}

.tab-panel p:last-of-type { margin-bottom: 0; }

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

/* ── Pull quote ──────────────────────────────────────────────── */
.pull-quote {
  border-left: 3px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin: 1.5rem 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--step-1);
  color: var(--ink);
  max-width: 40ch;
}

/* ── CTA links ───────────────────────────────────────────────── */
.cta-link {
  display: inline-block;
  margin-top: 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}

.cta-link:hover {
  color: var(--accent-dim);
  border-color: var(--accent-dim);
}

/* ── Plain links ─────────────────────────────────────────────── */
a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

a:hover { color: var(--accent-dim); text-decoration: underline; }

/* ── Paper reference card ────────────────────────────────────── */
.paper-ref {
  display: inline-flex;
  flex-direction: column;
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  text-decoration: none;
  color: inherit;
  max-width: 36rem;
  transition: border-color 0.15s, background 0.15s;
}

.paper-ref:hover {
  background: var(--rule);
  border-color: var(--accent-dim);
  text-decoration: none;
}

.paper-ref .paper-title {
  font-weight: 600;
  color: var(--ink);
  font-size: var(--step-0);
  margin-bottom: 0.2rem;
}

.paper-ref .paper-id {
  font-size: 0.8125rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ── Contact ─────────────────────────────────────────────────── */
.contact-address {
  font-size: var(--step-1);
  font-weight: 500;
  margin-top: 0.5rem;
}

/* ── Footer ──────────────────────────────────────────────────── */
footer {
  padding: clamp(0.5rem, 1vw, 0.75rem) 0;
  flex-shrink: 0;
}

.footer-legal {
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 540px) {
  .tab-panel h1,
  .tab-panel h2 { max-width: none; }

  .tab-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
