:root {
  --paper: #ffffff;
  --ink: #21201f;
  --button: #000000;
  --button-text: #ffffff;
  --page-pad-x: clamp(0.625rem, 3vw, 1.5rem);
  --page-pad-y: clamp(0.5rem, 1vh, 1.25rem);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

@font-face {
  font-family: "Soderhof Display";
  src: url("./assets/Shango-Regular.otf") format("opentype"),
    local("Shango"), local("Shango Regular");
  font-display: swap;
}

@font-face {
  font-family: "Soderhof Mono";
  src: url("./assets/XanhMono-Regular.ttf") format("truetype"),
    local("Xanh Mono"), local("XanhMono-Regular");
  font-display: swap;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  height: 100%;
  background: var(--paper);
  overflow-x: hidden;
}

body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Soderhof Mono", "Courier New", monospace;
  perspective: 900px;
  perspective-origin: 50% 58%;
  overflow-x: hidden;
  transition: background-color 900ms ease, color 900ms ease;
}

body.is-after-hours {
  --paper: #050505;
  --ink: #f7f7f2;
  --button: #f7f7f2;
  --button-text: #050505;
}

button,
textarea {
  font: inherit;
}

.landing {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 100vh;
  min-height: 100svh;
  width: min(100%, 45rem);
  margin: 0 auto;
  padding: var(--page-pad-y) var(--page-pad-x) 0.9375rem;
  text-align: center;
  text-transform: uppercase;
  transform-origin: center center;
}

.landing.is-revealing {
  transform: none !important;
  filter: none !important;
  transform-style: flat;
  will-change: opacity;
}

.brand {
  width: clamp(12.25rem, 52vw, 18rem);
  height: clamp(2.416rem, 10.25vw, 3.55rem);
  transform-origin: center;
}

.brand img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  transition: filter 900ms ease;
}

body.is-after-hours .brand img {
  filter: invert(1);
}

.soon {
  margin: 0;
  font-size: clamp(1rem, 4.6vw, 1.25rem);
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.soon,
.message,
.address,
.wish-form {
  transform-origin: center;
}

.message {
  width: 100%;
}

.message h1 {
  margin: 0;
  color: var(--ink);
  font-family: "Soderhof Display", "Times New Roman", serif;
  font-size: clamp(1.82rem, 8.2vw, 4.75rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: 0;
  text-wrap: balance;
}

.message span {
  display: block;
}

.message .letter {
  display: inline-block;
  min-width: 0.18em;
  transform-origin: 50% 100%;
}

.message .letter:not(.is-fallen) {
  cursor: pointer;
}

.message .letter.is-fallen {
  visibility: hidden;
  pointer-events: none;
}

.message .letter:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 0.08em;
}

.fallen-letter-pile {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  transform-origin: 50% 76%;
  transform-style: preserve-3d;
  will-change: transform, opacity, filter;
}

.fallen-letter {
  position: fixed;
  left: 0;
  top: 0;
  color: var(--ink);
  font-family: "Soderhof Display", "Times New Roman", serif;
  font-size: clamp(1.82rem, 8.2vw, 4.75rem);
  font-weight: 400;
  line-height: 0.92;
  text-transform: uppercase;
  transform-origin: 50% 100%;
  will-change: transform;
}

.video-takeover {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  padding: 0;
  overflow: hidden;
  background: #050505;
  color: #f7f7f2;
  opacity: 0;
  pointer-events: none;
}

.video-takeover.is-visible {
  pointer-events: none;
}

.video-frame {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  min-height: -webkit-fill-available;
  background: #050505;
}

.video-frame video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  min-height: -webkit-fill-available;
  object-fit: cover;
  object-position: center center;
  background: #050505;
}

