/* ------------------------------------------------------------------
   SmithWorks — Isaac Smith portfolio
   Layout from the Figma frames "Wide 1920 / Work" and "Phone 390 / Work".
   Everything is sized in --u, one design pixel scaled to the viewport
   width, so images and type always fill the screen the same way:
   desktop  --u = 100vw / 1920   (floor 0.6px on small laptops)
   phone    --u = 100vw / 390    (≤ 820px wide)
   ------------------------------------------------------------------ */
:root {
  --ink: #000;
  --muted: #767676;
  --bg: #fff;
  --line: #000;
  --tile: #ececec;
  --u: max(calc(100vw / 1920), 0.6px);
  --gut: calc(24 * var(--u));
  --tile-h: calc(560 * var(--u));
  --font: "Instrument Sans", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: calc(20 * var(--u));
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; line-height: 1; }

.muted { color: var(--muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------------- custom cursor (js/main.js) ----------------
   The Figma "Cursor" frame: a dot with four arms. Drawn as an element so it
   stays sharp on every screen; the native cursor is hidden only while it runs. */
html.has-cursor, html.has-cursor * { cursor: none !important; }
.cursor {
  position: fixed; left: 0; top: 0; z-index: 1000;
  width: 22.5px; height: 22.5px; margin: -11.25px 0 0 -11.25px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}
html.has-cursor .cursor.is-on { opacity: 1; }
.cursor svg { display: block; width: 100%; height: 100%; overflow: visible; }
.cursor .arm { transform-box: view-box; transform-origin: 22.6px 22.6px; transition: transform .25s cubic-bezier(.2,.8,.2,1); }
/* over anything clickable the arms pull in towards the dot */
.cursor.is-link .arm { transform: scale(.72); }
.cursor.is-down .arm { transform: scale(.55); }

/* ---------------- cover ---------------- */
.cover {
  position: relative; height: 100vh; height: 100dvh; overflow: hidden;
  --x: 50%; --y: 50%;          /* cursor position inside the cover (set in main.js) */
  --lens: 560px;               /* lens diameter */
}
.cover__link {
  display: block; position: relative;
  height: 100%; width: 100%;
}
/* wider than the viewport, centred so it bleeds off both edges as in Figma.
   Sized only in vw, so the crop of the letters is identical on every screen. */
.cover__mark {
  position: absolute; left: 50%; top: 50%;
  translate: -50% -50%;
  text-box: trim-both cap alphabetic;   /* centre on the cap height, as in Figma */
  font-weight: 700;
  font-size: 19.55vw;          /* 375.5px at the 1920 Figma frame */
  line-height: 1;
  letter-spacing: -0.05em;
  white-space: nowrap;
  margin: 0;
}
/* lens: a crisp circle pinned to the cursor, hidden until the cursor is over the title.
   Progressive blur: six stacked 1:1 copies of the title, each blurrier than the
   one below and masked to a smaller soft disc. */
.cover__lens {
  position: absolute; left: 0; top: 0;
  width: var(--lens); height: var(--lens);
  translate: calc(var(--x) - var(--lens) / 2) calc(var(--y) - var(--lens) / 2);
  overflow: hidden;
  clip-path: circle(50% at 50% 50%);
  -webkit-clip-path: circle(50% at 50% 50%);
  isolation: isolate;
  pointer-events: none;
  visibility: hidden;
}
.cover.is-lens .cover__lens { visibility: visible; }
.cover__lens-layer {
  position: absolute; inset: 0;
  overflow: hidden;
  clip-path: circle(50% at 50% 50%);
  -webkit-clip-path: circle(50% at 50% 50%);
  background: var(--bg);
  -webkit-mask-image: radial-gradient(circle closest-side, #000 var(--solid), rgba(0,0,0,0) var(--fade));
  mask-image: radial-gradient(circle closest-side, #000 var(--solid), rgba(0,0,0,0) var(--fade));
}
.cover__lens-layer:nth-child(1) { --b: 0.5px; --solid: 100%; --fade: 100%; background: transparent; }
.cover__lens-layer:nth-child(2) { --b: 2.5px; --solid: 68%;  --fade: 92%; }
.cover__lens-layer:nth-child(3) { --b: 6px;   --solid: 52%;  --fade: 76%; }
.cover__lens-layer:nth-child(4) { --b: 11px;  --solid: 36%;  --fade: 60%; }
.cover__lens-layer:nth-child(5) { --b: 17px;  --solid: 20%;  --fade: 44%; }
.cover__lens-layer:nth-child(6) { --b: 24px;  --solid: 0%;   --fade: 28%; }
.cover__lens-inner {
  position: absolute;
  width: var(--cw, 100vw); height: var(--ch, 100vh);
  left: calc(var(--lens) / 2 - var(--x)); top: calc(var(--lens) / 2 - var(--y));
  filter: blur(var(--b));
}
@media (hover: none) { .cover__lens { display: none; } }

/* scroll cue: a line drops out from behind the wordmark (Figma 39:467).
   Progressive blur: four copies of the line, each blurrier than the last and
   masked to a higher band, so it is soft and wide at the top and sharp with a
   round end at the bottom. It draws down, holds, then closes: the soft blurred
   top slides down the line (--c) until the whole line has dissolved into it.
   Fades out as soon as the work starts to appear (--p from main.js). */
@property --c { syntax: "<percentage>"; inherits: true; initial-value: 0%; }
.cover__cue {
  --cue-gap: 24px;                           /* ≈ 5 mm above the bottom edge */
  position: absolute; left: 50%; top: 50%; bottom: var(--cue-gap);
  width: 60px; translate: -50% 0;
  pointer-events: none;
  opacity: clamp(0, 1 - var(--p, 0) * 6, 1);
}
.cover__line {
  --c: 0%;
  position: absolute; inset: 0;
  animation: cue-line 3.2s infinite;
}
/* each copy is masked on a wide wrapper so its blur can spread sideways;
   every mask is offset by --c, so the blur profile travels down as it closes */
.cover__line i {
  position: absolute; inset: 0;
  -webkit-mask-image: linear-gradient(to bottom, var(--m));
  mask-image: linear-gradient(to bottom, var(--m));
}
.cover__line b {
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 4px; margin-left: -2px;
  border-radius: 2px;                        /* round end */
  /* 20% lighter than the Figma #3b3b3b */
  background: linear-gradient(to bottom, rgba(98,98,98,0) 0%, rgba(98,98,98,.35) 30%, #626262 100%);
  filter: blur(var(--b));
}
.cover__line i:nth-child(1) { --b: 0px;  --m: transparent calc(var(--c) + 50%), #000 calc(var(--c) + 78%); }
.cover__line i:nth-child(2) { --b: 2px;  --m: transparent calc(var(--c) + 25%), #000 calc(var(--c) + 48%), #000 calc(var(--c) + 60%), transparent calc(var(--c) + 80%); }
.cover__line i:nth-child(3) { --b: 5px;  --m: transparent calc(var(--c) + 4%), #000 calc(var(--c) + 22%), #000 calc(var(--c) + 34%), transparent calc(var(--c) + 52%); }
.cover__line i:nth-child(4) { --b: 10px; --m: transparent calc(var(--c) - 12%), #000 var(--c), #000 calc(var(--c) + 10%), transparent calc(var(--c) + 28%); }
@keyframes cue-line {
  0%   { clip-path: inset(0 0 100% 0); --c: 0%;   animation-timing-function: cubic-bezier(.65,0,.35,1); }
  40%  { clip-path: inset(0 0 0 0);    --c: 0%; }
  55%  { clip-path: inset(0 0 0 0);    --c: 0%;   animation-timing-function: cubic-bezier(.55,0,.45,1); }
  100% { clip-path: inset(0 0 0 0);    --c: 112%; }
}
@media (prefers-reduced-motion: reduce) { .cover__line { animation: none; } }

/* ---------------- bottom blur ----------------
   Progressive blur pinned to the bottom of the screen over all content
   (Figma "VIEW HEIGHT EXAMPLE"). Four stacked backdrop blurs, each masked to
   a lower band, so the blur builds towards the bottom edge. */
.edge-blur {
  position: fixed; left: 0; right: 0; bottom: -2px; z-index: 50;
  height: calc(138 * var(--u) + 2px);
  min-height: 58px;
  pointer-events: none;
  opacity: clamp(0, var(--p, 0) * 2 - 0.6, 1);
}
.edge-blur i {
  position: absolute; inset: 0;
  -webkit-backdrop-filter: blur(var(--b)); backdrop-filter: blur(var(--b));
  -webkit-mask-image: linear-gradient(to bottom, transparent var(--from), #000 var(--to));
  mask-image: linear-gradient(to bottom, transparent var(--from), #000 var(--to));
}
.edge-blur i:nth-child(1) { --b: 1px;  --from: 0%;  --to: 30%; }
.edge-blur i:nth-child(2) { --b: 3px;  --from: 20%; --to: 55%; }
.edge-blur i:nth-child(3) { --b: 6px;  --from: 45%; --to: 80%; }
.edge-blur i:nth-child(4) { --b: 10px; --from: 65%; --to: 100%; }
.edge-blur::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,.12) 40%, rgba(0,0,0,.55));
}

/* ---------------- scroll reveal ----------------
   --p goes 0 → 1 over the first viewport of scrolling (set in main.js).
   The work content starts blurred and faint under the cover and sharpens
   as it comes up; once --p reaches 1 the filter is removed entirely.   */
.reveal {
  --p: 0;
  position: relative;
  filter: blur(calc((1 - var(--p)) * 28px));
  opacity: calc(0.15 + var(--p) * 0.85);
  will-change: filter, opacity;
}
.reveal.is-clear { filter: none; opacity: 1; will-change: auto; }
@media (prefers-reduced-motion: reduce) {
  .reveal { filter: none; opacity: 1; }
}

/* ---------------- nav ---------------- */
.nav {
  display: flex; align-items: center;
  height: calc(88 * var(--u));
  margin: 0 var(--gut);
  padding-left: calc(10 * var(--u));
  border-bottom: 1px solid var(--line);
  font-size: calc(30 * var(--u)); letter-spacing: -0.05em; line-height: 1;
}
.nav__brand { white-space: nowrap; }

/* ---------------- intro ---------------- */
.intro {
  margin: 0 var(--gut);
  padding: calc(34 * var(--u)) 0 calc(220 * var(--u));
  border-bottom: 1px solid var(--line);
}
.intro h1 {
  max-width: calc(1180 * var(--u));
  font-size: calc(88 * var(--u)); letter-spacing: -0.05em; line-height: 1;
}

/* ---------------- section label ---------------- */
.label {
  display: flex; align-items: center;
  height: calc(88 * var(--u));
  margin: 0 var(--gut);
  font-size: calc(30 * var(--u)); letter-spacing: -0.05em; line-height: 1;
}

/* ---------------- project cards ---------------- */
.card {
  display: flex; flex-direction: column; gap: calc(28 * var(--u));
  padding: 0 0 calc(80 * var(--u)) var(--gut);
}
/* strip: fixed-height tiles at natural aspect, scrolls sideways and
   runs off the right edge of the screen */
.card__strip {
  width: 100%;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.card__strip::-webkit-scrollbar { display: none; }
.card__images {
  display: flex; gap: calc(28 * var(--u)); align-items: flex-start;
  width: max-content; height: var(--tile-h);
  padding-right: var(--gut);
}
.tile {
  flex: 0 0 auto;
  height: var(--tile-h); width: auto;
  background: var(--tile);
}
.tile--short { height: calc(var(--tile-h) * 288 / 396); align-self: center; }
.tile--ph {
  width: calc(var(--tile-h) * 517 / 396);
  display: grid; place-items: center;
  color: var(--muted);
}

.card__meta {
  position: relative;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-right: var(--gut);
}
.card__title {
  display: flex; gap: calc(20 * var(--u)); align-items: flex-start;
  width: calc(640 * var(--u));
  font-weight: 600; line-height: 1;
}
.card__title .client { color: var(--muted); white-space: nowrap; }
.card__title .titles { display: flex; flex-direction: column; gap: calc(4 * var(--u)); }
.card__title .titles .sub { color: var(--muted); }
.card__body {
  display: flex; flex-direction: column; gap: calc(22 * var(--u));
  width: calc(470 * var(--u));
  line-height: 1.12; text-align: justify;
}
.card__body--end { text-align: right; }

/* scroll bar under each strip (Figma 38:1324): grey track, dark thumb with a white rim.
   Added and driven by main.js; drag the thumb or click the track to scroll. */
.card__bar {
  position: absolute; left: 50%; top: calc(6 * var(--u));
  width: calc(513 * var(--u)); height: max(4px, calc(5.5 * var(--u)));
  translate: -50% 0;
  border-radius: 10px;
  background: #e9e9e9;
  touch-action: none;
}
.card__bar[hidden] { display: none; }
.card__thumb {
  position: absolute; left: 0; top: 0; height: 100%;
  width: calc(60 * var(--u)); min-width: 36px;
  border: 1px solid #fff; border-radius: 18px;
  background: #656565;
  translate: var(--tx, 0) 0;
}
/* a bigger invisible hit area so the thin bar is easy to grab */
.card__bar::before { content: ""; position: absolute; inset: -10px 0; }

/* ---------------- about ---------------- */
.about {
  display: flex; align-items: flex-start;
  margin: calc(20 * var(--u)) var(--gut) 0;
  padding: calc(26 * var(--u)) 0 calc(140 * var(--u));
  border-top: 1px solid var(--line);
}
.about__label {
  flex: 0 0 50%;
  font-size: calc(30 * var(--u)); letter-spacing: -0.05em; line-height: 1;
}
.about__copy {
  width: calc(812 * var(--u)); max-width: 50%;
  display: flex; flex-direction: column; gap: calc(26 * var(--u));
  font-size: calc(26 * var(--u)); letter-spacing: -0.05em; line-height: 1.2;
}
.about__links {
  display: flex; flex-direction: column; gap: calc(12 * var(--u)); margin-top: calc(12 * var(--u));
  font-size: calc(20 * var(--u)); letter-spacing: -0.03em; line-height: 1.1;
  color: var(--muted);
}
.about__links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------------- footer ---------------- */
.footer {
  display: flex; align-items: flex-start;
  padding: calc(40 * var(--u)) var(--gut) 0;
}
.footer__logo { flex: 0 0 50%; }
.footer__logo svg { width: calc(151 * var(--u)); height: calc(74 * var(--u)); display: block; }
.footer__rows {
  width: calc(912 * var(--u));
  display: flex; flex-direction: column; gap: calc(40 * var(--u));
  font-size: calc(26 * var(--u)); letter-spacing: -0.05em; line-height: 1;
}
.footer__row { display: flex; justify-content: space-between; align-items: flex-start; }
.footer__row .lab { text-transform: uppercase; }
.footer__vals { display: flex; flex-direction: column; align-items: flex-end; gap: calc(12 * var(--u)); }
.footer__vals a:hover { text-decoration: underline; text-underline-offset: 4px; }
/* wordmark: same size and crop as the cover, bleeding off both edges */
.wordmark {
  display: flex; justify-content: center;
  margin-top: calc(150 * var(--u));
  overflow: hidden;
}
.wordmark span {
  font-weight: 700; font-size: 19.55vw;
  letter-spacing: -0.05em; line-height: 0.9;
  white-space: nowrap;
}

/* below 1000px the scroll bar would collide with the text; the strips still swipe */
@media (max-width: 1000px) { .card__bar { display: none; } }

/* ---------------- phone (Figma "Phone 390 / Work") ---------------- */
@media (max-width: 820px) {
  :root {
    --u: calc(100vw / 390);
    --gut: calc(16 * var(--u));
    --tile-h: calc(220 * var(--u));
  }
  body { font-size: calc(15 * var(--u)); }
  .nav { height: calc(56 * var(--u)); padding-left: 0; font-size: calc(20 * var(--u)); }
  .intro { padding: calc(40 * var(--u)) 0 calc(72 * var(--u)); }
  .intro h1 { max-width: none; font-size: calc(38 * var(--u)); }
  .label { height: calc(56 * var(--u)); font-size: calc(20 * var(--u)); }

  /* strips run edge to edge; client on the left, title on the right, no description */
  .card { gap: calc(16 * var(--u)); padding: 0 0 calc(52 * var(--u)); }
  .card__images { gap: calc(12 * var(--u)); padding-right: 0; }
  .card__meta { padding: 0 calc(10 * var(--u)); }
  .card__title { width: 100%; justify-content: space-between; gap: calc(14 * var(--u)); }
  .card__title .titles { align-items: flex-end; text-align: right; }
  .card__body { display: none; }

  .about {
    flex-direction: column; gap: calc(24 * var(--u));
    margin-top: calc(8 * var(--u));
    padding: calc(20 * var(--u)) 0 calc(72 * var(--u));
  }
  .about__label { flex: none; font-size: calc(20 * var(--u)); }
  .about__copy { width: 100%; max-width: none; gap: calc(16 * var(--u)); font-size: calc(18 * var(--u)); letter-spacing: -0.04em; line-height: 1.25; }
  .about__links { font-size: calc(15 * var(--u)); gap: calc(10 * var(--u)); margin-top: calc(8 * var(--u)); }

  .footer {
    flex-direction: column; gap: calc(40 * var(--u));
    margin: 0 var(--gut); padding: calc(28 * var(--u)) 0 0;
    border-top: 1px solid var(--line);
  }
  .footer__logo { flex: none; }
  .footer__logo svg { width: calc(90 * var(--u)); height: calc(44 * var(--u)); }
  .footer__rows { width: 100%; gap: calc(26 * var(--u)); font-size: calc(16 * var(--u)); letter-spacing: -0.04em; line-height: 1.15; }
  .footer__vals { gap: calc(6 * var(--u)); }
  .wordmark { margin-top: calc(64 * var(--u)); }

  .edge-blur { height: calc(64 * var(--u) + 2px); min-height: 0; }
  .cover__cue { --cue-gap: 30px; }
}
