/* Personal page styles.
   Tokens live on :root so colours, type, and spacing can be changed in one place.
   Section headings in this file match the page: Header, Hero, Projects, etc. */

:root {
  /* Colour */
  --bg: #F5F3EE;
  --bg-sunken: #EDEAE3;
  --ink: #171717;
  --ink-muted: #4A4741;
  --ink-faint: #6B675F;
  --accent: #C65D3A;       /* dots, fills, large text, hovers */
  --accent-text: #A84B2B;  /* small accent text: 5.1:1 on --bg */
  --sage: #5A6854;
  --rule: #D9D7D1;
  --rule-strong: #8A867E;  /* form underlines: 3.3:1 on --bg */
  --rule-soft: #E7E4DD;

  /* Type */
  --sans: Geist, "Helvetica Neue", Helvetica, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  /* Layout */
  --shell: 1240px;
  --gutter: clamp(20px, 5vw, 64px);
  --section-y: clamp(56px, 8vw, 110px);
  --timeline-gutter: clamp(22px, 3vw, 34px);
  --header-h: 67px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}

/* ---------- Base ---------- */
/* Hide the raw template until the runtime mounts it (script.js loads after page.js). */
x-dc { display: none !important; }
* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
input, textarea, button { font-family: inherit; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Visually hidden but still read by assistive tech */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
/* Off-screen until focused */
.skip-link {
  position: absolute; top: 8px; left: 8px; z-index: 100;
  padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: 14px;
  transform: translateY(-200%);
}
.skip-link:focus,
.skip-link:focus-visible { transform: none; }

.noscript {
  margin: 0;
  padding: 12px var(--gutter);
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
}
.noscript p { margin: 0 0 4px; }
.noscript p:last-child { margin: 0; }
.noscript a { color: var(--bg); text-decoration: underline; }

/* ---------- Layout ---------- */
.shell { max-width: var(--shell); margin: 0 auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); border-top: 1px solid var(--rule); }
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(28px, 5vw, 72px);
}
/* Hairline dividers drawn by the parent background showing through 1px gaps. */
.rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--rule-grid-min, 210px), 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--rule);
  border-block: 1px solid var(--rule);
}
.rule-grid > * { background: var(--bg); margin: 0; }
.rule-grid--pillars {
  margin-top: clamp(40px, 6vw, 80px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 719px) {
  .rule-grid--pillars { grid-template-columns: 1fr; }
}
.rule-grid--notes { --rule-grid-min: 260px; margin-top: clamp(32px, 4vw, 56px); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}
.section-head__aside { max-width: 44ch; }

/* ---------- Type ---------- */
.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .16em;
  color: var(--sage);
}
.eyebrow--accent { color: var(--accent-text); }
.eyebrow--faint { color: var(--ink-faint); font-size: 11px; }
.section-title {
  margin: 18px 0 0;
  font-size: clamp(30px, 4.4vw, 54px);
  line-height: 1.06;
  letter-spacing: -.03em;
  font-weight: 400;
  text-wrap: balance;
}
.prose {
  margin: 0;
  max-width: 52ch;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-muted);
  text-wrap: pretty;
}
.prose--lead { font-size: 16.5px; max-width: 46ch; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 15px;
  cursor: pointer;
  transition: background .25s var(--ease), color .25s var(--ease);
}
.btn--ink { background: var(--ink); color: var(--bg); }
.btn--ink:hover { background: var(--accent); color: var(--bg); }
.btn--outline { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn--outline:hover { background: var(--ink); color: var(--bg); }
.btn--pill {
  min-height: 38px;
  padding: 9px 16px;
  border-color: var(--accent-text);
  color: var(--accent-text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
}
.btn--pill:hover { background: var(--accent); color: var(--bg); }

/* ---------- Header ---------- */
/* Fixed so it stays on screen; #dc-root is the runtime mount and sticky
   would fail inside it while body uses overflow-x: hidden. */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(245, 243, 238, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
#dc-root { padding-top: var(--header-h); }
.header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 14px;
}
.header__mark { font-size: 17px; font-weight: 500; letter-spacing: -.01em; color: var(--ink); }
.header__nav { display: flex; align-items: center; gap: clamp(18px, 2.6vw, 34px); }
.nav-links { display: flex; gap: clamp(18px, 2.6vw, 34px); }
.nav-links a { font-size: 14px; color: var(--ink); opacity: .72; }
.nav-links a:hover { opacity: 1; color: var(--accent); }
.lang {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0; /* 36px buttons + 1px border = 38px, the height of the header pill */
  border: 1px solid var(--rule);
  border-radius: 999px;
}
.lang__btn {
  min-height: 36px;
  padding: 0 10px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  cursor: pointer;
}
.lang__btn.is-active {
  background: var(--ink);
  color: var(--bg);
}
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.drawer {
  display: none;
  flex-direction: column;
  padding: 8px var(--gutter) 18px;
  border-top: 1px solid var(--rule);
}
.drawer a {
  padding: 13px 0;
  font-size: 17px;
  color: var(--ink);
  border-bottom: 1px solid var(--rule-soft);
}
.drawer a:last-child { border-bottom: none; }

/* Hamburger + drawer below 720px; hide the header CTA on very small phones */
@media (max-width: 719px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .drawer.is-open { display: flex; }
}
@media (max-width: 479px) {
  .header__cta { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  padding: clamp(56px, 9vw, 120px) 0 clamp(48px, 7vw, 96px);
}
.hero__title {
  margin: clamp(24px, 4vw, 40px) 0 0;
  font-size: clamp(38px, 6.4vw, 76px);
  line-height: 1.02;
  letter-spacing: -.035em;
  font-weight: 400;
  text-wrap: balance;
}
.hero__tagline {
  margin: clamp(14px, 2vw, 20px) 0 0;
  max-width: 22ch;
  font-size: clamp(21px, 2.9vw, 36px);
  line-height: 1.25;
  letter-spacing: -.02em;
  font-weight: 300;
  text-wrap: pretty;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(26px, 4vw, 38px); }
.hero__lead { margin-top: clamp(20px, 3vw, 28px); }
.mark { font-style: normal; color: var(--accent); }
.hero__visual { display: flex; justify-content: center; }
/* On phones the diagram is a full screen of decoration after the CTAs. */
@media (max-width: 719px) {
  .hero__visual { display: none; }
}
.hero__visual svg { width: 100%; max-width: 400px; height: auto; animation: drift 11s ease-in-out infinite; }

/* ---------- Cards (about pillars + notes) ---------- */
.pillar { padding: clamp(22px, 3vw, 32px) clamp(18px, 2vw, 28px) clamp(24px, 3.4vw, 36px); }
.pillar p:last-child { margin: 14px 0 0; font-size: 16px; line-height: 1.55; color: var(--ink); }

.about-copy { max-width: 52ch; }
.lede {
  margin: 0;
  font-size: clamp(18px, 2.1vw, 23px);
  line-height: 1.45;
  letter-spacing: -.015em;
}
.about-copy__body { margin-top: 18px; font-size: 16.5px; }

.note {
  padding: clamp(26px, 3.4vw, 40px) clamp(18px, 2vw, 28px);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.4;
  letter-spacing: -.015em;
}
.note--interactive { cursor: default; }
.note__aside { color: var(--accent-text); opacity: 0; transition: opacity .35s ease; }
.note--interactive:hover .note__aside,
.note--interactive:focus-visible .note__aside { opacity: 1; }
/* No hover on touch screens: just show the punchline. */
@media (hover: none) {
  .note__aside { opacity: 1; }
}

/* ---------- Projects ---------- */
/* One card markup (.work-card) serves the home preview and the gallery.
   Column header dots: professional = accent, personal = sage. */
.badge__dot {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--type-dot, var(--ink-faint));
}
.showcase__col--professional { --type-dot: var(--accent); }
.showcase__col--personal { --type-dot: var(--sage); }


.showcase {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 3.4vw, 48px) clamp(18px, 2.4vw, 32px);
  align-items: start;
  margin-top: clamp(36px, 5vw, 64px);
}
@media (max-width: 759px) {
  .showcase { grid-template-columns: 1fr; }
}
.showcase__list { display: flex; flex-direction: column; gap: clamp(18px, 2.4vw, 28px); }
.col-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: clamp(16px, 2vw, 22px);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink);
}
.col-head__title {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.col-head__count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--ink-faint);
}

