:root {
  --blue: #003b71;
  --blue-2: #0057a8;
  --blue-3: #eaf4ff;
  --navy: #001f3f;
  --cyan: #00a6d6;
  --red: #c8102e;
  --green: #14845c;
  --gold: #f2a20c;
  --purple: #6046a6;
  --ink: #182331;
  --muted: #5e6b79;
  --surface: #f5f8fb;
  --border: #d8e5f0;
  --shadow: 0 12px 34px rgba(0, 42, 82, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 150px; }
body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.62;
}
a { color: var(--blue-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 999;
  padding: 10px 14px; border-radius: 8px; color: #fff; background: var(--red);
}
.skip-link:focus { top: 12px; }

.app { display: block; min-height: 100vh; }
.site-header {
  position: sticky; top: 0; z-index: 30; color: #fff; background:
    radial-gradient(circle at 20% 0, rgba(0, 166, 214, .3), transparent 34%),
    linear-gradient(180deg, var(--blue), var(--navy));
  box-shadow: 0 8px 24px rgba(0, 31, 63, .18);
}
.header-main {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  width: min(1440px, 100%); margin: 0 auto; padding: 17px 30px 13px;
}
.brand {
  display: block; flex: 0 0 auto; color: #fff; font-size: 1.55rem;
  font-weight: 800; line-height: 1.05; letter-spacing: -.03em;
}
.brand:hover { text-decoration: none; }
.brand > span { margin-right: 3px; color: #91ddf4; }
.brand small {
  display: block; max-width: 430px; margin-top: 5px; color: #c9e3f6;
  font-size: .74rem; font-weight: 400; line-height: 1.35; letter-spacing: 0;
}
.top-nav {
  display: flex; flex-wrap: wrap; gap: 3px 4px;
  width: min(1440px, 100%); margin: 0 auto; padding: 0 24px 10px;
  overflow: visible; white-space: normal;
}
.top-nav a {
  display: block; flex: 0 0 auto; padding: 6px 8px; border-radius: 9px;
  color: #eaf6ff; font-size: .78rem; white-space: nowrap;
}
.top-nav a:hover, .top-nav a.active {
  color: #fff; background: rgba(255, 255, 255, .13); text-decoration: none;
}
.top-nav a.active { box-shadow: inset 0 -3px 0 var(--cyan); }

.main { width: 100%; margin-left: 0; }
.search { width: min(520px, 48%); }
.search input, .filter-input, .search-row input {
  width: 100%; padding: 12px 16px; border: 1px solid var(--border);
  border-radius: 999px; background: #fff; color: var(--ink); font: inherit;
  outline: none;
}
.search input:focus, .filter-input:focus, .search-row input:focus {
  border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(0, 87, 168, .12);
}
.reading-progress {
  position: fixed; top: 0; right: 0; left: 0; z-index: 40;
  height: 3px; pointer-events: none;
}
.reading-progress span { display: block; width: 0; height: 100%; background: var(--cyan); }

.content { width: min(1240px, 100%); margin: 0 auto; padding: 24px 30px 84px; }
.hero {
  margin-bottom: 24px; padding: 24px 0 26px;
  border-bottom: 1px solid var(--border); color: var(--ink); background: transparent;
}
.hero h1 {
  max-width: 980px; margin: 10px 0 10px; color: var(--blue);
  font-size: clamp(2rem, 3.2vw, 3.05rem); line-height: 1.08; letter-spacing: -.035em;
}
.hero p { max-width: 900px; margin: 0; color: var(--muted); font-size: 1.04rem; }
.badge {
  display: inline-flex; padding: 5px 10px; border: 1px solid #bdd6f3;
  border-radius: 999px; color: var(--blue); background: var(--blue-3);
  font-size: .78rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 17px; border: 0; border-radius: 999px; color: #fff !important;
  background: var(--blue); font: inherit; font-weight: 700; cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.light { color: #fff !important; background: var(--blue); }
.btn.ghost { border: 1px solid var(--blue); color: var(--blue) !important; background: transparent; }
.btn.secondary { border: 1px solid var(--blue); color: var(--blue) !important; background: #fff; }

.section-heading {
  display: flex; align-items: end; justify-content: space-between; gap: 20px;
  margin: 46px 0 16px; border-bottom: 3px solid var(--blue-3); padding-bottom: 12px;
}
.section-heading h2 { margin: 2px 0 0; color: var(--blue); font-size: 1.9rem; }
.eyebrow { color: var(--blue-2); font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.section-title {
  margin-top: 44px; padding-bottom: 9px; border-bottom: 3px solid var(--blue-3);
  color: var(--blue); line-height: 1.2;
}

.grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 17px; margin: 20px 0;
}
.card {
  padding: 21px; border: 1px solid var(--border); border-radius: 19px;
  background: #fff; box-shadow: 0 8px 24px rgba(0, 42, 82, .07);
}
.card-link { display: flex; min-height: 210px; flex-direction: column; color: var(--ink); }
.card-link:hover {
  border-color: #9fc5e7; box-shadow: var(--shadow); text-decoration: none;
  transform: translateY(-2px);
}
.card-heading { display: flex; align-items: flex-start; gap: 13px; }
.card h3 { margin: 0; color: var(--blue); font-size: 1.1rem; line-height: 1.25; }
.card p { color: var(--muted); font-size: .92rem; }
.card-action { margin-top: auto; color: var(--blue-2); font-size: .88rem; font-weight: 700; }
.module-num {
  display: inline-grid; flex: 0 0 44px; width: 44px; height: 44px; place-items: center;
  border-radius: 13px; color: #fff; background: var(--blue); font-weight: 800;
}
.meta { color: var(--muted); font-size: .75rem; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: .86rem; }
.legend span { display: flex; align-items: center; gap: 7px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }
.dot.transversal { background: var(--purple); }

.mini-toc {
  margin: 22px 0; padding: 0 20px; border: 1px solid var(--border);
  border-radius: 18px; background: var(--surface);
}
.mini-toc summary { padding: 16px 0; color: var(--blue); font-weight: 800; cursor: pointer; }
.mini-toc a {
  display: block; padding: 8px 0; border-top: 1px dashed #cddce9; font-size: .9rem;
}
.mini-toc a:last-child { padding-bottom: 16px; }
.prose { max-width: 1040px; }
.prose p { margin: 10px 0 14px; font-size: 1.01rem; }
.prose h2 { font-size: 1.75rem; }
.prose h3 { margin: 28px 0 8px; color: var(--blue); font-size: 1.25rem; line-height: 1.25; }
.prose h4 { margin: 22px 0 7px; color: #314154; font-size: 1.04rem; }
.prose code { padding: 2px 6px; border: 1px solid #dbe5ee; border-radius: 6px; background: #f3f6f9; }
.term {
  border-bottom: 1px dotted var(--cyan); color: var(--blue-2); font-weight: 600;
}
.list { margin: 10px 0 20px; padding: 0; list-style: none; }
.list li { position: relative; margin: 5px 0; padding: 4px 0 4px 26px; }
.list li::before { position: absolute; left: 7px; content: "•"; color: var(--blue-2); font-size: 1.3rem; line-height: 1.1; }
.steps { margin: 12px 0 22px; padding: 0; list-style: none; counter-reset: item; }
.steps li {
  position: relative; margin: 8px 0; padding: 11px 14px 11px 52px;
  border: 1px solid var(--border); border-radius: 12px; background: #fff; counter-increment: item;
}
.steps li::before {
  position: absolute; left: 13px; top: 10px; display: grid; width: 27px; height: 27px;
  place-items: center; border-radius: 50%; content: counter(item); color: #fff;
  background: var(--blue); font-size: .76rem; font-weight: 800;
}
.table-wrap { max-width: 100%; margin: 20px 0 28px; overflow-x: auto; border-radius: 16px; box-shadow: var(--shadow); }
.table { width: 100%; min-width: 620px; border-collapse: collapse; background: #fff; font-size: .91rem; }
.table th { color: #fff; background: var(--blue); text-align: left; }
.table th, .table td { padding: 11px 13px; border: 1px solid var(--border); vertical-align: top; }
.table tr:nth-child(even) td { background: #f8fbfe; }
.formula {
  margin: 16px 0; padding: 16px 18px; overflow-x: auto; border-left: 5px solid var(--cyan);
  border-radius: 10px; color: var(--navy); background: var(--blue-3);
  font-family: "Courier New", monospace; font-weight: 700;
}
.box { margin: 18px 0; padding: 16px 18px; border-left: 5px solid var(--blue-2); border-radius: 12px; background: var(--blue-3); }
.box.practice { border-color: var(--green); background: #effaf5; }
.document-context { margin-top: 50px; }
.document-context > h2 { color: var(--blue); }
.context-list { display: grid; gap: 10px; }
.source-context {
  display: block; padding: 15px 17px; border: 1px solid var(--border);
  border-radius: 14px; color: var(--ink); background: #fff;
}
.source-context:hover { border-color: #9fc5e7; text-decoration: none; }
.source-context span { color: var(--blue-2); font-size: .77rem; font-weight: 800; text-transform: uppercase; }
.source-context p { margin: 5px 0 0; color: var(--muted); font-size: .91rem; }
.page-end { margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--border); text-align: right; }
.source-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  margin-top: 48px; padding: 28px; border: 1px solid #b9d3e9; border-radius: 22px; background: var(--blue-3);
}
.source-banner h2 { margin: 4px 0; color: var(--blue); }
.source-banner p { max-width: 780px; margin: 0; color: var(--muted); }
.source-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.overview-visual { margin: 28px 0 44px; }
.overview-figure {
  margin: 0; padding: 10px; border: 1px solid var(--border);
  border-radius: 18px; background: #fff; box-shadow: 0 10px 28px rgba(0, 42, 82, .08);
}
.overview-figure a { display: block; }
.overview-figure img {
  display: block; width: 100%; height: auto; border-radius: 11px;
}
.overview-figure figcaption {
  padding: 10px 6px 2px; color: var(--muted); font-size: .84rem; text-align: center;
}

.index-tools { max-width: 520px; margin: 24px 0; }
.index-tools label, .search-panel > label { display: block; margin-bottom: 7px; color: var(--blue); font-weight: 800; }
.lexicon-grid .card[hidden] { display: none; }
.search-panel { padding: 24px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.search-row { display: flex; gap: 10px; }
.search-row input { border-radius: 13px; }
.search-meta { margin: 18px 0 8px; color: var(--muted); }
.search-result {
  display: block; margin: 10px 0; padding: 16px 18px; border: 1px solid var(--border);
  border-radius: 14px; color: var(--ink); background: #fff;
}
.search-result:hover { border-color: #91badf; text-decoration: none; }
.search-result strong { color: var(--blue); }
.search-result p { margin: 5px 0 0; color: var(--muted); font-size: .9rem; }
.search-result .result-type { margin-left: 8px; color: var(--blue-2); font-size: .75rem; font-weight: 800; text-transform: uppercase; }

.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; counter-reset: flow; }
.flow-node {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 92px;
  padding: 14px; border: 1px solid var(--border); border-radius: 16px; color: var(--ink); background: #fff;
}
.flow-node:not(:nth-child(4n))::after { position: absolute; right: -11px; content: "→"; color: var(--cyan); font-weight: 800; }
.flow-node:hover { border-color: var(--cyan); text-decoration: none; }
.flow-node b { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: #fff; background: var(--blue); }
.flow-node span { font-size: .88rem; font-weight: 700; line-height: 1.25; }
.layers { display: grid; gap: 9px; }
.layer {
  display: flex; align-items: center; gap: 14px; padding: 13px 18px;
  border-left: 6px solid var(--purple); border-radius: 10px; color: var(--ink); background: #f5f2ff;
}
.layer:hover { text-decoration: none; transform: translateX(3px); }
.layer b { color: var(--purple); }
.dimension-cloud { display: flex; gap: 9px; flex-wrap: wrap; }
.dimension-chip { padding: 9px 13px; border: 1px solid #cbdbea; border-radius: 999px; background: #fff; }
.dimension-chip:hover { color: #fff; background: var(--blue); text-decoration: none; }

.footer { padding: 28px 32px; border-top: 1px solid var(--border); color: var(--muted); background: #f8fafc; font-size: .86rem; }

@media (max-width: 1000px) {
  .flow { grid-template-columns: repeat(2, 1fr); }
  .flow-node:not(:nth-child(4n))::after { display: none; }
}
@media (max-width: 850px) {
  .header-main { align-items: stretch; flex-direction: column; gap: 12px; padding: 15px 18px 12px; }
  .search { width: 100%; max-width: none; }
  .top-nav { padding: 0 14px 10px; }
  .hero { padding: 20px 0 22px; }
  .content { padding: 24px 18px 64px; }
  .source-banner { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 560px) {
  .flow { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.15rem; }
  .hero p { font-size: 1rem; }
  .search-row { align-items: stretch; flex-direction: column; }
  .section-heading { align-items: flex-start; flex-direction: column; }
}

@media print {
  .site-header, .reading-progress, .mini-toc, .page-end { display: none !important; }
  .main { width: 100%; margin: 0; }
  .content { max-width: none; padding: 0; }
  .hero { color: var(--ink); background: none; box-shadow: none; border: 1px solid var(--border); }
  .hero h1, .hero p, .hero .badge { color: var(--ink); }
  a { color: inherit; text-decoration: none; }
  .table-wrap { overflow: visible; box-shadow: none; }
}