/* =========================================================================
   BetterPreview — Support Site
   Mirrors the iOS 26 Liquid Glass design system from constants/theme.ts and
   docs/design.md. CSS variables map 1:1 to ThemeColors tokens. Light is the
   default; dark mode swaps the same variable names via prefers-color-scheme.
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  /* Surfaces */
  --background: #F2F2F7;
  --background-deep: #E9E9EE;
  --card-background: #FFFFFF;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-raised: rgba(255, 255, 255, 0.86);
  --surface-header: rgba(242, 242, 247, 0.72);

  /* Text */
  --text-primary: #1C1C1E;
  --text-secondary: #5C5C66;
  --text-tertiary: #6D6D72;
  --text-quaternary: #8A8A93;

  /* Chrome */
  --tint: #007AFF;
  --tint-secondary: #5E5CE6;
  --separator: #C6C6C8;
  --separator-strong: rgba(60, 60, 67, 0.18);
  --icon-default: #8E8E93;

  /* Glass */
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-shadow: rgba(15, 20, 38, 0.12);
  --glass-shadow-strong: rgba(15, 20, 38, 0.18);
  --chip: rgba(120, 120, 128, 0.16);
  --pressed-fill: rgba(0, 0, 0, 0.06);

  /* File-icon palette (also reused as accent tints for feature cards) */
  --file-folder: #007AFF;
  --file-image: #34C759;
  --file-video: #FF2D55;
  --file-text: #5856D6;
  --file-accent: #FF9F0A;

  /* Brand */
  --splash: #41B1FF;

  /* Motion */
  --ease-out-cubic: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);

  /* Geometry */
  --radius-button: 12px;
  --radius-card: 16px;
  --radius-card-lg: 22px;
  --container-max: 1100px;
  --gutter: clamp(16px, 4vw, 32px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #000000;
    --background-deep: #0A0A0E;
    --card-background: #1C1C1E;
    --surface: rgba(36, 36, 42, 0.62);
    --surface-raised: rgba(58, 58, 64, 0.72);
    --surface-header: rgba(10, 10, 14, 0.72);

    --text-primary: #F2F2F7;
    --text-secondary: #B5B5BB;
    --text-tertiary: #6E6E73;
    --text-quaternary: #7A7A82;

    --tint: #0A84FF;
    --tint-secondary: #7D7AFF;
    --separator: #38383A;
    --separator-strong: rgba(255, 255, 255, 0.14);
    --icon-default: #AEAEB2;

    --glass-border: rgba(255, 255, 255, 0.16);
    --glass-shadow: rgba(0, 0, 0, 0.6);
    --glass-shadow-strong: rgba(0, 0, 0, 0.8);
    --chip: rgba(118, 118, 128, 0.24);
    --pressed-fill: rgba(255, 255, 255, 0.10);

    --file-folder: #5AA9FF;
    --file-image: #30D158;
    --file-video: #FF453A;
    --file-text: #5E5CE6;
    --file-accent: #FFB340;
  }
}

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

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

a {
  color: var(--tint);
  text-decoration: none;
  transition: color 180ms var(--ease-out-cubic);
}
a:hover { text-decoration: underline; text-underline-offset: 3px; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }

::selection { background: color-mix(in srgb, var(--tint) 35%, transparent); color: var(--text-primary); }

code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 1px 6px;
  background: var(--chip);
  border-radius: 6px;
  color: var(--text-primary);
}

/* ---------- A11y helpers ---------- */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  padding: 10px 16px;
  background: var(--tint);
  color: #fff;
  border-radius: 10px;
  font-weight: 600;
  z-index: 200;
  transform: translateY(-200%);
  transition: transform 220ms var(--ease-out-cubic);
}
.skip-link:focus {
  transform: translateY(0);
  outline: none;
}

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

/* ---------- Ambient layers ---------- */
.ambient-glow {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 18% 8%, rgba(65, 177, 255, 0.18), transparent 65%),
    radial-gradient(45% 40% at 82% 18%, rgba(94, 92, 230, 0.13), transparent 70%),
    radial-gradient(55% 45% at 50% 95%, rgba(52, 199, 89, 0.08), transparent 70%);
  filter: saturate(115%);
}

