/* Beyond Design: stone background, warm ink, logo red used sparingly. */
:root {
  --stone: #E2DCD2;
  --stone-deep: #D6CFC3;
  --stone-line: #BFB6A8;
  --ink: #24201C;
  --ink-soft: #5B544C;
  --red: #ED1C24;          /* logo red: artwork and large accents only */
  --red-ink: #C4161D;      /* button / link red: 5.7:1 with white text */
  --white: #FFFFFF;

  --font: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --text-xs: 0.8125rem;    /* 13px: header meta, captions */
  --text-sm: 0.9375rem;    /* 15px */
  --text-md: 1.0625rem;    /* 17px: body */
  --text-lg: clamp(1.375rem, 1.1rem + 1vw, 1.75rem);
  --text-xl: clamp(2rem, 1.3rem + 2.6vw, 3.5rem);

  --gutter: clamp(16px, 2.4vw, 32px);
  --header-h: 72px;
  --card-gap: 12px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --z-header: 20;
  --z-dialog: 100;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--stone);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--red-ink); outline-offset: 3px; }

.skip-link {
  position: absolute; left: var(--gutter); top: -100px; z-index: 1000;
  background: var(--ink); color: var(--stone); padding: 10px 14px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 22px; border: 0; border-radius: 999px;
  font-size: var(--text-sm); font-weight: 500; text-decoration: none;
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out);
}
.button:active { transform: scale(0.97); }
.button-red { background: var(--red-ink); color: var(--white); }
.button-red:hover { background: #A51218; }

.text-link {
  padding: 0; border: 0; background: none;
  font-size: var(--text-md); font-weight: 500;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px;
  min-height: 44px;
}
.text-link:hover { color: var(--red-ink); }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: var(--z-header);
  height: var(--header-h);
  display: grid; align-items: center; gap: var(--gutter);
  grid-template-columns: 1fr 1.2fr 1.2fr 1fr auto;
  padding: 0 var(--gutter);
  background: var(--stone);
  font-size: var(--text-xs); line-height: 1.3; text-transform: uppercase; letter-spacing: 0.02em;
}
.brand { width: 68px; justify-self: start; }
.brand img { width: 100%; height: auto; }
.header-line, .header-time { color: var(--ink); }
.header-time time { font-variant-numeric: tabular-nums; }
.site-nav ul { display: flex; gap: 20px; }
.site-nav a { text-decoration: none; display: inline-block; padding: 12px 0; }
.site-nav a:hover, .site-nav a[aria-current="true"] { color: var(--red-ink); }
.menu-toggle { display: none; }
.header-cta { text-transform: none; letter-spacing: 0; }

main > section { scroll-margin-top: var(--header-h); }

/* ---------- Portfolio strip ---------- */
.work { position: relative; scroll-margin-top: 0; }
.work-pin {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: grid; grid-template-rows: auto 1fr auto;
  padding-top: var(--header-h);
  overflow: hidden;
}
.work-intro {
  display: flex; align-items: end; justify-content: space-between; gap: var(--gutter);
  padding: clamp(16px, 4vh, 48px) var(--gutter) clamp(16px, 3vh, 32px);
}
.work-intro h1 {
  max-width: 18ch;
  font-size: var(--text-xl); font-weight: 500; line-height: 1.04; letter-spacing: -0.03em;
  text-wrap: balance;
}
.work-hint { font-size: var(--text-xs); color: var(--ink-soft); white-space: nowrap; }

.work-viewport { position: relative; min-height: 0; }
.work-track {
  --card-h: min(100%, 640px);
  display: flex; gap: var(--card-gap);
  height: 100%;
  padding: 0 var(--gutter);
  will-change: transform;
}
.work-card { flex: none; height: 100%; display: flex; }
.work-card > button, .work-card > a {
  display: grid; grid-template-rows: auto 1fr; gap: 10px;
  height: 100%; aspect-ratio: 4 / 5.6; max-width: 82vw;
  padding: 0; border: 0; background: none; text-align: left; text-decoration: none;
}
.work-caption {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: var(--text-xs); line-height: 1.3; text-transform: uppercase; letter-spacing: 0.02em;
}
.work-caption span:last-child { color: var(--ink-soft); text-align: right; }
.work-frame { position: relative; overflow: hidden; background: var(--stone-deep); min-height: 0; }
.work-frame img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 700ms var(--ease-out);
}
.work-card > button:hover .work-frame img,
.work-card > button:focus-visible .work-frame img { transform: scale(1.035); }

