/* ============================================================
   Syntax Studio — site stylesheet
   Built on the Atasuai Design System token layer.
   Dark-first, code-native. Light theme via [data-theme="light"].
   ============================================================ */

/* ---- Fonts -------------------------------------------------- */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-VariableFont_opsz_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-stretch: 75% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-Italic-VariableFont_opsz_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* ---- Theme tokens ------------------------------------------ */
:root {
  /* dark is the default surface system */
  --ink-0:   #07090E;   /* deepest bg */
  --ink-1:   #0B0E14;   /* page bg */
  --ink-2:   #11151D;   /* surface */
  --ink-3:   #161C27;   /* raised surface */
  --ink-4:   #1E2632;   /* hover surface */
  --line:    rgba(255,255,255,0.09);
  --line-2:  rgba(255,255,255,0.16);
  --tx-0:    #EEF2F8;   /* primary text */
  --tx-1:    #A9B4C4;   /* secondary */
  --tx-2:    #6F7C8E;   /* muted */
  --accent:  #2F8BFF;   /* brand blue 500 */
  --accent-2:#66A6FF;   /* brand blue 400 — hover on dark */
  --accent-soft: rgba(47,139,255,0.14);
  --accent-line: rgba(47,139,255,0.34);

  /* syntax-highlight accents (used sparingly) */
  --syn-key:  #729EFE;  /* keyword — blue */
  --syn-str:  #4ED197;  /* string — green */
  --syn-num:  #FFB454;  /* number — amber */
  --syn-fn:   #C792EA;  /* function — violet */
  --syn-com:  #5C6B7E;  /* comment — gray */
  --syn-tag:  #FF6E9C;  /* tag — pink */

  --grid-line: rgba(255,255,255,0.035);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 24px -12px rgba(0,0,0,0.6);
  --shadow-pop:  0 24px 60px -20px rgba(0,0,0,0.7);

  --maxw: 1200px;
  --nav-h: 68px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  color-scheme: dark;
}

[data-theme="light"] {
  --ink-0:   #EAEDF2;
  --ink-1:   #F7F8FA;
  --ink-2:   #FFFFFF;
  --ink-3:   #FFFFFF;
  --ink-4:   #F2F5FA;
  --line:    rgba(13,22,40,0.10);
  --line-2:  rgba(13,22,40,0.18);
  --tx-0:    #111722;
  --tx-1:    #3D4757;
  --tx-2:    #6B7686;
  --accent:  #1C7AF0;
  --accent-2:#135FC4;
  --accent-soft: rgba(28,122,240,0.10);
  --accent-line: rgba(28,122,240,0.28);
  --syn-key:  #2E6FE8;
  --syn-str:  #1B9E6B;
  --syn-num:  #C2410C;
  --syn-fn:   #8B5CF6;
  --syn-com:  #98A2B3;
  --syn-tag:  #DB2777;
  --grid-line: rgba(13,22,40,0.045);
  --shadow-card: 0 1px 2px rgba(16,24,40,0.05), 0 12px 28px -16px rgba(16,24,40,0.22);
  --shadow-pop:  0 24px 60px -20px rgba(16,24,40,0.22);
  color-scheme: light;
}

