/* =========================================================
   CyberCultur — monochrome, minimal
   ========================================================= */

:root {
  --black: #0a0a0a;
  --white: #fafafa;
  --grey-1: #171717;  /* placeholder fill on dark */
  --grey-2: #2a2a2a;  /* hairlines on dark */
  --grey-3: #8a8a8a;  /* meta text — reads on both */
  --grey-4: #d8d8d8;  /* hairlines on light */

  --fg: var(--white);
  --bg: var(--black);

  --gutter: clamp(1.25rem, 5vw, 5rem);
  --rule: 1px solid var(--grey-2);
  --header-h: 4.5rem;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.6s;

  --step--1: clamp(0.75rem, 0.72rem + 0.15vw, 0.84rem);
  --step-0:  clamp(0.95rem, 0.9rem + 0.25vw, 1.06rem);
  --step-1:  clamp(1.15rem, 1.05rem + 0.5vw, 1.5rem);
  --step-2:  clamp(1.5rem, 1.25rem + 1.2vw, 2.5rem);
  --step-3:  clamp(2rem, 1.4rem + 3vw, 4.5rem);
  --step-4:  clamp(2.5rem, 1.2rem + 6.5vw, 9rem);
}

/* Light section against the dark base. Meta grey is darkened here — #8a8a8a
   only reaches 3.3:1 on white, below AA; #6b6b6b clears it at 5:1. */
.is-inverted {
  --fg: var(--black);
  --bg: var(--white);
  --rule: 1px solid var(--grey-4);
  --grey-2: var(--grey-4);
  --grey-1: #f0f0f0;
  --grey-3: #6b6b6b;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;   /* fallback for anchor jumps if Lenis is absent */
}

/* Lenis smooth scroll. When it is driving, it disables native smooth so its
   own easing owns the motion; when stopped (panel open) the page is frozen. */
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--step-0);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.is-locked {
  overflow: hidden;
}

h1, h2, h3, p, ul, figure { margin: 0; }
ul { list-style: none; padding: 0; }
img { display: block; max-width: 100%; height: auto; }

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.75rem 1rem;
  background: var(--white);
  color: var(--black);
}
.skip-link:focus { left: 0; }

/* ---------- header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  padding-top: 2rem;
  color: var(--white);   /* white on the dark base */
  pointer-events: none;
  transition: transform 0.45s var(--ease), color 0.3s var(--ease);
}
.site-header a { pointer-events: auto; }

/* Flipped to dark ink by JS while the header overlaps the light About section. */
.site-header.on-light { color: var(--black); }

/* Retracts while scrolling down so it never sits on top of section headings,
   and returns as soon as the user scrolls back up. */
.site-header.is-hidden { transform: translateY(-135%); }

.wordmark {
  display: block;
  font-size: 0;   /* strip any inline whitespace around the logo */
}

/* The logo art is black on transparent. Inverted to white for the dark base;
   over the light About section the header flips to `on-light` and the invert
   is dropped so the original black art shows. */
.wordmark-logo {
  display: block;
  height: 5rem;
  width: auto;
  transition: filter 0.3s var(--ease);
}
.site-header.on-light .wordmark-logo { filter: none; }

.site-nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2.5rem);
  font-size: var(--step--1);
  letter-spacing: 0.06em;
}
.site-nav a { position: relative; }
.site-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease);
}
.site-nav a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- sections ---------- */

section {
  background: var(--bg);
  color: var(--fg);
  padding: clamp(4rem, 10vw, 9rem) var(--gutter);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: var(--rule);
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

.section-title,
.section-count {
  font-size: var(--step--1);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--grey-3);
}

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

.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-top: var(--header-h);
  padding-bottom: clamp(2rem, 5vw, 4rem);
}

.hero-title {
  font-size: var(--step-4);
  line-height: 0.95;
  letter-spacing: -0.035em;
  font-weight: 400;
  margin-bottom: clamp(2rem, 6vw, 5rem);
}

.hero-title .line {
  display: block;
  overflow: hidden;
}
.hero-title .line > span { display: block; }

.hero-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding-top: 1.5rem;
  border-top: var(--rule);
}

.hero-sub {
  max-width: 42ch;
  color: var(--grey-3);
}

.scroll-cue {
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--grey-3);
  white-space: nowrap;
}

/* ---------- work list ---------- */

.work-list { border-top: var(--rule); }

.work-item { border-bottom: var(--rule); }

.work-link {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  align-items: center;
  gap: 1.5rem;
  padding: clamp(1.25rem, 3vw, 2.25rem) 0;
  position: relative;
  transition: color 0.5s var(--ease), padding 0.5s var(--ease);
}

