/* ---- Cézanne City · museum-placard chrome over a living painting ---- */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ivory: #f4ecd9;
  --ivory-edge: #d8c9a5;
  --ink: #3a3a52;
  --ink-soft: #5a5a72;
  --accent: #c85a35;
  font-size: 16px;
}

html, body { height: 100%; overflow: hidden; }

body {
  background: #2c2620;
  font-family: Georgia, 'Palatino Linotype', 'Times New Roman', serif;
  color: var(--ink);
  -webkit-user-select: none; user-select: none;
}

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

/* when the painting rests, it hangs like a framed canvas */
#stage::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  border: 0 solid rgba(74, 58, 38, 0);
  box-shadow: inset 0 0 0 0 rgba(244, 236, 217, 0);
  transition: border 2s ease, box-shadow 2s ease;
  z-index: 20;
}
#stage.settling::after {
  border: 14px solid rgba(74, 58, 38, 0.85);
  box-shadow: inset 0 0 0 2px rgba(232, 218, 184, 0.7), inset 0 0 40px rgba(40, 30, 18, 0.25);
}

#view {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  cursor: crosshair;
  touch-action: none;
}

/* ---------- labels over the painting ---------- */
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dlabel {
  position: absolute;
  transform: translate(-50%, -50%) rotate(var(--tilt, -1.2deg));
  font-style: italic;
  letter-spacing: 0.14em;
  color: rgba(46, 44, 72, 0.82);
  text-shadow: 0 0 6px rgba(244, 236, 217, 0.85), 0 0 2px rgba(244, 236, 217, 0.9);
  white-space: nowrap;
  transition: opacity 1.8s ease;
  font-variant: small-caps;
}

/* ---------- shared chrome ---------- */
.chrome { transition: opacity 1.4s ease; }
.chrome.quiet { opacity: 0.09; }
.chrome.hidden { opacity: 0; pointer-events: none; }

/* ---------- placard ---------- */
#placard {
  position: absolute; top: 18px; left: 18px;
  background: linear-gradient(175deg, #f7f0de, #ede1c4);
  border: 1px solid var(--ivory-edge);
  outline: 3px solid rgba(244, 236, 217, 0.35);
  box-shadow: 0 2px 10px rgba(40, 30, 20, 0.25);
  padding: 10px 18px 8px;
  min-width: 172px;
}
#townName {
  font-variant: small-caps; letter-spacing: 0.22em;
  font-size: 1.05rem; color: var(--ink); cursor: text;
}
#townName:focus { outline: 1px dashed var(--ink-soft); }
#townDate {
  font-style: italic; font-size: 0.78rem; color: var(--ink-soft);
  margin-top: 2px; letter-spacing: 0.06em;
}

