/* ============================================================
   BaytChain Dev — styles
   Brand: navy + gold (same family as baytchain.uz), developer-dark by default.
   Gold on white is only 2.4:1, so gold *text* on light surfaces resolves to
   --accent-text (#8A6D12, 4.8:1). Keep that split if you add gold text.
   ============================================================ */

:root {
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --navy: #1E2761;
  --gold: #D4AF37;
  --ice: #CADCFC;

  /* dark theme (default) */
  --bg: #080B20;
  --bg-solid: #0B0F2B;
  --hdr-bg: rgba(8, 11, 32, .82);
  --surface: rgba(17, 23, 62, .74);
  --surface-2: rgba(30, 39, 97, .5);
  --text: #EAF0FF;
  --muted: #A3AED9;
  --line: rgba(202, 220, 252, .14);
  --line-strong: rgba(202, 220, 252, .3);
  --grid: rgba(202, 220, 252, .045);
  --accent: #D4AF37;
  --accent-text: #D4AF37;
  --grad-1: #D4AF37;
  --grad-2: #CADCFC;
  --btn-bg: #D4AF37;
  --btn-fg: #0E1230;
  --focus: #CADCFC;
  --ok: #5BE3A0;
  --err: #FF8A8A;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, .7);

  /* code window stays dark in both themes */
  --code-bg: rgba(8, 11, 32, .9);
  --code-text: #D6E0FF;
  --c-k: #C792EA; --c-s: #C3E88D; --c-f: #82AAFF; --c-n: #F78C6C; --c-c: #6C7BB0; --c-t: #FFCB6B;

  /* read by the background canvas: "r g b" triplets + overall strength */
  --cv-a: 212 175 55;
  --cv-b: 202 220 252;
  --cv-alpha: 1;

  color-scheme: dark;
}

/* Light theme. Declared twice on purpose: once for an explicit choice, once for
   "no choice yet + OS prefers light" — CSS cannot share a block between the two. */
:root[data-theme="light"] {
  --bg: #F3F5FC;
  --bg-solid: #F3F5FC;
  --hdr-bg: rgba(243, 245, 252, .86);
  --surface: rgba(255, 255, 255, .8);
  --surface-2: rgba(30, 39, 97, .06);
  --text: #121634;
  --muted: #444E78;
  --line: rgba(30, 39, 97, .16);
  --line-strong: rgba(30, 39, 97, .34);
  --grid: rgba(30, 39, 97, .06);
  --accent: #C9A227;
  --accent-text: #8A6D12;
  --grad-1: #8A6D12;
  --grad-2: #1E2761;
  --btn-bg: #1E2761;
  --btn-fg: #FFFFFF;
  --focus: #1E2761;
  --ok: #0B7A4B;
  --err: #B42318;
  --shadow: 0 24px 60px -30px rgba(30, 39, 97, .35);
  --cv-a: 138 109 18;
  --cv-b: 30 39 97;
  --cv-alpha: 1;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #F3F5FC;
    --bg-solid: #F3F5FC;
    --hdr-bg: rgba(243, 245, 252, .86);
    --surface: rgba(255, 255, 255, .8);
    --surface-2: rgba(30, 39, 97, .06);
    --text: #121634;
    --muted: #444E78;
    --line: rgba(30, 39, 97, .16);
    --line-strong: rgba(30, 39, 97, .34);
    --grid: rgba(30, 39, 97, .06);
    --accent: #C9A227;
    --accent-text: #8A6D12;
    --grad-1: #8A6D12;
    --grad-2: #1E2761;
    --btn-bg: #1E2761;
    --btn-fg: #FFFFFF;
    --focus: #1E2761;
    --ok: #0B7A4B;
    --err: #B42318;
    --shadow: 0 24px 60px -30px rgba(30, 39, 97, .35);
    --cv-a: 138 109 18;
    --cv-b: 30 39 97;
    --cv-alpha: 1;
    color-scheme: light;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  font: 400 16px/1.65 var(--sans);
  color: var(--text);
  /* No background here: html carries it. A body background would paint over the
     negative-z-index canvas and grid and hide the whole animated backdrop. */
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
/* faint "graph paper" under the animated canvas */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 35%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse at 50% 35%, #000 25%, transparent 78%);
}
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--btn-bg); color: var(--btn-fg); padding: 10px 16px; border-radius: 8px; text-decoration: none;
}
.skip:focus { top: 12px; }