/* ---- Reset / base ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-variation-settings: 'opsz' 16;
  background: var(--ink-1);
  color: var(--tx-0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background var(--dur-base,200ms) var(--ease-standard,ease), color var(--dur-base,200ms) var(--ease-standard,ease), opacity .18s ease;
}
/* language fade-swap */
body.lang-fade { opacity: 0.32; }
/* CTA headline: EN/RU accent the 2nd phrase; KK accents the 1st, 2nd goes white */
[lang="kk"] .cta__inner h2 .cta-w1 { color: var(--accent); }
[lang="kk"] .cta__inner h2 .cta-w2 { color: var(--tx-0); }
@media (prefers-reduced-motion: reduce) { body { transition: background var(--dur-base,200ms) ease, color var(--dur-base,200ms) ease; } body.lang-fade { opacity: 0.7; } }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; }
p { margin: 0; }
figure, blockquote, figcaption { margin: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
::selection { background: var(--accent); color: #fff; }

.mono { font-family: var(--font-mono, 'Roboto Mono', monospace); }

/* ---- Layout helpers ---------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 28px; }
@media (max-width: 720px) { .wrap { padding-inline: 20px; } }
.section { padding-block: clamp(64px, 9vw, 132px); position: relative; }
.section--tight { padding-block: clamp(48px, 6vw, 88px); }

/* eyebrow / kicker */
.kicker {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  text-transform: none;
}

.eyebrow-num { color: var(--syn-com); }

.section-head { max-width: 760px; }
.section-head h2 {
  font-size: clamp(28px, 4.6vw, 48px);
  margin-top: 18px;
  font-variation-settings: 'opsz' 32;
  text-wrap: balance;
}
.section-head p {
  margin-top: 18px;
  font-size: clamp(16px, 1.5vw, 19px);
  color: var(--tx-1);
  max-width: 620px;
  text-wrap: pretty;
}

/* ---- Blueprint grid background ----------------------------- */
.grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(120% 80% at 50% 0%, #000 30%, transparent 78%);
  mask-image: radial-gradient(120% 80% at 50% 0%, #000 30%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  height: 46px; padding-inline: 22px;
  border-radius: var(--r-sm);
  font-size: 15px; font-weight: 500;
  border: 1px solid transparent;
  transition: transform var(--dur-fast,140ms) var(--ease-standard,ease),
              background var(--dur-fast,140ms) ease,
              border-color var(--dur-fast,140ms) ease,
              box-shadow var(--dur-fast,140ms) ease, color 140ms ease;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 8px 22px -10px var(--accent); }
.btn--primary:hover { background: var(--accent-2); transform: translateY(-2px); box-shadow: 0 12px 28px -10px var(--accent); }
[data-theme="light"] .btn--primary:hover { color: #fff; }
.btn--ghost { background: transparent; color: var(--tx-0); border-color: var(--line-2); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); background: var(--accent-soft); }
.btn--block { width: 100%; justify-content: center; }
.btn .btn__arr { transition: transform var(--dur-fast,140ms) var(--ease-standard,ease); }
.btn:hover .btn__arr { transform: translateX(3px); }

/* arrow text-link — outlined button */
.tlink {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono, monospace);
  font-size: 13px; color: var(--accent);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 11px 18px;
  transition: border-color var(--dur-fast,140ms) ease, background var(--dur-fast,140ms) ease;
}
.tlink:hover { border-color: var(--accent); background: var(--accent-soft); }
.tlink svg { width: 15px; height: 15px; transition: transform var(--dur-fast,140ms) var(--ease-standard,ease); }
.tlink:hover svg { transform: translateX(4px); }

/* ---- Navigation -------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  height: var(--nav-h);
  display: flex; align-items: center;
  border-bottom: 1px solid transparent;
  transition: background var(--dur-base,200ms) ease, border-color var(--dur-base,200ms) ease, backdrop-filter 200ms ease;
}
.nav.is-stuck {
  background: color-mix(in srgb, var(--ink-1) 78%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom-color: var(--line);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: 100%; }
.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__link {
  position: relative;
  font-size: 14px; color: var(--tx-1);
  padding: 8px 14px; border-radius: var(--r-sm);
  transition: color 140ms ease, background 140ms ease;
}
.nav__link:hover { color: var(--tx-0); background: var(--ink-3); }
.nav__link.is-active { color: var(--tx-0); }
.nav__link.is-active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 1.5px;
  background: var(--accent); border-radius: 2px;
}
.nav__right { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: transparent; color: var(--tx-1);
  transition: color 140ms, border-color 140ms, background 140ms;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent-line); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .ico-moon { display: none; }
[data-theme="light"] .theme-toggle .ico-sun { display: none; }
[data-theme="light"] .theme-toggle .ico-moon { display: block; }

.nav__burger { display: none; width: 40px; height: 40px; border-radius: var(--r-sm); border: 1px solid var(--line); background: transparent; color: var(--tx-0); place-items: center; }
.nav__burger svg { width: 20px; height: 20px; }

/* collapse nav into burger on smaller screens */
@media (max-width: 960px) {
  .nav__links { display: none; }
  .nav__cta { display: none; }
  .nav__burger { display: grid; }
  .nav__right { gap: 8px; }
}
/* very small phones (iPhone SE / 320px): tighten so the bar never overflows */
@media (max-width: 380px) {
  .wrap { padding-inline: 16px; }
  .nav__inner { gap: 10px; }
  .nav__right { gap: 6px; }
  .theme-toggle, .nav__burger { width: 36px; height: 36px; }
  .theme-toggle svg, .nav__burger svg { width: 17px; height: 17px; }
}

/* ---- Language switcher ------------------------------------- */
.lang { position: relative; }
.lang__btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: transparent; color: var(--tx-1);
  font-family: var(--font-mono, monospace); font-size: 12px; font-weight: 500; letter-spacing: 0.03em;
  transition: color 140ms, border-color 140ms, background 140ms;
}
.lang__btn:hover { color: var(--accent); border-color: var(--accent-line); }
.lang.is-open .lang__btn { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.lang__menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 156px; z-index: 90;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 150ms var(--ease-standard, ease), transform 150ms var(--ease-standard, ease), visibility 150ms;
}
.lang.is-open .lang__menu { opacity: 1; visibility: visible; transform: none; }
.lang__menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  color: var(--tx-1); font-size: 14px; padding: 9px 12px; border-radius: var(--r-sm);
  font-family: inherit; transition: background 120ms, color 120ms;
}
.lang__menu button:hover { background: var(--ink-4); color: var(--tx-0); }
.lang__menu button.is-active { color: var(--accent); }
.lang__menu button .code { font-family: var(--font-mono, monospace); font-size: 11px; color: var(--tx-2); }
.lang__menu button.is-active .code { color: var(--accent); }

