/* The Twelve Houses — Slogit online book
   Layout: a purple-and-gold book band over a parchment reading column; chapters as cards on the cover. */
:root {
  --bg: #f5efe4;
  --bg2: #ede1cc;
  --panel: #fffaef;
  --ink: #23180f;
  --muted: #6f5f4d;
  --line: rgba(80, 55, 20, 0.18);
  --gold: #c9a45b;
  --link: #7a5a1a;
  --accent-text: #6e4e14;
  --purple: #251135;
  --purple-deep: #16091f;
  --purple-ink: #fff8e8;
  --gold-on-purple: #f0d38a;
  --chart-bar: #c7b99d;
  --display: "Cormorant Garamond", "Palatino Linotype", Georgia, serif;
  --body: Georgia, "Times New Roman", serif;
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08070b; --bg2: #15101d; --panel: #14101c; --ink: #f6ecd6; --muted: #c7b99d;
    --line: rgba(255, 216, 139, 0.18); --gold: #d7ad55; --link: #f0d38a; --accent-text: #ffe2a0;
    --chart-bar: #4a3d5c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #08070b; --bg2: #15101d; --panel: #14101c; --ink: #f6ecd6; --muted: #c7b99d;
  --line: rgba(255, 216, 139, 0.18); --gold: #d7ad55; --link: #f0d38a; --accent-text: #ffe2a0;
  --chart-bar: #4a3d5c; color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.68; }
a { color: var(--link); text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
a:focus-visible, .card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
img { max-width: 100%; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple) 55%, #120717);
  border-bottom: 1px solid rgba(240, 211, 138, 0.25);
  color: var(--purple-ink);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 10px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { color: var(--gold-on-purple); text-decoration: none; font-family: var(--display); font-size: 21px; font-weight: 600; letter-spacing: .02em; }
.brand span { color: var(--purple-ink); opacity: .7; font-weight: 500; }
.histlink { color: var(--purple-ink); text-decoration: none; font-family: var(--display); font-size: 17px; font-weight: 600; padding: 3px 10px; border-radius: 6px; border: 1px solid rgba(240, 211, 138, 0.35); margin-left: auto; }
.histlink:hover { background: rgba(240, 211, 138, 0.14); }
.histlink[aria-current="page"] { background: var(--gold-on-purple); color: var(--purple-deep); }
.strip { display: flex; flex-wrap: wrap; gap: 2px; }
@media (max-width: 760px) { .strip { flex-wrap: nowrap; overflow-x: auto; margin-left: 0; width: 100%; scrollbar-width: none; } .strip a { flex: none; } }
.strip a { color: var(--purple-ink); text-decoration: none; font-family: var(--display); font-size: 15px; font-weight: 600; min-width: 34px; text-align: center; padding: 3px 6px; border-radius: 6px; opacity: .8; }
.strip a:hover { background: rgba(240, 211, 138, 0.14); opacity: 1; }
.strip a[aria-current="page"] { background: var(--gold-on-purple); color: var(--purple-deep); opacity: 1; }

/* ---------- purple band (cover + chapter heads) ---------- */
.band {
  background:
    radial-gradient(ellipse at 80% 20%, rgba(215, 173, 85, 0.16), transparent 55%),
    linear-gradient(160deg, var(--purple-deep), var(--purple) 60%, #120717);
  color: var(--purple-ink);
}
.band-inner { position: relative; max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 48px 52px; }
.eyebrow { font-family: var(--body); font-size: 12.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-on-purple); }
.band h1 { font-family: var(--display); font-weight: 600; font-size: clamp(40px, 7vw, 76px); line-height: 1.02; margin: 10px 0 12px; color: #fff3d6; text-wrap: balance; }
.band .lede { font-size: 19px; max-width: 58ch; color: rgba(255, 248, 232, 0.86); margin: 0; }
.band .latin { font-family: var(--display); font-style: italic; font-size: 24px; color: var(--gold-on-purple); margin: 0 0 6px; }
.band .byline { margin-top: 22px; font-size: 14px; letter-spacing: .06em; color: rgba(255, 248, 232, 0.7); }

.cover { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 40px; align-items: center; }
@media (max-width: 860px) { .cover { grid-template-columns: 1fr; } }
.wheel { width: 100%; max-width: 420px; justify-self: center; aspect-ratio: 1; }
.wheel svg { width: 100%; height: 100%; display: block; }
.wheel a path { fill: rgba(255, 248, 232, 0.03); stroke: rgba(240, 211, 138, 0.45); stroke-width: 1; transition: fill .2s; }
.wheel a:hover path, .wheel a:focus path { fill: rgba(240, 211, 138, 0.18); }
.wheel a text { fill: var(--gold-on-purple); font-family: var(--display); font-weight: 600; }
.wheel .axis { stroke: var(--gold-on-purple); stroke-width: 1.6; }
.wheel .axis-label { fill: rgba(255, 248, 232, 0.75); font-family: var(--body); font-size: 11px; letter-spacing: .12em; }

/* ---------- reading column ---------- */
.page { max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 44px 64px; }
.prose { max-width: 70ch; }
.prose h2 { font-family: var(--display); font-weight: 600; font-size: clamp(30px, 4vw, 40px); line-height: 1.12; margin: 2.2em 0 .4em; text-wrap: balance; color: var(--ink); }
.prose h2:first-child { margin-top: 0; }
.prose h2::before { content: ""; display: block; width: 44px; height: 2px; background: var(--gold); margin-bottom: 18px; }
.prose h3 { font-family: var(--display); font-weight: 600; font-size: 25px; line-height: 1.2; margin: 1.7em 0 .3em; color: var(--accent-text); }
.prose h4 { font-family: var(--body); font-size: 15px; letter-spacing: .1em; text-transform: uppercase; margin: 1.6em 0 .3em; color: var(--muted); }
.prose p { margin: .7em 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .25em 0; }
.prose blockquote { margin: 1.2em 0; padding: 14px 20px; border-left: 3px solid var(--gold); background: var(--panel); border-radius: 0 10px 10px 0; color: var(--ink); }
.prose blockquote p { margin: .3em 0; }
.prose em { font-style: italic; }
.prose .xref { font-size: 14.5px; margin-top: -2px; }
.prose .xref a { font-style: italic; }
.table-wrap { overflow-x: auto; margin: 1.2em 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15.5px; background: var(--panel); border-radius: 10px; overflow: hidden; }
.prose th { text-align: left; font-weight: normal; font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-on-purple); background: var(--purple); padding: 10px 14px; }
.prose td { padding: 9px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.prose td:first-child { color: var(--muted); white-space: nowrap; }

.chapter-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 48px; align-items: start; }
@media (max-width: 960px) { .chapter-layout { grid-template-columns: 1fr; } .toc { position: static; } }
.toc { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 74px); font-size: 14.5px; line-height: 1.45; border-left: 1px solid var(--line); padding-left: 16px; }
.toc .eyebrow { color: var(--accent-text); display: block; margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.toc a { color: var(--ink); text-decoration: none; opacity: .82; }
.toc a:hover { opacity: 1; color: var(--link); }
@media (max-width: 960px) { .toc { position: static; border-left: 0; padding: 16px 18px; background: var(--panel); border-radius: 12px; } }

figure.chart { margin: 1.6em 0; }
figure.chart svg { width: 100%; height: auto; display: block; }
figure.chart figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.chart .t-title { fill: var(--ink); font-family: var(--display); font-weight: 600; font-size: 26px; }
.chart .t-sub, .chart .t-lab { fill: var(--muted); font-family: var(--body); font-size: 15px; }
.chart .t-ink { fill: var(--ink); font-family: var(--body); font-size: 16px; }
.chart .bar { fill: var(--chart-bar); }
.chart .bar-hi { fill: var(--gold); }
.chart .prof { fill: var(--chart-bar); }
.chart .grid { stroke: var(--line); }
.chart .ref { stroke: var(--muted); stroke-dasharray: 4 4; }
.chart .band-hi { fill: var(--gold); fill-opacity: .1; }
.chart .hit-line { stroke: var(--gold); stroke-dasharray: 2 3; stroke-opacity: .55; }
.chart .hit-minor { fill: var(--chart-bar); }

/* ---------- intro + cards ---------- */
.intro { display: grid; grid-template-columns: minmax(0, 70ch) minmax(0, 1fr); gap: 48px; }
@media (max-width: 960px) { .intro { grid-template-columns: 1fr; } }
.aside { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; align-self: start; font-size: 15.5px; }
.aside h3 { font-family: var(--display); font-weight: 600; font-size: 22px; margin: 0 0 8px; color: var(--accent-text); }
.aside dl { margin: 0; display: grid; gap: 10px; }
.aside dt { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.aside dd { margin: 0; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 64px 0 22px; }
.section-head h2 { font-family: var(--display); font-weight: 600; font-size: clamp(30px, 4vw, 40px); margin: 0; }
.section-head p { margin: 0; color: var(--muted); font-size: 15px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 960px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .cards { grid-template-columns: 1fr; } }
.card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); text-decoration: none; transition: transform .2s, border-color .2s, box-shadow .2s; }
.card:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 16px 34px rgba(37, 17, 53, 0.18); }
.ph { position: relative; aspect-ratio: 4 / 3; max-width: 100%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, rgba(215, 173, 85, 0.22), transparent 60%), linear-gradient(160deg, var(--purple-deep), var(--purple)); }
.ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ph .num { font-family: var(--display); font-weight: 600; font-size: 64px; color: var(--gold-on-purple); line-height: 1; }
.ph .ph-label { position: absolute; left: 12px; bottom: 10px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 248, 232, 0.6); border: 1px dashed rgba(240, 211, 138, 0.45); border-radius: 6px; padding: 2px 8px; }
.card-body { padding: 16px 20px 20px; display: grid; gap: 6px; flex: 1; align-content: start; }
.card-body .eyebrow { color: var(--accent-text); font-size: 11.5px; }
.card-body h3 { font-family: var(--display); font-weight: 600; font-size: 27px; line-height: 1.1; margin: 0; }
.card-body .latin { font-family: var(--display); font-style: italic; font-size: 18px; color: var(--muted); margin: 0; }
.card-body .kw { font-size: 14.5px; color: var(--muted); margin: 4px 0 0; }
.pill { justify-self: start; margin-top: 8px; font-size: 12px; letter-spacing: .08em; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--gold); color: var(--accent-text); }
.pill.soon { border-color: var(--line); color: var(--muted); }

