/* Civix: the app's own colours, type and skyline. Dark by default, as the
   app is; light where the reader's device asks for it. */

:root {
  --bg: #002336;
  --surface: #07314a;
  --surface-2: #0d3c57;
  --border: #1c4c68;
  --ink: #eaf4f8;
  --ink-soft: #a3bcca;
  --accent: #3ccbdd;
  --accent-soft: #0b4560;
  --on-accent: #002331;
  --gold: #f5b544;
  --skyline: url("assets/skyline-dark.jpg");
  --skyline-strength: 0.55;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* Light: where the device asks for it and the visitor has not chosen dark,
   or where the visitor has chosen light with the switch in the top bar. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f7f9;
    --surface: #ffffff;
    --surface-2: #e8f0f4;
    --border: #dae5eb;
    --ink: #0b2233;
    --ink-soft: #4e6575;
    --accent: #07759a;
    --accent-soft: #ddf0f6;
    --on-accent: #ffffff;
    --gold: #9a5c00;
    --skyline: url("assets/skyline-light.jpg");
    --skyline-strength: 0.7;
    --shadow: 0 24px 60px rgba(11, 34, 51, 0.18);
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f3f7f9;
  --surface: #ffffff;
  --surface-2: #e8f0f4;
  --border: #dae5eb;
  --ink: #0b2233;
  --ink-soft: #4e6575;
  --accent: #07759a;
  --accent-soft: #ddf0f6;
  --on-accent: #ffffff;
  --gold: #9a5c00;
  --skyline: url("assets/skyline-light.jpg");
  --skyline-strength: 0.7;
  --shadow: 0 24px 60px rgba(11, 34, 51, 0.18);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }

h1, h2 {
  font-family: Lora, Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.12;
  margin: 0;
}
h1 { font-size: clamp(2.6rem, 7vw, 4.4rem); }
h1 span { color: var(--gold); }
h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h3 { font-size: 1.12rem; font-weight: 700; margin: 0 0 6px; }

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ── Top bar ─────────────────────────────────────────────────────────── */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px clamp(16px, 5vw, 48px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.brand img { border-radius: 12px; }

.bar nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); }
.bar nav a {
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}
.bar nav a:hover { color: var(--ink); }
.bar nav .pill {
  padding: 8px 16px;
  border: 1.4px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-weight: 600;
}
.bar nav .pill:hover { background: var(--accent); color: var(--on-accent); }

/* The theme switch: Day, Night, or the same as the device. */
.theme {
  display: inline-flex;
  padding: 3px;
  border: 1.4px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.theme button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.theme button:hover { color: var(--ink); }
.theme button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.theme svg { width: 17px; height: 17px; fill: currentColor; }

@media (max-width: 560px) {
  .bar nav a:not(.pill) { display: none; }
}

/* ── Hero ────────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  max-width: 1160px;
  margin: 0 auto;
  padding: clamp(40px, 8vw, 96px) clamp(16px, 5vw, 48px) clamp(56px, 9vw, 120px);
  isolation: isolate;
}

/* The app's skyline, on the floor of the hero. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -1;
  background: var(--skyline) center bottom / cover no-repeat;
  opacity: var(--skyline-strength);
  mask-image: linear-gradient(to bottom, transparent 0, #000 45%, #000 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 45%, #000 85%, transparent 100%);
}

.lead {
  max-width: 34rem;
  margin: 20px 0 28px;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 2vw, 1.22rem);
}

.stores { display: flex; flex-wrap: wrap; gap: 12px; }

.store {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 172px;
  padding: 9px 18px 9px 14px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.15;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.store:hover { transform: translateY(-2px); box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 35%, transparent); }
.store svg { width: 26px; height: 26px; fill: currentColor; flex: none; }
.store small { display: block; font-size: 0.68rem; font-weight: 500; opacity: 0.85; }

.hint { margin: 16px 0 0; color: var(--ink-soft); font-size: 0.92rem; }

.hero-phone { display: flex; justify-content: center; }

.phone {
  width: min(300px, 78vw);
  padding: 9px;
  border-radius: 44px;
  background: linear-gradient(145deg, #1a2b36, #05141d);
  box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(255, 255, 255, 0.12);
}
.phone img { border-radius: 36px; width: 100%; }

.hero-phone .phone { transform: rotate(2.5deg); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .lead { margin-inline: auto; }
  .stores { justify-content: center; }
  .hero-phone .phone { transform: none; }
}

/* ── Sections ────────────────────────────────────────────────────────── */

.section {
  max-width: 1160px;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 88px) clamp(16px, 5vw, 48px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.card {
  position: relative;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  overflow: hidden;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%);
  pointer-events: none;
}
.card p { margin: 0; color: var(--ink-soft); font-size: 0.97rem; }

.icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--a), var(--b));
  box-shadow: 0 6px 14px color-mix(in srgb, var(--a) 40%, transparent);
}
.icon svg { width: 26px; height: 26px; fill: #fff; }

/* ── Hero promise, facts ─────────────────────────────────────────────── */

.promise {
  margin: 18px 0 0;
  color: var(--ink);
  font-size: clamp(1.2rem, 2.6vw, 1.5rem);
  font-weight: 600;
}
.promise + .lead { margin-top: 10px; }

.facts { padding-top: 0; }
.fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
  margin-top: 28px;
}
.fact {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  overflow: hidden;
}
.fact::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%);
  pointer-events: none;
}
.fact .icon { flex: none; margin: 0; }
.fact strong {
  display: block;
  color: var(--gold);
  font: 700 1.9rem/1.1 Lora, Georgia, serif;
}
.fact span { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 0.93rem; line-height: 1.35; }

