:root {
  color-scheme: dark;
  --ink: #07111f;
  --ink-2: #0b1b2e;
  --panel: rgba(15, 35, 56, 0.82);
  --panel-solid: #10263c;
  --line: rgba(172, 205, 224, 0.19);
  --line-strong: rgba(172, 205, 224, 0.38);
  --text: #f4f8fb;
  --muted: #a9bdca;
  --cyan: #61e5e2;
  --cyan-deep: #0f7f86;
  --gold: #f1c45b;
  --rose: #ff9e9e;
  --green: #8be0a8;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --radius: 1.1rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 18rem;
  color: var(--text);
  background:
    radial-gradient(circle at 14% 7%, rgba(38, 140, 150, 0.22), transparent 28rem),
    radial-gradient(circle at 88% 22%, rgba(96, 81, 166, 0.16), transparent 30rem),
    linear-gradient(180deg, #07111f 0%, #091827 58%, #07111f 100%);
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(122, 167, 193, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 167, 193, 0.055) 1px, transparent 1px);
  background-size: 3rem 3rem;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
}

a { color: inherit; text-underline-offset: 0.22em; }
a:hover { color: var(--cyan); }

button, input, select { font: inherit; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  color: var(--ink);
  background: var(--cyan);
  border-radius: 0.45rem;
  transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  width: min(90rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 760;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  color: var(--ink);
  background: var(--cyan);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 1.25rem;
}

nav, .footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.15rem;
}

nav a, .footer-links a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

main, footer {
  position: relative;
  z-index: 1;
  width: min(90rem, calc(100% - 2rem));
  margin-inline: auto;
}

.chooser {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(18rem, 0.92fr) minmax(14rem, 0.58fr);
  gap: 1.25rem;
  align-items: stretch;
  padding: clamp(2.5rem, 6vw, 5.8rem) 0 2.6rem;
}

.intro { max-width: 47rem; }

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--cyan);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1, h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 540;
  letter-spacing: -0.035em;
}

h1 {
  max-width: 13ch;
  margin-bottom: 1rem;
  font-size: clamp(2.7rem, 6vw, 5.8rem);
  line-height: 0.96;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.04;
}

h3 { line-height: 1.2; }

.lede {
  max-width: 43rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
}

.featured-reader { margin: 1.1rem 0 0; font-size: 1rem; line-height: 1.7; }
.featured-reader a { color: var(--cyan); font-weight: 700; }
.edition-card[data-accessible="true"] { border-color: var(--cyan); }
.coverage-note, .format-note { color: var(--muted); font-size: .9rem; }

.language-picker, .scope-note {
  align-self: end;
  min-height: 12.5rem;
  padding: 1.35rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(22, 52, 78, 0.86), rgba(9, 25, 42, 0.92));
  box-shadow: var(--shadow);
}

.language-picker {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.language-picker label {
  margin-bottom: 0.6rem;
  font-weight: 740;
}

.select-wrap { position: relative; }

.select-wrap select {
  width: 100%;
  min-height: 3.25rem;
  appearance: none;
  padding: 0.7rem 2.8rem 0.7rem 0.9rem;
  color: var(--text);
  background: #081524;
  border: 1px solid var(--line-strong);
  border-radius: 0.65rem;
}

.select-wrap > span {
  position: absolute;
  top: 50%;
  right: 1rem;
  color: var(--cyan);
  transform: translateY(-50%);
  pointer-events: none;
}

#picker-help {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.scope-note {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.scope-note p { margin: 1rem 0 0; color: var(--muted); }
.scope-note strong { color: var(--text); }

.scope-symbol {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 3.45rem;
  line-height: 1;
}

.catalogue { padding: 4rem 0 5rem; }

.catalogue-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.catalogue-head > div { max-width: 50rem; }

.catalogue-summary {
  max-width: 27rem;
  margin: 0;
  color: var(--muted);
  text-align: right;
}

.controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
}

.search-control {
  display: grid;
  gap: 0.35rem;
  width: min(100%, 27rem);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.search-control input {
  min-height: 2.8rem;
  padding: 0.6rem 0.85rem;
  color: var(--text);
  background: rgba(7, 17, 31, 0.7);
  border: 1px solid var(--line-strong);
  border-radius: 0.65rem;
}

.filter-group { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.filter, #clear-filters {
  min-height: 2.55rem;
  padding: 0.55rem 0.85rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.filter:hover, .filter.active, #clear-filters:hover {
  color: var(--ink);
  background: var(--cyan);
  border-color: var(--cyan);
}

.edition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.edition-card {
  position: relative;
  display: flex;
  min-height: 25rem;
  flex-direction: column;
  padding: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgba(16, 38, 60, 0.96), rgba(8, 23, 39, 0.96));
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
  scroll-margin-top: 1rem;
  transition: transform 160ms ease, border-color 160ms ease;
}

