/* ============================================================
   Benson Mathews — Architect. Editorial single-page portfolio.
   Theme colors live in custom properties; script.js interpolates
   them with scroll so the page inverts white → black → white.
   Portfolio sheets render as full-viewport "plates" with a
   vintage treatment: sepia tone, film grain, vignette, and the
   info set on a scrim along the bottom edge.
   ============================================================ */

:root {
  /* Light theme (default). script.js lerps these live. */
  --bg: #ffffff;
  --text: #111110;
  --muted: #6b6b66;
  --line: #dededa;
  --surface: #ececea;
  --accent: #b0322a;

  /* Fixed plate colors — plates carry their own scrim,
     independent of the page theme. */
  --plate-text: #f4f4f2;
  --plate-muted: #c9c9c2;

  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Archivo", "Inter", system-ui, sans-serif;

  --gutter: clamp(1.25rem, 5vw, 5rem);
  --maxw: 84rem;
}

/* Dark values used by the reduced-motion fallback (no lerp). */
:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --text: #f4f4f2;
  --muted: #8a8a85;
  --line: #262624;
  --surface: #161615;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 450;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip; /* full-bleed plates use 100vw */
}

::selection { background: var(--accent); color: #ffffff; }

/* ---------- Scroll progress hairline ---------- */

.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 60;
  background: transparent;
}
.progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
}

/* ---------- Fixed nav ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.1rem var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.nav__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}

.nav__links {
  display: flex;
  gap: clamp(1rem, 3vw, 2.5rem);
}

.nav__links a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  position: relative;
}

/* Animated hover underline (shared with .ulink) */
.nav__links a::after,
.ulink::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  height: 1px;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav__links a:hover::after,
.nav__links a:focus-visible::after,
.ulink:hover::after,
.ulink:focus-visible::after {
  transform: scaleX(1);
}

/* ---------- Sections: shared scaffolding ---------- */

.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(6rem, 14vh, 10rem) var(--gutter);
}

.section__head {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
  margin-bottom: clamp(2.5rem, 6vh, 4.5rem);
}

.section__num {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 400;
  line-height: 1;
  color: var(--muted);
}

.section__label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text);
}

/* ---------- Hero ---------- */

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8rem var(--gutter) 6rem;
}

/* Portfolio cover — black crumpled paper with the white terrain
   model — ghosted full-bleed behind the name, barely there. */
.hero::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 50vw);
  width: 100vw;
  z-index: 0;
  pointer-events: none;
  background: url("assets/cover.jpg") center 28% / 145% auto no-repeat;
  opacity: 0.16;
  -webkit-mask-image: linear-gradient(180deg, #000 40%, transparent 92%);
  mask-image: linear-gradient(180deg, #000 40%, transparent 92%);
}

.hero__inner,
.hero__scrollcue {
  position: relative;
  z-index: 1;
}

.hero__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.5rem, 12vw, 11rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--text);
}

/* The name is filled with the thesis axonometric — inverted to a
   near-black field with white linework and red interventions. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero__name {
    background: #131312 url("assets/hero-texture.jpg") no-repeat;
    background-size: 135% auto;
    background-position: 30% 40%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    /* Barely-there drift of the drawing inside the letters */
    animation: hero-drift 45s ease-in-out infinite alternate;
  }
}

@keyframes hero-drift {
  from { background-position: 30% 38%; }
  to   { background-position: 68% 62%; }
}

.hero__line { display: block; }
.hero__line--indent { margin-left: clamp(2rem, 10vw, 10rem); }

/* Interactive skyline below the name — a strip of thin bars that
   ripple idly and surge toward the cursor (script.js). Doubles
   as the divider above the meta row. */
.hero__bars {
  height: clamp(64px, 11vh, 110px);
  margin-top: clamp(1.5rem, 4vh, 3rem);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
  cursor: crosshair;
}

.hero__bars span {
  width: 2px;
  height: 100%;
  background: currentColor;
  color: var(--text);
  transform: scaleY(0.14);
  transform-origin: bottom;
  will-change: transform;
}

.hero__meta {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 4rem;
  padding-top: 0.75rem;
}

.hero__role {
  font-size: 0.95rem;
  font-weight: 500;
}

.hero__creds {
  font-size: 0.85rem;
  color: var(--muted);
}

.hero__scrollcue {
  position: absolute;
  right: var(--gutter);
  bottom: 6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.hero__scrollcue span:first-child {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--muted);
  writing-mode: vertical-rl;
}
.hero__scrollline {
  width: 1px;
  height: 4rem;
  background: var(--text);
}

/* ---------- About ---------- */

.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: start;
}

.about__lead {
  font-size: clamp(1.15rem, 1.8vw, 1.5rem);
  line-height: 1.55;
  font-weight: 400;
  max-width: 38em;
}

.about__portrait {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
  margin-bottom: 1.5rem;
  filter: grayscale(1);
}

.about__meta { border-top: 1px solid var(--line); }

.meta-row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.meta-row dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  padding-top: 0.2em;
}

.meta-row dd { font-size: 0.9rem; }

/* ---------- Plates: full-bleed portfolio sheets ---------- */

.plate {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  min-height: 100svh;
  overflow: hidden;
  background: #ffffff; /* matches sheet paper — letterbox bands vanish */
  /* Arced top corners (straight middle) — the layer sweeps over
     the pinned sheet behind it with rounded edges while scrolling. */
  border-radius: clamp(2rem, 5vw, 4rem) clamp(2rem, 5vw, 4rem) 0 0;
}

/* Breathing room where a plate group starts; plates within a
   group stack edge to edge for a continuous monograph flow. */
