/* The page takes on the mood of the chart style being shown. */
:root {
  --bg: #e9dcbc; --fg: #3a2816; --muted: #6b5638; --line: #b9a37a; --stage: #e2d3ae;
  --on-bg: #3a2816; --on-fg: #efe3c6; --glass: rgb(239 227 198 / .82);
  --head: "IM Fell English", Georgia, serif; --body: "IM Fell English", Georgia, serif;
}
body[data-style="klassisch"] {
  --bg: #f4f6f8; --fg: #111827; --muted: #4b5563; --line: #d1d5db; --stage: #e9edf1;
  --on-bg: #111827; --on-fg: #fff; --glass: rgb(255 255 255 / .85);
  --head: "IBM Plex Sans", system-ui, sans-serif; --body: "IBM Plex Sans", system-ui, sans-serif;
}
body[data-style="modern"] {
  --bg: #0b1220; --fg: #e2e8f0; --muted: #94a3b8; --line: #263247; --stage: #070c16;
  --on-bg: #e2e8f0; --on-fg: #0b1220; --glass: rgb(17 26 44 / .85);
  --head: "IBM Plex Sans", system-ui, sans-serif; --body: "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body);
  transition: background-color .35s, color .35s;
}
button {
  font: inherit; color: var(--fg); background: transparent; border: 0; border-radius: 999px;
  padding: 5px 12px; cursor: pointer; font-size: 15px; line-height: 1.2;
}
button:hover { background: color-mix(in srgb, var(--fg) 10%, transparent); }
button[aria-pressed="true"] { background: var(--on-bg); color: var(--on-fg); }
button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
a { color: inherit; }

/* ---- the viewer fills the first screen: bar / map / timeline ---- */
.app {
  height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--bg);
}
.bar {
  display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap;
  padding: 8px max(16px, env(safe-area-inset-left)) 8px max(16px, env(safe-area-inset-right));
}
.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
h1 {
  font-family: var(--head); font-weight: 400; letter-spacing: .26em; text-transform: uppercase;
  font-size: 24px; margin: 0;
}
body:not([data-style="vintage"]) h1 { letter-spacing: .06em; font-weight: 600; font-size: 21px; }
.sub { color: var(--muted); font-style: italic; font-size: 14px; white-space: nowrap; }
body:not([data-style="vintage"]) .sub { font-style: normal; }
.controls { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-left: auto; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 999px; padding: 2px; gap: 2px; }

#stage {
  position: relative; overflow: hidden; background: var(--stage); touch-action: none;
  cursor: grab; user-select: none; -webkit-user-select: none;
}
#stage.dragging { cursor: grabbing; }
#map {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  transform-origin: 0 0; will-change: transform;
}
#empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; color: var(--muted); }
#empty[hidden] { display: none; }
.zoom {
  position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 4px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 4px;
  backdrop-filter: blur(6px);
}
.zoom button { width: 36px; height: 36px; padding: 0; border-radius: 8px; font-size: 18px; }

.timeline {
  display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap;
  padding: 8px max(16px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right));
}
#play { width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); font-size: 13px; flex: none; }
#slider { flex: 1 1 200px; accent-color: var(--fg); min-width: 0; }
#when { font-variant-numeric: tabular-nums; white-space: nowrap; }
#when small { color: var(--muted); }
.ticks { display: flex; gap: 3px; flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
.ticks::-webkit-scrollbar { display: none; }
.ticks button { font-size: 13px; padding: 3px 9px; border: 1px solid var(--line); flex: none; }

/* In fullscreen only the chart and its controls remain. */
.app:fullscreen .bar, .app:fullscreen .ticks { display: none; }

/* ---- below the fold ---- */
.below { max-width: 1100px; margin: 0 auto; padding: 0 16px 32px; }
.dwd { padding-top: 28px; }
.dwd h2 { font-family: var(--head); font-weight: 400; font-size: 22px; margin: 0 0 6px; }
body:not([data-style="vintage"]) .dwd h2 { font-weight: 600; font-size: 19px; }
.dwd p { color: var(--muted); max-width: 70ch; }
.dwd img { display: block; width: 100%; height: auto; background: #fff; border-radius: 4px; }
.credit { font-size: 13px; }
footer { margin-top: 28px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.ver { opacity: .6; }

@media (max-width: 760px) {
  .bar { padding-top: 6px; padding-bottom: 6px; }
  h1 { font-size: 19px; }
  .controls { margin-left: 0; width: 100%; }
  .seg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  button { padding: 5px 9px; font-size: 14px; }
  .seg button { flex: none; }
  .ticks button { font-size: 12px; padding: 3px 7px; }
  #when small { display: none; }
}
