/* PeekMusic website: Material 3 Expressive, tokens derived from the app's indigo seed (#1F1E73). */

@font-face {
  font-family: "Roboto Flex";
  src: url("/fonts/roboto-flex-latin.woff2") format("woff2");
  font-weight: 100 1000;
  font-stretch: 25% 151%;
  font-display: swap;
}

:root {
  color-scheme: light;
  --primary: #4a48a8;
  --on-primary: #ffffff;
  --primary-container: #e2dfff;
  --on-primary-container: #1f1e73;
  --secondary-container: #e3e0f9;
  --on-secondary-container: #1a1a2c;
  --tertiary-container: #ffd8ea;
  --on-tertiary-container: #31101f;
  --surface: #fcf8ff;
  --surface-container-low: #f6f2fa;
  --surface-container: #f0ecf4;
  --surface-container-high: #eae6ef;
  --surface-container-highest: #e4e1e9;
  --on-surface: #1c1b20;
  --on-surface-variant: #47464f;
  --outline: #787680;
  --outline-variant: #c8c5d0;
  --brand: #1f1e73;

  --font: "Roboto Flex", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --r-l: 16px;
  --r-xl: 28px;
  --r-2xl: 48px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --primary: #c3c0ff;
    --on-primary: #2c2a86;
    --primary-container: #43419a;
    --on-primary-container: #e2dfff;
    --secondary-container: #45455a;
    --on-secondary-container: #e3e0f9;
    --tertiary-container: #5f3c50;
    --on-tertiary-container: #ffd8ea;
    --surface: #131318;
    --surface-container-low: #1c1b20;
    --surface-container: #201f25;
    --surface-container-high: #2a292f;
    --surface-container-highest: #35343a;
    --on-surface: #e5e1e9;
    --on-surface-variant: #c8c5d0;
    --outline: #918f9a;
    --outline-variant: #47464f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #c3c0ff;
  --on-primary: #2c2a86;
  --primary-container: #43419a;
  --on-primary-container: #e2dfff;
  --secondary-container: #45455a;
  --on-secondary-container: #e3e0f9;
  --tertiary-container: #5f3c50;
  --on-tertiary-container: #ffd8ea;
  --surface: #131318;
  --surface-container-low: #1c1b20;
  --surface-container: #201f25;
  --surface-container-high: #2a292f;
  --surface-container-highest: #35343a;
  --on-surface: #e5e1e9;
  --on-surface-variant: #c8c5d0;
  --outline: #918f9a;
  --outline-variant: #47464f;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--on-surface);
  font: 400 1rem/1.6 var(--font);
  font-variation-settings: "opsz" 16;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-underline-offset: 3px; }
a:focus-visible, .btn:focus-visible, .seg a:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}
.wrap { width: min(1120px, 100%); margin: 0 auto; padding-inline: max(20px, env(safe-area-inset-left, 0px)); }

/* Top app bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--on-surface); }
.brand img { width: 40px; height: 40px; border-radius: 12px; }
.brand span { font-size: 1.375rem; font-weight: 700; font-stretch: 112%; letter-spacing: -0.01em; }
.topbar nav { margin-left: auto; display: flex; gap: 4px; }
.topbar nav a {
  color: var(--on-surface-variant);
  text-decoration: none;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 999px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.topbar nav a:hover { background: var(--surface-container-high); color: var(--on-surface); }
.topbar nav a[aria-current="page"] { background: var(--secondary-container); color: var(--on-secondary-container); }

/* Buttons: pills that square off when pressed (expressive shape morph) */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 28px;
  border-radius: 999px;
  font: 650 1.0625rem/1 var(--font);
  font-stretch: 106%;
  text-decoration: none;
  transition: border-radius 0.35s var(--spring), transform 0.35s var(--spring), background 0.2s var(--ease);
}
.btn svg { width: 22px; height: 22px; fill: currentColor; }
.btn:hover { transform: translateY(-2px); }
.btn:active { border-radius: 16px; transform: scale(0.97); }
.btn-filled { background: var(--primary); color: var(--on-primary); }
.btn-tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn-large { min-height: 72px; padding: 0 36px; font-size: 1.25rem; }

