/*
 * Rives landing — mirrors the app's design rules (docs/ARCHITECTURE.md §5.3,
 * apps/mobile/src/theme/tokens.ts): absolute black canvas, serif titles with
 * sans meta, glass planes lit by a specular top edge instead of borders, a
 * chrome pill for the one CTA, and orange only as a micro-accent (the dot on the i of Paris).
 */

@font-face {
  font-family: 'Instrument Serif';
  src: url('/fonts/InstrumentSerif_400Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('/fonts/InstrumentSerif_400Regular_Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter_400Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter_500Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter_600SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

:root {
  --canvas: #000;
  --ink: #f4f1ea;
  --ink-muted: rgba(244, 241, 234, 0.62);
  --ink-faint: rgba(244, 241, 234, 0.32);
  --accent: #ff5a00;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.1);
  --edge: rgba(255, 255, 255, 0.14);
  --danger: #ff3b30;
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: clamp(20px, 5vw, 64px);
}

* {
  box-sizing: border-box;
}

html {
  /* The native scrollbar is hidden so it never takes width (short and long
     pages keep the same layout); scrollbar.js draws an overlay one. */
  scrollbar-width: none;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100svh;
  overflow-x: hidden;
  background:
    radial-gradient(60rem 40rem at 0% 0%, rgba(140, 142, 150, 0.16), transparent 70%),
    var(--canvas);
}

/* Film grain, the same texture as the artwork. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.page {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    'masthead'
    'hero'
    'footer';
  min-height: 100svh;
  max-width: 1440px;
  margin: 0 auto;
}

html::-webkit-scrollbar {
  display: none;
}

/* Overlay scrollbar (scrollbar.js): a slim glass pill on the right edge,
   always shown on pages that scroll, never taking layout width. */
.scrollbar {
  position: fixed;
  top: 8px;
  right: 4px;
  bottom: 8px;
  z-index: 10;
  width: 12px;
}

.scrollbar[hidden] {
  display: none;
}

.scrollbar-thumb {
  position: absolute;
  top: 0;
  right: 2px;
  width: 4px;
  min-height: 32px;
  border-radius: 999px;
  background: rgba(244, 241, 234, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  cursor: grab;
  transition: width 160ms ease, background-color 160ms ease;
}

.scrollbar.is-active .scrollbar-thumb {
  background: rgba(244, 241, 234, 0.32);
}

.scrollbar:hover .scrollbar-thumb,
.scrollbar.is-dragging .scrollbar-thumb {
  width: 7px;
  background: rgba(244, 241, 234, 0.45);
}

.scrollbar.is-dragging .scrollbar-thumb {
  cursor: grabbing;
}

/* Masthead */

.masthead {
  grid-area: masthead;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: calc(var(--gutter) * 0.75) var(--gutter) 0;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.01em;
}

/* The Rives mark, on the icon set's 24-unit grid (apps/mobile/src/ui/icons/
   glyphs.ts `logo`): three map pins joined at their points, 1.5 strokes. */
.logo {
  width: 26px;
  height: 26px;
  flex: none;
}

/* Hero */

.hero {
  grid-area: hero;
  align-self: center;
  padding: clamp(48px, 8vh, 96px) var(--gutter);
  max-width: 680px;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(44px, 5.6vw, 88px);
  line-height: 0.92;
  letter-spacing: -0.02em;
}

/* The dot on the i of Paris is the page's orange accent: a dotless ı with a drawn dot. */
.tittle {
  position: relative;
}

.tittle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0.27em;
  width: 0.12em;
  height: 0.12em;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}

h1 em {
  font-style: italic;
  color: var(--ink);
  white-space: nowrap;
}

.lede {
  margin: 28px 0 0;
  font-size: 18px;
  color: var(--ink-muted);
}

/* Form: a glass plane holding the field and the chrome pill. */

.signup-slot {
  display: grid;
  margin-top: 36px;
  max-width: 440px;
}

/* The form and the confirmation share one grid cell: the slot keeps the
   form's height, so confirming never moves the page. */
.signup,
.joined {
  grid-area: 1 / 1;
}

.signup {
  transition:
    opacity 260ms cubic-bezier(0.4, 0, 1, 1),
    transform 260ms cubic-bezier(0.4, 0, 1, 1),
    filter 260ms ease,
    visibility 0s linear 0s;
}

.joined {
  align-self: start;
  padding-top: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition:
    opacity 420ms cubic-bezier(0.22, 1, 0.36, 1) 180ms,
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1) 180ms,
    visibility 0s linear 180ms;
}

.signup-slot.is-joined .signup {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  filter: blur(6px);
  transition-property: opacity, transform, filter, visibility;
  transition-delay: 0s, 0s, 0s, 260ms;
}

.signup-slot.is-joined .joined {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.signup-slot.is-joined .joined-title::before {
  animation: dot-pop 520ms cubic-bezier(0.34, 1.56, 0.64, 1) 300ms both;
}

.signup-slot.is-instant .signup,
.signup-slot.is-instant .joined,
.signup-slot.is-instant .joined-title::before {
  transition: none;
  animation: none;
}

@keyframes dot-pop {
  from {
    transform: scale(0);
  }
}

.turnstile:empty {
  display: none;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: inset 0 1px 0 var(--edge);
  transition: background 160ms ease;
}

.field:focus-within {
  background: var(--glass-strong);
}

.field input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 8px 0 18px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 400 15px/1 var(--sans);
}

.field input::placeholder {
  color: var(--ink-faint);
}

.chrome {
  position: relative;
  flex: none;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  isolation: isolate;
  /* The app's chrome light layer (ChromeSurface): no metal plate, just light
     on glass — a faint wash and a top-left light leak. */
  background:
    radial-gradient(circle at 28% 0%, rgba(255, 255, 255, 0.12), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  color: var(--ink);
  font: 600 14px/1 var(--sans);
  letter-spacing: 0.01em;
  cursor: pointer;
  /* The lit rim, as inset shadows so the browser antialiases the curve: a
     bright top-left edge over a faint full ring and a soft bottom edge. */
  box-shadow:
    inset 0.75px 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 120ms ease, background-color 160ms ease, opacity 160ms ease;
}

.chrome > span {
  position: relative;
  z-index: 2;
}

/* Specular sweep on hover, as on the app's ChromePill. */
.chrome::after {
  content: '';
  position: absolute;
  top: -50%;
  bottom: -50%;
  left: -40%;
  width: 32%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: skewX(-20deg) translateX(0);
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.chrome:hover::after,
.chrome:focus-visible::after {
  transform: skewX(-20deg) translateX(520%);
}

.chrome:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.chrome:active {
  transform: scale(0.97);
  background-color: rgba(255, 255, 255, 0.1);
}

.chrome:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.chrome[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.note {
  min-height: 18px;
  margin: 14px 0 0 20px;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-faint);
}

.note.is-error {
  color: var(--danger);
}


.joined-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1.1;
}

.joined-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.hp,
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/*
 * Reel: the Explore stills as a tilted wall filling the whole page behind the
 * content, lanes drifting in alternate directions. The shade layer darkens the
 * edges and the left side so the headline and form stay legible.
 */

.reel {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  perspective: 1400px;
  perspective-origin: 70% 40%;
}

.wall {
  position: absolute;
  top: -45%;
  bottom: -45%;
  left: -10%;
  right: -35%;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 20px;
  transform: rotateX(34deg) rotateY(-16deg) rotateZ(-14deg);
  transform-origin: 65% 50%;
  transform-style: preserve-3d;
}

.lane {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: drift 90s linear infinite;
}

.lane:nth-child(even) {
  margin-top: -30%;
  animation-direction: reverse;
  animation-duration: 110s;
}

.lane:nth-child(3n) {
  animation-duration: 130s;
}

.lane img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 18px;
  /* Smooth edges under the 3D transform. */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  outline: 1px solid transparent;
}

@keyframes drift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-50%);
  }
}

.shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.95) 28%, rgba(0, 0, 0, 0.72) 45%, rgba(0, 0, 0, 0.15) 70%, rgba(0, 0, 0, 0.35) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.85) 0%, transparent 22%, transparent 74%, rgba(0, 0, 0, 0.9) 100%),
    radial-gradient(ellipse 75% 85% at 72% 50%, transparent 35%, rgba(0, 0, 0, 0.85) 100%);
}

/* Footer */

.footer {
  grid-area: footer;
  display: flex;
  gap: 24px;
  padding: 0 var(--gutter) calc(var(--gutter) * 0.75);
  font-size: 12px;
  color: var(--ink-faint);
}

.footer a {
  color: inherit;
  text-decoration: none;
  transition: color 160ms ease;
}

.footer a:hover,
.footer a:focus-visible {
  color: var(--ink-muted);
}

/* Legal pages: same left column over the wall, reading width. */

.legal {
  grid-area: hero;
  max-width: 600px;
  padding: clamp(40px, 7vh, 80px) var(--gutter) 64px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-muted);
}

.legal h1 {
  font-size: clamp(44px, 4.6vw, 64px);
  line-height: 1;
  color: var(--ink);
}

.legal-date {
  margin: 12px 0 36px;
  font-size: 12px;
  color: var(--ink-faint);
}

