/* ========================================================================
   Suby Marketing Site
   Single shared stylesheet — design tokens, base, components
   ======================================================================== */

/* ---------- Fonts (Outfit variable, served from one woff2) ---------- */
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/outfit/Outfit-Variable.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/outfit/Outfit-Variable-LatinExt.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  --ink: #111111;
  --bg: #ffffff;
  --surface: #f7f7f7;
  --border: #e8e8e8;
  --muted: #666666;
  --on-ink: #ffffff;

  --container-width: 1100px;
  --gutter: 24px;
  --section-y: clamp(64px, 10vw, 128px);
  --radius: 16px;
  --radius-lg: 24px;

  --font: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;

  --transition: 180ms cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ffffff;
    --bg: #0a0a0a;
    --surface: #161616;
    --border: #2a2a2a;
    --muted: #999999;
    --on-ink: #0a0a0a;
  }
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  /* scroll-behavior: smooth removed — it fights with browser scroll
     restoration on refresh, causing progressive scroll-down bug.
     Anchor navigation still works (instant jump). */
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: opacity var(--transition);
}
a:hover { opacity: 0.7; }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.5em;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

ul, ol { padding-left: 1.4em; }

strong { font-weight: 600; }

/* ---------- Layout primitives ---------- */
.container {
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--section-y);
}

.section--surface {
  background: var(--surface);
}

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header__inner {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 32px;
}

/* Brand: icon + wordmark */
.header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.header__brand:hover { opacity: 1; }

.header__brand img {
  width: 28px;
  height: 28px;
}

.header__wordmark {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}

/* Nav: centered links with animated underline */
.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
  font-size: 15px;
  font-weight: 500;
}

.nav a {
  position: relative;
  padding: 4px 0;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 240ms cubic-bezier(0.2, 0, 0, 1);
}

.nav a:hover { opacity: 1; }
.nav a:hover::after { transform: scaleX(1); }

/* CTA button in header */
.header__cta {
  flex-shrink: 0;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-ink);
  background: var(--ink);
  border-radius: 999px;
  transition: transform 200ms cubic-bezier(0.2, 0, 0, 1), background 200ms ease;
  white-space: nowrap;
}

.header__cta:hover {
  opacity: 1;
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--ink) 85%, transparent);
}

.header__cta:active {
  transform: scale(0.97);
}

/* Responsive header */
@media (max-width: 768px) {
  .header__inner { gap: 16px; }
  .nav { gap: 16px; font-size: 13px; }
  .header__cta { display: none; }
  .header__wordmark { font-size: 18px; }
}

@media (max-width: 480px) {
  .nav a:nth-child(n+3) { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), color var(--transition);
}
.btn:hover { opacity: 1; transform: translateY(-1px); }

.btn--primary {
  background: var(--ink);
  color: var(--on-ink);
}
.btn--primary:hover { background: color-mix(in srgb, var(--ink) 85%, transparent); }

.btn--secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

.btn--disabled {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--border);
  cursor: not-allowed;
}
.btn--disabled:hover { transform: none; }

/* ---------- Store badges ---------- */
.store-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.store-badges--centered {
  justify-content: center;
}

/* Both badges match HEIGHT (industry standard from Apple/Google brand
   guidelines). Widths differ naturally based on each badge's design. */
.store-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 10px;
  transition: transform 240ms cubic-bezier(0.2, 0, 0, 1);
}

.store-badge img {
  display: block;
  height: 52px;
  width: auto;
}

/* Google badge PNG has been trimmed of internal padding.
   No special sizing needed — both badges at height: 52px. */

.store-badge:hover {
  transform: translateY(-2px) scale(1.02);
  opacity: 1;
}

.store-badge--soon {
  cursor: not-allowed;
  pointer-events: none;
  position: relative;
}

.store-badge--soon img {
  filter: grayscale(0.4);
  opacity: 0.55;
}

.store-badge__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 10px;
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .store-badge--soon img {
    opacity: 0.45;
  }
}

/* In the dark CTA strip, give the overlay a brighter scrim for contrast */
.cta-strip .store-badge__overlay {
  background: rgba(255, 255, 255, 0.18);
}

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(80px, 12vw, 160px);
}

.hero__inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 64px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(48px, 8vw, 96px);
  margin-bottom: 24px;
}

.hero p.lead {
  font-size: clamp(18px, 2vw, 22px);
  color: var(--muted);
  max-width: 520px;
  margin-bottom: 40px;
}

.hero__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.hero__phone {
  position: relative;
  max-width: 360px;
  margin-inline: auto;
  border-radius: 40px;
  overflow: hidden;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.22);
}

@media (max-width: 768px) {
  .hero__inner { grid-template-columns: 1fr; gap: 48px; }
  .hero__phone { max-width: 280px; }
}

