/* ==========================================================================
   George Emrezian · Portfolio
   Cool off-white surface, near-black chrome, one restrained cobalt accent.

   Motion rule: every animation and transition in this file is scoped under
   html.motion-on (or the view-transition pseudo-elements, which site.js skips
   when motion is off). Removing that class stops all movement immediately and
   leaves every element in its final, visible state. scripts/check.mjs audits it.
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  src: url('assets/fonts/Inter-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('assets/fonts/Inter-Medium.woff') format('woff');
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter Display';
  src: url('assets/fonts/InterDisplay-SemiBold.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #e8ecf1;
  --ink: #0c0e12;
  --muted: #4f5763;
  --line: #d6dbe2;
  --line-strong: #b9c0ca;
  --accent: #2747d9;
  --accent-soft: #e4e9fd;
  --dark: #0b0c0e;
  --dark-2: #15181d;
  --dark-line: #262a31;
  --on-dark: #eef1f5;
  --on-dark-muted: #a3abb6;
  --accent-on-dark: #9fb2ff;

  --font-sans:
    'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
    Arial, sans-serif;
  --font-display: 'Inter Display', var(--font-sans);
  --font-serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;

  --wrap: 1240px;
  --gutter: clamp(20px, 4.2vw, 56px);
  --header-h: 72px;
  --radius: 14px;
  --radius-sm: 8px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-swift: cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

html {
  /* Native scrolling only. Smooth scrolling is done in JS, interruptibly, when motion is on. */
  scroll-behavior: auto;
  /* Reserve the scrollbar so locking scroll (menu, viewer) never shifts the layout. */
  scrollbar-gutter: stable;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: 'kern', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

main {
  flex: 1 0 auto;
  outline: none;
}

/* Keep anchor targets and keyboard focus clear of the sticky header. Set on content,
   not as html scroll-padding: that would make the browser "scroll into view" the
   header's own controls on focus and jump the page. */
main,
main *,
.site-footer * {
  scroll-margin-top: calc(var(--header-h) + 24px);
}

/* Very subtle cool ambient light behind the page. Static unless motion is on. */
body::before {
  content: '';
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 120vh;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40% 35% at 78% 18%, rgba(39, 71, 217, 0.07), transparent 70%),
    radial-gradient(35% 30% at 12% 8%, rgba(120, 150, 190, 0.1), transparent 70%);
}

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