/* Hero */
.hero { padding-block: 56px 40px; }
.hero .wrap { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 10px;
  background: var(--tertiary-container);
  color: var(--on-tertiary-container);
  font-weight: 600;
  font-size: 0.875rem;
}
.hero h1 {
  margin: 20px 0 16px;
  font-size: clamp(2.75rem, 7vw, 4.75rem);
  line-height: 1.02;
  font-weight: 800;
  font-stretch: 118%;
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--primary); }
.hero p.lead { font-size: 1.25rem; color: var(--on-surface-variant); max-width: 34ch; margin: 0 0 32px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-art { position: relative; aspect-ratio: 1; max-width: 460px; justify-self: center; width: 100%; }
.hero-art .cookie { position: absolute; inset: 0; width: 100%; height: 100%; fill: var(--primary-container); }
.hero-art .icon {
  position: absolute;
  inset: 22%;
  width: 56%;
  height: 56%;
  border-radius: 30%;
  box-shadow: 0 24px 48px -16px rgba(31, 30, 115, 0.45);
}
.peek-line {
  position: absolute;
  left: -4%;
  bottom: 8%;
  padding: 14px 22px;
  border-radius: 24px 24px 24px 8px;
  background: var(--surface-container-highest);
  color: var(--on-surface);
  font-weight: 700;
  font-size: 1.125rem;
  font-stretch: 110%;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.35);
}
.peek-line .sung { color: var(--primary); }
.peek-line .rest { color: color-mix(in srgb, var(--on-surface) 45%, transparent); }
.peek-line small { display: block; font-weight: 500; font-size: 0.8125rem; color: var(--on-surface-variant); }