.legal h2 {
  margin: 36px 0 8px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.2;
  color: var(--ink);
}

.legal p,
.legal ul {
  margin: 0 0 12px;
}

.legal ul {
  padding-left: 1.1em;
}

.legal a {
  color: var(--ink);
  text-decoration-color: var(--ink-faint);
  text-underline-offset: 3px;
}

.legal code {
  font-size: 0.92em;
  color: var(--ink);
}

.legal-back {
  margin-top: 40px !important;
}

/* Small screens: the wall sits behind the text, shaded from the top down. */

@media (max-width: 860px) {
  .hero {
    padding-top: 56px;
    padding-bottom: 40px;
  }

  h1 {
    font-size: 52px;
  }

  .signup-slot {
    max-width: none;
  }

  .field {
    flex-direction: column;
    align-items: stretch;
    border-radius: 28px;
  }

  .field input {
    height: 52px;
    padding: 0 18px;
  }

  .chrome {
    height: 52px;
  }

  .wall {
    left: -60%;
    right: -60%;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
  }

  .lane {
    gap: 12px;
  }

  .shade {
    background:
      linear-gradient(180deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.82) 45%, rgba(0, 0, 0, 0.35) 75%, rgba(0, 0, 0, 0.85) 100%),
      radial-gradient(ellipse 90% 70% at 50% 75%, transparent 30%, rgba(0, 0, 0, 0.85) 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .signup,
  .joined,
  .signup-slot.is-joined .signup {
    transform: none;
    filter: none;
  }

  .lane {
    animation: none;
  }
  .chrome::after {
    transition: none;
  }
}

/*
 * Cross-document view transitions between the landing and legal pages. Only
 * the content columns (and footers) are named: everything behind them (wall, shade,
 * wordmark, footer) is identical on both pages — wall.js phases the drift to
 * the clock — so the root swaps instantly and invisibly while the old column
 * fades out and the new one rises in. Pages render-block on #footer
 * (<link rel="expect">) so the new snapshot is never a half-parsed page.
 */

@view-transition {
  navigation: auto;
}

.hero {
  view-transition-name: content-home;
}

.legal {
  view-transition-name: content-legal;
}

/* The footer sits in a different place on each page, so it fades with the
   page's content instead of jumping. */
.page:has(.hero) .footer {
  view-transition-name: footer-home;
}

.page:has(.legal) .footer {
  view-transition-name: footer-legal;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

::view-transition-group(*) {
  animation-duration: 0s;
}

::view-transition-old(content-home),
::view-transition-old(content-legal),
::view-transition-old(footer-home),
::view-transition-old(footer-legal) {
  animation: 160ms cubic-bezier(0.4, 0, 1, 1) both content-out;
}

::view-transition-new(content-home),
::view-transition-new(content-legal),
::view-transition-new(footer-home),
::view-transition-new(footer-legal) {
  animation: 320ms cubic-bezier(0.22, 1, 0.36, 1) 150ms both content-in;
}

@keyframes content-out {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes content-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
