:root {
  --color-bg: #1D1D1D;
  --color-fg: #E5E4E0;
  --color-muted: #E5E4E099;
  --color-border: #E5E4E01A;
  --sand: #E3C9A8;
  --rose: #D9AFA6;
  --ice: #AFC4D4;
  --sage: #A9B7A6;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--color-bg);
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: Archivo, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--color-fg);
  text-decoration: none;
}

img, video { max-width: 100%; }

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

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- decorative layers ---------- */

@keyframes heroPulse { 0%, 100% { opacity: .92; } 50% { opacity: .68; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .4;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  z-index: 2;
  /* Flush to the top at every width: there is no fixed header any more. */
  padding-top: 0;
}


.hero-title {
  /* Pull the work list up so the first tile overlaps the bottom ~22% of the
     glyph. The tile is positioned (z-index 2) and the title is not, so the
     tile paints over the letters -- which also hides the drop-shadow glow
     that used to pulse against the tile's top edge.
     Both this and line-height are in vw, not em: main.js re-fits font-size
     (once on load, again after the webfont swaps) and anything em-based here
     would move the tile with it -- that cost 0.035 CLS. The fit always lands
     near 100vw/6.32, so these vw values equal the em ones at the fitted size,
     but stay put while it settles. */
  /* -0.78vw cancels the half-leading of the 21.4vw line box, so the flat cap
     tops land on y=0 -- flush at the top the way the M and K are at the sides. */
  margin: -0.78vw 0 -5.54vw;
  padding: 0;
  /* No-JS fallback; main.js measures the real glyph box and overrides this so
     the M and the K sit flush against the viewport edges at any width. */
  font-size: calc(100vw / 6.32);
  font-weight: 900;
  font-stretch: 125%;
  letter-spacing: -0.01em;
  line-height: 21.4vw;
  text-transform: uppercase;
  animation: riseIn .8s ease both;
}

.hero-title .wash {
  position: relative;
  display: block;
  white-space: nowrap;
  filter: url(#wwwWash);
}

.hero-title .fill {
  position: relative;
  display: inline-block;
  margin-left: var(--hero-bearing-l, 0px);
  transform: scaleY(1.7);
  transform-origin: left center;
  color: #fff;
  -webkit-text-fill-color: #fff;
  animation: heroPulse 9s ease-in-out infinite;
  /* em, not px: at the desktop size these resolve to the original 26/60px,
     but they now shrink with the type instead of being ~3.4x oversized on
     mobile (which is what blew the glow out and made it hit the filter edge). */
  filter: drop-shadow(0 0 0.114em rgba(215,158,147,.32)) drop-shadow(0 0 0.263em rgba(159,182,204,.2));
  font-weight: 900;
}

/* ---------- work grid ---------- */

.work-list {
  position: relative;
  z-index: 2;
  margin-top: 0;
  padding: 0 clamp(16px, 2.2vw, 34px) clamp(48px, 7vw, 96px);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.6vw, 22px);
}

.project { display: flex; flex-direction: column; }

.project-media {
  position: relative;
  display: block;
  width: 100%;
  height: clamp(108px, 31vh, 432px);
  overflow: hidden;
  background-color: #141413;
  box-shadow: inset 0 0 70px 12px rgba(0,0,0,.45), inset 0 0 2px 1px rgba(0,0,0,.6);
}

@keyframes vhsJitter {
  0%, 91%, 100% { transform: translate(0, 0); }
  92% { transform: translate(-3px, 1px); }
  93% { transform: translate(2px, -1px); }
  94% { transform: translate(-1px, 0); }
  95%, 97% { transform: translate(1px, 0); }
  96% { transform: translate(0, 1px); }
}

.project-media video,
.project-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: contrast(1.18) saturate(1.5) brightness(0.94) hue-rotate(-3deg);
}

.project-media video {
  opacity: 0;
  transition: opacity .5s ease;
  animation: vhsJitter 9s steps(1) infinite;
}

.project:nth-of-type(2n) .project-media video { animation-duration: 11s; animation-delay: -4s; }
.project:nth-of-type(3n) .project-media video { animation-duration: 7.5s; animation-delay: -2s; }

.project-media video.is-playing {
  opacity: 1;
}

.project-media .scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(12,12,12,.55) 0%, rgba(12,12,12,.12) 40%, rgba(12,12,12,0) 70%);
}

.project-media::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: .6;
  background:
    linear-gradient(90deg, rgba(255,0,90,.16) 0%, rgba(255,0,90,0) 2.5%, rgba(0,0,0,0) 97%, rgba(0,220,255,.16) 100%);
}

.project-media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .6;
  mix-blend-mode: overlay;
  background-image:
    repeating-linear-gradient(to bottom, rgba(0,0,0,.5) 0px, rgba(0,0,0,.5) 1px, transparent 1px, transparent 3px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.75'/%3E%3C/svg%3E");
  background-size: 100% 3px, 120px 120px;
}

.project-info {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: clamp(14px, 3vw, 48px);
  padding: clamp(18px, 2.1vw, 32px) clamp(14px, 1.7vw, 26px) clamp(22px, 2.4vw, 36px);
  background-color: #1a1a19;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.project-info .scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(92deg, rgba(15,15,14,.86) 0%, rgba(15,15,14,.66) 48%, rgba(15,15,14,.8) 100%);
  pointer-events: none;
}

.project-heading {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1 1 240px;
}

.project-heading h2 {
  margin: 0;
  font-size: clamp(19px, 2.4vw, 36px);
  font-weight: 400;
  font-stretch: 112%;
  letter-spacing: -0.015em;
  line-height: 1;
  text-transform: uppercase;
}

