/* The PIN page. Colors and fonts are the main site's (styles.css). Dark only.
   Layers, back to front: rows of show pictures sliding sideways on a tilted plane, a dark veil that
   is darkest behind the PIN box, the PIN box, and a full-screen layer used by the unlock animation. */
:root {
  --ink: #07080b;
  --bg: #14171e;
  --heading: #eceef2;
  --text: #c6ccd5;
  --muted: #8b93a1;
  --accent: #e8b67a;
  --accent-soft: rgba(232, 182, 122, 0.16);
  --accent-line: rgba(232, 182, 122, 0.45);
  --rose: #e39d9d;
  --rose-soft: rgba(227, 157, 157, 0.14);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-title: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --tile-h: clamp(120px, 21vh, 250px);
  --gap: clamp(10px, 1.4vh, 18px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); color: var(--heading); }

/* ---------- Sliding pictures ---------- */
.reel { position: fixed; inset: 0; overflow: hidden; perspective: 1600px; transition: opacity 1s ease, filter 1s ease, transform 1.4s cubic-bezier(.6, 0, .2, 1); }
.reel-plane {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 170vmax;
  display: grid;
  gap: var(--gap);
  transform: translate(-50%, -50%) rotateX(14deg) rotateZ(-9deg);
  opacity: 0;
  transition: opacity 1.6s ease .2s;
}
.reel.ready .reel-plane { opacity: 1; }
.track { display: flex; width: max-content; animation: slide var(--dur, 120s) linear infinite; }
.row.reverse .track { animation-direction: reverse; }
/* Rows use the logo's three frame shapes (--ratio is 2.39, 16:9 or 4:3, set by gate/pin.js).
   One set of pictures is --set wide, so moving by it lines the next copy up exactly where the first began. */
.track { --set: calc(var(--count) * (var(--tile-h) * var(--ratio) + var(--gap))); }
@keyframes slide { to { transform: translateX(calc(-1 * var(--set))); } }
.tile {
  flex: none;
  width: calc(var(--tile-h) * var(--ratio));
  height: var(--tile-h);
  margin-right: var(--gap);
  border-radius: 12px;
  object-fit: cover;
  background: #11141a;
  filter: saturate(.85) brightness(.62);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .05);
}

/* Darkest in the middle, behind the PIN box, with a faint lamp-amber glow. */
.veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 34% 40% at 50% 48%, rgba(232, 182, 122, .07), transparent 70%),
    radial-gradient(ellipse 62% 70% at 50% 50%, rgba(7, 8, 11, .86) 0%, rgba(7, 8, 11, .6) 55%, rgba(7, 8, 11, .25) 100%),
    linear-gradient(180deg, rgba(7, 8, 11, .9) 0%, rgba(7, 8, 11, 0) 22%, rgba(7, 8, 11, 0) 78%, rgba(7, 8, 11, .92) 100%);
  transition: opacity 1s ease;
}

