/*
  Kame Design Studio — static home page.
  Gallery stays one full-bleed column. Header and footer follow the
  style spec. Motion tokens live here so a later pass can retune them.

  Uni Neue is licensed to Van Escobar (EMDASH / Fontfabric commercial EULA,
  fonts/license.txt). Regular and Bold are subset WOFF2 files for this site.
*/

@font-face {
  font-family: "Uni Neue";
  src: url("../fonts/UniNeue-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Uni Neue";
  src: url("../fonts/UniNeue-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Color */
  --page: #141513;
  --paper: #edeae3;
  --ink: #141513;
  --text: #edeae3;
  --muted: #a09e97;
  --sand: #c9b896;

  /* Type. Sizes interpolate from a 390px viewport to 1440px. */
  --font: "Uni Neue", "Avenir Next", "Century Gothic", Futura, sans-serif;
  --u: calc(100vw / 320);
  --chrome: clamp(0.75px, 100vw / 320, 1.5px);
  --mark: #ffd115;
  --ui-size: clamp(11px, calc(11px + 2px * (100vw - 390px) / 1050px), 13px);
  --ui-track: 0.12em;
  --header-leading: 1;
  --footer-leading: 1.6;

  /* Space */
  --header-pad: clamp(20px, calc(20px + 12px * (100vw - 390px) / 1050px), 32px);
  --mark-h: clamp(18px, calc(18px + 10px * (100vw - 390px) / 1050px), 28px);
  --pad-x: clamp(16px, calc(16px + 80px * (100vw - 390px) / 1050px), 96px);
  --footer-pad-y: clamp(48px, calc(48px + 48px * (100vw - 390px) / 1050px), 96px);
  --image-gap: 0;

  /* Image reveal */
  --reveal-blur: 12px;
  --reveal-scale: 1.04;
  --reveal-from: 0.6;
  --reveal-duration: 900ms;
  --reveal-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --reveal-start: 15%;

  /* Film plate, centered. Letter and house lockup use the same box on first paint. */
  --film-w: min(92vw, calc(76vh * 960 / 540));
  --film-h: calc(var(--film-w) * 540 / 960);
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--text);
  overflow-x: clip;
}

body.menu-open {
  overflow: hidden;
}

body {
  font-family: var(--font);
  font-weight: 400;
  font-style: normal;
  text-rendering: optimizeLegibility;
}

img {
  border: 0;
}

.skip {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 5;
  padding: 8px 12px;
  background: var(--paper);
  color: var(--ink);
  font-size: var(--ui-size);
  letter-spacing: var(--ui-track);
  line-height: var(--header-leading);
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
  outline: 1px solid var(--sand);
  outline-offset: 2px;
}

.site-header {
  --mark-h: clamp(22px, calc(24px + (100vw - 390px) * 0.011429), 38px);
  --header-top: clamp(10px, 0.9vw, 14px);
  --header-bot: clamp(6px, 0.45vw, 8px);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  height: auto;
  padding: var(--header-top) 0 var(--header-bot);
  margin-bottom: calc(-1 * (var(--mark-h) + var(--header-top) + var(--header-bot)));
  background: transparent;
  pointer-events: none;
}

/* Landed row is about twice the film letters: 24px at 390, 36px at 1440. Gaps are the 170-unit wordmark, with K pulled 18 units toward A so the ink gap matches. */
.mark {
  position: relative;
  width: calc(var(--mark-h) * 2921.2 / 603.6);
  height: var(--mark-h);
}

.letter {
  position: absolute;
  display: block;
}

.letter-k { left: calc(0 / 2921.2 * 100%); bottom: 0; top: auto; width: calc(586 / 2921.2 * 100%); height: 100%; }
.letter-a { left: calc(786 / 2921.2 * 100%); bottom: 0; top: auto; width: calc(565.1 / 2921.2 * 100%); height: calc(580 / 603.6 * 100%); }
.letter-m { left: calc(1569.1 / 2921.2 * 100%); bottom: 0; top: auto; width: calc(567.6 / 2921.2 * 100%); height: calc(580.3 / 603.6 * 100%); }
.letter-e { left: calc(2354.7 / 2921.2 * 100%); bottom: 0; top: auto; width: calc(566.5 / 2921.2 * 100%); height: calc(565.2 / 603.6 * 100%); }

/* Black over the intro and light frames. Off-white over dark frames.
   data-tone is measured relative luminance (dark when Y < 0.18). */
.letter path {
  fill: #000000;
  transition: fill 240ms linear;
}

html[data-tone="dark"] .letter path {
  fill: #EDEAE3;
}

/* Before the flight is measured, the letters sit on the film so the first paint is the logo, not a white plate. */
@media (prefers-reduced-motion: no-preference) {
  /* The header is its own stacking context. Lift it over the white plate so the letters paint on the first frame. */
  .js:not(.is-landed) .site-header {
    z-index: 70;
  }

  .js:not(.is-landed) .letter {
    position: fixed;
    z-index: 60;
    margin: 0;
    opacity: 1;
    bottom: auto;
  }

  .js:not(.is-landed) .letter-k {
    left: calc(50vw - var(--film-w) / 2 + 440.63 / 960 * var(--film-w));
    top: calc(50vh - var(--film-h) / 2 + 244.71 / 960 * var(--film-w));
    width: calc(586 * 0.06037 / 960 * var(--film-w));
    height: calc(603.6 * 0.06037 / 960 * var(--film-w));
  }

  .js:not(.is-landed) .letter-a {
    left: calc(50vw - var(--film-w) / 2 + 485.86 / 960 * var(--film-w));
    top: calc(50vh - var(--film-h) / 2 + 245.21 / 960 * var(--film-w));
    width: calc(565.1 * 0.06037 / 960 * var(--film-w));
    height: calc(580 * 0.06037 / 960 * var(--film-w));
  }

  .js:not(.is-landed) .letter-m {
    left: calc(50vw - var(--film-w) / 2 + 440.48 / 960 * var(--film-w));
    top: calc(50vh - var(--film-h) / 2 + 290.76 / 960 * var(--film-w));
    width: calc(567.6 * 0.06037 / 960 * var(--film-w));
    height: calc(580.3 * 0.06037 / 960 * var(--film-w));
  }

  .js:not(.is-landed) .letter-e {
    left: calc(50vw - var(--film-w) / 2 + 485.82 / 960 * var(--film-w));
    top: calc(50vh - var(--film-h) / 2 + 290.9 / 960 * var(--film-w));
    width: calc(566.5 * 0.06037 / 960 * var(--film-w));
    height: calc(565.2 * 0.06037 / 960 * var(--film-w));
  }
}

.is-on-film .letter,
.is-flying .letter {
  position: fixed;
  z-index: 60;
  margin: 0;
  opacity: 1;
}

html.is-entering {
  overflow: hidden;
}

.is-landed .letter {
  opacity: 1;
}

.gallery {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 0;
  background: var(--page);
}

.frame {
  position: relative;
  margin: var(--image-gap);
  overflow: hidden;
  background: var(--tone, var(--page));
  line-height: 0;
}

.frame picture {
  display: block;
  height: 100%;
  margin: 0;
  padding: 0;
}

.frame:not(.frame--eager)::before {
  content: "";
  position: absolute;
  inset: -12%;
  background-image: var(--lqip);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  filter: blur(var(--reveal-blur));
  transform: scale(1.08);
}

.gallery img,
.gallery video {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
}

.gallery .frame {
  aspect-ratio: var(--frame, auto);
}

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

.intro {
  position: relative;
  background: var(--page);
}

.studio {
  width: 100%;
  max-width: clamp(34ch, calc(34ch + (460px - 34ch) * (100vw - 390px) / 1050px), 460px);
  margin: 0 auto;
  color: #141513;
  font-family: "Uni Neue", "Avenir Next", "Century Gothic", Futura, sans-serif;
  font-weight: 400;
  font-style: normal;
  text-align: center;
  text-transform: uppercase;
}

.studio-line {
  margin: 0;
  font-size: clamp(11px, calc(11px + 2px * (100vw - 390px) / 1050px), 13px);
  line-height: 1.7;
  letter-spacing: 0.08em;
  text-wrap: balance;
}

.studio-mail {
  display: inline-block;
  margin-top: 1.6em;
  color: #141513;
  font-size: clamp(10px, calc(10px + 2px * (100vw - 390px) / 1050px), 12px);
  line-height: 1.7;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.studio-mail:hover {
  color: var(--sand);
}

.studio-mail:focus-visible {
  outline: 1px solid var(--sand);
  outline-offset: 3px;
}

.js .studio {
  opacity: 0;
  transform: translateY(12px);
}

.js .studio.is-in {
  animation: studio-in 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes studio-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* The frame keeps its aspect. The photo is a little taller and only slides inside it. */
.gallery .frame :is(img, video) {
  position: absolute;
  top: 0;
  left: -9%;
  z-index: 1;
  display: block;
  width: 118%;
  height: 118%;
  max-width: none;
  margin: 0;
  padding: 0;
  object-fit: cover;
}

.logo-play {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: #fff url("../images/brand/hero-poster.jpg") center / var(--film-w) auto no-repeat;
  pointer-events: none;
}

.logo-poster {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--film-w);
  height: auto;
  transform: translate(-50%, -50%);
  opacity: 0;
}

/* The vector lockup is the first paint. The photographic plate sits behind it and ghosts the stroke, so it stays hidden until the film itself is playing. */
.logo-play {
  background-image: none !important;
}

.logo-film {
  position: relative;
  width: var(--film-w);
  height: auto;
  aspect-ratio: 960 / 540;
  background: transparent;
  opacity: 0;
}

.logo-film.is-playing {
  opacity: 1;
}

.logo-house {
  position: absolute;
  left: calc(50% - var(--film-w) / 2 + 419.9 / 960 * var(--film-w));
  top: calc(50% - var(--film-h) / 2 + 194.76 / 960 * var(--film-w));
  width: calc(120.74 / 960 * var(--film-w));
  height: calc(150.93 / 960 * var(--film-w));
  overflow: visible;
  pointer-events: none;
  shape-rendering: geometricPrecision;
}

.logo-house path {
  stroke-width: calc(7.2 * var(--film-w) / 960);
}

.logo-play.is-live .logo-house,
.logo-play.is-gone .logo-house {
  display: none;
}

.portal {
  position: fixed;
  inset: 0;
  z-index: 41;
  display: none;
  width: 100%;
  height: 100%;
  pointer-events: none;
  shape-rendering: geometricPrecision;
}

html.is-window .portal {
  display: block;
}

.logo-play.is-gone,
.portal.is-gone {
  display: none;
}

.site-footer {
  background: #FFFFFF;
  color: #141513;
  padding: clamp(120px, calc(120px + 80px * (100vw - 390px) / 1050px), 200px) 24px;
  font-family: "Uni Neue", "Avenir Next", "Century Gothic", Futura, sans-serif;
  font-size: var(--ui-size);
  font-weight: 400;
  font-style: normal;
  letter-spacing: var(--ui-track);
  line-height: var(--footer-leading);
  text-align: center;
  text-transform: uppercase;
}

.site-footer a,
.site-footer p {
  margin: 0;
  line-height: var(--footer-leading);
}

.site-footer a.studio-more,
.site-footer .studio-copy {
  display: block;
  width: max-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  color: var(--muted);
  text-decoration: none;
}

.site-footer a + a,
.site-footer p {
  margin-top: 0.35em;
}

.site-footer p {
  color: var(--muted);
}

.site-footer .studio-line {
  margin: 0;
  color: #141513;
  line-height: 1.7;
  letter-spacing: 0.08em;
}

.site-footer .studio-mail {
  color: #141513;
  line-height: 1.7;
  letter-spacing: 0.08em;
}

.site-footer a:hover {
  color: var(--sand);
  text-decoration: none;
}

.site-footer a:focus-visible {
  outline: 1px solid var(--sand);
  outline-offset: 2px;
}

.menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--paper);
  color: var(--ink);
  overflow: auto;
}

