/* ============================================================
   Page compositions
   Each section uses a different layout family. See README.
   ============================================================ */

/* ============================================================
   HERO
   Just the tagline (the page h1) on one line under the header,
   then the three actions. No brand line, no image.
   ============================================================ */
.hero {
  padding-top: clamp(0.75rem, 0.4rem + 1.2vw, 1.75rem);
  padding-bottom: clamp(1.25rem, 0.8rem + 1.6vw, 2.25rem);
}
/* Centred: the tagline and the three actions sit in the middle. */
.hero__intro { display: grid; gap: var(--s-5); justify-items: center; text-align: center; }
.hero__title {
  font-size: clamp(0.82rem, 0.3rem + 2.2vw, 1.5rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.1;
  color: var(--text);
  white-space: nowrap;      /* the tagline stays on a single line */
}
/* While typing, the text runs left to right inside a width reserved in
   JS, so the centred block never jumps as characters land. */
.hero__title.is-typing { text-align: left; }
.hero__title.is-typing::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 3px;
  vertical-align: -0.12em;
  background: var(--accent);
  animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* Three equal-width buttons, locked in place: About left, View work
   centre, Start a project right. They stack to equal full-width rows
   on the narrowest screens. */
.hero__cta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-3);
  width: 100%;
  max-width: 560px;
}
.hero__cta .btn { width: 100%; }
@media (max-width: 520px) { .hero__cta { grid-template-columns: 1fr; } }

/* ============================================================
   WORK SHOWCASE  (revealed below the hero by View work)
   ============================================================ */
/* Inline panel host. About Me, View work and Start a project each
   slide their content open in this one region instead of navigating
   away. The height is animated in JS from 0 to the content height (and
   between panels), so the footer slides rather than jumps. */
.panelhost__reveal {
  height: 0;
  overflow: hidden;
  transition: height 680ms var(--ease-out);
}
.panelhost__inner:focus { outline: none; }

/* Each panel's content lives in a slide. It carries the page colour so
   that when a new one slides across it fully covers the old underneath. */
/* Transparent so the daytime sky gradient reads through the whole
   expanded panel; the project card holds its own opaque surface for text
   readability. Between-panel swaps rely on the incoming slide sliding in
   over the outgoing one; individual card and control backgrounds keep the
   swap legible. */
.panel-slide { width: 100%; background: transparent; }

/* The work carousel sits right under the buttons, no top gap. */
.panel-work { padding-top: 0; padding-bottom: var(--s-9); }

@media (prefers-reduced-motion: reduce) {
  .panelhost__reveal { transition: none; }
}

.showcase { display: grid; gap: clamp(1rem, 0.6rem + 1.4vw, 1.75rem); }

/* --- coverflow shared --- */
.cf { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s-2); }
.cf__viewport {
  position: relative;
  height: var(--cf-h, 6rem);
  overflow: hidden;
  touch-action: pan-y;      /* horizontal gestures are ours, vertical scroll is the page's */
}
/* Pin to the middle column. Without this, when the arrows are hidden
   (a single-project discipline) the viewport auto-places into the empty
   first column and collapses to zero width. */
.cf__viewport { grid-column: 2; cursor: grab; touch-action: pan-y; }
.cf__viewport:active { cursor: grabbing; }
.cf__viewport > * {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  will-change: transform;
}
/* Cards animate only when snapping to a card; during a drag they track
   the finger with no transition. */
.cf__viewport.cf--animating > * {
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur) var(--ease-out);
}
.cf__arrow {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-full);
  color: var(--text);
  font-size: 1.1rem;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.cf__arrow:hover { background: var(--surface-2); border-color: var(--text-3); }
.cf__arrow:active { transform: scale(0.92); }
.cf__arrow:disabled { opacity: 0.3; pointer-events: none; }

/* --- discipline cards --- */
.cf--cats { --cf-h: 5rem; }
.showcat {
  width: clamp(150px, 42vw, 200px);
  min-height: 3.75rem;
  display: grid; gap: 2px; align-content: center;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: left;
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.showcat[aria-selected="true"] {
  border-color: var(--accent);
  box-shadow: var(--shadow-2), inset 0 0 0 1px var(--accent);
  cursor: default;
}
.showcat__k { font-family: var(--font-mono); font-size: var(--t-micro); color: var(--accent-text); letter-spacing: 0.12em; }
.showcat__label { font-size: var(--t-body); font-weight: 500; letter-spacing: -0.015em; color: var(--text); line-height: 1.2; }

/* --- project name strip --- */
.cf--names { --cf-h: 3.25rem; }
.showname {
  width: clamp(150px, 46vw, 220px);
  padding: var(--s-2) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--t-sm);
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.showname[aria-selected="true"] {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink); cursor: default;
}
.cf--names[data-single="true"] .cf__arrow { display: none; }

