/* Host Grotesk, self-hosted (SIL OFL, see fonts/OFL.txt). Variable font: one file covers 400–800. */
@font-face {
  font-family: "Host Grotesk";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/host-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Host Grotesk";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/host-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Host Grotesk";
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/host-grotesk-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Host Grotesk";
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/host-grotesk-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Design is drawn on a 1920px frame. 1 design px = 1 --u, capped at a 1920px viewport. */
:root {
  --bg: #000;
  --fg: #fff;
  --accent: #ea3323;
  color-scheme: dark;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --u: calc(min(100vw, 1920px) / 1920);
  --fs-body: max(calc(32 * var(--u)), 12px);
  --fs-title: max(calc(36 * var(--u)), 13.5px);
  /* hero (frame, lettering, intro) starts below the header links with a visible gap;
     50u is where the frame's top line sits in the Figma frame */
  --header-pad: calc(14 * var(--u));
  --hero-shift: max(0px, calc(var(--header-pad) + 1.34 * var(--fs-body) + max(calc(16 * var(--u)), 12px) - 50 * var(--u)));
  --gutter: max(calc(31 * var(--u)), 16px);
}

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

html {
  background: var(--bg);
  overscroll-behavior-x: none;
  /* stop phone browsers from enlarging text in wide blocks (the skills line is thousands of px wide) */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Host Grotesk", system-ui, sans-serif;
  font-size: var(--fs-body);
  line-height: 1.25;
  letter-spacing: -0.03em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: none;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  opacity: 0.6;
}

a:focus-visible,
button:focus-visible {
  outline: 1px solid var(--fg);
  outline-offset: 4px;
}

h1,
h2,
h3,
p {
  margin: 0;
  font-size: inherit;
  line-height: inherit;
}

/* Date ranges never break across lines */
.nw {
  white-space: nowrap;
}

.page {
  position: relative;
  width: min(100%, 1920px);
  margin: 0 auto;
  padding-bottom: calc(67 * var(--u));
}

/* Header and footer links: item widths follow the Figma spacing */
.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  padding: var(--header-pad) calc(34 * var(--u)) 0 var(--gutter);
  line-height: 1.34;
}

.nav {
  display: flex;
}

.nav a {
  width: calc(164 * var(--u));
}

.nav a:nth-last-child(2) {
  width: calc(151 * var(--u));
}

.nav a:last-child {
  width: auto;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 0 calc(34 * var(--u)) 0 var(--gutter);
}

.nav--footer a {
  text-decoration: underline;
  text-decoration-thickness: max(calc(2 * var(--u)), 1px);
  text-underline-offset: 0.12em;
}

/* Hero: ornament frame and lettering sit behind the intro text */
.hero__frame,
.hero__logo {
  position: absolute;
  z-index: 1;
  pointer-events: none;
}

.hero__frame {
  top: calc(-40 * var(--u) + var(--hero-shift));
  left: calc(4 * var(--u));
  width: calc(1916 * var(--u));
}

.hero__logo {
  top: calc(172.8 * var(--u) + var(--hero-shift));
  left: calc(368.4 * var(--u));
  width: calc(1133 * var(--u));
}

.intro {
  position: relative;
  z-index: 2;
  padding: calc(710 * var(--u) + var(--hero-shift)) var(--gutter) 0;
  text-align: center;
  text-wrap: balance;
}

