
:root {
  --deep:    #020d0f;
  --abyss:   #041418;
  --curr:    #071e22;
  --brine:   #0a2830;
  --slate:   #0f3540;
  --edge:    #1a5060;
  --text:    #70c0b8;
  --bright:  #c0f0e8;
  --muted:   #5090a8;
  --faded:   #5090a0;

  --biolum:  #00ffe8;
  --glow:    #00e8b8;
  --spark:   #60ffd0;
  --plankton:#a0ffcc;
  --dusk:    #20a878;
  --algae:   #00c850;
  --amber:   #ffa040;
  --danger:  #ff5858;
  --indigo:  #4060ff;
}

*{ margin:0; padding:0; box-sizing:border-box; }
body {
  background: var(--deep);
  color: var(--text);
  font-family: 'Exo 2', sans-serif;
  min-height: 100vh; overflow-x: hidden;
}

/* Deep ocean gradient */
body::before {
  content:'';
  position:fixed; inset:0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(0,200,160,0.06) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 80%, rgba(0,160,120,0.04) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 50%, rgba(0,80,100,0.08) 0%, transparent 70%);
  pointer-events:none; z-index:0;
}

/* Subtle wave texture */
body::after {
  content:'';
  position:fixed; inset:0;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(0,200,160,0.012) 3px,
      rgba(0,200,160,0.012) 4px
    );
  pointer-events:none; z-index:0;
}

/* ═══ HEADER ═══ */
header {
  position: relative; z-index: 1;
  border-bottom: 1px solid var(--edge);
  overflow: hidden;
}
/* Phosphorescent pulse bar */
.bio-bar {
  height: 3px;
  background: linear-gradient(90deg,
    transparent 0%, var(--biolum) 20%, var(--glow) 50%, var(--biolum) 80%, transparent 100%);
  box-shadow: 0 0 12px var(--biolum);
  animation: biopulse 3s ease-in-out infinite;
}
@keyframes biopulse {
  0%,100% { opacity: 0.6; }
  50%     { opacity: 1; }
}

.hdr-inner {
  padding: 28px 52px 24px;
  display: grid; grid-template-columns: 1fr auto;
  gap: 40px; align-items: start;
}
.hdr-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: 3px;
  color: var(--biolum); margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--biolum);
  box-shadow: 0 0 8px var(--biolum);
  animation: biopulse 1.4s ease-in-out infinite;
}
header h1 {
  font-family: 'Exo 2', sans-serif;
  font-size: clamp(38px, 6vw, 82px);
  font-weight: 800; line-height: 0.95;
  color: var(--bright);
  margin-bottom: 10px;
  text-shadow: 0 0 40px rgba(0,255,232,0.2);
}
header h1 em { color: var(--biolum); font-style: normal; }
.hdr-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--faded); letter-spacing: 1px; line-height: 1.8;
}
.hdr-depth {
  display: flex; flex-direction: column; gap: 8px;
  min-width: 200px;
}
.depth-bar {
  background: var(--abyss); border: 1px solid var(--brine);
  padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.depth-val {
  font-family: 'Exo 2', sans-serif;
  font-size: 22px; font-weight: 800; color: var(--biolum); line-height: 1;
}
.depth-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px; color: var(--faded); letter-spacing: 1px;
}

/* Speed comparison visual */
.speed-strip {
  padding: 16px 52px;
  border-top: 1px solid var(--brine);
  display: flex; gap: 6px; align-items: stretch; overflow-x: auto;
}
.speed-item {
  flex-shrink: 0; display: flex; flex-direction: column; gap: 4px;
}
.speed-bar-wrap { flex: 1; display: flex; align-items: flex-end; height: 40px; }
.speed-bar {
  width: 100%; border-radius: 2px 2px 0 0;
  box-shadow: 0 0 6px currentColor;
}
.speed-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; text-align: center; line-height: 1.3;
}
.speed-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 7.5px; color: var(--faded);
  text-align: center; line-height: 1.3;
}

/* ═══ NAV ═══ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--abyss); border-bottom: 1px solid var(--edge);
  display: flex; overflow-x: auto;
}
.nav-tab {
  padding: 12px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all 0.12s; white-space: nowrap;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--biolum); border-bottom-color: var(--biolum); box-shadow: 0 2px 8px rgba(0,255,232,0.2); }

/* ═══ CONTENT ═══ */
.content { padding: 40px 52px; position: relative; z-index: 1; max-width: 1280px; }
.view { display: none; }
.view.active { display: block; }

.sec-h {
  font-family: 'Exo 2', sans-serif; font-size: 22px; font-weight: 700;
  color: var(--bright); margin-bottom: 4px;
}
.sec-sub {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  color: var(--faded); letter-spacing: 2px; margin-bottom: 18px;
  padding-bottom: 10px; border-bottom: 1px solid var(--brine);
}

