/* ── Custom properties ───────────────────────────────────────────────────── */
:root {
  --bg:         #0a0a0f;
  --surface:    #12121a;
  --surface-2:  #1a1a26;
  --border:     #2a2a3a;
  --accent:     #4fa3e8;
  --accent-dim: #2a6499;
  --text:       #e8e8f0;
  --text-dim:   #9090a8;
  --text-faint: #505068;
  --success:    #4caf82;
  --warning:    #e8a94f;
  --danger:     #e8504f;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
  --radius:     6px;
  --radius-lg:  12px;
  --max-w:      900px;
  --max-w-wide: 1200px;
  --nav-h:      56px;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ──────────────────────────────────────────────────────────── */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; color: var(--text); }
h1 { font-size: clamp(1.7rem, 5vw, 2.6rem); }
h2 { font-size: clamp(1.3rem, 3.5vw, 1.9rem); margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
p  { margin-bottom: 1rem; color: var(--text); }
code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
}

/* ── Layout helpers ──────────────────────────────────────────────────────── */
.container      { max-width: var(--max-w);      margin: 0 auto; padding: 0 1.25rem; }
.container-wide { max-width: var(--max-w-wide); margin: 0 auto; padding: 0 1.25rem; }

/* ── Navigation ──────────────────────────────────────────────────────────── */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
  height: var(--nav-h);
}
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%;
  padding: 0 1.25rem;
  max-width: var(--max-w-wide); margin: 0 auto;
}
.nav__logo {
  font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text); white-space: nowrap; flex-shrink: 0;
}
.nav__logo span { color: var(--accent); }

/* Desktop nav links */
.nav__links {
  display: flex; gap: 1.5rem; align-items: center;
}
.nav__links a {
  color: var(--text-dim); font-size: 0.92rem; transition: color 0.15s;
  white-space: nowrap;
}
.nav__links a:hover { color: var(--text); text-decoration: none; }
.nav__links a.active { color: var(--accent); }

/* Desktop auth buttons */
.nav__auth { display: flex; gap: 0.75rem; align-items: center; flex-shrink: 0; }

/* Hamburger button — hidden on desktop */
.nav__burger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: none; border: none; cursor: pointer; padding: 4px;
  border-radius: var(--radius);
  -webkit-tap-highlight-color: transparent;
}
.nav__burger span {
  display: block; width: 22px; height: 2px;
  background: var(--text-dim); border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* Mobile drawer */
.nav__drawer {
  display: none;
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem 1.5rem;
  z-index: 199;
  flex-direction: column;
  gap: 0;
}
.nav__drawer.open { display: flex; }
.nav__drawer a, .nav__drawer button {
  display: block;
  padding: 0.75rem 0;
  font-size: 1rem; color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: none; border-top: none; border-left: none; border-right: none;
  text-align: left; cursor: pointer; width: 100%;
}
.nav__drawer a:last-child { border-bottom: none; }
.nav__drawer a.active { color: var(--accent); }
.nav__drawer a:hover, .nav__drawer button:hover { color: var(--text); text-decoration: none; }
.nav__drawer .drawer-auth {
  display: flex; gap: 0.75rem; padding-top: 1rem; border-bottom: none;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  padding: 4.5rem 1.25rem 3.5rem;
  text-align: center;
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(79,163,232,0.12) 0%, transparent 70%);
}
.hero__eyebrow {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 1rem;
}
.hero__title {
  font-size: clamp(2.2rem, 8vw, 4rem);
  font-weight: 800; letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}
