@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400;1,700&family=JetBrains+Mono:wght@400;600;700&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,300&display=swap');

:root {
  --bg-color: #0b0c10;
  --panel-bg: #15161a;
  --panel-border: #2a2b30;
  --text-main: #e2e2e2;
  --mid-text: #8c8c9a;
  --orange: #e8570a;
  --orange-glow: rgba(232, 87, 10, 0.2);
  --red-vivid: #ff2a2a;
  --amber: #fca311;
  --teal: #4db6ac;
  --cream: #f2e9e4;
}

html {
  scroll-behavior: smooth;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: 'Playfair Display', serif;
  color: var(--cream);
  font-weight: 700;
  margin-bottom: 1rem;
}

a { color: var(--orange); text-decoration: none; transition: 0.2s; }
a:hover { color: var(--red-vivid); text-decoration: underline; }

header {
  position: relative;
  height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  border-bottom: 1px solid var(--panel-border);
}

.header-logo {
  width: 300px;
  max-width: 80vw;
  height: auto;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 25px rgba(255, 165, 0, 0.15));
}
.header-logo svg { width: 100%; height: auto; display: block; }

.header-bg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at center, var(--panel-bg) 0%, var(--bg-color) 70%);
  z-index: -2;
}

.header-ticker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--teal);
  background: rgba(77, 182, 172, 0.2);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  margin-bottom: 2rem;
  border: 1px solid var(--teal);
}

header h1 {
  font-size: 5rem;
  line-height: 1.1;
  letter-spacing: -2px;
  margin-bottom: 1rem;
}

.highlight { color: var(--orange); font-style: italic; }

.header-sub {
  max-width: 600px;
  font-size: 1.25rem;
  color: var(--mid-text);
  font-weight: 300;
}

.header-byline {
  margin-top: 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--mid-text);
  letter-spacing: 1px;
  text-transform: uppercase;
}

nav {
  position: sticky;
  top: 0;
  background: rgba(11, 12, 16, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
  z-index: 100;
  padding: 1rem 0;
  transition: transform 0.3s ease;
}
.nav-hidden {
  transform: translateY(-100%);
}

.nav-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.nav-logo {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--cream);
  letter-spacing: 2px;
}
.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
}
.nav-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--mid-text);
  text-transform: uppercase;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}
.nav-links a:hover {
  color: var(--teal);
  text-shadow: 0 0 10px rgba(77, 182, 172, 0.8);
}

main { max-width: 900px; margin: 0 auto; padding: 4rem 2rem; }
section { margin-bottom: 8rem; scroll-margin-top: 90px; }
section:last-of-type { margin-bottom: 4rem; }

.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 1rem;
}

section h2 { font-size: 3rem; line-height: 1.2; margin-bottom: 2rem; }
section p { font-size: 1.15rem; margin-bottom: 1.5rem; color: var(--cream); font-weight: 300; }
section h3 { font-size: 1.8rem; margin-top: 4rem; border-bottom: 1px solid var(--panel-border); padding-bottom: 0.5rem; }

.diagram-wrap {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 2rem;
  margin: 2rem 0;
  overflow-x: auto;
}

.diagram-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--mid-text);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
}

.timeline { border-left: 2px solid var(--panel-border); padding-left: 2rem; margin-left: 1rem; }
.timeline-item { position: relative; margin-bottom: 2.5rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.4rem;
  top: 0.3rem;
  width: 12px; height: 12px;
  background: var(--bg-color);
  border: 2px solid var(--orange);
  border-radius: 50%;
}
.timeline-item.danger::before { border-color: var(--red-vivid); background: var(--red-vivid); box-shadow: 0 0 10px var(--red-vivid); }

.tl-year { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--cream); margin-bottom: 0.3rem; }
.tl-text { font-size: 1rem; color: var(--mid-text); }

.pipe-block {
  padding: 1rem;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  border: 1px solid;
  background: rgba(0,0,0,0.3);
}
.pipe-block.cream { color: var(--cream); border-color: var(--cream); }
.pipe-block.orange { color: var(--orange); border-color: var(--orange); background: var(--orange-glow); }
.pipe-block.red { color: var(--red-vivid); border-color: var(--red-vivid); background: rgba(255,42,42,0.1); }
.pipe-block.teal { color: var(--teal); border-color: var(--teal); }

