/* =========================================================
   TOKENS — brand palette, dark editor theme
   ========================================================= */
:root {
  --core: #1459CC;
  --sky: #81B4FF;
  --night: #161B1E;
  --night-2: #111518;

  --bg: var(--night);
  --bg-2: var(--night-2);
  --panel: #1D2327;
  --line: #272E33;
  --line-2: #353D43;
  --text: #E2E7EB;
  --muted: #98A3AC;
  --dim: #59646D;

  /* syntax */
  --kw: #81B4FF;
  --str: #9FE0B8;
  --num: #F5C27A;
  --fn: #C3B1FF;
  --prop: #A9CBFF;
  --com: #67737D;

  --logo-outer: var(--sky);
  --logo-inner: #A9CBFF;
  --logo-thin: #5F8FD6;
  --logo-prompt: #FFFFFF;

  --display: "Martian Mono", "JetBrains Mono", ui-monospace, monospace;
  --mono: "JetBrains Mono", Menlo, ui-monospace, monospace;

  --top: 44px;     /* tab bar */
  --status: 26px;  /* status bar */
  --gutter: 56px;  /* line numbers */
  --map: 76px;     /* minimap */
  --lh: 24px;      /* gutter line height */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-snap-type: y mandatory; scroll-behavior: smooth; background: var(--bg); }
