:root {
  --bg: #070708;
  --bg-2: #111214;
  --bg-3: #1a1c1f;
  --text: #eef1f7;
  --muted: #c2c6cd;
  --dim: #8f949c;
  --cyan: #b4c3d3;
  --violet: #8d949e;
  --pink: #eef1f5;
  --radius: 22px;
  --max: 1180px;
  --head: "Pragmatica", "pragmatica", "pragmatica-web", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img, canvas { display: block; }
::selection { background: #c9d1db; color: #06070b; }

h1, h2, h3, .logo, .stat-num, .big {
  font-family: var(--head);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.05;
}
h1 { font-size: clamp(2.6rem, 7vw, 6rem); }
h2 { font-size: clamp(2rem, 4.2vw, 3.4rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); letter-spacing: -0.03em; line-height: 1.2; }
p { color: var(--muted); max-width: 62ch; }
p + p { margin-top: 1em; }
strong { color: var(--text); font-weight: 600; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
/* Polished 3D chrome: hard horizon line, specular sweep, stacked extrusion */
.grad {
  display: inline-block;
  padding: 0 0.04em 0.1em;
  margin: 0 -0.04em -0.1em;
  background:
    linear-gradient(105deg, transparent 42%, rgba(255,255,255,0.95) 50%, transparent 58%),
    linear-gradient(180deg, #ffffff 0%, #f3f6f9 16%, #c9d1db 36%, #7d8692 47%, #2b2f35 50%, #3d434b 53%, #9aa4b0 64%, #e9eef3 82%, #ffffff 100%);
  background-size: 260% 100%, 100% 100%;
  background-position: 160% 0, 0 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter:
    drop-shadow(0 -1px 0 rgba(255,255,255,0.55))
    drop-shadow(0 1px 0 #6b737e)
    drop-shadow(0 1px 0 #454a52)
    drop-shadow(0 1px 0 #2e3237)
    drop-shadow(0 1px 0 #1d2024)
    drop-shadow(0 12px 14px rgba(0,0,0,0.75));
  animation: shine 7s ease-in-out infinite;
}
@keyframes shine {
  0%, 62% { background-position: 160% 0, 0 0; }
  100% { background-position: -60% 0, 0 0; }
}

/* Header */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  background: rgba(6, 7, 11, 0.6);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 20px; }
.logo { font-size: 1.2rem; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.logo-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(160deg, #ffffff 0%, #e6ebf0 22%, #8d96a1 46%, #2b2f35 52%, #6f7883 64%, #e9eef3 86%, #ffffff 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 rgba(0,0,0,0.55), 0 1px 0 #50565e, 0 2px 0 #2b2f35, 0 6px 14px rgba(0,0,0,0.7);
}
.nav { display: flex; gap: 6px; }
.nav a {
  font-family: var(--head); font-size: 0.95rem; color: var(--muted);
  padding: 8px 14px; border-radius: 999px; transition: color .2s, background .2s;
}
.nav a:hover { color: var(--text); background: var(--bg-3); }
.nav a.active { color: var(--text); background: var(--bg-3); }

main { padding-top: 72px; }
section { padding: 110px 0; }

/* Home hero */
.hero { padding: 80px 0 40px; }
.hero h1 { max-width: 13ch; }
.hero p { font-size: 1.2rem; margin-top: 26px; max-width: 52ch; }

.window {
  position: relative; margin-top: 56px;
  height: min(68vh, 640px); min-height: 380px;
  border-radius: 28px; overflow: hidden;
  background: #04050a;
  box-shadow: 0 40px 120px -40px rgba(180, 195, 211, 0.18), 0 0 0 1px rgba(255,255,255,0.03) inset;
  cursor: crosshair; touch-action: pan-y;
}
.window canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.window .fog, .window .hud, .window .cta-layer { pointer-events: none; }
.window::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2; border-radius: inherit;
  background: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), inset 0 0 80px rgba(0,0,0,0.45);
}
.window-caption {
  position: absolute; left: 28px; bottom: 24px; z-index: 3; pointer-events: none;
  font-family: var(--head); font-size: 1.05rem; color: rgba(255,255,255,0.85);
  mix-blend-mode: screen; transition: opacity .8s;
}
.hint { margin-top: 18px; color: var(--dim); font-size: 0.95rem; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stat { padding: 34px 28px; background: var(--bg-2); border-radius: var(--radius); }
.stat-num { font-size: clamp(2.4rem, 4.5vw, 3.6rem); }
.stat p { margin-top: 10px; font-size: 0.98rem; }

.statement { font-family: var(--head); font-size: clamp(1.6rem, 3.4vw, 2.6rem); line-height: 1.25; letter-spacing: -0.02em; max-width: 26ch; color: var(--text); }
.statement span { color: var(--dim); }

/* Doorways */
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 56px; }
.door {
  position: relative; overflow: hidden;
  padding: 40px 32px 34px; min-height: 300px;
  display: flex; flex-direction: column; justify-content: flex-end;
  background: var(--bg-2); border-radius: var(--radius);
  transition: transform .35s ease, background .35s;
}
.door::before {
  content: ""; position: absolute; width: 340px; height: 340px; border-radius: 50%;
  top: -120px; right: -120px; filter: blur(50px); opacity: .14; transition: opacity .35s, transform .5s;
}
.door:nth-child(1)::before { background: var(--cyan); }
.door:nth-child(2)::before { background: var(--violet); }
.door:nth-child(3)::before { background: var(--pink); }
.door:hover { transform: translateY(-6px); background: var(--bg-3); }
.door:hover::before { opacity: .35; transform: scale(1.15); }
.door h3 { font-size: 1.8rem; position: relative; }
.door p { position: relative; margin-top: 12px; font-size: 0.98rem; }
.arrow { position: relative; margin-top: 22px; font-family: var(--head); color: var(--text); }

/* Generic page hero */
.page-hero { padding: 100px 0 40px; }
.page-hero p { font-size: 1.2rem; margin-top: 24px; }

/* Learn layout */
.learn { display: grid; grid-template-columns: 220px 1fr; gap: 64px; padding-top: 40px; }
.toc { position: sticky; top: 110px; align-self: start; display: flex; flex-direction: column; gap: 4px; }
.toc a { color: var(--dim); font-family: var(--head); font-size: 0.98rem; padding: 6px 0; transition: color .2s, transform .2s; }
.toc a:hover, .toc a.on { color: var(--text); transform: translateX(4px); }
.topic { padding: 0 0 120px; scroll-margin-top: 110px; }
.topic h2 { margin-bottom: 28px; }
.topic h3 { margin: 40px 0 12px; }
.figure-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 36px 0; }
.figure { background: var(--bg-2); border-radius: 18px; padding: 26px 24px; }
.figure .big { font-size: 2.4rem; }
.figure p { font-size: 0.92rem; margin-top: 8px; }
sup a { color: var(--cyan); font-size: 0.7em; padding: 0 1px; }

.meter { margin: 34px 0 10px; height: 14px; border-radius: 999px; background: var(--bg-3); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(180deg, #ffffff 0%, #dfe5ec 38%, #5d6570 50%, #9aa4b0 62%, #f4f6f8 100%); box-shadow: inset 0 1px 0 #fff, 0 0 12px rgba(220,230,240,0.35); transition: width 1.6s cubic-bezier(.2,.8,.2,1); }
.meter-label { font-size: 0.92rem; color: var(--dim); }

.dots-wrap { margin: 36px 0 10px; background: var(--bg-2); border-radius: 18px; padding: 22px; }
#dots { width: 100%; height: auto; aspect-ratio: 2 / 1; }

/* News */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 40px; }
.filters button {
  font: 500 0.95rem var(--head); color: var(--muted); background: var(--bg-2);
  border: 0; border-radius: 999px; padding: 10px 18px; cursor: pointer; transition: all .2s;
}
.filters button:hover { color: var(--text); }
.filters button.on { color: #0b0c0e; }
.news-list { display: flex; flex-direction: column; gap: 14px; padding-top: 40px; }
.story {
  display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center;
  background: var(--bg-2); border-radius: var(--radius); padding: 34px 34px;
  transition: background .25s, transform .25s;
}
.story:hover { background: var(--bg-3); transform: translateX(6px); }
.story h3 { font-size: 1.45rem; }
.story p { margin-top: 10px; font-size: 0.98rem; }
.story .meta { margin-top: 16px; font-size: 0.88rem; color: var(--dim); }
.story .meta b { font-weight: 500; }
.story .num { font-family: var(--head); font-size: 2.6rem; letter-spacing: -0.03em; text-align: right; white-space: nowrap; }
.story.hide, .term.hide { display: none; }
.t-power { color: var(--cyan); }
.t-water { color: #d6dde5; }
.t-economy { color: #a7afba; }
.t-community { color: #ffffff; }

/* Resources */
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.res-block { background: var(--bg-2); border-radius: var(--radius); padding: 34px; }
.res-block h3 { margin-bottom: 18px; }
.res-block ol { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.res-block li { color: var(--muted); font-size: 0.95rem; line-height: 1.5; scroll-margin-top: 110px; padding: 6px 10px; margin: -6px -10px; border-radius: 10px; transition: background .4s; }
.res-block li:target { background: rgba(180, 195, 211, 0.14); }
.res-block li b { color: var(--text); font-weight: 500; }
.res-block li .n { display: inline-block; min-width: 28px; color: var(--cyan); font-family: var(--head); }
.res-block a { color: var(--text); text-decoration: underline; text-decoration-color: var(--dim); text-underline-offset: 3px; }
.glossary { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 40px; }
.term { background: var(--bg-2); border-radius: 18px; padding: 26px; }
.term h3 { font-size: 1.2rem; margin-bottom: 8px; }
.term p { font-size: 0.95rem; }

/* CTA + footer */
.cta { text-align: left; }
.btn, .filters button.on {
  background: linear-gradient(180deg, #ffffff 0%, #eef2f5 40%, #a9b2bd 50%, #c9d1da 62%, #f7f9fb 100%) !important;
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(0,0,0,0.28), 0 1px 0 #6b737e, 0 2px 0 #3a3f46, 0 3px 0 #23262a, 0 12px 26px rgba(0,0,0,0.6);
  text-shadow: 0 1px 0 rgba(255,255,255,0.7);
}
.btn {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 34px;
  font: 600 1rem var(--head); color: #0b0c0e;
  padding: 15px 26px; border-radius: 999px; transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); }

.site-footer { padding: 70px 0 50px; background: var(--bg-2); margin-top: 40px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; align-items: flex-end; }
.site-footer p { font-size: 0.92rem; color: var(--dim); }
.foot-tag { font-family: var(--head); font-size: 1.5rem; letter-spacing: -0.02em; color: var(--text); margin-top: 14px; }
.foot-nav { display: flex; gap: 22px; flex-wrap: wrap; }
.foot-nav a { color: var(--muted); font-family: var(--head); }
.foot-nav a:hover { color: var(--text); }

/* Reveal */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s ease, transform .9s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .doors { grid-template-columns: 1fr; }
  .door { min-height: 220px; }
  .learn { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .res-grid { grid-template-columns: 1fr; }
  .story { grid-template-columns: 1fr; }
  .story .num { text-align: left; order: -1; font-size: 2rem; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  section { padding: 80px 0; }
  .stats { grid-template-columns: 1fr; }
  .window { height: 56vh; border-radius: 20px; }
  .story, .res-block { padding: 26px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* Glossary */
.g-search {
  display: block; width: 100%; max-width: 520px; margin-top: 40px;
  font: 400 1.05rem var(--body); color: var(--text);
  background: var(--bg-2); border: 0; outline: none; border-radius: 999px; padding: 16px 24px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.g-search::placeholder { color: var(--dim); }
.g-search:focus { background: var(--bg-3); box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 2px rgba(200,210,222,0.35); }
.filters + .glossary, .page-hero .filters { margin-top: 18px; }
.term { display: flex; flex-direction: column; }
.term p { flex: 1; }
.term-cat { margin-top: 16px; font-size: 0.82rem; color: var(--dim); }
.g-empty { margin-top: 30px; }

/* 3D models */
.model {
  position: relative; height: 560px; margin-top: 40px; border-radius: 28px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 35%, #1d1f23 0%, #0d0e10 60%, #08090a 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 40px 100px -40px rgba(0,0,0,0.9);
  cursor: grab; touch-action: pan-y;
}
.model:active { cursor: grabbing; }
.model canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; }
.model.sm { height: 440px; }
.model-tip {
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; max-width: 250px;
  padding: 14px 16px; border-radius: 14px; font-size: 0.88rem; line-height: 1.45; color: var(--muted);
  background: rgba(14, 15, 17, 0.82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 12px 30px rgba(0,0,0,0.5);
  opacity: 0; transition: opacity .2s;
}
.model-tip.on { opacity: 1; }
.model-tip b { display: block; color: var(--text); font-family: var(--head); font-weight: 500; font-size: 1rem; margin-bottom: 4px; letter-spacing: -0.02em; }
.model-label {
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; white-space: nowrap;
  font-size: 0.85rem; color: var(--text); padding: 6px 12px; border-radius: 999px;
  background: rgba(14, 15, 17, 0.72); box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}
.model-failed { display: none; }
@media (max-width: 600px) { .model { height: 420px; } .model.sm { height: 360px; } }
.g-search::-webkit-search-cancel-button { filter: grayscale(1) brightness(1.6); cursor: pointer; }

/* Facts hidden behind the fog */
.facts {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(200,210,222,0.10), transparent 60%),
    radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1.4px) 0 0 / 22px 22px,
    #050506;
}
.fact {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 10%; opacity: 0; visibility: hidden; transition: opacity .6s, visibility 0s .6s;
}
.fact.on { opacity: 1; visibility: visible; transition: opacity .6s; }
.fact-num { font-family: var(--head); font-weight: 500; letter-spacing: -0.045em; line-height: 1; font-size: clamp(4rem, 13vw, 10rem); }
.fact p { margin-top: 18px; font-size: clamp(1.05rem, 1.8vw, 1.35rem); color: var(--text); max-width: 34ch; }
.fact a {
  margin-top: 26px; font-family: var(--head); font-weight: 500; color: var(--text);
  padding: 10px 20px; border-radius: 999px; background: rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18); transition: background .2s;
}
.fact a:hover { background: rgba(255,255,255,0.16); }
.window canvas.fog, .window canvas.cta-layer, .window canvas.hud { z-index: 1; }
.window { cursor: pointer; }
.window .fact a { cursor: pointer; }

/* Hamburger menu */
.nav-toggle {
  display: none; position: relative; width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: var(--bg-3); cursor: pointer; flex: none;
}
.nav-toggle span {
  position: absolute; left: 12px; right: 12px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, #ffffff, #b9c2cc); transition: transform .3s, opacity .2s, top .3s;
}
.nav-toggle span:nth-child(1) { top: 15px; }
.nav-toggle span:nth-child(2) { top: 21px; }
.nav-toggle span:nth-child(3) { top: 27px; }
.menu-open .nav-toggle span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
.menu-open .nav-toggle span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

@media (max-width: 820px) {
  .site-header .wrap { height: 64px; }
  main { padding-top: 64px; }
  .nav-toggle { display: block; }
  .nav {
    position: absolute; top: 64px; left: 0; right: 0; height: calc(100vh - 64px); height: calc(100dvh - 64px); flex-direction: column; gap: 4px;
    padding: 12px 16px 24px; background: #070708;
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .25s, transform .25s, visibility 0s .25s;
  }
  .site-header.menu-open { background: #070708; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .menu-open .nav { opacity: 1; visibility: visible; transform: none; transition: opacity .25s, transform .25s; }
  .nav a { font-size: 1.25rem; padding: 14px 16px; border-radius: 14px; }
  body.menu-lock { overflow: hidden; }
}

/* Small-screen polish */
@media (max-width: 600px) {
  h1 { font-size: clamp(2.4rem, 11vw, 3.4rem); }
  h2 { font-size: clamp(1.8rem, 8vw, 2.4rem); }
  .hero { padding: 48px 0 24px; }
  .hero p, .page-hero p { font-size: 1.05rem; }
  .page-hero { padding: 56px 0 24px; }
  .window { margin-top: 36px; height: 70vh; min-height: 420px; max-height: 560px; }
  .fact { padding: 32px 22px; }
  .fact-num { font-size: clamp(3.4rem, 18vw, 5rem); }
  .fact p { font-size: 1rem; }
  .statement { font-size: 1.5rem; }
  .stat { padding: 26px 22px; }
  .door { padding: 30px 24px; min-height: 0; }
  .door h3 { font-size: 1.5rem; }
  .topic { padding-bottom: 80px; }
  .figure-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .figure { padding: 20px 16px; }
  .figure .big { font-size: 1.7rem; }
  .story .num { font-size: 1.8rem; }
  .story h3 { font-size: 1.2rem; }
  .filters { gap: 6px; }
  .filters button { padding: 9px 14px; font-size: 0.9rem; }
  .res-block { padding: 24px 20px; }
  .site-footer .wrap { flex-direction: column; align-items: flex-start; }
  .model-label { font-size: 0.72rem; padding: 4px 9px; }
  .model-tip { max-width: 210px; }
}
