:root {
  color-scheme: light;
  --ink: #203044;
  --muted: #607085;
  --navy: #11263c;
  --navy-deep: #0a1a2c;
  --blue: #18678a;
  --gold: #c6a267;
  --paper: #fffefb;
  --line: #dce2e7;
  --background: #edf1f3;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--background); color: var(--ink); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button, input[type="submit"] { cursor: pointer; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #0c4969; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; color: #163047; }
h1 { font-size: clamp(2rem, 3.5vw, 3rem); margin: 0 0 1rem; }
h2 { font-size: clamp(1.5rem, 2vw, 2rem); margin: 1.75rem 0 .75rem; }
h3 { font-size: 1.35rem; margin: 1.4rem 0 .6rem; }
p { margin: 0 0 1rem; }
ul, ol { padding-left: 1.4rem; }
li { margin: .35rem 0; }
blockquote { margin: 1.5rem 0; padding: 1rem 1.4rem; background: #f5f7f7; border-left: 4px solid var(--gold); }
pre { max-width: 100%; overflow-x: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -5rem; z-index: 100; padding: .7rem 1rem; background: white; }
.skip-link:focus { top: 1rem; }
.eyebrow { color: #a27b42; font: 700 .72rem/1.3 system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; }

.site-header { background: linear-gradient(135deg, var(--navy-deep), #174767 75%, #21698a); color: #fff; box-shadow: 0 4px 18px #10283a20; }
.header-inner { max-width: 1320px; margin: auto; padding: 1.4rem 2rem; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.brand { display: inline-flex; align-items: center; gap: .85rem; color: white; text-decoration: none; white-space: nowrap; }
.brand:hover { color: white; }
.brand-symbol { display: grid; place-items: center; width: 3.25rem; height: 3.25rem; flex: none; border: 2px solid var(--gold); transform: rotate(-12deg); clip-path: polygon(50% 0, 90% 20%, 100% 65%, 50% 100%, 0 65%, 10% 20%); font: 800 .75rem/1 system-ui, sans-serif; letter-spacing: .05em; color: var(--gold); }
.brand strong { display: block; font: 2rem/1 Georgia, serif; letter-spacing: -.04em; }
.brand strong span { color: #9fdbef; font-weight: 400; }
.brand small { display: block; margin-top: .25rem; color: #c1d3df; font-size: .75rem; letter-spacing: .03em; }
.header-search { display: flex; width: min(100%, 430px); border: 1px solid #86acc275; border-radius: 8px; overflow: hidden; background: #fff; }
.header-search input { min-width: 0; flex: 1; border: 0; padding: .68rem .85rem; color: var(--ink); background: #fff; }
.header-search button, .search-row button { border: 0; padding: .68rem 1rem; background: var(--gold); color: #1b2e3f; font-weight: 750; }
.header-search button:hover, .search-row button:hover { background: #ddb77c; }
.primary-nav { background: #0d2337bd; border-top: 1px solid #ffffff24; }
.nav-inner { max-width: 1320px; margin: auto; padding: 0 1.4rem; display: flex; overflow-x: auto; scrollbar-width: thin; }
.nav-inner a { display: inline-block; flex: none; padding: .8rem .65rem; margin: 0 .18rem; color: #ecf3f7; text-decoration: none; font-size: .85rem; font-weight: 650; border-bottom: 3px solid transparent; }
.nav-inner a:hover, .nav-inner a:focus-visible { color: white; border-bottom-color: var(--gold); }

.site-shell { max-width: 1320px; min-height: calc(100vh - 270px); margin: auto; padding: 1.25rem 2rem 3rem; }
.edition-warning { padding: .85rem 1rem; margin-bottom: 1rem; background: #fff3d9; border: 1px solid #e8c687; border-radius: 8px; }
.breadcrumbs { color: var(--muted); font-size: .83rem; margin: 0 0 1rem; }
.breadcrumbs a { color: #40637a; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 255px; align-items: start; gap: 1.3rem; }
.main-content { min-width: 0; padding: clamp(1.2rem, 3vw, 2.5rem); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 5px 24px #2942570a; }
.main-content > :first-child { margin-top: 0; }
.main-content h2:first-child, .main-content h3:first-child { margin-top: 0; }
.main-content hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.report-link { display: block; width: fit-content; margin-left: auto; margin-bottom: .7rem; font-size: .8rem; }
.edit { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: .6rem .8rem; margin-bottom: 1rem; background: #eef6f8; border-radius: 8px; font-size: .85rem; }
.inline-form { display: inline-flex; margin: 0; }
.edit button { border: 0; background: none; color: var(--blue); text-decoration: underline; }
.sidebar { min-width: 0; font-size: .9rem; }
.sidebar h2, .sidebar h3 { font-size: 1.12rem; margin: 0 0 .6rem; }
.sidebar-card { padding: 1.2rem; background: #e1e9ed; border: 1px solid #d2dee5; border-radius: 10px; }
.sidebar-card .eyebrow { display: block; margin-bottom: .7rem; }
.sidebar-card p { color: #506479; }
.sidebar ul { padding-left: 1.2rem; }
.site-footer { display: flex; justify-content: space-between; gap: 2rem; max-width: 1320px; margin: 0 auto; padding: 2rem; border-top: 1px solid #cdd9df; color: #586b79; font-size: .85rem; }
.site-footer strong { color: var(--navy); font-family: Georgia, serif; font-size: 1.15rem; }
.site-footer p { margin: .2rem 0 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1.2rem; }

.main-content table { width: 100%; max-width: 100%; border-collapse: collapse; display: block; overflow-x: auto; white-space: normal; margin: 1rem 0 1.5rem; }
.main-content th, .main-content td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.main-content th { color: #26455b; background: #edf3f4; font-size: .78rem; letter-spacing: .03em; text-transform: uppercase; }
.main-content tr:hover td { background: #f6f9f9; }
.main-content td a { font-weight: 600; }
.spell-catalog-table th, .spell-catalog-table td { white-space: nowrap; }
.table-scroll-hint { display: none; }
.main-content .nice-textile { overflow-wrap: anywhere; }
.main-content .nice-textile p { margin-bottom: 1rem; }
.main-content .left { float: left; margin: 0 1rem 1rem 0; }
.main-content .right { float: right; margin: 0 0 1rem 1rem; }
.main-content .small { font-size: .78em; color: var(--muted); }
.main-content .disabled { color: #8b97a1; }
.main-content .pagination, .search-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin: 1.4rem 0; font-size: .85rem; }
.pagination a, .pagination .current, .search-pagination a { padding: .4rem .7rem; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; background: white; }
.pagination .current { color: #fff; background: var(--blue); }
.pagination .disabled { color: #98a3ab; }
.pagination form { display: inline-flex; align-items: center; gap: .4rem; }
.pagination select { max-width: 6rem; }
.form_settings p, .search-page-form { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.form_settings p > span, .form_settings label { min-width: 9rem; }
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]), select, textarea { max-width: 100%; padding: .6rem .7rem; border: 1px solid #bdcbd3; border-radius: 6px; background: #fff; color: var(--ink); }
textarea { width: min(100%, 40rem); min-height: 8rem; }
.form_settings input[type="submit"], .form_settings button, .main-content .submit { border: 0; padding: .62rem 1rem; border-radius: 6px; color: white; background: var(--blue); font-weight: 650; }
.filter-panel { margin: 1.5rem 0; padding: 1rem 1.2rem; background: #f3f7f8; border: 1px solid var(--line); border-radius: 9px; }
.filter-panel summary { cursor: pointer; color: var(--blue); font-weight: 700; }
.filter-panel form { margin-top: 1.2rem; }
.filter-panel .form_settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .4rem 1.5rem; }
.filter-panel .form_settings p { display: block; margin: .2rem 0; }
.filter-panel .form_settings label { display: block; margin-bottom: .3rem; font-size: .85rem; font-weight: 600; }
.filter-panel .form_settings input, .filter-panel .form_settings select { width: 100%; }
.filter-panel .form_settings input[type="checkbox"] { width: auto; }
.filter-panel .form_settings select[multiple] { min-height: 5.5rem; }

.page-heading { margin-bottom: 2rem; }
.page-heading .eyebrow { display: block; margin: 0 0 .6rem; }
.page-heading p:last-child { color: var(--muted); font-size: 1.05rem; }
.search-page-form { display: block; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: #f6f9f9; }
.search-page-form > label { display: block; margin-bottom: .4rem; font-weight: 650; }
.search-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.search-row input { min-width: min(100%, 280px); flex: 1; }
.search-row label { font-size: .85rem; }
.search-row select { min-width: 150px; }
.search-row button { border-radius: 6px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin-bottom: .5rem; }
.section-heading span { color: var(--muted); font-size: .85rem; }
.result-list { list-style: none; padding: 0; }
.result-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid #e7ecee; }
.result-list small { color: var(--muted); }
.empty-state { padding: 2rem; border: 1px dashed #c2d0d9; border-radius: 8px; background: #f8faf9; color: var(--muted); }

.home-hero { display: grid; grid-template-columns: 1.4fr .6fr; gap: 1.5rem; align-items: center; padding: 2.2rem; margin: -2.5rem -2.5rem 2rem; background: linear-gradient(125deg, #123149, #1d617c); color: white; border-radius: 12px 12px 0 0; }
.home-hero h1 { color: white; }
.home-hero p { color: #d7e8ef; max-width: 42rem; }
.home-hero .eyebrow { color: #e2c48f; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.hero-actions a { display: inline-block; padding: .65rem 1rem; border-radius: 6px; text-decoration: none; font-weight: 700; background: var(--gold); color: #1a2b3b; }
.hero-actions a + a { background: transparent; border: 1px solid #b9d0dc; color: white; }
.hero-mark { justify-self: center; display: grid; place-items: center; width: 145px; height: 145px; border: 4px solid #d0ad6c; clip-path: polygon(50% 0, 92% 22%, 100% 67%, 50% 100%, 0 67%, 8% 22%); transform: rotate(-12deg); color: #e5c487; font: 700 2rem Georgia, serif; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem; margin: 1.2rem 0 2.2rem; }
.category-grid a { display: block; padding: 1.2rem; border: 1px solid var(--line); border-radius: 9px; background: #f8faf9; color: var(--ink); text-decoration: none; font-weight: 700; }
.category-grid a:hover { border-color: #81aabb; background: #eef6f8; }
.category-grid small { display: block; color: var(--muted); font-weight: 400; }
.project-update { padding: 1.4rem; background: #f4f7f8; border-left: 4px solid var(--gold); border-radius: 6px; }
.project-update h2 { margin-top: 0; }

@media (max-width: 900px) {
  .header-inner { align-items: stretch; flex-direction: column; gap: 1rem; }
  .header-search { width: 100%; }
  .content-grid { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
  .home-hero { margin: -1.5rem -1.5rem 1.5rem; padding: 1.6rem; }
}
@media (max-width: 600px) {
  .table-scroll-hint { display: block; margin: .4rem 0; color: var(--muted); font-size: .8rem; }
  .header-inner { padding: 1rem; }
  .brand strong { font-size: 1.65rem; }
  .nav-inner { padding: 0 .5rem; }
  .site-shell { padding: .8rem .7rem 2rem; }
  .main-content { padding: 1.15rem; }
  .site-footer { padding: 1.5rem 1rem; flex-direction: column; }
  .home-hero { grid-template-columns: 1fr; margin: -1.15rem -1.15rem 1.3rem; }
  .hero-mark { display: none; }
  .search-row { align-items: stretch; flex-direction: column; }
  .search-row input, .search-row select, .search-row button { width: 100%; }
  .result-list li { flex-direction: column; gap: .1rem; }
}

/* Catalog navigation */
.site-header .header-inner { max-width: 1500px; padding: .65rem 1.25rem; gap: 1rem; }
.brand strong { font-size: 1.55rem; }
.brand-symbol { width: 2.5rem; height: 2.5rem; }
.brand small { margin-top: .1rem; }
.navigation-toggle { flex: none; display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .35rem .7rem; border: 1px solid #9bb7c9; border-radius: 7px; color: white; background: #133149; font-weight: 700; }
.navigation-toggle:hover { background: #20526d; }
.navigation-toggle span { font-size: 1.2rem; }
.site-frame { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 1rem; max-width: 1500px; margin: auto; padding: 0 1rem; }
.nav-collapsed .site-frame { grid-template-columns: minmax(0, 1fr); }
.nav-collapsed .catalog-sidebar { display: none; }
.catalog-sidebar { align-self: start; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; overscroll-behavior: contain; margin-top: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 5px 20px #2942570a; scrollbar-width: thin; }
.navigation-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); color: var(--navy); }
.navigation-close { display: none; min-height: 44px; border: 0; color: var(--blue); background: transparent; font-weight: 700; }
.navigation-level { margin: 0; padding: .4rem; list-style: none; }
.navigation-level .navigation-level { margin: .1rem 0 .3rem .55rem; padding: 0 0 0 .45rem; border-left: 1px solid var(--line); }
.navigation-item { margin: 0; }
.navigation-row { display: flex; align-items: stretch; min-height: 44px; border-radius: 6px; }
.navigation-row:hover { background: #eff5f7; }
.navigation-row > a, .navigation-label { flex: 1; min-width: 0; display: flex; align-items: center; gap: .4rem; padding: .5rem .6rem; font-size: .86rem; line-height: 1.25; text-decoration: none; color: var(--ink); }
.navigation-label { color: var(--muted); }
.navigation-label small { margin-left: auto; color: #7c8894; font-size: .65rem; }
.navigation-item.is-active > .navigation-row > a { color: #0b5273; font-weight: 700; }
.navigation-row > a[aria-current="page"] { background: #e9f1f4; box-shadow: inset 3px 0 var(--gold); }
.navigation-expand { flex: none; width: 44px; min-height: 44px; border: 0; border-radius: 6px; background: transparent; color: var(--blue); }
.navigation-expand:hover { background: #dfecef; }
.navigation-expand span { display: inline-block; transition: transform .18s ease; }
.navigation-expand[aria-expanded="true"] span { transform: rotate(180deg); }
.navigation-item > div[hidden], .search-suggestions[hidden], .navigation-backdrop[hidden] { display: none !important; }
.site-shell { width: 100%; min-width: 0; max-width: none; padding: 1rem 0 2rem; }
.content-grid { grid-template-columns: minmax(0, 1fr); }
.main-content { padding: clamp(1.15rem, 2.4vw, 2rem); }
.sidebar { display: block; }
.sidebar-card { padding: .9rem 1.1rem; }
.sidebar-card h2 { display: inline; margin-right: .6rem; }
.sidebar-card p { display: inline; }
.sidebar-card a { display: inline-block; margin-left: .5rem; }
.home-hero { grid-template-columns: minmax(0, 1fr) 90px; min-height: 0; margin: -2rem -2rem 1.4rem; padding: 1.35rem 1.7rem; }
.home-hero h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); }
.hero-mark { width: 85px; height: 85px; font-size: 1.3rem; }
.header-search { overflow: visible; position: relative; }
.search-input-wrap { position: relative; min-width: 0; flex: 1; }
.header-search input { width: 100%; }
.search-suggestions { position: absolute; z-index: 60; top: calc(100% + 3px); left: 0; right: 0; max-height: min(60vh, 420px); overflow-y: auto; margin: 0; padding: .35rem; list-style: none; border: 1px solid #b9cbd6; border-radius: 8px; background: white; box-shadow: 0 10px 30px #0a1a2c33; }
.search-suggestions li { margin: 0; }
.search-suggestions a { display: block; padding: .55rem .7rem; border-radius: 5px; color: var(--ink); text-decoration: none; }
.search-suggestions a:hover, .search-suggestions a[aria-selected="true"] { background: #e7f1f4; }
.search-suggestions small { display: block; color: var(--muted); }
.search-suggestion-status { position: absolute; z-index: 60; top: calc(100% + 3px); left: 0; right: 0; padding: .55rem .7rem; border: 1px solid #b9cbd6; border-radius: 8px; background: white; color: var(--muted); font-size: .82rem; box-shadow: 0 10px 30px #0a1a2c33; }
.spell-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem 1rem; margin: 1rem 0; }
.filter-field { min-width: 0; }
.filter-field > label { display: block; margin-bottom: .3rem; font-size: .82rem; font-weight: 700; }
.filter-field > input:not([type="checkbox"]), .filter-field > select { width: 100%; }
.filter-field > div { max-height: 10rem; overflow-y: auto; padding: .45rem; border: 1px solid var(--line); border-radius: 6px; background: white; }
.filter-field > div label { display: flex; align-items: flex-start; gap: .35rem; padding: .18rem 0; font-size: .83rem; }
.filter-field > div input { margin-top: .25rem; }
.field-error, .query-error { color: #a32724; }
.query-error { padding: .8rem; border: 1px solid #d9aaa8; border-radius: 6px; background: #fff0ee; }
.filter-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.filter-actions button { min-height: 44px; padding: .5rem 1rem; border: 0; border-radius: 6px; color: white; background: var(--blue); font-weight: 700; }
.filter-actions a { padding: .5rem; }
.filter-count { display: inline-block; margin-left: .3rem; padding: .1rem .45rem; border-radius: 20px; background: #dbe9ef; color: #194d69; font-size: .75rem; }
.active-filters { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0 1rem; }
.active-filters a { display: inline-flex; gap: .4rem; align-items: center; padding: .3rem .6rem; border: 1px solid #97bbc9; border-radius: 20px; background: #e8f2f5; color: #184e67; text-decoration: none; font-size: .8rem; }
.active-filters a:hover { background: #d8e9ef; }
.result-count { margin: .6rem 0; color: var(--muted); font-size: .88rem; }
.advanced-filters { margin-top: .8rem; }
.advanced-filters summary { cursor: pointer; font-size: .88rem; font-weight: 700; }
.image-placeholder { display: grid; place-items: center; width: 180px; min-height: 220px; padding: 1rem; border: 1px dashed #aebfc9; border-radius: 6px; background: #f2f6f8; color: var(--muted); font-size: .82rem; text-align: center; }

@media (max-width: 900px) {
  .site-frame { display: block; padding: 0 .7rem; }
  .catalog-sidebar { position: fixed; z-index: 50; top: 0; left: 0; width: min(88vw, 350px); height: 100dvh; max-height: none; margin: 0; border-radius: 0 10px 10px 0; transform: translateX(-101%); transition: transform .2s ease; visibility: hidden; }
  .nav-open .catalog-sidebar { transform: translateX(0); visibility: visible; }
  .nav-collapsed .catalog-sidebar { display: block; }
  .navigation-head { position: sticky; top: 0; z-index: 1; background: var(--paper); }
  .navigation-close { display: inline-block; }
  .navigation-backdrop { position: fixed; z-index: 40; inset: 0; background: #071b2eb3; }
  .nav-open { overflow: hidden; }
  .site-shell { padding: .8rem 0 2rem; }
  .header-inner { flex-wrap: wrap; }
  .header-search { flex-basis: 100%; width: 100%; }
  .home-hero { margin: -1.5rem -1.5rem 1.4rem; }
}
@media (max-width: 600px) {
  .site-header .header-inner { padding: .65rem .8rem; }
  .brand strong { font-size: 1.45rem; }
  .brand small { display: none; }
  .site-frame { padding: 0 .6rem; }
  .main-content { padding: 1rem; }
  .home-hero { display: block; margin: -1rem -1rem 1.2rem; padding: 1.2rem; }
  .sidebar-card p, .sidebar-card h2 { display: block; }
  .sidebar-card a { margin-left: 0; }
}