/* ---------- Features ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.feature-card {
  padding: 32px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform var(--transition), border-color var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--ink);
}

.feature-card h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--muted);
  font-size: 16px;
}

.section h2 {
  font-size: clamp(32px, 5vw, 56px);
  text-align: center;
  margin-bottom: 64px;
}

/* ---------- Screenshots gallery ----------
   Six App Store template slides shown side-by-side so the multi-phone
   continuous design (slides 1-3) flows visually. Tight gap on desktop
   to preserve the connection; horizontal scroll on mobile.
*/
.screenshots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.screenshots img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: 100%;
  height: auto;
}

@media (max-width: 1024px) {
  .screenshots {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 8px;
    padding-bottom: 24px;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
  }
  .screenshots img {
    flex: 0 0 60%;
    scroll-snap-align: center;
  }
}

@media (max-width: 600px) {
  .screenshots img {
    flex: 0 0 78%;
  }
}

/* ---------- Pricing ---------- */
.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 800px;
  margin-inline: auto;
}

.pricing-card {
  padding: 40px 32px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.pricing-card--featured {
  background: var(--ink);
  color: var(--on-ink);
  border-color: var(--ink);
}

.pricing-card h3 { font-size: 24px; margin-bottom: 8px; }

.pricing-card .price {
  font-size: 48px;
  font-weight: 700;
  margin-block: 16px 24px;
  letter-spacing: -0.03em;
}

.pricing-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pricing-card li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.pricing-card li::before {
  content: "✓";
  font-weight: 700;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .pricing-grid { grid-template-columns: 1fr; }
}

/* ---------- FAQ ---------- */
.faq {
  max-width: 800px;
  margin-inline: auto;
}

.faq details {
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.faq summary {
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  font-size: 28px;
  font-weight: 400;
  transition: transform var(--transition);
  flex-shrink: 0;
}

.faq details[open] summary::after {
  content: "−";
}

.faq details > *:not(summary) {
  margin-top: 16px;
  color: var(--muted);
}

.faq__more {
  text-align: center;
  margin-top: 40px;
}

/* ---------- CTA strip ---------- */
.cta-strip {
  background: var(--ink);
  color: var(--on-ink);
  text-align: center;
  padding-block: clamp(64px, 8vw, 96px);
}

.cta-strip h2 {
  color: var(--on-ink);
  margin-bottom: 32px;
}

.cta-strip .btn--primary {
  background: var(--on-ink);
  color: var(--ink);
}

.cta-strip__buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding-block: 64px 32px;
}

.footer__inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.footer__col h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.footer__col a {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

.footer__col a:hover { color: var(--ink); opacity: 1; }

.footer__credit {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 768px) {
  .footer__inner { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Legal pages (Privacy, Terms) ---------- */
.legal {
  max-width: 760px;
  margin-inline: auto;
}

.legal h1 {
  font-size: clamp(36px, 6vw, 56px);
  margin-bottom: 16px;
}

.legal .updated {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 48px;
}

.legal h2 {
  font-size: 24px;
  margin-top: 48px;
  margin-bottom: 16px;
}

.legal h3 {
  font-size: 18px;
  margin-top: 32px;
  margin-bottom: 8px;
}

.legal table {
  width: 100%;
  border-collapse: collapse;
  margin-block: 24px;
  font-size: 14px;
}

.legal th, .legal td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.legal th { font-weight: 600; }

.legal a { text-decoration: underline; }

.legal__toc {
  background: var(--surface);
  padding: 24px 32px;
  border-radius: var(--radius);
  margin-bottom: 48px;
}

.legal__toc h2 {
  margin-top: 0;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.legal__toc ol {
  margin: 0;
  padding-left: 20px;
}

.legal__toc li {
  margin-bottom: 6px;
  font-size: 15px;
}

/* ---------- Support page ---------- */
.support-hero {
  text-align: center;
  padding-block: clamp(64px, 8vw, 96px);
}

.support-hero h1 {
  font-size: clamp(40px, 6vw, 64px);
}

.support-email-card {
  max-width: 560px;
  margin: 48px auto 0;
  padding: 40px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  text-align: center;
}

.support-email-card a {
  font-size: 24px;
  font-weight: 600;
  text-decoration: underline;
}

.support-tip {
  max-width: 760px;
  margin: 48px auto 0;
  padding: 24px 32px;
  background: var(--surface);
  border-left: 4px solid var(--ink);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 15px;
  color: var(--muted);
}

/* ---------- Press kit ---------- */
.press-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-block: 40px;
}

.press-asset {
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.press-asset h4 { font-size: 16px; margin: 0; }

.press-asset .meta {
  font-size: 13px;
  color: var(--muted);
}

.press-asset a {
  margin-top: auto;
  font-weight: 600;
  text-decoration: underline;
}

.press-bio {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  background: var(--surface);
  padding: 40px;
  border-radius: var(--radius-lg);
  margin-top: 48px;
}

/* ---------- 404 ---------- */
.not-found {
  text-align: center;
  padding-block: clamp(96px, 16vw, 200px);
}

.not-found h1 {
  font-size: clamp(80px, 16vw, 200px);
  margin: 0;
  letter-spacing: -0.04em;
}

.not-found p {
  font-size: 24px;
  color: var(--muted);
  margin-bottom: 32px;
}

/* ---------- Utilities ---------- */
.center { text-align: center; }
.muted { color: var(--muted); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ========================================================================
   Animations & Transitions (subtle, respect reduced-motion)
   ======================================================================== */

/* Allow smooth height interpolation on <details> open/close */
:root { interpolate-size: allow-keywords; }

/* Smoother default for interactive elements */
.btn,
.feature-card,
.pricing-card,
.press-asset,
.screenshots img,
.faq summary {
  transition:
    transform 240ms cubic-bezier(0.2, 0, 0, 1),
    background 240ms cubic-bezier(0.2, 0, 0, 1),
    color 240ms cubic-bezier(0.2, 0, 0, 1),
    border-color 240ms cubic-bezier(0.2, 0, 0, 1),
    box-shadow 240ms cubic-bezier(0.2, 0, 0, 1),
    opacity 240ms cubic-bezier(0.2, 0, 0, 1);
}

/* FAQ marker rotates smoothly instead of swapping characters */
.faq summary::after {
  content: "+";
  display: inline-block;
  transform-origin: center;
  transition: transform 320ms cubic-bezier(0.2, 0, 0, 1);
}
.faq details[open] summary::after {
  content: "+";
  transform: rotate(45deg);
}

/* FAQ open/close: opacity-only fade (no translateY to avoid jumps) */
.faq details > *:not(summary) {
  opacity: 0;
  transition: opacity 280ms ease-out;
}
.faq details[open] > *:not(summary) {
  opacity: 1;
}

/* Card hover: lift + soft shadow instead of just translate */
.feature-card:hover,
.press-asset:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.18);
  border-color: var(--ink);
}

/* Pricing card hover */
.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.15);
}

/* Screenshot hover (desktop only) */
@media (hover: hover) and (min-width: 769px) {
  .screenshots img {
    transition: transform 320ms cubic-bezier(0.2, 0, 0, 1),
                box-shadow 320ms cubic-bezier(0.2, 0, 0, 1);
  }
  .screenshots img:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.25);
  }
}

