/* Venetian Vignette — style.
 * Paper, lagoon, ink. Understated: hairlines, tracked small caps, no chrome.
 */

:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --water: #ccd6d7;
  --land: #f8f5ec;
  --paper: #fbf9f3;
  --ink: #332f28;
  --ink-soft: #847d6f;
  --accent: #a24936;
  --hairline: rgba(51, 47, 40, 0.14);
  --halo: 0 0 5px var(--paper), 0 0 12px var(--paper), 0 0 20px var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--water);
  font-family: var(--serif);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }
::selection { background: rgba(162, 73, 54, 0.22); }

/* ------------------------------------------------------------------- map */

#map { position: fixed; inset: 0; }

.vv-map {
  width: 100%;
  height: 100%;
  display: block;
  background: var(--water);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.vv-map:active { cursor: grabbing; }
body.curator .vv-map { cursor: crosshair; }

.vv-land { fill: var(--land); }
.vv-water { fill: var(--water); }
.vv-bldg { fill: rgba(51, 47, 40, 0.055); }

/* Line-work (duplicated: a static copy, and a living copy near the ear) */
.vv-lines use { fill: none; vector-effect: non-scaling-stroke; }
.vv-line-coast { stroke: #8e887a; stroke-width: 0.8; }
.vv-line-canal { stroke: rgba(93, 115, 116, 0.5); stroke-width: 0.5; }
.vv-line-bldg { stroke: rgba(51, 47, 40, 0.26); stroke-width: 0.45; transition: opacity 0.5s ease; }

/* Building detail fades in as you approach */
.vv-z-far .vv-line-bldg { opacity: 0; }
.vv-z-mid .vv-line-bldg { opacity: 0.45; }
.vv-z-near .vv-line-bldg { opacity: 0.9; }

/* --------------------------------------------------------------- markers */

.vv-marker { cursor: pointer; }
.vv-hit { fill: transparent; pointer-events: all; }
.vv-halo { fill: var(--paper); opacity: 0.85; }
.vv-dot { fill: var(--ink); transition: fill 0.3s ease, r 0.15s ease; }
.vv-marker:hover .vv-dot { r: 4.4px; }
.vv-marker.audible .vv-dot { fill: var(--accent); }
.vv-marker.dragging .vv-dot { fill: var(--accent); }
.vv-ripple { fill: none; stroke: var(--accent); stroke-width: 1.1; }

/* the ear */
.vv-ear-marker { cursor: grab; }
.vv-ear-marker.dragging { cursor: grabbing; }
.vv-ear-pulse { fill: none; stroke: var(--ink); stroke-width: 1.1; }
.vv-ear-ring { fill: rgba(251, 249, 243, 0.5); stroke: var(--ink); stroke-width: 1.2; }
.vv-ear-dot { fill: var(--ink); }
.vv-ear-center { fill: var(--paper); }
.vv-ear-marker.dragging .vv-ear-dot { fill: var(--accent); }
.vv-ear-marker.dragging .vv-ear-ring { stroke: var(--accent); }

/* field circles (curator + debug): reach fill stacks to show overlap */
.vv-ring-reach {
  fill: rgba(162, 73, 54, 0.05);
  stroke: rgba(162, 73, 54, 0.16);
  stroke-width: 1;
  stroke-dasharray: 4 5;
  vector-effect: non-scaling-stroke;
}
.vv-ring-core {
  fill: none;
  stroke: rgba(162, 73, 54, 0.42);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

/* ----------------------------------------------------------------- brand */

.brand {
  position: fixed;
  top: 28px;
  left: 32px;
  pointer-events: none;
  z-index: 10;
}
body.curator .brand { top: 72px; }

.brand h1 {
  margin: 0;
  font-size: clamp(19px, 2.1vw, 24px);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-shadow: var(--halo);
}
#brand-sub {
  margin: 6px 0 0 1px;
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-shadow: var(--halo);
}
#brand-sub:empty { display: none; }

/* ----------------------------------------------------------------- intro */

#intro {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(251, 249, 243, 0.96);
  z-index: 30;
}
.intro-inner {
  max-width: min(430px, calc(100vw - 56px));
  text-align: center;
  animation: intro-in 0.9s ease both;
}
@keyframes intro-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.intro-inner h2 {
  margin: 0;
  font-size: 30px;
  font-style: italic;
  font-weight: 500;
}
.intro-sub {
  margin: 10px 0 0;
  font-size: 9.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.intro-lede {
  margin: 26px auto 34px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-soft);
}
#btn-begin {
  background: none;
  border: none;
  border-bottom: 1px solid var(--ink);
  padding: 2px 2px 5px;
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease;
}
#btn-begin:hover { color: var(--accent); border-color: var(--accent); }

