/* Quad Craft Studio — after Studio Dumbar: black page, small chrome, the film full screen.
   One screen, no scrolling; the header links switch views.
   Black and white only. Two typefaces: Gloock (display) and Marcellus (text). */

:root {
  --black: #000;
  --white: #f2f1ee;
  --mute: rgba(242, 241, 238, 0.55);
  --line: rgba(242, 241, 238, 0.16);
  --serif: 'Gloock', Georgia, serif;
  --sans: 'Marcellus', 'Palatino Linotype', 'Book Antiqua', serif;
  --clean: 'Inter Tight', 'Helvetica Neue', Arial, sans-serif; /* plain sans for the Services panel */
  --g: clamp(16px, 1.6vw, 28px);
  --head: clamp(84px, 12vh, 120px);
  --ease: cubic-bezier(0.76, 0, 0.24, 1);
  --out: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--black);
  color: var(--white);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
::selection { background: var(--white); color: var(--black); }
:focus-visible { outline: 1px solid var(--white); outline-offset: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
video { display: block; width: 100%; height: 100%; object-fit: cover; background: var(--black); }

/* ───────── Header ───────── */
.top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--g);
  mix-blend-mode: difference;
  color: var(--white);
}
.logo { display: grid; font-family: var(--serif); font-size: 19px; line-height: 0.95; text-transform: uppercase; }
.logo span:last-child { display: flex; align-items: center; gap: 0.15em; }
.logo svg { order: -1; width: 0.95em; height: 0.95em; fill: currentColor; margin-left: -0.12em; }

.nav { display: flex; gap: clamp(20px, 3vw, 48px); font-size: 17px; }
.nav a { position: relative; }
.nav a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform 0.5s var(--ease);
}
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }

/* ───────── Stage & views ───────── */
.stage { position: fixed; inset: 0; overflow: hidden; }
.view { position: absolute; inset: 0; opacity: 0; transition: opacity 0.5s; }
.view.is-on { opacity: 1; }
.view[hidden] { display: none; }

/* line reveals: each line rises from behind its mask when the view arrives */
.ln { display: block; overflow: hidden; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.ln > span { display: inline-block; transform: translateY(105%); transition: transform 1s var(--out); }
.up { opacity: 0; transform: translateY(14px); transition: opacity 0.8s, transform 1s var(--out); }
.view.is-on .ln > span, .view.is-on .up { transform: none; opacity: 1; }
.view.is-on .ln:nth-child(2) > span { transition-delay: 0.06s; }
.view.is-on .ln:nth-child(3) > span { transition-delay: 0.12s; }
.view.is-on .ln:nth-child(4) > span { transition-delay: 0.18s; }
.view.is-on .ln:nth-child(5) > span { transition-delay: 0.24s; }
.view.is-on .up { transition-delay: 0.3s; }
.view.is-on .up + .up { transition-delay: 0.38s; }
.view.is-on .up + .up + .up { transition-delay: 0.46s; }
.view.is-on .up + .up + .up + .up { transition-delay: 0.54s; }
.still .view, .still .ln > span, .still .up { transition: none; }

.cap {
  position: absolute;
  right: var(--g);
  bottom: var(--g);
  z-index: 2;
  font-size: 17px;
  text-align: right;
  mix-blend-mode: difference;
}

/* ───────── Home ───────── */
.reel {
  position: absolute;
  inset: 0;
  /* opens from a small frame in the centre to the full screen */
  clip-path: inset(calc(50% - 6vw * 9 / 16) calc(50% - 6vw));
  transition: clip-path 1.6s var(--ease);
}
.reel.is-open, .still .reel { clip-path: inset(0); }
.view--home .cap { opacity: 0; transition: opacity 0.8s 1.2s; }
.view--home.is-open .cap, .still .view--home .cap { opacity: 1; }

/* ───────── Studio & Contact ───────── */
.view--studio, .view--contact, .view--portal {
  display: grid;
  align-content: end;
  gap: clamp(28px, 5vh, 64px);
  padding: var(--head) var(--g) var(--g);
}
.statement {
  font-family: var(--serif);
  font-weight: 400;
  font-size: min(6.6vw, 11vh);
  line-height: 1;
  letter-spacing: -0.02em;
}
.cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--g);
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: var(--mute);
}
.cols--portal { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols b { display: block; font-family: var(--serif); font-weight: 400; font-size: 22px; color: var(--white); margin-bottom: 4px; }

.mail {
  justify-self: start;
  font-size: clamp(22px, 2.6vw, 40px);
  border-bottom: 1px solid currentColor;
  padding-bottom: 4px;
}
.mail:hover { opacity: 0.6; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: 14px; color: var(--mute); }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot a { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }
/* details still to be filled in before the site goes live — deliberately loud */
.todo { background: #ffe14d; color: #000; padding: 0 4px; }

/* ───────── Services ─────────
   The six groups on the left; the chosen group's film behind and its prices on the right. */
.view--services {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: end; /* the names sit low, like the statements on the other views; the prices hang from the top */
  gap: clamp(24px, 4vw, 72px);
  padding: var(--head) var(--g) var(--g);
}
.films { position: absolute; inset: 0; }
.terms a { color: var(--white); text-decoration: underline; text-underline-offset: 2px; }
.films video {
  position: absolute; inset: 0;
  opacity: 0;
  filter: brightness(0.38);
  transition: opacity 0.5s;
}
.films video.is-on { opacity: 1; }
/* a soft dark wash behind the price column, so the figures stay legible over bright films */
.films::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to left, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0) 60%); }
.list {
  position: relative;
  z-index: 2;
  font-family: var(--clean);
  font-weight: 400;
  /* the longest name is ~13em; this keeps every name on one line in its column */
  font-size: min(3.5vw, 7.4vh);
  line-height: 1.08;
  white-space: nowrap;
  letter-spacing: -0.035em;
}
.list button {
  font: inherit; letter-spacing: inherit; color: inherit;
  background: none; border: 0; padding: 0; margin: 0;
  text-align: left; cursor: pointer;
}
.list .ln > span { transition: transform 1s var(--out), opacity 0.35s; }
/* unchosen names stay at 0.55 so they keep at least 4.5:1 contrast on the dimmed film (WCAG AA) */
.view--services.is-on .list .ln:not(.is-on) > span { opacity: 0.55; }
.view--services.is-on .list .ln:not(.is-on):hover > span { opacity: 0.8; }
/* the rise is staggered; the dimming when the choice changes is not */
.view--services.is-on .list .ln:nth-child(2) > span { transition-delay: 0.06s, 0s; }
.view--services.is-on .list .ln:nth-child(3) > span { transition-delay: 0.12s, 0s; }
.view--services.is-on .list .ln:nth-child(4) > span { transition-delay: 0.18s, 0s; }
.view--services.is-on .list .ln:nth-child(5) > span { transition-delay: 0.24s, 0s; }
.view--services.is-on .list .ln:nth-child(6) > span { transition-delay: 0.3s, 0s; }