.menu[hidden] {
  display: none;
}

.menu-gif {
  display: block;
  width: min(calc(267 * var(--u)), 28rem);
  height: auto;
  aspect-ratio: 16 / 9;
  margin: calc(50 * var(--chrome)) auto 0;
  object-fit: cover;
  background: var(--paper);
}

.menu-copy {
  width: min(calc(225 * var(--u)), 34rem);
  max-width: 34rem;
  margin: 0 auto calc(6 * var(--chrome));
  color: var(--ink);
  font-size: clamp(13px, calc(13 * var(--chrome)), 20px);
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
}

.menu-copy p {
  margin: 0;
}

.menu-copy p + p {
  margin-top: 1em;
}

.menu-links {
  position: relative;
  width: min(calc(225 * var(--u)), 34rem);
  max-width: 34rem;
  height: calc(50 * var(--chrome));
  margin: 0 auto calc(48 * var(--chrome));
}

.menu-links a {
  position: absolute;
  top: 0;
  height: calc(50 * var(--chrome));
  color: var(--ink);
  font-size: clamp(12px, calc(12 * var(--chrome)), 18px);
  font-weight: 700;
  line-height: calc(50 * var(--chrome));
  text-decoration: none;
}

.menu-links a:hover {
  color: var(--sand);
}

