/* ============================================================
   GCC Tile Venture Study — core stylesheet
   Dark premium theme. Self-contained, no build step.
   ============================================================ */

:root {
  --bg:            #0e1013;
  --bg-2:          #12151a;
  --surface:       #161a20;
  --surface-2:     #1b2028;
  --surface-3:     #212832;
  --border:        #272e39;
  --border-2:      #333c49;

  --text:          #f3f5f8;
  --text-2:        #a8b2c0;
  --text-3:        #737f8f;

  --accent:        #d9a441;
  --accent-2:      #f0c273;
  --accent-dim:    rgba(217, 164, 65, 0.12);

  --good:          #199e70;
  --warn:          #c98500;
  --bad:           #e06666;

  /* validated categorical series (dark surface) */
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s5: #d55181;

  --radius:        14px;
  --radius-sm:     9px;
  --maxw:          1180px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

img { max-width: 100%; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.layout { display: flex; gap: 0; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 16, 19, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent) 0%, #8a6420 100%);
  display: grid; place-items: center; color: #16110a; font-weight: 800; font-size: 13px;
}
.brand-sub { color: var(--text-3); font-weight: 400; font-size: 13px; }

.nav-toggle {
  display: none; background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--text); border-radius: 8px; padding: 7px 12px; font-size: 14px; cursor: pointer;
}

/* ---------- Sidebar nav ---------- */

.sidebar {
  width: 246px; flex: 0 0 246px;
  border-right: 1px solid var(--border);
  padding: 28px 0 60px;
  position: sticky; top: 62px; align-self: flex-start;
  max-height: calc(100vh - 62px); overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

.nav-group { margin-bottom: 22px; }
.nav-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-3); font-weight: 600; padding: 0 22px 8px;
}
.sidebar a {
  display: block; padding: 7px 22px; color: var(--text-2); font-size: 14.5px;
  border-left: 2px solid transparent;
}
.sidebar a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.sidebar a.active {
  color: var(--accent-2); border-left-color: var(--accent);
  background: var(--accent-dim); font-weight: 550;
}
.nav-flag { display: inline-block; width: 22px; }

/* ---------- Main ---------- */

main { flex: 1 1 auto; min-width: 0; padding: 40px 0 100px 44px; }
.sidebar + main { max-width: calc(100% - 246px); }

/* ---------- Typography ---------- */

h1 {
  font-size: 40px; line-height: 1.15; letter-spacing: -0.028em;
  margin: 0 0 14px; font-weight: 700;
}
h2 {
  font-size: 26px; line-height: 1.25; letter-spacing: -0.02em;
  margin: 54px 0 16px; font-weight: 660;
  padding-top: 18px; border-top: 1px solid var(--border);
}
h2:first-of-type { border-top: none; padding-top: 0; }
h3 { font-size: 18.5px; margin: 32px 0 10px; font-weight: 620; letter-spacing: -0.01em; }
h4 { font-size: 15px; margin: 22px 0 8px; font-weight: 620; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }

p { margin: 0 0 15px; color: var(--text-2); }
p strong, li strong { color: var(--text); font-weight: 620; }
ul, ol { color: var(--text-2); padding-left: 20px; margin: 0 0 16px; }
li { margin-bottom: 7px; }

.lede { font-size: 18.5px; line-height: 1.6; color: var(--text-2); margin-bottom: 26px; }
.eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent); font-weight: 650; margin-bottom: 12px;
}

/* ---------- Page header ---------- */

.page-head { margin-bottom: 34px; padding-bottom: 26px; border-bottom: 1px solid var(--border); }

.hero {
  background:
    radial-gradient(900px 340px at 18% -10%, rgba(217,164,65,0.13), transparent 62%),
    linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 46px 42px; margin-bottom: 38px;
}
.hero h1 { font-size: 45px; }

/* ---------- Cards & grids ---------- */

.grid { display: grid; gap: 16px; margin: 22px 0; }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px;
}
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

/* ---------- Stat tiles ---------- */

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
}
.stat-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-3); font-weight: 620; margin-bottom: 9px;
}
.stat-value {
  font-size: 31px; font-weight: 680; letter-spacing: -0.03em;
  line-height: 1.05; color: var(--text); font-variant-numeric: tabular-nums;
}
.stat-value.accent { color: var(--accent-2); }
.stat-value.good { color: var(--good); }
.stat-value.bad { color: var(--bad); }
.stat-note { font-size: 13px; color: var(--text-3); margin-top: 7px; line-height: 1.45; }

/* ---------- Charts ---------- */