/* ----------------------------------------------------- now-hearing bar */

#hearing {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  width: min(620px, calc(100vw - 32px));
  text-align: center;
  pointer-events: none;
  z-index: 20;
}
.hearing-label {
  display: block;
  margin-bottom: 5px;
  font-size: 8.5px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-shadow: var(--halo);
}
#hearing-list { display: inline; }
.hearing-item, .hearing-amb {
  font-size: 15px;
  font-style: italic;
  text-shadow: var(--halo);
  white-space: nowrap;
}
.hearing-item { cursor: pointer; pointer-events: auto; }
.hearing-item:hover { text-decoration: underline; text-underline-offset: 3px; }
.hearing-item + .hearing-item::before {
  content: "·";
  margin: 0 10px;
  color: var(--ink-soft);
  font-style: normal;
}
.hearing-amb { color: var(--ink-soft); }
#hearing-desc {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  text-shadow: var(--halo);
}

/* ------------------------------------------------------------------ mute */

#btn-mute {
  position: fixed;
  top: 22px;
  right: 22px;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink-soft);
  z-index: 20;
}
#btn-mute:hover { color: var(--ink); }
#btn-mute svg { filter: drop-shadow(0 0 4px var(--paper)); }
#btn-mute .i-muted { display: none; }
#btn-mute.is-muted .i-sound { display: none; }
#btn-mute.is-muted .i-muted { display: block; }
#btn-mute.is-muted { color: var(--accent); }

/* ------------------------------------------------------------ debug view */

#debug-panel {
  position: fixed;
  top: 18px;
  right: 74px;
  width: min(260px, calc(100vw - 96px));
  max-height: calc(100% - 36px);
  overflow-y: auto;
  background: rgba(251, 249, 243, 0.94);
  border: 1px solid var(--hairline);
  padding: 10px 12px 12px;
  z-index: 21;
  font-size: 12px;
}
.dbg-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.dbg-key { letter-spacing: 0.04em; text-transform: none; font-style: italic; opacity: 0.7; }
.dbg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  color: var(--ink-soft);
}
.dbg-row.on { color: var(--ink); }
.dbg-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.dbg-name:hover { text-decoration: underline; text-underline-offset: 2px; }
.dbg-meter {
  flex: 0 0 64px;
  height: 5px;
  background: rgba(51, 47, 40, 0.1);
  overflow: hidden;
}
.dbg-meter > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.08s linear;
}
.dbg-val {
  flex: 0 0 20px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
}
.dbg-amb-row { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--hairline); }
.dbg-amb-row .dbg-meter > i { background: var(--ink-soft); }

/* ------------------------------------------------------------ chips/tips */

.chip {
  position: fixed;
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%);
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-shadow: var(--halo);
  z-index: 10;
}

#tooltip {
  position: fixed;
  transform: translate(-50%, -100%);
  background: var(--paper);
  border: 1px solid var(--hairline);
  color: var(--ink);
  font-style: italic;
  font-size: 12.5px;
  padding: 4px 12px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 30;
}

/* --------------------------------------------------------------- curator */

#curator-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 12px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
  font-size: 12.5px;
  z-index: 25;
}
.curator-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}
#curator-count { color: var(--ink-soft); }
.curator-hint { color: var(--ink-soft); font-style: italic; }
.spacer { flex: 1; }