.work-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color .35s var(--ease), box-shadow .35s var(--ease), transform .35s var(--ease);
}
.work-card:has(.work-card__cta):hover {
  border-color: var(--ink);
  box-shadow: 0 18px 40px -28px rgba(23, 23, 23, .45);
  transform: translateY(-2px);
}
.work-card:has(.work-card__cta:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }

.work-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--rule);
}
.work-card__media img {
  position: absolute;
  inset: clamp(18px, 7%, 40px) clamp(18px, 6%, 40px);
  width: calc(100% - 2 * clamp(18px, 6%, 40px));
  height: calc(100% - 2 * clamp(18px, 7%, 40px));
  object-fit: contain;
  filter: drop-shadow(0 12px 22px rgba(23, 23, 23, .14));
  /* Own layer so the drop-shadow isn't re-rasterised every frame of the zoom. */
  will-change: transform;
  transition: transform .5s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .work-card:hover .work-card__media img { transform: scale(1.03); }
}
.work-card:focus-within .work-card__media img { transform: scale(1.03); }
/* GSAP is tweening this card (page.js): don't let CSS chase its transform. */
.work-card[data-moving] { transition: none !important; }
.work-card__index {
  position: absolute;
  top: 16px;
  right: 18px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .16em;
  color: var(--ink-faint);
}

