/* ============================================================
   Thistlebase — site styles
   Identity carried from the taxonomy review page: cool marine
   paper, deep ink, thistle-heather accent, quiet slate second
   tier. Serif nameplate · system sans body · mono data.
   ============================================================ */

:root {
  --ground: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --ink: #1b2330;
  --ink-soft: #58616f;
  --ink-faint: #8b94a1;
  --line: #e1e4ea;
  --line-strong: #cfd4dd;
  --thistle: #6d5b9b;
  --thistle-deep: #4c3f78;
  --thistle-wash: #efecf6;
  --slate: #7b8798;
  --slate-deep: #5b6675;
  --link: #5a4a86;
  --shadow: 0 1px 2px rgba(27,35,48,.05), 0 10px 28px -20px rgba(27,35,48,.4);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 74rem;
  --read: 42rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #12161d; --surface: #1a212b; --surface-2: #212a35;
    --ink: #e7eaf0; --ink-soft: #a3adba; --ink-faint: #6f7986;
    --line: #29323d; --line-strong: #38434f;
    --thistle: #ab98d8; --thistle-deep: #c3b4e6; --thistle-wash: #241f31;
    --slate: #8b98a9; --slate-deep: #a3aebc; --link: #b6a6de;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px -22px rgba(0,0,0,.8);
  }
}
:root[data-theme="light"] {
  --ground: #f5f6f8; --surface: #ffffff; --surface-2: #eef0f4;
  --ink: #1b2330; --ink-soft: #58616f; --ink-faint: #8b94a1;
  --line: #e1e4ea; --line-strong: #cfd4dd;
  --thistle: #6d5b9b; --thistle-deep: #4c3f78; --thistle-wash: #efecf6;
  --slate: #7b8798; --slate-deep: #5b6675; --link: #5a4a86;
  --shadow: 0 1px 2px rgba(27,35,48,.05), 0 10px 28px -20px rgba(27,35,48,.4);
}
:root[data-theme="dark"] {
  --ground: #12161d; --surface: #1a212b; --surface-2: #212a35;
  --ink: #e7eaf0; --ink-soft: #a3adba; --ink-faint: #6f7986;
  --line: #29323d; --line-strong: #38434f;
  --thistle: #ab98d8; --thistle-deep: #c3b4e6; --thistle-wash: #241f31;
  --slate: #8b98a9; --slate-deep: #a3aebc; --link: #b6a6de;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px -22px rgba(0,0,0,.8);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--link); text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--link); }
h1, h2, h3 { text-wrap: balance; line-height: 1.15; }
img { max-width: 100%; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .6rem 1rem; border-radius: 8px; z-index: 50; }
:focus-visible { outline: 2px solid var(--thistle); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 2.2rem clamp(1rem, 4vw, 2rem) 4rem; width: 100%; }
.wrap--reading { max-width: calc(var(--read) + 6rem); }
main { flex: 1; }

.kicker {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--thistle); margin: 0 0 .6rem;
  display: inline-flex; align-items: center; gap: .45rem;
}
.kicker--link { text-decoration: none; }
.kicker--link:hover { color: var(--thistle-deep); }

/* ---- Header ---- */
.site-head { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--ground) 90%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.site-head__in { max-width: var(--wrap); margin: 0 auto; padding: .7rem clamp(1rem, 4vw, 2rem); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.wordmark { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; color: var(--ink); text-decoration: none; line-height: 1; display: inline-flex; align-items: baseline; gap: .35rem; position: relative; }
.wordmark__the { font-style: italic; font-size: .8rem; color: var(--ink-soft); }
.wordmark__logo { align-self: center; width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--line-strong); margin-right: .2rem; }
.wordmark__sub { position: absolute; left: calc(40px + .55rem); top: 100%; margin-top: 2px; font-family: var(--mono); font-size: .58rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; }
.nav { display: flex; align-items: center; gap: .3rem; }
.nav a { font-size: .9rem; color: var(--ink-soft); text-decoration: none; padding: .4rem .7rem; border-radius: 8px; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a.is-on { color: var(--thistle-deep); background: var(--thistle-wash); }
.theme-btn { margin-left: .3rem; width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); cursor: pointer; display: inline-grid; place-items: center; color: var(--ink-soft); }
.theme-btn:hover { color: var(--ink); }
.theme-btn__icon { width: 15px; height: 15px; border-radius: 50%; background: var(--thistle); box-shadow: inset -4px -4px 0 0 var(--surface); }
:root[data-theme="dark"] .theme-btn__icon, .theme-btn__icon { }
.build-flag { text-align: center; font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--thistle-deep); background: var(--thistle-wash); padding: .25rem; }