.pipe-arrow { font-size: 1.5rem; color: var(--mid-text); padding: 0 0.5rem; }

.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; margin-top: 2rem; }
.card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 1.5rem;
  border-radius: 8px;
  transition: transform 0.2s;
}
.card:hover { transform: translateY(-5px); border-color: var(--orange); }
.card-icon { font-size: 2rem; display: block; margin-bottom: 1rem; }
.card h4 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.card p { font-size: 0.95rem; color: var(--mid-text); margin-bottom: 0; }

code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--panel-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  border: 1px solid var(--panel-border);
  color: var(--orange);
}

.pull-quote {
  border-left: 4px solid var(--orange);
  padding-left: 1.5rem;
  margin: 3rem 0;
  font-style: italic;
  font-size: 1.5rem;
  color: var(--cream);
}

/* ── CODE BLOCKS & DEEP DIVES (moved out of inline <style>) ── */
.code-block {
  background: #111216;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 1.5rem;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--text-main);
  margin: 2rem 0;
}
.code-block .keyword { color: var(--orange); }
.code-block .string { color: var(--teal); }
.code-block .comment { color: var(--mid-text); font-style: italic; }
.code-block .func { color: var(--amber); }

.deep-dive {
  border-left: 3px solid var(--teal);
  background: rgba(77, 182, 172, 0.05);
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 0 8px 8px 0;
}
.deep-dive h3 { margin-top: 0; font-size: 1.3rem; border: none; padding-bottom: 0; }
.deep-dive p { font-size: 1rem; }

.friction-note {
  border-left: 3px solid var(--red-vivid);
  background: rgba(255, 42, 42, 0.05);
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 0 8px 8px 0;
}
.friction-note h3 { margin-top: 0; font-size: 1.3rem; border: none; padding-bottom: 0; }
.friction-note p { font-size: 1rem; margin-bottom: 0; }

/* ── DOWNLOAD SECTION ── */
.download-section {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: -2rem auto 4rem;
  max-width: 900px;
  position: relative;
  z-index: 10;
  flex-wrap: wrap;
}

.dl-btn {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  color: var(--cream);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  transition: all 0.3s ease;
  text-decoration: none;
}

