/* -------------------------
   Design tokens
-------------------------- */
:root{
  --bg: #ffffff;
  --fg: #111111;
  --muted: #666666;
  --border: #e7e7e7;
  --alt: #fafafa;
  --shadow: 0 8px 22px rgba(0,0,0,.06);

  /* Your palette */
  --daps-green: rgb(72,139,36);
  --daps-peach: rgb(236,161,79);
  --daps-lavender: rgb(140,147,211);
  --daps-salmon: rgb(205,130,130);
  --daps-gold: rgb(243,200,74);

  /* Accents */
  --accent: var(--daps-green);
  --accent-2: var(--daps-lavender);

  --radius: 16px;
  --container: 1060px;

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  font-family: var(--font);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.55;
}

img, video{ max-width: 100%; height: auto; display: block; }
a{ color: var(--accent); text-decoration: none; }
a:hover{ text-decoration: underline; }
a[aria-disabled="true"]{ color: var(--muted); pointer-events: none; }

.container{
  width: min(var(--container), calc(100% - 40px));
  margin: 0 auto;
}

.muted{ color: var(--muted); }
.note{ font-size: .95rem; }

/* Skip link */
.skiplink{
  position: absolute;
  left: -999px;
  top: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  z-index: 999;
}
.skiplink:focus{ left: 12px; }

/* -------------------------
   Topbar
-------------------------- */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 16px;
}
.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.brand__mark{
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 4px;
  box-shadow: 0 0 0 4px rgba(72,139,36,.10);
}
.nav{
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.nav a{
  color: var(--fg);
  padding: 6px 10px;
  border-radius: 10px;
}
.nav a:hover{
  background: rgba(72,139,36,.08);
  text-decoration: none;
}

.menu-toggle{
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 1.1rem;
  cursor: pointer;
}

@media (max-width: 920px){
  .nav{
    display: none;
    position: absolute;
    top: 56px;
    right: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 10px;
    flex-direction: column;
    gap: 6px;
    min-width: 160px;
    z-index: 100;
  }

  .nav a{
    padding: 8px 10px;
  }

  .menu-toggle{
    display: block;
  }

  .nav.open{
    display: flex;
  }
}

/* -------------------------
   Sections
-------------------------- */
.section{ padding: 56px 0; }
.section--alt{
  background: var(--alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
h1{
  font-size: clamp(2rem, 3vw, 2.7rem);
  line-height: 1.12;
  margin: 10px 0 14px;
}
h2{ font-size: 1.55rem; margin: 0 0 18px; }
h3{ font-size: 1.05rem; margin: 0 0 10px; }
.kicker{ margin: 0; color: var(--muted); font-size: .95rem; }

/* -------------------------
   Hero
-------------------------- */
.hero{ padding: 42px 0 10px; }
.hero__grid{
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 26px;
  align-items: start;
}
.lede{
  font-size: 1.05rem;
  margin: 0 0 18px;
}
.cta{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 12px;
}

/* HERO variant: stacked */
.hero--stack .hero__figure{ margin-top: 16px; }

/* Fix hero figure aesthetics */
.hero__figure{
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 14px;
}
.hero__figure img{
  width: 100%;
  height: auto;
  border-radius: 12px;          /* match media feel */
}
.hero__figure figcaption{
  text-align: center;           /* replaces <center> */
  margin-top: 10px;
  color: var(--muted);
  font-size: .95rem;
}

/* -------------------------
   Cards / layout helpers
-------------------------- */
.card{
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);

  /* Keep overflow protection for media, but don't clip math inside equation blocks */
  overflow: hidden;
}

/* grids */
.grid2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.grid3{
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  align-items: start;
}

/* Media inside cards */
.media{
  width: 100%;
  max-width: 100%;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

/* Buttons */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}
.btn:hover{
  text-decoration: none;
  border-color: rgba(72,139,36,.35);
  box-shadow: 0 8px 22px rgba(72,139,36,.10);
}
.btn--primary{
  background: var(--accent);
  color: #fff;
  border-color: rgba(0,0,0,.0);
}
.btn--primary:hover{ filter: brightness(0.98); }

/* Pills */
.meta{
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pill{
  font-size: .9rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
}
.pill--green{ border-color: rgba(72,139,36,.35); background: rgba(72,139,36,.08); }
.pill--lav{ border-color: rgba(140,147,211,.45); background: rgba(140,147,211,.10); }
.pill--gold{ border-color: rgba(243,200,74,.55); background: rgba(243,200,74,.14); }

/* Lists */
.bullets{ margin: 0; padding-left: 18px; }
.bullets li{ margin: 6px 0; }

/* Equation block — barebones, native */
.equation{
  border-left: 4px solid rgba(72,139,36,.50);
  padding: 8px 12px;
  margin: 12px 0;
  background: rgba(72,139,36,.04);
  border-radius: 12px;

  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Timeline / steps */
.stack{ display: grid; gap: 16px; }

.timeline{
  display: grid;
  gap: 16px;
  margin-top: 14px;
}
.step{ padding: 18px; }
.step__head{
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.step__badge{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(72,139,36,.35);
  background: rgba(72,139,36,.08);
  position: relative;
}
.step__badge::after{
  content: attr(data-step);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--fg);
}
.step__media{ margin: 12px 0; }

/* Collapsible math block */
.mathdrop{
  margin: 10px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 12px;
}
.mathdrop summary{ cursor: pointer; font-weight: 700; }
.mathdrop__body{ margin-top: 10px; }

/* Code blocks */
pre{
  overflow: auto;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: #e5e7eb;
  font-family: var(--mono);
  font-size: .92rem;
  line-height: 1.4;
}
code{ font-family: var(--mono); }

/* Footer */
.footer{ border-top: 1px solid var(--border); padding: 26px 0; }
.footer__inner{
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 920px){
  .hero__grid{ grid-template-columns: 1fr; }
  .grid2{ grid-template-columns: 1fr; }
  .grid3{ grid-template-columns: 1fr; }
  .nav{ display: none; }
}

@media (max-width: 520px){
  .container{ width: min(var(--container), calc(100% - 24px)); }
  .card{ padding: 14px; border-radius: 14px; }
  .step__head{ grid-template-columns: 44px 1fr; }
  .step__badge{ width: 38px; height: 38px; border-radius: 12px; }
}

.card > .muted{
  text-align: center;
}

#videos .grid3{
  gap: 12px;
}

#videos .card h3{
  margin-bottom: 8px;   /* tighter than your global 10px */
}

#videos .card{
  padding: 14px;
}

#videos .media{
  border: none;
  border-radius: 12px; /* keep rounding */
}