/* CODE */
.code-wrap { background: #010810; border: 1px solid var(--edge); border-radius: 3px; overflow: hidden; margin: 14px 0; }
.code-top  { display: flex; justify-content: space-between; padding: 6px 14px; background: var(--abyss); border-bottom: 1px solid var(--brine); font-family: 'JetBrains Mono', monospace; font-size: 8px; color: var(--faded); letter-spacing: 1px; }
.clang { color: var(--biolum); }
pre.code { padding: 14px 16px; font-family: 'JetBrains Mono', monospace; font-size: 11.5px; line-height: 1.9; color: var(--faded); overflow-x: auto; white-space: pre; }
.kw  { color: #4090c0; }
.cls { color: var(--biolum); }
.fn  { color: var(--algae); }
.cm  { color: var(--muted); }
.str { color: var(--amber); }
.ok  { color: var(--algae); }
.bad { color: var(--danger); }
.hl  { color: var(--bright); }

/* Pattern cards */
.pat-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin: 16px 0; }
.pat-card { background: var(--abyss); border: 1px solid var(--brine); border-radius: 3px; overflow: hidden; }
.pat-hdr  { padding: 12px 16px; border-bottom: 1px solid var(--brine); display: flex; justify-content: space-between; align-items: center; }
.pat-name { font-family: 'Exo 2', sans-serif; font-size: 16px; font-weight: 700; color: var(--bright); }
.pat-when { font-family: 'JetBrains Mono', monospace; font-size: 8px; color: var(--faded); }
.pat-body { padding: 12px 16px; font-size: 13px; color: var(--faded); line-height: 1.6; }
.pat-flow { display: flex; flex-direction: column; gap: 3px; padding: 12px 16px; border-top: 1px solid var(--brine); }
.pat-step { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text); }
.pat-step .n { color: var(--biolum); margin-right: 8px; }
.pat-pros { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--algae); line-height: 1.7; padding: 8px 16px; border-top: 1px solid var(--brine); }
.pat-cons { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--danger); line-height: 1.7; padding: 8px 16px; }

/* Eviction policy */
.evict-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 14px 0; }
.evict-card { background: var(--abyss); border: 1px solid var(--brine); padding: 14px 16px; border-top: 2px solid; }
.evict-name { font-family: 'Exo 2', sans-serif; font-size: 16px; font-weight: 700; color: var(--bright); margin-bottom: 6px; }
.evict-body { font-size: 12px; color: var(--faded); line-height: 1.55; }
.evict-impl { font-family: 'JetBrains Mono', monospace; font-size: 9px; margin-top: 8px; }

/* Redis structures */
.redis-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 14px 0; }
.redis-card { background: var(--abyss); border: 1px solid var(--edge); border-radius: 3px; overflow: hidden; }
.redis-hdr  { padding: 10px 14px; border-bottom: 1px solid var(--brine); display: flex; align-items: center; gap: 10px; }
.redis-icon { font-size: 20px; }
.redis-name { font-family: 'Exo 2', sans-serif; font-size: 14px; font-weight: 700; color: var(--bright); }
.redis-cmds { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--faded); padding: 10px 14px; line-height: 1.8; }
.redis-use  { font-family: 'JetBrains Mono', monospace; font-size: 9px; padding: 8px 14px; border-top: 1px solid var(--brine); }

/* Stampede animation */
.stampede-demo {
  background: var(--abyss); border: 1px solid var(--edge); border-radius: 3px;
  padding: 20px; margin: 14px 0; overflow: hidden;
}
.stamp-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.stamp-lbl { width: 80px; color: var(--faded); flex-shrink: 0; font-size: 10px; }
.stamp-track { flex: 1; height: 16px; background: var(--brine); border-radius: 2px; overflow: hidden; position: relative; }
.stamp-fill { height: 100%; border-radius: 2px; animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-direction: alternate; }
.sf1 { background: var(--biolum); animation: sf1 2.1s infinite alternate; box-shadow: 0 0 6px var(--biolum); }
.sf2 { background: var(--glow);   animation: sf2 2.3s infinite alternate; box-shadow: 0 0 6px var(--glow); }
.sf3 { background: var(--spark);  animation: sf3 1.9s infinite alternate; box-shadow: 0 0 6px var(--spark); }
@keyframes sf1 { 0%{width:0%} 40%{width:40%} 60%{width:100%;background:var(--danger)} 100%{width:80%} }
@keyframes sf2 { 0%{width:0%} 35%{width:35%} 55%{width:100%;background:var(--danger)} 100%{width:70%} }
@keyframes sf3 { 0%{width:0%} 45%{width:45%} 65%{width:100%;background:var(--danger)} 100%{width:60%} }

/* CDN diagram */
.cdn-diagram { background: var(--abyss); border: 1px solid var(--edge); padding: 20px; margin: 14px 0; }
.cdn-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.cdn-node { padding: 8px 14px; border: 1px solid; font-family: 'JetBrains Mono', monospace; font-size: 10px; text-align: center; border-radius: 2px; flex-shrink: 0; line-height: 1.4; }
.cdn-arr { color: var(--faded); font-size: 12px; }
.cdn-badge { font-family: 'JetBrains Mono', monospace; font-size: 8px; padding: 2px 6px; border-radius: 10px; }

