/* Brand fonts live in /fonts (see fonts/README.md).
   Highway Gothic falls back to Overpass until its file is added. */
@font-face {
  font-family: "Highway Gothic";
  src: url("/fonts/HighwayGothic-Regular.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Lydian BT";
  src: url("/fonts/LydianBT.otf") format("opentype");
  font-display: swap;
}

:root {
  --oxblood: #240000;
  --oxblood-deep: #1a0000;
  --cream: #e7e1d9;
  --cream-muted: rgba(231, 225, 217, 0.72);
  --cream-line: rgba(231, 225, 217, 0.35);
  --font-display: "Highway Gothic", "Overpass", "Arial Narrow", sans-serif;
  --font-body: "Lydian BT", Georgia, serif;
  --gutter: clamp(20px, 5vw, 72px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

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

html, body { margin: 0; }

body {
  background: var(--oxblood);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- Layout ---------- */

.page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  min-height: 100svh;
}

.panel {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(40px, 6vh, 72px);
  padding: clamp(40px, 6vh, 64px) var(--gutter) clamp(40px, 7vh, 72px);
  text-align: center;
}

/* Headline + form, centred in the space below the logo */
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(32px, 5vh, 56px);
  width: 100%;
  margin-block: auto;
}

/* Mobile-only one-line logotype above the photo */
.topbar { display: none; }

.logotype {
  display: block;
  width: min(250px, 68vw);
  height: auto;
  color: var(--cream);
}

/* Paper texture, as in the Figma frame (16% opacity) */
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("/assets/texture.jpg") center / cover;
  opacity: .16;
  pointer-events: none;
}

.intro { max-width: 34rem; }

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(40px, 5vw, 64px);
  line-height: .95;
  letter-spacing: .01em;
  text-transform: uppercase;
  text-wrap: balance;
}

.lede {
  margin: clamp(20px, 3vh, 32px) auto 0;
  max-width: 28rem;
  color: var(--cream-muted);
  font-size: 17px;
  line-height: 1.6;
}

/* ---------- Form slot ---------- */

.form-slot {
  width: 100%;
  max-width: 26rem;
}

.form-slot iframe {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
}

/* ---------- Logo lockup ---------- */

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo {
  display: block;
  width: clamp(160px, 16vw, 210px);
  padding: 0;
  margin: 0 auto;
  color: var(--cream);
  background: none;
  border: 0;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.logo svg { display: block; width: 100%; height: auto; overflow: visible; }

.logo-mark { width: 64px; }

/* Footer logomark is only for the mobile layout */
.lockup { display: none; }

.logo:focus-visible { outline: 1px solid var(--cream-line); outline-offset: 8px; }

.logo .monogram {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .35s var(--ease);
}

.logo.is-curious { cursor: pointer; }
.logo.is-curious .monogram { transform: scale(1.04); }
.logo .monogram.tick { animation: tick .3s var(--ease); }

@keyframes tick {
  40% { transform: scale(.92) rotate(-6deg); }
}

/* ---------- Photo ---------- */

.photo {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: #3a2a1f;
}

/* Desktop: keep the photo pinned while the taller form column scrolls */
@media (min-width: 768px) {
  .photo {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    height: 100svh;
  }
}

.photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 40% 55%;
  transform-origin: 60% 60%;
  animation:
    develop 2.6s var(--ease) both,
    drift 24s ease-out both;
}

/* Film grain: SVG turbulence, jittered in steps so it reads as grain, not a slide */
.grain {
  position: absolute;
  inset: -50%;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .22;
  mix-blend-mode: multiply;
  animation: grain 1s steps(8) infinite;
}

.flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 55% 40%, #fffaf0 0%, #fff3dc 45%, #f5e3c4 100%);
  opacity: 0;
  pointer-events: none;
}

@keyframes develop {
  from { filter: brightness(1.9) contrast(.6) saturate(0) sepia(.6); }
  to   { filter: none; }
}

@keyframes drift {
  from { transform: scale(1.08); }
  to   { transform: scale(1); }
}

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

/* ---------- Easter egg: the photo re-develops ---------- */

.photo.redevelop img {
  animation:
    redevelop 4.2s cubic-bezier(.3, 0, .2, 1) both,
    drift 24s ease-out both;
}
.photo.redevelop .flash { animation: flash 1.1s ease-out both; }
.photo.redevelop .grain { animation: grain 1s steps(8) infinite, grain-surge 4.2s ease-out both; }

@keyframes flash {
  0%   { opacity: 0; }
  6%   { opacity: .96; }
  100% { opacity: 0; }
}

@keyframes redevelop {
  0%   { filter: brightness(2.4) contrast(.4) saturate(0) sepia(.8) blur(1.5px); }
  35%  { filter: brightness(1.5) contrast(.75) saturate(.2) sepia(.9) blur(.4px); }
  100% { filter: none; }
}

@keyframes grain-surge {
  0%   { opacity: .55; }
  100% { opacity: .22; }
}

/* Typed archive label, like the back of an old print */
.note {
  position: absolute;
  left: clamp(16px, 4vw, 40px);
  bottom: clamp(16px, 4vw, 40px);
  max-width: min(24rem, calc(100% - 32px));
  padding: 12px 16px 13px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--oxblood);
  background: var(--cream);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  transform: rotate(-1.5deg) translateY(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .6s var(--ease), transform .6s var(--ease), visibility 0s .6s;
}

.note.is-shown {
  opacity: 1;
  visibility: visible;
  transform: rotate(-1.5deg) translateY(0);
  transition: opacity .6s var(--ease), transform .6s var(--ease), visibility 0s;
}