/* ── Features, each beside its screen ────────────────────────────────── */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(24px, 6vw, 80px);
  margin-top: clamp(40px, 6vw, 72px);
}
.feature.flip .feature-text { order: 2; }
.feature h3 { font: 700 clamp(1.4rem, 3vw, 1.8rem)/1.2 Lora, Georgia, serif; margin-bottom: 10px; }
.feature p { max-width: 32rem; margin: 0; color: var(--ink-soft); }
.feature .phone { width: min(250px, 66vw); border-radius: 38px; padding: 7px; }
.feature .phone img { border-radius: 31px; }
.feature + .grid { margin-top: clamp(40px, 6vw, 72px); }

@media (max-width: 720px) {
  .feature { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .feature.flip .feature-text { order: 0; }
  .feature .icon { margin-inline: auto; }
  .feature p { margin-inline: auto; }
}

/* ── Screens ─────────────────────────────────────────────────────────── */

.shots {
  display: flex;
  gap: clamp(16px, 3vw, 28px);
  margin: 32px calc(-1 * clamp(16px, 5vw, 48px)) 0;
  padding: 8px clamp(16px, 5vw, 48px) 24px;
  overflow-x: auto;
  /* Sideways only: the screens rising into place must not make it scroll
     up and down as well. */
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  /* The bar keeps its room, so nothing shifts, but is drawn only while the
     pointer is over the strip (or it has keyboard focus). */
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.shots:hover, .shots:focus-visible {
  scrollbar-color: color-mix(in srgb, var(--ink-soft) 55%, transparent) transparent;
}
/* Browsers without scrollbar-color (older Safari). */
@supports not (scrollbar-color: auto) {
  .shots::-webkit-scrollbar { height: 8px; }
  .shots::-webkit-scrollbar-thumb { border-radius: 4px; background: transparent; }
  .shots:hover::-webkit-scrollbar-thumb, .shots:focus-visible::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--ink-soft) 55%, transparent);
  }
}
.shots figure { flex: none; margin: 0; scroll-snap-align: center; }
.shots .phone { width: min(240px, 62vw); border-radius: 36px; padding: 7px; }
.shots .phone img { border-radius: 30px; }
.shots figcaption {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
}

/* ── Document pages (privacy, terms) ─────────────────────────────────── */

.doc {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(32px, 6vw, 72px) clamp(16px, 5vw, 48px);
}
.doc h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
.doc h2 { margin-top: 36px; font-size: 1.35rem; }
.doc p, .doc li { color: var(--ink-soft); }
.doc li { margin-bottom: 8px; }
.doc strong { color: var(--ink); }
.doc .updated { margin-top: 8px; font-size: 0.9rem; }

/* ── Get the app ─────────────────────────────────────────────────────── */

.get-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(24px, 5vw, 56px);
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
    var(--surface);
}
.app-icon { border-radius: 18px; margin-bottom: 18px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3); }
.get-text p { margin: 10px 0 22px; color: var(--ink-soft); }

