/* ==========================================================================
   Aurora — web presence
   The look is lifted straight from the app: a deep indigo night sky, a luminous
   aurora curtain sweeping teal → cyan → lavender, a faint star field, and a
   mountain-silhouette horizon. Dark is the native, on-brand mode; a soft
   twilight light mode is provided for readability.
   Accent colors are the exact "Aurora Coast" palette tokens from
   Aurora/SceneModel/MoodLibrary.swift.
   ========================================================================== */

:root {
  color-scheme: dark light;

  /* Aurora Coast palette (MoodLibrary.swift) — the signature scene */
  --aurora-green: #7ee8b0;
  --aurora-cyan: #5fc4d8;
  --aurora-violet: #9d8fe8;
  --aurora-mist: #b8e8dc;
  --aurora-blue: #6e9ac8;
  --aurora-snow: #dcf2e8;

  /* The curtain, as a reusable sweep */
  --curtain: linear-gradient(
    100deg,
    var(--aurora-green) 0%,
    var(--aurora-cyan) 34%,
    var(--aurora-mist) 50%,
    var(--aurora-violet) 78%,
    var(--aurora-blue) 100%
  );

  /* Semantic roles — dark (native) */
  --bg: #0a0e1c;
  --bg-deep: #070a15;
  --surface: #121830;
  --surface-2: #161d38;
  --text: #e8edfb;
  --muted: #9aa6c8;
  --border: #232c4c;
  --hairline: #2b355a;
  --accent: var(--aurora-cyan);
  --accent-ink: #86d6e6;
  --accent-strong: var(--aurora-green);
  --glow: rgba(95, 196, 216, 0.16); /* aurora light behind the header */
  --star: rgba(220, 242, 232, 0.7);

  --maxw: 46rem;
  --radius: 16px;
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype",
    Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
}

/* Soft twilight light mode — dawn over the same sky */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef2fb;
    --bg-deep: #e4eaf7;
    --surface: #ffffff;
    --surface-2: #f5f8ff;
    --text: #1a2140;
    --muted: #5b6488;
    --border: #d6ddf0;
    --hairline: #c8d2ea;
    --accent: #2f8ea6;
    --accent-ink: #24788d;
    --accent-strong: #2f9e77;
    --glow: rgba(95, 150, 216, 0.16);
    --star: rgba(120, 140, 190, 0.55);
  }
}

/* Explicit theme overrides (viewer toggle stamps data-theme on :root) */
:root[data-theme="dark"] {
  --bg: #0a0e1c;
  --bg-deep: #070a15;
  --surface: #121830;
  --surface-2: #161d38;
  --text: #e8edfb;
  --muted: #9aa6c8;
  --border: #232c4c;
  --hairline: #2b355a;
  --accent: var(--aurora-cyan);
  --accent-ink: #86d6e6;
  --accent-strong: var(--aurora-green);
  --glow: rgba(95, 196, 216, 0.16);
  --star: rgba(220, 242, 232, 0.7);
}
:root[data-theme="light"] {
  --bg: #eef2fb;
  --bg-deep: #e4eaf7;
  --surface: #ffffff;
  --surface-2: #f5f8ff;
  --text: #1a2140;
  --muted: #5b6488;
  --border: #d6ddf0;
  --hairline: #c8d2ea;
  --accent: #2f8ea6;
  --accent-ink: #24788d;
  --accent-strong: #2f9e77;
  --glow: rgba(95, 150, 216, 0.16);
  --star: rgba(120, 140, 190, 0.55);
}

* { box-sizing: border-box; }

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

/* 100vw includes the scrollbar gutter on some platforms; the full-bleed scene
   strip may overshoot by a few px there. Clip instead of growing the page. */
body { overflow-x: clip; }

body {
  margin: 0;
  background-color: var(--bg);
  /* Aurora glow rising behind the header + a faint dawn deepening at the foot,
     echoing the icon's luminous curtain over a dark horizon. */
  background-image:
    radial-gradient(130% 62% at 50% -10%, var(--glow) 0%, transparent 60%),
    radial-gradient(120% 55% at 82% -4%, rgba(157, 143, 232, 0.1) 0%, transparent 55%),
    linear-gradient(180deg, transparent 60%, var(--bg-deep) 100%);
  background-repeat: no-repeat;
  background-attachment: fixed, fixed, fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 17.5px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.15rem, 5vw, 2rem) 5rem;
}