.menu-links a:focus-visible {
  outline: 1px solid var(--sand);
  outline-offset: 2px;
}

.menu-links .ig {
  left: calc(-12 * var(--chrome));
}

.menu-links .em {
  left: calc(62 * var(--chrome));
}

@media (prefers-reduced-motion: reduce) {
  .gallery .frame :is(img, video) {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: none;
  }

  .frame:not(.frame--eager)::before {
    content: none;
  }

  .js.view-timeline .frame:not(.frame--eager):not(.is-settled) :is(img, video),
  .js .frame:not(.frame--eager):not(.is-settled) :is(img, video),
  .js .frame.is-settled :is(img, video),
  .js:not(.view-timeline) .frame.is-in :is(img, video) {
    opacity: 1;
    filter: none;
    transform: none;
    animation: none;
    transition: none;
  }

  .studio,
  .js .studio,
  .js .studio.is-in {
    opacity: 1;
    transform: none;
    animation: none;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  main,
  .gallery {
    display: contents;
  }

  .site-header { order: 0; }
  .frame { order: 2; width: 100%; }
  .intro { order: 3; }
  .site-footer { order: 4; }

  .portal,
  .logo-play {
    display: none;
  }

  .js.view-timeline .frame--eager {
    animation: none;
    transform: none;
    clip-path: none;
    opacity: 1;
    filter: none;
  }

  .letter,
  .js .letter,
  .is-on-film .letter,
  .is-flying .letter,
  .is-landed .letter {
    position: absolute;
    animation: none;
    transform: none;
    clip-path: none;
    opacity: 1;
  }

  .logo-play {
    display: none;
  }

}
