/* ============================================================
   Kdev VPN — Design System (dark · technical)
   Tokens + base + shared components
   ============================================================ */

/* ---- Fonts ---- */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Surfaces */
  --bg-0: #06070880;
  --bg-base: #070809;
  --bg-1: #0c0e10;
  --bg-2: #121518;
  --bg-3: #181c1f;
  --bg-4: #1f2428;

  /* Lines */
  --line: rgba(255,255,255,.07);
  --line-2: rgba(255,255,255,.12);
  --line-3: rgba(255,255,255,.20);

  /* Ink */
  --ink-0: #f3f5f5;
  --ink-1: #ced4d7;
  --ink-2: #8b9499;
  --ink-3: #5a636a;
  --ink-4: #3b4248;

  /* Accent — acid lime (used sparingly) */
  --acid: #c9f24e;
  --acid-bright: #d8ff5e;
  --acid-dim: #9bbd3a;
  --acid-ink: #0a0c05;            /* text on acid */
  --acid-glow: rgba(201,242,78,.16);
  --acid-soft: rgba(201,242,78,.08);

  /* Data / secondary */
  --cyan: #5cd6ff;
  --cyan-soft: rgba(92,214,255,.10);
  --violet: #b69cff;

  /* Status */
  --ok: #41dd87;
  --warn: #ffbb52;
  --crit: #ff6363;
  --ok-soft: rgba(65,221,135,.12);
  --warn-soft: rgba(255,187,82,.12);
  --crit-soft: rgba(255,99,99,.12);

  /* Type */
  --f-display: 'Space Grotesk', 'Pretendard', system-ui, sans-serif;
  --f-body: 'Pretendard', 'Space Grotesk', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  /* Radii */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;

  /* Shadow */
  --sh-1: 0 1px 0 rgba(255,255,255,.04) inset, 0 1px 2px rgba(0,0,0,.5);
  --sh-2: 0 18px 50px -20px rgba(0,0,0,.8);
  --sh-acid: 0 0 0 1px rgba(201,242,78,.35), 0 12px 40px -12px rgba(201,242,78,.30);

  /* Layout */
  --maxw: 1200px;
  --gutter: clamp(20px, 5vw, 64px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg-base);
  color: var(--ink-1);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01","cv01";
  letter-spacing: -0.01em;
}
::selection { background: var(--acid); color: var(--acid-ink); }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
h1,h2,h3,h4 { font-family: var(--f-display); font-weight: 600; color: var(--ink-0); margin: 0; letter-spacing: -0.025em; line-height: 1.05; }

/* ---- Atmosphere: mesh grid + glow ---- */
.bg-mesh {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 25%, transparent 78%);
          mask-image: radial-gradient(120% 90% at 50% 0%, #000 25%, transparent 78%);
  opacity: .5;
}
.bg-glow {
  position: fixed; z-index: 0; pointer-events: none;
  width: 70vw; height: 60vh; left: 50%; top: -10vh; transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, var(--acid-glow), transparent 70%);
  filter: blur(20px);
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Layout helpers ---- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.relative { position: relative; z-index: 2; }
.section { padding-block: clamp(64px, 9vw, 130px); position: relative; z-index: 2; }

/* ---- Eyebrow / mono label ---- */
.eyebrow {
  font-family: var(--f-mono); font-size: 12px; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase; color: var(--acid-dim);
  display: inline-flex; align-items: center; gap: 9px;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--acid-dim); display: inline-block; }
.eyebrow.center::before { display: none; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--f-body); font-weight: 500; font-size: 14.5px;
  padding: 0 18px; height: 44px; border-radius: var(--r-sm);
  border: 1px solid transparent; transition: .18s cubic-bezier(.2,.7,.3,1); white-space: nowrap;
  letter-spacing: -0.01em;
}
.btn svg { width: 16px; height: 16px; }
.btn-acid { background: var(--acid); color: var(--acid-ink); font-weight: 600; }
.btn-acid:hover { background: var(--acid-bright); box-shadow: var(--sh-acid); transform: translateY(-1px); }
.btn-ghost { background: rgba(255,255,255,.03); color: var(--ink-0); border-color: var(--line-2); }
.btn-ghost:hover { background: rgba(255,255,255,.07); border-color: var(--line-3); }
.btn-quiet { color: var(--ink-1); }
.btn-quiet:hover { color: var(--ink-0); background: rgba(255,255,255,.04); }
.btn-lg { height: 52px; font-size: 15.5px; padding: 0 24px; }
.btn-sm { height: 36px; font-size: 13px; padding: 0 13px; }

/* ---- Chips / tags / status ---- */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .04em;
  padding: 5px 10px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.04); border: 1px solid var(--line-2); color: var(--ink-2);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.crit { background: var(--crit); box-shadow: 0 0 0 3px var(--crit-soft); }
