/* ------------------------------------------------------------------
   Anton Rusakov — personal site
   Direction: instrument-grade / warm-engineered.
   Amber-phosphor accent, flat panels, Bricolage + Hanken + Spline Mono.
   Vanilla CSS, static, no build.
------------------------------------------------------------------- */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  /* light (default) — warm off-white, ink near-black, burnt-amber accent */
  --bg:         oklch(0.984 0.004 85);
  --bg-2:       oklch(0.965 0.006 85);
  --surface:    oklch(0.997 0.002 85);
  --surface-2:  oklch(0.955 0.007 85);
  --fg:         oklch(0.235 0.014 68);
  --fg-soft:    oklch(0.36 0.014 68);
  --muted:      oklch(0.505 0.013 70);
  --border:     oklch(0.905 0.008 82);
  --border-2:   oklch(0.845 0.010 82);
  --accent:     oklch(0.565 0.152 52);   /* burnt amber — passes contrast on light */
  --accent-2:   oklch(0.700 0.160 62);   /* brighter fill */
  --accent-ink: oklch(0.985 0.010 85);   /* text on accent fill */
  --trace:      oklch(0.660 0.170 58);   /* signal trace on light */
  --grid-line:  oklch(0.905 0.008 82 / 0.9);

  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --font-body:    'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-mono:    'Spline Sans Mono', ui-monospace, 'SFMono-Regular', monospace;

  --radius:    13px;
  --radius-sm: 9px;
  --maxw:      1080px;

  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);       /* ~ ease-out-expo */
  --ease-out-q: cubic-bezier(0.22, 1, 0.36, 1);

  --z-sticky: 40;
  --z-skip:   100;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         oklch(0.170 0.008 68);
    --bg-2:       oklch(0.150 0.008 68);
    --surface:    oklch(0.208 0.009 70);
    --surface-2:  oklch(0.250 0.010 70);
    --fg:         oklch(0.952 0.006 85);
    --fg-soft:    oklch(0.820 0.010 82);
    --muted:      oklch(0.700 0.013 80);
    --border:     oklch(0.300 0.011 70);
    --border-2:   oklch(0.380 0.013 70);
    --accent:     oklch(0.800 0.145 68);   /* amber phosphor */
    --accent-2:   oklch(0.800 0.145 68);
    --accent-ink: oklch(0.180 0.020 68);
    --trace:      oklch(0.800 0.150 68);
    --grid-line:  oklch(0.300 0.011 70 / 0.7);
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(20px, 5vw, 44px); }

::selection { background: color-mix(in oklch, var(--accent) 30%, transparent); color: var(--fg); }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------- Type scale ---------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin: 0 0 0.4em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.6rem, 7vw, 5rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
h3 { font-size: 1.14rem; letter-spacing: -0.018em; }
p  { margin: 0 0 1em; text-wrap: pretty; }

.mono {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  background: color-mix(in oklch, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 11px;
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em;
  color: var(--fg); text-decoration: none; font-size: 1.0rem;
}
.brand .monogram {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--fg); color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.78rem; font-weight: 500; letter-spacing: 0;
  transition: background 0.35s var(--ease-out), color 0.35s var(--ease-out);
}
.brand:hover .monogram { background: var(--accent); color: var(--accent-ink); }
.nav-controls { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  position: relative;
  color: var(--muted); text-decoration: none; font-weight: 500;
  padding: 7px 13px; border-radius: 8px; font-size: 0.94rem;
  transition: color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}
.nav-links a:hover { color: var(--fg); background: var(--surface-2); }
.nav-links a.active { color: var(--fg); }
.nav-links a.active::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 3px;
  height: 2px; border-radius: 2px; background: var(--accent);
}
.language-picker {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted);
}
.language-picker svg { width: 17px; height: 17px; flex: none; }
.language-picker select {
  width: 104px;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  font: 500 0.86rem/1.2 var(--font-body);
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}
.language-picker select:hover { border-color: var(--accent); }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ---------- Main rhythm ---------- */
main { padding: clamp(40px, 8vw, 88px) 0 24px; }
section { margin: 0 0 clamp(48px, 9vw, 104px); }