/* Results: 3-row reconstruction panel */
.recon-grid{
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.recon-row--stacked{
  display: grid;
  gap: 6px;
  align-items: start;
}

.recon-row--stacked .recon-label{
  text-align: left; /* or center if you prefer */
}

.recon-label{
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--fg);
}

.recon-label--daps{
  color: var(--accent);
}

.recon-img{
  border: none;          /* avoid double border inside card */
  border-radius: 10px;
}

.recon-note{
  text-align: center;
  margin: 12px 0 0;
}

.recon-note strong{
  color: var(--fg);
  font-weight: 800;
}

/* Mobile: label above each strip */
@media (max-width: 720px){
  .recon-row{
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.codebook-block{
  margin-top: 12px;
}

.codebook-label{
  font-weight: 800;
  color: var(--fg);
  margin: 6px 0 8px;
  letter-spacing: 0.2px;
}

.codebook-scroll{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

@media (min-width: 900px){
  .codebook-scroll{ overflow-x: visible; }
}

@media (max-width: 520px){
  .recon-label{
    font-size: 0.75rem;   /* was inheriting ~1rem+ with strong weight */
    line-height: 1.15;
    margin-bottom: 1px;   /* less vertical waste */
  }

  .recon-row--stacked{
    gap: 3px;             /* tighten label → image spacing */
  }
}