/* audio tray */
#audio-tray {
  position: fixed;
  top: 49px;
  right: 0;
  width: min(272px, 82vw);
  max-height: calc(100% - 49px);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-left: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  z-index: 24;
}
.tray-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
}
.tray-title {
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
#tray-count { font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
.tray-btn {
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 0 0 2px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.tray-btn:hover { border-bottom-color: var(--ink); }

#tray-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
}
.tray-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 14px 6px 12px;
  border-left: 2px solid transparent;
  font-size: 13px;
  cursor: pointer;
}
.tray-item:hover { background: rgba(51, 47, 40, 0.04); }
.tray-item.armed {
  border-left-color: var(--accent);
  background: rgba(162, 73, 54, 0.05);
}
.tray-item.placed .tray-name { color: var(--ink-soft); }
.tray-play {
  flex: none;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: none;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  cursor: pointer;
}
.tray-play:hover { color: var(--ink); background: rgba(51, 47, 40, 0.07); }
.tray-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tray-tail {
  flex: none;
  font-size: 8.5px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}
.tray-hint {
  margin: 0;
  padding: 9px 14px;
  border-top: 1px solid var(--hairline);
  font-size: 11px;
  font-style: italic;
  color: var(--ink-soft);
}

.bar-btn {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border: 1px solid var(--hairline);
  background: none;
  cursor: pointer;
}
.bar-btn:hover { border-color: var(--ink-soft); }
.bar-btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.bar-btn.primary:hover { background: #46413a; }
.bar-btn.danger { color: #8d2c1a; border-color: rgba(141, 44, 26, 0.35); }

/* ---------------------------------------------------------------- dialog */

#pin-dialog {
  border: 1px solid var(--hairline);
  border-radius: 0;
  padding: 26px 28px;
  width: min(400px, 92vw);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(40, 36, 28, 0.3);
}
#pin-dialog::backdrop { background: rgba(43, 39, 32, 0.32); }

#d-heading { margin: 0; font-size: 18px; font-style: italic; font-weight: 500; }
.coords {
  margin: 4px 0 2px;
  font-size: 11.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

#pin-form label {
  display: block;
  margin: 15px 0 5px;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.field-row { display: flex; gap: 12px; }
.field-row > div { flex: 1; }

#pin-form input[type="text"],
#pin-form input[type="number"],
#pin-form input:not([type]),
#pin-form textarea {
  width: 100%;
  font-family: var(--serif);
  font-size: 14.5px;
  padding: 8px 10px;
  border: 1px solid var(--hairline);
  border-radius: 0;
  background: #fffefb;
  color: var(--ink);
  resize: vertical;
}
#pin-form input:focus, #pin-form textarea:focus {
  outline: 1px solid var(--accent);
  outline-offset: 0;
}
#pin-form .check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 17px;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  cursor: pointer;
}
#pin-form .check input { accent-color: var(--accent); width: 14px; height: 14px; }

.dialog-actions { display: flex; align-items: center; gap: 8px; margin-top: 24px; }

/* ----------------------------------------------------------- toast, etc. */

#toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--ink);
  color: var(--paper);
  padding: 9px 14px;
  font-size: 12.5px;
  max-width: min(420px, 80vw);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 40;
}
#toast.show { opacity: 1; transform: translateY(0); }

.attribution {
  position: fixed;
  bottom: 8px;
  right: 12px;
  font-size: 9.5px;
  color: rgba(51, 47, 40, 0.42);
  z-index: 5;
}
.attribution a { color: inherit; }

/* ---------------------------------------------------------------- mobile */

@media (max-width: 1080px) {
  .curator-hint { display: none; }
}

@media (max-width: 640px) {
  .brand { top: 18px; left: 20px; }
  .brand h1 { font-size: 18px; }
  #brand-sub { font-size: 8px; letter-spacing: 0.26em; }
  .intro-inner h2 { font-size: 24px; }
  .intro-lede { font-size: 13px; }
  #hearing { bottom: 18px; }
  .hearing-item, .hearing-amb { font-size: 13.5px; }
  #hearing-desc { display: none; }
  .chip { bottom: 24px; font-size: 9.5px; }
  #btn-mute { top: 10px; right: 10px; }
  .curator-hint { display: none; }
  #toast { left: 12px; bottom: 12px; }
  .attribution { bottom: 5px; right: 8px; font-size: 8.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .intro-inner { animation: none; }
  #toast { transition: none; }
}