/* ---------- PIN box ---------- */
.stage {
  position: relative;
  z-index: 2;
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 22px;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

.card {
  position: relative;
  width: min(100%, 470px);
  padding: 44px clamp(22px, 6vw, 40px) 30px;
  text-align: center;
  background: rgba(12, 14, 19, .64);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 26px;
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  backdrop-filter: blur(22px) saturate(1.2);
  box-shadow: 0 40px 120px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .06);
  animation: rise .9s cubic-bezier(.2, .8, .2, 1) both;
  transition: background .6s ease, border-color .6s ease, box-shadow .6s ease;
}
/* A thin amber light that travels around the box's edge. */
.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--spin), transparent 0deg, transparent 250deg, var(--accent-line) 310deg, var(--accent) 340deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spin 7s linear infinite;
  pointer-events: none;
  transition: opacity .4s ease;
}
@keyframes spin { to { --spin: 360deg; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }

.brand { display: grid; justify-items: center; }
.logo { margin: 0; width: 100%; display: flex; justify-content: center; }
.hidden-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The logo draws itself in: the three frames from the outside in, then the amber square, then the name.
   The square sits at 13.66% across and 51.39% down the logo; the unlock animation zooms into that point. */
.lockup {
  display: block;
  width: min(100%, 360px);
  height: auto;
  aspect-ratio: 903.8 / 108;
  overflow: visible;
  color: var(--heading);
  fill: var(--accent);
  transform-origin: 13.66% 51.39%;
}
.lockup text { font-family: var(--font-display); font-size: 72.86px; font-weight: 600; font-variation-settings: "opsz" 72, "SOFT" 0; letter-spacing: 0; animation: fade .9s ease .95s both; }
.lockup .frame { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s cubic-bezier(.6, 0, .2, 1) forwards; }
.lockup .frame:nth-child(2) { animation-delay: .2s; }
.lockup .frame:nth-child(3) { animation-delay: .4s; }
.lockup .square { transform-box: fill-box; transform-origin: center; animation: pop .7s cubic-bezier(.3, 1.6, .5, 1) .8s both, glow 4s ease-in-out 2s infinite; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { transform: scale(0); } }
@keyframes glow { 50% { filter: drop-shadow(0 0 7px rgba(232, 182, 122, .8)); } }

.tagline { margin: 12px 0 0; font-size: .9375rem; line-height: 1.5; color: var(--muted); text-wrap: balance; animation: fade .9s ease .65s both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.pin-form { margin-top: 30px; padding-top: 26px; border-top: 1px solid rgba(255, 255, 255, .07); animation: fade .9s ease .8s both; }
.label { display: block; font: 600 .875rem/1 var(--font-title); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }

/* Without the script, the PIN box is a plain field. With it (html.js), a hidden field sits over drawn slots. */
.pin-field { position: relative; margin-top: 16px; }
.pin-field input {
  display: block;
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  color: var(--heading);
  font: 500 1.5rem/1 var(--font-mono);
  letter-spacing: .4em;
  text-align: center;
}
.slots { display: none; }
.js .pin-field input {
  position: absolute;
  inset: 0;
  z-index: 1;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px; /* 16px stops phones zooming in on focus */
  cursor: text;
}
.js .slots {
  display: grid;
  grid-template-columns: repeat(var(--n, 6), minmax(0, 52px));
  justify-content: center;
  gap: clamp(6px, 2.2vw, 10px);
}
.slot {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 52 / 62;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
  transition: border-color .2s ease, background-color .35s ease, box-shadow .2s ease, transform .2s ease;
}
.slot::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--heading);
  transform: scale(0);
  transition: transform .2s cubic-bezier(.3, 1.6, .5, 1), background-color .3s ease;
}
.slot.filled::after { transform: scale(1); }
.slot.filled { border-color: rgba(255, 255, 255, .26); }
.focused .slot.active { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.focused .slot.active::before {
  content: "";
  position: absolute;
  width: 2px;
  height: 40%;
  border-radius: 1px;
  background: var(--accent);
  animation: caret 1.1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.pin-field.error .slot { border-color: var(--rose); background: var(--rose-soft); }
.pin-field.error .slot::after { background: var(--rose); }
.pin-field.error { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}
.pin-field.busy .slot.filled::after { animation: wait 1s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 90ms); }
@keyframes wait { 50% { transform: scale(.55); opacity: .5; } }
.pin-field.locked { opacity: .45; }

.go {
  margin-top: 18px;
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 1.0625rem/1 var(--font-title);
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, opacity .2s ease;
}
.go:hover:not(:disabled) { background: var(--accent); color: var(--ink); }
.go:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.msg { min-height: 1.5em; margin: 14px 0 0; font-size: .9375rem; line-height: 1.5; color: var(--muted); text-wrap: balance; }
.msg.bad { color: var(--rose); }

.fine { margin: 0; font: 600 .8125rem/1.4 var(--font-title); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-align: center; text-wrap: balance; animation: fade 1s ease 1s both; }

/* ---------- Unlock animation ----------
   The slots turn amber one after another and the box empties. The logo's amber square moves to the middle
   of the screen (--dx and --dy, set by gate/pin.js) while the logo grows, so the view passes through the
   2.39:1, 16:9 and 4:3 frames into the square. The screen then fades to the site's header color. */
.unlocked .slot { border-color: var(--accent); background: var(--accent); transition-delay: calc(var(--i, 0) * 55ms); }
.unlocked .slot::after { background: var(--ink); transition-delay: calc(var(--i, 0) * 55ms); }
.unlocked .pin-form, .unlocked .tagline, .unlocked .fine { opacity: 0; transform: translateY(8px); transition: opacity .45s ease .45s, transform .45s ease .45s; }
.unlocked .lockup text { opacity: 0; transition: opacity .4s ease .6s; }
.unlocked .card { background: transparent; border-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; transition-delay: .55s; }
.unlocked .card::before { opacity: 0; }
.unlocked .lockup { transform: translate(var(--dx, 0px), var(--dy, 0px)) scale(var(--zoom, 300)); transition: transform 1.6s cubic-bezier(.7, 0, .2, 1) .7s; }
.unlocked .lockup .square { animation: none; }
.unlocked .lockup .frame { animation: none; stroke-dasharray: none; } /* a dash leaves a seam that shows when zoomed in */
.unlocked .reel { opacity: 0; filter: blur(10px); transform: scale(1.12); transition-delay: .5s; }
.unlocked .veil { opacity: 0; transition-delay: .6s; }
.flood { position: fixed; inset: 0; z-index: 5; background: var(--ink); opacity: 0; pointer-events: none; }
.unlocked .flood { opacity: 1; transition: opacity .5s ease 1.75s; }

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
  .card { padding-top: 36px; border-radius: 22px; }
  .pin-form { margin-top: 24px; padding-top: 22px; }
}
@media (max-height: 560px) {
  .tagline, .fine { display: none; }
  .card { padding-top: 26px; }
}

/* ---------- Reduced motion: nothing slides, shakes or zooms ---------- */
@media (prefers-reduced-motion: reduce) {
  .track, .card, .card::before, .tagline, .pin-form, .fine, .lockup rect, .lockup text, .pin-field.error, .pin-field.busy .slot::after { animation: none !important; }
  .lockup .frame { stroke-dashoffset: 0; }
  .unlocked .lockup { transform: none; transition: none; }
  .unlocked .flood { transition: opacity .3s ease; }
}
