/* ==========================================================================
   Undertone website
   Palette and type are lifted straight from the app (Undertone/Design/Theme.swift):
   Material Design 3 tonal palette generated from the purple seed #6750A4,
   set out in both light and dark, plus bundled Roboto.
   ========================================================================== */

/* --- Light scheme (the default, defined on bare :root) ------------------- */
:root {
  --surface:                   #FFFBFE; /* page: slightly warm, never pure white */
  --on-surface:                #1C1B1F; /* primary text */
  --on-surface-variant:        #49454F; /* secondary text */
  --primary:                   #6750A4; /* the seed colour: CTAs, links, focus */
  --on-primary:                #FFFFFF;
  --secondary-container:       #E8DEF8; /* chips and tonal buttons */
  --on-secondary-container:    #1D192B;
  --tertiary:                  #7D5260;
  --surface-container:         #F3EDF7;
  --surface-container-high:    #ECE6F0; /* cards */
  --surface-container-low:     #E7E0EC;
  --outline:                   #79747E;
  --outline-variant:           #CAC4D0;

  --card-shadow:   0 2px 6px rgba(0, 0, 0, 0.06);
  --button-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);

  /* The screenshot showcase keeps its own fixed lavender ground in both
     schemes, because that is the colour baked into the images themselves. */
  --showcase: #EFE9FA;

  --backdrop-primary:   rgba(103, 80, 164, 0.16);
  --backdrop-secondary: rgba(232, 222, 248, 0.55);
  --backdrop-tertiary:  rgba(125, 82, 96, 0.12);

  --max: 68rem;
  --radius-card: 24px;
  --radius-row: 18px;
}

/* Dark scheme. Only the tokens change.
   Two selectors, so an explicit choice and the system default both land:
   the media query covers "system", and [data-theme] covers a real toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface:                #1C1B1F; /* near-black, never pure black */
    --on-surface:             #E6E1E5;
    --on-surface-variant:     #CAC4D0;
    --primary:                #D0BCFF; /* lighter in dark, or contrast fails */
    --on-primary:             #381E72;
    --secondary-container:    #4A4458;
    --on-secondary-container: #E8DEF8;
    --tertiary:               #EFB8C8;
    --surface-container:      #211F26;
    --surface-container-high: #2B2930;
    --surface-container-low:  #36343B;
    --outline:                #938F99;
    --outline-variant:        #49454F;

    /* MD3 conveys lift with a lighter surface in dark, not a shadow. */
    --card-shadow:   none;
    --button-shadow: none;

    --backdrop-primary:   rgba(208, 188, 255, 0.10);
    --backdrop-secondary: rgba(74, 68, 88, 0.55);
    --backdrop-tertiary:  rgba(239, 184, 200, 0.08);
  }
}

:root[data-theme="dark"] {
  --surface:                #1C1B1F;
  --on-surface:             #E6E1E5;
  --on-surface-variant:     #CAC4D0;
  --primary:                #D0BCFF;
  --on-primary:             #381E72;
  --secondary-container:    #4A4458;
  --on-secondary-container: #E8DEF8;
  --tertiary:               #EFB8C8;
  --surface-container:      #211F26;
  --surface-container-high: #2B2930;
  --surface-container-low:  #36343B;
  --outline:                #938F99;
  --outline-variant:        #49454F;
  --card-shadow:   none;
  --button-shadow: none;
  --backdrop-primary:   rgba(208, 188, 255, 0.10);
  --backdrop-secondary: rgba(74, 68, 88, 0.55);
  --backdrop-tertiary:  rgba(239, 184, 200, 0.08);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 1.0625rem;   /* 17px, the app's body size */
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* The app's atmospheric background: three large organic shapes in primary,
   secondary and tertiary tones, heavily blurred and drifting off-canvas.
   Static, like OrganicBackdrop.swift, and hidden if the reader has asked for
   less transparency. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  filter: blur(70px);
}
.backdrop span {
  position: absolute;
  border-radius: 50%;
  display: block;
}
.backdrop .b1 { width: 90vw; aspect-ratio: 1; background: var(--backdrop-primary);   right: -40vw; top: -35vw; }
.backdrop .b2 { width: 80vw; aspect-ratio: 1; background: var(--backdrop-secondary); left: -42vw;  top: 30vh; }
.backdrop .b3 { width: 85vw; aspect-ratio: 1; background: var(--backdrop-tertiary);  right: -35vw; bottom: -30vw; }
@media (prefers-reduced-transparency: reduce) {
  .backdrop { display: none; }
}

h1, h2, h3 {
  /* Roboto Medium (500) carries headings, keeping the friendly MD3 feel. */
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 6.5vw, 3.4rem); }
h2 { font-size: clamp(1.65rem, 4.2vw, 2.3rem); }
h3 { font-size: 1.3rem; }
p  { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

/* One visible focus ring for everything, keyboard-first. */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: 6px;
}

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

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -120%);
  z-index: 100;
  background: var(--primary);
  color: var(--on-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 12px 12px;
  font-weight: 500;
  text-decoration: none;
}
.skip-link:focus { transform: translate(-50%, 0); }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
}

