:root {
  --ink: #302447;
  --paper: #f9f6ee;
  --panel: #fff;
  --accent: #503380;
  --accent-soft: #f0eafa;
  --muted: #665d72;
  --gold: #754d10;
  --line: #e5dcd0;
  --gutter: clamp(16px, 3vw, 42px);
  --site-width: 1450px;
  --serif: var(--jke-font-reading, Georgia, serif);
  --sans: var(--jke-font-ui, system-ui, sans-serif);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); line-height: 1.55; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
button { min-height: 44px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
button:not(:disabled):hover { border-color: var(--accent); }
:where(button, a, input, summary, [tabindex]):focus-visible { outline: 3px solid #7b4ed8; outline-offset: 3px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: -10000px; top: 8px; z-index: 5; background: white; padding: 10px; }
.skip-link:focus { left: 8px; }

body .topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 28px;
  padding: 10px max(var(--gutter), calc((100% - var(--site-width)) / 2 + var(--gutter)));
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: white; font: 700 1.3rem var(--serif); }
.suite-home { display: none; }
.search { display: flex; gap: 6px; width: min(100%, 39rem); margin-left: auto; }
.search input, .subcategory-search input { min-width: 0; width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid #bfb3ce; border-radius: 9px; background: #fff; }
.search input::-webkit-search-cancel-button { display: none; }
.search-submit { background: var(--accent); color: white; font-weight: 700; }
.clear-search { color: var(--accent); }
.eyebrow { margin: 0 0 3px; color: var(--gold); font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

#indexPage { width: min(var(--site-width), 100%); margin: auto; padding: 20px var(--gutter) 48px; }
.welcome { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 16px; }
.welcome h1 { margin: 0; font: 700 clamp(1.65rem, 3vw, 2.55rem)/1.15 var(--serif); }
.collection-count { margin: 0; color: var(--muted); font-size: .9rem; }
.index-layout { display: grid; grid-template-areas: "subject" "alphabet" "results"; gap: 10px; align-items: start; }
.subject-panel { grid-area: subject; }
.alphabet-panel { grid-area: alphabet; }
.results-panel { grid-area: results; min-width: 0; }
.subject-panel, .alphabet-panel { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.subject-panel > summary, .alphabet-panel > summary { min-height: 44px; padding: 10px 14px; color: var(--accent); font-weight: 700; cursor: pointer; }
.subject-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 3px; padding: 0 8px 8px; }
.subject-list button { width: 100%; text-align: left; background: transparent; border-color: transparent; font-size: .94rem; }
.subject-list button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.subcategory-panel { border-top: 1px solid var(--line); padding: 10px 0 0; }
.subcategory-panel h3 { margin: 0 14px 8px; font-size: .95rem; }
.subcategory-search { display: grid; gap: 4px; margin: 0 14px 8px; color: var(--muted); font-size: .83rem; }
.subcategory-panel .subject-list { max-height: 18rem; overflow: auto; }
.filter-empty { margin: 8px; color: var(--muted); }
.alphabet { display: grid; grid-template-columns: repeat(auto-fit, minmax(36px, 1fr)); gap: 2px; padding: 0 8px 8px; }
.alphabet button { min-height: 44px; padding: 2px; border-color: transparent; color: var(--accent); font-weight: 700; }
.alphabet button[aria-pressed=true] { background: var(--accent); color: white; }
.active-browse { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; padding: 5px 6px 5px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: .9rem; }
.active-browse span { overflow-wrap: anywhere; }
.active-browse button { flex: none; color: var(--accent); }
.results-heading { display: flex; justify-content: space-between; align-items: end; gap: 8px 16px; margin-bottom: 8px; }
.results-heading h2 { margin: 0; font: 700 clamp(1.25rem, 2.3vw, 1.8rem)/1.2 var(--serif); overflow-wrap: anywhere; }
#resultCount { flex: none; color: var(--muted); font-size: .85rem; }
.entry-list { display: grid; gap: 6px; }
.entry-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-width: 0; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); text-decoration: none; }
.entry-card:hover { border-color: #baa9cf; background: #fdfaff; }
.entry-copy { min-width: 0; }
.entry-copy small { display: block; margin-bottom: 2px; color: var(--gold); font-size: .76rem; }
.entry-copy strong { display: block; color: var(--ink); font: 700 1.1rem/1.23 var(--serif); overflow-wrap: anywhere; }
.entry-preview { display: -webkit-box; overflow: hidden; margin-top: 3px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--muted); font-size: .9rem; line-height: 1.35; }
.entry-arrow { flex: none; color: var(--accent); font-size: 1.05rem; }
.more-results { display: block; margin: 16px auto 0; color: var(--accent); font-weight: 700; }
.empty-state { padding: 16px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); }
.jke-ip-notice { padding-bottom: 20px; }

