/* Portfolio home. A quiet gallery page: paper ground, one typeface, large
   type with tight tracking, hairline rules and outlined pills. Each project
   page keeps its own palette; this page stays neutral so they can lead. */

@font-face {
  font-family: "Geist";
  src: url("../fonts/geist-wght.woff2") format("woff2-variations"),
       url("../fonts/geist-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------------ tokens */
:root {
  --paper: #F6F5F2;
  --paper-2: #E9E8E3;     /* the contact ground */
  --ink: #141414;
  --ink-soft: #5B5955;
  --line: rgb(20 20 20 / 0.22);
  --night: #0F0F0F;
  --night-ink: #ECEBE7;
  --night-soft: #9C9A95;

  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 3vw, 44px);
  --gap: clamp(12px, 1.2vw, 18px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --r: 2px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 1rem; line-height: 1.5; font-weight: 400;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.wrap { padding-inline: var(--gutter); }

.skip {
  position: fixed; left: 12px; top: 12px; z-index: 90;
  background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: var(--r);
  transform: translateY(-160%); transition: transform 200ms var(--ease);
}
.skip:focus { transform: none; }

/* -------------------------------------------------------------- type kit */
.display {
  font-size: clamp(2.6rem, 6.2vw, 5.6rem); font-weight: 400;
  letter-spacing: -0.045em; line-height: 0.98;
}
.label {
  font-size: 0.72rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-soft);
}
.pill {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.5em 1.05em; border: 1px solid currentColor; border-radius: 999px;
  font-size: 0.875rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background-color 250ms var(--ease), color 250ms var(--ease);
}
.pill:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.ai-tag {
  position: absolute; right: 12px; bottom: 12px; z-index: 2;
  padding: 4px 8px; border-radius: var(--r);
  background: rgb(15 15 15 / 0.42); color: rgb(255 255 255 / 0.9);
  font-size: 0.66rem; letter-spacing: 0.04em; line-height: 1.3;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}

/* ---------------------------------------------------------------- header */
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: clamp(14px, 1.6vw, 22px) var(--gutter);
}
.wordmark {
  font-size: clamp(1.1rem, 1.5vw, 1.4rem); font-weight: 450; letter-spacing: -0.025em;
  text-decoration: none;
}

/* ------------------------------------------------------------------ hero */
.hero { padding: clamp(10px, 1.6vw, 26px) var(--gutter) 0; }
/* The boards are tray photos, so each one sits whole on the stage, like an
   object on a table, and is never cropped. A new board fades in over the
   last one, so the stage never dips to empty mid-change. */
.hero__stage {
  position: relative; overflow: hidden; border-radius: var(--r);
  width: 100%; aspect-ratio: 16 / 9; max-height: calc(100svh - 150px); min-height: 240px;
  background: var(--paper-2);
}
.hero__slide {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: clamp(18px, 4.2vw, 64px);
  opacity: 0; transition: opacity 1200ms ease-in-out;
}
.hero__slide.is-active { opacity: 1; z-index: 2; }
.hero__slide.is-prev { opacity: 1; z-index: 1; transition: none; }
.hero__slide picture { display: contents; }
.hero__slide img {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  box-shadow: 0 1px 2px rgb(20 20 20 / 0.1), 0 28px 60px -30px rgb(20 20 20 / 0.45);
  transition: transform 1400ms var(--ease);
}
.hero__slide:hover img { transform: scale(1.012); }

.hero__bar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding-top: 10px; font-size: 0.875rem; line-height: 1.2;
}
.hero__caption { display: inline-flex; align-items: baseline; gap: 10px; min-width: 0; text-decoration: none; }
.hero__name { font-weight: 500; }
.hero__kind { color: var(--ink-soft); }
.hero__go { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
.hero__caption:hover .hero__go { text-decoration-thickness: 2px; }

/* One line per board; the active line fills over the interval, and the
   board changes when it is full. Hovering the stage holds it. */
.hero__controls { display: none; align-items: center; gap: 4px; flex: none; }
.js .hero__controls { display: flex; }
.hero__dot { position: relative; width: 36px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
.hero__dot::before, .hero__dot i { content: ""; position: absolute; left: 0; right: 0; top: 13px; height: 2px; }
.hero__dot::before { background: var(--line); }
.hero__dot i { background: var(--ink); transform: scaleX(0); transform-origin: left; }
.hero__dot.is-active i { animation: hero-fill var(--hero-interval, 5s) linear forwards; }
.hero.is-paused .hero__dot.is-active i,
.hero:has(.hero__stage:hover) .hero__dot.is-active i { animation-play-state: paused; }
@keyframes hero-fill { to { transform: scaleX(1); } }
.hero__pause {
  position: relative; width: 28px; height: 28px; margin-left: 8px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px; background: none; cursor: pointer;
  transition: border-color 250ms var(--ease);
}
.hero__pause:hover { border-color: var(--ink); }
.hero__pause span {
  position: absolute; inset: 0; margin: auto; width: 8px; height: 10px;
  border-left: 2px solid var(--ink); border-right: 2px solid var(--ink);
}
.hero.is-paused .hero__pause span {
  width: 8px; height: 10px; border-style: solid; border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent var(--ink); transform: translateX(1px);
}

/* ----------------------------------------------------------------- intro */
.intro {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap);
  padding-top: clamp(28px, 4vw, 56px); padding-bottom: clamp(96px, 14vw, 200px);
}
.intro__line {
  grid-column: 1 / -1;
  font-size: clamp(1.9rem, 4.4vw, 4.4rem); font-weight: 400;
  letter-spacing: -0.035em; line-height: 1.06;
}
.intro__line > span { display: block; text-wrap: balance; }
.js .intro__line > span:nth-child(2) { transition-delay: 110ms; }
.js .intro__line > span:nth-child(3) { transition-delay: 220ms; }
.js .intro__line > span:nth-child(4) { transition-delay: 330ms; }
.intro__text {
  grid-column: 6 / span 5; margin-top: clamp(28px, 3.4vw, 52px);
  font-size: 1rem; line-height: 1.55; color: var(--ink);
  text-wrap: pretty;
}

/* -------------------------------------------------------------- projects */
.section-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  margin-bottom: clamp(22px, 2.6vw, 40px);
}
.rail-nav { display: flex; gap: 8px; }
.rail-nav[hidden] { display: none; }
.rail-btn {
  width: 46px; height: 46px; border-radius: 999px; border: 1px solid var(--ink);
  background: transparent; color: var(--ink); font: inherit; font-size: 1.1rem; cursor: pointer;
  transition: background-color 250ms var(--ease), color 250ms var(--ease), opacity 250ms var(--ease);
}
.rail-btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.rail-btn:disabled { opacity: 0.25; cursor: default; }