.video-missing {
  margin: 0;
  font-size: clamp(0.94rem, 4vw, 1.125rem);
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.page-curtain {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: var(--paper);
  opacity: 0;
  visibility: hidden;
  transition: visibility 0s linear 720ms;
}

.page-curtain.is-active {
  visibility: visible;
  transition: visibility 0s;
}

.landing-sheet-capture-host {
  position: fixed;
  left: -120vw;
  top: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  opacity: 1;
}

.three-reset-scene {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
  background: transparent;
}

.crumple-thank-you {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0 clamp(1rem, 6vw, 2rem);
  font-family: "Soderhof Mono", "Xanh Mono", "XanhMono-Regular", "Courier New", monospace;
  font-size: clamp(1rem, 4.6vw, 1.25rem);
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
}

.three-reset-scene canvas {
  display: block;
  width: 100%;
  height: 100%;
  transition: filter 180ms ease;
}

.three-reset-scene.is-motion-blur canvas {
  filter: blur(2.5px);
}

.landing.is-css-crumpling {
  will-change: transform, opacity, filter;
}

.address {
  display: flex;
  flex-direction: column;
  margin: 0;
  font-size: clamp(1rem, 4.45vw, 1.2rem);
  font-style: normal;
  line-height: 0.92;
  letter-spacing: 0;
  white-space: nowrap;
}

.wish-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  justify-content: center;
  gap: 0 0.55rem;
  width: min(100%, 18rem);
  min-width: 0;
  font-size: clamp(0.94rem, 4.2vw, 1.125rem);
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.wish-form.is-sent {
  justify-items: center;
}

.wish-form label {
  grid-column: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.field-shell {
  position: relative;
  width: 100%;
  min-width: 0;
}

.wish-form textarea {
  display: block;
  appearance: none;
  width: 100%;
  min-width: 0;
  max-height: min(9rem, 26vh);
  min-height: 1.1em;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  caret-color: var(--ink);
  line-height: 1;
  outline: 0;
  overflow-x: hidden;
  overflow-y: auto;
  resize: none;
  text-align: left;
  text-transform: uppercase;
  transition: opacity 160ms ease;
}

.wish-form textarea::placeholder {
  color: currentColor;
  opacity: 0.74;
}

.wish-form:focus-within textarea::placeholder {
  opacity: 0.42;
}

.field-line {
  position: absolute;
  right: 0;
  bottom: -0.08rem;
  left: 0;
  height: 1px;
  background: currentColor;
  opacity: 0.92;
  transform: scaleX(0.96);
  transform-origin: center;
}

.wish-form button {
  border: 0;
  border-radius: 0;
  padding: 0.14rem 0.22rem 0.05rem;
  background: var(--button);
  color: var(--button-text);
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.wish-form button:hover,
.wish-form button:focus-visible {
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px currentColor;
  transform: translateY(-1px);
}

.wish-form button:focus-visible {
  outline: 1px solid var(--ink);
}

.form-status {
  grid-column: 1 / -1;
  display: none;
  margin: 0;
  line-height: 1;
}

.wish-form.is-sending button {
  cursor: wait;
  opacity: 0.7;
}

.wish-form.is-sent label,
.wish-form.is-sent .field-shell,
.wish-form.is-sent button {
  display: none;
}

.wish-form.is-sent .form-status,
.wish-form.has-error .form-status {
  display: block;
}

.wish-form.has-error .form-status {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

@media (min-width: 46rem) {
  .landing {
    width: min(100%, 68rem);
    padding-bottom: 1.5rem;
  }

  .address {
    margin-bottom: clamp(4rem, 10vh, 6rem);
  }
}

@media (max-width: 40rem) {
  html {
    width: 100vw;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .landing {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100svh;
    margin: 0;
    min-height: 0;
    overflow: hidden;
    padding: max(0.75rem, calc(var(--safe-top) + 0.5rem))
      max(var(--page-pad-x), calc(var(--safe-right) + 0.625rem))
      max(0.875rem, calc(var(--safe-bottom) + 0.5rem))
      max(var(--page-pad-x), calc(var(--safe-left) + 0.625rem));
  }

  .brand {
    width: clamp(11rem, 48vw, 16rem);
    height: clamp(2.17rem, 9.45vw, 3.16rem);
  }

  .soon,
  .address {
    font-size: clamp(0.875rem, 3.9vw, 1.05rem);
  }

  .wish-form {
    font-size: 1rem;
  }

  .wish-form textarea,
  .wish-form button {
    font-size: 1rem;
    touch-action: manipulation;
  }

  .message h1 {
    font-size: clamp(1.55rem, 7.25vw, 2.9rem);
    line-height: 0.9;
  }

  .wish-form textarea {
    max-height: min(6rem, 18svh);
  }

  .video-frame {
    width: 100vw;
    height: 100vh;
    height: 100lvh;
  }
}

@media (max-width: 23rem) {
  .message h1 {
    font-size: clamp(1.55rem, 8vw, 1.82rem);
  }

  .wish-form {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 0.45rem;
    font-size: 1rem;
  }

  .wish-form:focus-within {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}
