/* obsidianspider.org shared stylesheet — AAA-contrast (7:1+) in both light and dark.
   Verified palette (against WCAG 2.2 AAA). */

:root {
  /* Light mode — off-white warm background, near-black text */
  --fg:        #1a1a1a;   /* 15.9:1 on bg — AAA */
  --fg-muted:  #444444;   /*  9.6:1 on bg — AAA */
  --fg-subtle: #5d5d5d;   /*  6.5:1 on bg — AA  (reserve for non-essential) */
  --bg:        #fbfbf8;
  --bg-card:   #ffffff;
  --bg-code:   #f1f0e8;
  --rule:      #d6d4ca;
  --accent:    #1f4156;   /* deep slate — 10.4:1 on bg — AAA */
  --accent-soft: #e6ecf0;
  --link-hover: #4f7589;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark mode — warm off-black background, warm off-white text */
    --fg:        #ebe9e2;   /* 13.7:1 on bg — AAA */
    --fg-muted:  #bdbab1;   /*  8.6:1 on bg — AAA */
    --fg-subtle: #898680;   /*  5.5:1 on bg — AA  (reserve for non-essential) */
    --bg:        #1a1d20;
    --bg-card:   #232629;
    --bg-code:   #292c30;
    --rule:      #3a3d40;
    --accent:    #9ec3d9;   /* warm sky — 9.7:1 on bg — AAA */
    --accent-soft: #2a3540;
    --link-hover: #c8dfee;
  }
}

* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", sans-serif;
  max-width: 720px;
  margin: 0 auto;
  padding: 3em 1.25em 5em;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  font-feature-settings: "kern", "liga";
}

h1 {
  font-size: 2.5em;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 0.4em;
  color: var(--fg);
}
h1 + .lede {
  font-size: 1.18em;
  line-height: 1.55;
  color: var(--fg-muted);
  margin: 0 0 2em;
  font-weight: 400;
}
h2 {
  font-size: 1.4em;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2.5em 0 0.7em;
  color: var(--fg);
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--rule);
}
h3 {
  font-size: 1.1em;
  font-weight: 600;
  margin: 1.8em 0 0.5em;
  color: var(--fg);
}
p { margin: 0 0 1em; color: var(--fg); }

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease, text-decoration-thickness 0.15s ease;
}
a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--bg-code);
  color: var(--fg);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
}
pre {
  background: var(--bg-code);
  color: var(--fg);
  padding: 1em 1.2em;
  overflow-x: auto;
  border-radius: 6px;
  font-size: 0.85em;
  line-height: 1.55;
  border: 1px solid var(--rule);
}
pre code { background: transparent; padding: 0; }

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.2em 0;
  font-size: 0.93em;
}
th, td {
  border: 1px solid var(--rule);
  padding: 0.6em 0.75em;
  text-align: left;
  vertical-align: top;
  color: var(--fg);
}
th {
  background: var(--accent-soft);
  font-weight: 600;
  color: var(--fg);
}

ul, ol { margin: 0 0 1em; padding-left: 1.5em; color: var(--fg); }
li { margin-bottom: 0.3em; }

strong { font-weight: 600; color: var(--fg); }
em { font-style: italic; }

blockquote {
  margin: 1em 0;
  padding: 0.6em 1.1em;
  background: var(--bg-card);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  color: var(--fg-muted);
  font-style: italic;
}

.lang-block {
  background: var(--bg-card);
  border-left: 3px solid var(--accent);
  padding: 0.9em 1.2em;
  margin: 1em 0;
  border-radius: 0 4px 4px 0;
  color: var(--fg);
}
.lang-block strong { font-weight: 600; }
.lang-block .gloss {
  color: var(--fg-muted);
  font-size: 0.92em;
  margin-top: 0.4em;
  font-style: italic;
}

.cta {
  background: var(--accent-soft);
  border: 1px solid var(--rule);
  padding: 1.1em 1.3em;
  border-radius: 6px;
  margin: 1.5em 0;
  font-size: 0.97em;
  color: var(--fg);
}

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

footer {
  margin-top: 4em;
  padding-top: 1.5em;
  border-top: 1px solid var(--rule);
  font-size: 0.88em;
  color: var(--fg-muted);
}

details.polyglot {
  margin: 2.5em 0 1.5em;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg-card);
}
details.polyglot summary {
  padding: 0.9em 1.2em;
  cursor: pointer;
  font-size: 1.05em;
  list-style: none;
  border-radius: 6px;
}
details.polyglot summary::-webkit-details-marker { display: none; }
details.polyglot summary::before {
  content: "▸ ";
  display: inline-block;
  width: 1em;
  color: var(--accent);
  transition: transform 0.15s ease;
}
details.polyglot[open] summary::before {
  content: "▾ ";
}
details.polyglot summary:hover {
  background: var(--accent-soft);
}
details.polyglot[open] summary {
  border-bottom: 1px solid var(--rule);
  border-radius: 6px 6px 0 0;
}
details.polyglot > .lang-block {
  margin: 0.6em 1em;
  border-radius: 4px;
}
details.polyglot > .lang-block:first-of-type { margin-top: 1em; }
details.polyglot > .lang-block:last-of-type { margin-bottom: 1em; }