/* Inverting fill sweeps in from the left on hover. */
.work-link::before {
  content: '';
  position: absolute;
  inset: 0 calc(var(--gutter) * -1);
  background: var(--white);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
  z-index: 0;
}
.work-link > * { position: relative; z-index: 1; }

.work-index,
.work-tags {
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  color: var(--grey-3);
  transition: color 0.5s var(--ease);
}

.work-name {
  font-size: var(--step-3);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 400;
}

.work-tags { text-align: right; }

@media (hover: hover) and (pointer: fine) {
  .work-link:hover::before { transform: scaleX(1); }
  .work-link:hover { color: var(--black); padding-left: 1.25rem; }
  .work-link:hover .work-index,
  .work-link:hover .work-tags { color: var(--grey-3); }
}

.work-link:focus-visible { outline-offset: -4px; }

/* Static thumbnail shown on touch / narrow screens only. */
.work-thumb { display: none; }

/* ---------- cursor preview ---------- */

.cursor-preview {
  position: fixed;
  top: 0;
  left: 0;
  width: clamp(10rem, 16vw, 16rem);
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  will-change: transform;
}
.cursor-preview .media { aspect-ratio: 16 / 9; }

@media (hover: none), (pointer: coarse) {
  .cursor-preview { display: none; }
}

/* ---------- media placeholders ---------- */

.media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;   /* images 01 and 04, plus list thumbs and previews */
  overflow: hidden;
  background: var(--grey-1);
  border: 1px solid var(--grey-2);
}

/* Fallback for browsers without aspect-ratio (older Safari). */
@supports not (aspect-ratio: 16 / 9) {
  .media::before { content: ''; display: block; padding-top: 56.25%; }
  .media > img { position: absolute; inset: 0; }
}

.media > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s var(--ease);
}

/* Missing image: hide the broken icon, show the expected filename instead. */
.media.is-missing > img { opacity: 0; }
.media.is-missing::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  color: var(--grey-3);
  word-break: break-word;
}

/* Images 02 and 03 — the offset pair. */
.media--portrait { aspect-ratio: auto; }
@supports not (aspect-ratio: 3 / 4) {
  .media--portrait::before { padding-top: 133.333%; }
}

/* ---------- about ---------- */

.about-body {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  max-width: 68ch;
}

.about-lead {
  font-size: var(--step-2);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.capabilities { margin-top: clamp(1rem, 3vw, 2rem); }

.capabilities-title {
  font-size: var(--step--1);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--grey-3);
  margin-bottom: 1rem;
}

.capabilities-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.capabilities-list li {
  border: var(--rule);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: var(--step--1);
}

/* ---------- contact ---------- */

.contact { text-align: left; }

.contact-email {
  display: inline-block;
  font-size: var(--step-3);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: clamp(1.5rem, 4vw, 3rem) 0 1rem;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  transition: background-size 0.5s var(--ease);
}
.contact-email:hover { background-size: 0% 1px; }

.contact-note { color: var(--grey-3); }

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

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem var(--gutter);
  border-top: 1px solid var(--grey-2);
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  color: var(--grey-3);
}

/* Sits on the dark base, so invert the black art to white. No blend needed. */
.footer-logo {
  height: 5rem;
  width: auto;
}

/* =========================================================
   Project detail panels
   ========================================================= */

.panel {
  position: fixed;
  inset: 0;
  z-index: 150;
  /* Reset the generic `section` padding — panels manage their own spacing,
     and any inherited inline padding would break the full-bleed images. */
  padding: 0;
  background: var(--black);
  color: var(--white);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;

  /* The slide is a CSS transition, not a JS tween, so a panel's visibility
     never depends on requestAnimationFrame running. Worst case it appears
     instantly; it can never be left invisible while scroll is locked. */
  visibility: hidden;
  transform: translateY(100%);
  transition: transform 0.7s var(--ease), visibility 0s linear 0.7s;
}

.panel.is-open {
  visibility: visible;
  transform: none;
  transition: transform 0.7s var(--ease), visibility 0s linear 0s;
}

.panel-close {
  position: fixed;
  top: 1rem;
  right: var(--gutter);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  /* Mid grey rather than the hairline token — this button floats over body
     copy and needs to separate from it. */
  border: 1px solid var(--grey-3);
  border-radius: 999px;
  background: var(--black);
  color: var(--white);
  font: inherit;
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 2px 16px rgb(0 0 0 / 0.5);
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}
.panel-close:hover { background: var(--white); color: var(--black); }
.panel-close-icon { display: none; }

.panel-inner { padding: 0 0 clamp(4rem, 8vw, 7rem); }

.panel-head {
  padding: calc(var(--header-h) + clamp(2rem, 6vw, 5rem)) var(--gutter) clamp(2rem, 5vw, 3.5rem);
}

.panel-title {
  font-size: var(--step-4);
  line-height: 0.95;
  letter-spacing: -0.035em;
  font-weight: 400;
}