body {
  font-family: var(--mono); font-size: 15px; line-height: 1.7;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
::selection { background: rgba(129,180,255,.3); color: #fff; }
html::-webkit-scrollbar { width: 10px; }
html::-webkit-scrollbar-track { background: var(--bg-2); }
html::-webkit-scrollbar-thumb { background: var(--line-2); border: 2px solid var(--bg-2); border-radius: 6px; }

/* syntax helpers */
.kw { color: var(--kw); } .str { color: var(--str); } .num { color: var(--num); }
.fn { color: var(--fn); } .prop { color: var(--prop); } .com { color: var(--com); font-style: italic; }
.pn { color: var(--muted); } .dim { color: var(--dim); } .ok { color: var(--str); }

/* =========================================================
   EDITOR CHROME
   ========================================================= */
.tabbar {
  position: fixed; inset: 0 0 auto 0; height: var(--top); z-index: 60;
  display: flex; align-items: stretch; background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.tabbar .brand { display: flex; align-items: center; gap: 10px; padding: 0 18px; flex-shrink: 0; border-right: 1px solid var(--line); }
.tabbar .lights { display: flex; gap: 6px; margin-right: 6px; }
.tabbar .lights i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.tabbar .brand svg { width: 22px; height: 22px; }
.tabbar .brand b { font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .14em; font-stretch: 112.5%; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 0 18px;
  font-size: 13px; color: var(--muted); border-right: 1px solid var(--line); white-space: nowrap;
  transition: color .2s, background .2s;
}
.tab:hover { color: var(--text); background: rgba(129,180,255,.04); }
.tab .ic { font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.tab .x { color: var(--dim); font-size: 12px; opacity: 0; margin-left: 2px; }
.tab:hover .x { opacity: 1; }
.tab.active { color: var(--text); background: var(--bg); }
.tab.active::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--sky); }
.tab.active::after { content: ""; position: absolute; inset: auto 0 -1px 0; height: 1px; background: var(--bg); }
.tab.active .x { opacity: 1; }
.tabbar .run {
  margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 0 18px; flex-shrink: 0;
  font-size: 12px; color: var(--muted); border-left: 1px solid var(--line);
}
.tabbar .run:hover { color: var(--sky); }
.tabbar .run span { color: var(--str); }

.crumbs {
  position: fixed; top: var(--top); left: var(--gutter); right: var(--map); z-index: 55; height: 28px;
  display: flex; align-items: center; gap: 8px; padding: 0 18px;
  font-size: 12px; color: var(--dim); background: linear-gradient(var(--bg) 60%, transparent);
  pointer-events: none;
}
.crumbs b { color: var(--muted); font-weight: 400; }

.gutter {
  position: fixed; top: var(--top); bottom: var(--status); left: 0; width: var(--gutter); z-index: 50;
  overflow: hidden; border-right: 1px solid var(--line); background: var(--bg);
  font-size: 12px; line-height: var(--lh); color: var(--dim); text-align: right; padding-right: 14px;
}
.gutter .nums { will-change: transform; }
.gutter .nums div.cur { color: var(--text); }
.cursor-line {
  position: fixed; left: var(--gutter); right: var(--map); height: var(--lh); z-index: 0;
  background: rgba(129,180,255,.035); border-top: 1px solid rgba(129,180,255,.05); border-bottom: 1px solid rgba(129,180,255,.05);
  pointer-events: none; opacity: 0; transition: opacity .3s;
}

.minimap {
  position: fixed; top: calc(var(--top) + 12px); bottom: calc(var(--status) + 12px); right: 0; width: var(--map);
  z-index: 50; padding: 0 12px; border-left: 1px solid var(--line); background: var(--bg); cursor: pointer;
}
.minimap::before { content: ""; position: absolute; left: -1px; top: -12px; height: 12px; border-left: 1px solid var(--line); }
.minimap .blk { position: relative; overflow: hidden; padding-top: 3px; }
.minimap .blk i { display: block; height: 2px; margin: 0 0 3px; border-radius: 1px; background: var(--line-2); }
.minimap .blk i.k { background: rgba(129,180,255,.45); }
.minimap .blk i.s { background: rgba(159,224,184,.35); }
.minimap .view {
  position: absolute; left: 0; right: 0; top: 0; background: rgba(129,180,255,.08);
  border-top: 1px solid rgba(129,180,255,.25); border-bottom: 1px solid rgba(129,180,255,.25);
  pointer-events: none; transition: background .2s;
}
.minimap:hover .view { background: rgba(129,180,255,.14); }

.statusbar {
  position: fixed; inset: auto 0 0 0; height: var(--status); z-index: 60;
  display: flex; align-items: center; background: var(--core); color: #EAF2FF;
  font-size: 12px; line-height: 1;
}
.statusbar > span { display: flex; align-items: center; gap: 6px; padding: 0 12px; height: 100%; white-space: nowrap; }
.statusbar > span:hover { background: rgba(255,255,255,.1); }
.statusbar .sp { flex: 1; padding: 0; }
.statusbar .sp:hover { background: none; }
.statusbar .live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #9FE0B8; box-shadow: 0 0 0 3px rgba(159,224,184,.25); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(159,224,184,0); } }

/* =========================================================
   SECTIONS
   ========================================================= */
section {
  position: relative; min-height: 100vh; min-height: 100svh; scroll-snap-align: start;
  display: flex; align-items: center; overflow: hidden;
  padding: calc(var(--top) + 56px) calc(var(--map) + clamp(20px, 4vw, 64px)) calc(var(--status) + 44px) calc(var(--gutter) + clamp(20px, 4vw, 64px));
}
section:nth-of-type(even) { background: var(--bg-2); }
.wrap { position: relative; z-index: 2; width: 100%; max-width: 1180px; margin: 0 auto; }

.dotgrid {
  position: absolute; inset: -25% 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(rgba(129,180,255,.11) 1px, transparent 1.2px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse at 50% 50%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 20%, transparent 70%);
}
.px { position: absolute; z-index: 1; pointer-events: none; will-change: transform; }
.px-cube { opacity: .06; }

.label { display: inline-flex; gap: 10px; align-items: center; font-size: 13px; color: var(--com); margin-bottom: 18px; font-style: italic; }
.label b { color: var(--sky); font-style: normal; font-weight: 500; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; color: #F5F7F8; }
h2 { font-size: clamp(26px, 3.4vw, 46px); margin-bottom: 20px; }
h2 .tok { color: var(--dim); font-weight: 400; }
h3 { font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: #F5F7F8; }
p { color: var(--muted); }
.lead { font-size: 15.5px; max-width: 600px; }

.btn {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 20px; border-radius: 6px; font-family: var(--mono); font-size: 14px; font-weight: 500;
  border: 1px solid var(--line-2); color: var(--text); transition: all .2s;
}
.btn .pfx { color: var(--str); }
.btn:hover { border-color: var(--sky); color: #fff; box-shadow: 0 0 0 3px rgba(129,180,255,.12); }
.btn-primary { background: var(--core); border-color: var(--core); color: #fff; }
.btn-primary .pfx { color: #BFD8FF; }
.btn-primary:hover { background: #1A66E6; border-color: #1A66E6; }
.btn .caret { width: 8px; height: 15px; background: currentColor; opacity: 0; }
.btn:hover .caret { opacity: 1; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* code block component */
.code { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: 0 30px 60px -36px rgba(0,0,0,.7); }
.code .head { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; background: var(--bg-2); border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.code .head .ic { font-size: 10px; font-weight: 700; }
.code .head .r { margin-left: auto; color: var(--dim); }
.code pre { font-family: var(--mono); font-size: 13.5px; line-height: 1.85; padding: 14px 18px 16px 0; counter-reset: ln; overflow-x: auto; white-space: pre; }
.code pre .l { display: block; padding-left: 52px; position: relative; }
.code pre .l::before { counter-increment: ln; content: counter(ln); position: absolute; left: 0; width: 34px; text-align: right; color: var(--dim); font-size: 12px; }
.code pre .l:hover { background: rgba(129,180,255,.05); }

/* reveal: lines "compile" in */
.js .reveal { opacity: 0; transform: translateY(14px); filter: blur(3px); transition: opacity .7s ease, transform .7s ease, filter .7s ease; }
.js .in .reveal { opacity: 1; transform: none; filter: none; }
.in .reveal.d1 { transition-delay: .08s; } .in .reveal.d2 { transition-delay: .16s; }
.in .reveal.d3 { transition-delay: .24s; } .in .reveal.d4 { transition-delay: .32s; }

/* ---------- 01 home ---------- */
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
#home .px-cube { transition: translate .6s cubic-bezier(.2,.7,.2,1); }
.hero { display: grid; grid-template-columns: 1.3fr .7fr; gap: clamp(24px, 5vw, 72px); align-items: center; }
.hero .label { margin-bottom: 26px; }
#home h1 { font-size: clamp(28px, 3.9vw, 58px); min-height: 2.3em; margin-bottom: 28px; font-stretch: 92%; letter-spacing: -0.045em; }
#home h1 .accent { color: var(--sky); }
.type-caret { display: inline-block; width: .5em; height: .95em; background: var(--sky); vertical-align: -0.1em; margin-left: .08em; animation: blink 1s steps(1) infinite; }
.docblock { font-size: 15px; line-height: 1.75; color: var(--com); font-style: italic; margin-bottom: 34px; }
.docblock em { color: var(--muted); }
.docblock .tag { color: var(--kw); font-style: normal; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-mark { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.hero-mark svg { width: min(100%, 250px); height: auto; filter: drop-shadow(0 0 40px rgba(20,89,204,.35)); }
.hero-mark .wm { font-family: Menlo, var(--mono); font-weight: 700; font-size: clamp(16px, 1.8vw, 22px); letter-spacing: .3em; padding-left: .3em; color: #fff; }
.hero-mark .ver { font-size: 12px; color: var(--dim); }
.hero-mark .ver span { color: var(--str); }
.scroll-hint { position: absolute; bottom: calc(var(--status) + 16px); left: 50%; transform: translateX(-50%); z-index: 2; font-size: 12px; color: var(--dim); white-space: nowrap; }
.scroll-hint b { color: var(--sky); font-weight: 400; }

/* ---------- 02 about ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 72px); align-items: center; }
.md h2 .tok { color: var(--sky); }
.md p { font-size: 15px; max-width: 560px; }
.tasks { list-style: none; margin-top: 26px; display: grid; gap: 10px; }
.tasks li { display: flex; gap: 12px; align-items: baseline; font-size: 14.5px; color: var(--muted); }
.tasks li .bx { color: var(--dim); white-space: nowrap; }
.tasks li .bx b { color: var(--str); font-weight: 500; }
.tasks li strong { color: var(--text); font-weight: 600; }

/* ---------- 03 services ---------- */
.sig { font-size: 14.5px; color: var(--muted); margin-bottom: 34px; max-width: 820px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.card { position: relative; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; transition: border-color .25s, transform .25s, box-shadow .25s; }
.card .head { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--bg-2); }
.card .head .ic { font-size: 10px; font-weight: 700; }
.card .head .run { margin-left: auto; color: var(--str); opacity: 0; transform: translateX(-4px); transition: all .25s; }
.card .body { padding: 20px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card .sigline { font-size: 12.5px; color: var(--muted); }
.card p { font-size: 13.5px; line-height: 1.7; color: var(--com); font-style: italic; flex: 1; }
.card .ret { font-size: 12px; color: var(--dim); border-top: 1px dashed var(--line); padding-top: 12px; }
.card:hover { border-color: var(--line-2); transform: translateY(-4px); box-shadow: 0 20px 40px -24px rgba(20,89,204,.55); }
.card:hover .head .run { opacity: 1; transform: none; }
.card::after { content: ""; position: absolute; left: 0; right: 0; top: -40%; height: 40%; pointer-events: none; background: linear-gradient(transparent, rgba(129,180,255,.07), transparent); opacity: 0; }
.card:hover::after { opacity: 1; animation: scan 1.4s ease-in-out; }
@keyframes scan { from { top: -40%; } to { top: 100%; } }

/* ---------- 04 process ---------- */
.proc-head { display: grid; grid-template-columns: 1.1fr .9fr; gap: 32px; align-items: end; }
.proc-head h2 { margin-bottom: 0; }
.pipeline { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 40px; }
.track { position: absolute; top: 27px; left: 12.5%; right: 12.5%; height: 2px; background: repeating-linear-gradient(90deg, var(--line-2) 0 6px, transparent 6px 12px); }
.track-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--sky); transition: width .6s cubic-bezier(.2,.7,.2,1); }
.track-fill::after { content: ""; position: absolute; right: -5px; top: -4px; width: 10px; height: 10px; background: var(--sky); transform: rotate(45deg); box-shadow: 0 0 14px 2px rgba(129,180,255,.6); }
.stage { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; font: inherit; color: inherit; padding: 0 6px; text-align: center; }
.stage .node { width: 56px; height: 56px; border-radius: 10px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line-2); transition: all .35s; }
.stage .node svg { width: 24px; height: 24px; fill: none; stroke: var(--sky); stroke-width: 1.8; stroke-linejoin: round; transition: stroke .35s, transform .5s; }
.stage .n { font-size: 11px; color: var(--dim); }
.stage .t { font-family: var(--display); font-weight: 600; font-size: 13px; color: var(--muted); transition: color .3s; }
.stage:hover .node { border-color: var(--sky); transform: translateY(-3px); }
.stage.done .node { border-color: rgba(129,180,255,.45); }
.stage.done .n::after { content: " ✓"; color: var(--str); }
.stage.active .node { background: var(--core); border-color: var(--core); box-shadow: 0 0 0 4px rgba(20,89,204,.25), 0 14px 30px -12px rgba(20,89,204,.8); transform: translateY(-3px); }
.stage.active .node svg { stroke: #fff; transform: rotate(90deg); }
.stage.active .t { color: #fff; }
.stage.active .n { color: var(--sky); }
.stage .timer { width: 46px; height: 2px; background: var(--line); overflow: hidden; opacity: 0; transition: opacity .3s; }
.stage .timer i { display: block; height: 100%; width: 0; background: var(--sky); }
.stage.active .timer { opacity: 1; }
.stage:focus-visible { outline: none; }
.stage:focus-visible .node { outline: 2px solid var(--sky); outline-offset: 3px; }
.stage-panel { display: grid; grid-template-columns: 1fr 1fr; margin-top: 28px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); box-shadow: 0 30px 60px -36px rgba(0,0,0,.7); }
.stage-info { padding: 24px 26px; border-right: 1px solid var(--line); }
.stage-info .meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; margin-bottom: 12px; flex-wrap: wrap; }
.stage-info h3 { font-size: 22px; margin-bottom: 8px; }
.stage-info p { font-size: 14px; margin-bottom: 16px; }
.deliver { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.deliver li { font-size: 12px; padding: 5px 10px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--text); opacity: 0; transform: translateY(6px); animation: pop .4s forwards; }
.deliver li::before { content: "+ "; color: var(--str); }
@keyframes pop { to { opacity: 1; transform: none; } }
.swap { animation: swapIn .45s ease; }
@keyframes swapIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.stage-log { background: #0F1315; font-size: 13px; line-height: 1.85; display: flex; flex-direction: column; }
.stage-log .top { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.stage-log .top .r { margin-left: auto; color: var(--dim); }
.stage-log pre { font-family: inherit; padding: 14px 18px; white-space: pre-wrap; min-height: 180px; color: #CDD5DB; }
.stage-log .p { color: var(--sky); }
.blk-caret { display: inline-block; width: 8px; height: 15px; background: var(--sky); vertical-align: -3px; animation: blink 1s steps(1) infinite; }

/* ---------- 05 stack ---------- */
.stack-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 18px; margin-top: 34px; align-items: start; }
.json .t { cursor: default; border-radius: 3px; transition: background .2s, color .2s; }
.json .t:hover { background: rgba(159,224,184,.14); color: #CFF5DD; }
.term pre { white-space: pre-wrap; padding-left: 18px; color: #CDD5DB; }
.term .p { color: var(--sky); }

/* ---------- 06 contact ---------- */
.contact-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.email { display: inline-block; font-family: var(--display); font-size: clamp(15px, 1.6vw, 20px); color: var(--sky); margin: 6px 0 28px; border-bottom: 1px dashed rgba(129,180,255,.5); padding-bottom: 4px; }
.email:hover { border-bottom-style: solid; }
.shell { cursor: text; }
.shell .out { height: 260px; overflow-y: auto; padding: 14px 18px 4px; font-size: 13.5px; line-height: 1.8; white-space: pre-wrap; color: #CDD5DB; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.shell .out a { color: var(--sky); text-decoration: underline; text-underline-offset: 3px; }
.shell .out .p { color: var(--str); }
.shell .out .err { color: #FF9B9B; }
.shell .in { display: flex; align-items: center; gap: 8px; padding: 6px 18px 14px; font-size: 13.5px; }
.shell .in label { color: var(--str); white-space: nowrap; }
.shell .in label b { color: var(--sky); font-weight: 400; }
.shell input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: #fff; font: inherit; caret-color: var(--sky); }
.chipsrow { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px 14px; border-top: 1px solid var(--line); }
.chipsrow button { font: inherit; font-size: 11.5px; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); border-radius: 4px; padding: 3px 8px; cursor: pointer; transition: all .2s; }
.chipsrow button:hover { color: var(--sky); border-color: var(--sky); }
.foot { position: absolute; left: 0; right: 0; bottom: calc(var(--status) + 12px); z-index: 2; text-align: center; font-size: 12px; color: var(--dim); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 960px) {
  :root { --gutter: 0px; --map: 0px; }
  .gutter, .minimap, .cursor-line { display: none; }
  .hero, .split, .proc-head, .stage-panel, .stack-grid, .contact-grid { grid-template-columns: 1fr; }
  .hero-mark { display: none; }
  .stage-info { border-right: 0; border-bottom: 1px solid var(--line); }
  .tabbar .run, .statusbar .hide-sm { display: none; }
}
@media (max-width: 760px) {
  html { scroll-snap-type: y proximity; }
  .tabbar .brand b, .tabbar .lights { display: none; }
  .tab { padding: 0 14px; }
  .crumbs { display: none; }
  section { padding-top: calc(var(--top) + 40px); padding-bottom: calc(var(--status) + 60px); }
  .cards { grid-template-columns: 1fr; }
  .stage .t { font-size: 11px; }
  .stage .node { width: 44px; height: 44px; }
  .track { top: 21px; }
  .code pre { font-size: 12.5px; }
  .statusbar .hide-xs { display: none; }
}
@media (max-width: 520px) {
  .btn { width: 100%; justify-content: center; }
  .docblock { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; filter: none; transition: none; }
  .px { transform: none !important; }
}

/* folder tab that opens another page */
.tab-dir { color: var(--text); }
.tab-dir .x { opacity: 1; color: var(--num); }