section { padding-block: clamp(3rem, 8vw, 5.5rem); }

.lede {
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  color: var(--on-surface-variant);
  max-width: 40ch;
  text-wrap: pretty;
}

/* --- Site header --------------------------------------------------------- */
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 500;
  font-size: 1.2rem;
  color: var(--on-surface);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand svg { width: 34px; height: 34px; flex: none; }
.header-link {
  font-size: 0.95rem;
  color: var(--on-surface-variant);
}

/* --- Hero ---------------------------------------------------------------- */
.hero { padding-block: clamp(2rem, 6vw, 4rem) clamp(3rem, 8vw, 5rem); text-align: center; }
.hero .mark { display: block; width: clamp(168px, 38vw, 232px); height: auto; margin: 0 auto 1.25rem; }
.hero h1 { max-width: 24ch; margin-inline: auto; }
.hero .lede { margin: 1.25rem auto 0; max-width: 46ch; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  /* The app's QuietTag: small, capsule, secondary container at 70%. */
  background: color-mix(in srgb, var(--secondary-container) 70%, transparent);
  color: var(--on-secondary-container);
  font-size: 0.8125rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
}
.eyebrow svg { width: 14px; height: 14px; flex: none; }

/* --- Buttons: always pill-shaped, like PillButtonStyle ------------------- */
.cta-group {
  margin-top: 2.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: inherit;
  font-size: 1.0625rem;
  font-weight: 500;
  padding: 1rem 2rem;
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), opacity 0.2s;
}
.cta svg { width: 18px; height: 18px; flex: none; }
.cta-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--button-shadow);
}
.cta-primary:hover { opacity: 0.9; }
.cta-primary:active { transform: scale(0.96); }
/* Pre-launch state: same pill, but plainly not a link. */
.cta-primary.is-pending { cursor: default; }
.cta-primary.is-pending:hover { opacity: 1; }
.cta-tonal {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}
.cta-note { font-size: 0.9rem; color: var(--on-surface-variant); margin: 0; }

/* --- Cards --------------------------------------------------------------- */
.cards {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  list-style: none;
  padding: 0;
  margin: 2.5rem 0 0;
}
.card {
  /* The shared card treatment: tonal fill, 24px radius, whisper of shadow.
     No border; the tonal difference from the page does the separating. */
  background: var(--surface-container-high);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 1.75rem;
}
.card h3 { margin-bottom: 0.4rem; }
.card p { color: var(--on-surface-variant); font-size: 1rem; margin: 0; }
.card .icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--secondary-container);
  color: var(--primary);
  margin-bottom: 1.1rem;
}
.card .icon svg { width: 22px; height: 22px; }

/* A two-up variant of the same grid, so four cards land as a tidy 2x2 rather
   than a row of three with an orphan underneath. */
.cards--pair {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

/* --- Screenshot showcase ------------------------------------------------- */
.showcase-scroll {
  margin-top: 2.5rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 1rem;
  /* Bleed to the viewport edges so the strip reads as scrollable on phones. */
  margin-inline: calc(clamp(1.25rem, 5vw, 2.5rem) * -1);
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
}
.showcase {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  width: max-content;
}
.showcase li {
  width: min(17rem, 68vw);
  scroll-snap-align: center;
  flex: none;
}
.showcase figure { margin: 0; }
.showcase .frame {
  background: var(--showcase);
  border-radius: var(--radius-card);
  padding: 1.25rem 1.25rem 0;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
.showcase img { border-radius: 14px 14px 0 0; }
.showcase figcaption {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--on-surface-variant);
}
.showcase figcaption b { display: block; color: var(--on-surface); font-weight: 500; }

/* --- Privacy strip ------------------------------------------------------- */
.privacy-panel {
  background: var(--surface-container-high);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: clamp(1.75rem, 5vw, 3rem);
}
.facts { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; gap: 1rem; }
.facts li { display: flex; gap: 0.85rem; align-items: flex-start; color: var(--on-surface-variant); }
.facts li svg { width: 20px; height: 20px; color: var(--primary); flex: none; margin-top: 0.3rem; }
.facts li b { color: var(--on-surface); font-weight: 500; }

/* --- Closing ------------------------------------------------------------- */
.closing { text-align: center; }
.closing blockquote {
  margin: 0 auto;
  max-width: 32ch;
  font-size: clamp(1.5rem, 4.5vw, 2.1rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.closing .after { margin-top: 1.5rem; color: var(--on-surface-variant); max-width: 44ch; margin-inline: auto; }

/* --- Footer -------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--outline-variant);
  padding-block: 3rem 4rem;
  font-size: 0.95rem;
  color: var(--on-surface-variant);
}
.site-footer .cols {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem 3rem;
  justify-content: space-between;
  align-items: flex-start;
}
.site-footer nav ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.site-footer .disclaimer {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--outline-variant);
  max-width: 60ch;
  font-size: 0.9rem;
}