#progress {
  position: fixed; top: 0; left: 0; width: 100%; height: 3px; z-index: 70;
  transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), var(--ice));
}

/* ---------- header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  border-bottom: 1px solid transparent;
  transition: background .25s, border-color .25s;
}
.site-header.scrolled {
  background: var(--hdr-bg);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.bar { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.logo img { width: 32px; height: 32px; border-radius: 8px; }
.logo small {
  font: 500 .72rem/1 var(--mono); color: var(--accent-text);
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 4px 6px;
}
.nav { margin-left: auto; display: flex; align-items: center; gap: 28px; }
.nav-links { display: flex; gap: 24px; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: .95rem; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.actions { display: flex; align-items: center; gap: 10px; }

.lang { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.lang button {
  background: none; border: 0; cursor: pointer; padding: 8px 10px; min-width: 38px;
  font: 600 .74rem/1 var(--mono); color: var(--muted);
}
.lang button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-fg); }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; cursor: pointer;
  background: none; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text);
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-sun { display: none; }
:root[data-theme="light"] .theme-sun { display: block; }
:root[data-theme="light"] .theme-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-sun { display: block; }
  :root:not([data-theme]) .theme-moon { display: none; }
}
.burger { display: none; margin-left: auto; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 12px 22px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s, background .2s;
}
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -10px rgba(212, 175, 55, .55); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); transform: translateY(-2px); }
.btn-sm { min-height: 40px; padding: 8px 16px; font-size: .9rem; }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; box-shadow: none; }

/* ---------- sections ---------- */
section { position: relative; padding: clamp(72px, 11vw, 132px) 0; }
.sec-head { max-width: 680px; margin: 0 auto clamp(36px, 6vw, 60px); text-align: center; text-shadow: 0 0 28px var(--bg); }
.eyebrow { font: 500 .85rem/1.4 var(--mono); color: var(--accent-text); margin-bottom: 14px; }
.eyebrow .sl { opacity: .6; margin-right: .4em; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); line-height: 1.15; letter-spacing: -.02em; }
.sec-head p { margin-top: 14px; color: var(--muted); font-size: 1.05rem; }

