/*
 * nemonic.ai — shared design system.
 *
 * Tokens mirror gAscent/app/styles/tokens.ts and the brand README
 * (gAscent/assets/images/brand/nemonic/README.md): light runs brand blue on a
 * soft-gray canvas, dark runs mint on near-black. Pages follow the system
 * appearance, exactly like the app. DM Sans is the app's UI face and the
 * wordmark's face; 400 for reading, 800 for everything that speaks up.
 */

@font-face {
  font-family: "DM Sans";
  src: url("/fonts/dm-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("/fonts/dm-sans-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --canvas: #F4F5F7;
  --page: #FFFFFF;
  --sunken: #EEF0F3;
  --surface: #FFFFFF;
  --surface-2: #F4F5F7;
  --glass: rgba(0, 0, 0, 0.045);
  --glass-strong: rgba(0, 0, 0, 0.08);

  --ink: #11181C;
  --text-2: #5B6570;
  --text-3: #8A929C;

  --border: rgba(0, 0, 0, 0.10);
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.16);
  --card-border: rgba(0, 0, 0, 0.06);

  --accent: #0062F0;
  --accent-bright: #3D8AFF;
  --accent-deep: #0050C6;
  --accent-soft: rgba(0, 98, 240, 0.09);
  --accent-dim: rgba(0, 98, 240, 0.12);
  --accent-line: rgba(0, 98, 240, 0.35);
  --on-accent: #FFFFFF;

  --cta: #0A0A0A;
  --on-cta: #FFFFFF;

  /* Six-tile mark tones: primary, pale, bright (brand README). */
  --tile-a: #0062F0;
  --tile-b: #AFCFFF;
  --tile-c: #D9E9FF;

  --success: #16A34A;
  --success-soft: rgba(22, 163, 74, 0.12);
  --danger: #DC2626;
  --danger-soft: rgba(220, 38, 38, 0.10);

  /* Audio-format hues: small identifying glyphs only (formatVisuals.ts). */
  --fmt-lecture: #6D4FD0;
  --fmt-podcast: #0E7490;
  --fmt-debate: #C03434;
  --fmt-council: #0B7A54;
  --fmt-fable: #B45309;

  --shadow-card: 0 1px 2px rgba(11, 18, 32, 0.04), 0 8px 24px rgba(11, 18, 32, 0.06);
  --shadow-float: 0 2px 6px rgba(11, 18, 32, 0.05), 0 24px 56px rgba(11, 18, 32, 0.12);
  --glow: rgba(0, 98, 240, 0.16);

  --font: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 24px;
  --radius-sm: 12px;
  --max: 1200px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0A0A0A;
    --page: #0A0A0A;
    --sunken: #020403;
    --surface: #131313;
    --surface-2: #1A1A1A;
    --glass: rgba(255, 255, 255, 0.06);
    --glass-strong: rgba(255, 255, 255, 0.10);

    --ink: #FFFFFF;
    --text-2: #B4B4B4;
    --text-3: #808080;

    --border: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.16);
    --card-border: rgba(255, 255, 255, 0.08);

    --accent: #00D4AA;
    --accent-bright: #3DFFD0;
    --accent-deep: #00B894;
    --accent-soft: rgba(0, 212, 170, 0.08);
    --accent-dim: rgba(0, 212, 170, 0.12);
    --accent-line: rgba(0, 212, 170, 0.25);
    --on-accent: #06110F;

    --cta: #FFFFFF;
    --on-cta: #020403;

    --tile-a: #00D4AA;
    --tile-b: #A6FFE8;
    --tile-c: #3DFFD0;

    --success: #4ADE80;
    --success-soft: rgba(74, 222, 128, 0.12);
    --danger: #FF5C5C;
    --danger-soft: rgba(248, 113, 113, 0.15);

    --fmt-lecture: #B39DFC;
    --fmt-podcast: #4FD6EA;
    --fmt-debate: #FF8A8A;
    --fmt-council: #34D399;
    --fmt-fable: #FBBF24;

    --shadow-card: none;
    --shadow-float: 0 24px 56px rgba(0, 0, 0, 0.55);
    --glow: rgba(0, 212, 170, 0.14);
  }
}

/* ---- Base --------------------------------------------------------------- */

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