/* ---- Logo -------------------------------------------------- */
.logo { display: inline-flex; align-items: center; gap: 11px; }
.logo__mark { width: 30px; height: 30px; flex: none; }
.logo__word { font-size: 18px; font-weight: 600; letter-spacing: -0.03em; }
.logo__word .dim { color: var(--tx-2); font-weight: 500; }
.logo__cursor { color: var(--accent); }

/* ---- Mobile menu ------------------------------------------- */
.mobile-menu {
  position: fixed; inset: 0; z-index: 80;
  background: var(--ink-1);
  padding: 24px 28px;
  display: flex; flex-direction: column;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  opacity: 0; transform: translateY(-14px);
  visibility: hidden;
  transition: opacity .32s ease, transform .44s cubic-bezier(.16,1,.3,1), visibility 0s linear .44s;
}
.mobile-menu.is-open {
  opacity: 1; transform: translateY(0); visibility: visible;
  transition: opacity .3s ease, transform .46s cubic-bezier(.16,1,.3,1);
}
/* staggered entrance for the links + footer */
.mobile-menu__links a, .mobile-menu__foot {
  opacity: 0; transform: translateY(12px);
  transition: opacity .4s ease, transform .5s cubic-bezier(.16,1,.3,1);
}
.mobile-menu.is-open .mobile-menu__links a,
.mobile-menu.is-open .mobile-menu__foot { opacity: 1; transform: none; }
.mobile-menu.is-open .mobile-menu__links a:nth-child(1) { transition-delay: .08s; }
.mobile-menu.is-open .mobile-menu__links a:nth-child(2) { transition-delay: .13s; }
.mobile-menu.is-open .mobile-menu__links a:nth-child(3) { transition-delay: .18s; }
.mobile-menu.is-open .mobile-menu__links a:nth-child(4) { transition-delay: .23s; }
.mobile-menu.is-open .mobile-menu__links a:nth-child(5) { transition-delay: .28s; }
.mobile-menu.is-open .mobile-menu__foot { transition-delay: .3s; }
@media (prefers-reduced-motion: reduce) {
  .mobile-menu, .mobile-menu__links a, .mobile-menu__foot { transition: opacity .15s ease; transform: none; }
}
.mobile-menu__top { display: flex; align-items: center; justify-content: space-between; height: var(--nav-h); }
.mobile-menu__links { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.mobile-menu__links a {
  font-size: 23px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3;
  padding: 14px 0; border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 14px;
  color: var(--tx-0);
}
.mobile-menu__links a:hover { color: var(--accent); }
.mobile-menu__foot { margin-top: auto; margin-bottom: clamp(20px, 6vh, 64px); }
.mobile-menu__social { display: flex; gap: 12px; justify-content: center; margin-top: 22px; }
.mobile-menu__social a {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--tx-1);
  transition: color .16s, border-color .16s, background .16s, transform .16s;
}
.mobile-menu__social a:hover {
  color: var(--accent); border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px);
}
.mobile-menu__social a svg { width: 21px; height: 21px; }
.mm-controls { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.mm-lang { display: flex; gap: 8px; flex: 1; }
.mm-lang button {
  flex: 1; height: 38px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: transparent; color: var(--tx-1); font-family: var(--font-mono, monospace);
  font-size: 12px; letter-spacing: 0.03em; cursor: pointer; transition: color 140ms, border-color 140ms, background 140ms;
}
.mm-lang button:hover { color: var(--accent); border-color: var(--accent-line); }
.mm-lang button.is-active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ---- Footer ------------------------------------------------ */
.footer { border-top: 1px solid var(--line); background: var(--ink-0); position: relative; }
.footer__grid {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px;
  padding-block: 64px 40px;
}
.footer__brand .logo { margin-bottom: 18px; }
.footer__brand p { color: var(--tx-2); font-size: 14px; max-width: 280px; }
.footer__social { display: flex; gap: 10px; margin-top: 20px; }
.footer__social a { width: 38px; height: 38px; border-radius: var(--r-sm); border: 1px solid var(--line); display: grid; place-items: center; color: var(--tx-1); transition: color 140ms, border-color 140ms, background 140ms; }
.footer__social a svg { width: 18px; height: 18px; }
.footer__social a:hover { color: #fff; border-color: var(--accent); background: var(--accent); }
.footer__col h4 { font-family: var(--font-mono,monospace); font-size: 12px; color: var(--tx-2); font-weight: 500; letter-spacing: 0.02em; margin-bottom: 16px; }
.footer__col a { display: block; font-size: 14px; color: var(--tx-1); padding: 6px 0; transition: color 140ms, transform 140ms; }
.footer__col a:hover { color: var(--accent); transform: translateX(3px); }
.footer__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 24px; border-top: 1px solid var(--line); font-size: 13px; color: var(--tx-2); flex-wrap: wrap; }
.footer__bar .mono { font-size: 12px; }
.status-dot { display: inline-flex; align-items: center; gap: 8px; }
.status-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--syn-str); box-shadow: 0 0 0 4px color-mix(in srgb, var(--syn-str) 22%, transparent); }
@media (max-width: 860px) { .footer__grid { grid-template-columns: 1fr 1fr; gap: 32px; } .footer__brand { grid-column: 1 / -1; } }

