:root{
  --bg: #ffffff;
  --text: #111111;
  --muted: #6b7280;
  --accent: #0ea5e9;
  --accent-2: #22c55e;
  --panel: #f5f5f5;
}
[data-theme="dark"] {
  --bg: #18181b;
  --text: #e6e6e6;
  --muted: #9ca3af;
  --accent: #38bdf8;
  --accent-2: #4ade80;
  --panel: #23232a;
}
@media (prefers-color-scheme: dark){
  :root{ --bg:#0b0b0c; --text:#e6e6e6; --muted:#9ca3af; --accent:#38bdf8; --accent-2:#4ade80; --panel:#121316; }
}
html,body{ margin:0; padding:0; background:var(--bg); color:var(--text); font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, sans-serif; line-height:1.5; }
.skip-link{ position:absolute; left:-9999px; top:auto; width:1px; height:1px; overflow:hidden; }
.skip-link:focus{ position:static; width:auto; height:auto; padding:0.5rem 1rem; background:var(--accent); color:white; }
.site-header{ position:sticky; top:0; z-index:10; background:var(--bg); border-bottom:1px solid rgba(0,0,0,.08); padding:0.75rem 1rem; display:flex; align-items:center; gap:1rem; }
.site-header h1{ font-size:1.125rem; margin:0; }
.site-header h1{ font-size:2.0rem; margin:0; }
.site-header .tagline{ margin:0; color:var(--muted); font-size:1.2rem; }
#themeToggle{ margin-left:auto; background:transparent; border:1px solid var(--muted); border-radius:999px; padding:0.25rem 0.5rem; color:var(--text); cursor:pointer; }
main{ max-width:1100px; margin:0 auto; padding:0 1rem; }
.step{ min-height:100svh; display:grid; grid-template-columns: minmax(600px, 3fr) 2.5fr; align-items:start; gap:1rem; padding:2rem 0; }
.step h2{ grid-column:1; margin:0.5rem 0; font-size:1.25rem; }
.step h2{ grid-column:1; margin:1.0rem 0; font-size:2rem; }
.step .step-copy{ grid-column:1; color:var(--muted); max-width:60ch; }
.step > .chart, .step > .hero-visual, .step > .before-after, .step > .split-panel, .step > .final-text, .step > .world-outline{ grid-column:2; }
.step > .annotation, .step > .hero-captions, .step > .badges{ grid-column:2; }
.chart{ width:100%; height:60svh; background:var(--panel); border-radius:12px; overflow:hidden; }
.chart{ position:relative; }
#hero-title{ font-size:1.8rem; font-weight:750;}
#hero-title{ font-size:1.8rem; font-weight:750; grid-column:2; align-self:center;}
.step-copy{ font-size:1.25rem; font-weight:450;}
.hero-visual{ position:relative; height:55svh; width:100%; max-width:700px; border-radius:10px; background:linear-gradient(90deg, #1f77b4 0%, #d62728 100%); overflow:hidden; }
#hero-text { display: flex; flex-direction: column; justify-content: center; grid-column: 2; }
.hero-visual img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; opacity:0; transition:opacity 2.5s ease; }
.hero-visual img.active{ opacity:2; }
.hero-captions{ display:flex; gap:0.75rem; }
.hero-captions p{ margin:0; padding:0.25rem 0.5rem; background:var(--panel); border-radius:8px; opacity:.6; transition:opacity .3s ease, transform .3s ease; }
.hero-captions p.active{ opacity:1; transform:translateY(-2px); outline:2px solid var(--accent); }
.hero-caption-texts{ margin:0; padding:0.1rem 0.25rem; background:var(--panel); border-radius:8px; opacity:.6; transition:opacity .3s ease, transform .3s ease; font-size:0.85rem; font-style:italic; }
.before-after{ position:relative; height:50svh; border-radius:12px; overflow:hidden; display:grid; place-items:center; }
.before-after img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; transition:opacity .6s ease; }
.before-after img[aria-hidden="true"]{ opacity:0; }
.before-after.active img[aria-hidden="true"]{ opacity:1; }
.split-panel{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:0.5rem; height:55svh; }
.split-panel > div{ background:var(--panel); border-radius:10px; padding:0.5rem; }
.badges{ display:flex; flex-wrap:wrap; gap:0.5rem; list-style:none; padding:0; }
.badges li{ background:var(--panel); border-radius:999px; padding:0.35rem 0.6rem; }
.badges li{ opacity:.2; transition:opacity .4s ease, transform .4s ease; }
.badges li.active{ opacity:1; transform:translateY(-2px); }
.final-text{ display:grid; place-items:center; height:40svh; text-align:center; }
.final-text .line{ opacity:0.2; font-size:clamp(1.4rem, 4vw, 2.2rem); margin:0.25rem 0; transition:opacity .5s ease, transform .5s ease; transform:translateY(6px); }
.final-text .line.active{ opacity:1; transform:none; }
.world-outline{ height:40svh; background:radial-gradient(120% 100% at 50% 50%, rgba(14,165,233,.18), transparent 60%); border-radius:12px; }
.world-outline{ position:relative; overflow:hidden; }
.world-outline::after{ content:""; position:absolute; inset:0; background:linear-gradient(180deg, rgba(34,197,94,0.12), rgba(34,197,94,0.22)); transform:scaleY(0); transform-origin:bottom; transition:transform 1.2s ease; }
.world-outline.active::after{ transform:scaleY(1); }
.annotation{ position:absolute; inset:auto 0 0 0; padding:0.5rem; pointer-events:none; }
.annotation .callout{ display:inline-block; background:rgba(0,0,0,.65); color:#fff; padding:0.35rem 0.5rem; border-radius:6px; font-size:0.85rem; }
.tooltip{ position:fixed; z-index:20; pointer-events:none; background:rgba(17,24,39,.92); color:#fff; padding:6px 8px; border-radius:6px; font-size:12px; transform:translate(-50%, -120%); opacity:0; transition:opacity .15s ease; }
.tooltip.show{ opacity:1; }
.visually-hidden{ position:absolute !important; height:1px; width:1px; overflow:hidden; clip:rect(1px,1px,1px,1px); white-space:nowrap; }
@media (max-width: 800px){
  .step{ grid-template-columns: 1fr; }
  .split-panel{ grid-template-columns:1fr; height:auto; }
  .chart{ height:50svh; }
}
/* ===== Theme tokens (tweak to taste) ===== */
:root{
  --card-bg: #0f1216;              /* tile background */
  --card-ring: #1f2937;            /* outer border */
  --text-dim: #cbd5e1;
  --text-strong: #ffffff;
  --shadow: 0 6px 24px rgba(0,0,0,.25), inset 0 0 0 1px var(--card-ring);
  --radius-xl: 16px;
  --radius-2xl: 22px;

  --c-green: #22c55e;
  --c-amber: #f59e0b;
  --c-red:   #ef4444;
  --c-blue:  #60a5fa;
}

/* ===== Section ===== */
#challenges.fancy{
  display: grid;
  gap: 1rem;
}

/* ===== Metric tiles ===== */
.metric-cards{
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: .9rem;
}
.metric-card{
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem 1.1rem;
  isolation: isolate; /* keep the accent behind content */
  overflow: hidden;
}
.metric-card::before{
  /* colored rail on the left like the screenshot */
  content: "";
  position: absolute;
  inset: 8px auto 8px 8px;
  width: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: .9;
}
.metric-card h3{
  margin: 0 0 .25rem 0;
  color: var(--text-dim);
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .2px;
}
.metric-card .metric{
  margin: 0;
  color: var(--text-strong);
  font-weight: 800;
  font-size: 1.6rem;
}

/* color accents */
.accent-green{ color: var(--c-green); }
.accent-amber{ color: var(--c-amber); }
.accent-red{   color: var(--c-red); }
.accent-blue{  color: var(--c-blue); }

/* Hover / focus flair */
.metric-card{
  transition: transform .18s ease, box-shadow .18s ease;
}
.metric-card:where(:hover,:focus-within){
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 0 0 1px var(--card-ring);
}

/* ===== Challenge cards ===== */
.challenge-cards{
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: .9rem;
  list-style: none;
  margin: .2rem 0 0;
  padding: 0;
}
.challenge-card{
  grid-column: span 6;             /* 2-up on desktop */
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .8rem;
  align-items: start;

  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: .9rem 1rem;
  position: relative;
  overflow: hidden;
}
.challenge-card::before{
  content: "";
  position: absolute;
  inset: 8px auto 8px 8px;
  width: 5px;
  border-radius: 999px;
  background: currentColor;
  opacity: .9;
}
.challenge-card .emoji{
  font-size: 1.2rem;
  line-height: 1;
  display: grid;
  place-items: center;
  height: 28px; width: 28px;
  border-radius: 10px;
  background: color-mix(in oklab, currentColor 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, currentColor 55%, transparent);
}
.challenge-card h4{
  margin: 0 0 .15rem;
  color: var(--text-strong);
  font-size: 1rem;
  font-weight: 700;
}
.challenge-card p{
  margin: 0;
  color: var(--text-dim);
  font-size: .95rem;
  line-height: 1.35;
}

/* hover/focus */
.challenge-card{
  transition: transform .18s ease, box-shadow .18s ease;
}
.challenge-card:where(:hover,:focus-within){
  transform: translateY(-1px);
  box-shadow: 0 12px 34px rgba(0,0,0,.38), inset 0 0 0 1px var(--card-ring);
}

/* ===== Responsive ===== */
@media (max-width: 900px){
  .metric-cards{ grid-template-columns: 1fr; }
  .challenge-card{ grid-column: span 12; } /* 1-up on mobile */
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .metric-card, .challenge-card{ transition: none; }
}
#site-footer {
  background: #0f1115;                 /* dark background */
  border-top: 1px solid #1f2937;       /* subtle top border */
  padding: 2.5rem 1rem;                /* generous spacing */
  text-align: center;
}

#site-footer p {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: #f9fafb;                      /* bright text */
}