/* Alert */
.alert { padding: 12px 16px; margin: 12px 0; border-left: 3px solid; font-family: 'JetBrains Mono', monospace; font-size: 11px; line-height: 1.7; }
.alert.bio  { border-color: var(--biolum); color: var(--biolum); background: rgba(0,255,232,0.04); }
.alert.amb  { border-color: var(--amber);  color: var(--amber);  background: rgba(255,160,64,0.04); }
.alert.bad  { border-color: var(--danger); color: var(--danger); background: rgba(255,88,88,0.04); }
.alert em   { color: var(--bright); font-style: normal; font-family: 'Exo 2', sans-serif; font-weight: 700; }

/* Tips table */
.tips-tbl { width: 100%; border-collapse: collapse; margin: 14px 0; }
.tips-tbl th { background: var(--curr); color: var(--biolum); padding: 8px 13px; font-family: 'JetBrains Mono', monospace; font-size: 8px; letter-spacing: 2px; font-weight: 400; text-align: left; border-bottom: 1px solid var(--edge); }
.tips-tbl td { padding: 9px 13px; border-bottom: 1px solid var(--brine); font-size: 12px; color: var(--faded); vertical-align: top; line-height: 1.5; }
.tips-tbl td:first-child { font-family: 'JetBrains Mono', monospace; color: var(--biolum); font-size: 11px; }
.tips-tbl tr:hover td { background: rgba(0,255,232,0.02); }

/* Tasks */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-card { background: var(--abyss); border: 1px solid var(--brine); overflow: hidden; }
.task-hd   { display: flex; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; transition: background 0.12s; border-bottom: 1px solid var(--brine); }
.task-hd:hover { background: var(--curr); }
.t-num   { font-family: 'Exo 2', sans-serif; font-size: 30px; font-weight: 800; color: var(--muted); flex-shrink:0; line-height:1; }
.t-label { font-size: 14px; font-weight: 700; color: var(--bright); flex: 1; }
.t-meta  { font-family: 'JetBrains Mono', monospace; font-size: 9px; color: var(--faded); white-space: nowrap; }
.t-arr   { color: var(--faded); font-size: 18px; transition: transform 0.2s; }
.t-arr.open { transform: rotate(90deg); }
.task-bd { display: none; padding: 14px 18px; font-size: 13px; color: var(--faded); line-height: 1.7; }
.task-bd.open { display: block; }
.task-bd ol, .task-bd ul { margin-left: 20px; margin-top: 8px; }
.task-bd li { margin-bottom: 4px; }
.task-bd pre { background: #010810; border: 1px solid var(--brine); padding: 10px 12px; font-family: 'JetBrains Mono', monospace; font-size: 10.5px; line-height: 1.75; overflow-x: auto; margin: 8px 0; color: var(--faded); white-space: pre; }

/* Checklist */
.chk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chk { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; background: var(--abyss); border: 1px solid var(--brine); cursor: pointer; transition: all 0.12s; }
.chk:hover { border-color: var(--edge); }
.chk.done { border-color: rgba(0,255,232,0.3); }
.chk-box { width: 14px; height: 14px; border: 1px solid var(--brine); flex-shrink: 0; margin-top: 2px; display: flex; align-items: center; justify-content: center; font-size: 9px; font-family: 'JetBrains Mono', monospace; }
.chk.done .chk-box { background: var(--biolum); border-color: var(--biolum); color: #000; }
.chk-lbl { font-size: 12px; color: var(--faded); line-height: 1.4; }
.chk.done .chk-lbl { color: var(--biolum); text-decoration: line-through; text-decoration-color: rgba(0,255,232,0.3); }
.prog-row { display: flex; justify-content: space-between; font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--faded); margin-bottom: 8px; }
.prog-track { height: 2px; background: var(--brine); margin-bottom: 24px; }
.prog-fill { height: 100%; background: var(--biolum); transition: width 0.3s; width: 0%; box-shadow: 0 0 8px var(--biolum); }

@media(max-width:900px){
  .content { padding: 28px 20px; }
  .hdr-inner { padding: 24px 20px; grid-template-columns: 1fr; }
  .speed-strip { padding: 14px 20px; }
  .pat-grid  { grid-template-columns: 1fr; }
  .evict-grid { grid-template-columns: 1fr 1fr; }
  .redis-grid { grid-template-columns: 1fr 1fr; }
  .chk-grid  { grid-template-columns: 1fr; }
}

/* ===== BOTTOM NAV ===== */
.b3-bottom-nav {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 2rem 1rem;
  margin-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.15);
}
.b3-nav-footer-btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  background: rgba(0,212,170,0.1);
  color: #00d4aa;
  border: 1px solid rgba(0,212,170,0.3);
  transition: all 0.2s;
  font-family: inherit;
}
.b3-nav-footer-btn:hover {
  background: rgba(0,212,170,0.2);
  transform: translateY(-2px);
}
