/* BaggedIt landing page — implements the "BaggedIt Welcome" Claude Design
   canvas. Deliberately dark-only: the landing commits to the app's dark
   palette as a brand statement, while the legal pages (style.css) stay
   theme-aware for readability. Palette mirrors apps/baggedit/constants/Colors.ts.

   The canvas's JS behaviours (Lottie mascot, IntersectionObserver reveals,
   rotating loading puns) are reproduced without scripts so the strict CSP in
   _headers holds: static mascot PNG, CSS scroll-driven animations, and a
   CSS keyframe pun cycler. */

:root {
  --bg: #111827;
  --bg-top: #0b1220;
  --bg-deep: #0b0f17;
  --surface: #1c2535;
  --border: #253347;
  --text: #e8edf5;
  --muted: #8fa3bc;
  --muted-bright: #b8c6d9;
  --blue: #5ba3c4;
  --coral: #e8877a;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -5%, rgba(91, 163, 196, 0.22), transparent 60%),
    radial-gradient(1000px 500px at 90% 10%, rgba(232, 135, 122, 0.14), transparent 60%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 40%) var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: clip;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--coral); }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ---- background art (map grid + contours, hero ridge) ---- */

.bg-pattern {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.55;
  z-index: -1;
}

.bg-ridge {
  position: absolute;
  top: 120px;
  left: 0;
  width: 100%;
  height: 480px;
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
}

/* ---- header ---- */

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
  padding-bottom: 20px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.brand img { width: 36px; height: 36px; border-radius: 9px; display: block; }

.brand span { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }

.strapline {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- shared bits ---- */

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
}

.badges { display: flex; gap: 14px; flex-wrap: wrap; }

.badge-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 20px;
  min-width: 150px;
}

.badge-btn:hover { border-color: var(--blue); }

.cta-band .badge-btn:hover { border-color: var(--coral); }

.badge-btn small {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.badge-btn strong { font-size: 18px; font-weight: 700; color: var(--text); }

/* Phone frames. --screen-w/--screen-h set per size variant. */

.phone {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 44px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
}

.phone .screen {
  width: var(--screen-w);
  height: var(--screen-h);
  border-radius: 34px;
  overflow: hidden;
  background: var(--surface);
}

.phone.sm { padding: 10px; border-radius: 36px; box-shadow: 0 20px 44px rgba(0, 0, 0, 0.4); }
.phone.sm .screen { border-radius: 28px; }

.phone.lg { --screen-w: 296px; --screen-h: 620px; }
.phone.sm { --screen-w: 230px; --screen-h: 482px; }

.screen img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- hero ---- */

.hero {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 56px;
  padding-top: 48px;
  padding-bottom: 72px;
}

.hero-copy { flex: 1 1 420px; min-width: 300px; }

.hero-copy .eyebrow { margin-bottom: 14px; }

.hero h1 {
  font-size: clamp(40px, 7.5vw, 60px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
}

.hero h1 .hl { box-shadow: inset 0 -12px 0 rgba(232, 135, 122, 0.4); }

.hero .lede {
  font-size: 19px;
  font-weight: 500;
  color: var(--muted-bright);
  margin: 0 0 30px;
  max-width: 44ch;
  text-wrap: pretty;
}

.hero-stats {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  margin: 0 0 30px;
}

.hero-stats strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
}

.hero-stats .accent strong { color: var(--blue); }

.hero-stats small {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Rotating "loading pun" line — the app's LOADING_PUNS, cycled in pure CSS.
   Eight puns × 2.8s each = 22.4s loop. */
.pun-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 26px;
  font-family: "SF Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.pun-line .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
  flex: none;
  animation: floaty 1.6s ease-in-out infinite;
}

.puns { position: relative; height: 1.5em; flex: 1; min-width: 0; overflow: hidden; }

.puns span {
  position: absolute;
  inset: 0;
  white-space: nowrap;
  opacity: 0;
  animation: pun-cycle 22.4s infinite;
}

.puns span:nth-child(2) { animation-delay: 2.8s; }
.puns span:nth-child(3) { animation-delay: 5.6s; }
.puns span:nth-child(4) { animation-delay: 8.4s; }
.puns span:nth-child(5) { animation-delay: 11.2s; }
.puns span:nth-child(6) { animation-delay: 14s; }
.puns span:nth-child(7) { animation-delay: 16.8s; }
.puns span:nth-child(8) { animation-delay: 19.6s; }

/* Each span owns 12.5% of the loop: fade in, hold, fade out. */
@keyframes pun-cycle {
  0% { opacity: 0; }
  1.5%, 10.5% { opacity: 1; }
  12.5%, 100% { opacity: 0; }
}

.rule { height: 1px; background: var(--border); }

/* ---- feature sections ---- */

.feature {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding-top: 72px;
  padding-bottom: 72px;
  background: radial-gradient(640px 320px at 15% 30%, rgba(91, 163, 196, 0.10), transparent 70%);
}

.feature.rev {
  flex-direction: row-reverse;
  background: radial-gradient(640px 320px at 85% 30%, rgba(232, 135, 122, 0.10), transparent 70%);
}

.feature .num {
  position: absolute;
  top: 24px;
  left: 32px;
  font-size: 100px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: rgba(91, 163, 196, 0.09);
  pointer-events: none;
}

.feature-copy { flex: 1 1 420px; min-width: 300px; position: relative; }

.feature-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.feature-head img { width: 56px; height: 56px; flex: none; }

.feature.rev .eyebrow { color: var(--coral); }

.feature h2 {
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin: 0 0 12px;
}

.feature h2 span { box-shadow: inset 0 -8px 0 rgba(91, 163, 196, 0.28); }

.feature.rev h2 span { box-shadow: inset 0 -8px 0 rgba(232, 135, 122, 0.28); }

.feature p {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--muted-bright);
  margin: 0;
  max-width: 46ch;
  text-wrap: pretty;
}

