/*
 * Buddhism: Daily Dharma — support site stylesheet.
 * Palette mirrors src/theme/tokens.ts (light and dark). System fonts only;
 * nothing is fetched from a font or script CDN.
 */

:root {
  color-scheme: light dark;
  --bg: #F7F3EB;          /* warm paper */
  --surface: #FFFCF6;
  --sunken: #EFE9DD;
  --border: #DCD3C2;
  --text: #202B29;        /* deep ink */
  --muted: #5C6663;
  --primary: #395A4A;     /* pine */
  --link: #2F5A47;
  --accent-text: #8A503A; /* text-safe clay */
  --brass: #AD9266;       /* decorative only */
  --brass-text: #6F5A33;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171F1D;
    --surface: #1F2A27;
    --sunken: #131A18;
    --border: #33413D;
    --text: #EFE7D9;
    --muted: #B4AA99;
    --primary: #9FC3AF;
    --link: #A9CDB9;
    --accent-text: #E4B49E;
    --brass: #CDB483;
    --brass-text: #D8C49B;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem; /* ~17px, matching the app's body size */
  line-height: 1.6;
  overflow-x: hidden;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 16px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border: 1px solid var(--border);
}
.skip-link:focus { left: 16px; z-index: 10; }

/* Header and navigation */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 20px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  font-family: ui-serif, Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 0.95rem;
}
.site-header nav a { color: var(--link); text-decoration: none; padding: 6px 0; }
.site-header nav a:hover, .site-header nav a:focus { text-decoration: underline; }
.site-header nav a[aria-current="page"] {
  color: var(--text);
  border-bottom: 2px solid var(--brass);
}

/* Content */
main { padding: 28px 0 40px; }

h1, h2, h3 {
  font-family: ui-serif, Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; margin-top: 2em; }
h3 { font-size: 1.15rem; margin-top: 1.5em; }
h2 + h3 { margin-top: 1em; }

p, ul, ol, dl, table, blockquote, pre { margin: 0 0 1em; }
ul, ol { padding-left: 1.4em; }
li { margin-bottom: 0.35em; }

a { color: var(--link); overflow-wrap: anywhere; }
a:hover, a:focus { text-decoration-thickness: 2px; }

.subtitle {
  font-size: 1.15rem;
  color: var(--muted);
  margin-top: -0.25em;
}
.lede { font-size: 1.1rem; }
.meta { color: var(--muted); font-size: 0.95rem; }
.small { font-size: 0.95rem; }

blockquote {
  border-left: 3px solid var(--brass);
  margin-left: 0;
  padding: 4px 0 4px 16px;
  color: var(--text);
}

.note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

code, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--sunken);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 8px 10px 8px 0;
  border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; letter-spacing: 0.03em; text-transform: uppercase; }

/* Stack table rows into cards on narrow screens so nothing scrolls sideways. */
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 12px;
  }
  table.stack td { border: 0; padding: 4px 0; }
  table.stack td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }
}

/* Two-column facts on wide screens */
.columns { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .columns { grid-template-columns: 1fr 1fr; } }
.columns .note { margin: 0; }
.columns h2 { margin-top: 0; font-size: 1.2rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 32px;
  color: var(--muted);
  font-size: 0.92rem;
}
.site-footer p { margin: 0 0 0.5em; }
.site-footer a { color: var(--link); }

/* Landing page */
.hero { padding: 8px 0 4px; }
.hero .lede { font-size: 1.2rem; max-width: 40rem; }
.h-card { margin-top: 0; font-size: 1.25rem; }
.steps li { margin-bottom: 0.8em; }