.panel-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: var(--rule);
}

.panel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-3);
}

.panel-live {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-bottom: 2px;
  border-bottom: 1px solid currentColor;
  transition: opacity 0.4s var(--ease);
}
.panel-live .arrow { transition: transform 0.4s var(--ease); }
.panel-live:hover .arrow { transform: translate(2px, -2px); }

.panel-media { padding: 0 var(--gutter); }
.panel-media--bleed { padding: 0; }
.panel-media--bleed .media { border-left: 0; border-right: 0; }

.panel-body {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(2rem, 5vw, 4rem) clamp(1.5rem, 3vw, 3rem);
  padding: clamp(3rem, 7vw, 6rem) var(--gutter);
  align-items: start;
}

.block { grid-column: 1 / -1; }
.block--overview  { grid-column: 1 / span 7; }
.block--role      { grid-column: 1 / span 5; }
.block--stack     { grid-column: 7 / span 5; }
.block--pair      { grid-column: 1 / -1; }
.block--contrib   { grid-column: 1 / span 8; }

.block-label {
  font-size: var(--step--1);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--grey-3);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  border-bottom: var(--rule);
}

.block-text { font-size: var(--step-1); line-height: 1.45; }
.block--overview .block-text { font-size: var(--step-2); line-height: 1.25; letter-spacing: -0.015em; }

.stack-row { display: flex; gap: 0.75rem; padding: 0.5rem 0; }
.stack-row dt { color: var(--grey-3); min-width: 8ch; }
.stack-row dd { margin: 0; }

.contrib-list { display: grid; }
.contrib-list li {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: var(--rule);
}
.contrib-list li::before {
  content: counter(contrib, decimal-leading-zero);
  counter-increment: contrib;
  color: var(--grey-3);
  font-size: var(--step--1);
  letter-spacing: 0.1em;
}
.contrib-list { counter-reset: contrib; }

/* Offset image pair */
.pair {
  display: grid;
  grid-template-columns: repeat(12, 1fr); 
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: start;
}
.media.media--portrait:nth-of-type(1) {grid-column: 2 / 6;}
.media.media--portrait:nth-of-type(2) {
    grid-column: 8 / 12;
}
.pair > :last-child { margin-top: clamp(2rem, 6vw, 5rem); }

/* Next project */
.panel-next {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: clamp(3rem, 7vw, 6rem) var(--gutter) 0;
  padding-top: 1.5rem;
  border-top: var(--rule);
  cursor: pointer;
}
.panel-next .label {
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--grey-3);
}
.panel-next .name {
  font-size: var(--step-3);
  letter-spacing: -0.02em;
  line-height: 1.05;
  transition: transform 0.5s var(--ease);
}
.panel-next:hover .name { transform: translateX(-0.5rem); }

/* =========================================================
   Reveal defaults
   Elements start hidden ONLY when GSAP is confirmed present
   and the user has not asked for reduced motion.
   ========================================================= */

/* Reveals are pure CSS transitions toggled by a class, so content is never
   dependent on an animation library's ticker to become readable.
   `--i` (set in JS) staggers each group. */
html.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: calc(var(--i, 0) * 60ms);
}
html.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .panel { transition: none; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1024px) {
  .block--overview { grid-column: 1 / span 9; }
  .block--contrib  { grid-column: 1 / span 10; }
}

@media (max-width: 768px) {
  .media.media--portrait {
    grid-column: 1 / 12 !important;
}
.wordmark-logo {
    height: 3.5rem;
}

.footer-logo {
    height: 3.5rem;
}
a.contact-email {
    font-size: 1.75rem;
}
  :root { --header-h: 3.75rem; }

  .site-nav { gap: 1rem; }

  .hero-foot { flex-direction: column; align-items: flex-start; gap: 1rem; }

  /* Work rows stack: index + name, then tags and a static thumbnail. */
  .work-link {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    align-items: start;
  }
  .work-link:hover { padding-left: 0; }
  .work-tags { text-align: left; }
  .work-thumb {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
  }

  .panel-body { display: block; }
  .panel-body > .block + .block { margin-top: clamp(2rem, 8vw, 3rem); }
  .pair { grid-template-columns: 1fr; }
  .pair > :last-child { margin-top: 0; }

  /* Compact icon button — a wide pill crowds the body copy at this width. */
  .panel-close {
    right: 1rem;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    justify-content: center;
  }
  .panel-close-text { display: none; }
  .panel-close-icon { display: block; font-size: 1.5rem; line-height: 1; }

  .panel-head { padding-top: calc(var(--header-h) + 2.5rem); }

  .contrib-list li { grid-template-columns: 2.5rem 1fr; gap: 0.75rem; }
}

@media (min-width: 1800px) {
  :root { --gutter: 7vw; }
}
