/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:   #1a1a2e;
  --red:    #c4162a;
  --blue:   #0f3460;
  --gold:   #f5a623;
  --bg:     #f7f6f3;
  --white:  #ffffff;
  --border: #ddd;
  --text:   #222;
  --muted:  #666;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.10);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

h1, h2, h3 { font-family: Georgia, serif; line-height: 1.2; }
a { color: var(--blue); }

/* ── Loading overlay ──────────────────────────────────────────────────────── */
#loading-overlay {
  position: fixed; inset: 0;
  background: var(--navy);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 100;
  transition: opacity 0.6s, pointer-events 0s 0.6s;
}
#loading-overlay.done { opacity: 0; pointer-events: none; }

#load-status {
  color: #ccc;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.progress-track {
  width: 320px; height: 6px;
  background: #333; border-radius: 3px; overflow: hidden;
}
#progress-bar {
  height: 100%;
  background: var(--red);
  width: 0%;
  transition: width 0.3s ease;
}

/* ── Top bar ──────────────────────────────────────────────────────────────── */
header {
  background: var(--navy);
  color: #fff;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header h1 { font-size: 1.2rem; font-weight: normal; letter-spacing: 0.02em; line-height: 1; }
header h1 span { color: var(--gold); }

.byline {
  font-size: 0.8rem;
  font-family: sans-serif;
  color: #ccc;
  line-height: 1;
  margin: 0;
}
.byline a { color: #fff; text-decoration: none; }
.byline a:hover { text-decoration: underline; }

/* ── Header layout ────────────────────────────────────────────────────────── */
.hdr-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.header-back,
.header-tutorial {
  font-size: 0.8rem;
  font-family: sans-serif;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.header-back:hover,
.header-tutorial:hover { text-decoration: underline; }

/* ── Explainer ────────────────────────────────────────────────────────────── */
#explainer {
  max-width: 780px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}

.slide-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 2.5rem;
}
.skip-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.82rem;
  font-family: sans-serif;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}
.skip-btn:hover { color: #64748b; }

.slide-card h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--navy);
}
.slide-card p {
  font-size: 1rem;
  line-height: 1.7;
  color: #444;
  margin-bottom: 1.25rem;
}

#slide-viz { width: 100%; margin: 1rem 0; }

.slide-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}
.slide-nav button {
  padding: 0.5rem 1.4rem;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-family: sans-serif;
  font-size: 0.9rem;
  transition: background 0.15s;
}
#btn-prev { background: #eee; color: #555; }
#btn-prev:hover:not(:disabled) { background: #ddd; }
#btn-prev:disabled { opacity: 0.4; cursor: default; }
#btn-next { background: var(--navy); color: #fff; }
#btn-next:hover { background: var(--blue); }

.dots { display: flex; gap: 6px; margin-left: auto; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ccc; transition: background 0.2s;
}
.dot.active { background: var(--navy); }

/* ── Demo section ─────────────────────────────────────────────────────────── */
#demo {
  display: none;
  max-width: 820px;
  margin: 2rem auto;
  padding: 0 1.5rem 4rem;
}

#demo h2 { font-size: 1.4rem; margin-bottom: 0.4rem; color: var(--navy); }
#demo .subtitle { font-size: 0.95rem; color: var(--muted); margin-bottom: 1.5rem; }

/* Analogy form */
.analogy-form {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.input-row .op {
  font-size: 0.85rem;
  color: var(--muted);
  font-family: sans-serif;
  font-style: italic;
  white-space: nowrap;
  padding: 0 0.2rem;
}

.input-row input {
  font-family: Georgia, serif;
  font-size: 1.1rem;
  border: 2px solid var(--border);
  border-radius: 5px;
  padding: 0.5rem 0.75rem;
  width: 140px;
  outline: none;
  transition: border-color 0.15s;
  color: var(--text);
  background: var(--bg);
}
.input-row input:focus { border-color: var(--navy); }

#compute-btn {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 0.55rem 1.2rem;
  font-size: 1.3rem;
  font-family: Georgia, serif;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s;
  min-width: 2.5rem;
}
#compute-btn:hover:not(:disabled) { background: #c73652; }
#compute-btn:disabled { opacity: 0.4; cursor: default; }

