/* Mobile-first: base styles target small screens, media queries scale up. */

:root {
  --accent: #e0714f;      /* poster orange */
  --accent-soft: #f6d3c5;
  --blue: #2f7ad6;
  --navy: #1f2340;
  --text: #2b2b2b;
  --muted: #5f6270;
  --bg: #e9e9ec;          /* poster grey */
  --card: #ffffff;
  --soft: #f5f6fb;
  --border: #d9d9e3;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --gutter: clamp(12px, 4vw, 32px);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--blue); }

.wrap {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid var(--accent);
  transition: transform 0.15s, background 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--accent); }
.btn-light { background: #fff; color: var(--navy); border-color: #fff; }

/* ---------- 1. Hero ---------- */
.hero {
  background: var(--navy);
  color: #fff;
  text-align: center;
  padding: clamp(48px, 10vw, 96px) 0 clamp(40px, 8vw, 72px);
}
.hero-school {
  margin: 0 0 14px;
  font-family: var(--sans);
  font-size: clamp(0.7rem, 0.65rem + 0.3vw, 0.85rem);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.75;
}
.hero h1 {
  margin: 0;
  font-size: clamp(2.8rem, 1.5rem + 7vw, 6rem);
  line-height: 1.05;
}
.hero-question {
  max-width: 700px;
  margin: 18px auto 0;
  font-size: clamp(1.1rem, 1rem + 0.6vw, 1.45rem);
  color: var(--accent-soft);
}
.hero-authors {
  margin: 18px 0 0;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0.03em;
}
.hero-authors span { margin: 0 8px; opacity: 0.6; }
.hero-intro {
  max-width: 640px;
  margin: 28px auto 32px;
  opacity: 0.9;
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 4px;
  padding: 8px var(--gutter);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 0.9rem;
  /* scrolls horizontally on small screens instead of wrapping */
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--navy);
  text-decoration: none;
}
.nav a:hover { background: var(--soft); color: var(--accent); }

/* ---------- 2. Poster ---------- */
.poster-section {
  padding: clamp(16px, 4vw, 48px) clamp(6px, 2vw, 40px) 8px;
  text-align: center;
  scroll-margin-top: 48px;
}
.poster-frame {
  display: block;
  max-width: 1600px;
  margin: 0 auto;
  border-radius: clamp(4px, 1vw, 12px);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 40px rgba(31, 35, 64, 0.25);
  cursor: zoom-in;
}
.poster-frame img { width: 100%; }
.poster-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}
.poster-hint {
  margin: 12px 0 0;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- 3. Going further ---------- */
main { padding-top: clamp(40px, 8vw, 80px); padding-bottom: 24px; }

.section-intro {
  max-width: 720px;
  margin: 0 auto clamp(24px, 5vw, 48px);
  text-align: center;
}
.kicker {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
}
.big-title {
  margin: 6px 0 12px;
  font-size: clamp(2rem, 1.4rem + 3vw, 3rem);
  color: var(--navy);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: clamp(20px, 4vw, 40px);
  margin-bottom: clamp(18px, 3vw, 28px);
  scroll-margin-top: 64px;
}
.card h2 {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  line-height: 1.25;
  border-bottom: 2px dashed var(--accent);
  padding-bottom: 8px;
}
.card h3 { color: var(--navy); }
.card p { margin: 0 0 14px; }
.card p:last-child { margin-bottom: 0; }
.card ul, .card ol { padding-left: 22px; }
.card li { margin-bottom: 8px; }

.highlight {
  background: #fdf1ec;
  border-left: 4px solid var(--accent);
  padding: 14px 18px;
  border-radius: 0 8px 8px 0;
}

/* Summary */
.summary-grid {
  display: grid;
  gap: 14px;
}
.summary-item {
  background: var(--soft);
  border-radius: 10px;
  padding: 18px;
}
.summary-item p { margin: 8px 0 0; }
.summary-tag {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: var(--navy);
  padding: 3px 10px;
  border-radius: 999px;
}

/* Chart */
.chart-title {
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(1rem, 0.9rem + 0.4vw, 1.2rem);
}
.chart-sub {
  margin: 4px 0 12px !important;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
}
.legend {
  display: flex;
  gap: 20px;
  font-family: var(--sans);
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: -1px;
}
.swatch.before, .bar.before { background: var(--accent); }
.swatch.after,  .bar.after  { background: var(--blue); }

/* on very narrow phones the chart scrolls sideways rather than squashing */
.chart-scroll { overflow-x: auto; }
.chart {
  display: flex;
  gap: 6px;
  min-width: 420px;
  height: clamp(240px, 40vw, 340px);
  padding-top: 24px;
  font-family: var(--sans);
}
.group {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.group.average {
  background: #eef1f6;
  border-radius: 6px 6px 0 0;
}
.bars {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  border-bottom: 1px solid #bbb;
}
.bar {
  position: relative;
  width: 40%;
  max-width: 40px;
  border-radius: 3px 3px 0 0;
}
/* scale: 80 % of wrong answers = full height */
.bar.before { height: calc(var(--b) / 80 * 100%); }
.bar.after  { height: calc(var(--a) / 80 * 100%); }
.bar span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(0.62rem, 0.55rem + 0.3vw, 0.8rem);
  font-weight: 600;
  padding-bottom: 2px;
  white-space: nowrap;
}
.label {
  text-align: center;
  font-size: clamp(0.68rem, 0.6rem + 0.3vw, 0.85rem);
  padding-top: 6px;
  white-space: nowrap;
}

.key-figures {
  display: grid;
  gap: 12px;
  margin: 28px 0 20px;
}
.figure {
  text-align: center;
  background: var(--soft);
  border-radius: 10px;
  padding: 14px 8px;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
}
.figure .big {
  display: block;
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem);
  font-weight: 800;
  color: var(--navy);
}

