/*
 * Shared styles for diary.lingora.org.
 *
 * Palette and spacing are lifted from the app's src/theme so the site and the
 * app read as one product. Same house rules apply here: restrained, generous
 * whitespace, no emoji as decoration.
 *
 * Phase 13's family pages will use this file too, which is why the tokens live
 * at :root rather than being inlined per page.
 */

:root {
  --cream: #fddba3;
  --cream-soft: #fcebcb;
  --background: #fff8f3;
  --surface: #ffffff;
  --surface-alt: #fff3f5;
  --primary: #e8929b;
  --primary-dark: #d06e7a;
  --primary-light: #f5c6cb;
  --text-primary: #4a3b4e;
  --text-secondary: #8c7c96;
  --text-muted: #b7adc0;
  --border: #f0e3e8;
  --divider: #f4ecf0;

  --measure: 42rem;
  --radius: 20px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

header.masthead {
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
}

header.masthead .wrap {
  padding: 1.75rem 1.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.wordmark {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--primary-dark);
  text-decoration: none;
}

.masthead .tag {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

h1 {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

h2 {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 0.6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--divider);
}

h2:first-of-type { border-top: 0; padding-top: 0; }

h3 {
  font-size: 1rem;
  margin: 1.5rem 0 0.4rem;
  color: var(--primary-dark);
}

p, li { color: var(--text-primary); }

.lede {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin: 0 0 2rem;
}

.updated {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 2.5rem;
}

ul { padding-left: 1.15rem; }
li { margin: 0.35rem 0; }

a { color: var(--primary-dark); }
a:hover { color: var(--primary); }

strong { font-weight: 650; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin: 1.5rem 0;
}

.card.quiet { background: var(--surface-alt); border-color: var(--primary-light); }

.card p:first-child { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.75rem 0.6rem 0;
  border-bottom: 1px solid var(--divider);
}

th { color: var(--text-secondary); font-weight: 650; }

/* Wide content must scroll inside itself, never the page. */
.scroll-x { overflow-x: auto; }

footer.site {
  border-top: 1px solid var(--divider);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

footer.site .wrap { padding: 1.5rem; }

@media (prefers-color-scheme: dark) {
  :root {
    /* The cream tokens have to move too. They are backgrounds, and leaving them
       at their light values while --text-primary flips to near-white puts pale
       type on a pale orange band — which is exactly what happened to the family
       page header. Kept warm rather than neutral so the identity survives. */
    --cream: #4a3a28;
    --cream-soft: #2f2620;

    --background: #1c1620;
    --surface: #241d29;
    --surface-alt: #2b2231;
    --text-primary: #f2ecf3;
    --text-secondary: #b9abc0;
    --text-muted: #8d8095;
    --border: #382d3e;
    --divider: #332a39;
    --primary-dark: #f0a8b0;
  }
}

@media print {
  header.masthead, footer.site { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .wrap { max-width: none; padding: 0; }
  a { color: #000; text-decoration: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  h2 { page-break-after: avoid; }
}
