/* Glance marketing site.
   Palette values are set at runtime from index.html, copied from
   Sources/GlanceCore/Palette.swift. The defaults here are Mocha. */

@font-face {
  font-family: 'Newsreader';
  src: url('fonts/newsreader-var.woff2') format('woff2');
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Newsreader';
  src: url('fonts/newsreader-var.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Sans';
  src: url('fonts/instrument-sans.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 400 500;
  font-display: swap;
}

:root {
  --base: #1e1e2e;
  --mantle: #181825;
  --crust: #11111b;
  --surface0: #313244;
  --surface1: #45475a;
  --text: #cdd6f4;
  --subtext0: #a6adc8;
  --overlay0: #6c7086;
  --mauve: #cba6f7;
  --blue: #89b4fa;
  --green: #a6e3a1;
  --peach: #fab387;
  --teal: #94e2d5;

  --serif: 'Newsreader', Georgia, serif;
  --sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --measure: 62ch;
  --gutter: clamp(1.25rem, 5vw, 6rem);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--base);
  color: var(--text);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 220ms ease, color 220ms ease;
}

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

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--teal); }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.1; margin: 0; }

kbd {
  font-family: var(--mono);
  font-size: 0.78em;
  background: var(--surface0);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  color: var(--text);
}

code { font-family: var(--mono); font-size: 0.85em; }

/* ── top bar ─────────────────────────────────────────────── */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem var(--gutter);
  border-bottom: 1px solid var(--surface0);
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--base) 88%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.flavors { display: flex; gap: 0.5rem; }

.flavors button {
  appearance: none;
  border: 1px solid var(--surface0);
  background: none;
  padding: 0.3rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 0;
  transition: border-color 160ms ease, transform 160ms ease;
}

.flavors button:hover { transform: translateY(-1px); }
.flavors button[aria-pressed='true'] { border-color: var(--mauve); }

.flavors i {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: var(--sw);
  border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
}

/* ── hero ────────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  padding: clamp(3rem, 8vw, 6.5rem) var(--gutter) clamp(2.5rem, 6vw, 5rem);
}

h1 {
  font-size: clamp(2.4rem, 1.4rem + 4.4vw, 4.6rem);
  letter-spacing: -0.025em;
  max-width: 15ch;
}

h1 em { font-style: italic; color: var(--mauve); }

.lede {
  max-width: 46ch;
  color: var(--subtext1);
  font-size: 1.1rem;
  margin: 1.6rem 0 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.4rem;
  border-radius: 8px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.btn:hover { transform: translateY(-2px); }

.btn.primary { background: var(--mauve); color: var(--crust); }
.btn.primary:hover { background: var(--text); color: var(--crust); }

.btn.ghost { border-color: var(--surface1); color: var(--text); }
.btn.ghost:hover { border-color: var(--mauve); color: var(--mauve); }

.btn-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  opacity: 0.7;
  padding-left: 0.6rem;
  border-left: 1px solid color-mix(in srgb, currentColor 30%, transparent);
}

.fineprint {
  font-size: 0.86rem;
  color: var(--subtext1);
  margin-top: 1.1rem;
  max-width: 44ch;
}

.hero-shot { margin: 0; }

.shot-frame {
  padding: 0.6rem;
  border-radius: 18px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--mauve) 14%, var(--mantle)), var(--mantle));
  border: 1px solid var(--surface0);
  box-shadow: 0 24px 60px -28px rgb(0 0 0 / 0.55);
}

.shot-frame img { border-radius: 12px; width: 271px; }

.hero-shot figcaption {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--subtext1);
  margin-top: 0.85rem;
  text-align: center;
}

/* ── spec strip ──────────────────────────────────────────── */

.strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  border-top: 1px solid var(--surface0);
  border-bottom: 1px solid var(--surface0);
  background: var(--mantle);
}

.strip-item {
  padding: 1.5rem clamp(1rem, 2.5vw, 2rem);
  border-right: 1px solid var(--surface0);
}

.strip-item:last-child { border-right: none; }

.strip-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--subtext1);
  margin-bottom: 0.4rem;
}

.strip-value { font-size: 0.94rem; }

/* ── sections ────────────────────────────────────────────── */

main > section { padding: clamp(3.5rem, 8vw, 6rem) var(--gutter); }

h2 {
  font-size: clamp(1.8rem, 1.2rem + 2.2vw, 2.8rem);
  letter-spacing: -0.02em;
  max-width: 20ch;
}