.menu {
  position: relative;
  z-index: 2;
  justify-self: end;
  align-self: start;
  width: min(100%, 36rem);
  font-family: var(--clean);
  letter-spacing: -0.005em;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
}
/* one sheet at a time; the table's top stays put and the notes follow it */
.sheet:not(.is-on) { display: none; }
.sheet.is-on { animation: sheet-in 0.45s var(--out); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(6px); } }
.still .sheet.is-on { animation: none; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 16px; }
.sheet th, .sheet td {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 400;
  text-align: left;
  vertical-align: baseline;
}
.sheet td { text-align: right; white-space: nowrap; padding-left: 24px; font-variant-numeric: tabular-nums; }
.sheet thead th {
  padding-top: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
}
.sheet td { font-weight: 500; }
.sheet thead th:last-child { text-align: right; }
.sheet .lead td { font-size: 18px; }
.sheet small { display: block; max-width: 36ch; margin-top: 4px; font-size: 13px; color: var(--mute); }
.note, .terms { margin-top: 12px; font-size: 13px; line-height: 1.45; color: var(--mute); }
.terms { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; }

@media (max-width: 640px) {
  .top { gap: 12px; }
  .nav { gap: 12px; font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
  .logo { font-size: 15px; flex: none; }
  .cap { font-size: 15px; }
  .reel { clip-path: inset(calc(50% - 14vw * 9 / 16) calc(50% - 14vw)); }
  .cols, .cols--portal { grid-template-columns: 1fr; gap: 12px; }
  .statement { font-size: 9.4vw; }
  .view--services { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); align-items: start; gap: 22px; }
  .list { font-size: 6.6vw; }
  .menu { justify-self: stretch; width: auto; }
  .films::after { background: rgba(0, 0, 0, 0.45); }
  .sheet table { font-size: 14px; }
  .sheet th, .sheet td { padding: 7px 0; }
  .sheet td { padding-left: 14px; }
}

/* ───────── Loading screen ─────────
   Dark-grey wordmark → white; QUAD and CRAFT part and a window the height of the word opens
   between them (stills of the work, then the film itself); at the end the window grows out
   to the full screen and the site is there. All movement is transform / clip-path, driven
   from one animation clock in js/main.js so nothing re-lays-out mid-motion. */
.loader { display: none; }
.is-loading .loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  color: var(--white);
  pointer-events: none;
}
/* black everywhere except the window: the film below shows through the reel's clip */
.is-loading .stage { background: var(--black); }
.is-loading .reel { clip-path: inset(50% 50% 50% 50%); transition: none; }

.loader__word {
  position: relative;
  display: flex;
  font-family: var(--sans);
  font-size: min(13vw, 22vh);
  line-height: 0.74;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  white-space: nowrap;
  padding-top: 0.04em;
  color: #262624;
  transition: color 0.35s;
}
.loader.is-lit .loader__word { color: var(--white); }
.loader__half { display: flex; will-change: transform, opacity; }
.loader__ch { display: inline-block; overflow: hidden; padding: 0.06em 0; margin: -0.06em 0; }
.loader__ch > span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.9s var(--out) calc(var(--i) * 45ms);
}
.loader.is-in .loader__ch > span { transform: none; }

/* the window between the halves: same height as the word, stills of the work inside it */
.loader__win {
  position: absolute;
  top: 0;
  height: 100%;
  width: 0;
  overflow: hidden;
  will-change: left, width;
}
.loader__win img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}
.loader__win img.is-on { opacity: 1; }
.loader__win.is-clear img { opacity: 0 !important; transition: opacity 0.5s; }

.loader__plus {
  position: absolute;
  left: 50%;
  top: calc(50% + min(13vw, 22vh) * 0.62);
  transform: translateX(-50%);
  font-size: 14px;
  line-height: 1;
  color: var(--mute);
  animation: loader-blink 1s steps(2, start) infinite;
  transition: opacity 0.3s;
}
@keyframes loader-blink { to { visibility: hidden; } }

.loader.is-out .loader__plus { opacity: 0; }

/* the header row comes in once the film has the screen */
.top { transition: opacity 0.6s; }
.is-loading .top { opacity: 0; }

.still .loader__ch > span, .still .loader__word, .still .top { transition: none; }
.still .loader__plus { animation: none; }
