/* Portale beta page. The game's own font and palette (src/style.css in the game), and the
   trailer's finish (grade, chromatic aberration, wash, vignette, grain, light leak, push-in). */

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

:root {
  --ink: #202923;
  --ink-deep: #141a17;
  --night: #19201c;
  --parchment: #f3e8cf;
  --parchment-dim: #d8cdb3;
  --ocean: #2b5873;
  --sea: #65b8a6;
  --terracotta: #b96e50;
  --terracotta-hi: #c9805f;
  --ochre: #d9ac5b;
  --ok: #2f6b4f;
  --bad: #9a3b2a;
  --pixel: "Portale Pixel", ui-monospace, monospace;
  /* The trailer's grade (DEFAULT_GRADE in src/trailer/fx.ts). */
  --grade: contrast(1.07) saturate(1.12);
  --dusk-0: #17142c;
  --dusk-1: #2c2248;
  --dusk-2: #5b3a5e;
  --dusk-3: #a7586a;
  --dusk-4: #e0905e;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--night);
  color: var(--parchment);
  font-family: var(--pixel);
  font-size: 19px;
  line-height: 1.45;
  -webkit-font-smoothing: none;
  font-smooth: never;
  /* The pixel font's fi/fl ligatures are drawn wrong ("fish" reads "Ash"): letters one by one. */
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "clig" 0;
  overflow-x: hidden;
}

img {
  max-width: 100%;
}

/* Pixel art at any size: square pixels, never smoothed. */
.px {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

a {
  color: var(--ochre);
}

h1,
h2,
p {
  margin: 0;
}

h2 {
  font-weight: 400;
}

.defs {
  position: absolute;
}

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

/* ------------------------------------------------------------------ the top: dusk sky, the name, the scene */

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--night);
  padding-bottom: 72px;
  isolation: isolate;
}

/* The sky above the island, dusk going down to a warm horizon, like a title screen. */
.hero-top {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: max(4vh, 28px) 16px clamp(20px, 3vw, 40px);
  text-align: center;
  background: linear-gradient(180deg, var(--dusk-0) 0%, var(--dusk-1) 34%, var(--dusk-2) 72%, var(--dusk-3) 100%);
}

.stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.hero-top > :not(.stars) {
  position: relative;
}

.scene-wrap {
  width: 100%;
  background: linear-gradient(180deg, var(--dusk-3) 0%, var(--dusk-2) 22%, var(--night) 75%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.18em;
  font-weight: 400;
  font-size: clamp(56px, 9.5vw, 136px);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--parchment);
  text-shadow: 0.045em 0.045em 0 var(--ink);
}

.brand-icon {
  height: 1.12em;
  width: auto;
  filter: drop-shadow(0.04em 0.04em 0 rgba(32, 41, 35, 0.9));
  animation: bob 5s ease-in-out infinite;
}

.brand-word {
  /* The word sits on the arch's base line. */
  transform: translateY(0.06em);
}

.tagline {
  font-size: clamp(21px, 2.6vw, 32px);
  line-height: 1.25;
  text-shadow: 3px 3px 0 var(--ink);
}

/* The scene: the island at sunset, the moment the arch woke and everyone gathered. */
.scene {
  position: relative;
  z-index: 1;
  width: 100%;
  height: min(54vh, 56.25vw);
  min-height: 300px;
  overflow: hidden;
  /* Its top melts into the sky, its foot into the night. */
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.35) 10%, #000 28%, #000 80%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.35) 10%, #000 28%, #000 80%, transparent 100%);
}

.scene-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 55%;
  filter: var(--grade) brightness(1.04) url(#ca);
  transform-origin: 52% 50%;
  animation: push 26s ease-in-out infinite alternate;
}

/* The trailer's soft-light wash: warm light from the top left to cool shade at the bottom right. */
.wash,
.frame::after {
  background: linear-gradient(135deg, #ffc58a 0%, rgba(128, 128, 128, 0) 55%, #2c5a86 100%);
  mix-blend-mode: soft-light;
}

.wash {
  position: absolute;
  inset: 0;
  opacity: 0.45;
  pointer-events: none;
}

/* A light leak at golden hour, drifting across. */
.leak {
  position: absolute;
  inset: -20%;
  background: radial-gradient(closest-side, rgba(255, 190, 120, 0.55), rgba(255, 190, 120, 0));
  mix-blend-mode: screen;
  pointer-events: none;
  animation: leak 14s ease-in-out infinite;
}

.motes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(11, 15, 13, 0) 45%, rgba(11, 15, 13, 0.42) 100%);
  pointer-events: none;
}

