/* ============================================================
   site.css – alenpaunov.com
   One family (Geist, with Geist Mono only for dates and figures),
   the original violet / cyan palette and the hero dot field.
   ============================================================ */

:root {
  /* deep indigo instead of near-black */
  --bg: #08070e;
  --bg-2: #0d0c17;
  --line: rgba(255, 255, 255, 0.09);
  --text: #eceaf4;
  --muted: #8d8a9e;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --accent: #ff6a3a;
  --grad: linear-gradient(100deg, var(--violet) 0%, var(--accent) 100%);

  --font: "Geist", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;

  --nav-h: 84px;
  --pad-x: clamp(22px, 5vw, 88px);
  --max: 1280px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  cursor: default; /* plain arrow over text instead of the I-beam */
}
a, button { cursor: pointer; }
::selection { background: var(--accent); color: #fff; }
h1, h2, h3 { font-weight: 600; margin: 0; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.mono { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 0 var(--pad-x);
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}
.nav.is-scrolled { background: var(--bg); border-bottom-color: var(--line); }
.nav__name { font-weight: 600; font-size: 1.02rem; letter-spacing: -0.01em; white-space: nowrap; }
.nav__right { display: flex; align-items: center; gap: 28px; }
.nav__links { display: flex; gap: 26px; }
.nav__links a { font-size: 0.9rem; color: var(--muted); transition: color 0.2s; white-space: nowrap; }
.nav__links a:hover, .nav__links a:focus-visible { color: var(--text); }

.lang-toggle {
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted);
}
.lang-toggle__opt.is-active { color: var(--text); }
.lang-toggle__sep { margin: 0 5px; opacity: 0.5; }

.burger {
  display: none; background: none; border: 0; cursor: pointer;
  width: 40px; height: 40px; padding: 0;
  flex-direction: column; align-items: center; justify-content: center; gap: 7px;
}
.burger span { display: block; width: 22px; height: 1.5px; background: var(--text); transition: transform 0.3s; }
.burger.is-open span:first-child { transform: translateY(4.25px) rotate(45deg); }
.burger.is-open span:last-child { transform: translateY(-4.25px) rotate(-45deg); }

.menu-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: var(--bg);
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--nav-h) + 12px) var(--pad-x) 32px;
  overflow-y: auto;
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.menu-overlay.is-open { opacity: 1; visibility: visible; }
.menu-overlay__links { display: flex; flex-direction: column; }
.menu-overlay__links a {
  font-size: clamp(1.6rem, min(8vw, 5vh), 2.8rem);
  font-weight: 600; letter-spacing: -0.02em;
  padding: clamp(2px, 0.6vh, 8px) 0;
}
.menu-overlay__links a:hover { color: var(--accent); }
.menu-overlay__meta { margin-top: 32px; color: var(--muted); font-size: 0.9rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 15px 26px;
  border-radius: 3px;
  font-weight: 500; font-size: 0.95rem;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn--primary { background: var(--text); color: var(--bg); }
.btn--primary:hover { background: var(--accent); }
.btn--ghost { border: 1px solid var(--line); }
.btn--ghost:hover { border-color: var(--text); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  overflow: hidden;
}
/* the dot field (scene.js, or the 2D fallback in hero-machine.js) */
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero__glow {
  position: absolute; z-index: 0; pointer-events: none;
  width: 60vw; height: 60vw; max-width: 900px; max-height: 900px;
  right: -18vw; top: -18vw;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, rgba(34, 211, 238, 0.07) 45%, transparent 70%);
  filter: blur(40px);
}
.hero__glow--low {
  right: auto; top: auto; left: -22vw; bottom: -22vw;
  background: radial-gradient(circle, rgba(217, 70, 239, 0.14) 0%, rgba(139, 92, 246, 0.06) 45%, transparent 70%);
}
.hero__grid {
  position: relative; z-index: 2;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  grid-template-rows: 1fr auto auto auto 0.7fr;
  grid-template-areas:
    ".    photo"
    "name photo"
    "sub  photo"
    "cta  photo"
    ".    photo";
  column-gap: clamp(24px, 4vw, 72px);
  width: 100%; max-width: 1600px; margin: 0 auto;
  padding: calc(var(--nav-h) + 16px) var(--pad-x) 32px;
}
.hero__name {
  grid-area: name;
  font-size: clamp(3.4rem, 9vw, 8.6rem);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.045em;
  margin-bottom: clamp(26px, 4vh, 40px);
}
.hero__name span { display: block; }
.hero__name span + span { color: var(--muted); }
.hero__intro { grid-area: sub; max-width: 40ch; margin-bottom: 34px; }
.hero__role {
  font-size: clamp(1.2rem, 1.7vw, 1.6rem);
  font-weight: 500; line-height: 1.3; letter-spacing: -0.01em;
  margin-bottom: 14px;
}
.hero__sub { color: var(--muted); font-size: clamp(1rem, 1.2vw, 1.14rem); line-height: 1.55; margin: 0; }
.hero__cta { grid-area: cta; display: flex; gap: 12px; flex-wrap: wrap; }