.edition-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.edition-card:target, .edition-card.focused { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(97, 229, 226, 0.15); }

.edition-card::after {
  content: attr(data-script);
  position: absolute;
  right: -0.3rem;
  bottom: -1.55rem;
  color: rgba(150, 195, 216, 0.055);
  font-family: Georgia, serif;
  font-size: 7rem;
  line-height: 1;
  pointer-events: none;
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}

.language-tag {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.75rem;
}

.status-badge {
  padding: 0.28rem 0.52rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-complete { color: var(--green); }
.status-source-complete { color: var(--gold); }
.status-partial { color: var(--cyan); }
.status-research { color: #c4b3ff; }

.native-name {
  min-height: 1.5em;
  margin: 0 0 0.25rem;
  color: var(--cyan);
  font-size: 1.06rem;
}

.edition-card h3 {
  margin-bottom: 0.45rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.72rem;
  font-weight: 540;
  letter-spacing: -0.025em;
}

.layer {
  min-height: 2.8rem;
  margin-bottom: 1.2rem;
  color: var(--muted);
  font-size: 0.87rem;
}

.coverage { display: grid; gap: 0.9rem; margin-bottom: 1.2rem; }

.coverage-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 0.8rem;
  align-items: center;
}

.coverage-row span { color: var(--muted); font-size: 0.78rem; }
.coverage-row strong { font-size: 0.8rem; }

.track {
  grid-column: 1 / -1;
  height: 0.28rem;
  overflow: hidden;
  background: rgba(167, 195, 211, 0.13);
  border-radius: 999px;
}

.track > i {
  display: block;
  width: var(--coverage);
  height: 100%;
  background: linear-gradient(90deg, var(--cyan-deep), var(--cyan));
  border-radius: inherit;
}

.actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
}

.actions a {
  display: inline-flex;
  min-height: 2.45rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 0.55rem;
  font-size: 0.8rem;
  font-weight: 720;
  text-decoration: none;
}

.actions a.primary { color: var(--ink); background: var(--cyan); border-color: var(--cyan); }
.actions a:hover { color: var(--ink); background: var(--gold); border-color: var(--gold); }

.edition-card details {
  position: relative;
  z-index: 1;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.edition-card summary { cursor: pointer; color: var(--text); }
.edition-card ul { padding-left: 1.1rem; }

.empty-state, .noscript-card {
  margin-top: 1rem;
  padding: 2rem;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(9, 26, 44, 0.7);
}

.empty-state p { color: var(--muted); }

.method {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(2rem, 7vw, 7rem);
  padding: 5rem 0;
  border-top: 1px solid var(--line);
}

.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }

.method-grid article {
  padding: 1.1rem;
  border-left: 1px solid var(--line-strong);
}

.method-grid span { color: var(--gold); font-family: ui-monospace, monospace; font-size: 0.8rem; }
.method-grid h3 { margin: 0.8rem 0 0.45rem; }
.method-grid p { margin: 0; color: var(--muted); font-size: 0.87rem; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem 0 3rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

footer p { max-width: 37rem; margin: 0; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

@media (max-width: 68rem) {
  .chooser { grid-template-columns: 1.25fr 1fr; }
  .scope-note { grid-column: 1 / -1; min-height: auto; flex-direction: row; align-items: center; }
  .scope-note p { margin: 0 0 0 1rem; }
  .edition-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method { grid-template-columns: 1fr; }
}

@media (max-width: 48rem) {
  .site-header, .catalogue-head, .controls, footer { align-items: flex-start; flex-direction: column; }
  .site-header nav { gap: 0.75rem; }
  .chooser { grid-template-columns: 1fr; padding-top: 3rem; }
  .language-picker, .scope-note { grid-column: auto; min-height: auto; }
  .scope-note { flex-direction: row; }
  .catalogue-summary { text-align: left; }
  .search-control { width: 100%; }
  .edition-grid, .method-grid { grid-template-columns: 1fr; }
  .edition-card { min-height: 22rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
