/* ============================================================
   Kolya Clark — Portfolio
   Light & editorial · expressive display + mono metadata
   ============================================================ */

:root {
  --bg:        #f5f4ef;   /* warm off-white ground */
  --bg-2:      #efeee8;
  --text:      #16150f;   /* warm near-black */
  --muted:     #6c6a60;
  --line:      rgba(22, 21, 15, 0.16);
  --off:       rgba(22, 21, 15, 0.52);  /* unread word in the About read-along.
                                           0.20 measured 1.54:1 — the text was
                                           effectively invisible until lit. */
  --accent:    #2a45c8;   /* cobalt — used sparingly */
  --accent-up: #93a4ff;   /* the same cobalt lifted to read on near-black */

  --maxw: 1200px;
  --maxw-wide: 1500px;   /* booklet stage only — it needs the extra width */
  --pad: clamp(20px, 5vw, 60px);

  --font-display: 'Clash Display', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-sans:    'General Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'Space Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
em { font-style: italic; }

/* Monospace metadata utility — the "designer tell" */
.mono {
  font-family: var(--font-mono);
  /* Was a flat 0.72rem (11.5px) everywhere — the only size on the site that
     never scaled, and it carries the nav, every section index and all meta. */
  font-size: clamp(0.76rem, 0.72rem + 0.12vw, 0.8rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.accent { color: var(--accent); }

/* ---------- Intro loader · "Counter" ----------
   The inline script in <head> adds .is-loading to <html> before first
   paint; script.js counts 0→100, then adds .is-revealed to lift the
   panel away. Both classes are removed once it's gone.               */
.loader { display: none; }

html.is-loading { overflow: hidden; }
html.is-loading .loader {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: fixed;
  inset: 0;
  z-index: 1000;            /* above the fixed nav (100) */
  background: var(--bg);
  will-change: transform;
}
html.is-loading.is-revealed { overflow: visible; }
html.is-loading.is-revealed .loader {
  transform: translateY(-100%);
  transition: transform 1s cubic-bezier(0.76, 0, 0.24, 1);
  pointer-events: none;
}

.loader__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 var(--pad) clamp(16px, 2.2vw, 28px);
}
/* Sits in the same optical slot the hero name takes over. */
.loader__count {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(4rem, 19vw, 15rem);
  line-height: 0.78;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
.loader__status { color: var(--muted); padding-bottom: 8px; }
/* The vermilion line is the percentage — and the thing that sweeps
   up across the page when the panel leaves. */
.loader__fill {
  display: block;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.loader__skip {
  position: absolute;
  top: 22px;
  right: var(--pad);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 6px 2px;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}
.loader__skip:focus-visible {
  color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Selection picks up the accent instead of the browser's default blue.
   White on cobalt is 7.5:1. NB: the readable text colour depends on the
   accent — near-black only worked on the old, lighter vermilion. */
::selection { background: var(--accent); color: #fff; }

/* ---------- Custom cursor ---------- */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  z-index: 999;
  transform: translate(-50%, -50%);
  transition: width 0.25s var(--ease), height 0.25s var(--ease), background 0.25s var(--ease);
  display: none; /* enabled by JS on fine-pointer devices */
  mix-blend-mode: normal;
  align-items: center;
  justify-content: center;
}
.cursor.is-active { display: flex; }
.cursor.is-hover {
  width: 74px; height: 74px;
  background: var(--accent);
}
.cursor__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  white-space: nowrap;
}
.cursor.is-hover .cursor__label { opacity: 1; }
body.has-cursor a,
body.has-cursor .work-row__link { cursor: none; }

/* ---------- Floating project preview ---------- */
.preview {
  position: fixed;
  top: 0; left: 0;
  width: min(430px, 60vw);       /* landscape: every project hero is
                                    landscape, so a portrait frame cropped
                                    all three to a meaningless slice. Capped
                                    against the viewport so a narrowed window
                                    doesn't get a preview wider than the page. */
  aspect-ratio: 430 / 300;
  border-radius: 8px;
  pointer-events: none;
  z-index: 900;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.92);
  transition: opacity 0.3s var(--ease), transform 0.4s var(--ease);
  background-size: cover;
  background-position: center;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.3);
}
.preview.is-visible { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px var(--pad);
  /* No mix-blend-mode here. Multiplied over the dark statement band it came
     out black on black and the nav vanished. Colour is inverted instead,
     driven by .nav--invert from script.js. */
  transition: transform 0.45s var(--ease), color 0.25s var(--ease);
}
/* Hidden while reading down the page; returns on any upward scroll. Keeps
   the nav from sitting on top of body copy at mobile gutters. */
.nav--up { transform: translateY(-105%); }
.nav--invert .nav__brand,
.nav--invert .nav__links a { color: var(--bg); }
.nav--invert .nav__links a .mono { color: var(--accent-up); }
.nav__brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.nav__links { display: flex; gap: clamp(18px, 3vw, 38px); min-width: 0; }
.nav__links a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  position: relative;
  padding: 14px 0;
  margin: -14px 0;
  transition: color 0.2s var(--ease);
}
.nav__links a .mono { color: var(--accent); margin-right: 4px; }

/* ---------- Layout ---------- */
main { position: relative; }
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(80px, 13vw, 170px) var(--pad);
}
.section__head { margin-bottom: clamp(36px, 6vw, 64px); }
.section__index {
  display: block;
  color: var(--muted);
  margin-bottom: 14px;
}
.section__title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(100px, 12vw, 130px) var(--pad) clamp(70px, 9vw, 110px);
  min-height: 100vh;
  min-height: 100svh;   /* iOS counts the retracted toolbar in 100vh, which
                           pushed the tagline and location below the fold */
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero__eyebrow { color: var(--muted); margin-bottom: 28px; }
.hero__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(4rem, 19vw, 15rem);
  line-height: 0.86;
  /* Clash Display is a display face — its default spacing is already
     tuned for sizes like this. Negative tracking closed up the l/y pair
     in "Kolya", so we don't fight the font. Leave this at 0. */
  letter-spacing: 0;
  margin-bottom: 40px;
}
/* overflow:hidden masks the words so they can rise into place. line-height
   0.86 makes the box shorter than the letters, which clipped the y's tail —
   so pad the box down and pull the same amount back off the margin. The
   layout is unchanged; only the mask is taller. */