.rail {
  --per: 4;   /* cards in view */
  display: grid; grid-auto-flow: column;
  grid-auto-columns: calc((100% - var(--gap) * (var(--per) - 1)) / var(--per));
  gap: var(--gap);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
  padding-inline: var(--gutter); padding-bottom: 6px;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
/* With more projects than fit, cards narrow a little so the next one peeks
   in, and the row scrolls sideways; the arrows appear on their own. */
.rail:has(> li:nth-child(5)) { --per: 4.3; }
.rail > li { scroll-snap-align: start; min-width: 0; }

.card { display: block; text-decoration: none; }
.card__media {
  position: relative; overflow: hidden; border-radius: var(--r);
  aspect-ratio: 4 / 3; background: #d8d6d0;
}
.card__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 1100ms var(--ease);
}
.card:hover .card__media img { transform: scale(1.03); }
.card__title {
  margin-top: 14px; font-size: clamp(1rem, 1.15vw, 1.15rem); font-weight: 450; letter-spacing: -0.02em; line-height: 1.25;
}
.card__meta { margin-top: 4px; font-size: 0.8rem; color: var(--ink-soft); }
.card .pill { margin-top: 12px; padding: 0.42em 0.9em; font-size: 0.75rem; }
.card .ai-tag { right: 8px; bottom: 8px; padding: 3px 6px; font-size: 0.6rem; }
.card:hover .pill { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* --------------------------------------------------------------- explore */
.explore { padding-top: clamp(110px, 14vw, 200px); }
.rows { margin-top: clamp(28px, 3.4vw, 52px); border-bottom: 1px solid var(--line); }
.row > a {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap);
  padding: 18px 0 clamp(28px, 3vw, 44px);
  border-top: 1px solid var(--line); text-decoration: none;
}
.row__title {
  grid-column: 1 / span 4;
  font-size: clamp(1.25rem, 1.9vw, 1.8rem); font-weight: 400; letter-spacing: -0.025em; line-height: 1.15;
}
.row__meta { display: block; margin-top: 8px; font-size: 0.8rem; letter-spacing: 0; color: var(--ink-soft); }
.row__text { grid-column: 5 / span 4; font-size: 0.95rem; line-height: 1.5; max-width: 34ch; }
.row__media {
  grid-column: 9 / span 4; position: relative; overflow: hidden; border-radius: var(--r);
  aspect-ratio: 4 / 3; background: #d8d6d0;
}
.row__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1100ms var(--ease); }
.row > a:hover .row__media img { transform: scale(1.03); }
.row > a:hover .row__title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

