/* Layout is designed for a 1920x1080 screen and scaled to fit. The gaps between
   zones are where the plywood overlay sits; adjust the zone variables to match it. */
:root {
  --gap: 24px;
  --map-w: 1176px;
  --side-x: calc(var(--gap) * 2 + var(--map-w));
  --side-w: calc(1920px - var(--side-x) - var(--gap));
  /* Right-hand column, top to bottom: section buttons, stories, controls, dial. */
  --nav-h: 84px;
  --stories-h: 384px;
  --controls-h: 72px;

  --ink: #2b1d10;
  --ink-soft: #5b4630;
  --paper: #efe0bd;
  --paper-light: #f8eed6;
  --poppy: #b8121b;
  --brass: #b08d57;
  --surround: #120c07;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--surround);
}
body {
  font-family: "EB Garamond", Georgia, serif;
  color: var(--ink);
}
body.kiosk,
body.kiosk * {
  cursor: none !important;
}
/* Library touch screen: no zooming, text selection or long-press menus to get lost in. */
body.popup {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
body.popup .about-panel {
  touch-action: pan-y;
}
body.popup textarea,
body.popup input {
  user-select: text;
  -webkit-user-select: text;
}

/* Visitors who ask their device for less motion: no sliding or fading panels. (The poppies still
   appear one by one: that is the exhibit.) */
@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Read out by screen readers, not shown. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1920px;
  height: 1080px;
  transform-origin: center;
  /* Set before the first paint by the script in index.html's <head>, then by js/app.js. */
  transform: translate(-50%, -50%) scale(var(--stage-scale, 1));
}

.zone {
  position: absolute;
  overflow: hidden;
  border-radius: 6px;
}
.zone-map {
  left: var(--gap);
  top: var(--gap);
  width: var(--map-w);
  height: calc(1080px - var(--gap) * 2);
}
.zone-nav {
  left: var(--side-x);
  top: var(--gap);
  width: var(--side-w);
  height: var(--nav-h);
  overflow: visible;
}
.zone-stories {
  left: var(--side-x);
  top: calc(var(--gap) * 2 + var(--nav-h));
  width: var(--side-w);
  height: var(--stories-h);
}
.zone-controls {
  left: var(--side-x);
  top: calc(var(--gap) * 3 + var(--nav-h) + var(--stories-h));
  width: var(--side-w);
  height: var(--controls-h);
  overflow: visible;
}
.zone-dial {
  left: var(--side-x);
  top: calc(
    var(--gap) * 4 + var(--nav-h) + var(--stories-h) + var(--controls-h)
  );
  width: var(--side-w);
  height: calc(
    1080px - var(--gap) * 5 - var(--nav-h) - var(--stories-h) -
      var(--controls-h)
  );
}
/* The installation has no section buttons (a printed board explains it), so the stories
   panel takes their space. */
body.kiosk .zone-nav,
body.kiosk .zone-controls {
  display: none;
}
body.kiosk .zone-stories {
  top: var(--gap);
  height: calc(
    var(--nav-h) + var(--stories-h) + var(--controls-h) + var(--gap) * 2
  );
}

/* ---------- Map ---------- */
#map {
  position: absolute;
  inset: 0;
  background: #d9c39a;
}
.map-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
}
/* The map is drawn on a canvas (js/map.js), redrawn sharp at each zoom along with the poppies. */
body:not(.kiosk) #map {
  touch-action: none;
  cursor: grab;
}
body:not(.kiosk) #map:active {
  cursor: grabbing;
}
.map-zoom {
  position: absolute;
  z-index: 470;
  left: 28px;
  top: 186px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.map-zoom-btn {
  width: 56px;
  height: 56px;
  padding: 0;
  font:
    400 30px/1 system-ui,
    sans-serif;
}
.map-zoom-btn.zoom-all {
  font-size: 24px;
}
.map-credit {
  position: absolute;
  z-index: 460;
  left: 8px;
  bottom: 6px;
  padding: 1px 6px;
  font:
    italic 12px "EB Garamond",
    serif;
  color: var(--ink-soft);
  background: rgba(239, 224, 189, 0.75);
  border-radius: 2px;
}
.map-paper {
  position: absolute;
  inset: 0;
  z-index: 420;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 240, 200, 0) 60%,
    rgba(90, 55, 20, 0.35) 100%
  );
  mix-blend-mode: multiply;
}
.poppy-canvas {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 450;
  pointer-events: none;
}
.cartouche {
  position: absolute;
  z-index: 500;
  top: 28px;
  left: 28px;
  padding: 16px 28px 14px;
  text-align: center;
  background: rgba(248, 238, 214, 0.92);
  border: 2px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: -7px;
  box-shadow: 0 4px 18px rgba(40, 20, 0, 0.3);
}
.cartouche h1 {
  margin: 2px 0 0;
  font:
    400 46px/1 "IM Fell English SC",
    "Cinzel",
    serif;
  letter-spacing: 0.02em;
}
.cartouche-small {
  font:
    600 13px "Cinzel",
    serif;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}
