@font-face { font-family: "Old Standard"; src: url(fonts/OldStandard-r.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Old Standard"; src: url(fonts/OldStandard-i.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Old Standard"; src: url(fonts/OldStandard-b.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Old Standard"; src: url(fonts/OldStandard-bi.woff2) format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  --paper: #f3ebd8;
  --paper-2: #ece2cb;
  --ink: #1d1915;
  --ink-2: #5d5346;
  --rule: #1d191533;
  --red: #b3271d;
  --blue: #1c4c8c;
  --serif: "Old Standard", "Century Schoolbook", "Bodoni 72", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 17px; line-height: 1.45; overflow: hidden; }

#app { display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 34vw, 480px); height: 100vh; height: 100dvh; }

/* ------------------------------------------------------------------ map */
#stage { position: relative; overflow: hidden; min-height: 0; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#gl:active { cursor: grabbing; }
#mood { position: absolute; inset: 0; pointer-events: none; background: #2a2a3c; mix-blend-mode: multiply; opacity: 0; transition: opacity 2.5s; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

#stage::before { content: ""; position: absolute; left: 0; top: 0; width: min(640px, 100%); height: 190px; z-index: 1; pointer-events: none; background: radial-gradient(ellipse 100% 100% at 0 0, var(--paper) 35%, transparent 100%); }
#stage::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 150px; pointer-events: none; background: linear-gradient(to top, var(--paper) 22%, transparent); }
#masthead { position: absolute; z-index: 2; left: 28px; top: 22px; pointer-events: none; max-width: 60%; }
#masthead .over { margin: 0; font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: var(--ink-2); }
#masthead h1 { margin: 2px 0 6px; font-size: clamp(22px, 2.5vw, 34px); font-weight: 400; letter-spacing: .01em; line-height: 1.1; }
#masthead .clock { margin: 0; padding-top: 7px; border-top: 1px solid var(--ink); display: inline-flex; gap: 14px; font-size: 16px; }
#masthead #date { font-variant-caps: small-caps; letter-spacing: .06em; }
#masthead #time { font-style: italic; color: var(--ink-2); }

#legend { z-index: 2; position: absolute; left: 28px; bottom: 64px; font-size: 13.5px; line-height: 1.5; pointer-events: none; }
#legend p { margin: 0; display: flex; align-items: center; gap: 8px; }
#legend .swatch { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex: none; }
#legend .swatch.red { background: var(--red); }
#legend .swatch.blue { background: var(--blue); }
#legend .swatch.cross { font-style: normal; font-size: 13px; line-height: 11px; text-align: center; }
#legend .hint { margin-top: 6px; font-style: italic; color: var(--ink-2); font-size: 12.5px; }

#loading { z-index: 5; position: absolute; inset: 0; display: grid; place-items: center; font-style: italic; color: var(--ink-2); background: var(--paper); transition: opacity .8s; }
#loading.done { opacity: 0; pointer-events: none; }

/* timeline */
#timeline { z-index: 2; position: absolute; left: 28px; right: 28px; bottom: 16px; display: flex; align-items: flex-end; gap: 14px; }
#timeline .day { display: flex; flex-direction: column; gap: 5px; flex: none; }
#timeline .day span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
#timeline .ticks { display: flex; gap: 4px; }
#timeline button { width: 22px; height: 16px; padding: 0; border: 0; background: none; cursor: pointer; position: relative; }
#timeline button::after { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 3px; background: var(--ink); opacity: .22; transition: opacity .2s, height .2s, top .2s; }
#timeline button.seen::after { opacity: .55; }
#timeline button:hover::after { opacity: .8; }
#timeline button.on::after { opacity: 1; height: 7px; top: 4px; }
#timeline button:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }

/* map labels */
.lbl { position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform, opacity; transition: opacity .35s; text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 6px var(--paper); }
.lbl.place { font-size: 13px; letter-spacing: .04em; }
.lbl.place b { font-weight: 400; font-variant-caps: small-caps; }
.lbl.place small { display: block; font-size: 10.5px; font-style: italic; color: var(--ink-2); letter-spacing: 0; margin-top: -2px; }
.lbl.place::before { content: ""; position: absolute; left: -9px; top: 7px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink); }
.lbl.peak b { font-size: 15px; letter-spacing: .1em; }
.lbl.peak::before { left: -11px; top: 5px; width: 0; height: 0; border-radius: 0; background: none; border: 4px solid transparent; border-bottom: 7px solid var(--ink); border-top: 0; }
.lbl.village b { font-size: 16px; letter-spacing: .12em; }
.lbl.village::before { left: -12px; top: 6px; width: 7px; height: 7px; background: var(--paper); border: 1.5px solid var(--ink); }
.lbl.area { font-style: italic; font-size: 12.5px; color: var(--ink-2); letter-spacing: .12em; }
.lbl.area::before { display: none; }

.dot { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform, opacity; transition: opacity .4s; }
.dot i { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--c); }
.dot i::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 1px solid var(--c); opacity: 0; }
.dot.moving i::after { animation: ping 1.6s ease-out infinite; }
.dot span { position: absolute; right: 13px; top: -19px; font-size: 13px; font-style: italic; color: var(--c); white-space: nowrap; text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 5px var(--paper); }
.dot.hidden-behind i { background: var(--paper); }
.dot.red { --c: var(--red); }
.dot.blue { --c: var(--blue); }
.dot.fallen { --c: var(--ink); }
.dot.fallen i { left: -4px; top: -4px; width: 8px; height: 8px; border-width: 1px; }
@keyframes ping { from { transform: scale(.4); opacity: .9; } to { transform: scale(1.5); opacity: 0; } }