.intro__name {
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.intro p {
  margin-top: 1.25em;
}

.intro__status {
  font-weight: 800;
}

/* Marquees: skills line and project strips. Two identical groups; main.js moves the track */
.marquee {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  overflow: hidden;
}

.marquee__track {
  display: flex;
  width: max-content;
  will-change: transform;
}

.marquee__group {
  display: flex;
  flex-shrink: 0;
}

.marquee--skills {
  margin-top: calc(136 * var(--u));
  line-height: 1.5; /* keeps the 48px row from the design at body text size */
  white-space: nowrap;
  opacity: 0.57;
}

.marquee--strip {
  display: flex;
  align-items: center;
  height: calc(900 * var(--u));
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.marquee--strip.is-dragging {
  cursor: grabbing;
}

.marquee--strip img {
  width: auto;
  height: calc(var(--strip-h) * var(--u));
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Info: two columns, centred on x = 421.5 and 1432 of the frame */
.info {
  display: grid;
  grid-template-columns: calc(843 * var(--u)) calc(976 * var(--u));
  column-gap: calc(101 * var(--u));
  row-gap: calc(146 * var(--u));
  margin-top: calc(268 * var(--u));
  text-align: center;
}

.info h2 {
  font-weight: 800;
  text-transform: uppercase;
}

.info p {
  margin-top: 1.25em;
}

/* "Selected works" oval */
.works-title {
  position: relative;
  width: calc(850 * var(--u));
  margin: calc(50.5 * var(--u)) auto 0;
}

.works-title img {
  width: 100%;
}

.works-title h2 {
  position: absolute;
  top: 43.5%;
  left: 0;
  right: 0;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

/* Projects */
.project > * {
  margin-top: calc(var(--mt) * var(--u));
}

.project__head {
  display: grid;
  grid-template-columns: calc(180 * var(--u)) minmax(0, 1fr) calc(180 * var(--u));
  align-items: center;
  width: calc(1390 * var(--u));
  margin-inline: auto;
}

.project__head img {
  width: 100%;
}

.project__head h3 {
  font-size: var(--fs-title);
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.015em;
  text-align: center;
  text-transform: uppercase;
}

.project__text {
  padding-inline: var(--gutter);
  text-align: center;
}

/* Ornament between projects: the same infinity flourish as at the bottom */
.separator {
  margin-top: calc(var(--mt) * var(--u));
}

.separator img {
  width: calc(1455 * var(--u));
  margin-left: calc(232 * var(--u));
}

/* Motion slider: one slide at a time, arrows on the sides */
.slider {
  display: grid;
  grid-template-columns: calc(61 * var(--u)) calc(1355 * var(--u)) calc(61 * var(--u));
  column-gap: calc(88 * var(--u));
  align-items: center;
  width: fit-content;
  margin-inline: auto;
}

.slider__viewport {
  overflow: hidden;
}

.slider__track {
  display: flex;
  transition: transform 0.7s var(--ease);
  touch-action: pan-y;
}

.slider__slide {
  position: relative;
  flex: 0 0 100%;
  aspect-ratio: 1355 / 744;
  background: var(--bg);
}

.slider__slide img,
.slider__slide video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Portrait and square pieces are shown whole, on black */
.slider__slide--contain img,
.slider__slide--contain video {
  object-fit: contain;
}

.slider__arrow {
  display: block;
  justify-self: center;
  /* tap area larger than the small glyph, without moving the layout */
  margin: -12px;
  padding: 12px;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
}

.slider__arrow svg {
  display: block;
  width: calc(20 * var(--u));
  height: calc(29 * var(--u));
}

.slider__arrow--next svg {
  scale: -1 1;
}

.slider__arrow:hover {
  opacity: 0.6;
}

/* "Email copied" notice */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  padding: 0.5em 1em;
  background: var(--fg);
  color: var(--bg);
  font-size: max(calc(24 * var(--u)), 12px);
  white-space: nowrap;
  opacity: 0;
  translate: -50% 8px;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), translate 0.3s var(--ease);
}

.toast.is-shown {
  opacity: 1;
  translate: -50% 0;
}

/* Bottom ornament: same frame flipped, with the infinity flourish */
.finale {
  position: relative;
  height: calc(801 * var(--u));
  margin-top: calc(-8 * var(--u));
  pointer-events: none;
}

.finale__frame {
  position: absolute;
  top: 0;
  left: calc(4 * var(--u));
  width: calc(1916 * var(--u));
  scale: 1 -1;
}

.finale__ornament {
  position: absolute;
  top: calc(428 * var(--u));
  left: calc(232 * var(--u));
  width: calc(1455 * var(--u));
}

/* Mobile: same composition as desktop, scaled down; text sized to the screen width */
@media (max-width: 767px) {
  :root {
    --fs-body: clamp(10px, 2.85vw, 12.5px);
    --fs-title: clamp(11px, 3.2vw, 14px);
    --header-pad: 10px;
  }

  /* desktop line breaks don't fit long paragraphs on a phone; titles keep theirs */
  .project__text .lb {
    display: none;
  }

  .site-header {
    padding: 10px 16px 0;
  }

  .site-footer {
    padding-inline: 16px;
  }

  .info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
    padding-inline: 16px;
  }

  .project > *,
  .separator {
    margin-top: max(calc(var(--mt) * var(--u)), 16px);
  }

  .project__head {
    grid-template-columns: 7vw minmax(0, 1fr) 7vw;
    column-gap: 6px;
    width: calc(100% - 32px);
  }

  .slider {
    grid-template-columns: 18px minmax(0, 1fr) 18px;
    column-gap: 8px;
    width: calc(100% - 32px);
  }

  .slider__arrow svg {
    width: 7px;
    height: 10px;
  }
}

/* Motion: hidden start states only when JS is running */
.js [data-load] {
  opacity: 0;
  animation: load-in 1.1s var(--ease) forwards;
  animation-delay: calc(0.15s + var(--i, 0) * 0.12s);
}

.js .hero__logo[data-load] {
  animation-name: logo-in;
  animation-duration: 1.6s;
}

@keyframes load-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes logo-in {
  from {
    opacity: 0;
    filter: blur(14px);
    transform: scale(1.06);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}

.js .hero__frame[data-load],
.js .marquee[data-load] {
  animation-name: fade-in;
  animation-duration: 1.6s;
}

@keyframes fade-in {
  to {
    opacity: 1;
  }
}

.js .marquee--skills[data-load] {
  animation-name: fade-in-skills;
}

@keyframes fade-in-skills {
  to {
    opacity: 0.57;
  }
}

.js [data-reveal] {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}

.js [data-reveal="fade"] {
  transform: none;
  filter: blur(10px);
  transition: opacity 1.4s var(--ease), filter 1.4s var(--ease);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .slider__track {
    transition: none;
  }

  .js [data-load],
  .js [data-reveal],
  .js .hero__logo[data-load],
  .js .hero__frame[data-load],
  .js .marquee[data-load] {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none;
    transition: none;
  }

  .js .marquee--skills[data-load] {
    opacity: 0.57;
  }
}