.cartouche-years {
  font:
    500 22px "Cinzel",
    serif;
  letter-spacing: 0.2em;
  color: var(--poppy);
  margin-top: 4px;
}

/* ---------- Section buttons ---------- */
.zone-nav {
  display: flex;
  gap: 12px;
}
.nav-btn {
  flex: 1;
  padding: 8px 12px;
  font:
    700 19px/1.15 "Cinzel",
    serif;
  letter-spacing: 0.02em;
  color: #f3e3bd;
  background: #3a2814;
  border: 2px solid var(--brass);
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
/* Hover colours only where there's a mouse (here and in cabinet.css): on a touch screen a tapped
   button would otherwise stay lit. */
@media (hover: hover) {
  .nav-btn:hover {
    background: #4f3720;
  }
}
.nav-btn:focus-visible {
  outline: 3px solid #ffe7b0;
  outline-offset: 2px;
}
.nav-btn[aria-current] {
  color: #fff6e0;
  background: var(--poppy);
  border-color: #f3e3bd;
}

/* ---------- Dial ---------- */
.zone-dial {
  background: radial-gradient(ellipse at 50% 30%, #4a3520, #1f150b 80%);
  display: flex;
  flex-direction: column;
  align-items: center;
}
#dial {
  width: 404px;
  height: 404px;
  margin-top: 8px;
}
.dial-svg {
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.dial-svg:active {
  cursor: grabbing;
}
.dial-band {
  fill: none;
  stroke: #6b5133;
  stroke-width: 3;
}
.dial-band.after {
  stroke-dasharray: 6 5;
}
.dial-band.unknown {
  stroke-dasharray: 2 5;
}
.dial-progress {
  fill: none;
  stroke: var(--poppy);
  stroke-width: 7;
  stroke-linecap: round;
  opacity: 0.85;
}
.tick {
  stroke: #4a3520;
  stroke-width: 1.5;
}
.tick.year {
  stroke: var(--ink);
  stroke-width: 3;
}
.tick.armistice {
  stroke: var(--poppy);
  stroke-width: 4;
}
.dial-year {
  font:
    700 21px "Cinzel",
    serif;
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: middle;
}
.dial-year.small {
  font-size: 15px;
}
.dial-month {
  font:
    600 12px "Cinzel",
    serif;
  fill: #6b5133;
  text-anchor: middle;
  dominant-baseline: middle;
}
.dial-note {
  font:
    700 13px "Cinzel",
    serif;
  fill: var(--poppy);
  text-anchor: middle;
  dominant-baseline: middle;
  letter-spacing: 0.06em;
}
.dial-note.end {
  text-anchor: end;
}
.dial-endnote rect {
  fill: #3a2814;
  stroke: #b08d57;
  stroke-width: 1;
}
.dial-endnote text {
  font:
    700 10px "Cinzel",
    serif;
  fill: #f3e3bd;
  text-anchor: middle;
  dominant-baseline: middle;
  letter-spacing: 0.08em;
}
.dial-brand {
  font:
    700 14px "Cinzel",
    serif;
  fill: #6b5133;
  text-anchor: middle;
  letter-spacing: 0.1em;
}
.dial-brand.years {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2em;
}
.needle-line {
  stroke: #8a0d14;
  stroke-width: 3.5;
  stroke-linecap: round;
}
.needle-tip {
  fill: #8a0d14;
}
.dial-needle {
  filter: drop-shadow(2px 3px 2px rgba(0, 0, 0, 0.35));
}
.knob-grip {
  stroke: #6a5640;
  stroke-width: 2;
}

.map-readout {
  position: absolute;
  z-index: 500;
  top: 20px;
  right: 20px;
  box-shadow: 0 4px 18px rgba(40, 20, 0, 0.35);
}
.readout {
  width: 360px;
  padding: 6px 16px 8px;
  text-align: center;
  color: #f3e3bd;
  background: linear-gradient(#1a1108, #2a1c0e);
  border: 2px solid var(--brass);
  border-radius: 6px;
  box-shadow: inset 0 0 18px rgba(255, 190, 90, 0.18);
}
.readout-date {
  font:
    700 25px/1.1 "Cinzel",
    serif;
  letter-spacing: 0.03em;
  color: #ffe7b0;
  text-shadow: 0 0 10px rgba(255, 180, 80, 0.45);
}
.readout-line {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 18px;
}
.readout-phase {
  color: #ff8f7a;
  font-style: italic;
}
.readout-count {
  margin-left: auto;
}
#readout-count {
  font:
    700 21px "Cinzel",
    serif;
  color: #fff;
}

.ctrl {
  font:
    600 16px "Cinzel",
    serif;
  color: #f3e3bd;
  background: #3a2814;
  border: 2px solid var(--brass);
  border-radius: 999px;
  cursor: pointer;
}
@media (hover: hover) {
  .ctrl:hover:not(:disabled) {
    background: #4f3720;
  }
}
.ctrl:disabled {
  opacity: 0.3;
  cursor: default;
}
.ctrl:focus-visible {
  outline: 3px solid #ffe7b0;
  outline-offset: 2px;
}
/* ---------- Control bar: Start again, previous, Begin / Pause, next ---------- */
.zone-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.controls-main {
  display: flex;
  align-items: center;
  gap: 14px;
}
.controls-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.ctrl-fullscreen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 0;
}
.ctrl-fullscreen[hidden] {
  display: none;
}
.ctrl-fullscreen svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ctrl-fullscreen .fs-exit,
.is-fullscreen .ctrl-fullscreen .fs-enter {
  display: none;
}
.is-fullscreen .ctrl-fullscreen .fs-exit {
  display: inline;
}
.ctrl-start {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 60px;
  padding: 0 22px;
  font-size: 18px;
}
/* Drawn icons rather than the characters ⟲ ◀ ▶: iPhones drew the arrows as emoji (blue squares)
   and the ⟲ small (9 Nov 2026). Sized from the button's font size, so the layouts' sizes apply. */
.start-icon {
  flex: none;
  width: 1.4em;
  height: 1.4em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}
.start-icon .head {
  fill: currentColor;
  stroke: none;
}
.arrow-icon {
  width: 1.15em;
  height: 1.15em;
  fill: currentColor;
}
/* Sized for fingers on a touch screen. */
.ctrl-arrow {
  width: 64px;
  height: 64px;
  font-size: 24px;
}
.ctrl-play {
  flex: 0 0 auto;
  min-width: 200px;
  justify-content: center;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px 16px 22px;
  font-size: 22px;
  color: #fff6e0;
  background: var(--poppy);
  border-color: #f3e3bd;
  box-shadow: 0 0 18px rgba(184, 18, 27, 0.55);
}
@media (hover: hover) {
  .ctrl-play:hover:not(:disabled) {
    background: #d01c26;
  }
}
.ctrl-play .icon {
  width: 0;
  height: 0;
  border-left: 12px solid currentColor;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}
body.playing .ctrl-play .icon {
  width: 12px;
  height: 16px;
  border: 0;
  border-left: 4px solid currentColor;
  border-right: 4px solid currentColor;
}
body.kiosk .ctrl {
  display: none;
}

/* ---------- Stories ---------- */
.zone-stories {
  background: var(--paper);
  box-shadow: inset 0 0 40px rgba(90, 55, 20, 0.35);
}
#stories {
  position: absolute;
  inset: 0;
}
.story {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 22px;
  padding: 24px 26px;
  animation: story-in 0.5s ease-out;
}
@keyframes story-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.story-photo {
  position: relative;
  flex: 0 0 236px;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.story-photo img {
  position: absolute;
  top: 0;
  left: 0;
  width: 236px;
  height: 262px;
  object-fit: contain;
  background: #2b1d10;
  border: 6px solid var(--paper-light);
  box-shadow: 0 3px 12px rgba(40, 20, 0, 0.4);
  opacity: 0;
  transition: opacity 0.8s;
}
.story-photo img.on {
  opacity: 1;
}
.story-photo img.failed {
  visibility: hidden;
}
.story-photo figcaption {
  margin-top: 272px;
  font-size: 15px;
  line-height: 1.25;
  font-style: italic;
  color: var(--ink-soft);
}
.photo-count {
  font:
    600 12px "Cinzel",
    serif;
  color: var(--ink-soft);
  margin-top: 4px;
}
.story-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.story-rank {
  font:
    600 15px "Cinzel",
    serif;
  letter-spacing: 0.08em;
  color: var(--poppy);
  text-transform: uppercase;
}
.story-name {
  margin: 0 0 10px;
  font:
    700 31px/1.1 "Cinzel",
    serif;
}
.story-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 3px 10px;
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}
.story-facts dt {
  font:
    600 11px/2 "Cinzel",
    serif;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.story-facts dd {
  margin: 0;
}
.story-notes {
  margin: 12px 0 0;
  font-size: 17px;
  line-height: 1.3;
  font-style: italic;
  /* Fills the space left on the card; js/stories.js trims the text to fit, ending with "…". */
  flex: 0 1 auto;
  min-height: 0;
  overflow: hidden;
}
.story-position {
  margin-top: auto;
  padding-top: 8px;
  font:
    600 12px "Cinzel",
    serif;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
}
.story-intro {
  flex-direction: column;
  justify-content: center;
  padding: 28px 56px;
  text-align: center;
}
.story-intro .story-kicker {
  margin-bottom: 8px;
  font:
    600 15px "Cinzel",
    serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.story-intro h2 {
  margin: 0 0 18px;
  font:
    700 40px/1.1 "Cinzel",
    serif;
  color: var(--poppy);
}
.story-intro .story-lead {
  max-width: 580px;
  margin: 0 auto 14px;
  font-size: 27px;
  line-height: 1.3;
  text-wrap: balance;
}
.story-intro .nowrap {
  white-space: nowrap;
}
.story-intro .story-lead strong {
  color: var(--poppy);
  font-family: "Cinzel", serif;
}
.story-intro .story-hint {
  max-width: 460px;
  margin: 0 auto;
  font-size: 19px;
  line-height: 1.35;
  color: var(--ink-soft);
  font-style: italic;
  text-wrap: balance;
}
/* The installation's controls are explained on its printed board. */
body.kiosk .story-intro .story-hint {
  display: none;
}

/* ---------- Development panel (remove before going live) ---------- */
.dev-toggle {
  position: fixed;
  top: 2px;
  right: 2px;
  z-index: 10001;
  width: 22px;
  height: 22px;
  padding: 0;
  font:
    14px/22px system-ui,
    sans-serif;
  color: #b08d57;
  background: transparent;
  border: 0;
  opacity: 0.45;
  cursor: pointer;
}
.dev-toggle:hover,
.dev-toggle[aria-expanded="true"] {
  opacity: 1;
}
.dev-panel {
  position: fixed;
  top: 26px;
  right: 6px;
  z-index: 10000;
  width: 210px;
  padding: 8px 10px;
  font:
    11px/1.25 system-ui,
    sans-serif;
  color: #f5ecd8;
  background: rgba(20, 14, 8, 0.94);
  border: 1px solid #b08d57;
  border-radius: 6px;
}
.dev-panel[hidden] {
  display: none;
}
.dev-title {
  font-weight: 700;
  margin-bottom: 6px;
}
.dev-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 6px;
  margin-bottom: 4px;
}
.dev-row input {
  grid-column: 1 / -1;
  width: 100%;
  height: 14px;
  margin: 0;
}
.dev-row output {
  font-weight: 700;
  color: #ffe7b0;
}
.dev-note {
  margin: 4px 0 6px;
  color: #ffcf8a;
}
.dev-panel button {
  font: inherit;
  padding: 2px 8px;
  cursor: pointer;
}

/* ---------- About panel ---------- */
.about-panel {
  width: min(760px, 92vw);
  max-height: 86vh;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.about-panel[open] {
  display: flex;
  flex-direction: column;
}
.about-panel::backdrop {
  background: rgba(18, 12, 7, 0.7);
}
.about-body {
  overflow-y: auto;
  padding: 28px 36px 8px;
  font-size: 19px;
  line-height: 1.5;
  background: var(--paper-light);
  border-bottom: 1px solid rgba(43, 29, 16, 0.35);
}
.about-body h1 {
  font:
    400 44px/1.05 "IM Fell English SC",
    "Cinzel",
    serif;
  margin: 0 0 4px !important;
}
.about-body .years {
  font:
    500 20px "Cinzel",
    serif;
  letter-spacing: 0.2em;
  color: var(--poppy);
  margin-bottom: 20px;
}
.about-body h2 {
  font:
    700 21px "Cinzel",
    serif;
  margin: 26px 0 6px;
}
.about-body a {
  color: var(--poppy);
}
.about-body .note {
  color: var(--ink-soft);
  font-size: 17px;
}
.about-close {
  align-self: center;
  margin: 12px 0 14px;
  padding: 12px 32px;
  font-size: 18px;
}

/* People named on the Barrow Park Cenotaph (as in the research portal). */
.cenotaph-star {
  color: #9a7020;
  font-style: normal;
}
.story-cenotaph {
  margin-left: 14px;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}

/* Key to the wreath at the Cenotaph, bottom right of the map (over Cavendish Dock: no poppies). */
.map-key {
  position: absolute;
  z-index: 465;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 8px;
  background: rgba(248, 238, 214, 0.92);
  border: 1px solid var(--ink);
  box-shadow: 0 2px 8px rgba(40, 20, 0, 0.25);
  pointer-events: none;
  border-radius: 5px;
}
.map-key-icon {
  width: 46px;
  height: 46px;
  flex: none;
}
.map-key strong {
  display: block;
  font:
    600 14px "Cinzel",
    serif;
  letter-spacing: 0.04em;
}
.map-key span {
  display: block;
  font:
    italic 16px/1.2 "EB Garamond",
    serif;
  color: var(--ink-soft);
}
