/* ═══════════════════════════════════════════════════════════════════════
   EGOR.GLOBAL — STYLE
   Tokens from Figma (Portfolio / 1728, 12-col grid, gutter 12, offset 12).
   Fluid scale: --u = 100vw/1728, every design px = calc(N * var(--u)),
   mono floors at 11px so utility text never dips below legibility.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* ── color ── */
  --bg:    #ffffff;
  --ink:   #2e2930;
  --muted: rgba(46, 41, 48, 0.45);
  --line:  rgba(46, 41, 48, 0.16);
  --slot:  #e9e7ea;

  /* ── scale unit: 1px of the 1728 design ── */
  --u: calc(100vw / 1728);

  /* ── type ── */
  --font-sans: 'PP Neue Montreal', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  --fs-mono:  max(11px, calc(13 * var(--u)));
  --lh-mono:  max(15px, calc(18 * var(--u)));
  --fs-title: max(24px, calc(52 * var(--u)));  /* index row titles, floored so desktop rows stay legible down to 640 */
  --fs-name:  calc(116.4 * var(--u));   /* hero display, from Figma */

  /* ── space (8 / 12 / 16 / 24 / 48 / 96 scale from Figma) ── */
  --pad:   12px;                        /* body frame padding */
  --s-1:   max(6px,  calc(8  * var(--u)));
  --s-2:   12px;                        /* gutter — fixed like body pad */
  --s-3:   max(12px, calc(16 * var(--u)));
  --s-4:   max(16px, calc(24 * var(--u)));
  --s-5:   max(32px, calc(48 * var(--u)));
  --s-6:   max(56px, calc(96 * var(--u)));

  /* ── grid: 12 cols, col=131 gutter=12 → cluster step 429/858/1287 ── */
  --col-1:  calc(143 * var(--u));
  --col-cluster: calc(429 * var(--u));  /* 3 cols incl. trailing gutter */
  --col-num:  max(44px, calc(64 * var(--u)));  /* floored so year/number never clip on mid widths */
  /* type column floors at the widest label's width so it never squeezes the
     mono (which itself floors at 11px) into a wrap on mid desktop widths */
  --col-type: max(184px, calc(210 * var(--u)));

  /* ── motion ── */
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
  --ease-luxe: cubic-bezier(0.16, 1, 0.22, 1);
  --dur-fast:  350ms;
  --dur-wipe:  700ms;
  --dur-zoom:  900ms;
}

/* ═══════════ FONTS ═══════════ */
@font-face {
  font-family: 'PP Neue Montreal';
  src: url('../assets/fonts/PPNeueMontreal-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'PP Neue Montreal';
  src: url('../assets/fonts/PPNeueMontreal-Medium.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ═══════════ BASE (Safari-safe: html carries the tint, no bar clipping) ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
  background: var(--bg);
  scrollbar-width: none;
}
html::-webkit-scrollbar { width: 0; height: 0; display: none; }

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  font-family: var(--font-sans);
  font-weight: 400;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
ul, ol { list-style: none; }

::selection { background: var(--ink); color: var(--bg); }

:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* mono utility voice: the only three styles that exist */
.h-label, .h-value, .row-num, .row-type, .row-year, .col-num, .col-title,
.col-type, .col-year, .index-title, .index-view, .lang-switch,
.site-footer p, .soc-link, .header-col--nav a {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  line-height: var(--lh-mono);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

/* ═══════════ HEADER — fixed, inverts over whatever passes under ═══════════ */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: grid;
  grid-template-columns: var(--col-cluster) var(--col-cluster) var(--col-cluster) 1fr;
  padding: var(--pad);
  pointer-events: none;
  mix-blend-mode: difference;
  color: #ffffff;                 /* difference over white bg → ink-dark */
}
.site-header a, .site-header button { pointer-events: auto; }

.logo { display: inline-block; width: calc(43 * var(--u)); min-width: 28px; }
.logo-mark { width: 100%; height: auto; }
/* drop the mark by the text's cap-top offset (leading above the caps) so its
   top bar sits level with the mono glyphs, not the line box — self-adjusts to
   the mono size/leading at every breakpoint */
.header-col--logo .logo { margin-top: calc(var(--lh-mono) / 2 - 0.34 * var(--fs-mono)); }

.header-col--status .h-label { opacity: 1; }
.header-col--status .h-value, .h-label + .h-value { }
.h-label { }
.h-value a { }
.header-col--status .h-value { opacity: 0.45; }

.lang-switch { display: flex; gap: 0.5em; }
.lang-btn { opacity: 0.45; transition: opacity var(--dur-fast) var(--ease); text-transform: uppercase; }
.lang-btn.is-active { opacity: 1; }
.lang-sep { opacity: 0.45; }

.header-col--nav {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-self: end;
  text-align: right;
}

/* ═══════════ PAGE FRAME ═══════════ */
.page { padding: var(--pad); }

/* ═══════════ HERO ═══════════ */
/* min clears the 4-line nav on narrow desktop widths */
.hero { padding-top: max(104px, calc(112 * var(--u) + 16px)); }

.hero-photo {
  width: calc(184 * var(--u));
  min-width: 96px;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--slot);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }

.hero-name {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: calc(20 * var(--u));
  font-weight: 500;
  font-size: var(--fs-name);
  line-height: 0.84;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.hero-name-part { display: inline-block; }

/* ═══════════ STUB (case + utility pages, no design yet) ═══════════ */
.stub {
  padding-top: calc(112 * var(--u) + 96px);
  padding-bottom: var(--s-6);
  min-height: 72vh;
  display: flex;
  flex-direction: column;
}
.stub-label {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  line-height: var(--lh-mono);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--muted);
}
.stub-title {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--fs-name);
  line-height: 0.84;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin-top: var(--s-3);
}
.stub-note {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  line-height: var(--lh-mono);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: var(--s-4);
}
.stub-back {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  line-height: var(--lh-mono);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin-top: auto;
}
@media (max-width: 900px) {
  .stub { padding-top: 160px; }
  .stub-title { font-size: clamp(44px, 13vw, 72px); }
}