/* ---------------------------------------------------------- capabilities */
.caps { padding-top: clamp(110px, 14vw, 200px); padding-bottom: clamp(110px, 14vw, 200px); }
.caps__grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap);
  margin-top: clamp(28px, 3.4vw, 52px); padding-top: 18px; border-top: 1px solid var(--line);
}
.caps__grid ul { margin-top: 16px; display: grid; gap: 6px; font-size: 1rem; }

/* --------------------------------------------------------------- contact */
.contact { background: var(--paper-2); padding-block: clamp(90px, 12vw, 180px); }
.contact__grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); }
.contact__grid .display { grid-column: 1 / span 6; }
.contact__body { grid-column: 7 / span 5; align-self: end; display: grid; gap: 22px; font-size: 1rem; }
.contact__email {
  font-size: clamp(1.3rem, 2.2vw, 2rem); letter-spacing: -0.025em; line-height: 1.2;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}
.contact__links { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------------------------------------------------------------- footer */
.foot { background: var(--night); color: var(--night-ink); padding-top: clamp(64px, 8vw, 120px); overflow: hidden; }
.foot__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); font-size: 0.95rem; }
.foot__grid ul { display: grid; gap: 4px; }
.foot__grid a { text-decoration: none; }
.foot__grid a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.foot__label { margin-bottom: 12px; font-size: 0.72rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--night-soft); }
.foot :focus-visible { outline-color: var(--night-ink); }
.foot__small { margin-top: clamp(64px, 9vw, 140px); padding-block: 22px 28px; font-size: 0.75rem; color: var(--night-soft); }

/* ------------------------------------------------------------------ 404 */
.missing { display: grid; gap: 22px; align-content: start; min-height: 70svh; padding-top: clamp(60px, 12vw, 160px); }

/* ---------------------------------------------------------------- reveal */
.js [data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity 900ms var(--ease), transform 900ms var(--ease); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .hero__slide { transition: none; }
  .hero__slide img, .card__media img, .row__media img { transition: none; transform: none !important; }
}

/* ---------------------------------------------------------------- narrow */
@media (max-width: 900px) {
  .intro__line { grid-column: 1 / -1; }
  .intro__text { grid-column: 4 / -1; }
  .rail, .rail:has(> li:nth-child(5)) { --per: 3; }
  .rail:has(> li:nth-child(4)) { --per: 3.3; }
  .row__title { grid-column: 1 / span 6; }
  .row__text { grid-column: 7 / -1; }
  .row__media { grid-column: 1 / -1; margin-top: 18px; aspect-ratio: 16 / 9; }
  .caps__grid { grid-template-columns: repeat(2, 1fr); row-gap: 36px; }
  .contact__grid .display, .contact__body { grid-column: 1 / -1; }
  .contact__body { margin-top: 28px; }
}
@media (max-width: 600px) {
  .hero__stage { aspect-ratio: 4 / 3; }
  .hero__kind { display: none; }
  .rail, .rail:has(> li:nth-child(4)), .rail:has(> li:nth-child(5)) { --per: 2; }
  .rail:has(> li:nth-child(3)) { --per: 2.3; }
  .intro__text { grid-column: 1 / -1; }
  .row__title, .row__text { grid-column: 1 / -1; }
  .row__text { margin-top: 10px; }
  .foot__grid { grid-template-columns: 1fr 1fr; row-gap: 32px; }
  .foot__grid > div:first-child { grid-column: 1 / -1; }
}