/* the portrait – paint over it to reveal the machine */
.term {
  grid-area: photo;
  justify-self: center; align-self: end;
  position: relative; margin: 0;
  height: min(84svh, calc(100svh - var(--nav-h) - 48px), 900px);
  aspect-ratio: 933 / 1400;
  max-width: 100%;
  outline: none;
}
.term__wrap {
  position: relative; width: 100%; height: 100%;
  cursor: crosshair; touch-action: pan-y;
  -webkit-mask-image: linear-gradient(to bottom, #000 62%, rgba(0,0,0,.5) 84%, transparent 99%);
  mask-image: linear-gradient(to bottom, #000 62%, rgba(0,0,0,.5) 84%, transparent 99%);
}
.term__photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: center top;
  user-select: none; -webkit-user-drag: none;
}
.term__canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.term__hint {
  position: absolute; right: 0; bottom: 40px;
  color: var(--muted); font-size: 0.8rem;
  transition: opacity 0.3s;
}
html.is-boot .term__hint, html.has-booted .term__hint { opacity: 0; }

/* ---------- sections ---------- */
.section { padding: clamp(96px, 15vh, 168px) var(--pad-x); }
.section__inner { max-width: var(--max); margin: 0 auto; }
.section__title {
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  line-height: 1.05;
  max-width: 20ch;
  margin-bottom: clamp(40px, 7vh, 72px);
}

/* ---------- about ---------- */
/* photo on the left, mirrored so he faces the text; text on the right */
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.35fr);
  gap: clamp(40px, 7vw, 120px);
  align-items: start;
}
/* the fade lives on the figure: a mask on the flipped img itself does not paint */
.about__portrait {
  margin: 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
}
.about__portrait img { width: 100%; transform: scaleX(-1); }
.about .section__title { max-width: 26ch; font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1.15; margin-bottom: 40px; }
.about__text p { color: var(--muted); font-size: 1.08rem; max-width: 60ch; margin-bottom: 1.3em; }
.about__text p:first-of-type { color: var(--text); font-size: 1.2rem; }

.facts {
  display: grid; grid-template-columns: repeat(3, auto); justify-content: start;
  gap: 18px clamp(32px, 5vw, 72px);
  margin: 56px 0 0; padding-top: 28px;
  border-top: 1px solid var(--line);
}
.facts div { margin: 0; }
.facts dt {
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  font-weight: 600; letter-spacing: -0.03em; line-height: 1;
}
.facts dd { margin: 8px 0 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- what I do ---------- */
.work { background: var(--bg-2); }
.work__grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(44px, 7vh, 72px) clamp(40px, 6vw, 96px);
  max-width: 1080px; margin-left: auto;
}
.work__item h3 { font-size: clamp(1.3rem, 2vw, 1.6rem); margin-bottom: 12px; }
.work__item p { color: var(--muted); margin: 0; max-width: 48ch; }
.work__item p + p { margin-top: 0.9em; }