.about .plate,
.awards__list + .plate {
  margin-top: clamp(3rem, 8vh, 5rem);
}

/* contain, not cover — the whole sheet stays visible, never
   cropped; any letterboxing blends into the white plate. */
.plate img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
  will-change: transform;
}

/* Pinned plates — the sheet is viewport-sized and script.js
   counter-translates it against scroll so it reads as fixed
   behind the page; the plate acts as a moving window, so the
   surrounding sections slide over a stationary image. Used on
   the first sheet after each text block; follow-up sheets keep
   a gentle parallax drift so the effect stays an event. */
.plate--pin img {
  inset: auto;
  top: 0;
  left: 0;
  height: 100svh;
  object-fit: contain;
}

/* Bottom scrim so the caption stays readable — kept shallow so
   it doesn't gray out the sheet itself */
.plate::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(10, 10, 10, 0) 82%,
    rgba(10, 10, 10, 0.3) 92%,
    rgba(10, 10, 10, 0.6) 100%);
}

/* Slim caption — secondary sheets */
.plate__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 1.5rem var(--gutter);
  font-size: 1.05rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--plate-text);
  text-shadow: 0 1px 10px rgba(10, 10, 10, 0.8);
}

.plate__caption span:first-child {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.05em;
}

/* Slightly taller framing for the About timeline plate */
.plate--tall { min-height: 100svh; }

/* ---------- Work: chapter intro, then plates ---------- */

.project { margin: 0; }

/* Full-viewport typographic title screen before each project's sheets */
.project__intro {
  min-height: 92svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 5rem 0 3.5rem;
}

.project__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(6rem, 18vw, 16rem);
  line-height: 0.8;
  margin-left: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--muted);
}

@supports not (-webkit-text-stroke: 1px black) {
  .project__num { color: var(--surface); }
}

.project__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 5.75rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  max-width: 13em;
  margin-top: clamp(1.25rem, 3vh, 2.5rem);
}

.project__meta {
  margin-top: clamp(2rem, 5vh, 3.25rem);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 1.5rem clamp(2rem, 5vw, 5rem);
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
  align-items: start;
}

.project__place {
  font-size: 0.9rem;
  color: var(--muted);
}

.project__tags {
  margin-top: 0.9rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.project__desc {
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: 36em;
}

/* ---------- Awards ---------- */

.awards__list {
  list-style: none;
  columns: 2;
  column-gap: clamp(2rem, 6vw, 6rem);
}

.award {
  break-inside: avoid;
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}

.award__year {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  padding-top: 0.15em;
}

.award__title { font-size: 0.95rem; line-height: 1.5; }

.award__note {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---------- Experience ---------- */

.experience__list { border-top: 1px solid var(--line); }

.job {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 1.5rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--line);
}

/* Plates interleave with job rows */
.experience__list .plate {
  margin-top: 2.5rem;
  margin-bottom: 3rem;
}

.job__when {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  padding-top: 0.25em;
}

.job__role {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  font-weight: 600;
  letter-spacing: -0.005em;
}

.job__desc {
  margin-top: 0.6rem;
  font-size: 0.92rem;
  color: var(--muted);
  max-width: 42em;
}

/* ---------- Skills ---------- */

.skills__rows { border-top: 1px solid var(--line); }

.skills__row {
  display: grid;
  grid-template-columns: minmax(9rem, 16rem) 1fr;
  gap: 1.5rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--line);
}

.skills__row dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  padding-top: 0.35em;
}

.skills__row dd { font-size: 1rem; }

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

.contact { padding-bottom: 3rem; }

.contact__line {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: clamp(3rem, 8vh, 5rem);
}

.contact__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  border-top: 1px solid var(--line);
  padding-top: 2rem;
}

.contact__col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
}

.contact__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.ulink {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  position: relative;
  width: fit-content;
}

.contact__foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin-top: clamp(4rem, 10vh, 7rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(1.5rem);
  transition:
    opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0s);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Chapter titles rise further and slower — they carry the page */
.project__num.reveal {
  transform: translateY(3.5rem);
  transition-duration: 1s;
}

.project__title.reveal {
  transform: translateY(2.5rem);
  transition-duration: 0.85s;
}

.project__num.reveal.is-visible,
.project__title.reveal.is-visible {
  transform: none;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .plate img { transform: none !important; }

  .hero__name { animation: none; }

  .nav__links a::after,
  .ulink::after {
    transition: none;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .about__grid { display: block; }
  .about__side { margin-top: 2.5rem; }

  .awards__list { columns: 1; }

  .job { grid-template-columns: 4.5rem 1fr; gap: 1rem; }

  .skills__row { grid-template-columns: 1fr; gap: 0.4rem; }

  .contact__grid { grid-template-columns: 1fr; }

  .hero__scrollcue { display: none; }

  /* Plates: show the whole sheet, info on a dark band below.
     A hard 100svh cover-crop would hide most of a wide sheet
     on a portrait screen. */
  .plate { min-height: 0; }

  .plate img {
    position: static;
    width: 100%;
    height: auto;
    object-fit: initial;
  }

  .plate__caption {
    position: static;
    background: #111110;
    padding: 1.1rem var(--gutter) 1.3rem;
  }

  .project__intro {
    min-height: 0;
    padding: 3.5rem 0 2.5rem;
  }

  .project__meta { grid-template-columns: 1fr; }

  .plate::before {
    background: linear-gradient(180deg,
      rgba(10, 10, 10, 0) 60%,
      rgba(10, 10, 10, 0.25) 100%);
  }
}