/* Scroll reveal: sections rise in and the tilted phones straighten, matching
   the canvas's IntersectionObserver behaviour. Scroll-driven animations only —
   browsers without support (and reduced-motion users) see the settled state. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .feature {
      animation: rise-in linear both;
      animation-timeline: view();
      animation-range: entry 5% entry 45%;
    }
    .feature .phone {
      animation: untilt-l linear both;
      animation-timeline: view();
      animation-range: entry 5% entry 60%;
    }
    .feature.rev .phone { animation-name: untilt-r; }
  }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(36px); }
  to { opacity: 1; transform: none; }
}

@keyframes untilt-l {
  from { transform: rotate(-3deg); }
  to { transform: none; }
}

@keyframes untilt-r {
  from { transform: rotate(3deg); }
  to { transform: none; }
}

/* ---- CTA band ---- */

.cta-band {
  background:
    radial-gradient(700px 340px at 50% 0%, rgba(91, 163, 196, 0.18), transparent 70%),
    var(--surface);
  border-top: 1px solid var(--border);
}

.cta-band .wrap {
  max-width: 760px;
  padding-top: 80px;
  padding-bottom: 80px;
  text-align: center;
}

.cta-band .mascot {
  width: 96px;
  height: 96px;
  margin: 0 auto 8px;
  display: block;
  animation: floaty 4s ease-in-out infinite;
}

.cta-band h2 {
  font-size: clamp(32px, 6vw, 42px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

.cta-band p {
  font-size: 17px;
  font-weight: 500;
  color: var(--muted-bright);
  margin: 0 0 32px;
}

.cta-band .badges { justify-content: center; }

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
  .cta-band .mascot, .pun-line .dot { animation: none; }
  .puns span { animation: none; }
  .puns span:first-child { opacity: 1; }
}

/* ---- footer ---- */

.site-footer { border-top: 1px solid var(--border); background: var(--bg); }

.site-footer .wrap {
  padding-top: 24px;
  padding-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
}

.site-footer .copyright { color: var(--muted); }

.site-footer nav { display: flex; gap: 20px; }

/* ---- small screens ---- */

@media (max-width: 719px) {
  .strapline { display: none; }
  .hero { padding-top: 24px; padding-bottom: 48px; gap: 40px; }
  /* min-width: 0 lets the copy shrink below its 300px/44ch preferences —
     without it the flex items overflow the viewport on narrow phones. */
  .hero-copy, .feature-copy { min-width: 0; width: 100%; }
  .feature, .feature.rev { flex-direction: column; gap: 32px; }
  .feature { padding-top: 56px; padding-bottom: 48px; }
  .feature .num { font-size: 64px; top: 12px; }
  .feature > .phone-col, .hero > .phone-col { align-self: center; }
  .hero-stats { gap: 20px; }
}

/* 320px-class devices: the large hero phone (322px outer) no longer fits,
   so it drops to the small-frame dimensions. */
@media (max-width: 389px) {
  .phone.lg { --screen-w: 230px; --screen-h: 482px; }
}