@media (prefers-color-scheme: dark) {
  .ambient-glow {
    background:
      radial-gradient(60% 50% at 18% 8%, rgba(10, 132, 255, 0.22), transparent 65%),
      radial-gradient(45% 40% at 82% 18%, rgba(125, 122, 255, 0.18), transparent 70%),
      radial-gradient(55% 45% at 50% 95%, rgba(48, 209, 88, 0.10), transparent 70%);
  }
}

.cursor-spotlight {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    560px circle at var(--x, 50%) var(--y, 50%),
    color-mix(in srgb, var(--tint) 10%, transparent),
    transparent 45%
  );
  opacity: 0;
  transition: opacity 280ms var(--ease-out-cubic);
}
.cursor-spotlight.is-active { opacity: 1; }

@media (hover: none), (prefers-reduced-motion: reduce) {
  .cursor-spotlight { display: none; }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-header);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--separator-strong);
}

.site-header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; opacity: 0.85; }
.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--glass-shadow);
}

.site-nav {
  display: flex;
  gap: 4px;
}
.site-nav a {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 10px;
  transition: color 180ms var(--ease-out-cubic), background 180ms var(--ease-out-cubic);
}
.site-nav a:hover {
  color: var(--text-primary);
  background: var(--pressed-fill);
  text-decoration: none;
}

@media (max-width: 480px) {
  .site-nav { gap: 0; }
  .site-nav a { padding: 8px; font-size: 14px; }
}

/* ---------- Layout primitives ---------- */
main { isolation: isolate; }

.section {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: clamp(56px, 9vw, 96px) var(--gutter);
}

.section-head {
  text-align: center;
  margin: 0 auto clamp(32px, 4vw, 48px);
  max-width: 720px;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-quaternary);
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(28px, 4.4vw, 40px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.section-lede {
  font-size: 17px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.section-lede a { color: var(--tint); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(64px, 12vw, 128px) var(--gutter) clamp(48px, 8vw, 96px);
  max-width: var(--container-max);
  margin: 0 auto;
  text-align: center;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.hero-icon-wrap {
  margin-bottom: 8px;
  position: relative;
}

.hero-icon {
  width: clamp(96px, 14vw, 124px);
  height: clamp(96px, 14vw, 124px);
  border-radius: 22px;
  box-shadow:
    0 24px 60px -16px rgba(0, 122, 255, 0.35),
    0 8px 24px -8px var(--glass-shadow);
}

@media (prefers-color-scheme: dark) {
  .hero-icon {
    box-shadow:
      0 24px 60px -16px rgba(10, 132, 255, 0.45),
      0 8px 24px -8px rgba(0, 0, 0, 0.7);
  }
}

.hero-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-quaternary);
}

.hero-title {
  font-size: clamp(40px, 7vw, 64px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--text-primary);
  background: linear-gradient(
    180deg,
    var(--text-primary) 0%,
    color-mix(in srgb, var(--text-primary) 78%, var(--tint)) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-tagline {
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.45;
  color: var(--text-secondary);
  max-width: 480px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-button);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform 180ms var(--ease-out-cubic),
              background 180ms var(--ease-out-cubic),
              box-shadow 180ms var(--ease-out-cubic),
              color 180ms var(--ease-out-cubic);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--tint);
  color: #fff;
  box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--tint) 65%, transparent);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--tint) 92%, white);
  box-shadow: 0 12px 28px -6px color-mix(in srgb, var(--tint) 75%, transparent);
}