/* Feature cards */
.section { padding-block: 48px; }
.section h2 {
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 750;
  font-stretch: 114%;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  text-wrap: balance;
}
.section .sub { color: var(--on-surface-variant); margin: 0 0 32px; font-size: 1.125rem; max-width: 60ch; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card {
  background: var(--surface-container);
  border-radius: var(--r-xl);
  padding: 28px;
  transition: border-radius 0.45s var(--spring), background 0.25s var(--ease);
}
.card:hover { border-radius: var(--r-2xl); background: var(--surface-container-high); }
.card h3 { margin: 20px 0 8px; font-size: 1.375rem; font-weight: 700; font-stretch: 108%; }
.card p { margin: 0; color: var(--on-surface-variant); }
.shape { width: 72px; height: 72px; display: grid; place-items: center; }
.shape svg.bg { position: absolute; inset: 0; width: 72px; height: 72px; }
.shape { position: relative; }
.shape svg.ic { position: relative; width: 32px; height: 32px; }
.shape.p svg.bg { fill: var(--primary-container); } .shape.p svg.ic { fill: var(--on-primary-container); }
.shape.s svg.bg { fill: color-mix(in srgb, var(--primary) 22%, var(--secondary-container)); } .shape.s svg.ic { fill: var(--on-secondary-container); }
.shape.t svg.bg { fill: var(--tertiary-container); } .shape.t svg.ic { fill: var(--on-tertiary-container); }

/* Call to action */
.cta {
  background: var(--primary-container);
  color: var(--on-primary-container);
  border-radius: var(--r-2xl);
  padding: clamp(32px, 6vw, 64px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
}
.cta h2 { margin: 0 0 8px; }
.cta p { margin: 0; font-size: 1.125rem; opacity: 0.85; }

/* Footer */
footer { padding-block: 40px 56px; color: var(--on-surface-variant); font-size: 0.9375rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
footer a { color: var(--on-surface-variant); }

/* Document pages (privacy) */
.doc-head { padding-block: 40px 8px; }
.doc-head h1, .doc-title {
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 800;
  font-stretch: 118%;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 8px;
}
.doc-head .meta, .doc .meta { color: var(--on-surface-variant); margin: 0 0 24px; }
.seg { display: inline-flex; border: 1px solid var(--outline); border-radius: 999px; overflow: hidden; }
.seg a {
  min-width: 96px;
  text-align: center;
  padding: 10px 18px;
  color: var(--on-surface);
  text-decoration: none;
  font-weight: 600;
}
.seg a + a { border-left: 1px solid var(--outline); }
.seg a:hover { background: var(--surface-container-high); }
.doc { max-width: 820px; }
.doc section { scroll-margin-top: 88px; }
.doc .summary {
  background: var(--primary-container);
  color: var(--on-primary-container);
  border-radius: var(--r-xl);
  padding: 24px 28px;
  margin: 24px 0 8px;
  font-size: 1.0625rem;
}
.doc .summary p { margin: 0; }
.doc h2 { font-size: 1.625rem; font-weight: 720; font-stretch: 108%; margin: 40px 0 8px; }
.doc p, .doc li { max-width: 70ch; }
.doc code { font-size: 0.95em; background: var(--surface-container-high); padding: 1px 6px; border-radius: 6px; }
.table-wrap {
  overflow-x: auto;
  background: var(--surface-container-low);
  border-radius: var(--r-xl);
  padding: 8px;
  margin-top: 16px;
}
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th, td { text-align: left; vertical-align: top; padding: 12px 14px; }
th { color: var(--on-surface-variant); font-weight: 650; font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr + tr td { border-top: 1px solid var(--outline-variant); }
td:first-child { font-weight: 600; min-width: 11em; }
.divider { height: 1px; background: var(--outline-variant); margin: 64px 0; }

/* Motion */
@media (prefers-reduced-motion: no-preference) {
  .hero-art .cookie { animation: spin 48s linear infinite; transform-origin: 50% 50%; }
  .peek-line { animation: float 6s var(--ease) infinite alternate; }
  .rise { animation: rise 0.7s var(--spring) both; }
  .rise.d1 { animation-delay: 0.08s; } .rise.d2 { animation-delay: 0.16s; } .rise.d3 { animation-delay: 0.24s; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { to { transform: translateY(-10px); } }
@keyframes rise { from { transform: translateY(18px) scale(0.98); } }

/* Layout at smaller widths */
@media (max-width: 880px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-art { max-width: 340px; order: -1; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cta { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .topbar nav a { padding: 10px 12px; }
  .brand span { display: none; }
  .peek-line { left: 0; }
}

/* Theme toggle: follows the system until the visitor picks one (kept in localStorage) */
.theme-toggle {
  width: 48px;
  height: 48px;
  margin-left: 4px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--surface-container-high);
  color: var(--on-surface);
  transition: border-radius 0.35s var(--spring), background 0.2s var(--ease), transform 0.35s var(--spring);
}
.theme-toggle:hover { background: var(--surface-container-highest); }
.theme-toggle:active { border-radius: 14px; transform: scale(0.94); }
.theme-toggle:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.theme-toggle svg { width: 24px; height: 24px; fill: currentColor; }
.theme-toggle .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

/* PeekParty invite (/party, /listen) */
.party .room { margin: -12px 0 28px; font-size: 1.125rem; color: var(--on-surface-variant); }
.party .room code {
  margin-left: 6px;
  padding: 6px 14px;
  border-radius: 12px;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font: 700 1.25rem/1.4 ui-monospace, "Roboto Mono", monospace;
  letter-spacing: 0.12em;
}
.party .hint { margin: 20px 0 0; max-width: 42ch; color: var(--on-surface-variant); font-size: 0.9375rem; }
@media (max-width: 880px) {
  .party.hero { padding-block: 24px 40px; }
  .party .hero-art { max-width: 180px; }
}