.figure {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px 18px; margin: 24px 0;
}
.figure-head { margin-bottom: 4px; }
.figure-title { font-size: 16px; font-weight: 640; letter-spacing: -0.01em; color: var(--text); }
.figure-sub { font-size: 13.5px; color: var(--text-3); margin-top: 3px; line-height: 1.45; }
.chart-box { position: relative; height: 340px; margin-top: 16px; }
.chart-box.tall { height: 430px; }
.chart-box.short { height: 270px; }
.figure-note {
  font-size: 12.5px; color: var(--text-3); margin-top: 14px;
  padding-top: 12px; border-top: 1px solid var(--border); line-height: 1.5;
}

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin: 22px 0; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 520px; }
thead th {
  background: var(--surface-2); color: var(--text-2); text-align: left;
  font-weight: 620; font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em;
  padding: 12px 15px; border-bottom: 1px solid var(--border-2); white-space: nowrap;
}
tbody td { padding: 11px 15px; border-bottom: 1px solid var(--border); color: var(--text-2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 13.5px; }
tbody td.key { color: var(--text); font-weight: 600; }
tr.total td { background: var(--surface-3); color: var(--text); font-weight: 650; border-top: 1px solid var(--border-2); }
tr.sub td { color: var(--text-3); font-size: 13.5px; }

/* ---------- Callouts ---------- */

.callout {
  border-radius: var(--radius); padding: 18px 22px; margin: 22px 0;
  border: 1px solid var(--border); background: var(--surface);
  border-left: 3px solid var(--accent);
}
.callout p:last-child { margin-bottom: 0; }
.callout-title { font-weight: 650; color: var(--text); margin-bottom: 7px; font-size: 15px; }
.callout.warn { border-left-color: var(--warn); }
.callout.bad  { border-left-color: var(--bad); }
.callout.good { border-left-color: var(--good); }

/* ---------- Pills & tags ---------- */

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 620; letter-spacing: 0.01em;
  border: 1px solid var(--border-2); color: var(--text-2); background: var(--surface-2);
}
.pill.good { color: #7fd8b4; border-color: rgba(25,158,112,0.4); background: rgba(25,158,112,0.12); }
.pill.warn { color: #ecc06a; border-color: rgba(201,133,0,0.4);  background: rgba(201,133,0,0.12); }
.pill.bad  { color: #f0a0a0; border-color: rgba(224,102,102,0.4); background: rgba(224,102,102,0.12); }
.pill.blue { color: #8dbcf2; border-color: rgba(57,135,229,0.4); background: rgba(57,135,229,0.12); }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 20px; }

/* ---------- Country header ---------- */

.country-head { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.country-flag { font-size: 46px; line-height: 1; }

/* ---------- Route cards (China / Spain) ---------- */

.route-card {
  border-radius: var(--radius); padding: 24px 26px; border: 1px solid var(--border);
  background: var(--surface);
}
.route-card.china { border-top: 3px solid var(--s2); }
.route-card.spain { border-top: 3px solid var(--s1); }

/* ---------- Waterfall-ish cost list ---------- */

.cost-list { list-style: none; padding: 0; margin: 16px 0; }
.cost-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 14.5px;
}
.cost-list li:last-child { border-bottom: none; }
.cost-list .v { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--text); font-size: 13.5px; }
.cost-list li.tot { border-top: 1px solid var(--border-2); border-bottom: none; margin-top: 6px; padding-top: 12px; }
.cost-list li.tot span { color: var(--accent-2); font-weight: 650; }

/* ---------- Timeline ---------- */

.timeline { border-left: 2px solid var(--border-2); padding-left: 26px; margin: 26px 0; }
.tl-item { position: relative; padding-bottom: 30px; }
.tl-item::before {
  content: ""; position: absolute; left: -33px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg);
}
.tl-phase { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); font-weight: 650; }
.tl-title { font-size: 17px; font-weight: 640; margin: 3px 0 6px; }

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--border); margin-top: 70px; padding: 34px 0 60px;
  color: var(--text-3); font-size: 13.5px;
}
footer .wrap { padding-left: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 16px; }

/* ---------- Page nav (prev / next) ---------- */

.pagenav { display: flex; justify-content: space-between; gap: 14px; margin-top: 56px; }
.pagenav a {
  flex: 1 1 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 18px; color: var(--text-2);
}
.pagenav a:hover { border-color: var(--border-2); background: var(--surface-2); text-decoration: none; }
.pagenav .dir { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.pagenav .t { color: var(--text); font-weight: 620; font-size: 15px; margin-top: 3px; }
.pagenav .next { text-align: right; }

/* ---------- Misc ---------- */

.muted { color: var(--text-3); }
.small { font-size: 13.5px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

.toc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px; margin: 26px 0 34px;
}
.toc ul { columns: 2; column-gap: 32px; margin: 0; padding-left: 18px; }
.toc li { margin-bottom: 5px; break-inside: avoid; }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .layout { display: block; }
  .sidebar {
    display: none; width: 100%; flex-basis: auto; position: static;
    max-height: none; border-right: none; border-bottom: 1px solid var(--border);
    padding: 16px 0 24px;
  }
  .sidebar.open { display: block; }
  main { padding: 28px 0 70px 0; max-width: 100%; }
  .sidebar + main { max-width: 100%; }
  h1 { font-size: 31px; }
  .hero { padding: 30px 22px; }
  .hero h1 { font-size: 32px; }
  h2 { font-size: 22px; margin-top: 42px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .toc ul { columns: 1; }
  .chart-box { height: 300px; }
  .chart-box.tall { height: 380px; }
  .pagenav { flex-direction: column; }
  .pagenav .next { text-align: left; }
  .wrap { padding: 0 16px; }
}

@media print {
  .sidebar, .topbar, .pagenav, .nav-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0; max-width: 100%; }
}
