/*
  IMADEZ STUDIO: styles.
  Direction: "The dark room" (charcoal and sage, Zodiak with Hanken Grotesk).
  One dark ground from top to bottom; the studio's name is the lit thing in it.
  Everything references the tokens below. No gradients, no shadows, no thin rules, square corners.
*/

@font-face {
  font-family: "Zodiak"; font-weight: 100; font-style: normal; font-display: swap;
  src: url("../assets/fonts/zodiak-thin.woff2") format("woff2");
}
@font-face {
  font-family: "Zodiak"; font-weight: 300; font-style: normal; font-display: swap;
  src: url("../assets/fonts/zodiak-light.woff2") format("woff2");
}

/* ================= Tokens ================= */
:root {
  --bg: #1c1c1c;
  --surface: #262626;
  --ink: #f1f1ef;
  --muted: #a3a49f;
  --accent: #8fa68e;
  --accent-ink: #1c1c1c;
  --field: #c8c5ba;        /* the one pale section (contact) */
  --field-ink: #1c1c1c;
  --field-muted: #45443f;

  --display: "Zodiak", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --text: "Hanken Grotesk", "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --step-small: clamp(0.875rem, 0.83rem + 0.18vw, 1rem);
  --step-body: clamp(1.125rem, 1.05rem + 0.3vw, 1.3125rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-title: clamp(1.375rem, 1rem + 1.6vw, 2.25rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);

  --margin: clamp(1rem, 1.7vw, 1.5rem);
  --gutter: clamp(0.75rem, 1.4vw, 1.5rem);
  --section: clamp(5.5rem, 12vw, 12rem);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --t-press: 140ms;
  --t-hover: 180ms;
  --t-ui: 240ms;
  --t-reveal: 800ms;
}

/* ================= Base ================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--text); font-size: var(--step-body); font-weight: 400; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow-x: clip;
}
h1, h2, h3, p, ul, dl, dd, figure { margin: 0; padding: 0; }
ul { list-style: none; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3 { font-family: var(--display); font-weight: 300; letter-spacing: -0.01em; line-height: 1; text-wrap: balance; }
p { text-wrap: pretty; }
main:focus { outline: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }
::selection { background: var(--ink); color: var(--bg); }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--margin); top: 0; z-index: 20;
  padding: 0.75rem 1rem; background: var(--ink); color: var(--bg); font-weight: 500;
  transform: translateY(-120%);
}
.skip-link:focus { transform: none; }
.note { font-size: var(--step-small); line-height: 1.4; color: var(--muted); }

/* one link manner and one button shape for the whole page */
.link {
  text-decoration: underline; text-decoration-thickness: 0.06em; text-underline-offset: 0.22em;
  text-decoration-color: var(--muted);
  transition: text-decoration-color var(--t-hover) ease, color var(--t-hover) ease;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0.5rem 1.6rem;
  background: var(--accent); color: var(--accent-ink);
  font-size: max(var(--step-body), 1.25rem); font-weight: 500; line-height: 1.1; text-decoration: none; text-align: center; border-radius: 0;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease;
}
.btn:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: #a9bea8; }
  .link:hover { text-decoration-color: currentColor; }
}

/* ================= Hero: the name is the lit thing ================= */
.hero {
  min-height: 100vh; /* taste-skill-ignore: fallback for browsers without svh */
  min-height: 100svh;
  display: grid; grid-template-rows: auto 1fr auto auto; row-gap: clamp(1rem, 2.5vh, 1.75rem);
  padding: var(--margin) var(--margin) 0;
  overflow: clip;
}
.bar { display: flex; justify-content: flex-end; }
.bar__brand, .bar__toggle, .contact__cta { display: none; }   /* phones only: see the Phones block at the end */
.btn--ink { background: var(--field-ink); color: var(--field); }
.hero__nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.25rem clamp(1rem, 2.4vw, 2.25rem); font-size: var(--step-small); }
.hero__nav a { padding-block: 0.6rem; }
.hero__top { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: start; }
.hero__say {
  grid-column: 1 / -1; max-width: 27ch;
  font-family: var(--display); font-weight: 300; font-size: clamp(1.5rem, 1rem + 2.4vw, 3.25rem); line-height: 1.1; letter-spacing: -0.01em;
}
.hero__strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; }
.hero__strip p { max-width: 36ch; margin-right: auto; }
.hero__name {
  font-weight: 100; font-size: min(var(--fit, 21vw), 46vh); line-height: 0.85; letter-spacing: -0.02em;
  white-space: nowrap; text-transform: uppercase; transform-origin: 0 100%;
  padding-bottom: 0.06em;
}
.hero__name > span:first-child { display: inline-block; }