.dot.live { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

/* ---- Card ---- */
.card {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-base));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}

/* ---- Nav ---- */
.nav {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-base) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
}
.nav-inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav-links a {
  font-size: 14px; color: var(--ink-2); padding: 8px 12px; border-radius: var(--r-xs);
  transition: .15s; font-weight: 450; white-space: nowrap;
}
.nav-links a:hover { color: var(--ink-0); background: rgba(255,255,255,.04); }
.nav-links a.active { color: var(--ink-0); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Mobile hamburger — hidden on desktop, shown <=860px (see responsive block) */
.nav-burger {
  display: none;
  width: 40px; height: 40px; flex: none;
  align-items: center; justify-content: center;
  background: rgba(255,255,255,.03); color: var(--ink-1);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  transition: .15s;
}
.nav-burger:hover { color: var(--ink-0); background: rgba(255,255,255,.07); border-color: var(--line-3); }
.nav-burger svg { width: 20px; height: 20px; }
.nav-burger .ico-close { display: none; }
.nav-burger[aria-expanded="true"] .ico-open { display: none; }
.nav-burger[aria-expanded="true"] .ico-close { display: block; }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-mark { width: 30px; height: 30px; flex: none; }
.logo-word { font-family: var(--f-display); font-weight: 600; font-size: 17px; color: var(--ink-0); letter-spacing: -.02em; }
.logo-word b { color: var(--acid); font-weight: 600; }

/* Lang toggle */
.lang {
  display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-pill);
  overflow: hidden; font-family: var(--f-mono); font-size: 11.5px;
}
.lang button { background: transparent; border: none; color: var(--ink-3); padding: 6px 11px; transition: .15s; }
.lang button.on { background: var(--acid); color: var(--acid-ink); font-weight: 600; }
.lang button:not(.on):hover { color: var(--ink-1); }

/* ---- Footer ---- */
.footer { border-top: 1px solid var(--line); padding-block: 60px 40px; position: relative; z-index: 2; background: var(--bg-base); }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 40px 24px; }
.footer h5 { font-family: var(--f-mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 16px; font-weight: 500; }
.footer a { display: block; color: var(--ink-2); font-size: 14px; padding: 5px 0; transition: .15s; }
.footer a:hover { color: var(--ink-0); }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; margin-top: 52px; padding-top: 26px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; font-family: var(--f-mono); }

/* ---- Code / terminal ---- */
.term {
  font-family: var(--f-mono); font-size: 13px; background: var(--bg-1);
  border: 1px solid var(--line-2); border-radius: var(--r-md); overflow: hidden;
}
.term-bar { display: flex; align-items: center; gap: 7px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.02); }
.term-bar .tdot { width: 10px; height: 10px; border-radius: 50%; background: var(--bg-4); }
.term-body { padding: 16px 16px; line-height: 1.85; color: var(--ink-1); white-space: pre; overflow-x: auto; }
.term-body .c-dim { color: var(--ink-3); }
.term-body .c-acid { color: var(--acid); }
.term-body .c-cyan { color: var(--cyan); }
.term-body .c-ok { color: var(--ok); }

/* ---- Utility ---- */
.mono { font-family: var(--f-mono); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.center { text-align: center; }
.acid { color: var(--acid); }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* reveal on load — content is VISIBLE by default. The hidden start-state only
   applies when JS adds .preload, and JS only does that when the tab is actually
   visible (so a stalled/hidden iframe never traps content at opacity 0). */
[data-reveal] { transition: opacity .7s cubic-bezier(.2,.7,.3,1), transform .7s cubic-bezier(.2,.7,.3,1); }
.preload [data-reveal] { opacity: 0; transform: translateY(14px); }
.preload.revealed [data-reveal] { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .05ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
}

/* ---- Responsive base ---- */
@media (max-width: 860px) {
  .nav-inner { gap: 12px; }
  .nav-burger { display: inline-flex; }
  /* The desktop inline nav becomes a stacked dropdown panel under the bar.
     Collapsed by default; .open (toggled by the burger script) reveals it. */
  .nav-links {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    margin: 0; padding: 10px var(--gutter) 14px;
    background: color-mix(in srgb, var(--bg-base) 96%, transparent);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--sh-2);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 12px; font-size: 15px; border-radius: var(--r-sm); }
  /* auth actions surface inside the dropdown on mobile (hidden in the cramped bar) */
  .nav-links .nav-cta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
  .nav-links .nav-cta a { justify-content: center; }
  .nav-right .btn { display: none; }
  /* the nav already establishes the positioning context via position:sticky */
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
/* .nav-cta lives inside the mobile dropdown only — never on desktop */
.nav-cta { display: none; }