/* Links: aurora cyan, with a luminous underline that brightens on hover. */
a {
  color: var(--accent-ink);
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: var(--accent); }

/* --- Header ------------------------------------------------------------ */
.site-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding-bottom: 1.4rem;
  margin-bottom: 2.4rem;
  border-bottom: 1px solid var(--hairline);
}
.site-head .mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: block;
  box-shadow: 0 1px 8px rgba(95, 196, 216, 0.25);
}
.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.28rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}
/* The brand dot glows like the crossing point of the curtain. */
.brand-dot {
  background: var(--curtain);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.site-head nav {
  margin-left: auto;
  display: flex;
  gap: 1.25rem;
  font-size: 0.95rem;
}
.site-head nav a { color: var(--muted); text-decoration: none; }
.site-head nav a:hover { color: var(--text); }

/* --- Typography -------------------------------------------------------- */
h1, h2, h3 { text-wrap: balance; }

h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}
h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 2.8rem 0 0.7rem;
  /* Each section opens with a short aurora-gradient tick. */
  padding-top: 1.6rem;
  position: relative;
}
h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2.4rem;
  height: 3px;
  background: var(--curtain);
  border-radius: 3px;
}
h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  margin: 1.6rem 0 0.35rem;
}

.meta {
  color: var(--muted);
  font-size: 0.94rem;
  letter-spacing: 0.01em;
  margin: 0 0 2rem;
}

p { margin: 0.75rem 0; }
ul { margin: 0.7rem 0; padding-left: 0; list-style: none; }
li {
  position: relative;
  margin: 0.5rem 0;
  padding-left: 1.35rem;
}
/* A small luminous "star" marker instead of a default bullet. */
li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.66em;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 6px color-mix(in srgb, var(--accent-strong) 70%, transparent);
}
strong { font-weight: 650; color: var(--text); }
code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.86em;
  background: var(--surface-2);
  color: var(--accent-ink);
  padding: 0.1em 0.4em;
  border-radius: 5px;
}

.lede {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  line-height: 1.5;
  color: var(--muted);
  font-weight: 400;
  margin: 0.4rem 0 0;
}

/* --- Callout / TL;DR --------------------------------------------------- */
.callout {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem 1.25rem 1.55rem;
  margin: 1.6rem 0 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
/* Aurora edge instead of a flat colored border. */
.callout::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--curtain);
}
.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }
.callout p:first-child strong {
  font-family: var(--serif);
  font-size: 1.05rem;
}

/* --- Hero (index) ------------------------------------------------------ */
.hero { padding: 1.5rem 0 0.5rem; }
.eyebrow {
  display: block;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 0.9rem;
}
.hero-mark {
  width: clamp(104px, 26vw, 148px);
  height: clamp(104px, 26vw, 148px);
  border-radius: 23%; /* iOS-style superellipse approximation */
  display: block;
  margin-bottom: 1.8rem;
  box-shadow: 0 14px 44px -10px rgba(95, 196, 216, 0.4),
    0 4px 14px rgba(0, 0, 0, 0.4);
}
/* Aurora runs through the headline itself. */
.aurora-text {
  background: var(--curtain);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pill {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  margin-bottom: 1.4rem;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.1rem;
  margin: 2rem 0 1.6rem;
}
/* Apple's badge artwork is the one sanctioned non-scene graphic on the site. */
.store-badge {
  display: inline-block;
  border-radius: 10px;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.store-badge img { display: block; height: 50px; width: auto; }
.store-badge:hover {
  transform: translateY(-1px);
  filter: drop-shadow(0 4px 16px rgba(95, 196, 216, 0.35));
}
.store-badge:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
  padding: 0.68rem 1.3rem;
  border-radius: 11px;
  border: 1px solid var(--border);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.btn-ghost { color: var(--text); background: var(--surface); }
.btn-ghost:hover { transform: translateY(-1px); border-color: var(--accent); }

/* --- Watch it move (index) --------------------------------------------- */
/* A full-bleed strip of living scenes; resting position aligns with the
   reading column, but the frames slide out to the viewport edges. */
.scenes {
  /* Distance from the reading column's content edge to the viewport edge.
     A real length (not %) so scroll-padding computes the same value. */
  --bleed: calc(max((100vw - var(--maxw)) / 2, 0px) + clamp(1.15rem, 5vw, 2rem));
  display: flex;
  gap: 1.1rem;
  margin: 1.9rem 0 0.4rem;
  margin-inline: calc(var(--bleed) * -1);
  padding-inline: var(--bleed);
  padding-block: 0.5rem 1rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--bleed);
  scrollbar-width: thin;
  scrollbar-color: var(--hairline) transparent;
}
.scenes:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.scene {
  flex: 0 0 auto;
  width: clamp(186px, 62vw, 246px);
  margin: 0;
  scroll-snap-align: start;
}
.scene-frame {
  aspect-ratio: 600 / 1304;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  /* Scenes emit their own light onto the page (Emitted-Light Rule). */
  box-shadow: 0 12px 36px -14px rgba(95, 196, 216, 0.35),
    0 2px 10px rgba(0, 0, 0, 0.35);
  transform: translateZ(0);
}
.scene-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scene figcaption {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--muted);
  margin-top: 0.7rem;
  padding-inline: 0.2rem;
}
/* The scenes breathe: a slow drift inside each frame, out of phase so the
   strip never moves in lockstep. Stills stay fully visible without it. */