/* Button press feedback */
.btn:active:not(.btn--disabled) {
  transform: translateY(0) scale(0.98);
  transition-duration: 80ms;
}

/* ---- Entry animations ---- */
@media (prefers-reduced-motion: no-preference) {

  /* Hero fades in with stagger — no translateY to avoid shifting layout
     and fighting with browser scroll restoration on refresh */
  @keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  .hero h1 {
    animation: fade-in 600ms ease-out both;
  }
  .hero p.lead {
    animation: fade-in 600ms ease-out 100ms both;
  }
  .hero__buttons, .store-badges {
    animation: fade-in 600ms ease-out 200ms both;
  }
  .hero__phone {
    animation: fade-in 800ms ease-out 250ms both;
  }

}

/* ---- Scroll-driven section reveals (Chrome/Edge/Firefox) ---- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    @keyframes reveal-up {
      from { opacity: 0; transform: translateY(40px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .section h2,
    .feature-card,
    .pricing-card,
    .screenshots img,
    .legal h2,
    .legal__toc,
    .support-email-card,
    .support-tip,
    .press-grid,
    .press-bio,
    .cta-strip h2,
    .cta-strip__buttons {
      animation: reveal-up linear both;
      animation-timeline: view();
      animation-range: entry 5% cover 25%;
    }

    /* Stagger feature cards and pricing cards by index */
    .feature-grid .feature-card:nth-child(1) { animation-delay: 0ms; }
    .feature-grid .feature-card:nth-child(2) { animation-delay: 60ms; }
    .feature-grid .feature-card:nth-child(3) { animation-delay: 120ms; }
    .feature-grid .feature-card:nth-child(4) { animation-delay: 180ms; }
    .feature-grid .feature-card:nth-child(5) { animation-delay: 240ms; }
    .feature-grid .feature-card:nth-child(6) { animation-delay: 300ms; }

    .screenshots img:nth-child(1) { animation-delay: 0ms; }
    .screenshots img:nth-child(2) { animation-delay: 60ms; }
    .screenshots img:nth-child(3) { animation-delay: 120ms; }
    .screenshots img:nth-child(4) { animation-delay: 180ms; }
    .screenshots img:nth-child(5) { animation-delay: 240ms; }
    .screenshots img:nth-child(6) { animation-delay: 300ms; }
  }
}

/* ---- Header background intensifies on scroll ---- */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    @keyframes header-condense {
      from { box-shadow: 0 0 0 transparent; }
      to   { box-shadow: 0 8px 24px -16px rgba(0, 0, 0, 0.25); }
    }
    .header {
      animation: header-condense linear both;
      animation-timeline: scroll(root);
      animation-range: 0 200px;
    }
  }
}

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