/* House of Small Infinities
   Desktop design frame: 1728 × 1117   Mobile design frame (≤500px): 402 × 700 */

/* Licensed web fonts: web formats only (woff2/woff), never desktop .otf/.ttf */
@font-face {
  font-family: "Romie";
  src: url("../fonts/Romie-Regular.woff2") format("woff2"),
       url("../fonts/Romie-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Panama Mono";
  src: url("../fonts/PanamaMono-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #000;          /* HoSI_Black / active button */
  --hover: #666;        /* hover state */
  --bg: #fff;
  --pad: 20px;          /* nav padding */

  /* Design frame: everything in the contact block scales from this unit,
     locked to the frame's aspect ratio, so lines never reflow. */
  --frame-w: 1728;
  --frame-h: 1117;
  --u: min(calc(100vw / var(--frame-w)), calc(100svh / var(--frame-h)));

  --video-ar: 1 / 1;      /* Vimeo video is 3000 × 3000 */
}

@media (max-width: 500px) {
  :root {
    --frame-w: 402;
    --frame-h: 700;
    --video-ar: 1 / 1;
  }
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ---------- Navigation (top right; CONTACT rolls into X) ---------- */

.nav {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10;
  display: grid;
}
.nav-btn {
  grid-area: 1 / 1;
  justify-self: end;
  margin: 0;
  padding: var(--pad);
  border: 0;
  background: none;
  color: var(--ink);
  font: 700 16px/1.6 "Panama Mono", ui-monospace, monospace;  /* 14px on mobile */
  letter-spacing: 0.1em;
  text-box: trim-both cap alphabetic;
  cursor: pointer;
  transition: color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.nav-word {
  position: relative;
  display: inline-block;
  perspective: 6em;            /* depth of the rolling drum */
}
.nav-word .ch {
  display: inline-block;
  transform-origin: 50% 50% -0.6em;   /* letters turn round a drum just behind them */
  backface-visibility: hidden;
}
.nav-word .ch-x {
  position: absolute;
  top: 0;
  right: 0;                    /* sits exactly where the last T is */
  opacity: 0;
  transform: rotateX(-90deg);  /* waiting below, ready to roll up into place */
}
@media (hover: hover) {
  .nav-btn:hover { color: var(--hover); }
}
.nav-btn:focus-visible { color: var(--hover); outline: 1px solid var(--hover); outline-offset: -6px; }

/* ---------- Stage ---------- */

.stage {
  position: fixed;
  inset: 0;
}

/* ---------- Home: video, sized by the viewport's longest edge ---------- */

.home {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform-origin: 50% 50%;
}
/* Centred on the viewport; overflows equally on both sides of the short edge */
.video {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  aspect-ratio: var(--video-ar);
}
@media (orientation: landscape) {
  .video { width: 100vw; height: auto; }
}
@media (orientation: portrait) {
  .video { height: 100svh; width: auto; }
}
.video iframe,
.video img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  pointer-events: none;
}
.video img { object-fit: contain; }

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

.contact {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;   /* text block sits in the middle of the viewport */
  visibility: hidden;
  pointer-events: none;
}
body[data-state="contact"] .contact,
body[data-state="opening"] .contact,
body[data-state="closing"] .contact {
  visibility: visible;
}
body[data-state="contact"] .contact { pointer-events: auto; }

.contact-block {
  margin: 0;
  font-style: normal;
  font-family: "Romie", "Times New Roman", serif;
  font-weight: 400;
  font-size: calc(130 * var(--u));   /* 130px at 1728 × 1117 */
  letter-spacing: 0.04em;            /* 5.2px at 130px */
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-box: trim-both cap alphabetic;  /* centre on cap height, like Figma */
  position: relative;
  top: calc(-50 * var(--u));           /* sits 50px above centre at design size */
}
.contact-block--mob { display: none; }

.contact-block .group {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.contact-block .group + .group { margin-top: 0.4em; }  /* 52px at 130px */

.contact-block .line {
  display: block;
  line-height: 0.9923;   /* 129px line step at 130px */
  will-change: transform, opacity;
}
.contact-block a.group { transition: color 0.15s ease; }
@media (hover: hover) {
  .contact-block a.group:hover { color: var(--hover); }
}
.contact-block a.group:focus-visible { outline: 1px solid var(--hover); outline-offset: 0.1em; }

.contact-block .label {
  font-family: "Panama Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.1385em;     /* 18px at 130px */
  letter-spacing: 0.1em;
  margin-right: 1.111em;   /* 20px at 18px */
  vertical-align: baseline;
}

/* Lines start hidden; JS animates them in */
.contact .line { opacity: 0; }

@media (max-width: 500px) {
  .nav-btn { font-size: 14px; }
  .contact-block {
    font-size: calc(40 * var(--u));  /* 40px at 402 × 700 */
    top: calc(-20 * var(--u));       /* 20px above centre at design size */
  }
  .contact-block--desk { display: none; }
  .contact-block--mob { display: flex; }
  .contact-block .group + .group { margin-top: 0.45em; }  /* 18px at 40px */
  .contact-block .line { line-height: 1; }
  .contact-block .label {
    font-size: 0.3em;        /* 12px at 40px */
    margin-right: 0.4167em;  /* 5px at 12px */
  }
}