.hero__tagline {
  font-size: clamp(1rem, 3.5vw, 1.4rem);
  color: var(--text-dim); margin-bottom: 0.5rem;
  font-style: italic;
}
.hero__slogan {
  font-size: clamp(0.82rem, 2.5vw, 1.05rem);
  color: var(--text-faint); letter-spacing: 0.06em;
  font-family: var(--font-mono);
  margin-bottom: 2.5rem;
}
.hero__actions {
  display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block; padding: 0.65rem 1.4rem;
  border-radius: var(--radius); font-size: 0.93rem; font-weight: 600;
  cursor: pointer; border: none; transition: opacity 0.15s, background 0.15s;
  text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.btn:hover { opacity: 0.88; text-decoration: none; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-outline  { background: transparent; color: var(--accent); border: 1px solid var(--accent-dim); }
.btn-outline:hover { background: rgba(79,163,232,0.08); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.btn-danger { background: var(--danger); color: #fff; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--accent-dim); }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem; margin-top: 1.5rem;
}

/* ── Paper list ──────────────────────────────────────────────────────────── */
.paper-number {
  color: var(--accent); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.3rem;
}
.maturity-tag {
  display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 0.15em 0.6em;
  border-radius: 999px; letter-spacing: 0.05em; text-transform: uppercase;
  white-space: nowrap;
}
.maturity-published { background: rgba(76,175,130,0.15); color: var(--success); border: 1px solid rgba(76,175,130,0.3); }
.maturity-draft      { background: rgba(232,169,79,0.12); color: var(--warning); border: 1px solid rgba(232,169,79,0.25); }
.maturity-preprint   { background: rgba(79,163,232,0.12); color: var(--accent);  border: 1px solid rgba(79,163,232,0.25); }

/* ── Section ─────────────────────────────────────────────────────────────── */
.section { padding: 3rem 0; }
.section-title { margin-bottom: 0.4rem; }
.section-subtitle { color: var(--text-dim); margin-bottom: 1.5rem; font-size: 1rem; }
hr.divider { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
label {
  display: block; font-size: 0.88rem; font-weight: 600;
  color: var(--text-dim); margin-bottom: 0.35rem;
}
input[type=text], input[type=email], input[type=password] {
  width: 100%; padding: 0.7rem 0.9rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  /* 16px minimum prevents iOS zoom-on-focus */
  font-size: 1rem;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
input:focus { outline: none; border-color: var(--accent); }
.form-error { color: var(--danger); font-size: 0.85rem; margin-top: 0.3rem; }
.alert {
  padding: 0.75rem 1rem; border-radius: var(--radius);
  margin-bottom: 1rem; font-size: 0.9rem;
}
.alert-error   { background: rgba(232,80,79,0.12);  border: 1px solid rgba(232,80,79,0.3);  color: var(--danger); }
.alert-success { background: rgba(76,175,130,0.12); border: 1px solid rgba(76,175,130,0.3); color: var(--success); }
.alert-info    { background: rgba(79,163,232,0.10); border: 1px solid rgba(79,163,232,0.25); color: var(--accent); }

/* ── Scorecard ───────────────────────────────────────────────────────────── */
.scorecard-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem; margin: 1.5rem 0;
}
.score-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem;
  text-align: center;
}
.score-stat__value { font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.score-stat__label {
  font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-dim);
}
.scorecard-filters {
  display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.filter-btn {
  padding: 0.4rem 0.9rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); font-size: 0.82rem; cursor: pointer;
  transition: all 0.15s; -webkit-tap-highlight-color: transparent;
  /* ensure comfortable tap target */
  min-height: 36px;
}
.filter-btn.active, .filter-btn:hover {
  border-color: var(--accent); color: var(--accent);
  background: rgba(79,163,232,0.08);
}
.problem-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.problem-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.85rem 1rem;
  display: flex; gap: 0.75rem; align-items: flex-start;
}
.problem-item[data-status=SOLVED]       { border-left: 3px solid var(--success); }
.problem-item[data-status=DISSOLVED]    { border-left: 3px solid #3bbfbf; }
.problem-item[data-status=REFRAMED]     { border-left: 3px solid var(--accent); }
.problem-item[data-status=PREDICTED]    { border-left: 3px solid #a78bfa; }
.problem-item[data-status=REHABILITATED]{ border-left: 3px solid #f97316; }
.problem-item[data-status=UNNECESSARY]  { border-left: 3px solid var(--warning); }
.problem-item[data-status=OPEN]         { border-left: 3px solid var(--text-faint); }
.problem-item__meta {
  display: flex; gap: 0.75rem; align-items: center;
  margin-bottom: 0.2rem; flex-wrap: wrap;
}
.problem-item__part { font-size: 0.74rem; color: var(--text-faint); }
.problem-item__ref  { font-size: 0.74rem; color: var(--accent-dim); font-style: italic; }
.problem-item__title { font-weight: 600; font-size: 0.9rem; }
.problem-item__note  { font-size: 0.82rem; color: var(--text-dim); margin-top: 0.25rem; }
.problem-item__badges { display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-end; flex-shrink: 0; }

/* Status tags */
.status-tag {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  padding: 0.15em 0.55em; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
}
.status-tag--solved       { background: rgba(76,175,130,0.15);  color: var(--success); border: 1px solid rgba(76,175,130,0.3); }
.status-tag--dissolved    { background: rgba(59,191,191,0.12);  color: #3bbfbf;        border: 1px solid rgba(59,191,191,0.3); }
.status-tag--reframed     { background: rgba(79,163,232,0.12);  color: var(--accent);  border: 1px solid rgba(79,163,232,0.25); }
.status-tag--predicted    { background: rgba(167,139,250,0.12); color: #a78bfa;        border: 1px solid rgba(167,139,250,0.25); }
.status-tag--rehabilitated{ background: rgba(249,115,22,0.12);  color: #f97316;        border: 1px solid rgba(249,115,22,0.25); }
.status-tag--unnecessary  { background: rgba(232,169,79,0.12);  color: var(--warning); border: 1px solid rgba(232,169,79,0.25); }
.status-tag--open         { background: rgba(80,80,104,0.15);   color: var(--text-dim);border: 1px solid var(--border); }

/* Maturity badge */
.maturity-badge {
  display: inline-block; font-size: 0.64rem; font-weight: 600;
  padding: 0.1em 0.5em; border-radius: 3px;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
  background: var(--surface-2); color: var(--text-faint); border: 1px solid var(--border);
}
.maturity-badge--derived      { color: var(--success);  border-color: rgba(76,175,130,0.3); }
.maturity-badge--mechanism    { color: var(--accent);   border-color: rgba(79,163,232,0.25); }
.maturity-badge--architecture { color: var(--warning);  border-color: rgba(232,169,79,0.25); }
.maturity-badge--exploratory  { color: var(--text-dim); }

/* ── Prose content (rendered markdown) ──────────────────────────────────── */
.prose h2 { font-size: 1.15rem; margin: 2rem 0 0.5rem; color: var(--text); }
.prose h3 { font-size: 0.98rem; margin: 1.5rem 0 0.4rem; color: var(--accent); }
.prose p  { color: var(--text-dim); font-size: 0.95rem; }
.prose ul, .prose ol { padding-left: 1.5rem; color: var(--text-dim); font-size: 0.95rem; }
.prose li { margin-bottom: 0.4rem; }
.prose strong { color: var(--text); }
.prose em { color: var(--text-dim); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.prose a {
  color: var(--accent);
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.prose a:hover { text-decoration: underline; }
/* Resource link blocks */
.prose h3 + p + p a,
.prose p a[href*="youtube"] {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  background: rgba(79,163,232,0.06);
}
.prose p a[href*="youtube"]:hover {
  background: rgba(79,163,232,0.12);
  text-decoration: none;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border); padding: 1.75rem 1.25rem;
  color: var(--text-faint); font-size: 0.84rem; text-align: center;
}
.footer a { color: var(--text-dim); }

/* ── Mobile — hamburger nav ──────────────────────────────────────────────── */
@media (max-width: 700px) {
  .nav__links { display: none; }
  .nav__auth  { display: none; }
  .nav__burger { display: flex; }

  .hero { padding: 3rem 1.25rem 2.5rem; }
  .hero__actions { flex-direction: column; align-items: center; }
  .hero__actions .btn { width: 100%; max-width: 280px; text-align: center; }

  .section { padding: 2rem 0; }

  /* Paper list row: stack number above title on narrow screens */
  .paper-row { flex-direction: column !important; gap: 0.5rem !important; }
  .paper-row__number { min-width: unset !important; text-align: left !important; font-size: 1rem !important; }

  /* Paper/companion detail header badge row: wrap */
  .detail-meta { flex-wrap: wrap; }

  .card-grid { grid-template-columns: 1fr; }

  .scorecard-summary { grid-template-columns: 1fr 1fr; }

  /* Subscribe inline form: stack on mobile */
  .subscribe-inline { flex-direction: column !important; }
  .subscribe-inline input { min-width: unset !important; }

  input[type=text], input[type=email], input[type=password] {
    font-size: 1rem; /* belt-and-braces against iOS zoom */
  }
}

/* ── Burger animation when open ──────────────────────────────────────────── */
.nav__burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger.open span:nth-child(2) { opacity: 0; }
.nav__burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
