/* =========================================================================
   IB-FT — Breaking Memorization Barriers · project page (WARM theme)
   Palette adapted from the SafePyramid template: cream paper, navy + clay,
   Spectral / IBM Plex.  Same layout & structure as the dark version.
   ========================================================================= */

:root {
  /* warm paper surfaces */
  --bg:        #F4F0E8;
  --bg-panel:  #FBF9F4;
  --bg-card:   #FFFFFF;
  /* ink */
  --ink:       #15171C;
  --ink-soft:  #52565F;
  --ink-faint: #8A8E97;
  --line:      rgba(21,23,28,0.12);
  --line-soft: rgba(21,23,28,0.07);
  /* accents */
  --blue:      #1C548F;
  --blue-deep: #123E6E;
  --blue-bright:#2C73BD;
  --blue-wash: #E4ECF4;
  --clay:      #A84A26;
  --clay-deep: #7E3417;
  --clay-wash: #F4E2D6;
  --gold:      #B7822E;
  --green:     #3A7A4E;
  --green-wash:#E4EFE7;

  /* semantic aliases so the shared markup keeps working */
  --text:       var(--ink);
  --text-2:     #2b2e36;
  --muted:      var(--ink-soft);
  --f:          var(--blue);
  --f-tint:     var(--blue-wash);
  --g:          var(--clay);
  --g-tint:     var(--clay-wash);
  --conflict:   var(--clay);
  --conflict-tint: var(--clay-wash);
  --good:       var(--green);
  --line-strong:rgba(21,23,28,0.20);

  --display: "Spectral", Georgia, "Times New Roman", serif;
  --body:    "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --fs-body:  18px;
  --fs-lede:  clamp(1.12rem, 1.5vw, 1.3rem);
  --fs-eyebrow: .82rem;
  --fs-caption: 1rem;
  --fs-table: .95rem;
  --fs-label: .78rem;
  --fs-h2: clamp(1.95rem, 3.1vw, 2.5rem);
  --fs-h3: clamp(1.3rem, 1.9vw, 1.55rem);

  --wrap: 1160px;
  --prose: 980px;   /* body reading column — LEFT-aligned to the wrap edge, never centered */
  --radius: 14px;
  --radius-sm: 9px;
  --section-y: clamp(76px, 9vw, 132px);
  --shadow-card: 0 1px 2px rgba(21,23,28,.04), 0 12px 34px -18px rgba(21,23,28,.22);
  --ease: cubic-bezier(.22,.61,.36,1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(20px, 5vw, 40px); }
.prose { max-width: var(--prose); }
.prose p { color: var(--text-2); }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.12; color: var(--ink); }
.eyebrow {
  font-family: var(--mono); font-size: var(--fs-eyebrow); letter-spacing: .18em;
  text-transform: uppercase; color: var(--clay); margin: 0 0 14px;
  display: inline-flex; align-items: center; gap: 12px;
}
.eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--clay); display: inline-block; }
em { font-style: italic; }
strong { font-weight: 600; color: var(--ink); }

