:root {
  --ink: #172747;
  --muted: #5c6881;
  --paper: #fffdf6;
  --cream: #f6efd9;
  --navy: #152a52;
  --blue: #2b67a0;
  --sky: #d9eff6;
  --gold: #efbd4d;
  --coral: #db745d;
  --green: #6b9b73;
  --line: #c9c2ae;
  --shadow: 0 18px 45px rgba(25, 38, 68, .14);
  font-family: ui-rounded, "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  background: #e8eef4;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: linear-gradient(#edf3f8, #f7f0df 72%); min-height: 100vh; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .8rem 1rem; background: #fff; border: 3px solid var(--ink); border-radius: .7rem; }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.site-header { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.5rem; padding: .8rem clamp(1rem, 4vw, 4rem); color: #fff; background: rgba(21, 42, 82, .96); border-bottom: 4px solid var(--gold); box-shadow: 0 6px 22px rgba(18, 37, 72, .2); }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 2.7rem; height: 2.7rem; color: var(--ink); background: var(--gold); border: 2px solid #fff; border-radius: 50%; font-size: 1.4rem; }
.brand span:last-child { display: grid; line-height: 1; }
.brand small { color: #d6e4f2; font-size: .7rem; letter-spacing: .13em; text-transform: uppercase; }
.brand strong { margin-top: .22rem; font-size: 1.1rem; }
.main-nav { justify-self: center; display: flex; flex-wrap: wrap; gap: .3rem; }
.main-nav button { padding: .55rem .75rem; color: #dae6f3; background: transparent; border: 0; border-radius: 999px; cursor: pointer; }
.main-nav button:hover, .main-nav button[aria-pressed="true"] { color: var(--ink); background: #fff; }
.questbyte-link { color: #fff; font-weight: 750; text-decoration: none; white-space: nowrap; }

main { width: min(1240px, calc(100% - 2rem)); margin: 0 auto; }
.hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .55fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: end; min-height: 480px; padding: clamp(3rem, 8vw, 7rem) clamp(1rem, 4vw, 3.5rem) 4rem; background: radial-gradient(circle at 85% 18%, rgba(239,189,77,.34), transparent 27%), radial-gradient(circle at 8% 78%, rgba(43,103,160,.2), transparent 30%); border-left: 1px solid rgba(23,39,71,.12); border-right: 1px solid rgba(23,39,71,.12); }
.eyebrow { margin: 0 0 .65rem; color: var(--blue); font-size: .78rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.hero h1 { max-width: 850px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.6rem, 6vw, 5.4rem); font-weight: 700; line-height: .98; letter-spacing: -.045em; }
.hero-copy > p:not(.eyebrow) { max-width: 760px; font-size: clamp(1rem, 2vw, 1.24rem); line-height: 1.65; }
.hero-search { display: grid; grid-template-columns: 1fr auto; max-width: 720px; margin-top: 1.5rem; padding: .35rem; background: #fff; border: 2px solid var(--ink); border-radius: 1rem; box-shadow: 6px 7px 0 rgba(21,42,82,.12); }
.hero-search input { min-width: 0; padding: .85rem 1rem; border: 0; outline: 0; background: transparent; }
.hero-search button, .load-more { padding: .75rem 1.2rem; color: #fff; background: var(--blue); border: 0; border-radius: .7rem; font-weight: 800; cursor: pointer; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 1.3rem; margin-top: 1.3rem; color: var(--muted); }
.hero-stats strong { color: var(--ink); }
.hero-note { padding: 1.6rem; background: var(--paper); border: 2px solid var(--ink); border-radius: 1.2rem; box-shadow: 8px 9px 0 rgba(21,42,82,.12); transform: rotate(1deg); }
.hero-note > span { display: block; color: var(--coral); font-size: 2rem; }
.hero-note strong { font-family: Georgia, serif; font-size: 1.4rem; }
.hero-note p { color: var(--muted); line-height: 1.55; }

.path-section, .library, .method { padding: 4.2rem clamp(.5rem, 3vw, 2rem); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 1.5rem; }
.section-heading h2, .method h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.05; }
.section-heading > p { max-width: 440px; margin: 0; color: var(--muted); line-height: 1.55; text-align: right; }
.history-paths { position: relative; overflow: hidden; background: var(--navy); border: 4px solid var(--ink); border-radius: 1.5rem; box-shadow: var(--shadow); }
.history-paths img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.path-hotspots { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr); }
.path-hotspots button { position: relative; display: flex; align-items: end; justify-content: start; padding: .8rem; color: #fff; background: linear-gradient(transparent 55%, rgba(9,19,39,.72)); border: 1px solid rgba(255,255,255,.2); cursor: pointer; text-align: left; }
.path-hotspots button:hover, .path-hotspots button:focus-visible { background: rgba(239,189,77,.2); outline: 4px solid #fff; outline-offset: -6px; }
.path-hotspots span { padding: .28rem .48rem; background: rgba(21,42,82,.87); border-radius: .4rem; font-weight: 850; font-size: clamp(.65rem, 1.3vw, .9rem); }

.library { background: rgba(255,253,246,.78); border: 1px solid rgba(23,39,71,.14); border-radius: 1.8rem; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .8rem; margin-bottom: 1.5rem; padding: 1rem; background: #e7eff3; border-radius: 1rem; }
.filters label { display: grid; gap: .35rem; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.filters select { min-width: 170px; padding: .65rem .8rem; color: var(--ink); background: #fff; border: 1px solid #8895a8; border-radius: .65rem; }
.filters button { margin-left: auto; padding: .72rem .9rem; color: var(--blue); background: transparent; border: 1px solid var(--blue); border-radius: .65rem; cursor: pointer; }
.results-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.history-card { min-width: 0; overflow: hidden; background: #fff; border: 1px solid var(--line); border-top: 5px solid var(--card-colour, var(--blue)); border-radius: .9rem; box-shadow: 0 9px 24px rgba(25,38,68,.08); }
.history-card .card-copy { padding: 1.25rem; }
.card-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: 1px solid var(--line); }
.history-card .card-meta { display: flex; justify-content: space-between; gap: .7rem; color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.history-card h3 { margin: .7rem 0 .4rem; font-family: Georgia, serif; font-size: 1.35rem; line-height: 1.18; }
.history-card p { color: var(--muted); line-height: 1.55; }
.history-card button { padding: 0; color: var(--blue); background: transparent; border: 0; font-weight: 850; cursor: pointer; }
.history-card button:hover { text-decoration: underline; }
.load-more { display: block; margin: 1.5rem auto 0; }
.empty-state { grid-column: 1 / -1; padding: 3rem; text-align: center; border: 2px dashed var(--line); border-radius: 1rem; }
.timeline-list { grid-column: 1 / -1; display: grid; gap: .8rem; border-left: 4px solid var(--gold); margin-left: 1rem; padding-left: 1.3rem; }
.timeline-list .history-card { position: relative; }
.timeline-list .history-card::before { content: ""; position: absolute; left: -1.95rem; top: 1.2rem; width: .9rem; height: .9rem; background: var(--gold); border: 3px solid var(--ink); border-radius: 50%; }

.method { display: grid; grid-template-columns: .8fr 1.6fr; gap: 2rem; }
.method-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.method article { position: relative; padding: 1.2rem; background: var(--paper); border: 1px solid var(--line); border-radius: 1rem; }
.method article > span { display: grid; place-items: center; width: 2rem; height: 2rem; color: #fff; background: var(--coral); border-radius: 50%; font-weight: 900; }
.method h3 { margin: .8rem 0 .3rem; }
.method article p { margin: 0; color: var(--muted); line-height: 1.5; }

footer { display: flex; justify-content: space-between; align-items: center; gap: 2rem; padding: 2rem clamp(1.5rem, 5vw, 5rem); color: #fff; background: var(--navy); border-top: 4px solid var(--gold); }
footer p { margin: .3rem 0 0; color: #c6d4e5; }
footer a { color: #fff; font-weight: 800; }

dialog { width: min(780px, calc(100% - 1.2rem)); max-height: 92vh; padding: 0; color: var(--ink); background: transparent; border: 0; }
dialog::backdrop { background: rgba(10,22,43,.72); backdrop-filter: blur(3px); }
.entry-sheet { position: relative; overflow: auto; max-height: 92vh; padding: clamp(1.4rem, 5vw, 3.5rem); background: var(--paper); border: 4px solid var(--ink); border-radius: 1.3rem; box-shadow: var(--shadow); }
.dialog-close { position: sticky; float: right; top: 0; display: grid; place-items: center; width: 2.7rem; height: 2.7rem; color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 50%; font-size: 1.6rem; cursor: pointer; }
.entry-kicker { margin: 0 3rem .5rem 0; color: var(--blue); font-size: .78rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.entry-sheet h2 { max-width: 630px; margin: 0; font-family: Georgia, serif; font-size: clamp(2.1rem, 6vw, 3.8rem); line-height: 1; }
.entry-date { color: var(--coral); font-weight: 850; }
.entry-summary { padding: 1rem 1.15rem; background: #e7eff3; border-left: 5px solid var(--blue); font-size: 1.12rem; line-height: 1.55; }
.entry-image { display: block; width: 100%; max-height: 430px; margin: 1.2rem 0; object-fit: cover; border: 2px solid var(--ink); border-radius: 1rem; }
.entry-image[hidden] { display: none; }
.entry-body p { font-family: Georgia, serif; font-size: 1.07rem; line-height: 1.75; }
.evidence-box { margin-top: 1.5rem; padding: 1rem 1.2rem; background: #fff3cc; border: 1px solid #dfbd61; border-radius: .8rem; }
.evidence-box h3, .connections h3 { margin: 0 0 .4rem; }
.evidence-box p { margin: 0; line-height: 1.55; }
.sources-box { margin-top: 1rem; padding: 1rem 1.2rem; background: #e8f2ea; border: 1px solid #8cac91; border-radius: .8rem; }
.sources-box h3 { margin: 0 0 .4rem; }
.sources-box ul { margin: .4rem 0 0; padding-left: 1.25rem; }
.sources-box li + li { margin-top: .35rem; }
.sources-box a { color: var(--blue); font-weight: 800; }
.connections { margin-top: 1.5rem; }
.connections button { margin: .3rem .35rem .3rem 0; padding: .55rem .75rem; color: var(--ink); background: #fff; border: 1px solid var(--ink); border-radius: 999px; cursor: pointer; }

@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr auto; }
  .main-nav { grid-column: 1 / -1; justify-self: stretch; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .2rem; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-note { max-width: 520px; transform: none; }
  .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  main { width: min(100% - 1rem, 1240px); }
  .site-header { padding: .7rem; gap: .7rem; }
  .questbyte-link { font-size: .8rem; }
  .hero { padding: 3.5rem .6rem 2.5rem; }
  .hero-search { grid-template-columns: 1fr; }
  .hero-search button { margin: .25rem; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: .7rem; text-align: left; }
  .path-hotspots span { font-size: .55rem; padding: .15rem; }
  .filters { align-items: stretch; }
  .filters label, .filters select { width: 100%; }
  .filters button { margin-left: 0; }
  .results-grid, .method-grid { grid-template-columns: 1fr; }
  footer { align-items: start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