/* Closing card that leads to the enquiry form */
.work-card--end > a {
  background: var(--ink); color: var(--stone);
  grid-template-rows: 1fr auto; padding: clamp(20px, 3vw, 36px);
}
.work-card--end strong { font-size: var(--text-lg); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; }
.work-card--end span { font-size: var(--text-sm); text-decoration: underline; text-underline-offset: 4px; }
.work-card--end > a:hover { background: var(--red-ink); color: var(--white); }

.work-progress {
  display: flex; align-items: center; gap: 16px;
  padding: 18px var(--gutter) 22px;
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.work-bar { flex: 1; height: 1px; background: var(--stone-line); position: relative; }
.work-bar span {
  position: absolute; inset: 0; background: var(--ink);
  transform-origin: left; transform: scaleX(0);
}

/* Fallback when motion is reduced or JS sizing is off: plain sideways scrolling. */
.work--native .work-viewport { overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; }
.work--native .work-track { width: max-content; transform: none !important; }
.work--native .work-card { scroll-snap-align: start; scroll-margin-left: var(--gutter); }
.work--native .work-hint { display: none; }

/* ---------- Walkthrough ---------- */
.walkthrough {
  display: grid; grid-template-columns: 1fr minmax(260px, 400px); gap: clamp(32px, 6vw, 96px);
  align-items: center;
  padding: clamp(72px, 12vh, 140px) var(--gutter);
  border-top: 1px solid var(--stone-line);
}
.walkthrough-text { max-width: 34rem; display: grid; gap: 18px; justify-items: start; }
.walkthrough-text h2 { font-size: var(--text-xl); font-weight: 500; line-height: 1.05; letter-spacing: -0.03em; }
.walkthrough-text p { color: var(--ink-soft); }
.walkthrough-video { position: relative; }
.walkthrough-video video { width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: cover; background: var(--stone-deep); }
.video-controls { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 8px; }
.video-controls button {
  min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px;
  background: rgba(36, 32, 28, 0.78); color: var(--stone); font-size: var(--text-xs);
}
.video-controls button:hover { background: var(--ink); }

/* ---------- Studio & Services ---------- */
.studio, .services {
  display: grid; grid-template-columns: minmax(140px, 1fr) 3fr; gap: var(--gutter);
  padding: clamp(64px, 10vh, 120px) var(--gutter);
  border-top: 1px solid var(--stone-line);
}
.section-title { font-size: var(--text-sm); font-weight: 500; }
.studio-body { display: grid; gap: 24px; max-width: 46rem; }
.studio-lead { font-size: var(--text-lg); line-height: 1.3; letter-spacing: -0.01em; }
.studio-body > p:not(.studio-lead) { color: var(--ink-soft); max-width: 38rem; }
.studio-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 14rem)); gap: var(--gutter); padding-top: 16px; }
.studio-facts dt { font-size: var(--text-xs); color: var(--ink-soft); }
.studio-facts dd { font-size: var(--text-lg); }

.service-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gutter); }
.service-list h3 { font-size: var(--text-lg); font-weight: 500; line-height: 1.2; margin-bottom: 10px; }
.service-list p { color: var(--ink-soft); max-width: 30ch; }
.process-title { grid-column: 2; margin-top: clamp(40px, 7vh, 72px); font-size: var(--text-sm); font-weight: 500; }
.process-list {
  grid-column: 2; counter-reset: step;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--gutter);
}
.process-list li { counter-increment: step; padding-top: 14px; border-top: 1px solid var(--ink); }
.process-list li::before { content: counter(step); display: block; font-size: var(--text-xs); color: var(--ink-soft); margin-bottom: 18px; }
.process-list h4 { font-size: var(--text-md); font-weight: 500; margin-bottom: 6px; }
.process-list p { font-size: var(--text-sm); color: var(--ink-soft); }

/* ---------- Contact ---------- */
.contact {
  display: grid; grid-template-columns: 1fr 1.3fr; gap: clamp(32px, 6vw, 96px);
  padding: clamp(72px, 12vh, 140px) var(--gutter);
  background: var(--stone-deep);
}
.contact-intro { display: grid; gap: 18px; align-content: start; }
.contact-intro h2 { font-size: var(--text-xl); font-weight: 500; line-height: 1.05; letter-spacing: -0.03em; }
.contact-intro > p { color: var(--ink-soft); max-width: 30rem; }
.contact-details { display: grid; gap: 14px; margin-top: 18px; }
.contact-details dt { font-size: var(--text-xs); color: var(--ink-soft); }
.contact-details a { text-underline-offset: 3px; }