/* ═══════════ INDEX ═══════════ */
.index { padding-top: var(--s-6); position: relative; }

.index-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: var(--s-4);
}
.index-view { color: var(--ink); }

.index-cols {
  display: grid;
  grid-template-columns: var(--col-num) 1fr var(--col-type) var(--col-year, var(--col-num));
  padding-bottom: var(--s-1);
  color: var(--muted);
}
.col-year { text-align: right; }
.col-type, .row-type { white-space: nowrap; }

.index-rows li { border-top: 1px solid var(--line); }
.index-rows li:last-child { border-bottom: 1px solid var(--line); }

/* ═══ GALLERY VIEW (toggled by "Show as gallery") ═══
   harryjatkins-idea: mono meta strip above a tile, the shot sits on the
   tile's bottom edge. Built by JS from the same row data. */
.gallery { display: none; }
.index.is-gallery .index-rows,
.index.is-gallery .index-cols { display: none; }
.index.is-gallery .gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-2);
  row-gap: var(--s-5);
}
.gallery-card { display: block; }
.g-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  padding-bottom: 10px;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  line-height: var(--lh-mono);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.g-title { color: var(--ink); }
.g-num { color: var(--muted); text-align: right; }
.g-type { color: var(--muted); grid-column: 1 / -1; }
.g-tile {
  display: block;
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--slot);
  overflow: hidden;
}
.g-tile img {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 62%;
  height: auto;
  max-height: 86%;
  object-fit: cover;
  object-position: top;
  transition: transform 600ms var(--ease-luxe);
}
@media (hover: hover) and (pointer: fine) {
  .gallery-card:hover .g-tile img { transform: translateX(-50%) translateY(-8px); }
}
@media (max-width: 1100px) {
  .index.is-gallery .gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .index.is-gallery .gallery { grid-template-columns: 1fr; row-gap: var(--s-4); }
}

.row {
  display: grid;
  grid-template-columns: var(--col-num) 1fr var(--col-type) var(--col-num);
  align-items: baseline;
  padding: var(--s-3) 0 var(--s-4);
}
.row-num { color: var(--muted); }
.row-title {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--fs-title);
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: none;
  transition: transform 500ms var(--ease-luxe);
}
.row-year { color: var(--muted); text-align: right; }

@media (hover: hover) and (pointer: fine) {
  .row:hover .row-title { transform: translateX(calc(18 * var(--u))); }
}

/* cursor-trailing thumbnail — labe.app recipe:
   fixed frame follows pointer (lerp in JS), wipes open via clip-path,
   inner image counter-zooms; row-to-row swaps crossfade two layers */
.row-cursor {
  position: fixed;
  top: 0; left: 0;
  z-index: 30;
  width: calc(264 * var(--u));
  min-width: 200px;
  aspect-ratio: 3 / 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
  will-change: transform;
}
.row-cursor-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  clip-path: inset(0 0 100%);
  transition: clip-path var(--dur-wipe) var(--ease-luxe);
}
.row-cursor-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.25);
  transition: transform var(--dur-zoom) var(--ease-luxe), opacity 400ms var(--ease);
}
.row-cursor-img.is-back { opacity: 0; }
.index.is-hovering .row-cursor { opacity: 1; }
.index.is-hovering .row-cursor-frame { clip-path: inset(0 0 0%); }
.index.is-hovering .row-cursor-img { transform: scale(1); }