/* ---- Cards / tags ------------------------------------------ */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono,monospace); font-size: 10.5px;
  padding: 3px 8px; border-radius: var(--r-sm);
  border: 1px solid var(--line); color: var(--tx-1);
  background: var(--ink-2); white-space: nowrap;
}
.tag svg { width: 11px; height: 11px; color: var(--accent); }

.card {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
}

/* reveal on scroll — gated on .js so content is visible without/before JS */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease-decelerate, cubic-bezier(0,0,0,1)), transform .7s var(--ease-decelerate, cubic-bezier(0,0,0,1)); }
.js .reveal.is-in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .07s; }
.reveal[data-delay="2"] { transition-delay: .14s; }
.reveal[data-delay="3"] { transition-delay: .21s; }
.reveal[data-delay="4"] { transition-delay: .28s; }
.reveal[data-delay="5"] { transition-delay: .35s; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } }

/* ============================================================
   Reusable code-window component
   ============================================================ */
.codewin {
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--ink-3), var(--ink-2));
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  font-family: var(--font-mono,monospace);
}
.codewin__bar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink-0) 40%, var(--ink-2));
}
.codewin__dots { display: flex; gap: 7px; }
.codewin__dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--line-2); }
.codewin__dots i:nth-child(1){ background:#FF5F57; }
.codewin__dots i:nth-child(2){ background:#FEBC2E; }
.codewin__dots i:nth-child(3){ background:#28C840; }
.codewin__file { font-size: 12.5px; color: var(--tx-2); }
.codewin__file b { color: var(--tx-1); font-weight: 500; }
.codewin__body { padding: 18px 20px; font-size: 13.5px; line-height: 1.85; overflow-x: auto; }
.codewin__ln { display: block; white-space: pre; }
.c-com { color: var(--syn-com); }
.c-key { color: var(--syn-key); }
.c-str { color: var(--syn-str); }
.c-num { color: var(--syn-num); }
.c-fn  { color: var(--syn-fn); }
.c-tag { color: var(--syn-tag); }
.c-pun { color: var(--tx-2); }
.c-var { color: var(--tx-0); }
.caret { display: inline-block; width: 8px; height: 1.05em; background: var(--accent); vertical-align: text-bottom; margin-left: 2px; animation: blink 1.1s steps(2,start) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none; } }