/* ---------- hero ---------- */
.hero { min-height: 100svh; display: flex; align-items: center; padding-top: 120px; padding-bottom: 80px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(32px, 5vw, 64px); align-items: center; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.9rem); line-height: 1.08; letter-spacing: -.025em; margin: 18px 0 22px; text-shadow: 0 0 40px var(--bg); }
.grad {
  display: block;
  color: var(--accent-text);
  background: linear-gradient(90deg, var(--grad-1), var(--grad-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lead { color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.15rem); max-width: 560px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.scroll-hint { display: inline-flex; align-items: center; gap: 10px; margin-top: 44px; color: var(--muted); font: 500 .8rem/1 var(--mono); }
.mouse { width: 20px; height: 32px; border: 1.5px solid var(--line-strong); border-radius: 12px; position: relative; }
.mouse::after {
  content: ""; position: absolute; left: 50%; top: 6px; width: 3px; height: 6px; margin-left: -1.5px;
  border-radius: 2px; background: var(--accent); animation: wheel 1.8s ease-in-out infinite;
}
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(10px); opacity: 0; } 100% { opacity: 0; } }

/* ---------- code / terminal windows ---------- */
.win {
  border: 1px solid var(--line-strong); border-radius: 14px; background: var(--code-bg);
  box-shadow: var(--shadow); overflow: hidden; min-width: 0;
}
.win-bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid rgba(202, 220, 252, .12); background: rgba(255, 255, 255, .03);
}
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.r { background: #FF5F57; } .dot.y { background: #FEBC2E; } .dot.g { background: #28C840; }
.win-title { margin-left: 8px; font: 500 12px/1 var(--mono); color: #8D99C8; }
.tabs { display: flex; gap: 2px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; background: none; border: 0; cursor: pointer; border-radius: 6px;
  padding: 6px 10px; font: 500 12px/1 var(--mono); color: #8D99C8;
}
.tab[aria-selected="true"] { color: #EAF0FF; background: rgba(202, 220, 252, .12); }

.code, .term {
  font: 400 13.5px/1.65 var(--mono); color: var(--code-text);
  white-space: pre; overflow: hidden; tab-size: 2;
}
.code { counter-reset: ln; padding: 14px 0; min-height: calc(13 * 1.65em + 28px); }
.ln { counter-increment: ln; position: relative; min-height: 1.65em; padding: 0 14px 0 52px; }
.ln::before { content: counter(ln); position: absolute; left: 0; width: 36px; text-align: right; color: #4C5888; }
.code .k { color: var(--c-k); } .code .s { color: var(--c-s); } .code .f { color: var(--c-f); }
.code .n { color: var(--c-n); } .code .c { color: var(--c-c); font-style: italic; } .code .t { color: var(--c-t); }
.caret {
  display: inline-block; width: .55em; height: 1.15em; margin-left: 1px; vertical-align: text-bottom;
  background: var(--accent); animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.win-foot {
  display: flex; justify-content: space-between; gap: 12px; padding: 7px 14px;
  border-top: 1px solid rgba(202, 220, 252, .1); font: 500 11px/1 var(--mono); color: #6C7BB0;
}

.term { padding: 16px 18px; min-height: 196px; }
.term .p { color: var(--accent); } .term .ok { color: #5BE3A0; } .term .dim { color: #6C7BB0; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.card {
  position: relative; overflow: hidden; padding: 28px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .3s, border-color .3s, box-shadow .3s;
}
.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(212, 175, 55, .16), transparent 70%);
}
.card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }
.ico {
  width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: 18px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--accent-text);
}
.ico svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.card h3 { font-size: 1.15rem; line-height: 1.3; margin-bottom: 10px; letter-spacing: -.01em; }
.card p { color: var(--muted); font-size: .96rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.tags span { font: 500 .72rem/1 var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }

/* ---------- process timeline ---------- */
.tl { --p: 0; position: relative; max-width: 760px; margin: 0 auto; padding-left: 64px; }
.tl::before { content: ""; position: absolute; left: 19px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.tl-fill {
  position: absolute; left: 19px; top: 8px; width: 2px;
  height: calc((100% - 16px) * var(--p));
  background: linear-gradient(var(--accent), var(--ice)); box-shadow: 0 0 14px var(--accent);
}
.step { position: relative; padding-bottom: 42px; opacity: .45; transition: opacity .45s; }
.step:last-child { padding-bottom: 0; }
.step.on { opacity: 1; }
.step .node {
  position: absolute; left: -55px; top: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-solid); border: 2px solid var(--line-strong); transition: border-color .4s, box-shadow .4s;
}
.step.on .node { border-color: var(--accent); box-shadow: 0 0 0 5px rgba(212, 175, 55, .18); }
.step .tag { font: 500 .8rem/1 var(--mono); color: var(--accent-text); margin-bottom: 8px; }
.step h3 { font-size: 1.3rem; letter-spacing: -.01em; margin-bottom: 6px; }
.step p { color: var(--muted); max-width: 520px; }

/* ---------- workflow ---------- */
.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.split .sec-head { text-align: left; margin: 0 0 28px; max-width: none; }
.checks { display: grid; gap: 16px; }
.checks li { display: flex; gap: 14px; align-items: flex-start; color: var(--muted); }
.checks li::before {
  content: ""; flex: none; width: 22px; height: 22px; margin-top: 2px; border-radius: 50%;
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D4AF37' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 13px no-repeat;
  border: 1px solid var(--line-strong);
}

/* ---------- stack ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 820px; margin: 0 auto; }
.chip {
  font: 500 .92rem/1 var(--mono); padding: 12px 18px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  animation: bob 6s ease-in-out infinite; animation-delay: var(--bd, 0s);
  transition: border-color .25s, color .25s;
}
.chip:hover { border-color: var(--accent); color: var(--accent-text); }
.chip:nth-child(3n) { --bd: -2s; } .chip:nth-child(3n+1) { --bd: -4s; } .chip:nth-child(4n) { --bd: -1s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---------- product ---------- */
.product {
  display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center;
  padding: clamp(24px, 4vw, 40px); border-radius: 22px; background: var(--surface); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.product img { width: 76px; height: 76px; border-radius: 18px; }
.product h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 8px; }
.product p { color: var(--muted); max-width: 560px; }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(24px, 4vw, 48px); align-items: start; }
.form { padding: clamp(22px, 3vw, 34px); border-radius: 18px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 18px; }
.field { display: grid; gap: 7px; }
.field label { font: 500 .82rem/1.2 var(--mono); color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface-2); transition: border-color .2s, box-shadow .2s;
}
.field select option { color: #121634; background: #fff; }
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212, 175, 55, .22); }
.field [aria-invalid="true"] { border-color: var(--err); }
.field .err { color: var(--err); font-size: .85rem; min-height: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.status { min-height: 1.5em; font-weight: 500; }
.status.ok { color: var(--ok); } .status.bad { color: var(--err); }
.side { display: grid; gap: 16px; }
.side .card { padding: 22px; }
.side a { color: var(--accent-text); font-weight: 600; text-underline-offset: 3px; }
.side p { margin-top: 6px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 40px; color: var(--muted); font-size: .9rem; }
.foot { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
.foot a { text-underline-offset: 3px; }

/* ---------- reveal on scroll ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .75s ease, transform .75s ease; }
.js [data-reveal].in { opacity: 1; transform: none; }
.js [data-reveal="1"] { transition-delay: .08s; } .js [data-reveal="2"] { transition-delay: .16s; }
.js [data-reveal="3"] { transition-delay: .24s; } .js [data-reveal="4"] { transition-delay: .32s; }
.js [data-reveal="5"] { transition-delay: .4s; }

/* ---------- 404 ---------- */
.nf { min-height: 100svh; display: grid; place-items: center; text-align: center; padding: 24px; }
.nf h1 { font-family: var(--mono); font-size: clamp(3rem, 12vw, 7rem); margin: 0 0 8px; }
.nf p { color: var(--muted); margin-bottom: 28px; }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .hero-grid, .split, .contact-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 104px; }
  .split .sec-head { text-align: center; }
}
@media (max-width: 860px) {
  .burger { display: inline-grid; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    flex-direction: column; align-items: stretch; gap: 18px; padding: 18px 20px 26px;
    background: var(--bg-solid); border-bottom: 1px solid var(--line);
  }
  .nav-open .nav { display: flex; }
  .site-header.nav-open { background: var(--bg-solid); }
  .nav-links { flex-direction: column; gap: 4px; }
  .nav-links a { padding: 12px 4px; font-size: 1.05rem; }
  .actions { flex-wrap: wrap; }
  .actions .btn { flex: 1 1 100%; }
}
@media (max-width: 640px) {
  .product { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .code, .term { font-size: 12px; }
  .scroll-hint span:last-child { display: none; }
  .card { padding: 22px; }
  .tl { padding-left: 52px; }
  .step .node { left: -49px; }
  .tl::before, .tl-fill { left: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