@media (max-width: 767px) {
  .hero__nav { justify-content: space-between; }
  .hero__top { align-items: end; }   /* the sentence sits with the action and the name, not alone at the top */
  .hero__say { font-size: clamp(1.75rem, 1rem + 4vw, 2.25rem); }
  .hero__strip .btn { width: 100%; }
}

/* ================= Genres: what the studio builds, at poster scale ================= */
.build { padding: clamp(4rem, 12vh, 8rem) var(--margin) clamp(5rem, 16vh, 11rem); display: grid; row-gap: 0.35em; font-size: var(--step-head); }
.build__line { font-size: var(--step-head); line-height: 1; }
.build__line--head { color: var(--muted); }
.build__row { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); column-gap: var(--gutter); align-items: first baseline; }
.build__row p { font-size: var(--step-body); line-height: 1.45; max-width: 34ch; }
.build__row .build__line { transition: color var(--t-ui) ease; }
@media (hover: hover) and (pointer: fine) {
  .build:hover .build__row:not(:hover) .build__line { color: var(--muted); }
}
@media (max-width: 899px) {
  .build { row-gap: 1.75rem; }
  .build__row { grid-template-columns: minmax(0, 1fr); row-gap: 0.5rem; }
  .build__row p { padding-left: var(--margin); }
}

/* ================= Services: statement, list pushed right, the email that writes itself ================= */
.work { padding: var(--section) var(--margin); }
.work__head { font-size: var(--step-head); line-height: 0.98; max-width: 16ch; text-indent: 3vw; }
.work__grid { margin-top: clamp(3rem, 6.5vw, 6rem); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: end; }
.enquiry { grid-column: 1 / 6; grid-row: 1; display: grid; gap: 1rem; justify-items: start; position: sticky; bottom: 2rem; }
.enquiry__lead { max-width: 30ch; }
.enquiry__hint, .enquiry__summary { display: none; }
.enquiry__hint { color: var(--muted); }
.enquiry__summary { font-family: var(--display); font-weight: 300; font-size: var(--step-lead); line-height: 1.2; max-width: 24ch; min-height: 2.4em; }
.js .enquiry__hint, .js .enquiry__summary { display: block; }
.work__list { grid-column: 8 / -1; grid-row: 1; display: grid; gap: 2.25rem; }
.work__list li { display: grid; gap: 0.5rem; justify-items: start; }
.work__list h3 { font-size: var(--step-title); line-height: 1.05; }
.work__list p { max-width: 44ch; }
.pick { display: none; position: relative; align-items: center; min-height: 44px; cursor: pointer; color: var(--muted); transition: color var(--t-hover) ease; }
.js .pick { display: inline-flex; }
.pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pick span::before {
  content: ""; display: inline-block; width: 1.15rem; height: 1.15rem; margin-right: 0.7rem; vertical-align: -0.2rem;
  border: 2px solid var(--muted); /* a real form control keeps its edge */
  transition: background-color var(--t-hover) ease, border-color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.pick input:checked + span { color: var(--ink); }
.pick input:checked + span::before { background: var(--accent); border-color: var(--accent); transform: scale(1.1); }
.pick input:focus-visible + span { outline: 3px solid currentColor; outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .pick:hover { color: var(--ink); } }
@media (max-width: 899px) {
  .work__head { text-indent: 0; }
  .work__grid { row-gap: 3rem; }
  .enquiry, .work__list { grid-column: 1 / -1; }
  .enquiry { position: static; grid-row: 2; }
  .work__list { grid-row: 1; }
  .enquiry .btn { width: 100%; }
}
@media (max-height: 620px) { .enquiry { position: static; } }

/* ================= Games: the studio's products, one card per game ================= */
.games { padding: 0 var(--margin) var(--section); }
.games__head { display: grid; gap: 1rem; margin-bottom: clamp(2.5rem, 5vw, 4.5rem); }
.games__head h2 { font-size: var(--step-head); }
.games__head p { color: var(--muted); }
.games__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: clamp(2.5rem, 4vw, 3.5rem) var(--gutter); align-items: start; }
.games__list { display: contents; }
.card { position: relative; display: grid; gap: 0.5rem; align-content: start; justify-items: start; }
.card__pic { width: 100%; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface); margin-bottom: 0.5rem; }
.card__pic img { width: 100%; height: 100%; object-fit: cover; object-position: 58% 50%; transition: transform 900ms var(--ease-soft); }
.card h3 { font-size: var(--step-title); line-height: 1.05; }
.card__open { min-height: 44px; }
.card__open::after { content: ""; position: absolute; inset: 0; }   /* the whole card opens the details */
@media (hover: hover) and (pointer: fine) {
  .card:hover .card__pic img { transform: scale(1.04); }
  .card:hover .card__open { text-decoration-color: currentColor; }
}
/* while there is one game, its card takes two columns */
@media (min-width: 48rem) {
  .card:only-child { grid-column: span 2; }
  .card:only-child h3 { font-size: var(--step-head); }
}
.games__note { aspect-ratio: 16 / 10; display: flex; align-items: flex-end; padding: 1rem; background: var(--surface); color: var(--muted); }

