﻿@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #182230;
  --muted: #5e6b7a;
  --paper: #fbf8f1;
  --panel: #ffffff;
  --blue: #09233f;
  --blue-2: #123a63;
  --gold: #c89b3c;
  --line: #d9d0bd;
  --soft: #eef2f6;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Source Serif 4", Georgia, serif;
  line-height: 1.68;
}
a { color: var(--blue-2); }
.citation {
  white-space: nowrap;
  text-decoration: none;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.9em;
}
.ref-number {
  color: var(--blue-2);
  font-family: Inter, system-ui, sans-serif;
  font-weight: 700;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 3rem);
  background: rgba(9, 35, 63, 0.96);
  color: white;
  font-family: Inter, system-ui, sans-serif;
  border-bottom: 3px solid var(--gold);
}
.brand { color: white; text-decoration: none; font-weight: 700; letter-spacing: 0.08em; }
.top-nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.top-nav a { color: #f8ecd0; text-decoration: none; font-size: 0.95rem; }
.hero {
  min-height: 72vh;
  display: grid;
  align-items: center;
  background: radial-gradient(circle at 70% 30%, rgba(200,155,60,0.16), transparent 28%), linear-gradient(135deg, #06182c, #0d2e4f 55%, #06182c);
  color: white;
  padding: clamp(3rem, 8vw, 7rem) clamp(1rem, 6vw, 5rem);
}
.hero-inner { max-width: 980px; }
.kicker {
  margin: 0 0 0.5rem;
  color: var(--gold);
  font-family: Inter, system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.82rem;
  font-weight: 700;
}
.hero h1 {
  margin: 0;
  font-size: clamp(3rem, 10vw, 8rem);
  line-height: 0.92;
  letter-spacing: 0;
}
.subtitle { font-size: clamp(1.2rem, 2.4vw, 2rem); color: #f3d99a; max-width: 780px; }
.overview { max-width: 820px; font-size: 1.12rem; color: #dfe8f2; }
.hero .overview a { color: #f3d99a; }
.primary-link,
.chapter-card a,
.full-size-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--gold);
  color: var(--blue);
  background: #f6e2ae;
  text-decoration: none;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 700;
  border-radius: 6px;
}
.book-overview, .chapter-grid {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 4vw, 2rem);
}
.book-overview h2 { color: var(--blue); font-size: clamp(1.8rem, 3vw, 2.6rem); margin: 0 0 0.75rem; }
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  padding-top: 0;
}
.chapter-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--gold);
  border-radius: 8px;
  padding: 1.25rem;
  min-height: 230px;
  display: flex;
  flex-direction: column;
}
.chapter-number {
  font-family: Inter, system-ui, sans-serif;
  color: var(--gold);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
}
.chapter-card h3 { color: var(--blue); line-height: 1.18; margin: 0.5rem 0; }
.chapter-card p { color: var(--muted); margin: 0 0 auto; }
.chapter-card a { margin-top: 1rem; width: fit-content; }
.chapter-layout {
  display: grid;
  grid-template-columns: minmax(170px, 250px) minmax(0, 880px);
  gap: clamp(1rem, 4vw, 3rem);
  max-width: 1220px;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 3rem);
}
.chapter-toc {
  position: sticky;
  top: 5rem;
  align-self: start;
  padding: 1rem;
  border-left: 3px solid var(--gold);
  font-family: Inter, system-ui, sans-serif;
}
.chapter-toc p { color: var(--blue); font-weight: 800; margin: 0 0 0.75rem; }
.chapter-toc a { display: block; padding: 0.25rem 0; text-decoration: none; }
.chapter-content {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: clamp(1.2rem, 4vw, 3rem);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(9, 35, 63, 0.08);
}
.breadcrumb {
  font-family: Inter, system-ui, sans-serif;
  display: flex;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.chapter-intro {
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
}
.chapter-intro h1, .chapter-content > h1 {
  color: var(--blue);
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  line-height: 1.05;
}
.chapter-content h2 {
  color: var(--blue);
  border-top: 1px solid var(--line);
  padding-top: 1.6rem;
  margin-top: 2.2rem;
}
.chapter-content h3 {
  color: var(--blue-2);
  margin-top: 1.8rem;
}
.figure-card, .table-card, .technical-details {
  margin: 2rem 0;
  border: 1px solid var(--line);
  background: #fffdf8;
  border-radius: 8px;
  padding: 1rem;
}
.figure-card img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid #e5dfd1;
  background: white;
}
figcaption, .table-caption {
  margin-top: 0.8rem;
  color: #2f3c4a;
  font-size: 0.96rem;
}
.full-size-link { margin-top: 0.75rem; font-size: 0.85rem; }
.legacy-note {
  margin: 0.7rem 0 0;
  color: #755c1d;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.86rem;
}
.model-status {
  margin: 1.5rem 0 2rem;
  padding: 1rem 1.15rem;
  border-left: 4px solid var(--gold);
  background: #fff7e6;
  color: #263545;
  font-size: 1.02rem;
}
.model-status strong {
  color: var(--blue);
  font-family: Inter, system-ui, sans-serif;
}
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 6px;
}
table {
  width: max-content;
  min-width: 100%;
  max-width: none;
  border-collapse: collapse;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.45;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}
