/*
 * Design tokens, copied from src/ui/theme.ts (THEMES.light, THEMES.dark, radius, spacing).
 * site/__tests__/contracts.test.ts fails if any value here drifts from the app. Change theme.ts first.
 * site.css uses these only: no raw colours there.
 */
:root {
  --bg: #F5F2FC;
  --glow: radial-gradient(ellipse 140% 100% at 50% 0%, rgba(139, 92, 255, 0.16) 0%, rgba(139, 92, 255, 0) 100%);
  --card: #FFFFFF;
  --card-border: rgba(60, 30, 140, 0.06);
  --card-shadow: 0 1px 2px rgba(35, 20, 90, 0.05), 0 8px 24px rgba(70, 40, 180, 0.07);
  --text: #17112E;
  --text-secondary: #625B7F;
  --border: #E6E0F4;
  --accent: #5B2EEB;
  --accent-soft: #ECE6FF;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-card: 22px;
  --radius-pill: 999px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-xxl: 32px;

  /* SF Pro Rounded (theme.ts `fonts.display`) for titles and numbers; the system font for text. No web fonts. */
  --font-display: ui-rounded, -apple-system, system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0720;
    --glow: radial-gradient(ellipse 140% 100% at 50% 0%, rgba(124, 77, 255, 0.3) 0%, rgba(124, 77, 255, 0) 100%);
    --card: #161130;
    --card-border: rgba(205, 184, 255, 0.08);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    --text: #F4F1FF;
    --text-secondary: #ADA6CF;
    --border: #2A2350;
    --accent: #A08BFF;
    --accent-soft: rgba(160, 139, 255, 0.16);
  }
}

/*
 * Notes AI website layout (NOTES-9 design brief). iPhone first; one desktop step at 900px.
 * Colours come only from tokens.css (var(--…)): site/__tests__/contracts.test.ts rejects raw colours here.
 * Text sizes are in rem (1rem = 16px) so Safari's text zoom works. No fixed heights on anything with text.
 */

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

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

html {
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5rem;
  overflow-wrap: break-word;
}

/* The violet light from the top of the screen (theme.glow on its 460pt view). Behind everything. */
.glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: -1;
  height: 460px;
  background-image: var(--glow);
  pointer-events: none;
}

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

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

a {
  color: inherit;
  text-underline-offset: 3px;
  transition: opacity 150ms ease-out;
}

a:active {
  opacity: 0.8;
}

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

@media (hover: hover) {
  a:hover {
    text-decoration-thickness: 2px;
  }
}

.container {
  width: 100%;
  max-width: calc(680px + 2 * var(--space-xl));
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

/* ---------- Header ---------- */

.site-header-inner {
  display: flex;
  align-items: center;
  min-height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 44px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.375rem;
  text-decoration: none;
}

.brand-icon {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 22.37%;
}

.brand-small {
  font-size: 0.9375rem;
  line-height: 1.25rem;
}

.brand-small .brand-icon {
  width: 22px;
  height: 22px;
}

/* ---------- Shared pieces ---------- */

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

.section {
  margin-top: 64px;
}

.section-title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 2.125rem;
}

.prose {
  overflow-wrap: anywhere;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
}

.prose code {
  padding: 0 var(--space-xs);
  border-radius: var(--radius-sm);
  background-color: var(--accent-soft);
  font-size: 0.9em;
}

/* Section bodies on the landing page: secondary prose, then any list as one card with a row per item. */
/* flow-root: a first child's top margin adds to the body's instead of collapsing into it. */
.section-body {
  display: flow-root;
  margin-top: var(--space-md);
}

.section-body p {
  max-width: 640px;
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.625rem;
}

.section-body p + p {
  margin-top: var(--space-lg);
}

.card-list {
  margin-top: 20px;
  padding: 0;
  list-style: none;
  background-color: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
}

/* A body that is only a list: h2 to card is 20 (12 + 8; 12 + 12 = 24 from 900px), like the price card. */
.section-body > .card-list:first-child {
  margin-top: var(--space-sm);
}