.btn-ghost {
  background: var(--chip);
  color: var(--text-primary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.btn-ghost:hover {
  background: color-mix(in srgb, var(--chip) 70%, var(--text-primary) 6%);
}

/* ---------- Glass cards ---------- */
.glass-card {
  position: relative;
  background: var(--surface);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 16px 40px -12px var(--glass-shadow),
    0 4px 10px -4px var(--glass-shadow);
  transition: transform 220ms var(--ease-out-cubic),
              box-shadow 220ms var(--ease-out-cubic),
              border-color 220ms var(--ease-out-cubic);
}

@media (prefers-color-scheme: dark) {
  .glass-card {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.07) inset,
      0 16px 40px -12px var(--glass-shadow),
      0 4px 10px -4px var(--glass-shadow);
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-card {
    background: var(--card-background);
  }
}

.glass-card-raised {
  background: var(--surface-raised);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 28px 70px -18px var(--glass-shadow-strong),
    0 8px 16px -6px var(--glass-shadow);
}

@media (prefers-color-scheme: dark) {
  .glass-card-raised {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.10) inset,
      0 28px 70px -18px var(--glass-shadow-strong),
      0 8px 16px -6px var(--glass-shadow);
  }
}

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

.feature-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

@media (hover: hover) {
  .feature-card:hover {
    transform: translateY(-3px);
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.65) inset,
      0 24px 50px -12px var(--glass-shadow-strong),
      0 8px 16px -6px var(--glass-shadow);
    border-color: color-mix(in srgb, var(--icon-tint, var(--tint)) 35%, var(--glass-border));
  }
}

.feature-icon {
  --icon-bg: color-mix(in srgb, var(--icon-tint, var(--tint)) 14%, transparent);
  --icon-border: color-mix(in srgb, var(--icon-tint, var(--tint)) 28%, transparent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--icon-bg);
  border: 1px solid var(--icon-border);
  color: var(--icon-tint, var(--tint));
  margin-bottom: 4px;
}

.feature-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.feature-body {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* ---------- FAQ ---------- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
}

.faq-item {
  padding: 0;
  overflow: hidden;
}

.faq-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  text-align: left;
  color: var(--text-primary);
  transition: background 180ms var(--ease-out-cubic);
}
.faq-trigger:hover { background: var(--pressed-fill); }
.faq-trigger:focus-visible {
  outline: none;
  background: var(--pressed-fill);
}

.faq-question {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.faq-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--text-tertiary);
  background: var(--chip);
  flex-shrink: 0;
  transition: transform 240ms var(--ease-out-cubic),
              color 180ms var(--ease-out-cubic),
              background 180ms var(--ease-out-cubic);
}
.faq-trigger[aria-expanded="true"] .faq-chevron {
  transform: rotate(180deg);
  color: var(--tint);
  background: color-mix(in srgb, var(--tint) 14%, transparent);
}

.faq-content {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 320ms var(--ease-out-cubic);
}
.faq-trigger[aria-expanded="true"] + .faq-content {
  grid-template-rows: 1fr;
}
.faq-content-inner {
  overflow: hidden;
  min-height: 0;
}
.faq-content-inner p {
  padding: 0 22px 20px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.faq-content-inner p a { color: var(--tint); }
.faq-content-inner strong { color: var(--text-primary); font-weight: 600; }

/* ---------- Contact ---------- */
.section-contact {
  padding-bottom: clamp(80px, 12vw, 128px);
}

.contact-card {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 48px);
  text-align: center;
}

.contact-card .section-label {
  margin-bottom: 12px;
}

.contact-title {
  font-size: clamp(24px, 3.6vw, 32px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.contact-body {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.contact-btn {
  font-size: 16px;
  padding: 14px 28px;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--separator-strong);
  background: var(--surface-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 24px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}
.footer-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}
.footer-version {
  color: var(--text-quaternary);
  font-weight: 400;
  margin-left: 4px;
}

.footer-copy {
  color: var(--text-tertiary);
  font-size: 13px;
}

.footer-link {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}
.footer-link:hover { color: var(--tint); text-decoration: none; }

@media (max-width: 560px) {
  .footer-inner {
    justify-content: center;
    text-align: center;
  }
}

/* ---------- Scroll reveal ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 480ms var(--ease-out-cubic),
              transform 480ms var(--ease-out-cubic);
}
[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .btn,
  .glass-card,
  .faq-chevron,
  .faq-content,
  .site-nav a {
    transition: none !important;
  }
}

/* ---------- Tiny tweaks at narrow widths ---------- */
@media (max-width: 480px) {
  .hero-actions { flex-direction: column; width: 100%; }
  .hero-actions .btn { width: 100%; }
  .faq-trigger { padding: 16px 18px; }
  .faq-content-inner p { padding: 0 18px 18px; }
}