html {
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
p,
ol,
ul,
figure {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

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

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

strong,
b {
  font-weight: 800;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.nm-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 100;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--cta);
  color: var(--on-cta);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.container {
  width: min(100% - 48px, var(--max));
  margin-inline: auto;
}

@media (max-width: 600px) {
  .container {
    width: calc(100% - 32px);
  }
}

/* ---- Icons -------------------------------------------------------------- */

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Type --------------------------------------------------------------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.display,
.title {
  font-weight: 800;
  text-transform: uppercase;
  text-wrap: balance;
}

.display {
  font-size: clamp(44px, 7.4vw, 104px);
  letter-spacing: -0.022em;
  line-height: 0.94;
}

.title {
  font-size: clamp(38px, 5.4vw, 76px);
  letter-spacing: -0.018em;
  line-height: 0.96;
}

/* The App Store screenshots' highlight: a filled pill behind the key phrase.
   line-height .9 centers DM Sans caps (cap 700 / asc 992 / desc 310). */
.hl {
  display: inline-block;
  max-width: 100%;
  margin: 0.04em 0;
  padding: 0.07em 0.14em 0.05em;
  border-radius: 0.14em;
  background: var(--accent);
  color: var(--on-accent);
  line-height: 0.9;
}

.lead {
  color: var(--text-2);
  font-size: clamp(18px, 1.55vw, 21px);
  line-height: 1.55;
  text-wrap: pretty;
}

.lead em,
.accent-text {
  color: var(--accent);
  font-style: normal;
}

/* ---- Logo --------------------------------------------------------------- */

.logo {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.logo svg {
  width: 138px;
  height: 26px;
}

/* ---- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 200ms var(--ease),
    background-color 200ms var(--ease),
    border-color 200ms var(--ease),
    color 200ms var(--ease);
}

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

.btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}

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

.btn-cta:hover {
  background: var(--accent);
  color: var(--on-accent);
}

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

.btn-line:hover {
  border-color: var(--ink);
}

.btn-accent {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-sm {
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
}

.store-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 480px) {
  .store-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
}

/* ---- Navigation --------------------------------------------------------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  background: var(--canvas);
  background: color-mix(in srgb, var(--canvas) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  backdrop-filter: saturate(1.4) blur(16px);
  transition: border-color 200ms var(--ease);
}

.site-nav.is-scrolled {
  border-bottom-color: var(--border-subtle);
}

.nav-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
  transition: color 150ms var(--ease), background-color 150ms var(--ease);
}

.nav-link:hover {
  background: var(--glass);
  color: var(--ink);
}

.nav-links .btn {
  margin-left: 8px;
}

@media (max-width: 760px) {
  .nav-link {
    display: none;
  }
}

/* ---- Cards & shared product UI ----------------------------------------- */

.card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.chip .icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.icon-tile {
  width: 40px;
  height: 40px;
  display: grid;
  flex: none;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Now-playing card (matches the App Store "Keep learning" screen). */
.player {
  width: 100%;
  max-width: 400px;
  padding: 24px;
}

.player-title {
  margin-top: 12px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.player-meta {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 15px;
}

.wave {
  height: 44px;
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.wave i {
  height: var(--h);
  min-height: 3px;
  flex: 1;
  border-radius: 2px;
  background: var(--border-strong);
}

.wave i.on {
  background: var(--accent);
}

.scrub {
  position: relative;
  height: 4px;
  margin-top: 16px;
  border-radius: 4px;
  background: var(--glass-strong);
}

.scrub span {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p);
  border-radius: inherit;
  background: var(--accent);
}

.scrub span::after {
  position: absolute;
  top: 50%;
  right: -6px;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.player-time {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.player-controls {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.ctrl {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--ink);
}

.ctrl .icon {
  width: 20px;
  height: 20px;
}

.ctrl-play {
  width: 64px;
  height: 64px;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
}

.ctrl-play .icon {
  width: 24px;
  height: 24px;
}

.ctrl-rate {
  width: auto;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

/* Quick review card (interactive sample question). */
.quiz {
  padding: 32px;
  display: flex;
  flex-direction: column;
}

.quiz-question {
  margin-top: 16px;
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.quiz-options {
  margin-top: 24px;
  display: grid;
  gap: 8px;
}

.quiz-option {
  width: 100%;
  min-height: 56px;
  padding: 12px 16px 12px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease);
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-letter {
  width: 32px;
  height: 32px;
  display: grid;
  flex: none;
  place-items: center;
  border-radius: 8px;
  background: var(--glass);
  font-size: 14px;
  font-weight: 800;
}

.quiz-option.correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.quiz-option.correct .quiz-letter {
  background: var(--success);
  color: #FFFFFF;
}

.quiz-option.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.quiz-option.wrong .quiz-letter {
  background: var(--danger);
  color: #FFFFFF;
}

.quiz-option.faded {
  opacity: 0.5;
}

.quiz-result {
  min-height: 72px;
  margin-top: 24px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.55;
}

.quiz-result strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
}

/* ---- Sections ----------------------------------------------------------- */

.section {
  padding: 128px 0;
}

.section-head .title {
  margin-top: 16px;
}

.section-head .lead {
  max-width: 620px;
  margin-top: 24px;
}

.section-head.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

@media (max-width: 760px) {
  .section {
    padding: 88px 0;
  }
}

/* ---- FAQ ---------------------------------------------------------------- */

.faq-list {
  border-top: 1px solid var(--border);
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item summary {
  padding: 24px 48px 24px 0;
  position: relative;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
  list-style: none;
  cursor: pointer;
  transition: color 150ms var(--ease);
}

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

.faq-item summary:hover {
  color: var(--accent);
}

.faq-item summary::after {
  position: absolute;
  top: 50%;
  right: 4px;
  width: 12px;
  height: 12px;
  margin-top: -9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: rotate(45deg);
  transition: transform 200ms var(--ease), margin-top 200ms var(--ease);
}

.faq-item[open] summary::after {
  margin-top: -3px;
  transform: rotate(-135deg);
}

.faq-item p {
  max-width: 720px;
  padding: 0 0 24px;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.65;
}

/* ---- Final call to action ---------------------------------------------- */

.cta-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(48px, 7vw, 96px);
  border-radius: 32px;
  background: var(--accent);
  color: var(--on-accent);
}

.cta-panel .eyebrow {
  color: inherit;
  opacity: 0.8;
}

.cta-panel .title {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin-top: 16px;
}

.cta-panel .hl {
  background: var(--on-accent);
  color: var(--accent);
}

.cta-panel p {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin-top: 24px;
  font-size: clamp(18px, 1.55vw, 21px);
  line-height: 1.55;
  opacity: 0.9;
}

.cta-panel .store-actions {
  position: relative;
  z-index: 1;
  margin-top: 40px;
}

.cta-panel .btn-cta {
  background: var(--on-accent);
  color: var(--accent);
}

.cta-panel .btn-cta:hover {
  background: var(--on-accent);
  color: var(--ink);
}

.cta-panel .btn-line {
  border-color: currentColor;
  color: inherit;
}

.cta-panel .btn-line:hover {
  background: color-mix(in srgb, var(--on-accent) 12%, transparent);
}

/* Oversized six-tile n bleeding off the panel's right edge. */
.cta-mark {
  position: absolute;
  right: -3%;
  bottom: -38%;
  width: min(40%, 460px);
  aspect-ratio: 1;
  opacity: 0.18;
  pointer-events: none;
  --tile-a: var(--on-accent);
  --tile-b: var(--on-accent);
  --tile-c: var(--on-accent);
}

.cta-mark svg {
  width: 100%;
  height: 100%;
}

@media (max-width: 760px) {
  .cta-panel {
    border-radius: 24px;
  }

  .cta-mark {
    right: -22%;
    bottom: -14%;
    width: 76%;
    opacity: 0.12;
  }
}

/* ---- Footer ------------------------------------------------------------- */

.site-footer {
  padding: 48px 0 64px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--border-subtle);
}

.footer-legal {
  margin-top: 16px;
  color: var(--text-3);
  font-size: 13px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.footer-links a {
  color: var(--text-2);
  font-size: 14px;
  text-decoration: none;
  transition: color 150ms var(--ease);
}

.footer-links a:hover {
  color: var(--ink);
}

/* ---- Motion ------------------------------------------------------------- */

/* Reveal only when JS is running; without it, content is simply visible. */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 700ms var(--ease),
    transform 700ms var(--ease);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@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;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}

/* Download recovery for embedded browsers. Native dialog supplies focus trapping. */
.download-help-open { overflow: hidden; }
.download-help-link {
  display: block; width: fit-content; margin: 14px auto; padding: 8px;
  border: 0; background: none; color: var(--text-2); font: inherit;
  font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.hero .download-help-link { margin-left: 0; }
.download-help {
  box-sizing: border-box; width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 32px); margin: auto; padding: 32px 24px 20px;
  border: 1px solid var(--border); border-radius: 24px;
  background: var(--surface); color: var(--ink); text-align: left;
  box-shadow: 0 24px 80px rgba(0,0,0,.25); overflow-y: auto;
}
.download-help::backdrop { background: rgba(0,0,0,.55); }
.download-help-close {
  position: absolute; right: 8px; top: 8px; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: none; color: var(--ink);
  font-size: 28px; cursor: pointer;
}
.download-help h2 { margin: 12px 28px 12px 0; font-size: 28px; line-height: 1.15; }
.download-help p { margin: 12px 0; color: var(--text-2); font-size: 16px; line-height: 1.5; }
.download-help ol { list-style: decimal; padding-left: 24px; margin: 20px 0; }
.download-help li { padding-left: 4px; margin: 12px 0; line-height: 1.5; }
.download-help label { display: block; margin: 16px 0 6px; font-size: 14px; }
.download-help input {
  box-sizing: border-box; width: 100%; min-width: 0; padding: 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface-2); color: var(--ink); font: inherit; font-size: 16px;
}
.download-help-copy { width: 100%; margin-top: 12px; cursor: pointer; }
.download-help .download-help-status { min-height: 24px; font-size: 14px; }
.download-help :focus-visible, .download-help-link:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px;
}
@media (max-width: 600px) {
  .hero .download-help-link { margin-left: auto; }
}