/* ---------- Hero ---------- */
.hero { position: relative; }
.hero .coord {
  display: inline-flex; align-items: center; gap: 9px;
  margin: 0 0 22px;
}
.hero .coord::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in oklch, var(--accent) 60%, transparent);
  animation: ping 2.6s var(--ease-out) infinite;
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklch, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 8px color-mix(in oklch, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--accent) 0%, transparent); }
}
.hero h1 { margin: 0 0 0.22em; }
.hero h1 .amp { color: var(--accent); }
.hero .tagline {
  color: var(--fg-soft); font-size: clamp(1.08rem, 2.1vw, 1.32rem);
  max-width: 40ch; margin: 0 0 1.7em; line-height: 1.5;
}
.hero .tagline strong { color: var(--fg); font-weight: 600; }

/* signal trace */
.trace-wrap {
  position: relative;
  margin: 6px 0 34px;
  height: clamp(60px, 12vw, 104px);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.trace-wrap svg { display: block; width: 100%; height: 100%; }
.trace-line {
  fill: none; stroke: var(--trace); stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 5px color-mix(in oklch, var(--trace) 45%, transparent));
}
.trace-line.draw {
  stroke-dasharray: 2600; stroke-dashoffset: 2600;
  animation: draw 1.9s var(--ease-out) 0.25s forwards;
}
.trace-ticks line { stroke: var(--grid-line); stroke-width: 1; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 11px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 11px 18px; border-radius: 10px; text-decoration: none;
  font-family: var(--font-body); font-weight: 600; font-size: 0.94rem;
  border: 1px solid var(--border-2); color: var(--fg);
  background: var(--surface);
  transition: transform 0.25s var(--ease-out), border-color 0.25s var(--ease-out),
              background 0.25s var(--ease-out), color 0.25s var(--ease-out);
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.btn-primary {
  background: var(--accent-2); color: var(--accent-ink); border-color: transparent;
}
.btn-primary:hover { border-color: transparent; filter: brightness(1.04); }

/* ---------- Highlights (home) ---------- */
.highlights { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(14px, 1.6vw, 20px); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(22px, 2.6vw, 30px);
}
.panel .tag {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent);
  display: block; margin-bottom: 14px;
}
.panel h3 { margin: 0 0 0.4em; }
.panel p  { color: var(--muted); margin: 0; font-size: 0.96rem; }

.feature { grid-column: span 7; display: flex; flex-direction: column; }
.feature.alt { grid-column: span 5; }
.feature .big {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.5rem, 2.6vw, 2rem); letter-spacing: -0.025em;
  line-height: 1.08; margin: 0 0 0.35em; color: var(--fg);
}

/* spec list — replaces identical card grid */
.spec { grid-column: span 12; padding: 0; overflow: hidden; }
.spec-row {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: baseline;
  gap: clamp(14px, 2.4vw, 30px);
  padding: clamp(18px, 2.2vw, 24px) clamp(22px, 2.6vw, 30px);
  border-top: 1px solid var(--border);
  transition: background 0.25s var(--ease-out);
}
.spec-row:first-child { border-top: none; }
.spec-row:hover { background: var(--surface-2); }
.spec-row .idx { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); }
.spec-row h3 { margin: 0 0 0.25em; font-size: 1.08rem; }
.spec-row p  { margin: 0; color: var(--muted); font-size: 0.94rem; max-width: 52ch; }
.spec-row .kit { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); text-align: right; white-space: nowrap; }

/* experience CTA */
.cta {
  grid-column: span 12;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: clamp(22px, 2.6vw, 30px);
  text-decoration: none; color: inherit;
  transition: border-color 0.25s var(--ease-out), transform 0.25s var(--ease-out), background 0.25s var(--ease-out);
}
.cta:hover { border-color: var(--accent); transform: translateY(-2px); }
.cta .tag { color: var(--accent); }
.cta h3 { margin: 0.1em 0 0.3em; }
.cta p { margin: 0; color: var(--muted); font-size: 0.96rem; }
.cta .arrow {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; color: var(--accent);
  border: 1px solid var(--border-2);
  transition: transform 0.3s var(--ease-out-q), background 0.25s var(--ease-out), color 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
}
.cta:hover .arrow { background: var(--accent); color: var(--accent-ink); border-color: transparent; transform: translateX(4px); }

/* ---------- Resume ---------- */
.lead {
  font-size: clamp(1.06rem, 1.9vw, 1.22rem); color: var(--fg-soft);
  max-width: 64ch; line-height: 1.55;
}
.lead em { font-style: normal; color: var(--accent); font-weight: 600; }

