/* gedlint rules reference page. Standalone stylesheet, no framework.
   Palette distilled from the family's hand-painted tree: aged paper,
   sepia ink, trunk brown, leaf green, and the red ink of the names. */

:root {
  --bg: #f3ead6;            /* aged paper */
  --card: #faf5e7;          /* fresher paper */
  --text: #3a2d1f;          /* sepia ink */
  --muted: #8a795f;         /* faded ink */
  --border: #ddcdaa;        /* tan rule line */
  --accent: #5c7a38;        /* leaf green */
  --accent-deep: #47622c;
  --trunk: #7a5636;         /* trunk and rings */
  --error: #b23c2e;         /* red ink of the names */
  --error-bg: #f4ddd2;
  --warn: #96681f;          /* ochre */
  --warn-bg: #f2e5c0;
  --info: #77664d;          /* ring taupe */
  --info-bg: #ebe0c6;
  --code-bg: #eadfc2;
  --radius: 8px;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #211a10;          /* walnut in the shade */
    --card: #2a2214;
    --text: #ecdfc2;
    --muted: #b1a081;
    --border: #453723;
    --accent: #a9c377;
    --accent-deep: #c0d596;
    --trunk: #b08d63;
    --error: #e28a76;
    --error-bg: #3a241c;
    --warn: #d9a95c;
    --warn-bg: #352a16;
    --info: #c8b795;
    --info-bg: #322a1c;
    --code-bg: #362c1a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

.wrap { max-width: 62rem; margin: 0 auto; padding: 0 1.25rem; }

a { color: var(--accent-deep); }
a:hover { text-decoration-thickness: 2px; }

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.08em 0.35em;
  border-radius: 4px;
}

pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
}
pre code { background: none; padding: 0; }

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

/* Header, same skeleton as the viewer */

.site-head { border-bottom: 1px solid var(--border); background: var(--card); }

.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.brand {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  font-variant: small-caps;
  color: var(--trunk);
}

.head-nav a {
  margin-left: 1.1rem;
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--muted);
}
.head-nav a:hover { color: var(--accent-deep); }

/* Page head */

h1 {
  font-variant: small-caps;
  letter-spacing: 0.03em;
  font-weight: 700;
  margin: 2.2rem 0 0.4rem;
}

.lede { color: var(--muted); max-width: 46rem; margin-top: 0; }
.lede code { color: var(--text); }

/* Using gedlint */

.usage { margin: 1.6rem 0 2rem; }
.usage h2 { margin-bottom: 0.6rem; }
.usage pre { border-left: 3px solid var(--accent); }

/* Contents */

.toc { margin: 1.6rem 0; }
.toc h2 { margin-bottom: 0.5rem; }

.style-handbook .toc { columns: 2; column-gap: 3rem; }
.style-handbook .toc section { break-inside: avoid; }
.style-handbook .toc ul { list-style: none; margin: 0.2rem 0 1rem; padding: 0; }
.style-handbook .toc li { padding: 0.1rem 0; }
.style-handbook .toc a { text-decoration: none; }
.style-handbook .toc a:hover { text-decoration: underline; }

.style-reference .toc p, .style-cards .toc p { margin: 0.2rem 0 0; }

/* Ruleset sections */

.ruleset { margin: 2.2rem 0; }

.ruleset h2 {
  font-variant: small-caps;
  letter-spacing: 0.05em;
  color: var(--trunk);
  border-bottom: 3px double var(--border);
  padding-bottom: 0.3rem;
  margin-bottom: 1.2rem;
}

.rs-meta {
  font-variant: normal;
  letter-spacing: 0;
  font-size: 0.85rem;
  font-family: var(--sans, system-ui);
  color: var(--muted);
  font-weight: 400;
}

/* One rule */

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

/* Deep links land on the rule: keep it clear of the top edge, mark it. */
.rule { scroll-margin-top: 1.5rem; }
.rule:target { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.rule h3 { margin: 0 0 0.15rem; font-size: 1.05rem; }

.anchor { text-decoration: none; }
.anchor code {
  background: var(--trunk);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.9em;
  padding: 0.15em 0.5em;
  border-radius: 5px;
}
.anchor:hover code { background: var(--accent-deep); }

.rname { font-family: var(--mono); font-size: 0.85em; color: var(--muted); }

.rtitle { margin: 0.2rem 0 0.5rem; font-style: italic; color: var(--text); }

.badges {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.4rem;
  padding: 0;
  font-family: system-ui, sans-serif;
  font-size: 0.74rem;
}

.b {
  padding: 0.14rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--bg);
}

.b.sev-error   { color: var(--error); border-color: var(--error); background: var(--error-bg); font-weight: 600; }
.b.sev-warning { color: var(--warn);  border-color: var(--warn);  background: var(--warn-bg); }
.b.sev-info    { color: var(--info);  border-color: var(--info);  background: var(--info-bg); }

.b.fix-safe  { color: var(--accent-deep); border-color: var(--accent); }
.b.fix-maybe { color: var(--warn); border-style: dashed; }
.b.fix-none  { border-style: dotted; }

.b.on  { color: var(--accent-deep); }
.b.off { border-style: dashed; }

.rule h4 {
  font-variant: small-caps;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
  color: var(--trunk);
  margin: 0.9rem 0 0.2rem;
}

.rule p { margin: 0.2rem 0; }

/* Folded prose (reference and cards) */

details summary {
  cursor: pointer;
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
  color: var(--accent-deep);
  margin-top: 0.2rem;
}
details[open] summary { margin-bottom: 0.3rem; }
details > h4:first-of-type { margin-top: 0.4rem; }

/* Before/after example */

.example .ex {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

/* GEDCOM lines are long for a half column; keep them on screen when they fit. */
.example pre {
  font-size: 0.8rem;
  line-height: 1.5;
}

.ex-before { border-left: 3px solid var(--error); margin: 0; }
.ex-after  { border-left: 3px solid var(--accent); margin: 0; }

@media (max-width: 44rem) {
  .example .ex { grid-template-columns: 1fr; }
}

/* Cards layout: a badge-first grid per ruleset */

.style-cards .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr));
  gap: 0.9rem;
}

.style-cards .rule { margin: 0; display: flex; flex-direction: column; }
.style-cards .rule details { margin-top: auto; }

/* Handbook layout: reading measure */

.style-handbook main .rule {
  border: none;
  background: none;
  padding: 0 0 1.4rem;
  margin: 0;
  max-width: 46rem;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}
.style-handbook .rule:target { box-shadow: none; }
.style-handbook .rule:last-child { border-bottom: none; }

/* Footer */

.site-foot {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1.2rem 0 2rem;
  color: var(--muted);
  font-size: 0.92rem;
}