.section-lede {
  max-width: var(--measure);
  color: var(--subtext1);
  margin: 1rem 0 0;
}

.features .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
  gap: clamp(1.5rem, 3vw, 2.75rem);
  margin-top: 3rem;
}

.features article {
  border-top: 1px solid var(--surface0);
  padding-top: 1.25rem;
}

.features h3 {
  font-size: 1.22rem;
  margin-bottom: 0.55rem;
  letter-spacing: -0.01em;
}

.features p { margin: 0; color: var(--subtext1); font-size: 0.95rem; }

/* ── gallery ─────────────────────────────────────────────── */

.gallery { background: var(--mantle); }

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: clamp(1.25rem, 2.5vw, 2rem);
  margin-top: 2.75rem;
  align-items: start;
}

.shots figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.shots img {
  border-radius: 10px;
  border: 1px solid var(--surface0);
  box-shadow: 0 18px 40px -26px rgb(0 0 0 / 0.5);
  /* Tops aligned, varying heights — the windows genuinely differ. */
}

.shots figcaption {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--subtext1);
  margin-top: 0.7rem;
}

/* ── privacy ─────────────────────────────────────────────── */

.privacy {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.privacy-copy p { color: var(--subtext1); max-width: var(--measure); }
.privacy-copy .muted { font-size: 0.88rem; color: var(--subtext1); }

.privacy-code {
  background: var(--crust);
  border: 1px solid var(--surface0);
  border-radius: 10px;
  padding: 1.25rem 1.35rem;
  overflow-x: auto;
}

.code-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--subtext1);
  display: block;
  margin-bottom: 0.75rem;
}

.privacy-code pre { margin: 0; }
.privacy-code code { font-size: 0.8rem; line-height: 1.7; color: var(--text); }
.privacy-code .c { color: var(--subtext1); }

/* ── support / BMC ───────────────────────────────────────── */

.support { background: var(--mantle); }

.support-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  max-width: 68rem;
}

.support p { color: var(--subtext1); max-width: 46ch; margin: 0.9rem 0 0; }

.bmc {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.95rem 1.6rem;
  border-radius: 999px;
  background: var(--peach);
  color: #2a1a10;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--peach) 60%, transparent);
}

.bmc:hover {
  transform: translateY(-2px);
  color: #2a1a10;
  box-shadow: 0 16px 38px -14px color-mix(in srgb, var(--peach) 75%, transparent);
}

.bmc-icon svg { width: 1.35rem; height: 1.35rem; display: block; }

/* ── faq ─────────────────────────────────────────────────── */

.faq { max-width: 54rem; }

.faq details {
  border-top: 1px solid var(--surface0);
  padding: 1.15rem 0;
}

.faq details:last-of-type { border-bottom: 1px solid var(--surface0); }

.faq summary {
  cursor: pointer;
  font-weight: 500;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

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

.faq summary::after {
  content: '+';
  font-family: var(--mono);
  color: var(--mauve);
  font-size: 1.1rem;
  line-height: 1;
}

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

.faq details p {
  color: var(--subtext1);
  font-size: 0.95rem;
  max-width: var(--measure);
  margin: 0.85rem 0 0;
}

/* ── footer ──────────────────────────────────────────────── */

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: baseline;
  justify-content: space-between;
  padding: 2.5rem var(--gutter) 3.5rem;
  border-top: 1px solid var(--surface0);
  font-size: 0.85rem;
  color: var(--subtext1);
}

footer nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
footer .credits { flex-basis: 100%; font-size: 0.8rem; }

/* ── responsive ──────────────────────────────────────────── */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-shot { justify-self: center; }
  .privacy { grid-template-columns: 1fr; }
  .strip-item { border-right: none; border-bottom: 1px solid var(--surface0); }
  .strip-item:last-child { border-bottom: none; }
}

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

/* Staggered reveal on load, no JS needed. */
@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * {
    animation: rise 620ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
  }
  .hero-copy > *:nth-child(1) { animation-delay: 60ms; }
  .hero-copy > *:nth-child(2) { animation-delay: 150ms; }
  .hero-copy > *:nth-child(3) { animation-delay: 240ms; }
  .hero-copy > *:nth-child(4) { animation-delay: 330ms; }
  .hero-shot { animation: rise 760ms cubic-bezier(0.22, 1, 0.36, 1) 200ms backwards; }
}

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