/* ---------- controls ---------- */
#controls { position: absolute; top: 18px; right: 18px; display: flex; gap: 8px; }
.ctl {
  font-family: inherit; font-variant: small-caps; letter-spacing: 0.08em;
  background: linear-gradient(175deg, #f7f0de, #ece0c2);
  color: var(--ink);
  border: 1px solid var(--ivory-edge);
  box-shadow: 0 2px 6px rgba(40, 30, 20, 0.22);
  min-width: 40px; height: 40px;
  padding: 0 12px;
  font-size: 0.85rem;
  cursor: pointer;
}
.ctl:hover { background: #fbf5e6; }
.ctl.active { background: #e9d9ae; box-shadow: inset 0 1px 4px rgba(60, 45, 25, 0.3); }
.ctl.wide { padding: 0 16px; }

/* ---------- painter's dock ---------- */
#dock {
  position: absolute; left: 50%; bottom: 16px;
  transform: translateX(-50%);
  display: flex; gap: 4px; align-items: flex-end;
  background: linear-gradient(178deg, #f5eedb, #e7d9b6);
  border: 1px solid var(--ivory-edge);
  box-shadow: 0 3px 14px rgba(40, 30, 20, 0.3);
  padding: 8px 12px 6px;
}
.tool {
  width: 58px; padding: 5px 2px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer; border: 1px solid transparent;
  background: none; font-family: inherit;
}
.tool svg { width: 30px; height: 26px; display: block; filter: drop-shadow(0 1px 1px rgba(50,35,20,0.35)); }
.tool .tname {
  font-size: 0.62rem; letter-spacing: 0.08em; color: var(--ink-soft);
  font-variant: small-caps; line-height: 1;
}
.tool:hover { background: rgba(255, 252, 240, 0.65); }
.tool.active { background: #fdf8ea; border-color: var(--ivory-edge); box-shadow: 0 1px 5px rgba(60,45,25,0.25); }
.tool.active .tname { color: var(--ink); }
.tool .key {
  font-size: 0.55rem; color: #a09472; line-height: 1; font-style: italic;
}

/* ---------- observations feed ---------- */
#feed {
  position: absolute; right: 18px; bottom: 18px;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
  max-width: 330px; pointer-events: none;
}
.obs {
  pointer-events: auto; cursor: pointer;
  background: rgba(247, 240, 222, 0.92);
  border: 1px solid var(--ivory-edge);
  box-shadow: 0 2px 8px rgba(40, 30, 20, 0.2);
  padding: 7px 12px;
  font-style: italic; font-size: 0.82rem; color: var(--ink);
  letter-spacing: 0.02em; line-height: 1.35;
  opacity: 0; transform: translateY(6px);
  transition: opacity 1.2s ease, transform 1.2s ease;
}
.obs.show { opacity: 1; transform: none; }
.obs.fade { opacity: 0; }
.obs:hover { background: #fdf8ea; }

/* ---------- toast (recognition / namings) ---------- */
#toast {
  position: absolute; left: 50%; bottom: 96px;
  transform: translateX(-50%);
  background: linear-gradient(175deg, #f7f0de, #ede1c4);
  border: 1px solid var(--ivory-edge);
  outline: 3px solid rgba(244, 236, 217, 0.35);
  box-shadow: 0 3px 16px rgba(40, 30, 20, 0.35);
  padding: 12px 26px;
  text-align: center;
  font-style: italic; font-size: 0.95rem; letter-spacing: 0.05em;
  opacity: 0; pointer-events: none;
  transition: opacity 1.6s ease;
  max-width: 70vw;
}
#toast b { font-style: normal; font-variant: small-caps; letter-spacing: 0.18em; }
#toast.show { opacity: 1; }

/* ---------- intro ---------- */
#intro {
  position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: opacity 2.2s ease;
}
#intro.gone { opacity: 0; pointer-events: none; }
#introCard { text-align: center; max-width: 520px; padding: 0 24px; }
#introCard h1 {
  font-weight: normal; font-size: 2.6rem; letter-spacing: 0.34em;
  color: #40405c;
  text-shadow: 0 0 18px rgba(244, 236, 217, 0.9), 0 0 5px rgba(244, 236, 217, 1);
}
#introCard .sub {
  font-style: italic; letter-spacing: 0.2em; margin-top: 6px;
  color: #565672; font-size: 1rem;
  text-shadow: 0 0 10px rgba(244, 236, 217, 0.95);
}
#introCard .hint {
  margin-top: 26px; font-size: 0.9rem; line-height: 1.65; color: #4a4a66;
  font-style: italic;
  text-shadow: 0 0 8px rgba(244, 236, 217, 0.95), 0 0 3px rgba(244,236,217,0.9);
}
#introCard .epigraph {
  margin-top: 22px; font-style: italic; font-size: 0.8rem;
  color: #6a6a86; letter-spacing: 0.04em;
  text-shadow: 0 0 8px rgba(244, 236, 217, 0.95);
}
#introCard .go {
  margin-top: 24px; font-variant: small-caps; letter-spacing: 0.3em;
  color: #6a5a3a; font-size: 0.85rem;
  animation: breathe 2.6s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

/* ---------- help ---------- */
#help {
  position: absolute; inset: 0; z-index: 40;
  display: none; align-items: center; justify-content: center;
  background: rgba(44, 38, 30, 0.45);
}
#help.open { display: flex; }
#helpCard {
  background: linear-gradient(175deg, #f7f0de, #ece0c2);
  border: 1px solid var(--ivory-edge);
  outline: 4px solid rgba(244, 236, 217, 0.3);
  box-shadow: 0 8px 40px rgba(20, 14, 8, 0.5);
  max-width: 620px; max-height: 86vh; overflow-y: auto;
  padding: 26px 34px 22px;
}
#helpCard h2 {
  font-weight: normal; font-variant: small-caps; letter-spacing: 0.16em;
  font-size: 1.25rem; text-align: center; margin-bottom: 10px;
}
#helpCard .lede {
  font-style: italic; text-align: center; font-size: 0.9rem; color: var(--ink-soft);
  margin-bottom: 16px; line-height: 1.5;
}
#helpTools { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 22px; margin-bottom: 16px; }
.htool { display: flex; gap: 9px; align-items: baseline; font-size: 0.82rem; padding: 3px 0; }
.htool b { font-variant: small-caps; letter-spacing: 0.1em; min-width: 74px; display: inline-block; }
.htool span { color: var(--ink-soft); font-style: italic; }
.ctrl-line { font-size: 0.78rem; text-align: center; color: var(--ink-soft); margin-top: 8px; line-height: 1.6; }
.ctrl-line.dim { font-style: italic; opacity: 0.75; }
.help-actions { display: flex; justify-content: center; gap: 14px; margin-top: 18px; }
.help-actions button {
  font-family: inherit; font-variant: small-caps; letter-spacing: 0.1em;
  background: #f2e8cf; border: 1px solid var(--ivory-edge);
  padding: 8px 18px; cursor: pointer; font-size: 0.82rem; color: var(--ink);
}
.help-actions button:hover { background: #fbf5e6; }
#btnNewTown { color: #8a4a30; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .tool { width: 44px; }
  .tool .tname { font-size: 0.52rem; }
  .tool .key { display: none; }
  #feed { max-width: 240px; bottom: 84px; }
  #introCard h1 { font-size: 1.7rem; }
  #helpTools { grid-template-columns: 1fr; }
}