.project-heading .format {
  font-size: clamp(11px, .85vw, 13px);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-fg);
}

.project-credits {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: clamp(4px, .6vw, 9px);
  flex: 0 1 auto;
}

.project-credits li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: clamp(12px, 1vw, 14px);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-fg);
}

/* Rows fan out from the list's vertical middle: the further from center, the
   further right and the dimmer. Selectors below pick the middle row of a
   3-item list, then the two middle rows of a 4-item list. */
.project-credits li { margin-left: 34px; opacity: .65; }
.project-credits li:nth-child(2):nth-last-child(2) { margin-left: 0; opacity: 1; }
.project-credits li:nth-child(2):nth-last-child(3),
.project-credits li:nth-child(3):nth-last-child(2) { margin-left: 11px; opacity: .88; }

.project-credits li::before {
  content: "";
  width: 4px; height: 4px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #E5E4E066;
  transform: translateY(-2px);
}

/* ---------- footer ---------- */

.site-footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--color-border);
  padding: clamp(14px, 1.8vw, 22px) clamp(16px, 2.2vw, 34px);
}

.site-footer .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(16px, 4vw, 48px);
}

.site-footer .cluster {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 34px);
}

.site-footer .icon-link { display: flex; }
.site-footer .icon-linkedin img { display: block; opacity: .85; transition: opacity .2s ease; }
.site-footer .icon-linkedin:hover img { opacity: 1; }
.site-footer .icon-mail { color: var(--ice); }
.site-footer .icon-mail:hover { color: #CFE0EC; }
.site-footer .icon-tel { color: var(--sage); }
.site-footer .icon-tel:hover { color: #C8D6C4; }

.site-footer .signature {
  display: block;
  flex: 0 1 auto;
  width: clamp(140px, 26vw, 300px);
  height: auto;
  opacity: .85;
}

/* ---------- fixed corner controls ---------- */

.corner-dot {
  position: fixed;
  bottom: 18px;
  left: clamp(16px, 2.2vw, 34px);
  z-index: 45;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #E5E4E066;
}

.menu-toggle {
  position: fixed;
  bottom: 18px;
  right: clamp(16px, 2.2vw, 34px);
  z-index: 55;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  justify-content: center;
  width: 54px; height: 40px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .2s ease;
}

.menu-toggle:hover { border-color: #E5E4E066; }

.menu-toggle span {
  display: block;
  width: 20px; height: 1px;
  background: var(--color-fg);
  transition: transform .25s ease, opacity .25s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- full-screen menu overlay ---------- */

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--color-bg);
  padding: clamp(16px, 2.2vw, 34px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .3s ease, transform .3s ease, visibility 0s linear .3s;
}

.menu-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .3s ease, transform .3s ease;
}

.menu-overlay .row { display: flex; align-items: center; justify-content: space-between; }

.menu-signature {
  display: block;
  width: clamp(104px, 13vw, 168px);
  height: auto;
  opacity: .9;
}

.menu-close {
  background: none;
  border: 1px solid #E5E4E033;
  border-radius: 999px;
  color: var(--color-fg);
  font-family: Archivo, sans-serif;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 13px 20px;
  cursor: pointer;
}

.menu-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-links a {
  font-size: clamp(40px, 9vw, 100px);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.02;
  text-transform: uppercase;
  transition: color .2s ease;
}

.menu-links a:hover { color: #ffffffbb; }

.menu-contact {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: clamp(20px, 3vh, 36px);
}

.menu-contact-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 3px;
}

.menu-contact a {
  width: fit-content;
  font-size: clamp(15px, 1.5vw, 19px);
  letter-spacing: .01em;
  color: var(--color-fg);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, color .2s ease;
}

.menu-contact a:hover { border-bottom-color: #E5E4E066; }
.menu-contact a:nth-child(2) { color: var(--ice); }
.menu-contact a:nth-child(3) { color: var(--sage); }
.menu-contact a:nth-child(4) { color: var(--sand); }

.menu-tagline {
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* ---------- reduced motion / lightweight fallback ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-title .fill, .hero-title { animation: none !important; }
  .project-media video { animation: none !important; }
  .menu-overlay { transition: none; }
}

/* ---------- mobile ---------- */

@media (max-width: 700px) {
  /* Taller wordmark. Width is already the full viewport, so "bigger" means
     more scaleY. line-height matches the ink height exactly (19.84vw at
     scaleY 1.7, so 19.84 * 2.4/1.7 = 28.01vw) which leaves zero half-leading,
     keeping the caps flush to y=0. The bottom margin is measured, not derived:
     rendered ink runs 1..104 in a 109 line box at 390w. scaleY, line-height
     and margin are all scaled together by 1.2 (2.4 -> 2.88) for the extra 20%
     of vertical stretch, so the container overlap is unchanged. */
  .hero-title {
    line-height: 33.61vw;
    margin: 0 0 -8.56vw;
  }

  .hero-title .fill {
    transform: scaleY(2.88);
  }

  /* Credits read as a row rather than a stacked fan. The nth-child selectors
     that build the fan out-specify a plain `li`, so they are repeated here to
     be unwound. */
  .project-credits {
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: 16px;
    row-gap: 6px;
    flex: 1 1 100%;
  }

  .project-credits li,
  .project-credits li:nth-child(2):nth-last-child(2),
  .project-credits li:nth-child(2):nth-last-child(3),
  .project-credits li:nth-child(3):nth-last-child(2) {
    margin-left: 0;
    opacity: .85;
  }
}