/* ---------- top navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(244,240,232,.82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.nav__mark {
  font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: var(--blue);
  letter-spacing: .01em;
}
.nav__mark:hover { text-decoration: none; }
.nav__links { display: flex; gap: clamp(14px, 2vw, 30px); list-style: none; margin: 0; padding: 0; }
.nav__links a { font-size: .92rem; color: var(--ink-soft); font-weight: 500; }
.nav__links a:hover { color: var(--ink); text-decoration: none; }
.nav__progress { height: 2px; background: linear-gradient(90deg, var(--clay), var(--blue)); width: 0; transition: width .1s linear; }
@media (max-width: 720px) { .nav__links { display: none; } }

/* ---------- hero (light / warm) ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(90% 70% at 82% -10%, rgba(168,74,38,.08) 0%, rgba(168,74,38,0) 60%),
    radial-gradient(80% 70% at 10% 0%, rgba(28,84,143,.07) 0%, rgba(28,84,143,0) 55%),
    var(--bg-panel);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  padding: clamp(64px, 10vw, 112px) 0 clamp(52px, 8vw, 84px);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(21,23,28,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21,23,28,.035) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(120% 100% at 50% 0%, #000 25%, transparent 72%);
}
.hero > .wrap { position: relative; }
.pill {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: .8rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--clay);
  border: 1px solid var(--clay-wash); background: rgba(168,74,38,.06); border-radius: 999px;
  padding: 7px 16px 7px 13px; margin-bottom: clamp(28px, 5vw, 44px);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--clay); box-shadow: 0 0 0 4px rgba(168,74,38,.14); }

.hero h1 {
  font-size: clamp(2.7rem, 6.2vw, 4.6rem); color: var(--ink); margin: 0 0 22px;
  letter-spacing: -.01em; max-width: 15ch;
}
.hero h1 .accent {
  background: linear-gradient(102deg, var(--clay) 0%, #9a4a2f 32%, #4a4f8a 66%, var(--blue-deep) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero h1 .accent-b { color: var(--blue); }

/* two-column hero: content + borderless race illustration */
.hero__grid { display: grid; grid-template-columns: 1.12fr .88fr; gap: clamp(20px, 4vw, 56px); align-items: center; }
.hero__content { min-width: 0; }
.hero__figure { margin: 0; }
.hero__figure img {
  display: block; width: 100%; height: auto; max-width: 540px; margin: 0 auto;
  filter: drop-shadow(0 20px 34px rgba(21,23,28,.14));
}
.hero__figure figcaption {
  margin: 18px auto 0; max-width: 460px; font-size: .9rem; line-height: 1.5;
  color: var(--ink-faint); text-align: center;
}
.hero__figure figcaption b { color: var(--ink-soft); font-weight: 600; }
@media (max-width: 880px) {
  .hero__grid { grid-template-columns: 1fr; gap: 36px; }
  .hero__figure { order: 1; }
  .hero__figure img { max-width: 420px; }
}
.hero .lede {
  font-size: clamp(1.15rem, 1.9vw, 1.5rem); color: var(--ink-soft); max-width: 40ch;
  line-height: 1.5; margin: 0 0 clamp(30px, 5vw, 48px); font-weight: 400;
  font-family: var(--display); font-style: italic;
}
.hero .authors { max-width: 62ch; line-height: 2; color: var(--text-2); font-size: 1.05rem; }
.hero .authors a { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.hero .affils { margin-top: 14px; color: var(--ink-faint); font-size: .92rem; line-height: 1.7; max-width: 66ch; }

/* action buttons */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(32px, 5vw, 44px); }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--body); font-weight: 500; font-size: .98rem;
  padding: 11px 22px; border-radius: 999px;
  border: 1px solid transparent; transition: transform .18s var(--ease), background .18s, border-color .18s, box-shadow .18s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn--primary { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 10px 24px -12px rgba(28,84,143,.6); }
.btn--primary:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: #fff; border-color: var(--line-strong); }
.btn svg { width: 16px; height: 16px; }

