/* ===================== THEME TOKENS ===================== */
:root {
  --radius-xxl: 22px;
  --radius-xl: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --dur-fast: .16s;
  --dur: .28s;
  --ring: 0 0 0 3px color-mix(in oklab, var(--brand) 45%, transparent);
  /* Default (dark baseline) */
  --bg: #0d1014;
  --fg: #e9ecf1;
  --muted: #aeb6c3;
  --surface: #12161c;
  --card: #0f1318;
  --border: #232a34;
  --brand: #6ee7ff;
  --brand-2: #b2ffa2;
  --link: #7bd1ff;
  --accent: #7cffc7;
  --grid-line: rgba(190, 205, 220, .11);
  --elev: 0 10px 40px rgba(0,0,0,.28);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg:#fbfbfd;
    --fg:#121317;
    --muted:#58606d;
    --surface:#ffffff;
    --card:#ffffff;
    --border:#e6eaf1;
    --brand:#0aa9ff;
    --brand-2:#77f08b;
    --link:#0966c6;
    --accent:#16c5a3;
    --grid-line: rgba(40, 60, 90, .08);
    --elev: 0 20px 60px rgba(10,20,40,.08);
  }
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1014;
  --fg: #e9ecf1;
  --muted: #aeb6c3;
  --surface: #12161c;
  --card:#0f1318;
  --border:#232a34;
  --brand:#6ee7ff;
  --brand-2:#b2ffa2;
  --link:#7bd1ff;
  --accent:#7cffc7;
  --grid-line: rgba(190, 205, 220, .11);
  --elev: 0 10px 40px rgba(0,0,0,.28);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg:#fbfbfd;
  --fg:#121317;
  --muted:#58606d;
  --surface:#ffffff;
  --card:#ffffff;
  --border:#e6eaf1;
  --brand:#0aa9ff;
  --brand-2:#77f08b;
  --link:#0966c6;
  --accent:#16c5a3;
  --grid-line: rgba(40, 60, 90, .08);
  --elev: 0 20px 60px rgba(10,20,40,.08);
}

/* ===================== BASE & LAYOUT ===================== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans";
  color: var(--fg);
  background: radial-gradient(1200px 600px at 80% -20%, color-mix(in oklab, var(--brand) 12%, transparent), transparent 60%), var(--bg);
  transition: background-color var(--dur), color var(--dur);
  overflow-x: hidden;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
.wrap { width: min(1160px, 100% - 40px); margin: 0 auto; position: relative; }

/* Crisp subtle grid (replaces pixelated dots) */
.bg-grid::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(to right, var(--grid-line), var(--grid-line) 1px, transparent 1px, transparent 22px),
              repeating-linear-gradient(to bottom, var(--grid-line), var(--grid-line) 1px, transparent 1px, transparent 22px);
  pointer-events: none;
  z-index: -1;
}

/* Signature gradient spine */
.spine { position: fixed; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, var(--brand), var(--brand-2)); opacity: .95; transform: translateZ(0); }

/* Skip link */
.skip { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.skip:focus { position: fixed; top: 12px; left: 12px; z-index: 9999; width: auto; height: auto; padding: 10px 14px; border-radius: 10px; background: var(--surface); color: var(--fg); box-shadow: var(--ring); }

header.site { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; padding: 22px 0; }
.brand { display:flex; align-items:center; gap:14px; font-weight: 800; font-size: 18px; letter-spacing:.2px; }
.brand-logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: conic-gradient(from 210deg, var(--brand), var(--brand-2));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--fg) 20%, transparent);
  animation: spin 14s linear infinite;
}
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.actions { display: flex; align-items: center; gap: 10px; }
nav a { margin: 0 8px; padding: 8px 10px; border-radius: 10px; }
nav a:focus-visible { outline: none; box-shadow: var(--ring); }
.toggle {
  appearance: none; border: 1px solid var(--border); background: var(--surface); padding: 10px 12px; border-radius: 12px; cursor: pointer; font: inherit; display: inline-flex; gap: 10px; align-items: center; transition: transform var(--dur-fast);
}
.toggle:hover { transform: translateY(-1px); }
.toggle svg { width: 18px; height: 18px; }
.toggle:focus-visible { outline: none; box-shadow: var(--ring); }

/* HERO */
.hero {
  margin: 28px 0 18px; padding: 28px; border: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in oklab, var(--surface) 92%, transparent), color-mix(in oklab, var(--card) 100%, transparent));
  border-radius: var(--radius-xxl); box-shadow: var(--elev); position: relative; overflow: clip; backdrop-filter: saturate(1.05);
}
.glow {
  position: absolute; inset: -40% -40% auto auto; height: 260px; width: 360px; filter: blur(48px);
  background: radial-gradient(120px 90px at 70% 60%, color-mix(in oklab, var(--brand) 35%, transparent), transparent 60%),
              radial-gradient(120px 90px at 20% 30%, color-mix(in oklab, var(--brand-2) 35%, transparent), transparent 60%);
  opacity: .25; pointer-events: none;
}
.hero-grid { display: grid; gap: 18px; align-items: center; grid-template-columns: 1.25fr .75fr; }
@media (max-width: 880px) { .hero-grid { grid-template-columns: 1fr; } }
.title { font-size: clamp(36px, 4vw, 54px); line-height: 1.02; letter-spacing: -0.5px; margin: 2px 0 10px; }
.subtitle { color: var(--muted); max-width: 65ch; }

/* ===== Enhanced Terminal Window ===== */
.terminal {
  border-radius: 16px;
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  background: linear-gradient(180deg, color-mix(in oklab, var(--card) 86%, transparent), color-mix(in oklab, var(--card) 100%, transparent));
  box-shadow: 0 30px 60px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.03);
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px; color: var(--fg); overflow: hidden; position: relative;
}
.term-titlebar { display:flex; align-items:center; justify-content: space-between; gap:10px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, color-mix(in oklab, var(--surface) 92%, transparent), color-mix(in oklab, var(--card) 100%, transparent)); }
.term-controls { display:flex; align-items:center; gap:8px; }
.ctrl { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.c-close { background:#ff5f57; }
.c-min { background:#febc2e; }
.c-max { background:#28c840; }
.term-tab { padding: 6px 10px; border-radius: 8px; font-size: 12px; letter-spacing:.2px; color: var(--muted); background: transparent; border: 1px solid transparent; }
.term-tab.active { color: var(--fg); background: color-mix(in oklab, var(--surface) 70%, transparent); border-color: color-mix(in oklab, var(--border) 100%, transparent); }
.term-actions { display:flex; align-items:center; gap:8px; }
.copy-btn { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--fg); border-radius: 10px; padding: 6px 10px; cursor: pointer; font: inherit; display: inline-flex; align-items:center; gap:8px; }
.copy-btn:hover { border-color: color-mix(in oklab, var(--brand) 35%, var(--border)); }
.copy-btn svg { width: 14px; height: 14px; }
.term-body { padding: 14px 16px; max-height: 220px; overflow: auto; }
.prompt { color: var(--brand-2); }
.cursor { display:inline-block; width: .6ch; height: 1em; background: var(--brand); vertical-align: -2px; margin-left: 2px; animation: blink 1.2s steps(2,end) infinite; }
@keyframes blink { 0%,49%{opacity:1} 50%,100%{opacity:0} }
.k { color: var(--muted); }

/* Sections */
section { margin: 56px 0; }
h2.section-title { font-size: clamp(22px, 2.2vw, 28px); margin: 0 0 16px; display:flex; align-items:center; gap:10px; letter-spacing:.1px; }
.section-title .dot { width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(180deg, var(--brand), var(--brand-2)); }

/* Grid (cards) */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
.col-4 { grid-column: span 4; }
.col-12 { grid-column: span 12; }
@media (max-width: 980px) { .col-4 { grid-column: span 6; } }
@media (max-width: 640px) { .col-4 { grid-column: span 12; } }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: relative; isolation: isolate;
  transform: translateZ(0) perspective(800px) rotateX(0) rotateY(0) translateY(0);
  transition: transform var(--dur), border-color var(--dur), background var(--dur); will-change: transform; overflow: clip;
}
.card::after {
  content: ""; position: absolute; inset: -2px; border-radius: inherit;
  background: conic-gradient(from 220deg, color-mix(in oklab, var(--brand) 24%, transparent), transparent, color-mix(in oklab, var(--brand-2) 20%, transparent), transparent);
  filter: blur(12px); opacity: 0; transition: opacity var(--dur); z-index: -1;
}
.card:hover { transform: translateY(-6px); border-color: color-mix(in oklab, var(--brand) 40%, var(--border)); }
.card:hover::after { opacity: .5; }
.card h3 { margin: 2px 0 8px; font-size: 17px; }
.card p { color: var(--muted); margin: 0; }
.meta { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* Contact */
.contact {
  display:grid; gap:14px; grid-template-columns: 1fr auto; border: 1px dashed var(--border); border-radius: var(--radius); padding: 18px; background: color-mix(in oklab, var(--surface) 70%, transparent);
}
@media (max-width: 720px){ .contact{ grid-template-columns: 1fr; } }
.btn {
  display:inline-flex; align-items:center; gap:10px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); padding: 12px 16px; text-decoration:none; color: var(--fg);
  transition: transform var(--dur-fast), border-color var(--dur); position: relative; overflow: hidden;
}
.btn:hover { transform: translateY(-2px); border-color: color-mix(in oklab, var(--brand) 35%, var(--border)); }
.btn::before {
  content:""; position:absolute; inset:0;
  background: radial-gradient(160px 80px at var(--mx, 50%) var(--my, 50%), color-mix(in oklab, var(--brand) 20%, transparent), transparent 60%);
  opacity: 0; transition: opacity var(--dur-fast);
}
.btn:hover::before { opacity: .7; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn svg { width: 18px; height: 18px; }

/* Footer */
footer { padding: 40px 0 70px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--border); margin-top: 60px; text-align: center; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0) scale(1); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .brand-logo { animation: none; }
  .card, .btn { transition: none; }
  .reveal { transition: none; opacity: 1; transform: none; }
}