th { background: #f4ead5; color: var(--blue); }
tbody tr:last-child td { border-bottom: 0; }
.equation {
  overflow-x: auto;
  margin: 1.4rem 0;
  padding: 0.9rem 1rem;
  border-left: 4px solid var(--gold);
  background: var(--soft);
}
.appendix-table table { min-width: 760px; }
.stage-note, .appendix-note, .equation-number {
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.9rem;
}
.stage-note, .appendix-note {
  color: #405064;
  background: #fffaf0;
  border-left: 3px solid var(--gold);
  padding: 0.7rem 0.85rem;
}
.equation-number {
  color: var(--blue-2);
  font-weight: 700;
  margin-bottom: -0.8rem;
}
.technical-details summary {
  cursor: pointer;
  font-family: Inter, system-ui, sans-serif;
  color: var(--blue);
  font-weight: 700;
}
.figure-jump-list { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.8rem; }
.figure-jump-list a {
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.85rem;
  padding: 0.25rem 0.45rem;
  background: #f4ead5;
  border-radius: 5px;
  text-decoration: none;
}
.chapter-bottom-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  font-family: Inter, system-ui, sans-serif;
}
@media (max-width: 900px) {
  .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chapter-layout { grid-template-columns: 1fr; }
  .chapter-toc { position: static; border-left: 0; border-top: 3px solid var(--gold); }
}
@media (max-width: 620px) {
  .site-header { align-items: flex-start; flex-direction: column; }
  .chapter-grid { grid-template-columns: 1fr; }
  .chapter-content { padding: 1rem; }
  .chapter-bottom-nav { flex-direction: column; }
  .table-card { padding: 0.75rem; }
  table { font-size: 0.82rem; }
  th, td { padding: 0.55rem; }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.85rem;
}
.hero-links-note {
  margin: 0.85rem 0 0;
  max-width: 840px;
  color: #dfe8f2;
}

.resource-grid {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem) clamp(2rem, 5vw, 4rem);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.fdg-ai-section {
  padding-top: clamp(1.2rem, 3vw, 2rem);
}

.chatbot-frame-wrap {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(9, 35, 63, 0.08);
}

.chatbot-frame {
  display: block;
  width: 100%;
  height: 720px;
  border: 0;
  background: #ffffff;
}

.guide-callout {
  margin: 1.2rem 0 2rem;
  padding: 0.9rem 1rem;
  border-left: 4px solid var(--gold);
  background: #fffaf0;
  color: #263545;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.55;
}

.guide-callout strong {
  color: var(--blue);
}

@media (max-width: 620px) {
  .resource-grid {
    grid-template-columns: 1fr;
  }
}