/* ---------- journey ---------- */
.jr__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.jr__row {
  display: grid;
  grid-template-columns: 9rem minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: 8px clamp(20px, 4vw, 56px);
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.jr__date { color: var(--muted); padding-top: 4px; }
.jr__org h3 { font-size: 1.3rem; }
.jr__org p { color: var(--muted); margin: 2px 0 0; font-size: 0.95rem; }
.jr__desc { margin: 0; color: var(--muted); max-width: 52ch; }
.jr__row--current .jr__date { color: var(--accent); }

/* ---------- newsletter ---------- */
.nl__grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(44px, 7vw, 110px);
  align-items: start;
}
.nl__title { font-size: clamp(2.6rem, 5vw, 4rem); line-height: 0.95; letter-spacing: -0.04em; }
.nl__sub { margin: 10px 0 0; color: var(--muted); font-size: 1.1rem; }
.nl__desc { margin: 22px 0 0; color: var(--muted); max-width: 40ch; }
.nl__desc + .nl__desc { margin-top: 12px; }
.nl__stats { list-style: none; margin: 30px 0 34px; padding: 0; display: flex; gap: 40px; }
.nl__stats li { display: flex; flex-direction: column; gap: 4px; }
.nl__num { font-size: 1.9rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.nl__stats b { font-weight: 400; color: var(--muted); font-size: 0.9rem; }

.nl__latest { font-size: 0.95rem; font-weight: 500; color: var(--muted); margin-bottom: 14px; letter-spacing: 0; }
.nl__rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.nl__row { border-bottom: 1px solid var(--line); }
.nl__row a {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 20px;
  align-items: baseline; gap: 18px; padding: 18px 2px;
}
.nl__no { color: var(--muted); }
.nl__ttl { line-height: 1.35; transition: color 0.2s; }
.nl__date { color: var(--muted); white-space: nowrap; }
.nl__arrow { color: var(--muted); transition: color 0.2s; }
.nl__row a:hover .nl__ttl, .nl__row a:hover .nl__arrow { color: var(--accent); }
.nl__all { display: inline-block; margin-top: 22px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.nl__all:hover { color: var(--text); border-color: var(--text); }

/* ---------- appearances ---------- */
.appear .section__title { max-width: none; margin-bottom: 20px; }
.appear__intro { color: var(--muted); max-width: 62ch; margin-bottom: clamp(36px, 6vh, 56px); }
.appear__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.appear__row { border-bottom: 1px solid var(--line); }
.appear__row a {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr) auto 20px;
  align-items: baseline;
  gap: clamp(14px, 3vw, 32px);
  padding: 20px 2px;
}
.appear__tag { color: var(--muted); font-size: 0.78rem; }
.appear__title { font-size: clamp(1.02rem, 1.9vw, 1.32rem); font-weight: 500; line-height: 1.3; transition: color 0.2s; }
.appear__meta { color: var(--muted); white-space: nowrap; }
.appear__arrow { color: var(--muted); transition: color 0.2s; }
.appear__row a:hover .appear__title, .appear__row a:hover .appear__arrow { color: var(--accent); }

.appear__preview {
  position: fixed; z-index: 80;
  width: 300px; aspect-ratio: 16 / 10; object-fit: cover;
  pointer-events: none;
  opacity: 0; transition: opacity 0.2s;
}
.appear__preview.is-visible { opacity: 1; }
@media (pointer: coarse) { .appear__preview { display: none; } }

/* ---------- contact ---------- */
.contact {
  position: relative; overflow: hidden; text-align: center;
  padding-top: clamp(110px, 18vh, 200px); padding-bottom: clamp(110px, 18vh, 200px);
}
.contact__glow {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 80vw; height: 80vw; max-width: 1100px; max-height: 1100px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.13) 0%, rgba(255, 106, 58, 0.05) 45%, transparent 70%);
  filter: blur(40px); pointer-events: none;
}
.contact .section__inner { position: relative; }
.contact__title {
  font-size: clamp(2.6rem, 8.5vw, 6.4rem);
  font-weight: 600; letter-spacing: -0.04em; line-height: 1.02;
  margin-bottom: clamp(36px, 6vh, 60px);
}
.contact__title-accent { color: var(--accent); }
.contact__text { color: var(--muted); max-width: 46ch; margin: 0 auto 10px; font-size: 1.1rem; }
.contact__cta { font-size: 1.2rem; font-weight: 500; margin-bottom: 30px; }
.contact__mail {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 20px 40px; border-radius: 999px;
  background: var(--accent); color: #0a0a12;
  font-weight: 600; font-size: 1.05rem;
  transition: background 0.2s, color 0.2s;
}
.contact__mail:hover { background: var(--text); }
.contact__links {
  list-style: none; margin: 48px 0 28px; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 34px;
}
.contact__links a { color: var(--muted); transition: color 0.3s; }
.contact__links a:hover { color: var(--accent); }
.contact__cv { margin: 0 0 28px; }
.contact__cv a { color: var(--muted); border-bottom: 1px dashed rgba(141, 138, 158, 0.4); padding-bottom: 2px; }
.contact__cv a:hover { color: var(--accent); border-color: var(--accent); }
.contact__meta { margin: 0; color: var(--muted); }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 28px var(--pad-x);
  text-align: center; color: var(--muted);
}
.footer p { margin: 0 0 10px; }
.footer__links { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 28px; }
.footer a { color: var(--muted); border-bottom: 1px dashed rgba(141, 138, 158, 0.4); padding-bottom: 2px; }
.footer a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .nav__links { display: none; }
  .burger { display: flex; }
}
@media (max-width: 1020px) {
  .hero { min-height: auto; }
  .hero__grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "name" "photo" "sub" "cta";
    padding-bottom: 64px;
  }
  .hero__name { margin-bottom: 8px; }
  /* the portrait PNG has empty space above the head, so pull it up under the name */
  .term { height: auto; width: min(70vw, 420px); margin: -9% 0 8px; align-self: start; }
  .hero__intro { max-width: 46ch; }
  .about__grid { grid-template-columns: 1fr; }
  .about__portrait { max-width: 340px; }
  .nl__grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .work__grid { grid-template-columns: 1fr; }
  .jr__row { grid-template-columns: 1fr; gap: 6px; }
  .jr__date { padding-top: 0; }
  .appear__row a { grid-template-columns: minmax(0, 1fr) 16px; gap: 4px 12px; }
  .appear__tag { grid-column: 1; }
  .appear__title { grid-column: 1; }
  .appear__meta { grid-column: 1; }
  .appear__arrow { grid-column: 2; grid-row: 2; }
  .appear__preview { display: none; }
}
@media (max-width: 560px) {
  :root { --nav-h: 68px; }
  body { font-size: 16px; }
  .term { width: min(84vw, 340px); }
  .term__hint { bottom: 24px; }
  .hero__cta .btn { flex: 1 1 100%; }
  .facts { grid-template-columns: repeat(2, auto); }
  .nl__row a { grid-template-columns: 34px minmax(0, 1fr) 16px; gap: 4px 12px; }
  .nl__date { grid-column: 2; grid-row: 2; }
  .nl__arrow { grid-column: 3; grid-row: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* ?tune – alignment controls for the machine picture (dev only) */
.tuner {
  position: fixed; left: 18px; bottom: 18px; z-index: 300;
  width: 230px; padding: 14px; background: var(--bg-2);
  border: 1px solid var(--line); font-size: 0.7rem;
}
.tuner b { display: block; margin-bottom: 10px; }
.tuner label { display: block; margin-bottom: 9px; color: var(--muted); }
.tuner label span { color: var(--text); float: right; }
.tuner input[type="range"] { width: 100%; }
.tuner__btns { display: flex; gap: 8px; }
.tuner button { flex: 1; background: none; color: var(--text); border: 1px solid var(--line); padding: 6px 0; font: inherit; cursor: pointer; }