/* ================= Game details: the dialog a card opens ================= */
.sheet {
  width: min(94vw, 72rem); max-width: none; max-height: 90vh; max-height: 90svh;
  padding: 0; border: 0; background: var(--bg); color: var(--ink); overflow: auto;
}
.sheet::backdrop { background: rgb(10 10 10 / 0.92); }
.sheet__bar { position: sticky; top: 0; z-index: 1; height: 0; display: flex; justify-content: flex-end; }
.game { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 3vw, 2.5rem) clamp(1.5rem, 4vw, 4rem); padding-bottom: clamp(2rem, 4vw, 3rem); }
.game__visual { grid-column: 1 / -1; aspect-ratio: 21 / 9; overflow: hidden; background: var(--surface); }
.game__visual img { width: 100%; height: 100%; object-fit: cover; object-position: 55% 50%; }
.game__text { display: grid; gap: 1.1rem; align-content: start; padding-left: clamp(1rem, 3vw, 2.5rem); }
.game__text h2 { font-size: var(--step-head); }
.game__meta { color: var(--muted); font-size: var(--step-small); line-height: 1.4; }
.game__tagline { font-family: var(--display); font-weight: 300; font-size: var(--step-lead); line-height: 1.2; }
.game__links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.game__links .link { min-height: 44px; display: inline-flex; align-items: center; }
.game__text dl { display: grid; gap: 0.8rem; }
.game__text dt { font-weight: 500; }
.game__text dd { color: var(--muted); }
.game__media { display: grid; gap: 0.75rem; align-content: start; padding-right: clamp(1rem, 3vw, 2.5rem); }
.game__clip { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface); }
.game__stills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; margin-top: 0.5rem; }
.game__stills img { width: 100%; height: auto; aspect-ratio: 813 / 720; object-fit: cover; background: var(--surface); }
@media (max-width: 767px) {
  .game { grid-template-columns: minmax(0, 1fr); }
  .game__visual { aspect-ratio: 16 / 10; }
  .game__text, .game__media { padding-inline: 1rem; }
}

/* ================= Stats (hidden until real values exist) ================= */
.stats { padding: 0 var(--margin) var(--section); }
.stats h2 { font-size: var(--step-head); }
.stats__list { margin-top: 3rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 2rem var(--gutter); }
.stat { display: flex; flex-direction: column-reverse; }
.stat dd { font-family: var(--display); font-weight: 100; font-size: var(--step-head); line-height: 1; font-variant-numeric: tabular-nums; }
.stat dt { margin-top: 0.5rem; color: var(--muted); }