/* --- stage --- */
.showstage { position: relative; overflow: hidden; touch-action: pan-y; cursor: grab; }
.showstage.is-grabbing { cursor: grabbing; }
.showstage__card {
  display: grid; gap: clamp(1.25rem, 0.8rem + 1.6vw, 2rem);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: clamp(1rem, 0.6rem + 1.4vw, 1.75rem);
}
@media (min-width: 760px) { .showstage__card { grid-template-columns: 1.15fr 1fr; } }
.showstage__card .media { aspect-ratio: 16 / 10; }
.showstage__card .media img { transform: scale(1.03); }

/* Cross-fade slideshow: base image underneath, real photos stacked on top,
   each fading in and out in turn. The selectors are qualified with `img.` to
   match the specificity of the `.media img` transition rule in
   components.css — without this, that rule wins and opacity toggles hard. */
.showstage__media > img { position: absolute; inset: 0; }
img.showstage__base { z-index: 0; }
img.showstage__slide {
  z-index: 1;
  opacity: 0;
  transition: opacity 1400ms var(--ease-in-out);
}
img.showstage__slide.is-on { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  img.showstage__slide { transition: none; }
}
.showstage__body { display: grid; gap: var(--s-3); align-content: center; }
.showstage__disc { font-family: var(--font-mono); font-size: var(--t-micro); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-text); }
.showstage__meta { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); }
.showstage__title { font-size: var(--t-h2); font-weight: 500; letter-spacing: -0.03em; }
.showstage__year { font-family: var(--font-mono); font-size: var(--t-sm); color: var(--text-3); flex-shrink: 0; }
.showstage__summary { color: var(--text-2); max-width: 52ch; }
.showstage__tags { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.showstage__tag {
  font-family: var(--font-mono); font-size: var(--t-micro);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3);
  border: 1px solid var(--line); border-radius: var(--r-full);
  padding: 0.25rem 0.6rem;
}
.showstage__visit { width: fit-content; margin-top: var(--s-1); }

@media (prefers-reduced-motion: no-preference) {
  .showstage__card.is-enter { animation: fade-up 500ms var(--ease-out) both; }
}
@media (prefers-reduced-motion: reduce) {
  .cf__viewport.cf--animating > * { transition: none; }
}

/* ============================================================
   CAPABILITIES  (family: asymmetric bento, 3 items to 3 cells)
   ============================================================ */
.cap { display: grid; gap: var(--s-4); margin-top: var(--s-7); }
@media (min-width: 860px) {
  .cap {
    grid-template-columns: 1.25fr 1fr;
    grid-template-rows: auto auto;
  }
  .cap__cell:first-child { grid-row: span 2; }
}

.cap__cell {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1.5rem, 1rem + 1.6vw, 2.25rem);
  display: flex; flex-direction: column; gap: var(--s-3);
  min-height: 15rem;
  background: var(--surface);
  transition: border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.cap__cell:hover { border-color: var(--line-strong); }

/* Cell 1: photographic. Cell 2: accent field. Cell 3: plotted grid.
   Three genuinely different surfaces, not three white text boxes. */
.cap__cell--photo { justify-content: flex-end; min-height: 26rem; border-color: transparent; }
.cap__cell--photo img {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; object-fit: cover;
  /* Pushed well down. The copy on top has to clear AA against the
     darkest plausible frame of any photograph dropped in here, and
     a photo is not a colour you get to choose. */
  filter: grayscale(1) contrast(0.92) brightness(0.3);
  transform: scale(1.03);
  transition: transform 900ms var(--ease-out);
}
/* Two scrims: a near-solid base under the text and a softer wash
   over the whole tile, so the type sits on a known value rather
   than on whatever the image happens to be doing. */
.cap__cell--photo::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to top,
      rgb(6 7 9 / 0.96) 0%,
      rgb(6 7 9 / 0.93) 42%,
      rgb(6 7 9 / 0.72) 72%,
      rgb(6 7 9 / 0.55) 100%);
}
.cap__cell--photo:hover img { transform: scale(1.07); }

/* Fixed light ink. This tile is dark at every slider position, so
   it opts out of the theme inks on purpose. Measured 15.2:1 for the
   title and 11.4:1 for the body against the scrim base. */