.work-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: clamp(20px, 2.6vw, 32px);
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tags li {
  padding: 4px 9px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  color: var(--ink-muted);
}
.work-card__title {
  margin: 16px 0 0;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.14;
  letter-spacing: -.025em;
  font-weight: 400;
  text-wrap: balance;
}
.work-card__summary { margin: 12px 0 0; font-size: 15.5px; }
.work-card__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--rule-soft);
}
.work-card__facts dt { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; color: var(--ink-faint); }
.work-card__facts dd { margin: 6px 0 0; font-size: 14.5px; line-height: 1.45; }
.work-card__result { grid-column: 1 / -1; }
.work-card__result dd { color: var(--ink-muted); }

/* Footer sticks to the bottom so CTAs line up across a row */
.work-card__foot { margin-top: auto; padding-top: 24px; }
.work-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--accent-text);
  outline: none;
}
/* Stretched link: the whole card opens the project */
.work-card__cta::after { content: ""; position: absolute; inset: 0; z-index: 2; }
.work-card__arrow { display: inline-block; transition: transform .35s var(--ease); }
.work-card:hover .work-card__arrow,
.work-card:focus-within .work-card__arrow { transform: translate(3px, -3px); }
.work-card__private {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .08em;
  color: var(--ink-faint);
}

.projects__more {
  display: flex;
  justify-content: center;
  margin: clamp(36px, 5vw, 64px) 0 0;
}

/* ---------- Project gallery ---------- */
.gallery-page { padding-top: clamp(40px, 6vw, 72px); }
.gallery-back {
  display: inline-block;
  margin: 0 0 clamp(28px, 4vw, 40px);
  font-size: 14px;
  color: var(--ink);
  opacity: .72;
}
.gallery-back:hover { opacity: 1; color: var(--accent); }
/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
  margin: clamp(36px, 5vw, 64px) 0 0;
  padding: 0 0 0 var(--timeline-gutter);
  border-left: 1px solid var(--rule);
}
.timeline__item { position: relative; padding-bottom: clamp(34px, 4.5vw, 54px); }
.timeline__item:last-child { padding-bottom: 0; }
/* Dot sits on the left border */
.timeline__item::before {
  content: "";
  position: absolute;
  top: 7px;
  left: calc(-1 * var(--timeline-gutter) - 4px);
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--ink);
}
.timeline__item:first-child::before { background: var(--accent); }
.timeline__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(12px, 3vw, 48px);
}
.timeline__role { margin: 10px 0 2px; font-size: 20px; letter-spacing: -.02em; font-weight: 500; }
.timeline__org { margin: 0; font-size: 14.5px; color: var(--ink-faint); }