.card-list li {
  position: relative;
  padding: 14px 20px 14px calc(20px + 8px + var(--space-md));
  color: var(--text);
  font-size: 1.0625rem;
  line-height: 1.5rem;
}

.card-list li + li {
  border-top: 1px solid var(--border);
}

/* The accent dot, centred on the first line. Decorative: an empty ::before isn't announced. */
.card-list li::before {
  content: '';
  position: absolute;
  left: 20px;
  top: calc(14px + (1.5rem - 8px) / 2);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent);
}

.card-list + p {
  margin-top: var(--space-lg);
}

/* Lists in step texts and FAQ answers stay plain lists. */
.step-text ul,
.step-text ol,
.faq-answer ul,
.faq-answer ol {
  margin-top: var(--space-sm);
  padding-left: 22px;
}

.step-text p + p,
.step-text p + ul,
.step-text p + ol,
.faq-answer p + p,
.faq-answer p + ul,
.faq-answer p + ol {
  margin-top: var(--space-sm);
}

/* ---------- Hero #top ---------- */

.hero {
  max-width: 720px;
  margin: 0 auto;
  padding-top: 28px;
  text-align: center;
}

.hero-logo {
  width: 112px;
  margin: 0 auto var(--space-xl);
}

.hero-title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 2.125rem;
  font-weight: 700;
  line-height: 2.5rem;
}

.hero-line {
  margin-top: var(--space-md);
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.625rem;
}

.hero-action {
  display: flex;
  justify-content: center;
  margin-top: var(--space-xl);
}

/* Link fields while they're placeholders: the literal text in a dashed box, unlinked (brief §7). */
.placeholder-box,
.placeholder-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  border: 1.5px dashed var(--accent);
  color: var(--accent);
  font-weight: 600;
  overflow-wrap: anywhere;
  text-align: center;
}

.placeholder-box {
  min-width: 164px;
  min-height: 52px;
  padding: var(--space-sm) 20px;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  line-height: 1.25rem;
}

.placeholder-pill {
  min-height: 50px;
  padding: var(--space-sm) var(--space-xl);
  border-radius: var(--radius-pill);
  font-size: 1.0625rem;
  line-height: 1.375rem;
}

/* Apple's badge, unaltered, 52px tall, with at least a quarter of its height clear around it. */
.badge-link {
  display: inline-block;
  margin: 13px;
  border-radius: var(--radius-md);
}

.badge {
  width: auto;
  height: 52px;
}

/* The support email, styled as the app's secondary button (Button.tsx). */
.email-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: var(--space-sm) var(--space-xl);
  border-radius: var(--radius-pill);
  background-color: var(--accent-soft);
  color: var(--accent);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.375rem;
  overflow-wrap: anywhere;
  text-align: center;
  text-decoration: none;
}

@media (hover: hover) {
  .badge-link:hover,
  .email-button:hover {
    opacity: 0.85;
  }
}

@media (min-width: 600px) {
  .email-button {
    display: inline-flex;
    width: fit-content;
  }
}

/* ---------- How it works #how-it-works ---------- */

.steps {
  display: grid;
  gap: var(--space-md);
  margin-top: 20px;
  padding: 0;
  list-style: none;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
  padding: 20px;
}

.step-number {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--radius-md);
  background-color: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.5rem;
}

.step-body {
  min-width: 0;
}

.step-title {
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.375rem;
}

.step-text {
  margin-top: var(--space-xs);
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.5rem;
}

/* ---------- Privacy #privacy: the promise, in one glowing card ---------- */

.privacy-card {
  padding: var(--space-xl);
  background-image: var(--glow);
}

.privacy-link-row {
  margin-top: var(--space-sm);
}

.arrow-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.375rem;
  text-decoration: none;
}