/* Film grain: a noise tile, stepped about. */
.grain {
  position: absolute;
  inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.09;
  mix-blend-mode: overlay;
  pointer-events: none;
  animation: grain 0.6s steps(4) infinite;
}

/* ------------------------------------------------------------------ the sign-up panel (the game's panels) */

.panel {
  position: relative;
  z-index: 3;
  width: min(600px, calc(100% - 32px));
  background: var(--parchment);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 7px 7px 0 rgba(14, 19, 16, 0.85);
}

.hero .panel {
  margin-top: -120px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px 13px;
  background: var(--ocean);
  color: var(--parchment);
  border-bottom: 3px solid var(--ink);
}

.panel-head h2 {
  font-size: 30px;
  line-height: 1.1;
}

.panel-head p {
  margin-top: 4px;
  font-size: 17px;
  line-height: 1.3;
  opacity: 0.92;
}

/* The game's little arch, as on its title screen. */
.mark {
  flex: none;
  width: 26px;
  height: 33px;
  margin-top: 2px;
  background: var(--sea);
  border: 4px solid var(--parchment);
  border-bottom: 0;
  border-radius: 13px 13px 0 0;
  box-shadow: inset 0 -6px 0 var(--ochre);
}

.panel-body {
  padding: 16px 18px 14px;
}

.field {
  display: flex;
  gap: 10px;
}

.field input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 19px;
  color: var(--ink);
  background: #fffaf0;
  border: 3px solid var(--ink);
  border-radius: 0;
  padding: 10px 12px;
  box-shadow: inset 3px 3px 0 rgba(32, 41, 35, 0.12);
}

.field input::placeholder {
  color: #8b8574;
}

.field input:focus-visible,
.btn:focus-visible,
a:focus-visible {
  outline: 3px solid var(--ochre);
  outline-offset: 2px;
}

.btn {
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border: 3px solid var(--ink);
  border-radius: 0;
  padding: 12px 18px;
  white-space: nowrap;
  transition: transform 80ms steps(2), box-shadow 80ms steps(2);
}

.btn.primary {
  background: var(--terracotta);
  color: var(--parchment);
  box-shadow: 4px 4px 0 var(--ink);
  text-shadow: 2px 2px 0 rgba(32, 41, 35, 0.45);
}

.btn.primary:hover {
  background: var(--terracotta-hi);
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--ink);
}

.btn.primary:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}

.btn[disabled] {
  cursor: progress;
  opacity: 0.75;
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.status {
  min-height: 1.4em;
  margin-top: 10px;
  font-size: 17px;
  line-height: 1.3;
}

.status.ok {
  color: var(--ok);
}

.status.bad {
  color: var(--bad);
}

.fine {
  font-size: 15px;
  color: #6c6656;
}

.fine a {
  color: var(--ocean);
}

.signup.done .field {
  display: none;
}

.scroll-cue {
  position: relative;
  z-index: 3;
  margin-top: 36px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
}

.scroll-cue span {
  width: 14px;
  height: 14px;
  border-right: 4px solid var(--parchment);
  border-bottom: 4px solid var(--parchment);
  transform: rotate(45deg);
  animation: cue 1.6s steps(2) infinite;
}

/* ------------------------------------------------------------------ features */

main {
  display: block;
}

/* Each feature: a few words, then the game itself, big enough to see every pixel. */
.feature {
  display: grid;
  gap: clamp(26px, 3.5vw, 44px);
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: clamp(56px, 8vw, 110px) 24px;
}

.copy {
  max-width: 760px;
}

.feature.flip .copy {
  justify-self: end;
}

.copy h2 {
  font-size: clamp(30px, 3.6vw, 46px);
  line-height: 1.1;
  margin: 10px 0 16px;
  text-shadow: 3px 3px 0 var(--ink-deep);
}

.copy p:not(.kicker) {
  color: var(--parchment-dim);
  max-width: 34em;
}

.kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--ochre);
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kicker::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--ochre);
  box-shadow: 3px 3px 0 var(--ink-deep);
}

.soon {
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--ink);
  background: var(--sea);
  border: 2px solid var(--ink);
  padding: 1px 8px 2px;
}

/* A big lead picture, and a second one laid over its corner like a photo on a table. */
.shots {
  position: relative;
}

.shots.two {
  padding-bottom: 9%;
}

.shots.two .frame:first-child {
  width: 80%;
}

.shots.two .frame:nth-child(2) {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 40%;
  z-index: 1;
}

/* Two collages, each the full width: their small panels need the room. */
.shots.stack {
  display: grid;
  gap: clamp(20px, 3vw, 36px);
}

.feature.flip .shots.two .frame:first-child {
  margin-left: auto;
}

.feature.flip .shots.two .frame:nth-child(2) {
  right: auto;
  left: 0;
}