.hero__title .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.2em;
  margin-bottom: -0.2em;
}
.hero__title .word { display: inline-block; will-change: transform; }
/* Hidden up front only when JS can bring them back (see .js in <head>). */
.js .hero__title .word { transform: translateY(140%); }
.hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  padding-top: 26px;
}
.hero__tagline {
  max-width: 40ch;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.4;
}
.hero__loc { color: var(--muted); }

/* ---------- Work list (hover-preview) ---------- */
.work-list { list-style: none; border-top: 1px solid var(--line); }
.work-row { border-bottom: 1px solid var(--line); }
.work-row__link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(20px, 3vw, 34px) 0;
  transition: padding 0.4s var(--ease), color 0.3s var(--ease);
}
.work-row__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 6vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  transition: transform 0.4s var(--ease), color 0.3s var(--ease);
}
.work-row__meta {
  display: flex;
  gap: 18px;
  color: var(--muted);
  flex-shrink: 0;
  transition: color 0.3s var(--ease);
}
/* display:contents dissolves this wrapper on desktop, so the title and meta
   stay direct flex children of the link exactly as before. Touch layouts
   below turn it back into a real column beside the thumbnail. */
.work-row__text { display: contents; }
.work-row__thumb { display: none; }

/* ---------- About ---------- */
/* The statement is its own full-width block so it can be pinned. Pinning an
   element taller than the viewport strands its overflow, so this stays short. */
.about__statement {
  margin-bottom: clamp(56px, 9vw, 110px);
}
.about__lead {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3.4vw, 2.7rem);
  line-height: 1.16;
  letter-spacing: -0.01em;
  max-width: 30ch;   /* keeps the pinned block well under viewport height */
}
.about__lead em { font-style: italic; color: var(--muted); }

/* Word spans made by the read-along splitter. Each is tweened from --off back
   to the colour it computed to, so em stays muted and .accent stays cobalt. */