/* ---------- section scaffolding ---------- */
.section { padding: var(--section-y) 0; }
.section--tight { padding: clamp(56px,7vw,88px) 0; }
.section--alt { background: var(--bg-panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section--ink { background: var(--blue-deep); color: #dbe6f2;
  background-image: radial-gradient(90% 120% at 85% 0%, rgba(255,255,255,.06), rgba(255,255,255,0) 60%); }
.section--ink h2, .section--ink h3 { color: #fff; }
.section--ink .eyebrow { color: #f0c9a8; }
.section--ink .eyebrow::before { background: #f0c9a8; }
.section--ink .prose p { color: #c6d5e6; }

/* Everything left-aligns to the wrap edge (like SIFT). Text just gets a
   max-width so lines stay readable — it is NOT centered. */
.section__head { margin-bottom: clamp(34px, 5vw, 54px); }
.section h2 { font-size: var(--fs-h2); margin: 0 0 18px; letter-spacing: -.01em; max-width: 20ch; }
.section h3 { font-size: var(--fs-h3); margin: 0 0 12px; }
.lead { font-size: var(--fs-lede); color: var(--ink-soft); max-width: 60ch; line-height: 1.55; }
.section--ink .lead { color: #aec2d8; }

.subsec { margin-top: clamp(42px, 5vw, 64px); }
.subsec:first-child { margin-top: 0; }

/* ---------- glance / stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 8px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .stat-grid { grid-template-columns: 1fr; } }

/* glance: compact 2x2 stat block on the left, a smaller Fig 1a on the right */
.glance-grid { display: grid; grid-template-columns: 1fr 0.86fr; gap: clamp(20px, 3vw, 34px); align-items: center; }
.glance-grid .stat-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: auto; margin-top: 0; height: auto; gap: 14px; }
.glance-grid .stat { padding: 20px 18px 18px; }
.glance-grid .glance-fig { margin: 0; }
.glance-grid .glance-fig img { display: block; width: auto; max-width: 100%; height: auto; max-height: 300px; margin: 0 auto; object-fit: contain; }
.glance-grid .glance-fig figcaption { margin-top: 12px; }
@media (max-width: 900px) { .glance-grid { grid-template-columns: 1fr; } .glance-grid .glance-fig img { max-height: none; } }
@media (max-width: 520px) { .glance-grid .stat-grid { grid-template-columns: 1fr; } }

.hero .authors sup { color: var(--clay); font-size: .68em; font-weight: 600; }
.hero .affils sup { color: var(--clay); font-weight: 600; }
.stat {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 22px 20px; box-shadow: var(--shadow-card);
}
.stat__label { font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-soft); font-weight: 600; }
.stat__row { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; }
.stat__from { font-family: var(--mono); color: var(--ink-faint); font-size: 1rem; }
.stat__arrow { color: var(--line-strong); }
.stat__to { font-family: var(--display); font-size: 2.1rem; font-weight: 600; color: var(--blue); line-height: 1; }
.stat__delta { display: inline-block; margin-top: 12px; font-family: var(--mono); font-size: .82rem;
  color: var(--green); background: var(--green-wash); padding: 3px 9px; border-radius: 999px; }
.stat__sub { margin-top: 10px; font-size: .86rem; color: var(--ink-faint); }

/* ---------- callout / question box ---------- */
.callout {
  border: 1px solid var(--line); border-left: 3px solid var(--blue);
  background: var(--blue-wash); border-radius: var(--radius-sm);
  padding: 20px 24px; margin: 30px 0; max-width: 820px;
}
.callout--barrier { border-left-color: var(--clay); background: var(--clay-wash); border-color: rgba(168,74,38,.22); max-width: 820px; }
.callout .k { font-family: var(--mono); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); display: block; margin-bottom: 8px; }
.callout--barrier .k { color: var(--clay-deep); }
.callout p { margin: 0; color: var(--text-2); font-size: 1.05rem; }

/* ---------- equations (no box — set directly on the paper) ---------- */
.eq {
  display: flex; align-items: center; gap: 16px;
  margin: 22px 0; max-width: 820px; overflow-x: auto;
  padding: 6px 2px;
}
.eq__body {
  flex: 1 1 auto; text-align: center; white-space: nowrap;
  font-family: var(--display); font-size: 1.32rem; color: var(--ink); line-height: 1.5;
}
.eq__num { flex: 0 0 auto; font-family: var(--mono); font-size: .82rem; color: var(--ink-faint); }
.eq .var { font-style: italic; }
.eq .sub { font-size: .68em; vertical-align: sub; }
.eq .sup { font-size: .68em; vertical-align: super; }
.eq--hero .eq__body { color: var(--blue-deep); font-weight: 600; font-size: 1.5rem; }
.eq--hero .eq__num { color: var(--blue); font-weight: 500; }
.section--ink .eq__body { color: #eef3f9; }

/* ---------- figures ---------- */
.figrow { display: grid; gap: 26px; margin: 8px 0; }
.figrow.two { grid-template-columns: 1fr 1fr; }
.figrow.two-uneven { grid-template-columns: 1.15fr 1fr; align-items: center; }
@media (max-width: 820px) { .figrow.two, .figrow.two-uneven { grid-template-columns: 1fr; } }
figure { margin: 0; }
.fig-card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-card);
}
.fig-card img { display: block; width: 100%; height: auto; border-radius: 6px; }
figcaption { font-size: var(--fs-caption); color: var(--ink-soft); line-height: 1.5; margin-top: 14px; }
figcaption b { color: var(--text-2); font-weight: 600; }
.figtag { font-family: var(--mono); font-size: .74rem; color: var(--clay); letter-spacing: .08em; text-transform: uppercase; }

/* ---------- data tables ---------- */
.tablewrap { overflow-x: auto; margin: 8px 0; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); background: var(--bg-card); }
table.data { border-collapse: collapse; width: 100%; font-size: var(--fs-table); min-width: 560px; }
table.data caption { text-align: left; padding: 16px 18px 4px; font-size: var(--fs-caption); color: var(--ink-soft); caption-side: top; }
table.data th, table.data td { padding: 11px 16px; text-align: right; border-bottom: 1px solid var(--line-soft); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { font-family: var(--body); font-weight: 600; color: var(--ink-soft); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1.5px solid var(--line); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr.hl { background: var(--blue-wash); }
table.data tbody tr.hl td { font-weight: 600; color: var(--blue-deep); }
table.data .mono { font-family: var(--mono); }
table.data .up { color: var(--green); font-weight: 600; }

/* ---------- experiment cards ---------- */
.exp-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-card);
  padding: clamp(22px, 3vw, 32px); box-shadow: var(--shadow-card); margin-top: 22px;
}
.exp-card__meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.chip { font-family: var(--mono); font-size: .74rem; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-soft); }
.chip--data { color: var(--clay-deep); border-color: rgba(168,74,38,.25); background: var(--clay-wash); }

/* ---------- list ---------- */
ul.clean { list-style: none; padding: 0; margin: 18px 0; max-width: var(--prose); }
ul.clean li { position: relative; padding-left: 26px; margin-bottom: 14px; color: var(--text-2); }
ul.clean li::before { content: ""; position: absolute; left: 4px; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--clay); }
.section--ink ul.clean li { color: #c6d5e6; }
.section--ink ul.clean li::before { background: #f0c9a8; }

/* ---------- bibtex ---------- */
.cite-block {
  background: #15171C; color: #eef0f4; border-radius: var(--radius);
  padding: 24px; overflow-x: auto; font-family: var(--mono); font-size: .86rem; line-height: 1.7;
  position: relative; margin-top: 20px; border: 1px solid rgba(21,23,28,.4);
}
.cite-block pre { margin: 0; white-space: pre; }
.cite-block .tok-k { color: #7fb0e8; }
.cite-block .tok-f { color: #e0a578; }
.copy-btn {
  position: absolute; top: 14px; right: 14px; font-family: var(--body); font-size: .8rem;
  color: #dfe4ee; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; transition: background .15s;
}
.copy-btn:hover { background: rgba(255,255,255,.16); }

/* ---------- footer ---------- */
.footer { background: var(--blue-deep); color: #b7c7da; padding: 48px 0; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 30px; justify-content: space-between; align-items: flex-start; }
.footer h4 { font-family: var(--body); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: #8ba4c0; margin: 0 0 10px; font-weight: 600; }
.footer a { color: #e7edf5; }
.footer .small { font-size: .84rem; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }
