@font-face { font-family: "Cinzel"; font-weight: 400; src: url(fonts/cinzel-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Cinzel"; font-weight: 600; src: url(fonts/cinzel-latin-600-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Cinzel"; font-weight: 700; src: url(fonts/cinzel-latin-700-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "EB Garamond"; font-weight: 400; src: url(fonts/eb-garamond-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "EB Garamond"; font-weight: 400; font-style: italic; src: url(fonts/eb-garamond-latin-400-italic.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "EB Garamond"; font-weight: 500; src: url(fonts/eb-garamond-latin-500-normal.woff2) format("woff2"); font-display: swap; }

:root {
  --ink: #231a13;
  --icon: #3a2a1f;
  --ink-soft: #4a4036;
  --parchment: #f2e4bd;
  --parchment-light: #f7efd8;
  --parchment-dark: #dccb9f;
  --sea: #8fb3b3;
  --sea-deep: #6d9a9d;
  --terracotta: #b4532a;
  --terracotta-dark: #8a3b1b;
  --myth-fill: #e6b999;
  --history-fill: #bccac6;
  --place-fill-deep: #d2b673;
  --myth-fill-deep: #db9870;
  --history-fill-deep: #8ea8a6;
  --myth: #8a3b1b;
  --history: #2f5560;
  --panel-w: min(480px, 42vw);
  --display: "Cinzel", "Trajan Pro", serif;
  --text: "EB Garamond", Garamond, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--sea); color: var(--ink); font-family: var(--text); font-size: 18px; line-height: 1.45; overflow: hidden; }
a { color: var(--terracotta-dark); }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- map ---------- */
#stage { position: fixed; inset: 0; background: var(--sea); }
#map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; display: block; }
#map:active { cursor: grabbing; }
.land-halo { fill: none; stroke: var(--sea-deep); stroke-width: 6px; stroke-linejoin: round; opacity: .55; vector-effect: non-scaling-stroke; }
.land-halo.outer { stroke-width: 34px; opacity: .13; }
.land-halo.mid { stroke-width: 18px; opacity: .2; }
#decor { pointer-events: none; }
#decor image { opacity: .75; }
.land { fill: var(--parchment); stroke: var(--ink); stroke-width: .9px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

#frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
#stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 70px rgba(31, 26, 21, .22); }

.region { font-family: var(--display); font-weight: 600; fill: var(--ink); text-anchor: middle; text-transform: uppercase; pointer-events: none; transition: opacity .35s; opacity: 0; }
.region.size-1 { font-size: 22px; letter-spacing: .55em; }
.region.size-2 { font-size: 17px; letter-spacing: .5em; }
.region.size-3 { font-size: 13px; letter-spacing: .45em; }
.region.on { opacity: .5; }

.marker { cursor: pointer; transition: opacity .3s; opacity: 0; pointer-events: none; outline: none; }
.marker.on { opacity: 1; pointer-events: auto; }
.marker .hit { fill: transparent; }
.marker .disc { fill: var(--parchment-light); stroke: var(--ink); stroke-width: 1.5px; }
.marker .glyph { fill: var(--icon); stroke: var(--icon); stroke-width: .5px; stroke-linejoin: round; stroke-linecap: round; }
.marker .glyph.line { fill: none; stroke-width: 1.4px; }
.marker.myth .disc { fill: var(--myth-fill); }
.marker.t-history-event .disc { fill: var(--history-fill); }
/* hover, keyboard focus and selection deepen the marker's own tint (never full colour) */
.marker:hover .disc, .marker:focus-visible .disc, .marker.selected .disc { fill: var(--place-fill-deep); }
.marker.myth:hover .disc, .marker.myth:focus-visible .disc, .marker.myth.selected .disc { fill: var(--myth-fill-deep); }
.marker.t-history-event:hover .disc, .marker.t-history-event:focus-visible .disc, .marker.t-history-event.selected .disc { fill: var(--history-fill-deep); }
.marker text { font-family: var(--text); font-weight: 500; font-size: 15px; fill: var(--ink); paint-order: stroke; stroke: var(--parchment); stroke-width: 3.5px; stroke-linejoin: round; pointer-events: none; }

.marker.nolabel text.label { display: none; }
.marker.dot .icon, .marker.dot .count, .marker.dot .edge-arrow, .marker.dot text.label { display: none; }
.marker.dot .disc { stroke-width: 1.3px; }
.marker .edge-arrow { fill: var(--terracotta-dark); stroke: var(--parchment-light); stroke-width: 1px; }
.marker .count circle { fill: var(--ink); stroke: var(--parchment-light); stroke-width: 1.5px; }
.marker .count text { font-family: var(--text); font-weight: 500; font-size: 11px; fill: var(--parchment-light); stroke: none; text-anchor: middle; }

.route { fill: none; stroke-linecap: round; pointer-events: none; }
.route.active { stroke: var(--terracotta-dark); stroke-width: 2.5px; stroke-dasharray: 7 5; }
.route.faint { stroke: var(--terracotta-dark); stroke-width: 1.5px; stroke-dasharray: 4 5; opacity: .45; }
.stop { cursor: pointer; }
.stop circle { fill: var(--parchment-light); stroke: var(--terracotta-dark); stroke-width: 2px; }
.stop text { font-family: var(--display); font-weight: 700; font-size: 11px; fill: var(--terracotta-dark); text-anchor: middle; pointer-events: none; }
.stop.current circle { fill: var(--terracotta-dark); }
.stop.current text { fill: var(--parchment-light); }
.stop:hover circle { fill: #f3dcc4; }
.stop.current:hover circle { fill: var(--terracotta-dark); }

#layers { position: absolute; top: 30px; right: 34px; background: var(--parchment-light); border: 2px solid var(--ink); box-shadow: 3px 3px 0 rgba(31, 26, 21, .35); padding: 0 14px; min-width: 180px; font-size: 16px; z-index: 4; }
#layers[open] { padding-bottom: 10px; }
#layers summary { font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; padding: 8px 0; cursor: pointer; }
#layers label { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
#layers .layer-shape { flex: none; width: 20px; height: 20px; margin-left: -2px; }
#layers .layer-shape circle { fill: var(--parchment-light); stroke: var(--ink); stroke-width: 2.2px; }
#layers .layer-shape.myth circle { fill: var(--myth-fill); }
#layers .layer-shape.history circle { fill: var(--history-fill); }
#layers input { accent-color: var(--terracotta); width: 16px; height: 16px; margin: 0; }
#layers label.journey { flex-direction: column; align-items: stretch; gap: 3px; margin-top: 6px; padding-top: 8px; border-top: 1px solid rgba(31, 26, 21, .3); font-family: var(--display); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
#layers select { font: inherit; font-family: var(--text); font-size: 16px; letter-spacing: 0; text-transform: none; color: var(--ink); background: var(--parchment); border: 1.5px solid var(--ink); padding: 3px 6px; }
#layers input:disabled + * , #layers label:has(input:disabled) { color: var(--ink-soft); opacity: .55; cursor: default; }
#layers .focus-note { margin: 2px 0 0; font-size: 14px; font-style: italic; color: var(--terracotta-dark); max-width: 200px; }

#journey-bar { position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%); display: flex; align-items: stretch; background: var(--parchment-light); border: 2px solid var(--ink); box-shadow: 4px 4px 0 rgba(31, 26, 21, .35); z-index: 4; max-width: calc(100% - 180px); }
#journey-bar[hidden] { display: none; }
#journey-bar button { border: 0; background: none; font-size: 24px; padding: 0 14px; min-width: 44px; }
#journey-bar button:hover:not(:disabled) { background: var(--parchment-dark); }
#journey-bar button:disabled { opacity: .3; cursor: default; }
#journey-bar .prev { border-right: 1px solid var(--ink); }
#journey-bar .next { border-left: 1px solid var(--ink); }
#journey-bar .next.start { font-family: var(--display); font-size: 15px; letter-spacing: .06em; white-space: nowrap; }
#journey-bar .close { border-left: 1px solid var(--ink); font-size: 20px; }
#journey-bar .info { padding: 6px 16px; text-align: center; min-width: 220px; }
#journey-bar .title { font-family: var(--display); font-weight: 600; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); text-decoration: none; }
#journey-bar .title:hover { color: var(--terracotta-dark); }
#journey-bar .where { font-size: 16px; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#masthead { position: absolute; top: 30px; left: 34px; pointer-events: none; z-index: 4; }
#masthead a { color: inherit; text-decoration: none; pointer-events: auto; }
#masthead h1 { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: .14em; text-transform: uppercase; margin: 0; padding: 4px 12px 2px; background: var(--parchment-light); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--terracotta); }
#masthead p { margin: 6px 0 0 4px; font-style: italic; font-size: 15px; color: var(--ink); text-shadow: 0 0 4px var(--parchment-light), 0 0 4px var(--parchment-light); }

#search { position: absolute; top: 110px; left: 34px; width: 280px; z-index: 6; display: flex; }
#search-input { flex: 1; min-width: 0; font: inherit; font-size: 16.5px; padding: 6px 10px; border: 2px solid var(--ink); border-right: 0; background: var(--parchment-light); color: var(--ink); border-radius: 0; -webkit-appearance: none; appearance: none; }
#search-input:focus { outline: none; background: #fffaf0; }
#search-input::placeholder { color: var(--ink-soft); font-style: italic; }
#browse-link { display: flex; align-items: center; padding: 0 12px; border: 2px solid var(--ink); background: var(--ink); color: var(--parchment-light); text-decoration: none; font-family: var(--display); font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; }
#browse-link:hover { background: var(--terracotta-dark); }
#search-results { position: absolute; top: 100%; left: 0; right: 0; margin: 0; padding: 0; list-style: none; background: var(--parchment-light); border: 2px solid var(--ink); border-top: 0; box-shadow: 4px 4px 0 rgba(31, 26, 21, .35); }
#search-results[hidden] { display: none; }
#search-results li { padding: 6px 10px; cursor: pointer; border-top: 1px solid rgba(31, 26, 21, .15); }
#search-results li.active, #search-results li:hover { background: var(--parchment-dark); }
#search-results .t { display: block; font-size: 16.5px; }
#search-results .k { display: block; font-size: 12.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); }

#zoom-controls { position: absolute; left: 34px; bottom: 36px; display: flex; flex-direction: column; border: 2px solid var(--ink); background: var(--parchment-light); }
#zoom-controls button { width: 40px; height: 40px; border: 0; background: none; font-size: 22px; line-height: 1; }
#zoom-controls button + button { border-top: 1px solid var(--ink); }
#zoom-controls button:hover { background: var(--parchment-dark); }

/* ---------- popup ---------- */
#popup { position: absolute; width: 290px; background: var(--parchment-light); border: 2px solid var(--ink); box-shadow: 4px 4px 0 rgba(31, 26, 21, .35); padding: 12px 14px 12px; z-index: 5; }
#popup::after { content: ""; position: absolute; left: var(--tail-x, 50%); width: 14px; height: 14px; background: var(--parchment-light); border: solid var(--ink); border-width: 0 2px 2px 0; transform: translateX(-50%) rotate(45deg); }
#popup.above::after { bottom: -9px; }
#popup.below::after { top: -9px; transform: translateX(-50%) rotate(225deg); }
#popup[hidden] { display: none; }
#popup h2 { font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: .04em; margin: 0 22px 4px 0; line-height: 1.2; }
#popup .kind { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px; }
#popup .kind .tag { color: var(--myth); font-weight: 500; }
#popup .kind .tag.history { color: var(--history); }
#popup .when { font-size: 14.5px; font-style: italic; color: var(--history); margin: -2px 0 6px; }
#popup p { margin: 0; font-size: 16px; line-height: 1.35; }
#popup .traditional-note { margin-top: 8px; font-style: italic; font-size: 14.5px; color: var(--terracotta-dark); }
#popup .more { display: inline-block; margin-top: 10px; padding: 3px 12px; border: 1.5px solid var(--ink); background: var(--ink); color: var(--parchment-light); text-decoration: none; font-family: var(--display); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
#popup .more:hover { background: var(--terracotta-dark); }
#popup .stop-line { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--terracotta-dark); margin: 0 22px 6px 0; }
#popup .stop-line strong { display: block; font-family: var(--display); font-weight: 600; text-transform: none; letter-spacing: .02em; font-size: 14px; color: var(--ink); }
#popup .back { border: 0; background: none; padding: 0; margin-bottom: 4px; color: var(--terracotta-dark); font-size: 14.5px; }
#popup .back:hover { text-decoration: underline; }
#popup .group-list { list-style: none; margin: 4px 0 0; padding: 0; max-height: 260px; overflow-y: auto; }
#popup .group-list li + li { border-top: 1px solid rgba(31, 26, 21, .2); }
#popup .group-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 6px 4px; }
#popup .group-list button:hover { background: var(--parchment); }
#popup .group-list .t { display: block; font-size: 16.5px; }
#popup .group-list .k { display: block; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
#popup .group-list .tag { color: var(--myth); }
#popup .group-list .tag.history { color: var(--history); }
#popup .close { position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 22px; line-height: 1; padding: 2px 6px; }

/* ---------- wiki panel ---------- */
#panel { position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); min-width: 360px; background: var(--parchment-light); border-left: 3px double var(--ink); box-shadow: -6px 0 20px rgba(31, 26, 21, .3); transform: translateX(105%); transition: transform .3s ease; z-index: 10; overflow-y: auto; overscroll-behavior: contain; }
#panel.open { transform: none; }
#panel-close { position: sticky; top: 8px; float: right; margin: 8px 12px 0 0; width: 38px; height: 38px; border: 2px solid var(--ink); background: var(--parchment-light); font-size: 24px; line-height: 1; z-index: 2; }
#panel-close:hover { background: var(--parchment-dark); }
#panel-body { padding: 26px 28px 60px; }
.wiki h1 { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.15; margin: 0 0 4px; letter-spacing: .03em; }
.wiki .subtitle { font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 14px; }
.wiki .tag { font-weight: 500; color: var(--myth); }
.wiki .tag.history { color: var(--history); }
.wiki .show-map { display: inline-block; margin: 2px 0 14px; padding: 6px 16px; border: 2px solid var(--ink); background: var(--terracotta); color: var(--parchment-light); text-decoration: none; font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; box-shadow: 3px 3px 0 var(--ink); }
.wiki .show-map:hover { background: var(--terracotta-dark); }
.wiki .lead { font-style: italic; border-left: 3px solid var(--terracotta); padding-left: 12px; margin: 0 0 16px; color: var(--ink-soft); }
.wiki .body p { margin: 0 0 .9em; hyphens: auto; text-align: justify; }
.wiki .body a.wikilink { text-decoration-thickness: 1px; text-underline-offset: 2px; }
.wiki figure { margin: 0 0 16px; }
.wiki figure img { width: 100%; display: block; border: 2px solid var(--ink); }
.wiki figure img { max-height: 420px; object-fit: contain; background: var(--parchment); }
.wiki figcaption { font-size: 14px; color: var(--ink-soft); margin-top: 5px; line-height: 1.3; }
.wiki figcaption .caption { display: block; font-style: italic; color: var(--ink); }
.wiki figcaption .credit { display: block; font-size: 12.5px; margin-top: 2px; }
.wiki figcaption a { color: var(--ink-soft); }
.infobox { border: 2px solid var(--ink); background: var(--parchment); margin: 0 0 20px; font-size: 16px; }
.infobox dl { margin: 0; display: grid; grid-template-columns: 7.5em 1fr; }
.infobox dt, .infobox dd { margin: 0; padding: 5px 10px; border-top: 1px solid rgba(31, 26, 21, .25); }
.infobox dt:first-of-type, .infobox dt:first-of-type + dd { border-top: 0; }
.infobox dt { font-family: var(--display); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; padding-top: 8px; color: var(--ink-soft); }
.infobox ul { margin: 0; padding-left: 1.1em; }
.infobox .sub { color: var(--ink-soft); font-size: 14.5px; font-style: italic; }
.wiki h2 { font-family: var(--display); font-weight: 600; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; margin: 26px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--ink); }
.wiki .stops { margin: 0; padding-left: 1.6em; }
.wiki .stops li { margin: 2px 0; }
.wiki .stops .map-link { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.browse .tabs { display: flex; flex-wrap: wrap; margin: 10px 0 6px; border: 2px solid var(--ink); }
.browse .tabs a { flex: 1; text-align: center; padding: 6px 8px; font-family: var(--display); font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; color: var(--ink); white-space: nowrap; }
.browse .tabs a + a { border-left: 1px solid var(--ink); }
.browse .tabs a.on { background: var(--ink); color: var(--parchment-light); }
.browse .browse-group h2 .n { font-family: var(--text); font-size: 14px; letter-spacing: 0; color: var(--ink-soft); }
.browse .browse-group ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 20px; }
.browse .browse-group li { break-inside: avoid; padding: 2px 0; }
.browse .browse-group .note { margin: -4px 0 6px; font-style: italic; font-size: 14.5px; color: var(--ink-soft); }
.browse .sub, .wiki .stops .sub { color: var(--ink-soft); font-size: 15px; }
.browse .nowrap { white-space: nowrap; }
.browse .num { color: var(--ink-soft); display: inline-block; min-width: 1.6em; }
.browse .map-link { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.wiki .backlinks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  body { font-size: 17px; }
  #masthead { top: 22px; left: 22px; }
  #search { top: 66px; left: 22px; right: 22px; width: auto; }
  .browse .browse-group ul { columns: 1; }
  #masthead h1 { font-size: 18px; }
  #masthead p { display: none; }
  #zoom-controls { left: 22px; bottom: calc(26px + env(safe-area-inset-bottom)); }
  #zoom-controls button { width: 44px; height: 44px; }
  #layers { top: 22px; right: 22px; min-width: 0; }
  #layers[open] { min-width: 180px; }
  #journey-bar { left: 78px; right: 22px; bottom: calc(26px + env(safe-area-inset-bottom)); transform: none; max-width: none; }
  #journey-bar .info { min-width: 0; flex: 1; padding: 4px 8px; overflow: hidden; }
  #journey-bar .next { padding: 0 10px; }
  body:has(#journey-bar:not([hidden])) #popup { bottom: calc(80px + env(safe-area-inset-bottom)); }
  #popup { position: fixed; left: 20px !important; right: 20px; top: auto !important; bottom: calc(22px + env(safe-area-inset-bottom)); width: auto; z-index: 7; }
  #popup::after { display: none; }
  #popup.phone-top, body:has(#journey-bar:not([hidden])) #popup.phone-top { top: 118px !important; bottom: auto; }
  #journey-bar .title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #panel { width: 100%; min-width: 0; border-left: 0; transform: translateY(105%); }
  #panel.open { transform: none; }
  #panel-body { padding: 20px 18px 50px; }
  .wiki h1 { font-size: 25px; }
  .wiki .body p { text-align: left; }
  .infobox dl { grid-template-columns: 6.5em 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  #panel, .marker, .region { transition: none; }
}