.note.is-typing .note-text::after {
  content: "";
  display: inline-block;
  width: .55em;
  height: 1em;
  margin-left: 2px;
  vertical-align: -.15em;
  background: currentColor;
  animation: caret .8s steps(1) infinite;
}

@keyframes caret { 50% { opacity: 0; } }

/* Corner hint for the easter egg; appears after a pause, keys light up as typed */
.hint {
  position: absolute;
  right: clamp(16px, 3vw, 32px);
  bottom: clamp(16px, 3vw, 28px);
  margin: 0;
  padding: 7px 8px 7px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: .04em;
  color: var(--cream);
  background: rgba(36, 0, 0, .72);
  border-radius: 4px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  pointer-events: none;
  animation: hint-in 1.2s var(--ease) 6s both;
  transition: opacity .5s var(--ease);
}

.hint.is-done { opacity: 0; }

.hint kbd {
  display: inline-block;
  min-width: 1.6em;
  margin-left: 3px;
  padding: 2px 0 1px;
  font: inherit;
  text-align: center;
  color: var(--cream);
  background: transparent;
  border: 1px solid var(--cream-line);
  border-radius: 3px;
  transition: background .2s, color .2s, transform .2s var(--ease);
}

.hint kbd.is-on {
  color: var(--oxblood);
  background: var(--cream);
  transform: translateY(-2px);
}

/* Touch version sits right under the badge it refers to, with a dot per tap */
.hint-tap {
  position: static;
  display: none;
  margin-top: 20px;
  padding: 0;
  color: var(--cream-muted);
  background: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  animation-delay: 4s;
}

.hint-tap i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 5px;
  vertical-align: 1px;
  border: 1px solid var(--cream-line);
  border-radius: 50%;
  transition: background .2s, border-color .2s, transform .2s var(--ease);
}

.hint-tap i:first-of-type { margin-left: 8px; }

.hint-tap i.is-on {
  background: var(--cream);
  border-color: var(--cream);
  transform: scale(1.25);
}

/* Tablets (touch, two-column): tap hint under the top logo instead of the key hint */
@media (min-width: 768px) and (hover: none) and (pointer: coarse) {
  .hint-keys { display: none; }
  .brand .hint-tap { display: block; }
}

@keyframes hint-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Legal links + pages ---------- */

.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
  font-size: 14px;
  letter-spacing: .04em;
}

.legal-links a {
  color: var(--cream-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}

.legal-links a:hover,
.legal-links a:focus-visible,
.legal-links a[aria-current="page"] {
  color: var(--cream);
  border-color: var(--cream-line);
}

.legal-page {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(28px, 5vh, 48px) var(--gutter) clamp(40px, 7vh, 72px);
}

.legal-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("/assets/texture.jpg") center / cover;
  opacity: .16;
  pointer-events: none;
}

.legal-home {
  display: block;
  color: var(--cream);
}

.legal-body {
  width: 100%;
  max-width: 42rem;
  margin: clamp(48px, 9vh, 96px) 0 clamp(56px, 9vh, 96px);
  color: var(--cream-muted);
}

.legal-body h1 {
  margin-bottom: clamp(28px, 4vh, 44px);
  color: var(--cream);
  text-align: center;
}

.legal-body h2,
.legal-body h3 {
  margin: 2.2em 0 .6em;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--cream);
}

.legal-body h2 { font-size: 22px; }
.legal-body h3 { margin-top: 1.6em; font-size: 17px; }

.legal-body p,
.legal-body li { margin: 0 0 1em; }

.legal-body ul,
.legal-body ol { margin: 0 0 1em; padding-left: 1.4em; }

.legal-body li > ul,
.legal-body li > ol { margin-top: .8em; }

.legal-body a {
  color: var(--cream);
  text-decoration-color: var(--cream-line);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.legal-updated {
  margin-top: 3em;
  font-size: 14px;
  letter-spacing: .04em;
}

/* ---------- Load reveal ---------- */

.reveal {
  animation: rise 1s var(--ease) both;
  animation-delay: var(--d, 0s);
}

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

/* ---------- Responsive ---------- */

@media (max-width: 767px) {
  .page {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .topbar {
    order: -2;
    display: flex;
    justify-content: center;
    padding: 22px 16px 20px;
  }

  /* Mobile shows the one-line logotype on top and the logomark in the footer */
  .brand { display: none; }
  .lockup { display: block; }
  .lockup .hint-tap { display: block; }
  .hint-keys { display: none; }

  /* The photo (with its grain) fades into the panel via a mask; an overlay
     gradient left a sub-pixel seam at the join */
  .photo {
    order: -1;
    height: 52svh;
    min-height: 300px;
    background: transparent;
    -webkit-mask-image: linear-gradient(to bottom, #000 50%, rgba(0, 0, 0, .55) 75%, rgba(0, 0, 0, .15) 90%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 50%, rgba(0, 0, 0, .55) 75%, rgba(0, 0, 0, .15) 90%, transparent 100%);
  }

  .photo img { object-position: 62% 50%; }

  .note { bottom: auto; top: 16px; }

  .panel { padding-top: 16px; gap: 56px; }

  /* Fade the paper texture in below the photo so there's no seam */
  .panel::before {
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 160px);
    mask-image: linear-gradient(to bottom, transparent, #000 160px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .hint,
  .photo img,
  .photo.redevelop img,
  .photo.redevelop .flash,
  .grain,
  .photo.redevelop .grain,
  .logo .monogram.tick { animation: none !important; }
  .note, .logo .monogram { transition: none; }
}