/* optional: make it “stick” to bottom if content is short */
html, body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
body > *:last-child {
  margin-top: auto;
}
.plot-card {
  background: var(--card-bg, #fff);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
  border: 2px solid var(--accent-color, #4E79A7);
  padding: 1.7em 2.2em;
  margin: 2em auto 1.5em auto;
  max-width: 1100px;
  color: var(--text-color, #222);
}

.site-footer.plot-card {
  text-align: center;
  font-size: 1.08em;
  opacity: 1;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
}

#site-footer {
  background: #0f1115;                 /* dark background */
  border-top: 1px solid #1f2937;       /* subtle top border */
  padding: 2.5rem 1rem;
  text-align: center;
}

#site-footer .footer-heading {
  margin: 0 0 1rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: #f9fafb;                      /* bright text */
}

/* Links */
#site-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

#site-footer .footer-links a {
  color: #9ca3af;                      /* muted gray */
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color .2s ease;
}
#site-footer .footer-links a:hover,
#site-footer .footer-links a:focus {
  color: #f9fafb;                      /* brighten on hover */
}

/* stick footer to bottom if content is short */
html, body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
body > *:last-child {
  margin-top: auto;
}

/* Responsive: stack links vertically on small screens */
@media (max-width: 600px) {
  #site-footer .footer-links {
    flex-direction: column;
    gap: .6rem;
  }
}
/* Defaults (used when NO data-theme attr) – i.e., AUTO mode */
:root {
  /* light defaults; dark will override via media query */
  --bg: #ffffff;
  --fg: #111827;
}
@media (prefers-color-scheme: dark){
  :root { --bg: #0f1115; --fg: #e5e7eb; }
}

/* Explicit themes override auto */
:root[data-theme="light"] { --bg: #ffffff; --fg: #111827; }
:root[data-theme="dark"]  { --bg: #0f1115; --fg: #e5e7eb; }

body { background: var(--bg); color: var(--fg); }

/* (optional) button styling */
#themeToggle[data-mode="auto"]::after { content: "Auto"; }
#themeToggle[data-mode="light"]::after{ content: "Light"; }
#themeToggle[data-mode="dark"]::after { content: "Dark"; }
#hero.plot-card {
  color: #fff;
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  padding: 2.5em 4vw;
}
#hero.plot-card p {
  font-size: 1.2em;
  line-height: 1.7;
  margin: 0;
  padding: 0;
}
.hero-description2 {
  font-style: italic;
  font-size: 1rem !important;
  opacity: 0.92;
}