/* ---------- Toolbox ---------- */
.toolbox {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(24px, 3vw, 40px);
}
.toolbox ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  font-size: 15.5px;
  color: var(--ink-muted);
}

.toolbox h3 { font-weight: 400; }

/* ---------- Contact ---------- */
.section--contact { padding-bottom: clamp(48px, 6vw, 80px); }
.split--contact { gap: clamp(32px, 5vw, 80px); }
.contact-title {
  max-width: 14ch;
  font-size: clamp(32px, 5vw, 62px);
  line-height: 1.03;
  letter-spacing: -.032em;
}
.contact-lead { margin-top: 22px; }
.contact-list { display: flex; flex-direction: column; margin-top: 34px; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.contact-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 52px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font-size: 15.5px;
}
.contact-list a:hover { color: var(--accent); }

.form { display: flex; flex-direction: column; gap: 20px; align-self: start; position: relative; }
.form__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field input, .field textarea {
  padding: 10px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule-strong);
  font-size: 16px;
  color: var(--ink);
  outline: none;
}
.field input { min-height: 44px; }
.field textarea { resize: vertical; }
/* 2px focus underline; 1px less padding keeps the field the same height */
.field input:focus, .field textarea:focus { padding-bottom: 9px; border-bottom: 2px solid var(--accent-text); }
.form__status { margin: 0; font-size: 14.5px; color: var(--sage); }
.form__status--error { color: var(--accent-text); }
.form .btn { align-self: flex-start; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--rule); }
.footer__inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  align-items: start;
  padding-block: clamp(28px, 4vw, 44px);
}
.footer__name { margin: 0; font-size: 17px; font-weight: 500; }
.footer__role { margin-top: 8px; }
.footer__links { display: flex; flex-wrap: wrap; gap: 14px 26px; }
.footer__links a { font-size: 14.5px; color: var(--ink); }
.footer__links a:hover { color: var(--accent); }
.footer__copy { margin: 0; justify-self: end; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--ink-faint); }

/* ---------- Motion ---------- */
/* Sprite sheet for the hero dots — kept out of flow */
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

@keyframes dash { to { stroke-dashoffset: -400; } }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(1); } 50% { opacity: 1; transform: scale(1.35); } }
@keyframes drift { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* `reveal-on` is set from JS, so content stays visible when scripting or
   IntersectionObserver is unavailable. */
html.reveal-on .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
html.reveal-on .reveal.is-in { opacity: 1; transform: none; }
/* Once GSAP loads, cards animate via inline styles (staggered batch) instead. */
html.cards-motion .work-card.reveal {
  opacity: 1;
  transform: none;
  transition: border-color .35s var(--ease), box-shadow .35s var(--ease), transform .35s var(--ease);
}
html.cards-motion .work-card.reveal:has(.work-card__cta):hover { transform: translateY(-2px); }

/* ---------- Back to top ---------- */
/* Fixed bottom-right; hidden (and out of the tab order) until page.js adds .is-visible. */
.to-top {
  position: fixed;
  right: max(16px, calc(var(--gutter) / 2), env(safe-area-inset-right));
  bottom: max(16px, calc(var(--gutter) / 2), env(safe-area-inset-bottom));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 6px 20px rgba(23, 23, 23, .14);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out),
              visibility 0s linear .3s, background .25s var(--ease), border-color .25s var(--ease);
}
.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out),
              visibility 0s, background .25s var(--ease), border-color .25s var(--ease);
}
.to-top:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) {
  .to-top:hover { background: var(--accent); border-color: var(--accent); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