.qrs { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.qr {
  position: relative;
  margin: 0;
  padding: 12px 12px 8px;
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}
.qr img { width: min(168px, 60vw); }
.qr figcaption { color: #0b2233; font-size: 0.85rem; font-weight: 600; }

@media (max-width: 720px) {
  .get-card { grid-template-columns: 1fr; text-align: center; }
  .app-icon { margin-inline: auto; }
  .get-card .stores { justify-content: center; }
  .qrs { justify-self: center; }
}

/* ── Footer ──────────────────────────────────────────────────────────── */

footer {
  padding: 40px clamp(16px, 5vw, 48px) 56px;
  border-top: 1px solid var(--border);
  color: var(--ink-soft);
  text-align: center;
}
footer .brand { font-size: 1.3rem; }
footer p { margin: 8px 0 0; }
footer .fine { font-size: 0.86rem; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin-top: 18px; }
.foot-links a { color: var(--ink-soft); font-size: 0.93rem; text-decoration: none; }
.foot-links a:hover { color: var(--accent); }
.social { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.social a {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--ink-soft);
}
.social a:hover { border-color: var(--accent); color: var(--accent); }
.social svg { width: 17px; height: 17px; fill: currentColor; }

/* The last line of the footer: the copyright, and at the far right the
   AmPa mark, as on AmPa's own pages. */
.foot-end {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1160px;
  margin: 22px auto 0;
}
.foot-end .fine { margin: 0; }
.byampa {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.byampa span:last-child { color: var(--ink); font-size: 0.95rem; font-weight: 800; letter-spacing: 0.06em; }
.ampa-logo { width: 46px; height: 46px; overflow: visible; }
.ampa-orbit  { transform-origin: 32px 32px; animation: ampa-cw 14s linear infinite; }
.ampa-orbit2 { transform-origin: 32px 32px; animation: ampa-ccw 9s linear infinite; }
.ampa-shine  { animation: ampa-sweep 3.6s ease-in-out infinite; }
.ampa-spark  { transform-origin: 52px 15px; animation: ampa-twinkle 2.2s ease-in-out infinite; }
.ampa-spark.s2 { transform-origin: 11px 50px; animation-delay: 1.1s; }
@keyframes ampa-cw { to { transform: rotate(360deg); } }
@keyframes ampa-ccw { to { transform: rotate(-360deg); } }
@keyframes ampa-sweep { 0% { transform: translateX(0) skewX(-20deg); } 55%, 100% { transform: translateX(110px) skewX(-20deg); } }
@keyframes ampa-twinkle { 0%, 100% { opacity: 0.2; transform: scale(0.5); } 50% { opacity: 1; transform: scale(1.2) rotate(45deg); } }

@media (max-width: 570px) {
  .foot-end { flex-direction: column; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ── Motion ──────────────────────────────────────────────────────────
   Things rise into place as they come into view, and each phone grows to
   full size as the page scrolls it up the screen. Only with scripting on
   (the "js" class), so the page is whole without it; and not at all for a
   visitor who has asked for less motion. */

.js .reveal {
  opacity: 0;
  transform: translateY(36px);
  transition:
    opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 90ms);
  will-change: opacity, transform;
}
.js .reveal.in { opacity: 1; transform: none; }

/* The hero arrives on load: its lines one after another, the phone last. */
.js .hero-text > * { animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.js .hero-text > :nth-child(2) { animation-delay: 0.08s; }
.js .hero-text > :nth-child(3) { animation-delay: 0.16s; }
.js .hero-text > :nth-child(4) { animation-delay: 0.24s; }
.js .hero-text > :nth-child(5) { animation-delay: 0.32s; }
.js .hero-text > :nth-child(6) { animation-delay: 0.4s; }
.js .hero-phone { animation: arrive 1.3s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s both; }
@keyframes rise { from { opacity: 0; transform: translateY(28px); } }
@keyframes arrive { from { opacity: 0; transform: translateY(70px) scale(0.9); } }

/* Scroll-driven: --p runs 0 to 1 as the phone travels up the screen. */
.js .feature .phone {
  opacity: calc(0.25 + 0.75 * var(--p, 1));
  transform: translateY(calc((1 - var(--p, 1)) * 70px)) scale(calc(0.86 + 0.14 * var(--p, 1)));
  will-change: opacity, transform;
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .js .hero-text > *, .js .hero-phone { animation: none; }
  .js .feature .phone { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
  .store { transition: none; }
  .ampa-orbit, .ampa-orbit2, .ampa-shine, .ampa-spark { animation: none; }
}