.section-title {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: clamp(26px, 3vw, 38px);
}
.section-title h2 { margin: 0; white-space: nowrap; }
.section-title::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.section-title .mono { color: var(--accent); }

.timeline { display: grid; gap: clamp(22px, 3vw, 32px); }
.entry {
  position: relative; padding-left: 30px;
  border-left: 1px solid var(--border-2);
}
.entry:last-child { border-left-color: transparent; }
.entry::before {
  content: ""; position: absolute; left: -5px; top: 6px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
  transition: background 0.25s var(--ease-out), box-shadow 0.35s var(--ease-out);
}
.entry:hover::before { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 18%, transparent); }
.entry .role { font-family: var(--font-display); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.015em; }
.entry .org  { color: var(--fg); font-weight: 600; margin-top: 1px; }
.entry .meta { font-family: var(--font-mono); color: var(--muted); font-size: 0.76rem; letter-spacing: 0.01em; margin: 5px 0 10px; }
.entry ul { margin: 0; padding-left: 18px; }
.entry li { margin-bottom: 6px; color: var(--muted); }
.entry li strong { color: var(--fg); font-weight: 600; }
.entry li::marker { color: var(--accent); }

.badge {
  display: inline-block; font-family: var(--font-mono);
  font-size: 0.66rem; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in oklch, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in oklch, var(--accent) 32%, transparent);
  border-radius: 6px; padding: 2px 8px; margin-left: 8px; vertical-align: middle;
}

/* skills as spec panel */
.skills { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.skills .spec-row { grid-template-columns: 1fr; gap: 6px; }
.skills .spec-row h3 { font-size: 1.05rem; }
.skills .spec-row p  { max-width: 68ch; }
@media (min-width: 720px) {
  .skills { display: grid; grid-template-columns: 1fr 1fr; }
  .skills .spec-row:nth-child(2) { border-top: none; }
  .skills .spec-row:nth-child(odd)  { border-right: 1px solid var(--border); }
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip {
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--fg-soft);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px;
}

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(14px, 2vw, 20px); }
.fact {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: clamp(20px, 2.4vw, 26px); background: var(--surface);
}
.fact .n { font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 1.9rem); font-weight: 800; letter-spacing: -0.02em; }
.fact .l { font-family: var(--font-mono); color: var(--muted); font-size: 0.76rem; margin-top: 2px; }
.refs { color: var(--muted); margin-top: 20px; font-size: 0.94rem; max-width: 68ch; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); margin-top: clamp(40px, 8vw, 80px);
  padding: 30px 0; color: var(--muted); font-size: 0.9rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; align-items: center; }
.site-footer .mono { color: var(--muted); }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.foot-links { display: flex; gap: 18px; }

/* ---------- Accessibility ---------- */
a:focus-visible, .btn:focus-visible, .nav-links a:focus-visible, .cta:focus-visible,
.language-picker select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px;
}
.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--accent); color: var(--accent-ink);
  padding: 9px 15px; border-radius: 8px; z-index: var(--z-skip); font-weight: 600;
}
.skip:focus { left: 12px; }

/* ---------- Motion: load reveal (progressive enhancement) ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(14px); }
.js .revealed [data-reveal],
.js [data-reveal].revealed {
  opacity: 1; transform: none;
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.js [data-reveal][style*="--d"] { transition-delay: var(--d); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
      transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .trace-line.draw { stroke-dashoffset: 0; }
  .js [data-reveal] { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .feature, .feature.alt { grid-column: span 12; }
  .spec-row { grid-template-columns: 34px 1fr; }
  .spec-row .kit { grid-column: 2; text-align: left; margin-top: 4px; }
}
@media (max-width: 680px) {
  .brand-name { display: none; }
  .nav { gap: 8px; }
  .nav-controls { gap: 7px; }
  .language-picker { gap: 5px; }
  .language-picker svg { width: 15px; height: 15px; }
  .language-picker select { width: 82px; font-size: 0.8rem; padding-inline: 6px; }
}
@media (max-width: 560px) {
  .facts { grid-template-columns: 1fr; }
  .cta { flex-direction: column; align-items: flex-start; }
  .nav-links a { padding: 7px 6px; font-size: 0.82rem; }
  .nav-links a.active::after { left: 6px; right: 6px; }
  .foot-links { gap: 14px; }
}
