/* ==========================================================================
   Eugene Lazebny — home
   Mobile-first stacked layout. `html.h-mode` switches desktop (fine pointer,
   enough room, motion allowed) to the horizontal, scroll-driven track.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --fg: #151515;
  --text: #444444;
  --muted: #777777;
  --faint: #999999;
  --line: #e8e8e8;
  --soft: #f5f5f3;

  --max: 1160px;
  --gutter: 20px;
  --nav-h: 64px;

  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Helvetica Neue', Arial, sans-serif;

  --radius-visual: 24px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

@media (min-width: 760px) {
  :root { --gutter: 28px; --nav-h: 82px; --radius-visual: 32px; }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
html:not(.h-mode) { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img, canvas { display: block; max-width: 100%; }
h1, h2, h3, h4, p, dl, dd { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 100;
  padding: 10px 16px; border-radius: 100px;
  background: var(--fg); color: #fff; font-size: 14px;
  transform: translateY(-160%);
  transition: transform .2s var(--ease-out);
}
.skip-link:focus { transform: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Header ---------- */

.nav {
  position: sticky; top: 0; z-index: 40;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter);
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
}

.logo { font-size: 18px; font-weight: 600; letter-spacing: -.03em; }

.navlinks { display: flex; align-items: center; gap: 26px; font-size: 14px; color: #555; }
.navlinks a { transition: color .2s; }
.navlinks a:hover, .navlinks a[aria-current="true"] { color: var(--fg); }
.navlinks a[aria-current="true"] { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }

.menu-toggle {
  display: none;
  align-items: center; gap: 10px;
  margin-right: -10px; padding: 10px;
  border: 0; background: none; color: var(--fg);
  font: inherit; font-size: 14px; cursor: pointer;
}
.menu-toggle-icon { position: relative; width: 16px; height: 10px; }
.menu-toggle-icon i {
  position: absolute; left: 0; right: 0; height: 1.5px; border-radius: 2px;
  background: currentColor;
  transition: transform .3s var(--ease-out), top .3s var(--ease-out);
}
.menu-toggle-icon i:first-child { top: 1px; }
.menu-toggle-icon i:last-child { top: 7.5px; }
.menu-toggle[aria-expanded="true"] .menu-toggle-icon i:first-child { top: 4.25px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-icon i:last-child { top: 4.25px; transform: rotate(-45deg); }

@media (max-width: 759px) {
  .menu-toggle { display: inline-flex; }

  .navlinks {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px var(--gutter) 24px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 40px -24px rgba(0, 0, 0, .18);
    font-size: 28px; letter-spacing: -.03em; color: var(--fg);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .25s var(--ease-out), transform .25s var(--ease-out), visibility 0s linear .25s;
  }
  .navlinks a { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .navlinks a:last-child { border-bottom: 0; }
  .navlinks a[aria-current="true"] { text-decoration: none; }
  .nav.is-open { background: #fff; }
  .nav.is-open .navlinks {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity .25s var(--ease-out), transform .25s var(--ease-out);
  }
}

/* ---------- Shared type ---------- */

.label, .eyebrow {
  text-transform: uppercase; letter-spacing: .12em;
  font-size: 12px; font-weight: 400; color: #888;
}
.eyebrow { margin-bottom: 22px; }

/* ---------- Panels (stacked by default) ---------- */

.panel {
  position: relative;
  padding: 72px var(--gutter);
  scroll-margin-top: var(--nav-h);
}
.panel-inner { width: 100%; max-width: calc(var(--max) - 56px); margin: 0 auto; }

.split { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 760px) {
  .panel { padding-top: 96px; padding-bottom: 96px; }
  .split { grid-template-columns: 1fr 2fr; gap: 70px; }
}

/* Hero */
.hero { padding-top: 48px; padding-bottom: 80px; }
.hero .panel-inner { max-width: calc(var(--max) - 56px); }
.hero h1 {
  max-width: 900px;
  font-size: clamp(46px, 12.5vw, 86px);
  line-height: .98; letter-spacing: -.06em; font-weight: 500;
  margin-bottom: 30px;
}
.hero h1 em { font-family: var(--serif); font-weight: 400; letter-spacing: -.04em; }
.hero-lede { font-size: clamp(18px, 2.2vw, 22px); line-height: 1.45; max-width: 720px; color: var(--text); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.pill { position: relative; border: 1px solid var(--line); border-radius: 100px; padding: 7px 13px; font-size: 13px; color: #555; }
.pill > span { display: inline-block; }
@media (min-width: 760px) {
  .hero { padding-top: 105px; padding-bottom: 115px; }
  .hero h1 { margin-bottom: 34px; letter-spacing: -.065em; }
  .hero-meta { gap: 10px; margin-top: 36px; }
}

/* Hero intro (home.js → playIntro). `html.is-intro` is set in <head> and
   holds the starting state until the timeline takes over. */
.w {
  display: inline-block;
  /* Each word rises out of its own line; room below for descenders, and
     overflow on the sides and top for the italic's overhang. */
  padding-bottom: .18em; margin-bottom: -.18em;
  clip-path: inset(-.35em -.4em 0 -.4em);
}
.w > span { display: inline-block; transform-origin: 0 100%; }
.pill-line { position: absolute; left: -1px; top: -1px; overflow: visible; pointer-events: none; }
.pill-line rect { fill: none; stroke-width: 1; }

.is-intro .hero .eyebrow,
.is-intro .hero-lede,
.is-intro .hero .pill > span,
.is-intro .hint { opacity: 0; }
.is-intro .hero h1 .w > span { transform: translateY(140%); }
.is-intro .hero .pill { border-color: transparent; }

/* Page reveals (home.js → revealPanel). Placeholders until a page plays. */
.reveal-on .panel:not(.hero):not(.is-in) :is(.label, .status, .intro-copy, .exp-copy, .date, .project-meta, .tagline, .more, .about-copy, .contact-links, .exp-point > *, .lead-item > *) { opacity: 0; }
.reveal-on .panel:not(.hero):not(.is-in) .w > span { transform: translateY(140%); }
.reveal-on .panel:not(.hero):not(.is-in) :is(.exp-point, .lead-item, .contact) { --line-scale: 0; }
.reveal-on .panel:not(.hero):not(.is-in) .visual { clip-path: inset(100% 0 0 0); }

/* Divider lines are drawn by a pseudo-element so they can grow from the left. */
.exp-point::before, .lead-item::before, .contact::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: var(--line-color, var(--line));
  transform: scaleX(var(--line-scale, 1)); transform-origin: left;
}

/* What I do */
.intro-copy { font-size: clamp(20px, 2.4vw, 24px); line-height: 1.42; max-width: 760px; color: var(--text); }
.intro-copy strong { font-weight: 500; color: #111; }

/* Experience */
/* Small status badge — reads as metadata, sized well below the title. */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 12px; padding: 3px 9px 3px 8px;
  border-radius: 100px;
  background: var(--soft);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
  font-size: 11px; line-height: 14px; font-weight: 500; letter-spacing: .01em;
  color: #5c5c5c;
}
.status-dot { position: relative; flex: none; width: 6px; height: 6px; border-radius: 50%; background: #1f9d63; }
.status-dot::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: inherit; animation: status-ping 2.4s var(--ease-out) infinite;
}
@keyframes status-ping { 0% { transform: scale(1); opacity: .45; } 70%, 100% { transform: scale(2.6); opacity: 0; } }

.role { font-size: 18px; font-weight: 600; }
/* The heading's words sit in rise masks, so the underline is drawn as a background, not text-decoration. */
.role a {
  display: inline-block;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .4s var(--ease-out);
}
.role a:hover { background-size: 100% 1px; }
.role-arrow { display: inline-block; margin-left: 3px; font-weight: 400; color: var(--faint); transition: transform .25s var(--ease-out), color .2s; }
.role a:hover .role-arrow { color: var(--fg); transform: translate(2px, -2px); }
.date { color: #888; font-size: 14px; margin-top: 6px; }
.exp-copy { font-size: 18px; color: var(--text); max-width: 720px; }
.exp-points { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 30px; }
.exp-point { position: relative; padding-top: 16px; }
.exp-point b { display: block; font-size: 15px; font-weight: 600; margin-bottom: 6px; color: #111; }
.exp-point span { font-size: 14px; color: #666; }
@media (min-width: 600px) { .exp-points { grid-template-columns: repeat(2, 1fr); gap: 26px; } }

/* ---------- Projects ---------- */

.project-grid { display: grid; grid-template-columns: 1fr; gap: 28px; align-items: center; }
.project-grid .visual { order: -1; }
@media (min-width: 760px) {
  .project-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 48px; }
  .project-grid .visual { order: 0; }
}

/* Sentence case on purpose: uppercase would turn iOS / macOS into IOS / MACOS */
.project-meta { font-size: 14px; color: var(--faint); margin-bottom: 14px; }
.project h2 { font-size: clamp(30px, 3.6vw, 46px); letter-spacing: -.05em; font-weight: 500; line-height: 1.08; margin-bottom: 16px; }
.tagline { font-size: clamp(18px, 1.6vw, 20px); color: #555; line-height: 1.45; max-width: 480px; margin-bottom: 30px; }

.more {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 14px; padding-bottom: 3px;
  border-bottom: 1px solid var(--fg);
  transition: gap .25s var(--ease-out), opacity .2s;
}
.more:hover { gap: 10px; }

/* Visuals share the Rive artboard ratio (500 × 460). */
.visual {
  position: relative; display: block;
  width: 100%; aspect-ratio: 500 / 460;
  overflow: hidden; isolation: isolate;
  border-radius: var(--radius-visual);
  background: var(--tint, var(--soft));
  -webkit-user-drag: none;
  transform: translateZ(0);
}
.visual canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0; transition: opacity .6s ease;
}
.visual canvas.is-ready { opacity: 1; }

a.visual { transition: transform .5s var(--ease-out), box-shadow .5s var(--ease-out); }
a.visual:hover { transform: translateY(-4px); box-shadow: 0 28px 60px -28px rgba(0, 0, 0, .35); }

/* ---------- Leadership ---------- */

.lead-title { font-size: clamp(34px, 4vw, 44px); letter-spacing: -.05em; font-weight: 500; line-height: 1.1; }
.lead-items { display: grid; grid-template-columns: 1fr; gap: 0 38px; }
.lead-item { position: relative; padding: 20px 0 24px; }
.lead-item h3 { font-size: 18px; margin-bottom: 7px; font-weight: 500; }
.lead-item p { font-size: 14px; color: #666; }
@media (min-width: 600px) { .lead-items { grid-template-columns: 1fr 1fr; } }

/* ---------- About + contact ---------- */

.about-copy { font-size: clamp(20px, 2.3vw, 23px); line-height: 1.45; max-width: 750px; color: var(--text); }
.contact { position: relative; margin-top: 48px; padding-top: 24px; }
.contact .label { margin-bottom: 12px; }
.contact-email {
  display: inline-block;
  font-size: clamp(26px, 3.4vw, 40px); letter-spacing: -.045em; font-weight: 500; line-height: 1.2;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .4s var(--ease-out);
}
.contact-email:hover { background-size: 100% 1px; }
.contact-links { display: flex; gap: 24px; margin-top: 16px; font-size: 15px; color: #555; }
.contact-links a:hover { color: var(--fg); }


/* Horizontal-only chrome */
.hint, .progress { display: none; }

/* ==========================================================================
   Horizontal mode (desktop)
   ========================================================================== */

html.h-mode {
  --nav-h: 82px;
  overscroll-behavior: none;
  scrollbar-width: none;
}
html.h-mode::-webkit-scrollbar { display: none; }
html.h-mode body { overflow-x: hidden; overscroll-behavior: none; }

.h-mode .nav {
  position: fixed; left: 0; right: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, .96), rgba(255, 255, 255, 0));
  -webkit-backdrop-filter: none; backdrop-filter: none;
}

/* clip (not hidden) so focus and #anchors can't scroll the stage or panels behind the transform */
.h-mode .stage { height: 100vh; overflow: hidden; overflow: clip; }
.h-mode .track { display: flex; width: max-content; height: 100vh; will-change: transform; }

.h-mode .panel {
  flex: 0 0 100vw; width: 100vw; height: 100vh;
  display: flex; align-items: center;
  padding: calc(var(--nav-h) + 18px) 28px 72px;
  overflow: hidden; overflow: clip;
}

.h-mode .hero { padding-top: 170px; padding-bottom: 90px; }

.h-mode .project-grid {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(40px, 5vw, 70px);
}
.h-mode .project-grid .visual {
  width: min(52vw, calc((100vh - 260px) * 500 / 460), 620px);
}


.h-mode .hint {
  display: block; position: fixed; z-index: 25; bottom: 24px; right: 28px;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
  pointer-events: none; transition: opacity .4s;
}
.h-mode .hint-arrow { display: inline-block; animation: nudge 1.8s var(--ease-out) infinite; }
.h-mode .hint.is-hidden { opacity: 0; }
@keyframes nudge { 0%, 100% { transform: none; } 50% { transform: translateX(4px); } }

.h-mode .progress {
  display: block; position: fixed; z-index: 25; left: 28px; bottom: 29px;
  width: 120px; height: 2px; background: #e9e9e9; pointer-events: none;
}
.h-mode .progress i { display: block; height: 100%; background: var(--fg); transform-origin: left; transform: scaleX(0); }

/* Drag-to-scroll */
.h-mode.is-dragging, .h-mode.is-dragging * { cursor: grabbing !important; user-select: none !important; }
.h-mode.is-dragging a.visual { transform: none; }

/* Short desktop viewports: tighten vertical rhythm so every panel fits */
@media (max-height: 780px) {
  .h-mode .hero { padding-top: 120px; padding-bottom: 72px; }
  .h-mode .project h2 { font-size: 36px; }
  .h-mode .tagline { font-size: 17px; margin-bottom: 22px; }
  .h-mode .project-grid .visual { width: min(52vw, calc((100vh - 220px) * 500 / 460), 620px); }
  .h-mode .lead-item { padding: 14px 0 16px; }
  .h-mode .exp-points { margin-top: 20px; }
  .h-mode .contact { margin-top: 32px; }
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  html:not(.h-mode) { scroll-behavior: auto; }
}