/* Embeddings */
.split {
  display: grid;
  gap: 24px;
  align-items: center;
}
.figure-svg { margin: 0; }
.figure-svg svg { width: 100%; max-width: 440px; margin: 0 auto; }
.figure-svg figcaption {
  margin-top: 8px;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

/* Tiles (search methods) and tools */
.tiles, .tools {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}
.tile, .tool, .phase {
  background: var(--soft);
  border-radius: 10px;
  padding: 18px;
}
.tile h3, .tool h3, .phase h3 {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.15rem;
}
.tile-sub {
  margin: 2px 0 10px !important;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}
.tile p, .tool p { font-size: 0.95em; }
.tool p { margin: 6px 0 0; }
.tool { border-top: 4px solid var(--accent); }

/* RAG phases */
.phases {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}
.phase h3 span {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--muted);
}
.steps { margin: 12px 0 0; }

/* Limits */
.limits { padding-left: 0 !important; list-style: none; }
.limits li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 14px;
}
.limits li::before {
  content: "!";
  position: absolute;
  left: 0;
  top: 2px;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 800;
}

/* Glossary */
.glossary { margin: 0; }
.glossary dt {
  font-family: var(--sans);
  font-weight: 700;
  color: var(--navy);
  margin-top: 12px;
}
.glossary dt:first-child { margin-top: 0; }
.glossary dd { margin: 2px 0 0; }

/* References */
.refs { list-style: none; padding-left: 0 !important; }
.refs li {
  padding-left: 1.5em;
  text-indent: -1.5em;
  overflow-wrap: anywhere;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 40px 0;
  background: var(--navy);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.95rem;
}
.footer a { color: var(--accent-soft); overflow-wrap: anywhere; }
.footer-names {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
.footer-small {
  margin: 14px 0;
  font-size: 0.8rem;
  opacity: 0.7;
}
.back-top { font-size: 0.85rem; }

/* ---------- Larger screens ---------- */
@media (min-width: 640px) {
  .key-figures { grid-template-columns: repeat(3, 1fr); }
  .tools { grid-template-columns: repeat(2, 1fr); }
  .chart-scroll { overflow-x: visible; }
  .chart { min-width: 0; gap: 10px; }
}

@media (min-width: 860px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .phases { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 3fr 2fr; }
  .tools { grid-template-columns: repeat(3, 1fr); }
  .glossary {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 10px 24px;
  }
  .glossary dt, .glossary dd { margin: 0; }
}

/* centre the nav links without making the first ones unreachable when it overflows */
.nav a:first-child { margin-left: auto; }
.nav a:last-child { margin-right: auto; }

@media (min-width: 1100px) {
  .tools { grid-template-columns: repeat(4, 1fr); }
}

/* Landscape phones: keep the hero short so the poster is visible quickly */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { padding: 28px 0; }
  .hero-intro { margin: 16px auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}