.dl-btn:hover {
  border-color: var(--orange);
  background: rgba(232, 87, 10, 0.1);
  transform: translateY(-3px);
  text-decoration: none;
  box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

.dl-btn svg { width: 24px; height: 24px; fill: currentColor; }
.dl-btn.windows:hover { color: #00a4ef; border-color: #00a4ef; background: rgba(0,164,239,0.1); }
.dl-btn.mac:hover { color: #ffffff; border-color: #ffffff; background: rgba(255,255,255,0.1); }
.dl-btn.linux:hover { color: #fca311; border-color: #fca311; background: rgba(252,163,17,0.1); }
.dl-btn.repo { background: var(--orange); color: var(--bg-color); border: none; }
.dl-btn.repo:hover { background: var(--red-vivid); color: #fff; }

/* ── MODAL ── */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0; width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 2.5rem;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  position: relative;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

.close-btn {
  position: absolute;
  top: 1rem; right: 1.5rem;
  color: var(--mid-text);
  font-size: 1.5rem;
  cursor: pointer;
  transition: 0.2s;
}
.close-btn:hover { color: var(--red-vivid); }

.modal-desc { margin-bottom: 1.5rem; color: var(--mid-text); }

.code-container {
  display: flex;
  align-items: center;
  background: #0b0c10;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 0.5rem;
  justify-content: space-between;
}

.code-container code {
  background: transparent;
  border: none;
  color: var(--teal);
  font-size: 0.85rem;
  padding: 0.5rem;
  flex-grow: 1;
  text-align: left;
  overflow-x: auto;
}

.copy-btn {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--cream);
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  transition: 0.2s;
  min-width: 40px;
}
.copy-btn:hover { border-color: var(--orange); color: var(--orange); }

/* ── CLOSING SECTION ── */
.closing-box {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 2.5rem;
  margin-top: 2rem;
}
.closing-box p:last-child { margin-bottom: 0; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .card-grid { grid-template-columns: 1fr; }
  .header-logo { width: 220px; margin-bottom: 1rem; }
  header h1 { font-size: 2.75rem; letter-spacing: -1px; }
  .header-sub { font-size: 1.05rem; padding: 0 1rem; }
  section h2 { font-size: 2rem; }
  section p { font-size: 1rem; }
  main { padding: 3rem 1.25rem; }
  .nav-inner { flex-direction: column; justify-content: center; align-items: center; padding: 1rem; }
  .nav-links { 
    width: 100%;
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem 0;
  }
  .nav-links li {
    flex: 0 0 33.333%;
    text-align: center;
  }
  .nav-links a { font-size: 0.75rem; }
  .pull-quote { font-size: 1.2rem; margin: 2rem 0; padding-left: 1rem; }
  
  .download-section {
    flex-direction: column;
    padding: 0 1.25rem;
    gap: 1rem;
    margin: -1rem auto 3rem;
  }
  .dl-btn {
    width: 100%;
    justify-content: center;
  }
  
  .diagram-wrap { padding: 1rem; }
  .deep-dive, .friction-note, .closing-box { padding: 1.25rem; }
  
  .modal-content { padding: 1.5rem; width: 95%; }
}

@media (max-width: 400px) {
  header h1 { font-size: 2.2rem; }
  .timeline { padding-left: 1.5rem; margin-left: 0.5rem; }
  .timeline-item::before { left: -1.9rem; }
}

/* =========================================================
   STAT STRIP
   ========================================================= */
.stat-strip {
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:1rem;
  margin:3rem 0;
}
.stat-cell {
  background:rgba(255,255,255,0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius:10px;
  padding:1.5rem 0.75rem;
  text-align:center;
  min-width:0;
  transition: transform 0.3s ease, background 0.3s ease;
}
.stat-cell:hover {
  background:rgba(255,255,255,0.06);
  transform: translateY(-2px);
}
.stat-cell .num {
  font-family:'Playfair Display',serif;
  font-size:clamp(1.1rem,2.2vw,2.2rem);
  font-weight:900;
  color:var(--orange);
  display:block;
  word-break:break-word;
  line-height:1.15;
}
.stat-cell .label-s {
  font-family:'JetBrains Mono',monospace;
  font-size:0.68rem;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:var(--mid-text);
  margin-top:0.5rem;
  display:block;
}

/* =========================================================
   FOOTER
   ========================================================= */
footer {
  background: var(--bg);
  border-top: 1px solid rgba(77, 182, 172, 0.15); /* subtle teal border */
  color: var(--mid-text);
  padding:3rem 1.5rem;
  text-align:center;
  position:relative;
  z-index:1;
}
footer .footer-logo {
  font-family:'JetBrains Mono',monospace;
  font-size:1rem;
  font-weight:700;
  color:var(--teal);
  letter-spacing:0.15em;
  margin-bottom:1rem;
  display:block;
}
footer p { font-size:0.95rem; line-height:1.7; max-width:600px; margin:0.5rem auto; }
footer .footer-note {
  font-family:'JetBrains Mono',monospace;
  color: rgba(255,255,255,0.7);
}
footer .footer-version {
  margin-top: 1.5rem;
  font-family:'JetBrains Mono',monospace;
  letter-spacing:0.1em;
  color: var(--orange);
}
footer .footer-credits {
  color: var(--cream);
}
footer .footer-credits a {
  color: var(--teal);
  text-decoration: none;
  font-weight: bold;
}
footer .footer-credits a:hover {
  text-decoration: underline;
}

/* Responsive Stat-Strip */
@media (max-width:768px) {
  .stat-strip { grid-template-columns:repeat(2,1fr); }
}
@media (max-width:480px) {
  .stat-strip { grid-template-columns:1fr 1fr; }
}
