/* ------------------------------------------------------------------
   LoopBreak website: shared foundation for the three designs.
   Tokens come from the app (mobile/src/theme.ts): palette, type, radii, easings.
   1. Tokens   2. Reset   3. Type helpers   4. Buttons   5. Store badges
   6. Scroll reveals   7. FAQ   8. Social links   9. Reduced motion
------------------------------------------------------------------- */

/* ---------- 1. Tokens ---------- */

:root {
  --green: #13EC5B;
  --mint: #34D399;
  --teal: #2FE6D2;
  --bg: #121212;
  --bg-app: #171717;
  --bg-deep: #0D1310;
  --surface: #191919;
  --deep: #102216;
  --pick: #17291D;
  --ink: #F1F5F9;
  --soft: #CBD5E1;
  --muted: #94A3B8;
  --btn-text: #101410;
  --amber: #FFB300;
  --frozen: #00F3FF;
  --relapse: #FF6B6B;
  --line: rgba(255, 255, 255, 0.08);
  --line-green: rgba(19, 236, 91, 0.4);

  --grad-text: linear-gradient(90deg, #13EC5B 0%, #34D399 50%, #2FE6D2 100%);
  --grad-streak: linear-gradient(135deg, #13EC5B 0%, #2FE6D2 100%);
  --glow-cta: 0 0 15px rgba(19, 236, 91, 0.3);

  --font-display: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-card: 24px;
  --r-tile: 14px;

  /* The app's curves */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-press: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-pop: cubic-bezier(0.2, 0.9, 0.3, 1.35);

  --gutter: clamp(20px, 4vw, 48px);
  --max: 1200px;
}

/* ---------- 2. Reset ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
::selection { background: rgba(19, 236, 91, 0.32); color: #fff; }
:focus { outline: none; }
:focus-visible { outline: 2px solid rgba(19, 236, 91, 0.85); outline-offset: 3px; border-radius: 6px; }
a, button { -webkit-tap-highlight-color: transparent; }

/* Glows, orbits and oversized rings may bleed past the edge; they never widen the page. Sticky still works under clip. */
main, footer { overflow-x: clip; }

.wrap { width: min(100% - var(--gutter) * 2, var(--max)); margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 16px; top: -64px; z-index: 1000;
  background: var(--green); color: var(--btn-text);
  font: 700 15px var(--font-display); padding: 12px 18px; border-radius: 12px;
  transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: 16px; }

/* ---------- 3. Type helpers ---------- */

.display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.045em; line-height: 1; text-wrap: balance; }
.text-gradient {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* room for descenders inside the clipped box */
  padding-bottom: 0.08em;
}
.kicker {
  color: var(--green);
  font: 800 12px/1 var(--font-display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.green-subtext { color: var(--green); font-family: var(--font-display); font-weight: 600; text-shadow: 0 0 3px rgba(19, 236, 91, 0.4); }
.muted { color: var(--muted); }
.soft { color: var(--soft); }

/* ---------- 4. Buttons (the app's PrimaryButton and its quiet sibling) ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 28px;
  border-radius: 9999px;
  font: 700 16px/1 var(--font-display);
  white-space: nowrap;
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease,
    transform 0.16s var(--ease-press), filter 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--green); color: var(--btn-text); box-shadow: var(--glow-cta); }
.btn-ghost { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); color: var(--ink); }
.btn .btn-arrow { transition: transform 0.3s var(--ease-out); }
@media (hover: hover) {
  .btn-primary:hover { filter: brightness(1.06); box-shadow: 0 0 26px rgba(19, 236, 91, 0.45); }
  .btn-ghost:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.18); }
  .btn:hover .btn-arrow { transform: translateX(4px); }
}

/* ---------- 5. Store badges ----------
   Official artwork, unmodified. Apple: black badge, first in the line-up, at least 40px tall, clear space of a
   quarter of its height, never angled or animated. Google: same height as Apple's or larger, clear space of a
   quarter of its height. Google's PNG ships with that clear space baked in (41px around a 564x168 badge in a
   646x250 file), so the image is drawn larger and pulled back with negative margins to make both badges match. */

.store-badges {
  --badge-h: 54px;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: calc(var(--badge-h) / 2);
}
.store-badge { display: inline-flex; flex: none; border-radius: calc(var(--badge-h) * 0.17); }
.store-badge:focus-visible { outline-offset: calc(var(--badge-h) / 4); }
.store-badge img { display: block; max-width: none; }
.store-badge--apple img { height: var(--badge-h); width: auto; }
.store-badge--google img {
  height: calc(var(--badge-h) * 250 / 168);
  width: auto;
  margin: calc(var(--badge-h) * -41 / 168);
}
@media (max-width: 420px) {
  .store-badges { --badge-h: 46px; }
}

/* ---------- 6. Scroll reveals ----------
   Hidden states only exist under html.js (set inline in <head>), so the page reads without script. */

@media (prefers-reduced-motion: no-preference) {
  html.js [data-reveal] {
    opacity: 0;
    transform: translate3d(0, 28px, 0);
    transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out), filter 0.9s var(--ease-out);
    transition-delay: calc(var(--i, 0) * 80ms);
    will-change: opacity, transform;
  }
  html.js [data-reveal="scale"] { transform: scale(0.94); }
  html.js [data-reveal="left"] { transform: translate3d(-32px, 0, 0); }
  html.js [data-reveal="right"] { transform: translate3d(32px, 0, 0); }
  html.js [data-reveal="blur"] { transform: translate3d(0, 12px, 0); filter: blur(8px); }
  html.js [data-reveal="fade"] { transform: none; }
  html.js [data-reveal].is-in { opacity: 1; transform: none; filter: none; }

  /* Headline lines that rise out of a mask */
  html.js .line-mask { display: block; overflow: hidden; padding-bottom: 0.12em; margin-bottom: -0.12em; }
  html.js .line-mask > span {
    display: block;
    transform: translate3d(0, 108%, 0);
    transition: transform 1.1s var(--ease-out);
    transition-delay: calc(var(--i, 0) * 110ms + 80ms);
  }
  html.js .is-in .line-mask > span, html.js .line-mask.is-in > span { transform: none; }
}

/* ---------- 7. FAQ (native details, one open at a time through the name attribute) ---------- */

.faq-item { border-radius: var(--r-card); }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  cursor: pointer; list-style: none;
  font: 700 18px/1.3 var(--font-display); letter-spacing: -0.01em;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-mark {
  flex: none; position: relative; width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.45s var(--ease-out);
}
.faq-mark::before, .faq-mark::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 2px; margin: -1px 0 0 -6px;
  background: var(--ink); border-radius: 2px; transition: transform 0.45s var(--ease-out), background-color 0.25s ease;
}
.faq-mark::after { transform: rotate(90deg); }
.faq-item[open] .faq-mark { background: var(--pick); border-color: var(--line-green); transform: rotate(180deg); }
.faq-item[open] .faq-mark::before, .faq-item[open] .faq-mark::after { background: var(--green); }
.faq-item[open] .faq-mark::after { transform: rotate(0deg); }
.faq-answer { color: var(--soft); max-width: 68ch; }
.faq-answer a { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
@supports (interpolate-size: allow-keywords) {
  .faq-item { interpolate-size: allow-keywords; }
  .faq-item::details-content {
    block-size: 0; overflow: clip; opacity: 0;
    transition: block-size 0.45s var(--ease-out), opacity 0.35s ease, content-visibility 0.45s allow-discrete;
  }
  .faq-item[open]::details-content { block-size: auto; opacity: 1; }
}

/* ---------- 8. Social links ---------- */

.socials { display: flex; gap: 10px; }
.social {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--soft);
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.3s var(--ease-out);
}
.social svg { width: 20px; height: 20px; fill: currentColor; }
.social:active { transform: scale(0.94); }
@media (hover: hover) {
  .social:hover { background: var(--pick); border-color: var(--line-green); color: var(--green); transform: translateY(-3px); }
}

/* ---------- 9. Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