/* ---- Hero ---- */
.hero { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--surface-2), var(--ground)); }
.hero__in { max-width: var(--wrap); margin: 0 auto; padding: clamp(2.5rem, 8vw, 5rem) clamp(1rem, 4vw, 2rem); }
.hero__name { font-family: var(--serif); font-weight: 600; font-size: clamp(2.8rem, 10vw, 5.5rem); letter-spacing: -.02em; margin: .1rem 0 0; color: var(--ink); }
.hero__lede { max-width: 40ch; font-size: 1.18rem; color: var(--ink-soft); margin: 1.1rem 0 1.8rem; }
.hero__lede em { color: var(--thistle-deep); font-style: italic; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .7rem; }

/* ---- Buttons ---- */
.btn { font: inherit; font-size: .92rem; font-weight: 500; padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; transition: transform .12s ease; }
.btn:hover { border-color: var(--slate); }
.btn--primary { background: var(--thistle); border-color: var(--thistle); color: #fff; }
:root[data-theme="dark"] .btn--primary { color: #171422; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn--primary { color: #171422; } }
.btn--primary:hover { background: var(--thistle-deep); border-color: var(--thistle-deep); }
.btn--ghost { background: transparent; }
@media (prefers-reduced-motion: no-preference) { .btn:active { transform: translateY(1px); } }

/* ---- Bands / grids (home) ---- */
.band { max-width: var(--wrap); margin: 0 auto; padding: 2.6rem clamp(1rem, 4vw, 2rem); }
.band__head { margin-bottom: 1.3rem; }
.band__head h2 { font-family: var(--serif); font-size: 1.7rem; margin: 0 0 .3rem; }
.band__head p { color: var(--ink-soft); margin: 0; max-width: 60ch; }
.grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.topic-card { display: flex; flex-direction: column; gap: .5rem; padding: 1.1rem 1.15rem; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--thistle); border-radius: 12px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.topic-card--quiet { border-left-color: var(--slate); }
.topic-card:hover { border-color: var(--thistle); }
.topic-card--quiet:hover { border-color: var(--slate); }
.topic-card__hd { display: flex; align-items: center; gap: .5rem; }
.topic-card__name { font-weight: 650; font-size: 1.05rem; }
.topic-card__desc { color: var(--ink-soft); font-size: .9rem; flex: 1; }
.topic-card__meta { font-family: var(--mono); font-size: .74rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.decades { display: flex; flex-wrap: wrap; gap: .6rem; }
.decade-chip { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .6rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); min-width: 5.5rem; }
.decade-chip:hover { border-color: var(--thistle); }
.decade-chip__yr { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; }
.decade-chip__n { font-family: var(--mono); font-size: .68rem; color: var(--ink-faint); }

/* ---- Page head / crumbs ---- */
.crumbs { font-family: var(--mono); font-size: .76rem; color: var(--ink-faint); margin-bottom: 1.4rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--thistle-deep); }
.crumbs__sep { color: var(--line-strong); }
.page-head { margin-bottom: 2rem; }
.page-head h1 { font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 .5rem; display: flex; align-items: baseline; gap: .55rem; }
.page-head__lede { font-size: 1.08rem; color: var(--ink-soft); max-width: 62ch; margin: 0; }
.page-head__lede em { font-style: italic; color: var(--thistle-deep); }
.page-head__stat { font-family: var(--mono); font-size: .8rem; color: var(--ink-faint); margin: .8rem 0 0; font-variant-numeric: tabular-nums; }
.page-head--issue { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap; }
.page-head__actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---- Topics overview ---- */
.tier-sec { margin-bottom: 2.4rem; }
.tier-sec__head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.tier-sec__head h2 { font-family: var(--serif); font-size: 1.35rem; margin: 0; white-space: nowrap; }
.rule { flex: 1; height: 1px; background: var(--line); }
.cat-block { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; margin-bottom: .6rem; box-shadow: var(--shadow); overflow: hidden; }
.cat-block > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .95rem 1.1rem; }
.cat-block > summary::-webkit-details-marker { display: none; }
.cat-block__name { display: flex; align-items: center; gap: .55rem; font-weight: 650; font-size: 1.05rem; }
.cat-block__name a { color: var(--ink); text-decoration: none; }
.cat-block__name a:hover { color: var(--thistle-deep); }
.cat-block__meta { font-family: var(--mono); font-size: .76rem; color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sub-list { list-style: none; margin: 0; padding: 0 1.1rem 1rem; display: grid; gap: .1rem; }
.sub-list li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name n" "desc desc"; gap: 0 .8rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.sub-list li a { grid-area: name; font-weight: 600; font-size: .95rem; text-decoration: none; color: var(--ink); }
.sub-list li a:hover { color: var(--thistle-deep); }
.sub-list__n { grid-area: n; font-family: var(--mono); font-size: .76rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.sub-list__desc { grid-area: desc; font-size: .83rem; color: var(--ink-soft); }

/* ---- Category → subcategory cards ---- */
.sub-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.sub-card { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name n" "desc desc"; gap: .3rem .8rem; padding: 1.05rem 1.15rem; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--thistle); border-radius: 12px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.sub-card--result { border-top-color: var(--slate); }
.sub-card:hover { border-color: var(--thistle); }
.sub-card__name { grid-area: name; font-weight: 650; }
.sub-card__n { grid-area: n; font-family: var(--mono); font-size: .78rem; color: var(--thistle-deep); font-variant-numeric: tabular-nums; }
.sub-card--result .sub-card__n { color: var(--slate-deep); }
.sub-card__desc { grid-area: desc; font-size: .86rem; color: var(--ink-soft); }

/* ---- Article cards (lists) ---- */
.cards { display: flex; flex-direction: column; gap: .7rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 1rem 1.15rem; box-shadow: var(--shadow); }
.card__title { font-weight: 650; font-size: 1.08rem; color: var(--ink); text-decoration: none; display: inline-block; }
.card__title:hover { color: var(--thistle-deep); }
.card__meta { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin: .35rem 0 .5rem; font-family: var(--mono); font-size: .76rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.card__meta .yr { color: var(--thistle); }
.card__sum { margin: 0 0 .6rem; color: var(--ink-soft); font-size: .92rem; }
.card__author { font-style: italic; }

/* ---- Issues ---- */
.decade { margin-bottom: 2.4rem; }
.decade__head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.decade__head h2 { font-family: var(--serif); font-size: 1.5rem; margin: 0; }
.decade__n { font-family: var(--mono); font-size: .74rem; color: var(--ink-faint); }
.issue-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
.issue-card { display: flex; flex-direction: column; gap: .2rem; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); }
.issue-card:hover { border-color: var(--thistle); }
.issue-card__label { font-weight: 600; font-size: .95rem; }
.issue-card__n { font-family: var(--mono); font-size: .72rem; color: var(--ink-faint); }

/* ---- Article (reading) ---- */
.post__head { margin-bottom: 1.4rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.post__title { font-family: var(--serif); font-size: clamp(1.9rem, 5vw, 2.9rem); margin: .3rem 0 .7rem; }
.post__meta { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-family: var(--mono); font-size: .8rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; align-items: baseline; }
.post__meta a { color: var(--ink-soft); text-decoration: none; }
.post__meta a:hover { color: var(--thistle-deep); }
.post__author { font-style: italic; color: var(--ink-soft); }
.post__abstract { font-size: 1.18rem; line-height: 1.55; color: var(--ink); font-family: var(--serif); font-style: italic; margin: 0 0 1.5rem; padding-left: 1rem; border-left: 3px solid var(--thistle); }
.original { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 0 0 1.8rem; padding: 1rem 1.15rem; background: var(--surface-2); border-radius: 12px; }
.original__note { width: 100%; margin: .2rem 0 0; font-size: .85rem; color: var(--ink-soft); }
.post__body { font-size: 1.06rem; line-height: 1.72; }
.post__body p { margin: 0 0 1.15rem; }
.post__stub { color: var(--ink-soft); font-size: .95rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.tags { list-style: none; padding: 1.3rem 0 0; margin: 1.6rem 0 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .45rem; }
.tag { font-family: var(--mono); font-size: .74rem; text-decoration: none; padding: .25rem .6rem; border-radius: 999px; }
.tag--plain { background: var(--surface-2); color: var(--ink-soft); }
.tag--craft { background: var(--thistle-wash); color: var(--thistle-deep); }
.tag--result { background: var(--surface-2); color: var(--slate-deep); }

/* ---- Tier dot ---- */
.dot { width: .6rem; height: .6rem; border-radius: 3px; flex: none; display: inline-block; }
.dot--craft { background: var(--thistle); }
.dot--result { background: var(--slate); }

/* ---- Footer ---- */
.site-foot { border-top: 1px solid var(--line); background: var(--surface-2); margin-top: 2rem; }
.site-foot__in { max-width: var(--wrap); margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2rem); font-size: .87rem; color: var(--ink-soft); display: flex; flex-direction: column; gap: .4rem; }
.site-foot__name { font-size: 1rem; color: var(--ink); margin: 0; }
.site-foot p { margin: 0; max-width: 70ch; }
.site-foot__stat { font-family: var(--mono); font-size: .76rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; margin-top: .4rem; }
.site-foot code { font-family: var(--mono); font-size: .8rem; }

/* ---- Pagefind UI theming ---- */
.pf {
  --pagefind-ui-primary: var(--thistle);
  --pagefind-ui-text: var(--ink);
  --pagefind-ui-background: var(--surface);
  --pagefind-ui-border: var(--line-strong);
  --pagefind-ui-tag: var(--surface-2);
  --pagefind-ui-border-radius: 11px;
  --pagefind-ui-font: var(--sans);
  margin-top: 1rem;
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .wordmark__sub { display: none; }
  .page-head--issue { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