a {
  color: inherit;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.site-header :focus-visible,
.site-footer :focus-visible,
.ribbon :focus-visible,
.image-viewer :focus-visible {
  outline-color: var(--accent-on-dark);
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: none;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Typography ---------- */

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-size: clamp(44px, 7vw, 104px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  margin: 0 0 28px;
  max-width: 14ch;
}

h2 {
  font-size: clamp(30px, 3.4vw, 48px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  margin: 0 0 24px;
}

h3 {
  font-size: clamp(26px, 2.5vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
}

p {
  margin: 0 0 1em;
}

.lead {
  max-width: 40ch;
  font-size: clamp(19px, 1.6vw, 23px);
  line-height: 1.5;
  color: var(--muted);
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.eyebrow,
.label {
  display: block;
  margin: 0 0 18px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow::before {
  content: '';
  display: inline-block;
  width: 22px;
  height: 2px;
  margin-right: 12px;
  vertical-align: 0.3em;
  background: var(--accent);
  border-radius: 2px;
}

.text-link {
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
}

.text-link:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* ---------- Buttons (stationary: colour and border only) ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.button--ghost:hover {
  background: var(--surface);
  border-color: var(--ink);
  color: var(--ink);
}

.motion-on .button,
.motion-on .text-link,
.motion-on .site-nav a,
.motion-on .motion-toggle,
.motion-on .menu-toggle,
.motion-on .footer-links a,
.motion-on .to-top,
.motion-on .back-link,
.motion-on .category,
.motion-on .next-project a,
.motion-on .shot-hint,
.motion-on .work-media,
.motion-on .shot-frame,
.motion-on .viewer-controls button {
  transition:
    background-color 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease,
    text-decoration-color 0.25s ease,
    opacity 0.25s ease;
}

/* ---------- Header ---------- */

/* Solid colour, no transform, filter or backdrop-filter: nothing here may become a
   containing block for the fixed full-screen mobile menu. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--dark);
  color: var(--on-dark);
  border-bottom: 1px solid var(--dark);
  view-transition-name: site-header;
}

.site-header.is-scrolled {
  border-bottom-color: var(--dark-line);
  box-shadow: 0 10px 30px -18px rgba(5, 8, 15, 0.6);
}

.header-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--header-h);
}

.brand {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
  color: var(--on-dark);
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.g-mark {
  width: 32px;
  height: 32px;
  flex: none;
}

.g-mark-bg {
  fill: var(--on-dark);
}

.g-mark-g {
  fill: none;
  stroke: var(--dark);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-nav ul {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--on-dark-muted);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--on-dark);
  background: var(--dark-2);
}

.site-nav a[aria-current='page'] {
  color: var(--on-dark);
  background: var(--dark-2);
  box-shadow: inset 0 0 0 1px var(--dark-line);
}

.nav-contact {
  display: none;
}

.header-tools {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.motion-toggle,
.menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--dark-line);
  border-radius: 999px;
  background: transparent;
  color: var(--on-dark);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.motion-toggle[hidden],
.menu-toggle {
  display: none;
}

.motion-toggle:hover,
.menu-toggle:hover {
  border-color: var(--on-dark-muted);
  background: var(--dark-2);
}

.motion-state {
  display: inline-block;
  min-width: 2.4em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-on-dark);
  color: var(--dark);
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
}

.motion-toggle[aria-pressed='false'] .motion-state {
  background: transparent;
  color: var(--on-dark-muted);
  box-shadow: inset 0 0 0 1px var(--on-dark-muted);
}

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

.hero {
  padding: clamp(64px, 9vw, 136px) 0 clamp(48px, 6vw, 88px);
}

.hero--home {
  padding-bottom: clamp(64px, 8vw, 112px);
}

.quote-intro {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 17px;
}

.quote-author {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink);
}

.intro-quote {
  margin: 0 0 clamp(48px, 7vw, 96px);
  max-width: 15ch;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(46px, 8.2vw, 124px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.intro-quote p {
  margin: 0;
  text-wrap: balance;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
  padding-top: clamp(32px, 4vw, 56px);
  border-top: 1px solid var(--line);
}

.hero--home h1 {
  font-size: clamp(34px, 4.6vw, 68px);
  line-height: 1.02;
  max-width: 12ch;
  margin: 0;
}

.hero--home .lead {
  max-width: 36ch;
  padding-top: 6px;
}

.intro-about {
  max-width: 52ch;
  color: var(--muted);
  margin-bottom: 32px;
}

.hero--page h1 {
  max-width: 13ch;
}

.hero--case h1 {
  font-size: clamp(52px, 9vw, 132px);
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0 0 28px;
  padding: 6px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.back-link:hover {
  border-color: var(--ink);
  background: var(--surface);
}

.case-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 28px;
  align-items: center;
  margin-top: 36px;
}

.case-actions .chips {
  margin: 0;
}

/* ---------- Chips ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

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

.ribbon {
  position: relative;
  padding: 28px 0 32px;
  background: var(--dark);
  color: var(--on-dark);
  overflow: hidden;
}

.ribbon-title {
  margin: 0 0 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-dark-muted);
}

/* Static by default (no JS, or motion off): a wrapped list inside the page width. */
.ribbon-viewport {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.ribbon-track {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ribbon-track li {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(22px, 2.6vw, 34px);
  letter-spacing: -0.03em;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--on-dark);
}

.ribbon-track li::after {
  content: '/';
  margin: 0 0.6em;
  color: var(--accent-on-dark);
  opacity: 0.55;
  font-weight: 400;
}

.ribbon-track--clone {
  display: none;
}

/* Motion on: a seamless marquee made of two identical tracks. */
.motion-on .ribbon-viewport {
  display: flex;
  max-width: none;
  padding-inline: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.motion-on .ribbon-track {
  flex: none;
  flex-wrap: nowrap;
  animation: ribbon-scroll 60s linear infinite;
}

.motion-on .ribbon-track--clone {
  display: flex;
}

.motion-on .ribbon:hover .ribbon-track {
  animation-play-state: paused;
}

@keyframes ribbon-scroll {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-100%, 0, 0);
  }
}

/* ---------- Sections ---------- */

.section {
  padding: clamp(72px, 9vw, 136px) 0;
}

.section--tight {
  padding-top: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: clamp(40px, 5vw, 72px);
}

.section-head h2 {
  margin: 0;
}

.list-title {
  margin-bottom: 28px;
}

/* ---------- Project cards ---------- */

.work-list {
  display: grid;
  gap: clamp(72px, 9vw, 128px);
}

.work {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
}

.work--flip {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
}

.work--flip .work-visual {
  order: 2;
}

.work--flip .work-media {
  margin-left: auto;
}

.work-visual {
  min-width: 0;
}

/* Screenshot frames: a thin black outline hugging the real image. Natural
   proportions, never cropped, never upscaled past the file's own pixels. */
.work-media,
.shot-frame {
  display: block;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--ink);
  background: var(--surface);
  line-height: 0;
  box-shadow: 0 22px 44px -34px rgba(16, 24, 40, 0.45);
}

.work-media img,
.shot-frame img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
}

.work-media:hover,
.shot-button:hover .shot-frame {
  border-color: var(--accent);
}

.work-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 3 / 2;
  line-height: 1.2;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
}

.work-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 20px;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.work-type {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.work h3 {
  font-size: clamp(36px, 4vw, 60px);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 18px;
}

.work h3 a {
  text-decoration: none;
}

.work h3 a:hover {
  color: var(--accent);
}

.work-summary {
  max-width: 42ch;
  color: var(--muted);
  font-size: 18px;
}

.work-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin: 0;
}

.category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px 40px;
  margin-top: clamp(72px, 9vw, 128px);
  padding: clamp(28px, 3.4vw, 44px);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line);
}

.category h3 {
  font-size: clamp(24px, 2.2vw, 32px);
  margin-bottom: 8px;
}

.category p {
  margin: 0;
  color: var(--muted);
}

/* ---------- Labs ---------- */

.labhead,
.lab {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(120px, 0.6fr);
  gap: 32px;
}

.labhead {
  padding: 0 0 14px;
  border-bottom: 1px solid var(--ink);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.labhead span:last-child,
.lab-code {
  text-align: right;
}

.lab {
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.lab h3 {
  font-size: clamp(22px, 2vw, 28px);
  margin-bottom: 10px;
}

.lab-main p {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
}

.lab-tech {
  margin: 0;
  padding-top: 4px;
  font-weight: 500;
}

.lab-code {
  padding-top: 4px;
}

.lab-status {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

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

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.contact-card {
  min-width: 0;
  padding: clamp(28px, 3.6vw, 48px);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line), 0 24px 48px -36px rgba(16, 24, 40, 0.3);
}

.contact-card--mail {
  background: var(--dark);
  color: var(--on-dark);
  box-shadow: none;
}

.contact-card--mail h2,
.contact-card--mail .contact-value {
  color: var(--on-dark);
}

.contact-card--mail .label,
.contact-card--mail > p:not(.label) {
  color: var(--on-dark-muted);
}

.contact-card--mail .contact-value:hover {
  color: var(--accent-on-dark);
}

.contact-card h2 {
  font-size: clamp(26px, 2.4vw, 34px);
  margin-bottom: 16px;
}

.contact-value {
  display: inline-block;
  max-width: 100%;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.5vw, 34px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
  text-decoration-thickness: 1px;
}

.contact-value:hover {
  color: var(--accent);
}

.contact-card > p:not(.label),
.contact-note p {
  margin: 20px 0 0;
  color: var(--muted);
}

.contact-card strong {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}

.contact-card .actions {
  margin-top: 28px;
}

.contact-note {
  grid-column: 1 / -1;
  padding: 32px 0 0;
  border-top: 1px solid var(--line);
}

.contact-note h2 {
  font-size: clamp(22px, 2vw, 28px);
  margin: 0;
}

.contact-note p {
  max-width: 64ch;
  margin-top: 12px;
}

/* ---------- Case study ---------- */

.case-cover {
  padding-bottom: clamp(16px, 3vw, 40px);
}

.shot {
  margin: 0;
  min-width: 0;
}

.shot-button {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  text-align: left;
}

.shot--cover .shot-button {
  margin-inline: auto;
}

.shot--cover figcaption {
  justify-content: center;
}

.shot figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 15px;
}

/* The enlarge hint sits under the image, never on top of screenshot pixels. */
.shot-hint {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.22em;
}

.shot:hover .shot-hint {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.case-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: clamp(40px, 6vw, 112px);
  align-items: start;
}

.case-facts {
  position: sticky;
  top: calc(var(--header-h) + 32px);
}

.case-facts dl {
  margin: 0;
}

.case-facts div {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.case-facts dt {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.case-facts dd {
  margin: 0;
  font-weight: 500;
}

.case-copy section + section {
  margin-top: clamp(40px, 5vw, 64px);
}

.case-copy h2 {
  font-size: clamp(26px, 2.6vw, 38px);
  margin-bottom: 14px;
}

.case-copy p {
  max-width: 60ch;
  font-size: clamp(17px, 1.3vw, 19px);
  color: var(--muted);
}

.case-gallery {
  padding-top: 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 40px);
}

.gallery-grid {
  align-items: start;
}

.next-project {
  padding: 0 0 clamp(72px, 9vw, 128px);
}

.next-project a {
  display: grid;
  gap: 6px;
  padding: clamp(32px, 4vw, 56px);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line);
  text-decoration: none;
}

.next-project a:hover {
  background: var(--dark);
  color: var(--on-dark);
}

.next-project a:hover .label,
.next-project a:hover .next-type {
  color: var(--on-dark-muted);
}

.next-project .label {
  margin: 0;
}

.next-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(40px, 6vw, 88px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.next-type {
  color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: auto;
  background: var(--dark);
  color: var(--on-dark);
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 40px;
  padding-top: clamp(64px, 8vw, 112px);
  padding-bottom: clamp(48px, 6vw, 80px);
}

.footer-cta h2 {
  margin: 0 0 12px;
  color: var(--on-dark);
  font-size: clamp(44px, 6.4vw, 96px);
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.footer-cta p {
  margin: 0;
  color: var(--on-dark-muted);
  font-size: 19px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 20px;
  border: 1px solid var(--dark-line);
  border-radius: 999px;
  color: var(--on-dark);
  font-weight: 500;
  text-decoration: none;
}

.footer-links a:hover {
  border-color: var(--on-dark);
  background: var(--on-dark);
  color: var(--dark);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px 24px;
  padding-top: 24px;
  padding-bottom: 32px;
  border-top: 1px solid var(--dark-line);
}

.copyright {
  margin: 0;
  color: var(--on-dark-muted);
  font-size: 15px;
}

.footer-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.to-top {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--dark-line);
  border-radius: 999px;
  color: var(--on-dark);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.to-top:hover {
  border-color: var(--on-dark-muted);
  background: var(--dark-2);
}

/* ---------- Image viewer ---------- */

.image-viewer {
  width: min(1200px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100% - 24px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--dark);
  color: var(--on-dark);
  overflow: hidden;
}

.image-viewer[open] {
  display: flex;
  flex-direction: column;
}

.image-viewer::backdrop {
  background: rgba(6, 8, 12, 0.82);
}

.viewer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 12px 12px 20px;
  border-bottom: 1px solid var(--dark-line);
}

.viewer-count {
  margin: 0;
  color: var(--on-dark-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.viewer-controls {
  display: flex;
  gap: 8px;
}

.viewer-controls button {
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--dark-line);
  border-radius: 999px;
  background: transparent;
  color: var(--on-dark);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.viewer-controls button:hover {
  border-color: var(--on-dark);
  background: var(--dark-2);
}

.viewer-controls button[hidden] {
  display: none;
}

.viewer-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: #000;
  touch-action: pan-y pinch-zoom;
}

.viewer-stage img {
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.viewer-caption {
  margin: 0;
  padding: 14px 20px 18px;
  color: var(--on-dark-muted);
  font-size: 15px;
}

/* Scroll lock for the mobile menu and image viewer.
   scrollbar-gutter: stable normally reserves the classic (e.g. Windows) scrollbar
   space. Nothing can paint into a reserved gutter, so while locked the gutter is
   dropped (fixed sheets and ::backdrop then span the whole viewport) and the
   measured gutter width (--lock-gap, set by site.js; 0 with overlay scrollbars) is
   added back as body padding so the page does not reflow or shift. Full-bleed dark
   bands are extended into that padding so no light seam shows under the backdrop. */
html.is-locked {
  overflow: hidden;
  scrollbar-gutter: auto;
}

/* On body, not html: body clips horizontal overflow at its padding box, so the
   extended bands below stay visible inside this padding. */
html.is-locked body {
  padding-right: var(--lock-gap, 0px);
}

html.is-locked .site-header,
html.is-locked .ribbon,
html.is-locked .site-footer {
  margin-right: calc(-1 * var(--lock-gap, 0px));
  padding-right: var(--lock-gap, 0px);
}

/* ==========================================================================
   Motion (only when html.motion-on)
   ========================================================================== */

/* Staggered reveals. Content is hidden only while .reveal is set, which the
   <head> script removes after a short failsafe if site.js never runs. */
.motion-on.reveal [data-reveal]:not(.is-in) {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
}

.motion-on [data-reveal] {
  transition:
    opacity 0.9s var(--ease-out),
    transform 1s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

/* Arriving through a page transition: the slide is the entrance, so the hero
   shows immediately instead of fading in a second time. */
.motion-on.vt-in .hero [data-reveal] {
  opacity: 1;
  transform: none;
  transition: none;
}

/* Ambient light drifts very slowly. */
.motion-on body::before {
  animation: ambient-drift 38s ease-in-out infinite alternate;
}

@keyframes ambient-drift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-4%, 3%, 0);
  }
}

.motion-on .site-header {
  transition:
    box-shadow 0.3s ease,
    border-color 0.3s ease;
}

.motion-on .image-viewer[open] {
  animation: viewer-in 0.38s var(--ease-out);
}

.motion-on .image-viewer[open]::backdrop {
  animation: fade-in 0.3s ease;
}

.motion-on .viewer-stage img {
  animation: fade-in 0.35s ease;
}

@keyframes viewer-in {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* Horizontal page change, like a phone swipe. Same-origin, cross-document view
   transitions; site.js / the head script skip them when motion is off. The header
   has its own name, so it stays put while the page slides beneath it. */
@view-transition {
  navigation: auto;
}

::view-transition-group(site-header) {
  animation: none;
}

::view-transition-old(root) {
  animation: 0.48s var(--ease-swift) both vt-out-left;
}

::view-transition-new(root) {
  animation: 0.56s var(--ease-out) both vt-in-from-right;
}

html.vt-back::view-transition-old(root) {
  animation-name: vt-out-right;
}

html.vt-back::view-transition-new(root) {
  animation-name: vt-in-from-left;
}

@keyframes vt-out-left {
  to {
    transform: translateX(-28%);
    opacity: 0;
  }
}

@keyframes vt-in-from-right {
  from {
    transform: translateX(100%);
  }
}

@keyframes vt-out-right {
  to {
    transform: translateX(28%);
    opacity: 0;
  }
}

@keyframes vt-in-from-left {
  from {
    transform: translateX(-100%);
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1080px) {
  .work,
  .work--flip {
    grid-template-columns: minmax(0, 1fr);
  }

  .work--flip .work-visual {
    order: 0;
  }

  .work-summary {
    max-width: 56ch;
  }

  .intro-grid {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
}

/* Mobile navigation. Only with JS; without it the links simply sit under the brand. */
@media (max-width: 880px) {
  :root {
    --header-h: 64px;
  }

  .header-bar {
    flex-wrap: wrap;
    gap: 0 12px;
  }

  html:not(.js) .site-nav {
    order: 3;
    width: 100%;
    padding-bottom: 10px;
  }

  html:not(.js) .site-nav ul {
    flex-wrap: wrap;
  }

  .js .header-bar {
    flex-wrap: nowrap;
  }

  .js .menu-toggle:not([hidden]) {
    display: inline-flex;
  }

  /* Full-screen sheet: fixed, inset: 0, border-box. Never 100vw plus padding. */
  .js .site-nav {
    position: fixed;
    inset: 0;
    z-index: 1;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: calc(var(--header-h) + 32px) var(--gutter) 40px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--dark);
    visibility: hidden;
    opacity: 0;
  }

  .js .site-nav.is-open {
    visibility: visible;
    opacity: 1;
  }

  .js .site-nav ul {
    flex-direction: column;
    gap: 2px;
  }

  .js .site-nav a {
    width: 100%;
    padding: 10px 0;
    border-radius: 0;
    font-family: var(--font-display);
    font-size: clamp(36px, 10vw, 56px);
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.1;
    color: var(--on-dark);
    background: none;
  }

  .js .site-nav a[aria-current='page'] {
    box-shadow: none;
    color: var(--accent-on-dark);
    background: none;
  }

  .js .site-nav a:hover {
    background: none;
    color: var(--accent-on-dark);
  }

  .js .nav-contact {
    display: block;
    margin: 0;
    padding-top: 24px;
    border-top: 1px solid var(--dark-line);
  }

  .js .nav-contact a {
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--on-dark-muted);
    overflow-wrap: anywhere;
  }

  .motion-on .site-nav {
    transition:
      opacity 0.35s ease,
      visibility 0s linear 0.35s;
  }

  .motion-on .site-nav.is-open {
    transition:
      opacity 0.35s ease,
      visibility 0s;
  }

  .motion-on .site-nav li {
    transition:
      opacity 0.5s var(--ease-out),
      transform 0.6s var(--ease-out);
  }

  .motion-on .site-nav:not(.is-open) li {
    opacity: 0;
    transform: translate3d(24px, 0, 0);
  }

  .motion-on .site-nav.is-open li:nth-child(2) {
    transition-delay: 0.05s;
  }

  .motion-on .site-nav.is-open li:nth-child(3) {
    transition-delay: 0.1s;
  }

  .motion-on .site-nav.is-open li:nth-child(4) {
    transition-delay: 0.15s;
  }

  .labhead {
    display: none;
  }

  .lab {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .lab-code {
    text-align: left;
  }

  .case-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .case-facts {
    position: static;
  }

  .case-facts dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .contact-grid,
  .gallery-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .section-head,
  .category,
  .footer-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .button {
    white-space: normal;
  }

  .motion-toggle,
  .menu-toggle {
    padding-inline: 12px;
  }
}

@media (max-width: 440px) {
  :root {
    --gutter: 16px;
  }

  .brand {
    gap: 9px;
    font-size: 15px;
  }

  .g-mark {
    width: 28px;
    height: 28px;
  }

  .header-tools {
    gap: 4px;
  }

  .motion-toggle,
  .menu-toggle {
    gap: 6px;
    padding-inline: 10px;
  }

  .motion-state {
    min-width: 2.2em;
    padding-inline: 6px;
  }
}

@media (max-width: 365px) {
  .brand-name {
    display: none;
  }

  .case-facts dl {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media print {
  .site-header,
  .site-footer,
  .ribbon,
  .image-viewer {
    display: none !important;
  }

  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}