.enquiry { display: grid; grid-template-columns: 1fr 1fr; gap: 20px var(--gutter); align-content: start; }
.field { display: grid; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: var(--text-sm); font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--stone-line); border-radius: 4px; background: var(--stone);
  font: inherit; font-size: 1rem; color: var(--ink);
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline-offset: 0; border-color: var(--ink); }
.field [aria-invalid="true"] { border-color: var(--red-ink); }
.field-error { font-size: var(--text-sm); color: var(--red-ink); }
.form-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.form-note { font-size: var(--text-xs); color: var(--ink-soft); max-width: 36ch; }

/* ---------- Footer ---------- */
.site-footer {
  display: flex; align-items: end; justify-content: space-between; gap: var(--gutter);
  padding: 40px var(--gutter);
  font-size: var(--text-xs);
}
.footer-logo { width: 96px; height: auto; }
.site-footer a { text-underline-offset: 3px; padding: 12px 0; }

/* ---------- Gallery dialog ---------- */
.gallery {
  width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0;
  background: var(--stone); color: var(--ink);
  display: none; grid-template-rows: auto 1fr;
}
.gallery[open] { display: grid; animation: gallery-in 320ms var(--ease-out); }
.gallery::backdrop { background: var(--stone); }
@keyframes gallery-in { from { opacity: 0; transform: translateY(16px); } }
.gallery-head {
  display: flex; justify-content: space-between; align-items: start; gap: var(--gutter);
  padding: 18px var(--gutter);
}
.gallery-head h2 { font-size: var(--text-lg); font-weight: 500; line-height: 1.15; }
.gallery-head p { font-size: var(--text-xs); color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.02em; margin-top: 4px; }
.gallery-nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; }
.gallery-nav button {
  min-height: 44px; padding: 0 16px; border: 1px solid var(--stone-line); border-radius: 999px;
  background: none; font-size: var(--text-xs);
}
.gallery-nav button:hover { border-color: var(--ink); }
.gallery-nav .gallery-close { background: var(--ink); color: var(--stone); border-color: var(--ink); }
.gallery-strip {
  display: flex; gap: var(--card-gap);
  min-height: 0; padding: 0 var(--gutter) var(--gutter);
  overflow-x: auto; overscroll-behavior: contain; scroll-snap-type: x proximity;
  scrollbar-width: thin; scrollbar-color: var(--stone-line) transparent;
}
.gallery-strip:focus-visible { outline-offset: -2px; }
.gallery-strip li { flex: none; height: 100%; scroll-snap-align: start; scroll-margin-left: var(--gutter); }
.gallery-strip img { height: 100%; width: auto; max-width: none; object-fit: cover; background: var(--stone-deep); }
body.has-dialog { overflow: hidden; }

/* ---------- Smaller screens ---------- */
@media (max-width: 1023px) {
  .site-header { grid-template-columns: auto 1fr auto auto; }
  .header-line { display: none; }
  .header-time { display: none; }
  .site-nav { justify-self: end; position: relative; }
  .menu-toggle {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px;
    border: 0; background: none; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.02em;
  }
  .site-nav ul {
    position: absolute; right: 0; top: calc(100% + 14px);
    flex-direction: column; gap: 0; min-width: 180px; padding: 8px 18px;
    background: var(--stone); border: 1px solid var(--stone-line);
  }
  .site-nav ul:not(.is-open) { display: none; }
  .site-nav a { display: block; padding: 12px 0; font-size: var(--text-sm); }

  .walkthrough, .studio, .services, .contact { grid-template-columns: 1fr; }
  .walkthrough-video { max-width: 380px; }
  .process-title, .process-list { grid-column: 1; }
  .process-list { grid-template-columns: repeat(2, 1fr); row-gap: 28px; }
  .service-list { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 599px) {
  :root { --header-h: 64px; }
  .brand { width: 56px; }
  .header-cta { padding: 0 16px; }
  .work-intro { padding-top: 12px; }
  .work-intro h1 { font-size: 1.75rem; }
  .work-hint { display: none; }
  .work-track { padding-bottom: 4px; }
  .studio-facts { grid-template-columns: 1fr; gap: 14px; }
  .process-list { grid-template-columns: 1fr; }
  .enquiry { grid-template-columns: 1fr; }
  .gallery-head { flex-direction: column; }
  .gallery-nav { justify-content: start; }
  .gallery-strip img { height: auto; max-height: 100%; }
  .site-footer { flex-direction: column; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