/* ═══════════ FOOTER ═══════════ */
.site-footer {
  display: grid;
  grid-template-columns: var(--col-cluster) var(--col-cluster) var(--col-cluster) 1fr;
  padding: var(--s-1) var(--pad) var(--pad);
  margin-top: var(--s-6);
}
.footer-col--muted { color: var(--muted); }
.footer-col--social {
  display: flex;
  justify-content: flex-end;
  gap: 1.5em;
}

/* social arrows: on hover the ↗ flies out top-right, re-enters from bottom-left */
.soc-link { display: inline-flex; align-items: baseline; gap: 0.3em; }
.soc-arrow {
  position: relative;
  display: inline-block;
  overflow: hidden;
  width: 1em; height: 1em;
  line-height: 1;
}
.soc-arrow-in {
  position: absolute; inset: 0;
  transition: transform 400ms var(--ease-luxe);
}
.soc-arrow-in::after {
  content: '↗';
  position: absolute;
  top: 100%; left: 0;
  transform: translateX(-100%);
}
.soc-link:hover .soc-arrow-in,
.soc-link:focus-visible .soc-arrow-in {
  transform: translate(100%, -100%);
}

/* ═══════════ ENTRANCE STATES (JS removes) ═══════════ */
.js .hero-photo { clip-path: inset(0 0 100% 0); }
.js .hero-name .char { display: inline-block; transform: translateY(120%); }
.js .hero-name-part { overflow: hidden; }
.js .index-head, .js .index-cols { opacity: 0; }
.js .index-rows li { opacity: 0; transform: translateY(14px); }

.no-motion .hero-photo,
.no-motion .hero-name .char,
.no-motion .index-head,
.no-motion .index-cols,
.no-motion .index-rows li {
  clip-path: none !important;
  transform: none !important;
  opacity: 1 !important;
}

/* ═══════════ MOBILE (≤900) — reflow, don't shrink ═══════════ */
/* ═══════════ TABLET / MOBILE ≤900 — header, hero, footer ═══════════
   Cards keep the desktop row layout down to 640 (see next block); the
   hero must stack earlier because the two-part name overflows below ~900. */
@media (max-width: 900px) {
  :root {
    --fs-mono: 12px;
    --lh-mono: 17px;
  }

  /* HEADER — all four clusters on one row, hugging + spread across.
     Stays fixed (like desktop) so it tracks the page with blend inversion. */
  .site-header {
    grid-template-columns: auto auto auto auto;
    justify-content: space-between;
    align-items: start;
    column-gap: 12px;
  }
  .logo { width: 34px; }
  .header-col--nav { justify-self: auto; }

  /* HERO — name stacks, photo shrinks */
  .hero { padding-top: 128px; }
  .hero-photo { width: 128px; }
  .hero-name {
    flex-direction: column;
    align-items: flex-start;
    white-space: normal;
    font-size: clamp(44px, 11.4vw, 64px);
    line-height: 0.9;
    gap: 0.08em;
    margin-top: 16px;
  }

  /* FOOTER — row1: © | Bali, row2: design&dev justified, row3: links spread */
  .site-footer {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      'copy bali'
      'dd   dd'
      'soc  soc';
    row-gap: 28px;
    column-gap: 12px;
    margin-top: 72px;
  }
  .site-footer > .footer-col:nth-child(1) { grid-area: copy; }
  .site-footer > .footer-col:nth-child(2) { grid-area: dd; }
  .site-footer > .footer-col:nth-child(3) { grid-area: bali; text-align: right; }
  .site-footer > .footer-col--social { grid-area: soc; }
  /* "Design & dev by me" spreads edge to edge */
  .site-footer > .footer-col:nth-child(2) p {
    text-align: justify;
    text-align-last: justify;
  }
  .footer-col--social {
    justify-content: space-between;
    width: 100%;
    gap: 0;
  }
}

/* ═══════════ MOBILE CARDS ≤640 — 2×2 record ═══════════
   Name + year on top, number + tags on the bottom. Year pins top-right,
   tags sink to the bottom of the name; number sits under the name. */
@media (max-width: 640px) {
  .index-cols { display: none; }
  .row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      'title year'
      'num   type';
    align-items: start;
    column-gap: 16px;
    row-gap: 10px;
  }
  .row-title { grid-area: title; font-size: clamp(32px, 9.2vw, 44px); }
  .row-year  { grid-area: year; text-align: right; }
  .row-num   { grid-area: num; }
  .row-type  { grid-area: type; text-align: right; color: var(--muted); white-space: normal; }
  .row-cursor { display: none; }
}

/* keep the frame sane beyond the design width */
@media (min-width: 2200px) {
  :root { --u: calc(2200px / 1728); }
  .page, .site-header { max-width: 2200px; margin-inline: auto; }
  .site-footer { max-width: 2200px; margin-inline: auto; }
}