/* Model toggle */
.model-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.model-toggle-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: sans-serif;
}
.model-btn {
  font-size: 0.8rem;
  font-family: sans-serif;
  background: #f0f0f0;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s, border-color 0.1s;
}
.model-btn:hover:not(:disabled):not(.active) { background: #e0e0e0; }
.model-btn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  cursor: default;
}
.model-btn:disabled:not(.active) { opacity: 0.5; cursor: default; }
.model-btn small { opacity: 0.75; font-family: sans-serif; }

/* Examples */
.examples-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  align-items: center;
}
.examples-row .label {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: sans-serif;
  margin-right: 0.25rem;
}
.example-btn {
  font-size: 0.8rem;
  font-family: 'Courier New', monospace;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  color: var(--blue);
  transition: background 0.1s;
}
.example-btn:hover:not(:disabled) { background: #e0e0e0; }
.example-btn:disabled { opacity: 0.4; cursor: default; }

/* Error */
#error-box {
  display: none;
  background: #fdecea;
  border: 1px solid #f5c6c6;
  border-radius: 5px;
  padding: 0.75rem 1rem;
  color: #a00;
  font-family: sans-serif;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Result */
#result-box {
  display: none;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}

#equation-recap {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--navy);
}
#equation-recap .highlight { color: var(--red); }

#result-word {
  font-size: 2.8rem;
  font-weight: bold;
  color: var(--red);
  display: block;
  margin: 0.25rem 0 0.1rem;
}
#result-score {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  display: block;
  margin-bottom: 0.75rem;
}

.also-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: sans-serif;
  margin-bottom: 0.4rem;
}
#result-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.alt-word {
  background: #f0f0f0;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.85rem;
  font-family: sans-serif;
}
.alt-word small { color: var(--muted); }

#bc-similarity {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: sans-serif;
  font-style: italic;
}

/* Visualization */
#viz-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.5rem 1.5rem;
  margin-bottom: 1.5rem;
}
#viz-card h3 { font-size: 0.95rem; color: var(--navy); margin-bottom: 0.25rem; }
#viz-card .viz-note {
  font-size: 0.78rem; color: var(--muted);
  font-style: italic; margin-bottom: 0.5rem;
  font-family: sans-serif;
}
#viz { display: block; width: 100%; }

/* ── Papers footer ────────────────────────────────────────────────────────── */
.papers-section {
  background: var(--navy);
  color: #ccc;
  padding: 2rem 2rem 2.5rem;
  margin-top: 3rem;
}
.papers-section h3 { color: #fff; font-size: 1rem; margin-bottom: 1rem; }
.papers-grid {
  max-width: 820px; margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}
.paper-link {
  background: rgba(255,255,255,0.07);
  border-radius: 5px;
  padding: 0.6rem 0.9rem;
  font-size: 0.8rem;
  font-family: sans-serif;
  line-height: 1.4;
}
.paper-link a { color: #7ecfff; text-decoration: none; }
.paper-link a:hover { text-decoration: underline; }
.paper-link .venue { color: #999; font-style: italic; }

/* ── Site footer ─────────────────────────────────────────────────────────── */
#site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.70);
  font-family: sans-serif;
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 0.65rem 2rem;
  flex-shrink: 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}
.footer-left { flex: 1; }
.footer-right { text-align: right; flex-shrink: 0; }
#site-footer p { margin: 0.1rem 0; }
#site-footer a { color: rgba(255,255,255,0.85); text-decoration: none; }
#site-footer a:hover { text-decoration: underline; }
#site-footer em { font-style: italic; }
@media (max-width: 600px) {
  .footer-inner { flex-direction: column; gap: 0.3rem; }
  .footer-right { text-align: left; }
}