/* ================= Contact: the address as display type, on the one pale field ================= */
.contact {
  background: var(--field); color: var(--field-ink);
  min-height: 100vh; /* taste-skill-ignore: fallback for browsers without svh */
  min-height: 100svh;
  display: grid; grid-template-rows: auto 1fr auto; row-gap: 2rem;
  padding: clamp(1.5rem, 3vw, 2.5rem) var(--margin) clamp(1.25rem, 2vw, 1.75rem);
  overflow: clip;
}
.contact__say { font-size: var(--step-lead); line-height: 1.3; max-width: 26ch; }
.contact__address { align-self: end; }
.contact__email {
  display: inline-block; font-family: var(--display); font-weight: 100; font-size: var(--fit, 6.6vw); line-height: 1; letter-spacing: -0.02em;
  white-space: nowrap; text-decoration: none; transition: color var(--t-hover) ease;
}
.contact__foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 2rem; min-height: 44px; }
.contact__foot .link { text-decoration-color: var(--field-muted); min-height: 44px; display: inline-flex; align-items: center; }
.contact__socials { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-left: auto; }
@media (hover: hover) and (pointer: fine) { .contact__email:hover { color: #3d5a3c; } }
@media (max-width: 767px) {
  .contact { min-height: 86vh; min-height: 86svh; }
  .contact__address { align-self: center; }
  .contact__email { font-size: var(--fit, 10.4vw); white-space: normal; }
  .contact__email span { display: block; white-space: nowrap; }
}

/* ================= Footer: columns above, the name below ================= */
.footer {
  min-height: 72vh; min-height: 72svh;
  display: grid; grid-template-rows: auto 1fr auto auto; row-gap: 1rem;
  padding: 2.5rem var(--margin) 1.25rem; overflow: clip;
}
.footer__cols { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: 2rem; font-size: var(--step-small); }
.footer__cols > * { grid-column: span 3; display: grid; gap: 0.35rem; align-content: start; justify-items: start; }
.footer__cols a { padding-block: 0.3rem; }
.footer__name {
  grid-row: 3; font-family: var(--display); font-weight: 100; font-size: var(--fit, 21vw); line-height: 0.85; letter-spacing: -0.02em;
  white-space: nowrap; text-transform: uppercase; transform-origin: 0 100%; padding-top: 0.08em;
}
.footer__name span { display: inline-block; }
.footer__legal { grid-row: 4; }
@media (max-width: 767px) {
  .footer__cols > * { grid-column: span 6; }
  .footer__cols > :nth-child(n + 3) { grid-column: 1 / -1; }
  .footer__cols a { padding-block: 0.6rem; overflow-wrap: anywhere; }
}

/* ================= Video dialog ================= */
.player {
  width: min(92vw, 150vh); max-width: none; max-height: none;
  padding: 0; border: 0; background: var(--bg); color: var(--ink); overflow: visible;
}
.player.is-portrait { width: min(92vw, 50vh); }
.player::backdrop { background: rgb(10 10 10 / 0.92); }
.player video { width: 100%; max-height: 80vh; background: #000; }
.player__close { position: absolute; right: 0; bottom: 100%; min-height: 44px; }
.player[open], .sheet[open] { animation: dialog-in var(--t-ui) var(--ease-out); }
@keyframes dialog-in { from { opacity: 0; transform: scale(0.97); } }

/* ================= Motion. Hidden states only apply under html.js (set inline in <head>) ================= */
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes name-up { from { transform: translateY(102%); } }
@media (prefers-reduced-motion: no-preference) {
  .js [data-rise] {
    opacity: 0; transform: translateY(18px);
    animation: rise var(--t-reveal) var(--ease-out) forwards;
    animation-delay: calc(var(--i, 0) * 110ms + 350ms);
  }
  /* the name rises out of the bottom edge of the first screen */
  .js .hero__name > span:first-child { animation: name-up 1100ms var(--ease-out) both; }

  .js [data-reveal] {
    opacity: 0; transform: translateY(24px);
    transition: opacity 700ms var(--ease-out), transform 900ms var(--ease-out);
    transition-delay: calc(var(--i, 0) * 80ms);
  }
  .js [data-reveal].is-in { opacity: 1; transform: none; }

  /* the address rises part by part */
  .js .contact__email span { display: inline-block; opacity: 0; transform: translateY(40%); transition: opacity 700ms var(--ease-out), transform 1000ms var(--ease-out); }
  .js .contact__email span + span { transition-delay: 120ms; }
  .js .contact.is-in .contact__email span { opacity: 1; transform: none; }
}
@media (max-width: 767px) and (prefers-reduced-motion: no-preference) {
  .js .contact__email span { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .player[open], .sheet[open] { animation: none; }
}

/* ================= Phones and upright tablets: a fixed bar with a menu, tighter sections, full-width actions =================
   Also used by upright tablets. Kept together and last so it wins over the section rules above. */
@media (max-width: 899px) {
  :root { --bar: 3.5rem; --section: 4rem; }
  section { scroll-margin-top: calc(var(--bar) + 1rem); }

  /* the bar and its full-screen menu (only with JavaScript; without it the links stay a plain row) */
  .js .bar {
    position: fixed; inset: 0 0 auto 0; z-index: 10; height: var(--bar);
    align-items: center; justify-content: space-between; padding: 0 var(--margin); background: var(--bg);
  }
  .js .bar__brand {
    display: inline-flex; align-items: center; min-height: 44px;
    font-family: var(--display); font-weight: 300; font-size: 1.375rem; letter-spacing: 0.06em; text-decoration: none;
    opacity: 0; visibility: hidden; transition: opacity var(--t-ui) ease, visibility var(--t-ui);
  }
  .js .bar.is-past .bar__brand, .js .bar.is-open .bar__brand { opacity: 1; visibility: visible; }
  .js .bar__toggle {
    display: inline-flex; align-items: center; justify-content: flex-end; min-width: 44px; min-height: 44px; margin-left: auto;
    font-size: 1rem; font-weight: 500;
  }
  .js .hero__nav {
    position: fixed; inset: var(--bar) 0 0 0; z-index: 10;
    flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; gap: 0;
    padding: 1.5rem var(--margin) 2rem; background: var(--bg); overflow: auto;
    opacity: 0; visibility: hidden; transition: opacity var(--t-ui) ease, visibility var(--t-ui);
  }
  .js .bar.is-open .hero__nav { opacity: 1; visibility: visible; }
  .js .hero__nav a { padding-block: 0.85rem; font-family: var(--display); font-weight: 300; font-size: 2.25rem; line-height: 1.1; text-decoration: none; }
  .menu-open { overflow: hidden; }

  /* hero: as tall as its content, so the next section shows below it */
  .hero { min-height: 0; grid-template-rows: none; row-gap: 1.25rem; }
  .js .hero { padding-top: calc(var(--bar) + clamp(2.5rem, 9vh, 5rem)); }
  .hero__name { margin-top: 1rem; }

  /* what we build */
  .build { padding-block: var(--section); row-gap: 2rem; }
  .build__line--head { font-size: var(--step-title); }
  .build__row p { padding-left: 0; max-width: none; color: var(--muted); }

  /* services: one tile each */
  .work { padding-block: 0 var(--section); }
  .work__grid { margin-top: 2rem; row-gap: 2rem; }
  .work__list { gap: 0.75rem; }
  .work__list li { padding: 1.25rem; background: var(--surface); justify-items: stretch; }
  .js .work__list li { padding-bottom: 0.4rem; }
  .work__list p { max-width: none; }
  .pick { min-height: 48px; }

  /* games */
  .games__head { margin-bottom: 2rem; }
  .games__grid { row-gap: 1.75rem; }
  .card__open {
    display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; margin-top: 0.5rem;
    background: var(--surface); font-weight: 500; text-decoration: none;
  }
  .games__note { grid-column: 1 / -1; aspect-ratio: auto; padding: 1.25rem; }

  /* contact: the address, then two full-width actions */
  .contact { min-height: 0; grid-template-rows: none; row-gap: 1.5rem; padding-block: var(--section) 2.5rem; }
  .contact__address { align-self: auto; margin-block: 0.5rem; }
  .contact__foot { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  .contact__cta { display: inline-flex; }
  .contact__foot button.link { justify-content: center; min-height: 52px; border: 2px solid var(--field-ink); font-weight: 500; text-decoration: none; }
  .contact__socials { margin-left: 0; }

  /* footer */
  .footer { min-height: 0; grid-template-rows: none; row-gap: 2rem; }
  .footer__name, .footer__legal { grid-row: auto; }
  .footer__cols { row-gap: 1rem; }
  .footer__cols > * { grid-column: span 6; gap: 0; }
  .footer__cols a { display: inline-flex; align-items: center; min-height: 44px; padding-block: 0; }

  /* game details fill the screen */
  .sheet { width: 100vw; height: 100vh; height: 100dvh; max-height: none; margin: 0; }
}
@media (hover: hover) and (pointer: fine) { .btn--ink:hover { background: #3a3a37; } }
