/* ==================================================================
   dylan driscoll — portfolio
   Dark, minimal, gallery-style. Plain CSS, no build step.
   ================================================================== */

:root {
  --bg: #0a0a0b;
  --bg-elev: #111113;
  --fg: #f2f2f0;
  --fg-dim: #8a8a88;
  --fg-faint: #55555a;
  --line: rgba(255, 255, 255, 0.09);
  --line-soft: rgba(255, 255, 255, 0.05);

  --pad-x: clamp(20px, 3.2vw, 56px);
  --pad-y: clamp(18px, 2.4vw, 36px);

  --t-micro: 10px;
  --t-small: 11px;
  --t-body: clamp(13px, 0.92vw, 15px);
  --t-lead: clamp(15px, 1.05vw, 17px);
  --t-display: clamp(38px, 5.4vw, 76px);
  --t-head: clamp(28px, 3.4vw, 46px);

  --ls-micro: 0.14em;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --sans: "Helvetica Neue", Helvetica, "Inter", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --serif: "Times New Roman", Times, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

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

html, body { height: 100%; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }

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

::selection { background: #2a2a2e; color: #fff; }

:focus-visible {
  outline: 1px solid var(--fg-dim);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------
   Tiny type — the voice of the whole site
------------------------------------------------------------------ */
.micro {
  font-size: var(--t-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
  color: var(--fg-dim);
  line-height: 1.4;
}

.micro-lower {
  font-size: var(--t-small);
  letter-spacing: 0.06em;
  color: var(--fg-dim);
  line-height: 1.4;
}

/* ------------------------------------------------------------------
   Chrome: wordmark + nav
------------------------------------------------------------------ */
.site-head {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: var(--pad-y) var(--pad-x);
  pointer-events: none;
  mix-blend-mode: normal;
}

.site-head > * { pointer-events: auto; }

.wordmark {
  font-size: var(--t-small);
  letter-spacing: 0.02em;
  color: var(--fg);
  text-transform: lowercase;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: clamp(14px, 1.6vw, 26px);
}

.nav a {
  font-size: var(--t-small);
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--fg-faint);
  transition: color 0.3s var(--ease);
}

.nav a:hover,
.nav a[aria-current="page"] { color: var(--fg); }

/* ------------------------------------------------------------------
   Gallery (home)
------------------------------------------------------------------ */
.gallery-page {
  height: 100%;
  overflow: hidden;
}

.filters {
  position: fixed;
  left: var(--pad-x);
  bottom: calc(var(--pad-y) + 2px);
  z-index: 35;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(10px, 1.2vw, 20px);
}

.filters button {
  appearance: none;
  background: none;
  border: 0;
  padding: 2px 0;
  cursor: pointer;
  font: inherit;
  font-size: var(--t-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
  color: var(--fg-faint);
  white-space: nowrap;
  transition: color 0.3s var(--ease);
}

.filters button:hover { color: var(--fg-dim); }
.filters button[aria-pressed="true"] { color: var(--fg); }

.viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  /* no grab cursor: the row is driven by the wheel, and a mouse drag would
     fight the easing rather than help it */
  cursor: default;
  touch-action: pan-y;
}


.track {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: clamp(40px, 6vw, 110px);
  padding: 0 50vw;
  will-change: transform;
}

/* .item carries the JS-driven 3D transform (arc position + rotation).
   .item__frame carries the CSS reveal transition, so the two never fight. */
.item {
  position: relative;
  flex: 0 0 auto;
  display: block;
  will-change: transform;
}

.item__frame {
  position: relative;
  overflow: hidden;
  background: var(--bg-elev);
  height: var(--item-h, 52vh);
  display: flex;
  opacity: 0;
  transform: translateY(16px) scale(1.03);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}

.item.is-revealed .item__frame {
  opacity: 1;
  transform: none;
}

.item__frame img {
  height: 100%;
  width: auto;
  max-width: none;
  object-fit: cover;
  transform: scale(1.001);
  transition: filter 0.6s var(--ease);
  filter: saturate(0.9);
}

.item:hover .item__frame img { filter: saturate(1); }

/* The centred item's real site, layered over its cover. It never takes the
   pointer: the carousel keeps drag, and the item's link keeps the click. */
.item__live {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #fff;
  opacity: 0;
  transition: opacity 0.7s var(--ease);
  pointer-events: none;
}

.item__live.is-on { opacity: 1; }

.item__live-frame {
  position: absolute;
  top: 0;
  left: 0;
  border: 0;
  transform-origin: 0 0;
  pointer-events: none;
}

/* One height for every item in the row. Covers differ wildly in aspect — a
   3:4 garment shot next to a 16:10 site screenshot — and cycling the height
   on top of that made the portrait ones read as an afterthought. The rhythm
   comes from the vertical offsets in STAGGER (js/main.js) and from the
   natural width differences instead.
   Capped: the caption hangs below the centred item and stops clearing the
   counter at the bottom of the screen above about 52vh. */
.item { --item-h: 50vh; }

/* ---- 3D carousel layout (default: pointer, wide, motion allowed) ----
   Items sit on a cylinder around a vertical axis behind the screen. JS places
   each one; CSS only establishes the 3D context. The flex row above remains
   the layout for the mobile and reduced-motion fallbacks. */
/* The items are billboarded — they never turn — so the only thing the 3D
   pipeline contributes is perspective foreshortening, which JS computes
   directly. Keeping the transforms 2D matters: an element pushed to a
   non-zero Z inside preserve-3d paints in its projected position but is not
   hit-tested there, so off-centre items simply could not be clicked. */
@media (prefers-reduced-motion: no-preference) and (min-width: 769px) {
  .track {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    gap: 0;
  }

  .item {
    position: absolute;
    left: 0;
    top: 50%;
    transform-origin: 50% 50%;
    /* items stay square to the camera, so no backface ever shows */
  }
}

/* centred under the item, as in the reference, and above the neighbours it
   would otherwise be read against */
.item__caption {
  position: absolute;
  top: calc(100% + 16px);
  left: 50%;
  transform: translateX(-50%);
  width: max(100%, 200px);
  text-align: center;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}

.item.is-active .item__caption { opacity: 1; }

.item__title {
  font-size: var(--t-small);
  letter-spacing: 0.04em;
  color: var(--fg);
  margin: 0;
  font-weight: 400;
}

.item__sub {
  font-size: var(--t-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin: 3px 0 0;
}

/* bottom-centre scroll affordance + counter */
.scrollbar {
  position: fixed;
  left: 50%;
  bottom: var(--pad-y);
  transform: translateX(-50%);
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}

.scroll-rail {
  width: clamp(70px, 9vw, 120px);
  height: 1px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}

.scroll-rail__thumb {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 28%;
  background: var(--fg-dim);
  will-change: transform;
}

.counter {
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.12em;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

.scroll-label {
  font-size: var(--t-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
  color: var(--fg-faint);
}

.gallery-empty {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}

.gallery-empty.is-shown { display: flex; }

/* ------------------------------------------------------------------
   Interior pages (project / about / contact)
------------------------------------------------------------------ */
.page {
  min-height: 100%;
  padding: calc(var(--pad-y) * 3 + 20px) var(--pad-x) clamp(60px, 10vh, 140px);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
  color: var(--fg-faint);
  transition: color 0.3s var(--ease);
  margin-bottom: clamp(20px, 3vw, 40px);
}

.back:hover { color: var(--fg); }

/* --- project detail --- */
.project {
  display: grid;
  /* Two columns since the notes and the meta list came out: a narrow
     sticky rail for the title and the link, and the images taking the
     rest of the page. */
  grid-template-columns: minmax(200px, 20%) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 72px);
  align-items: start;
}

.project__aside {
  position: sticky;
  top: calc(var(--pad-y) * 3 + 20px);
  align-self: start;
}

.project__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-display);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--fg);
}

.project__sub {
  font-size: var(--t-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
  color: var(--fg-faint);
  margin: 12px 0 0;
}

.project__desc {
  color: var(--fg-dim);
  font-size: var(--t-body);
  margin: clamp(18px, 2.4vw, 30px) 0 0;
  max-width: 34ch;
}

.project__link {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  margin-top: clamp(16px, 2vw, 24px);
  font-size: var(--t-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  padding-bottom: 5px;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}

.project__link:hover { border-color: var(--fg); }

.project__link-arrow {
  font-size: 0.9em;
  color: var(--fg-faint);
  transition: color 0.3s var(--ease);
}

.project__link:hover .project__link-arrow { color: var(--fg); }

.notes {
  list-style: none;
  margin: clamp(26px, 3.4vw, 44px) 0 0;
  padding: 0;
  display: grid;
  gap: clamp(16px, 1.8vw, 24px);
  max-width: 34ch;
}

.note {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.note__num {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--fg-faint);
  letter-spacing: 0.08em;
  padding-top: 2px;
}

.note__title {
  font-size: var(--t-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
  color: var(--fg);
  margin: 0 0 5px;
  font-weight: 400;
}

.note__body {
  font-size: var(--t-small);
  line-height: 1.6;
  color: var(--fg-faint);
  margin: 0;
}

.project__media {
  display: grid;
  gap: clamp(16px, 2.2vw, 34px);
}

.project__media figure { margin: 0; background: var(--bg-elev); }
.project__media img { width: 100%; height: auto; }

/* --- live site preview --- */
.preview {
  border: 1px solid var(--line);
  background: var(--bg-elev);
}

.preview__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}

.preview__dots {
  flex: 0 0 auto;
  width: 34px;
  height: 8px;
  background-image: radial-gradient(circle, var(--fg-faint) 3px, transparent 3.5px);
  background-size: 12px 8px;
  background-repeat: repeat-x;
  opacity: 0.7;
}

.preview__url {
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.06em;
  color: var(--fg-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview__shell {
  position: relative;
  height: clamp(340px, 62vh, 680px);
  overflow: hidden;
  background: #fff;
}

/* The frame is laid out at a real desktop width and scaled down to fit the
   column, so the site shows its desktop layout rather than its mobile one.
   JS sets --preview-k and --preview-h from the column's measured width. */
.preview__frame {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--preview-w, 1440px);
  height: var(--preview-h, 900px);
  border: 0;
  display: block;
  transform: scale(var(--preview-k, 1));
  transform-origin: 0 0;
}

.preview__cap {
  padding: 10px 12px;
  border-top: 1px solid var(--line-soft);
  font-size: var(--t-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
  color: var(--fg-faint);
}

.project__meta {
  position: sticky;
  top: calc(var(--pad-y) * 3 + 20px);
  display: grid;
  gap: clamp(16px, 2vw, 26px);
  align-self: start;
  text-align: right;
}

.meta-pair dt {
  font-size: var(--t-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
  color: var(--fg-faint);
  margin: 0 0 5px;
}

.meta-pair dd {
  margin: 0;
  font-size: var(--t-small);
  letter-spacing: 0.03em;
  color: var(--fg);
}

.project-nav {
  margin-top: clamp(60px, 9vh, 120px);
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.project-nav a {
  font-size: var(--t-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
  color: var(--fg-faint);
  transition: color 0.3s var(--ease);
}

.project-nav a:hover { color: var(--fg); }

/* --- about --- */
.about {
  display: grid;
  grid-template-columns: minmax(0, 36%) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 90px);
  align-items: start;
}

.about__portrait { background: var(--bg-elev); }
.about__portrait img { width: 100%; height: auto; }

.about__headline {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-head);
  line-height: 1.08;
  letter-spacing: -0.012em;
  margin: 0;
  white-space: pre-line;
}

.about__intro {
  font-size: var(--t-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
  color: var(--fg-faint);
  margin: 14px 0 0;
}

.about__bio {
  color: var(--fg-dim);
  max-width: 56ch;
  margin: clamp(20px, 2.6vw, 34px) 0 0;
  font-size: var(--t-lead);
  line-height: 1.6;
}

.about__bio + .about__bio { margin-top: 1em; font-size: var(--t-body); }

.about__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: clamp(16px, 2vw, 30px);
  margin: clamp(30px, 4vw, 52px) 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.services {
  grid-column: 1 / -1;
  margin-top: clamp(50px, 8vh, 110px);
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: minmax(0, 36%) minmax(0, 1fr);
  gap: clamp(20px, 5vw, 90px);
  align-items: start;
}

.services__label {
  font-family: var(--serif);
  font-size: clamp(20px, 2.1vw, 30px);
  font-weight: 400;
  margin: 0;
}

.services__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px clamp(20px, 3vw, 44px);
}

.services__list li {
  font-size: var(--t-small);
  letter-spacing: 0.03em;
  color: var(--fg-dim);
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}

/* --- contact --- */
.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 26%);
  gap: clamp(28px, 5vw, 80px);
  align-items: start;
}

.contact__headline {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-display);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0;
  max-width: 14ch;
}

.contact__lead {
  color: var(--fg-dim);
  max-width: 48ch;
  margin: clamp(20px, 2.6vw, 34px) 0 0;
  font-size: var(--t-lead);
}

.contact__email {
  display: inline-block;
  margin-top: clamp(26px, 3.4vw, 44px);
  font-size: clamp(18px, 2.2vw, 30px);
  letter-spacing: -0.01em;
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  transition: border-color 0.3s var(--ease);
}

.contact__email:hover { border-color: var(--fg); }

.contact__side { display: grid; gap: clamp(18px, 2.4vw, 30px); }

.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.link-list a {
  font-size: var(--t-small);
  letter-spacing: 0.03em;
  color: var(--fg-dim);
  transition: color 0.3s var(--ease);
}

.link-list a:hover { color: var(--fg); }

.ph-note {
  margin-top: clamp(40px, 7vh, 90px);
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: var(--t-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
  grid-column: 1 / -1;
}

/* ------------------------------------------------------------------
   Responsive — below 768px
------------------------------------------------------------------ */
@media (max-width: 768px) {
  :root { --pad-x: 16px; --pad-y: 16px; }

  .nav { gap: 14px; }

  /* gallery becomes a vertical stack */
  .gallery-page { height: auto; overflow: visible; }

  .viewport {
    position: static;
    inset: auto;
    overflow: visible;
    cursor: default;
    touch-action: auto;
  }

  .track {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    gap: 44px;
    height: auto;
    padding: calc(var(--pad-y) * 3 + 46px) var(--pad-x) 120px;
    transform: none !important;
  }

  .item { transform: none !important; }

  .item__frame {
    height: auto;
    display: block;
    opacity: 1;
    transform: none;
  }
  .item__frame img { width: 100%; height: auto; }

  .item__caption {
    position: static;
    opacity: 1;
    width: auto;
    margin-top: 10px;
    transform: none;
    text-align: left;
  }

  .filters {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 12px var(--pad-x);
    gap: 14px;
    background: linear-gradient(to top, var(--bg) 62%, transparent);
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .filters::-webkit-scrollbar { display: none; }

  .scrollbar { display: none; }

  .project {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .project__aside,
  .project__meta { position: static; text-align: left; }

  .project__meta {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    display: grid;
    order: 3;
  }

  .about,
  .services,
  .contact { grid-template-columns: 1fr; }

  .about__portrait { max-width: 320px; }
}

@media (max-width: 420px) {
  .project__title,
  .contact__headline { font-size: clamp(32px, 11vw, 44px); }
}

/* ------------------------------------------------------------------
   Reduced motion — plain scrollable row, no easing or scaling
------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  /* Not natively scrolled any more: the row wraps, and a native scroller
     has an end to hit. JS positions the items; reduced motion is honoured
     by dropping the easing, the 3D and the reveal, not by stopping dead. */
  .viewport {
    overflow: hidden;
    touch-action: auto;
    cursor: default;
  }

  .track {
    position: relative;
    transform: none !important;
    padding-left: var(--pad-x);
    padding-right: var(--pad-x);
  }

  .item { transition: none; }

  .item__frame {
    opacity: 1 !important;
    transform: none !important;
  }

  .item__caption {
    opacity: 1;
    position: static;
    margin-top: 10px;
    width: auto;
    transform: none;
    text-align: left;
  }
}