.arrow-link-label {
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (hover: hover) {
  .arrow-link:hover .arrow-link-label {
    text-decoration-thickness: 2px;
  }
}

/* ---------- Price #price and requirements #requirements ---------- */

.price-card {
  margin-top: 20px;
  padding: var(--space-xl);
}

.price-figure {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 2.875rem;
  overflow-wrap: anywhere;
}

.price-text {
  margin-top: var(--space-sm);
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.5rem;
}

.price-text p + p {
  margin-top: var(--space-sm);
}

.price-text .card-list {
  margin-top: var(--space-md);
}

/* ---------- Support #support ---------- */

.support-email {
  margin-top: 20px;
}

.faq {
  margin-top: 20px;
}

.faq-item {
  padding: 18px 20px;
}

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

.faq-question {
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.375rem;
}

.faq-answer {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.5rem;
}

/* ---------- Privacy policy and 404: one reading column ---------- */

.reading {
  padding-top: var(--space-xl);
}

.page-title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 2.125rem;
  font-weight: 700;
  line-height: 2.5rem;
}

.page-updated {
  margin-top: var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.375rem;
}

.page-text {
  margin-top: var(--space-md);
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.625rem;
}

.strong-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: var(--space-sm);
  color: var(--accent);
  font-size: 1.0625rem;
  font-weight: 600;
  text-decoration: underline;
}

/* The policy: long reading, so body text in --text. Plain lists, no cards: this is legal text. */
.policy {
  margin-top: var(--space-xl);
  color: var(--text);
  font-size: 1.0625rem;
  line-height: 1.625rem;
}

.policy p + p,
.policy p + ul,
.policy p + ol,
.policy ul + p,
.policy ol + p {
  margin-top: var(--space-lg);
}

.policy h2 {
  margin-top: var(--space-xxl);
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.75rem;
}

.policy h3 {
  margin-top: var(--space-xl);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.375rem;
}

.policy h4 {
  margin-top: var(--space-lg);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5rem;
}

.policy > :first-child {
  margin-top: 0;
}

.policy h2 + *,
.policy h3 + *,
.policy h4 + * {
  margin-top: var(--space-sm);
}

.policy ul,
.policy ol {
  padding-left: 22px;
}

.policy li + li {
  margin-top: 6px;
}

.policy li::marker {
  color: var(--accent);
}

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

.site-footer {
  margin-top: 80px;
}

.site-footer-inner {
  padding: var(--space-lg) 0 40px;
  border-top: 1px solid var(--border);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-xl);
  padding: 0;
  list-style: none;
}

.footer-links a,
.footer-text {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.25rem;
}

.footer-links a {
  text-decoration: underline;
}

.footer-links a[aria-current='page'] {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Desktop: 900px and up ---------- */

@media (min-width: 900px) {
  .glow {
    height: 560px;
  }

  .container {
    max-width: calc(1040px + 2 * var(--space-xl));
  }

  .reading {
    max-width: calc(680px + 2 * var(--space-xl));
  }

  .site-header-inner {
    min-height: 72px;
  }

  .section {
    margin-top: 96px;
  }

  .section-title {
    font-size: 2.125rem;
    line-height: 2.5rem;
  }

  .card-list,
  .steps,
  .price-card {
    margin-top: var(--space-xl);
  }

  .section-body > .card-list:first-child {
    margin-top: var(--space-md);
  }

  .hero {
    padding-top: 48px;
  }

  .hero-logo {
    width: 144px;
    margin-bottom: var(--space-xxl);
  }

  .hero-title {
    font-size: 3.25rem;
    line-height: 3.625rem;
  }

  .hero-line {
    margin-top: var(--space-lg);
    font-size: 1.25rem;
    line-height: 1.875rem;
  }

  .hero-action {
    margin-top: var(--space-xxl);
  }

  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-lg);
  }

  .step {
    flex-direction: column;
    padding: var(--space-xl);
  }

  .privacy-card {
    padding: 40px;
  }

  .duo {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-xl);
    margin-top: 96px;
  }

  .duo > .section {
    margin-top: 0;
  }

  .support {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 40px;
    align-items: start;
  }

  .support .faq {
    margin-top: 0;
  }

  .faq-item {
    padding: 20px var(--space-xl);
  }

  .site-footer {
    margin-top: 112px;
  }

  .site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    column-gap: var(--space-xl);
    padding-bottom: 48px;
  }
}