.about__lead .w { transition: none; }

.about {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}
.about__body p { color: #34332b; margin-bottom: 40px; }
.about__cols { display: flex; gap: clamp(30px, 6vw, 70px); }
.meta-block h3 {
  color: var(--muted);
  margin-bottom: 14px;
  font-weight: 400;   /* it's a label, not a heading in appearance */
}
.meta-block ul { list-style: none; }
.meta-block li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
}

/* ---------- Contact ---------- */
.section--contact { text-align: center; padding-bottom: clamp(60px, 10vw, 120px); }
.contact__lead {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  color: var(--muted);
  margin-bottom: 24px;
}
.contact__email {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 7.5vw, 6rem);
  letter-spacing: -0.02em;   /* same "ly" pair as the hero — keep it clear */
  line-height: 1.05;
  /* One 20-character token with no break opportunity. At the old 2rem floor
     it measured 366px and was clipped on any phone under 375px. */
  overflow-wrap: anywhere;
  padding: 6px 0;
  transition: color 0.3s var(--ease);
}
.contact__socials {
  display: flex;
  gap: clamp(20px, 4vw, 44px);
  justify-content: center;
  margin-top: 44px;
  color: var(--muted);
}
.contact__socials a { padding: 14px 4px; margin: -14px 0; transition: color 0.2s var(--ease); }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px var(--pad);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  justify-content: space-between;
  color: var(--muted);
}
.footer a { padding: 14px 0; margin: -14px 0; }

/* ---------- Focus ----------
   One visible, consistent ring for every interactive element. Separate from
   :hover on purpose — keyboard users need this on touch devices too, where
   the hover block below never applies. */
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Skip link: visually hidden until focused, then it lands top-left. */
.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 1001;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 18px;
  border-radius: 4px;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- Hover states ----------
   Capability-gated as a group. Touch devices get none of these, so nothing
   can stick after a tap. */
@media (hover: hover) and (pointer: fine) {
  .loader__skip:hover { color: var(--accent); }
  .nav__links a:hover { color: var(--accent); }
  .work-row:hover .work-row__link { padding-left: 20px; }
  .work-row:hover .work-row__title { color: var(--accent); transform: translateX(10px); }
  .work-row:hover .work-row__meta { color: var(--text); }
  .contact__email:hover { color: var(--accent); }
  .contact__socials a:hover { color: var(--accent); }
  .footer a:hover { color: var(--accent); }
}

/* ---------- Reveal animation (fallback if GSAP absent) ---------- */
.reveal { opacity: 0; transform: translateY(22px); }
.no-js-anim .reveal, .revealed { opacity: 1; transform: none; transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }

/* ---------- Responsive ---------- */
/* Selected Work carries no imagery without a hover preview, so touch and
   narrow screens get a real thumbnail per row instead. */
@media (hover: none), (max-width: 820px) {
  .work-row__thumb {
    display: block;
    width: clamp(84px, 24vw, 132px);
    height: auto;
    flex: none;
    border-radius: 5px;
    background: var(--bg-2);
  }
  .work-row__link { flex-direction: row; align-items: center; gap: clamp(14px, 4vw, 24px); }
  .work-row__text {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }
}

@media (max-width: 820px) {
  .work-row__meta { gap: 14px; flex-wrap: wrap; }
  .nav__links { gap: 16px; }
  .hero__meta { flex-direction: column; align-items: flex-start; }
}

/* Above ~1650px the 1200px cap leaves the hero looking stranded. */
@media (min-width: 1650px) {
  :root { --maxw: 1360px; }
}

@media (max-width: 560px) {
  .about__cols { flex-direction: column; gap: 26px; }
  /* 01/02/03 prefixes are the first thing to go when the bar gets tight */
  .nav__links a .mono { display: none; }
  .nav__links { gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .cursor, .preview { display: none !important; }
  .loader { display: none !important; }
  .js .hero__title .word { transform: none; }
  .nav { transition: none; }
  .nav--up { transform: none; }
  /* No pin, no read-along — the statement is just text. The splitter doesn't
     run under reduced motion, but this guards it if anything else sets --off. */
  .about__lead .w { color: inherit !important; }
}
