/* Landing page only. privacy.html and terms.html keep styles.css.
   Colours are the app's own tokens (Moment/Core/Theme.swift). */
@font-face {
  font-family: "MuseoModerno";
  src: url("/museomoderno.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F4EFE8;
  --text: #2A2320;
  --muted: #6E625A;
  --faint: #C9BFB5;
  --accent: #BD4016;
  --green: #137A38;
  --bezel: #1D1B19;
  --edge: #4A4541;
  --shadow: rgba(74, 46, 24, 0.22);
  --grain: 0.05;
  --gutter: clamp(20px, 5vw, 64px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F0E0D;
    --text: #FAF7F2;
    --muted: #A8A29B;
    --faint: #57524C;
    --accent: #D47454;
    --green: #4ADE80;
    --bezel: #050505;
    --edge: #3A3633;
    --shadow: rgba(0, 0, 0, 0.6);
    --grain: 0.035;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* The app's paper grain, carried over. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: var(--grain);
  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='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--accent); text-underline-offset: 3px; }

h1, h2 {
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

.muted { color: var(--muted); }

/* Header */
.top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 28px var(--gutter);
}

.wordmark {
  font-family: "MuseoModerno", ui-rounded, system-ui, sans-serif;
  font-weight: 500;
  font-size: 26px;
  line-height: 1;
  color: var(--accent);
  text-decoration: none;
}

/* Hero */
.hero {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: center;
  gap: 32px;
  padding: 112px var(--gutter) 64px;
  max-width: 1320px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(44px, 6.4vw, 92px);
  letter-spacing: -0.04em;
  line-height: 0.98;
  max-width: 9.5ch;
}

/* The headline on a shared Moment's page (set by _worker.js): "Zee shared a moment with you".
   Steps down from the brand headline, since the card beside it is the thing to look at. */
.hero h1.shared {
  font-size: clamp(34px, 4.6vw, 64px);
  letter-spacing: -0.03em;
  line-height: 1.08;
  max-width: 14ch;
  overflow-wrap: anywhere;
}
/* A shared Moment's page is just the hero: let it fill the screen without the scroll cue below. */
.shared-page .hero { min-height: calc(100svh - 120px); }

/* A shared Moment's own card, in the deck's place (_worker.js). Drawn the way the app draws a
   card without its photo: the Moment's colour as a lit diagonal wash, white type over it. Sized
   and tilted like the deck's top card so the hero keeps its shape. */
.shared-card {
  --sc: #BD4016;
  position: relative;
  width: min(100%, 470px);
  aspect-ratio: 4 / 3;
  justify-self: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(18px, 3vw, 28px);
  border-radius: 7%/9%;
  color: #fff;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, 0.16), transparent 60%),
    linear-gradient(135deg, var(--sc), color-mix(in srgb, var(--sc) 55%, #000));
  box-shadow: 0 24px 48px -12px var(--shadow), 0 2px 6px rgba(0, 0, 0, 0.18);
  transform: rotate(-2deg);
  overflow: hidden;
}
.sc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: clamp(15px, 1.4vw, 18px);
  font-weight: 600;
}
.sc-host { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.sc-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 2px var(--accent);
}
.sc-left {
  flex: none;
  padding: 0.35em 0.8em;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  font-size: 0.85em;
}
/* A photo Moment: square like in the app, with the picture's place held by a note that it's in
   the app. A quiet dashed frame over the wash, so it reads as "something goes here", not an error. */
.shared-card.has-photo { aspect-ratio: 1; }
.sc-photo {
  flex: 1;
  margin: 18px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 18px;
  border: 1.5px dashed rgba(255, 255, 255, 0.38);
  background: rgba(0, 0, 0, 0.14);
  font-size: clamp(14px, 1.3vw, 16px);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}
.sc-photo svg { opacity: 0.85; }

.sc-title {
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lede {
  margin-top: 28px;
  font-size: clamp(19px, 1.7vw, 23px);
  line-height: 1.45;
  color: var(--muted);
  max-width: 25ch;
}

.lede span { color: var(--text); font-weight: 600; }

/* What an invited visitor should do next. Hidden unless home.js fills it. */
.notice {
  margin-top: 24px;
  padding: 12px 16px;
  max-width: 36ch;
  border: 1px solid var(--faint);
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}
.notice[hidden] { display: none; }

/* A deck of real Moments. The PNGs carry their own corners and shadow. data-pos is a card's
   place in the deck: 0 on top, 1 and 2 peeking out behind, the rest waiting out of sight. */
.deck {
  position: relative;
  width: min(100%, 470px);
  aspect-ratio: 1;
  justify-self: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.deck .card {
  position: absolute;
  inset: 0;
  width: 100%;
  transform-origin: 50% 70%;
  transition: transform 0.9s var(--ease), opacity 0.7s var(--ease);
}

.card[data-pos="0"] { transform: rotate(-2deg); z-index: 5; }
.card[data-pos="1"] { transform: translate(6%, -4%) rotate(5deg) scale(0.95); z-index: 4; }
.card[data-pos="2"] { transform: translate(-6%, -6%) rotate(-7deg) scale(0.9); z-index: 3; }
.card:not([data-pos="0"]):not([data-pos="1"]):not([data-pos="2"]) {
  transform: translate(0, -8%) rotate(1deg) scale(0.86);
  opacity: 0;
  z-index: 1;
}

/* Dealt off the top, out to the side. */
.deck .card.is-leaving {
  transform: translate(52%, 10%) rotate(16deg) scale(0.98);
  opacity: 0;
  z-index: 6;
  transition: transform 0.75s cubic-bezier(0.5, 0, 0.75, 0), opacity 0.6s ease-in 0.1s;
}

.js .deck {
  opacity: 0;
  translate: 0 18px;
  transition: opacity 0.9s var(--ease), translate 1.1s var(--ease);
}

.js .is-ready .deck { opacity: 1; translate: 0 0; }

/* Story: a pinned phone that changes screen as you scroll past each line. */
.story {
  position: relative;
  height: calc(var(--beats) * 90svh + 10svh);
}

.story-pin {
  position: sticky;
  top: 0;
  height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(32px, 8vw, 140px);
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.beats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 22px;
  max-width: 470px;
}

.beats li { cursor: pointer; }

.beats h2 {
  font-size: clamp(24px, 2.3vw, 32px);
  color: var(--faint);
  transition: color 0.5s var(--ease);
}

.beats p {
  color: var(--muted);
  font-size: 18px;
  max-width: 34ch;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.6s var(--ease), opacity 0.5s var(--ease), margin 0.6s var(--ease);
}

.beats li.is-active h2 { color: var(--text); }
.beats li.is-active p { max-height: 6em; opacity: 1; margin-top: 12px; }

.phone {
  --h: min(78svh, 760px);
  height: var(--h);
  aspect-ratio: 1320 / 2868;
  box-sizing: content-box;
  padding: calc(var(--h) * 0.016);
  border-radius: calc(var(--h) * 0.078);
  background: var(--bezel);
  box-shadow:
    0 0 0 1.5px var(--edge),
    0 2px 4px rgba(0, 0, 0, 0.08),
    0 40px 80px -24px var(--shadow);
}

.screen {
  position: relative;
  height: 100%;
  border-radius: calc(var(--h) * 0.064);
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}

.shot {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.55s var(--ease), transform 0.7s var(--ease);
}

.shot img { width: 100%; height: 100%; object-fit: cover; }

.shot.sheet { transform: translateY(7%); }
.shot.is-active { opacity: 1; transform: none; }

/* Home Screen: two rows of widgets drifting past in opposite directions. */
.glance {
  padding: 6vh 0 4vh;
}

.glance-text {
  text-align: center;
  padding: 0 var(--gutter);
  margin-bottom: clamp(40px, 6vh, 64px);
}

.glance h2 {
  font-size: clamp(32px, 4vw, 54px);
  letter-spacing: -0.035em;
  margin: 0 auto;
  max-width: 16ch;
}

.glance-text p {
  margin-top: 14px;
  font-size: clamp(18px, 1.6vw, 21px);
  color: var(--muted);
}

.rails {
  display: grid;
  gap: clamp(16px, 2vw, 24px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.rail { overflow: hidden; padding: 10px 0 28px; margin-bottom: -28px; }

.track {
  display: flex;
  gap: clamp(16px, 2vw, 24px);
  width: max-content;
  will-change: transform;
}

.track picture { display: contents; }

.tile {
  flex: none;
  width: clamp(124px, 12.5vw, 172px);
  border-radius: 23%;
  box-shadow: 0 18px 36px -20px var(--shadow);
}

.js .reveal {
  opacity: 0;
  translate: 0 28px;
  transition: opacity 0.9s var(--ease), translate 1.1s var(--ease);
}

.js .reveal.is-in { opacity: 1; translate: 0 0; }

/* Sign-off */
.hello {
  text-align: center;
  padding: 12vh var(--gutter) 12vh;
  display: grid;
  justify-items: center;
  gap: 6px;
}

.appicon {
  width: 88px;
  margin-bottom: 22px;
  filter: drop-shadow(0 12px 18px var(--shadow));
}

.hello-line {
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 18px;
  text-wrap: balance;
}

/* Apple's own badge, unaltered (their artwork rules), at a size that clears the 40px minimum. */
.store {
  display: block;
  width: fit-content;
  margin-top: 44px;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s var(--ease);
}
.store:hover { transform: translateY(-1px); }
.store:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.store img { display: block; width: auto; height: 48px; }
.hello .store { margin: 0 0 28px; }
.appicon-link { display: block; border-radius: 22%; }
.appicon-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.hello .muted { font-size: 15px; line-height: 1.6; }
.hello a { text-decoration: none; font-weight: 600; }
.hello a:hover { text-decoration: underline; }

/* Footer */
.bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 24px var(--gutter) calc(28px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 13px;
  max-width: 1320px;
  margin: 0 auto;
}

.bottom p { display: flex; gap: 20px; }
.bottom a { color: var(--muted); text-decoration: none; }
.bottom a:hover { color: var(--accent); }

/* Phones and narrow windows */
@media (max-width: 820px) {
  .top { padding-top: 22px; }

  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-top: 104px;
    padding-bottom: 24px;
    gap: 44px;
  }

  .lede { margin-top: 20px; }

  .deck { width: min(80vw, 360px); margin-top: 8px; }

  /* The shared Moment's card at the deck's phone size, tilt included, so it stays on screen. */
  .shared-card { width: min(80vw, 340px); margin-top: 4px; }
  .shared-page .hero { min-height: 0; gap: 36px; }

  /* Phone on top, one line underneath it. */
  .story-pin {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-content: center;
    justify-items: center;
    gap: 26px;
  }

  .phone { --h: min(62svh, 600px); order: -1; }

  .beats {
    display: grid;
    grid-template-areas: "only";
    text-align: center;
    max-width: 340px;
    min-height: 7.5em;
  }

  .beats li {
    grid-area: only;
    opacity: 0;
    translate: 0 10px;
    transition: opacity 0.45s var(--ease), translate 0.6s var(--ease);
    pointer-events: none;
  }

  .beats li.is-active { opacity: 1; translate: 0 0; }
  .beats h2 { font-size: 25px; color: var(--text); }
  .beats p { font-size: 16px; margin: 8px auto 0; }
  .beats li p, .beats li.is-active p { max-height: none; opacity: 1; margin-top: 8px; }

  .glance { padding-top: 12vh; }
  .glance h2 { max-width: 12ch; }

  .bottom { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .js .deck, .js .reveal { opacity: 1; translate: none; transition: none; }
  .shot, .shot.sheet { transition: opacity 0.2s linear; transform: none; }
  .beats li, .beats h2, .beats p { transition: none; }
}
