@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Lato";
  src: url("/fonts/lato-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Official palette, sampled from the GS logo. Night is derived from its blue. */
:root {
  --gs-blue: #085cb0;
  --ice: #7db8f2;
  --gold-700: #986a2d;
  --gold-500: #b68a47;
  --gold-300: #d5af5a;
  --gold-100: #f4dd8c;
  --cream: #f7efd8;
  --night: #06182e;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  background: var(--night);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--cream);
  font-family: "Lato", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html.intro,
html.intro body {
  overflow: hidden;
}

/* Layers, bottom to top: golden air, the page, the flood of light, the ice. */
.air,
.flood,
.fx {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.air {
  z-index: 0;
  pointer-events: none;
}

.flood {
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(
    circle at var(--x, 50%) var(--y, 50%),
    #fffbe8,
    var(--gold-100) 28%,
    var(--gold-300) 58%,
    var(--gold-700)
  );
}

.fx {
  z-index: 10;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.air[hidden],
.flood[hidden],
.fx[hidden] {
  display: none;
}

.final {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  justify-content: space-between;
  gap: min(3svh, 24px);
  padding:
    max(24px, env(safe-area-inset-top))
    max(clamp(20px, 3vw, 48px), env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(clamp(20px, 3vw, 48px), env(safe-area-inset-left));
}

html.intro .final {
  visibility: hidden;
}

/* Failsafe: if main.js never starts, the message still shows after a moment. */
html.js:not(.revealed):not(.intro) .final {
  visibility: hidden;
  animation: failsafe 1ms 2.5s forwards;
}

@keyframes failsafe {
  to {
    visibility: visible;
  }
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.lang {
  display: flex;
  flex-shrink: 0;
  padding: 3px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgb(213 175 90 / 0.45);
}

.lang[hidden] {
  display: none;
}

.lang button {
  min-width: 44px;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--cream);
  cursor: pointer;
  font: inherit;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  transition:
    background-color 160ms ease-out,
    color 160ms ease-out,
    transform 100ms ease-out;
}

.lang button:hover {
  color: var(--gold-100);
}

.lang button[aria-pressed="true"] {
  background: var(--gold-300);
  color: var(--night);
}

.lang button:active {
  transform: scale(0.97);
}

.logo {
  display: block;
  width: auto;
  height: clamp(72px, 17svh, 150px);
  max-width: 100%;
}

.headline {
  margin: 0;
  font-family: "Instrument Serif", "Times New Roman", serif;
  font-size: min(19.4vw, 33svh);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 0.92;
}

.headline .line {
  display: block;
}

.headline em {
  color: var(--gold-300);
  font-style: italic;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px clamp(16px, 2.4vw, 36px);
}

.soon {
  margin: 0;
  color: var(--gold-100);
  font-size: 0.8125rem;
  letter-spacing: 0.32em;
  line-height: 44px;
  text-transform: uppercase;
  white-space: nowrap;
}

.links {
  display: flex;
  gap: 8px;
}

.links a {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(213 175 90 / 0.45);
  color: var(--cream);
  transition:
    background-color 160ms ease-out,
    color 160ms ease-out,
    transform 100ms ease-out;
}

.links a:hover {
  background: rgb(213 175 90 / 0.16);
  color: var(--gold-100);
}

.links a:active {
  transform: scale(0.95);
}

.links svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.controls {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.controls button {
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: rgb(247 239 216 / 0.72);
  cursor: pointer;
  font: inherit;
  font-size: 0.8125rem;
  transition:
    color 140ms ease-out,
    transform 100ms ease-out;
}

.controls button:hover {
  color: var(--gold-100);
}

.controls button:active {
  transform: scale(0.97);
}

.controls button[hidden] {
  display: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--gold-100);
  outline-offset: 2px;
}

/* The page emerges as the flood of light dies down. */
html.revealed .final > * {
  animation: arrive 1100ms var(--ease-out) both;
  animation-delay: calc(620ms + var(--order, 0) * 130ms);
}

.top {
  --order: 0;
}

.headline {
  --order: 1;
}

.foot {
  --order: 2;
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Phones: three lines, as large as the width allows. */
@media (max-aspect-ratio: 1/1) {
  .headline {
    font-size: min(24.5vw, 16svh);
  }

  /* "Nothing will" is longer than "Nada se va", and on phones it gets its own line. */
  html[lang="en"] .headline {
    font-size: min(21vw, 16svh);
  }

  .headline em {
    display: block;
  }

  .controls {
    width: 100%;
    margin-left: -10px;
  }

  .foot {
    gap: 4px 16px;
  }
}

/* Phones held sideways: everything has to share very little height. */
@media (max-height: 480px) and (min-aspect-ratio: 1/1) {
  .logo {
    height: 56px;
  }

  .headline {
    font-size: 27svh;
  }

  .final {
    gap: 6px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(4px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  html.revealed .final > * {
    animation: arrive-soft 500ms ease-out both;
    animation-delay: 0ms;
  }

  .links a,
  .lang button,
  .controls button {
    transition: none;
  }

  .links a:active,
  .lang button:active,
  .controls button:active {
    transform: none;
  }
}

@keyframes arrive-soft {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