.mark { position: absolute; left: 0; top: 0; will-change: transform, opacity; transition: opacity .6s; font-size: 22px; line-height: 1; text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 6px var(--paper); }
.mark b { position: absolute; left: -8px; top: -24px; font-weight: 400; }
.mark span { position: absolute; left: 12px; top: -22px; font-size: 12.5px; font-style: italic; white-space: nowrap; }

/* ---------------------------------------------------------------- panel */
#panel { display: flex; flex-direction: column; min-height: 0; background: var(--paper); border-left: 1px solid var(--ink); box-shadow: inset 3px 0 0 var(--paper), inset 4px 0 0 var(--rule); }
#card { flex: 1; overflow-y: auto; padding: 30px 34px 20px 38px; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
#card > * { animation: rise .7s both; }
#card > :nth-child(2) { animation-delay: .06s; } #card > :nth-child(3) { animation-delay: .12s; }
#card > :nth-child(4) { animation-delay: .18s; } #card > :nth-child(n+5) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.kicker { margin: 0; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); display: flex; gap: 10px; align-items: baseline; }
.kicker em { font-style: italic; text-transform: none; letter-spacing: .02em; font-size: 14px; }
#card h2 { margin: 6px 0 14px; font-size: 27px; line-height: 1.14; font-weight: 400; text-wrap: balance; }
#card h2::after { content: ""; display: block; width: 46px; height: 1px; background: var(--ink); margin-top: 14px; }

#card figure { margin: 0 0 16px; text-align: center; }
#card figure img { max-width: 100%; max-height: 34vh; mix-blend-mode: multiply; filter: sepia(.25) contrast(1.05); }
#card figure.small img { max-height: 24vh; }
#card figcaption { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin-top: 6px; }

#card .quote p { margin: 0; text-align: justify; hyphens: auto; text-indent: 1.3em; }
#card .quote p:first-child { text-indent: 0; }
#card .quote p:first-child::first-letter { float: left; font-size: 3.05em; line-height: .82; padding: .06em .08em 0 0; }
#card .src { margin: 10px 0 0; text-align: right; font-size: 13px; font-style: italic; color: var(--ink-2); }
#card .note { margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--rule); font-size: 14.5px; font-style: italic; color: var(--ink-2); line-height: 1.4; }

#controls { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 34px 14px 38px; border-top: 1px solid var(--ink); }
#controls button { font: inherit; font-size: 15px; color: var(--ink); background: none; border: 1px solid var(--ink); padding: 4px 13px 5px; cursor: pointer; border-radius: 0; }
#controls button:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
#controls button:disabled { opacity: .3; cursor: default; }
#controls button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
#controls #play { font-variant-caps: small-caps; letter-spacing: .1em; min-width: 78px; }
#controls #play.on { background: var(--ink); color: var(--paper); }
#controls #book { font-size: 14px; font-style: italic; color: var(--ink); text-underline-offset: 3px; white-space: nowrap; }
#controls #book:hover { color: var(--red); }
#controls #count { flex: 1; text-align: center; font-size: 13px; font-style: italic; color: var(--ink-2); }

/* --------------------------------------------------------------- narrow */
@media (max-width: 820px) {
  body { font-size: 15.5px; }
  #app { grid-template-columns: 1fr; grid-template-rows: 52dvh minmax(0, 1fr); }
  #panel { border-left: 0; border-top: 1px solid var(--ink); box-shadow: none; }
  #card { padding: 16px 18px 10px; }
  #card h2 { font-size: 22px; margin-bottom: 10px; }
  #card figure img { max-height: 22vh; }
  #controls { padding: 8px 18px 10px; }
  #masthead { left: 14px; top: 10px; max-width: 90%; }
  #masthead .over { display: none; }
  #legend { display: none; }
  #timeline { left: 14px; right: 14px; bottom: 8px; gap: 8px; overflow: hidden; }
  #timeline .day span { font-size: 9px; letter-spacing: .06em; }
  #timeline button { width: 11px; }
  #timeline .ticks { gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  #card > * { animation: none; }
  .dot.moving i::after { animation: none; }
}