/* A screenshot, framed like the game's panels, with the trailer's wash and vignette over it. */
.frame {
  position: relative;
  margin: 0;
  background: var(--ink);
  border: 4px solid var(--parchment);
  box-shadow:
    0 0 0 3px var(--ink),
    9px 9px 0 3px rgba(8, 11, 9, 0.75);
  overflow: hidden;
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
  filter: var(--grade) url(#ca);
  transition: transform 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.frame:hover img {
  transform: scale(1.035);
}

.frame::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  pointer-events: none;
  box-shadow: inset 0 0 60px rgba(11, 15, 13, 0.45);
}

/* ------------------------------------------------------------------ trailer and closing */

.trailer {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: clamp(40px, 8vw, 110px) 24px clamp(56px, 9vw, 120px);
  text-align: center;
}

.trailer h2 {
  font-size: clamp(30px, 3.6vw, 46px);
  margin-bottom: 26px;
  text-shadow: 3px 3px 0 var(--ink-deep);
}

.frame.video video {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
}

.frame.video::after {
  display: none;
}

.closing {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(56px, 8vw, 110px) 0 clamp(64px, 9vw, 120px);
  background: linear-gradient(180deg, var(--night) 0%, var(--dusk-1) 55%, var(--dusk-0) 100%);
}

.closing-icon {
  width: clamp(150px, 20vw, 230px);
  height: auto;
  margin-bottom: -8px;
  filter: drop-shadow(5px 5px 0 rgba(14, 19, 16, 0.8));
  animation: bob 5s ease-in-out infinite;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 22px 24px 28px;
  background: var(--ink-deep);
  color: var(--parchment-dim);
  font-size: 16px;
}

.foot-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--parchment);
  text-decoration: none;
  font-size: 26px;
  text-shadow: 2px 2px 0 var(--ink);
}

.foot-brand img {
  height: 40px;
  width: auto;
}

.foot nav {
  display: flex;
  gap: 20px;
}

.foot p {
  width: 100%;
  color: #8f8a7b;
  font-size: 14px;
}

/* ------------------------------------------------------------------ the small pages (confirm, privacy) */

.page {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--dusk-0) 0%, var(--dusk-1) 45%, var(--dusk-2) 80%, var(--dusk-3) 100%) fixed;
}

.page-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px 0 64px;
}

.page-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--parchment);
  text-decoration: none;
  font-size: clamp(44px, 9vw, 72px);
  line-height: 1;
  text-shadow: 0.05em 0.05em 0 var(--ink);
}

.page-brand img {
  height: 1.1em;
  width: auto;
}

.page .panel {
  width: min(680px, calc(100% - 32px));
}

.panel-head h1 {
  font-size: 30px;
  font-weight: 400;
  line-height: 1.1;
}

.confirm-shot {
  margin-bottom: 18px;
}

.page .panel-body > p,
.page .panel-body > div {
  margin-top: 10px;
}

.prose h2 {
  font-size: 22px;
  margin: 18px 0 4px;
  color: var(--ocean);
}

.prose h2:first-child {
  margin-top: 0;
}

.prose p {
  color: #3b3f37;
  font-size: 18px;
}

.prose a {
  color: var(--ocean);
}

[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ motion */

@keyframes push {
  from {
    transform: scale(1.02) translate(0, 0);
  }
  to {
    transform: scale(1.09) translate(-0.6%, 0.4%);
  }
}

@keyframes leak {
  0%,
  100% {
    transform: translate(-38%, -10%);
    opacity: 0.25;
  }
  50% {
    transform: translate(22%, 4%);
    opacity: 0.8;
  }
}

@keyframes grain {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-6%, 4%);
  }
  50% {
    transform: translate(5%, -7%);
  }
  75% {
    transform: translate(-3%, 8%);
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes cue {
  0%,
  100% {
    transform: translateY(0) rotate(45deg);
  }
  50% {
    transform: translateY(5px) rotate(45deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ------------------------------------------------------------------ narrow screens */

@media (max-width: 860px) {
  .feature {
    grid-template-columns: 1fr;
    padding-left: 16px;
    padding-right: 16px;
  }
  .shots.two {
    padding-bottom: 0;
    display: grid;
    gap: 18px;
  }
  .shots.two .frame:first-child,
  .shots.two .frame:nth-child(2) {
    position: static;
    width: 100%;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 18px;
  }
  .scene {
    height: 46vh;
  }
  .scene-img {
    object-position: 46% 55%;
  }
  .hero .panel {
    margin-top: -56px;
  }
  .field {
    flex-direction: column;
  }
  .btn {
    width: 100%;
  }
  .panel-head h2 {
    font-size: 26px;
  }
}