/* ---------- chapter footers ---------- */
.related { margin-top: 56px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; max-width: 70ch; }
.related h2 { font-family: var(--display); font-weight: 600; font-size: 26px; margin: 0 0 10px; }
.related ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 40px; max-width: 70ch; }
.pager a { display: grid; gap: 2px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--panel); }
.pager a:hover { border-color: var(--gold); }
.pager .eyebrow { color: var(--accent-text); font-size: 11px; }
.pager .next { text-align: right; grid-column: 2; }
.pager span.t { font-family: var(--display); font-size: 21px; font-weight: 600; }
.notice { border: 1px dashed var(--gold); border-radius: 12px; padding: 14px 18px; background: var(--panel); font-size: 15.5px; }
footer.site { border-top: 1px solid var(--line); }
footer.site .inner { max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 22px 30px; font-size: 13.5px; color: var(--muted); display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .card, .wheel a path { transition: none; } .card:hover { transform: none; } }

.band-num { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-family: var(--display); font-weight: 600; font-size: clamp(120px, 20vw, 260px); line-height: 1; color: rgba(240, 211, 138, 0.13); pointer-events: none; user-select: none; }
@media (max-width: 760px) { .band-num { font-size: 110px; top: 24px; transform: none; } }
.band-inner > *:not(.band-num) { position: relative; }
