/* stefanzlatev.com — v1 landing page
   Palette: fog light grey + ink. Monochrome on purpose. */

:root {
  --fog: #15161a;
  --fog-deep: #0d0e11;
  --fog-light: #23252b;
  --ink: #ecece7;
  --ink-soft: #c9c9c3;
  --muted: #8d8d87;
  --rule: rgba(236, 236, 231, 0.16);
  --max: 1120px;
  --pad: clamp(1.25rem, 4vw, 3rem);
  --font: "Mona Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --mono: "Mona Sans Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@font-face {
  font-family: "Mona Sans";
  src: url("../assets/fonts/MonaSansVF.woff2") format("woff2-variations"), url("../assets/fonts/MonaSansVF.woff2") format("woff2");
  font-weight: 200 900;
  font-stretch: 75% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Mona Sans Mono";
  src: url("../assets/fonts/MonaSansMonoVF.woff2") format("woff2-variations"), url("../assets/fonts/MonaSansMonoVF.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/FrauncesVF.woff2") format("woff2-variations"), url("../assets/fonts/FrauncesVF.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

.logos img, .edu img, .icon-link img { filter: grayscale(1) invert(1) brightness(1.2) contrast(1.1); opacity: 1; }
.nav { mix-blend-mode: normal; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  color: var(--ink);
  background: var(--fog);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
html, body { overflow-x: clip; }

a { color: inherit; text-decoration: none; }
a:hover { opacity: 0.7; }

/* --- background scene --- */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}
.fog-fallback {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: none;
  background:
    radial-gradient(60% 50% at 70% 40%, var(--fog-light) 0%, transparent 70%),
    radial-gradient(50% 60% at 20% 80%, var(--fog-deep) 0%, transparent 70%),
    var(--fog);
}
body.no-webgl #scene { display: none; }
body.no-webgl .fog-fallback { display: block; }

/* --- nav --- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem var(--pad);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}
.nav-name { font-size: 0.95rem; line-height: 0.9; }
.nav-name .first { font-size: 0.95em; }
.nav nav a { margin-left: 1.6rem; color: var(--ink-soft); font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }

main { position: relative; z-index: 1; }

/* --- hero --- */
.hero {
  min-height: 100svh;
  display: grid;
  align-content: center;
  padding: 0 var(--pad);
  position: relative;
}
.hero-text {
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
}
/* wordmark: first name in the serif, surname in bold grotesk, stacked tight */
.wordmark { display: inline-grid; text-transform: uppercase; line-height: 0.86; }
.wordmark .first { font-family: var(--serif); font-weight: 400; letter-spacing: 0.06em; font-variation-settings: "opsz" 144; }
.wordmark .last { font-family: var(--font); font-weight: 800; letter-spacing: -0.03em; }
.hero h1 {
  font-size: clamp(3rem, 8.5vw, 6.6rem);
  margin: 0 0 1.2rem;
}
.hero h1 .first { font-size: 0.92em; }
.hero-sub {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.4vw, 1.8rem);
  font-weight: 300;
  margin: 0 0 0.9rem;
  color: var(--ink-soft);
}
.hero-line {
  font-size: clamp(0.95rem, 1.3vw, 1.1rem);
  color: var(--ink-soft);
  max-width: 36rem;
  margin: 0;
  line-height: 1.5;
}
.scroll-cue {
  margin-top: 3.2rem;
  display: inline-grid;
  justify-items: start;
  gap: 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.dots { display: grid; gap: 3px; }
.dots i { width: 3px; height: 3px; border-radius: 50%; background: var(--ink); display: block; animation: cue 1.8s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes cue { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: 0.6; } }

/* --- beats (sections) --- */
.beat {
  min-height: 100svh;
  display: grid;
  align-content: center;
  padding: clamp(5rem, 12vh, 9rem) var(--pad);
}
.beat-inner {
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
}
/* Text sits on the scene: a frosted, feathered pool keeps it legible without a visible box. */
.beat-inner > * { position: relative; }
.beat-inner::before {
  content: "";
  position: absolute;
  inset: -3rem -4rem;
  background: color-mix(in srgb, var(--fog) 62%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(0.9);
  backdrop-filter: blur(18px) saturate(0.9);
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
  z-index: -1;
  pointer-events: none;
}
.beat-inner { position: relative; }
.beat-kicker {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.6rem;
}
.route { font-family: var(--serif); font-weight: 300; text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--ink-soft); margin-left: 0.6rem; }
.beat-caption {
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  max-width: 44rem;
  margin: 0 0 2.2rem;
  color: var(--ink-soft);
}
.beat-lead {
  font-size: clamp(2.4rem, 5.5vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  line-height: 1.1;
  margin: 0 0 1.4rem;
}
.beat-body {
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  max-width: 40rem;
  margin: 0 0 2.5rem;
  color: var(--ink-soft);
}

.facts {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr));
  gap: 1.5rem 2rem;
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
  max-width: 52rem;
}
.facts li { display: grid; gap: 0.2rem; }
.facts strong { font-family: var(--serif); font-weight: 300; font-size: 1.9rem; letter-spacing: -0.02em; }
.facts span { font-size: 0.85rem; color: var(--muted); }

/* --- focus: pinned stage, one track across time --- */
.focus { position: relative; height: 700svh; }
.stage {
  position: sticky; top: 0; height: 100svh; overflow: hidden;
  --itemw: clamp(260px, 30vw, 420px);
}
.focus-head {
  position: absolute; left: var(--pad); top: 16svh; z-index: 2;
}
.focus-head::before {
  content: ""; position: absolute; inset: -2rem -3rem;
  background: color-mix(in srgb, var(--fog) 55%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  -webkit-mask-image: radial-gradient(closest-side, #000 50%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 50%, transparent 100%);
  z-index: -1;
}
.focus-head .beat-kicker { margin-bottom: 0.4rem; }
.focus-head .year {
  font-family: var(--serif); font-weight: 300; text-transform: none;
  font-size: clamp(4rem, 10vw, 8.5rem); line-height: 0.95; margin: 0; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; color: var(--ink);
  transition: color 0.5s ease;
}
body.colour .focus-head .year { color: color-mix(in srgb, var(--accent, var(--ink)) 70%, white); }

.track {
  list-style: none; margin: 0; padding: 0;
  position: absolute; left: 50%; top: 42svh;
  display: flex; align-items: start;
  will-change: transform;
  transition: transform 0.25s linear;
}
.machine {
  --accent: var(--ink);
  width: var(--itemw); flex: 0 0 var(--itemw);
  display: grid; justify-items: center; text-align: center; gap: 0.55rem; position: relative;
  padding: 0 1.2rem;
}
.machine svg { width: 100%; max-width: 170px; height: auto; color: var(--ink); opacity: 0.35; transition: opacity 0.5s ease, transform 0.6s ease; }
.machine svg .m { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.machine svg .hot { transition: stroke 0.6s ease, fill 0.6s ease; }
.machine .label { font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); transition: color 0.5s ease; }
.machine .desc {
  font-size: 0.9rem; color: var(--ink-soft); max-width: 20rem; line-height: 1.5;
  opacity: 0; transform: translateY(4px); transition: opacity 0.5s ease, transform 0.5s ease;
}
.machine.active svg { opacity: 1; transform: translateY(-6px) scale(1.06); }
.machine.active .label { color: var(--ink); font-weight: 400; }
.machine.active .desc { opacity: 1; transform: none; }
body.colour .machine.active svg .hot { stroke: color-mix(in srgb, var(--accent) 70%, white); }
body.colour .machine.active svg circle.hot { fill: color-mix(in srgb, var(--accent) 70%, white); }

/* time axis: a line across the stage, a tick and year under each machine */
.axis { position: absolute; left: 0; right: 0; top: calc(42svh + 300px); height: 1px; background: var(--rule); }
.machine .tick { position: absolute; top: 300px; left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 0.5rem; }
.machine .tick i { width: 1px; height: 14px; background: var(--ink); opacity: 0.35; display: block; transform: translateY(-7px); transition: background 0.5s ease, opacity 0.5s ease, height 0.5s ease; }
.machine .tick b { font-family: var(--mono); font-weight: 400; font-size: 0.74rem; letter-spacing: 0.04em; color: var(--muted); font-variant-numeric: tabular-nums; }
.machine.active .tick i { opacity: 1; height: 22px; transform: translateY(-11px); }
body.colour .machine.active .tick i { background: color-mix(in srgb, var(--accent) 70%, white); }
.machine.active .tick b { color: var(--ink); }

.focus-hint { font-family: var(--mono); position: absolute; right: var(--pad); bottom: 2rem; margin: 0; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

@media (max-width: 700px) {
  .focus { height: 760svh; }
  .focus-head { top: 12svh; }
  .track { top: 38svh; }
  .machine .desc { max-width: 15rem; font-size: 0.85rem; }
  .machine svg { max-width: 130px; }
  .axis, .machine .tick { top: calc(38svh + 250px); }
  .machine .tick { top: 250px; }
  .focus-hint { display: none; }
}

/* now */
.now {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  gap: 2rem 2.5rem;
  max-width: var(--max);
}
.now div { border-top: 1px solid var(--rule); padding-top: 1rem; }
.now dt { font-weight: 400; font-size: 1.1rem; margin-bottom: 0.4rem; }
.now dd { margin: 0; color: var(--ink-soft); font-size: 0.98rem; }

/* contact */
.contact .beat-body { margin-bottom: 1.6rem; }
.links { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 0; font-size: 1.05rem; }
.links a { border-bottom: 1px solid var(--ink); padding-bottom: 0.1rem; }

.amp { font-family: var(--serif); font-weight: 300; font-style: italic; text-transform: none; letter-spacing: 0; font-size: 0.8em; }

/* logos: greyscale, quiet */
.logos { margin: 0 0 2rem; display: flex; gap: 1rem; align-items: center; }
.logos img { display: block; width: 44px; height: 44px; object-fit: contain; filter: grayscale(1); opacity: 0.85; border-radius: 4px; }
.sectors-list {
  list-style: none; margin: 0; padding: 1.4rem 0 0; border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: 0.5rem 0.6rem; max-width: 60rem;
}
.sectors-list li {
  font-size: 0.85rem; color: var(--ink-soft); border: 1px solid var(--rule); border-radius: 999px; padding: 0.3rem 0.8rem;
}

/* education: quiet list at the end */
.education { padding: 0 var(--pad) clamp(3rem, 8vh, 5rem); position: relative; z-index: 1; }
.education .beat-inner::before { display: none; }
.edu { list-style: none; margin: 0; padding: 0; max-width: 56rem; }
.edu li {
  padding: 0.9rem 0;
  display: grid; grid-template-columns: 44px minmax(11rem, 0.8fr) 2.2fr; gap: 1.2rem; align-items: center;
  padding: 0.7rem 0; border-top: 1px solid var(--rule);
  font-size: 0.92rem; color: var(--ink-soft);
}
.edu li span:first-of-type { color: var(--ink); font-weight: 400; }
.edu img { width: 44px; height: 44px; object-fit: contain; }
@media (max-width: 560px) { .edu li { grid-template-columns: 44px 1fr; gap: 0.15rem 0.8rem; } .edu li span:last-child { grid-column: 2; } }

.icon-link { display: inline-flex; align-items: center; border-bottom: none !important; }
.icon-link img { display: block; width: 26px; height: 26px; border-radius: 4px; filter: grayscale(1); opacity: 0.85; }

footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  padding: 2rem var(--pad) 2.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}

/* --- reveal on scroll --- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

@media (max-width: 640px) {
  .nav nav a { margin-left: 1rem; }
  .nav nav a:nth-child(3), .nav nav a:nth-child(4) { display: none; }
}

/* --- v2: instrument dial on the time axis --- */
.dial { position: absolute; right: var(--pad); top: 14svh; width: clamp(96px, 11vw, 150px); height: auto; z-index: 2; }
.dial circle, .dial line { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.dial-track { opacity: 0.18; }
.dial-arc { stroke: color-mix(in srgb, var(--accent, var(--ink)) 70%, white); stroke-width: 2.2; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease, stroke 0.6s ease; }
.dial-ticks line { opacity: 0.25; transition: opacity 0.4s ease, stroke 0.4s ease; }
.dial-ticks line.on { opacity: 1; stroke: color-mix(in srgb, var(--accent, var(--ink)) 70%, white); }
.dial-hub { fill: var(--ink) !important; stroke: none !important; }
@media (max-width: 700px) { .dial { top: auto; bottom: 6svh; right: var(--pad); width: 72px; } }

/* --- v2: letters assemble --- */
.ch { display: inline-block; opacity: 0; transform: translateY(0.35em); transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); transition-delay: calc(var(--i, 0) * 28ms); }
.loaded .hero .ch, .reveal.in .ch { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .ch { opacity: 1; transform: none; transition: none; } }

/* --- v2: the Operator chapter gets room for the exploded view --- */
#engineer { min-height: 190svh; align-content: start; padding-top: 30svh; }

/* --- v2: drawing labels --- */
.draw-labels { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity 0.3s ease; }
.draw-labels span {
  position: absolute; left: 0; top: 0; transform: translate(-9999px, -9999px);
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--ink-soft);
  padding-left: 0.9rem; white-space: nowrap;
}
.draw-labels span::before { content: ""; position: absolute; left: 0; top: 50%; width: 0.6rem; height: 1px; background: var(--ink-soft); }

/* phones: the fan owns the top half of the hero, the words sit below it */
@media (max-width: 700px) {
  .hero { align-content: end; padding-bottom: 16svh; }
  .hero h1 { font-size: clamp(2.6rem, 15vw, 3.6rem); }
}

/* --- accessibility: visible focus, skip link --- */
a:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 2px; }
.skip { position: absolute; left: var(--pad); top: -3rem; z-index: 50; padding: 0.5rem 0.8rem; background: var(--ink); color: var(--fog); font-size: 0.85rem; border-radius: 4px; }
.skip:focus { top: 1rem; }