.cap__cell--photo .cap__title { color: #F7F8F9; }
.cap__cell--photo .cap__body { color: #DDE0E4; }
.cap__cell--photo .cap__list span { color: #DDE0E4; border-color: rgb(255 255 255 / 0.3); }

.cap__cell--field {
  background:
    radial-gradient(110% 130% at 100% 0%, var(--accent-soft), transparent 58%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
}
.cap__cell--plot {
  background-color: var(--surface-2);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
}

.cap__title { font-size: var(--t-h3); font-weight: 500; letter-spacing: -0.02em; }
.cap__body { color: var(--text-2); font-size: var(--t-sm); max-width: 38ch; }
.cap__list { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: auto; padding-top: var(--s-4); }
.cap__list span {
  font-family: var(--font-mono); font-size: var(--t-micro);
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
  border: 1px solid var(--line); border-radius: var(--r-full);
  padding: 0.25rem 0.6rem;
}

/* ============================================================
   SELECTED WORK  (family: offset editorial grid)
   ============================================================ */
.sectionhead { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-5); flex-wrap: wrap; }
.sectionhead h2 { max-width: 18ch; }

.worklist { display: grid; gap: clamp(2.5rem, 1.5rem + 3vw, 4.5rem); margin-top: var(--s-8); }
@media (min-width: 780px) {
  .worklist { grid-template-columns: 1fr 1fr; column-gap: clamp(1.5rem, 0.5rem + 3vw, 3.5rem); }
  /* Vertical offset gives the grid rhythm without breaking the reading order */
  .worklist > *:nth-child(even) { transform: translateY(clamp(2rem, 5vw, 5rem)); }
}
.worklist--flat > * { transform: none !important; }

/* ============================================================
   PROCESS  (family: numbered slideshow)
   One step at a time, advancing on its own, with controls that
   appear on hover or keyboard focus.
   ============================================================ */
.slideshow {
  position: relative;
  margin-top: var(--s-7);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}

.slideshow__viewport {
  position: relative;
  display: grid;
  /* Every slide occupies the same cell, so the box is as tall as
     the longest one and nothing jumps as they change. */
  min-height: 16rem;
}

.slide {
  grid-area: 1 / 1;
  display: flex; flex-direction: column; gap: var(--s-4);
  padding: clamp(1.75rem, 1.2rem + 2vw, 3rem);
  padding-right: clamp(1.75rem, 1rem + 6vw, 7rem);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 480ms var(--ease-out), transform 480ms var(--ease-out), visibility 0s 480ms;
}
.slide[data-active="true"] {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 480ms var(--ease-out), transform 480ms var(--ease-out), visibility 0s;
}

.slide__num {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--accent-text);
  letter-spacing: 0.08em;
}
.slide__verb { font-size: var(--t-h2); font-weight: 500; letter-spacing: -0.03em; }
.slide__body { color: var(--text-2); max-width: 52ch; font-size: var(--t-lead); line-height: 1.5; }

/* Controls sit out of the way until wanted. Hover, focus and touch
   all bring them in; on coarse pointers they simply stay. */
.slideshow__controls {
  position: absolute; right: var(--s-4); bottom: var(--s-4);
  display: flex; align-items: center; gap: var(--s-2);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.slideshow:hover .slideshow__controls,
.slideshow:focus-within .slideshow__controls { opacity: 1; transform: none; }
@media (pointer: coarse) {
  .slideshow__controls { opacity: 1; transform: none; }
}

.slidebtn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg);
  color: var(--text);
  font-size: 1.05rem;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.slidebtn:hover { background: var(--surface-2); border-color: var(--text-3); }
.slidebtn:active { transform: scale(0.93); }

/* Position rail doubles as the autoplay progress indicator. */
.slideshow__dots {
  position: absolute; left: clamp(1.75rem, 1.2rem + 2vw, 3rem); bottom: var(--s-5);
  display: flex; gap: var(--s-2);
}
.slidedot {
  width: 28px; height: 3px;
  border-radius: var(--r-full);
  background: var(--line-strong);
  position: relative;
  overflow: hidden;
  transition: background-color var(--dur) var(--ease-out);
}
.slidedot[data-active="true"] { background: var(--line-strong); }
.slidedot[data-active="true"]::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(1);
}
/* While autoplay is running the active dot fills in time with it,
   so the wait is visible rather than a surprise. */
.slideshow[data-playing="true"] .slidedot[data-active="true"]::after {
  animation: dot-fill var(--slide-dwell, 5200ms) linear forwards;
}
@keyframes dot-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.slideshow__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  .slide { transition: none; }
  .slideshow[data-playing="true"] .slidedot[data-active="true"]::after { animation: none; }
}