@media (prefers-reduced-motion: no-preference) {
  .scene-frame img {
    animation: scene-drift 38s ease-in-out infinite alternate;
  }
  /* Out-of-phase starts (nth-child, not inline styles: CSP is style-src 'self') */
  .scene:nth-child(2) .scene-frame img { animation-delay: -9.5s; }
  .scene:nth-child(3) .scene-frame img { animation-delay: -19s; }
  .scene:nth-child(4) .scene-frame img { animation-delay: -28.5s; }
  .scene:nth-child(5) .scene-frame img { animation-delay: -38s; }
  @keyframes scene-drift {
    from { transform: scale(1.05) translateY(0.9%); }
    to { transform: scale(1.13) translateY(-0.9%); }
  }
}

/* --- Feature rows: control panel & Live Activities (index) ------------- */
.feature {
  display: grid;
  gap: 1.7rem;
  align-items: center;
  margin: 2.6rem 0;
}
.feature h2 { margin-top: 0; }
.feature-text p { margin-bottom: 0; }
.feature-shot {
  width: min(62vw, 236px);
  flex: none;
  scroll-snap-align: none;
}
.feature-duo {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}
.feature-duo .feature-shot {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  max-width: 176px;
}
/* The pair sits like two moments, not a grid: the second hangs lower. */
.feature-duo .feature-shot:last-child { margin-top: 1.7rem; }
/* UI moments hold still; only living scenes drift. */
.feature-shot .scene-frame img { animation: none; }

@media (min-width: 640px) {
  .feature {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2.4rem;
  }
  .feature-flip { grid-template-columns: auto minmax(0, 1fr); }
  .feature-flip .feature-media { order: -1; }
}

/* --- Gesture list (index) --------------------------------------------- */
.gestures { margin: 1.4rem 0 0.5rem; }
.gesture {
  display: flex;
  gap: 0.9rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--hairline);
}
.gesture:last-child { border-bottom: 0; }
.gesture dt {
  flex: 0 0 auto;
  min-width: 8.5rem;
  font-weight: 650;
  color: var(--text);
}
.gesture dd { margin: 0; color: var(--muted); }

/* Thin "horizon" divider, echoing the mountain line in the icon. */
.matline {
  border: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--hairline) 20%,
    var(--hairline) 80%,
    transparent
  );
  margin: 2.4rem 0;
}

/* --- Footer ------------------------------------------------------------ */
footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
  align-items: center;
}
.footer-links { margin-left: auto; display: flex; gap: 1.2rem; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }

.disclaimer {
  font-family: var(--serif);
  font-size: 0.98rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.55;
}

/* --- Entrance motion: one calm, staggered settle on load --------------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal > * {
    opacity: 0;
    transform: translateY(10px);
    animation: settle 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  }
  .reveal > *:nth-child(1) { animation-delay: 0.02s; }
  .reveal > *:nth-child(2) { animation-delay: 0.09s; }
  .reveal > *:nth-child(3) { animation-delay: 0.16s; }
  .reveal > *:nth-child(4) { animation-delay: 0.23s; }
  .reveal > *:nth-child(5) { animation-delay: 0.30s; }
  .reveal > *:nth-child(6) { animation-delay: 0.37s; }
  .reveal > *:nth-child(7) { animation-delay: 0.44s; }
  .reveal > *:nth-child(8) { animation-delay: 0.51s; }
  @keyframes settle {
    to { opacity: 1; transform: none; }
  }
}
