/* MemoChart site — shared stylesheet.
   Tokens come from docs/DESIGN-SYSTEM.md so the site matches the app.
   Light theme in :root, dark via prefers-color-scheme. No JS, no external assets. */

:root {
  color-scheme: light dark;

  /* Color tokens (chrome only) */
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --text: #15181D;
  --text-2: #6B7180;
  --accent: #4F46E5;
  --border: #E3E5E9;
  --gridline: #D8DBE0;
  --empty-cell: #F0F1F4;
  --well: #F0F1F4;
  --accent-subtle: #EEEDF8;
  --accent-text: #FFFFFF;
  --danger: #E5484D;

  /* Spacing scale */
  --sp-1: 2px;
  --sp-2: 4px;
  --sp-3: 8px;
  --sp-4: 12px;
  --sp-5: 16px;
  --sp-6: 24px;

  /* Radii */
  --radius-panel: 6px;
  --radius-control: 4px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1014;
    --surface: #181B20;
    --text: #E6E8EC;
    --text-2: #9AA0AD;
    --accent: #6366F1;
    --border: #262A31;
    --gridline: #2C313A;
    --empty-cell: #1E222A;
    --well: #0A0C0F;
    --accent-subtle: #1C1F35;
    --accent-text: #FFFFFF;
    --danger: #F2555A;
  }
}

/* Base */

* {
  box-sizing: border-box;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  /* App body is 13px; prose reads at 16px on the web (phone readability).
     13px stays for nav, metas, and captions. */
  font-size: 16px;
  line-height: 1.55;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
}

code {
  background: var(--well);
  border-radius: var(--radius-control);
  padding: var(--sp-1) var(--sp-2);
  font-size: 0.85em;
}

.wrap {
  max-width: 960px;
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  padding-block: var(--sp-5);
}

.brand {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.site-header nav {
  display: flex;
  gap: var(--sp-5);
  font-size: 13px;
}

.site-header nav a {
  color: var(--text-2);
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a:focus-visible {
  color: var(--accent);
}

/* Hero */

.hero {
  text-align: center;
  padding-block: 48px var(--sp-6);
}

h1 {
  font-size: clamp(30px, 7vw, 48px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.hero .sub {
  max-width: 640px;
  margin: var(--sp-5) auto var(--sp-6);
  color: var(--text-2);
}

.meta {
  font-size: 13px;
  color: var(--text-2);
  margin-top: var(--sp-4);
}

/* Buttons */

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: var(--radius-control);
  padding: var(--sp-4) var(--sp-6);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.btn:hover {
  opacity: 0.9;
}

.btn:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Sections */

section {
  margin-block: 48px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--sp-4);
}

h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--sp-3);
}

/* Cards — Surface on Bg; separation by elevation, not lines; no shadows */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-6); /* adjacent cards sit 24px apart (2 x 12px detaching margin) */
}

.card {
  background: var(--surface);
  border-radius: var(--radius-panel);
  padding: var(--sp-6);
}

.card p {
  color: var(--text-2);
}

.callout {
  background: var(--accent-subtle);
}

.callout p {
  color: var(--text);
}

/* Module blocks: text beside screenshot, stacked on phones */

.module {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-6);
  align-items: center;
  margin-block: 48px;
}

.module figure img {
  border: 1px solid var(--border); /* frames the screenshot, not a region separator */
  border-radius: var(--radius-panel);
}

.module figcaption {
  font-size: 12px;
  color: var(--text-2);
  margin-top: var(--sp-3);
}

.module:nth-of-type(even) figure {
  order: -1;
}

.module p {
  color: var(--text-2);
}

/* Guides (help page) */

.guide {
  scroll-margin-top: var(--sp-6);
}

.guide figure {
  margin-block: var(--sp-5);
}

.guide figure img {
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
}

.guide ul {
  padding-left: 20px;
  color: var(--text-2);
}

.guide li {
  margin-block: var(--sp-3);
}

.toc {
  font-size: 13px;
  color: var(--text-2);
}

/* Stacked cards (download page) */

.stack {
  display: grid;
  gap: var(--sp-6);
}

/* FAQ */

.faq .card + .card {
  margin-top: var(--sp-6);
}

/* Footer */

.site-footer {
  padding-block: 48px var(--sp-6);
  font-size: 13px;
  color: var(--text-2);
}

.site-footer p {
  margin-bottom: var(--sp-3);
}

/* Phone */

@media (max-width: 720px) {
  .module {
    grid-template-columns: 1fr;
  }

  .module:nth-of-type(even) figure {
    order: 0;
  }

  .hero {
    padding-block: var(--sp-6);
  }
}