@media (max-width: 600px) {
  .slideshow__viewport { min-height: 19rem; }
  .slide { padding-bottom: var(--s-9); padding-right: clamp(1.75rem, 1.2rem + 2vw, 3rem); }
  .slideshow__dots { bottom: var(--s-4); }
}

/* ============================================================
   CTA BAND  (family: full-width statement)
   ============================================================ */
.ctaband { position: relative; overflow: hidden; background: var(--bg-sunken); }
.ctaband::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(80% 120% at 50% 120%, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.ctaband__inner { position: relative; text-align: center; display: grid; justify-items: center; gap: var(--s-5); }
.ctaband h2 { font-size: var(--t-h1); max-width: 16ch; }
.ctaband p { color: var(--text-2); max-width: 46ch; }

/* ============================================================
   PAGE HEADER (shared by Work / Studio / Contact)
   ============================================================ */
.pagehead { padding-top: clamp(2.5rem, 1.5rem + 3.5vw, 5rem); padding-bottom: clamp(2rem, 1rem + 3vw, 3.5rem); }
.pagehead h1 { max-width: 16ch; margin-bottom: var(--s-5); }
.pagehead .lead { max-width: 52ch; }

/* ============================================================
   WORK INDEX  (family: filtered index)
   ============================================================ */
.workbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4); flex-wrap: wrap;
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--line);
}
.workbar__count { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--text-3); }

/* ============================================================
   STUDIO  (families: portrait split, divided principles, toolkit)
   ============================================================ */
.studio__intro { display: grid; gap: clamp(2rem, 1rem + 3vw, 4rem); align-items: start; }
@media (min-width: 900px) { .studio__intro { grid-template-columns: 0.8fr 1.2fr; } }
.studio__portrait .media { aspect-ratio: 3 / 4; }
.studio__portrait .media img { object-position: 50% 22%; }  /* keep the face in frame */
.studio__copy { display: grid; gap: var(--s-4); }
.studio__copy p { color: var(--text-2); max-width: 56ch; }
.studio__copy p:first-of-type { color: var(--text); font-size: var(--t-lead); line-height: 1.5; }

.principles { margin-top: var(--s-7); }
.principles > li { padding-block: clamp(1.5rem, 1rem + 1.5vw, 2.25rem); border-bottom: 1px solid var(--line); }
.principles > li:first-child { border-top: 1px solid var(--line); }
.principle { display: grid; gap: var(--s-3); }
@media (min-width: 780px) { .principle { grid-template-columns: 1fr 1.6fr; gap: var(--s-6); align-items: start; } }
.principle h3 { max-width: 14ch; }
.principle p { color: var(--text-2); max-width: 58ch; }

.toolkit { display: grid; gap: var(--s-6); margin-top: var(--s-7); }
@media (min-width: 700px) { .toolkit { grid-template-columns: repeat(3, 1fr); } }
.toolkit__group h3 { font-size: var(--t-body); font-weight: 600; margin-bottom: var(--s-4); }

/* ============================================================
   CONTACT  (family: split form)
   ============================================================ */
.contact { display: grid; gap: clamp(2.5rem, 1.5rem + 4vw, 5rem); align-items: start; }
@media (min-width: 940px) { .contact { grid-template-columns: 0.85fr 1.15fr; } }

.contact__aside { display: grid; gap: var(--s-6); }
.contact__aside h2 { font-size: var(--t-h3); }
.contact__direct { display: grid; gap: var(--s-3); }
.contact__answer { display: flex; align-items: flex-start; gap: var(--s-3); color: var(--text-2); font-size: var(--t-sm); }
.contact__answer i { color: var(--accent-text); font-size: 1.1rem; margin-top: 2px; }

.form { display: grid; gap: var(--s-5); }
.form__row { display: grid; gap: var(--s-5); }
@media (min-width: 620px) { .form__row { grid-template-columns: 1fr 1fr; } }
.form__foot { display: flex; align-items: center; gap: var(--s-5); flex-wrap: wrap; }

/* ============================================================
   404
   ============================================================ */
.notfound { min-height: 62dvh; display: grid; align-content: center; gap: var(--s-5); justify-items: start; }
.notfound__code { font-family: var(--font-mono); font-size: var(--t-display); color: var(--accent-text); line-height: 1; }