@media (min-width: 720px) {
  .entry-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
@media (min-width: 960px) {
  html[data-jke-device-profile=desktop] .index-layout {
    grid-template-areas: "subject alphabet" "subject results";
    grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
    gap: 12px 18px;
  }
  html[data-jke-device-profile=desktop] .subject-panel { position: sticky; top: 12px; max-height: calc(100dvh - 24px); overflow: auto; }
  html[data-jke-device-profile=desktop] .subject-panel .subject-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 649px) {
  body .topbar { flex-wrap: wrap; gap: 8px; }
  .search { width: 100%; }
  #indexPage { padding-top: 14px; }
  .welcome { margin-bottom: 10px; }
  .index-layout:not(:has(details[open])) {
    grid-template-areas: "subject alphabet" "results results";
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .subject-panel > summary, .alphabet-panel > summary { padding-inline: 9px; font-size: .9rem; }
  .entry-card { padding: 9px 11px; }
  .entry-preview { -webkit-line-clamp: 1; }
}
html[data-jke-device-profile=smartphone] .entry-list { grid-template-columns: minmax(0, 1fr); }
@media print {
  .topbar, .skip-link, .jke-platform-bar, .jke-ip-notice { display: none !important; }
}
/* Shared wayfinding: shape and text carry the meaning; color reinforces the subject. */
.wayfinding-icon { width: 24px; height: 24px; flex: none; display: inline-block; vertical-align: middle; }
.topic-mark { --topic-ink: #28685d; --topic-paper: #eaf5ef; display: inline-grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 13px; background: var(--topic-paper); color: var(--topic-ink); }
.topic-mark[data-tone=history] { --topic-ink: #8a5928; --topic-paper: #fbf0dc; }
.topic-mark[data-tone=culture] { --topic-ink: #654391; --topic-paper: #f0eafa; }
.topic-mark .wayfinding-icon { width: 28px; height: 28px; }
.welcome { align-items: center; padding: 8px 0 14px; position: relative; }
.welcome-note { color: var(--muted); margin: 9px 0 0; }
.welcome-art { width: 160px; height: 92px; margin-left: auto; }
.browse-modes { display: flex; gap: 5px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 18px; }
.browse-modes button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding-inline: 18px; font-weight: 700; color: var(--muted); }
.browse-modes button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: white; }
.subject-list button { display: flex; align-items: center; gap: 9px; }
.subject-list .wayfinding-icon { width: 21px; height: 21px; }
.category-directory { display: grid; gap: 22px; }
.category-group h3 { display: flex; align-items: center; gap: 9px; margin: 8px 0 10px; font-size: 1.05rem; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 9px; }
.category-card { display: flex; align-items: center; gap: 12px; min-height: 102px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); text-decoration: none; }
.category-card:hover { border-color: #baa8d1; background: #fdfaff; }
.category-copy { flex: 1; min-width: 0; }
.category-copy strong { display: block; color: var(--ink); font: 700 1.06rem/1.3 var(--serif); overflow-wrap: anywhere; }
.category-copy small { display: block; color: var(--muted); margin-top: 5px; font-size: .8rem; }
.entry-copy { flex: 1; }
.entry-card .topic-mark { width: 37px; height: 37px; border-radius: 10px; }
.entry-card .topic-mark .wayfinding-icon { width: 24px; height: 24px; }
@media (max-width: 649px) {
  .welcome-art { display: none; }
  .welcome-note { font-size: .92rem; }
  .browse-modes button { flex: 1; padding-inline: 8px; }
  .category-card { min-height: 88px; padding: 11px; }
  .index-layout:not(:has(details[open])) { grid-template-areas: "subject" "alphabet" "results"; grid-template-columns: minmax(0, 1fr); }
  .entry-card { gap: 9px; }
}
@media (max-width: 649px) {
  .welcome { padding: 2px 0 8px; gap: 6px; }
  .welcome > div > .eyebrow, .welcome-note { display: none; }
  .welcome h1 { font-size: 1.5rem; }
  .collection-count { font-size: .8rem; }
  .browse-modes { margin-bottom: 12px; padding-bottom: 10px; }
  .results-heading h2 { font-size: 1.4rem; }
}

/* A single scrolling document inside device hosts, including after filtering. */
html.auto-height-index, html.auto-height-index body { height: auto; min-height: 0; overflow: hidden; }
html.auto-height-index body > .jke-platform-footer,
html.auto-height-index body > .jke-ip-notice,
html.auto-height-index body > [data-shared-footer] { display: none !important; }
@media (max-width: 649px) {
  :root { --gutter: 12px; }
  body .topbar { padding: 4px 12px 8px; gap: 2px 8px; }
  .topbar > div { min-width: 0; }
  .brand { gap: 6px; min-height: 44px; font-size: 1rem; line-height: 1.2; }
  .brand-mark { width: 26px; height: 26px; border-radius: 7px; font-size: 1rem; }
  .suite-home { display: inline-flex; align-items: center; justify-content: center; margin-left: auto; min-height: 44px; font-size: .85rem; }
  .search { flex-basis: 100%; gap: 5px; }
  .search input { min-height: 44px; font-size: 16px; }
  .search button { min-height: 44px; padding: 6px 10px; }
  #indexPage { padding-top: 8px; padding-bottom: 24px; }
  /* The brand already names this screen. Keep the page heading for screen readers. */
  .welcome { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; overflow: hidden; clip-path: inset(50%); }
  .browse-modes { margin-bottom: 8px; padding-bottom: 0; border: 0; }
  .browse-modes button { min-height: 44px; }
  .index-layout { gap: 8px; }
  .index-layout:has(.category-directory:not([hidden])) > .subject-panel { display: none; }
  .subject-panel > summary, .alphabet-panel > summary { min-height: 44px; padding-block: 8px; }
  .results-heading { align-items: center; margin-bottom: 6px; }
  .results-heading .eyebrow { display: none; }
  .results-heading h2 { font-size: 1.15rem; }
  .category-directory { gap: 12px; }
  .category-group h3 { margin: 6px 0; font-size: .95rem; }
  .category-grid { gap: 5px; }
  .category-card { min-height: 64px; padding: 8px 10px; gap: 9px; }
  .category-card .topic-mark { width: 32px; height: 32px; border-radius: 9px; }
  .category-card .topic-mark .wayfinding-icon { width: 22px; height: 22px; }
  .category-copy strong { font-size: 1rem; line-height: 1.25; }
  .category-copy small { margin-top: 1px; font-size: .75rem; }
  .entry-card { padding: 8px 10px; }
  .entry-card .topic-mark { display: none; }
  .entry-copy small { font-size: .72rem; margin-bottom: 1px; }
  .entry-copy strong { font-size: 1.05rem; }
  .entry-preview { font-size: .85rem; margin-top: 2px; }
}
