/* Tiny València — chunky pixel-art panels over a full-bleed map */
:root {
  --paper: #fbf6ec;
  --paper-2: #f3ead8;
  --ink: #2a2018;
  --muted: #76675a;
  --orange: #ef7d22;
  --orange-2: #f6a53b;
  --blue: #1262b2;
  --table: #e7dfcf;
  --shadow: 3px 3px 0 var(--ink);
  --pixel: "Pixelify Sans", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gap: 16px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--table); color: var(--ink);
  font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); }
button { font: inherit; color: inherit; }

/* the map sits on a drafting table: a faint dot grid where there is no city */
#map { position: fixed; inset: 0; background-color: var(--table);
  background-image: radial-gradient(rgba(42,32,24,.13) 1px, transparent 1.2px); background-size: 22px 22px; }
#map:focus, #map *:focus { outline: none; }

.panel { background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; box-shadow: var(--shadow); }

/* brand */
.brand { position: fixed; z-index: 3; left: var(--gap); top: var(--gap); display: flex; gap: 10px; align-items: center;
  padding: 8px 14px 8px 10px; max-width: calc(100vw - 2 * var(--gap)); }
.logo { width: 34px; height: 34px; flex: none; image-rendering: pixelated; }
.brand h1 { margin: 0; font: 700 22px/1 var(--pixel); letter-spacing: .3px; }
.brand .sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); white-space: nowrap; }
.brand .sub b { color: var(--ink); font-weight: 600; }
.pencil { background: repeating-linear-gradient(135deg, #fff 0 3px, #e9e4da 3px 4px); border: 1px solid #b9ae9c;
  border-radius: 3px; padding: 0 4px; color: #5d5246; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; min-width: 40px; padding: 0 12px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; box-shadow: var(--shadow); cursor: pointer;
  font: 500 15px/1 var(--pixel); transition: transform .06s, box-shadow .06s, background .1s; user-select: none; }
.btn.icon { padding: 0; width: 40px; }
.btn svg { width: 16px; height: 16px; fill: currentColor; shape-rendering: crispEdges; }
.btn:hover { background: #fff; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); background: var(--orange-2); }
.btn:focus-visible, .placesToggle:focus-visible, .card:focus-visible, .linkish:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn[hidden] { display: none; }

/* top right: search, share, about */
.topright { position: fixed; z-index: 4; right: var(--gap); top: var(--gap); display: flex; gap: 10px; align-items: flex-start; }
.search { position: relative; display: flex; align-items: center; height: 40px; width: 300px; padding: 0 10px; gap: 8px; }
.search > svg { width: 16px; height: 16px; flex: none; fill: var(--muted); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font: 15px var(--sans); color: var(--ink); outline: none; }
.search input::placeholder { color: #9b8c7c; }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.search:focus-within { box-shadow: 4px 4px 0 var(--orange); }
#results { position: absolute; left: -2px; right: -2px; top: calc(100% + 8px); margin: 0; padding: 4px; list-style: none;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; box-shadow: var(--shadow); max-height: 50vh; overflow: auto; }
#results li { padding: 8px 10px; border-radius: 4px; cursor: pointer; line-height: 1.3; }
#results li small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#results li[aria-selected="true"], #results li:hover { background: var(--paper-2); }
#results li.none { cursor: default; color: var(--muted); }

/* right edge: zoom, home, random, full screen */
.controls { position: fixed; z-index: 3; right: var(--gap); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; }

/* minimap (OpenSeadragon's navigator) */
.navigator { border: 2px solid var(--ink) !important; border-radius: 6px; box-shadow: var(--shadow);
  background: var(--paper) !important; overflow: hidden; }
.navigator .displayregion { border: 2px solid var(--orange) !important; background: rgba(239,125,34,.12); }

/* places strip */
.places { position: fixed; z-index: 3; left: 50%; bottom: calc(var(--gap) + 18px); transform: translateX(-50%);
  width: min(860px, calc(100vw - 2 * var(--gap) - 260px)); display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.placesToggle { pointer-events: auto; align-self: center; margin-bottom: 8px; padding: 4px 12px; font: 500 14px/1.2 var(--pixel);
  background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; box-shadow: 2px 2px 0 var(--ink); cursor: pointer; }
.placesToggle span { display: inline-block; transition: transform .15s; }
.places.collapsed .placesToggle span { transform: rotate(180deg); }
.places.collapsed .strip { display: none; }
.strip { pointer-events: auto; display: flex; gap: 10px; overflow-x: auto; max-width: 100%; padding: 2px 6px 8px 2px;
  scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--ink) transparent;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.card { flex: none; width: 132px; padding: 0; text-align: left; background: var(--paper); border: 2px solid var(--ink); border-radius: 6px;
  box-shadow: var(--shadow); cursor: pointer; overflow: hidden; scroll-snap-align: start; transition: transform .06s, box-shadow .06s; }
.card:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.card:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.card img { display: block; width: 100%; aspect-ratio: 8 / 5; object-fit: cover; border-bottom: 2px solid var(--ink); background: var(--paper-2); }
.card span { display: block; padding: 5px 7px 6px; font: 500 13px/1.15 var(--pixel); min-height: 36px; }
.card.soon img { filter: grayscale(.85) contrast(.9); opacity: .8; }
.card.soon span::after { content: "Soon"; display: inline-block; margin-left: 5px; padding: 0 4px; font-size: 10px; line-height: 14px;
  background: var(--ink); color: var(--paper); border-radius: 3px; vertical-align: 1px; }

/* credits */
.credits { position: fixed; z-index: 2; right: var(--gap); bottom: 6px; font-size: 11px; color: var(--muted);
  background: rgba(251,246,236,.85); padding: 2px 8px; border-radius: 4px; }
.credits a { color: inherit; }
.linkish { border: 0; background: none; padding: 0; cursor: pointer; text-decoration: underline; color: inherit; font-size: inherit; }

/* toast */
.toast { position: fixed; z-index: 5; left: 50%; top: var(--gap); transform: translateX(-50%); padding: 10px 14px; max-width: min(460px, calc(100vw - 32px));
  text-align: center; animation: pop .18s ease-out; }
.toast b { font: 700 16px/1.2 var(--pixel); display: block; }
.toast small { color: var(--muted); font-size: 13px; }
@keyframes pop { from { transform: translate(-50%, -6px); opacity: 0; } }

/* about */
dialog { max-width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto; padding: 22px 26px 18px; color: var(--ink); }
dialog::backdrop { background: rgba(42,32,24,.35); }
dialog h2 { margin: 0 0 8px; font: 700 28px/1.1 var(--pixel); }
dialog h3 { margin: 18px 0 4px; font: 700 17px/1.2 var(--pixel); }
dialog p { margin: 8px 0; }
dialog .small { font-size: 12px; color: var(--muted); }
dialog .close { position: absolute; right: 14px; top: 14px; font: 700 16px var(--sans); }
.keys { margin: 6px 0; padding-left: 18px; }
.keys li { margin: 3px 0; }
kbd { font: 600 12px var(--sans); border: 1.5px solid var(--ink); border-bottom-width: 3px; border-radius: 4px; padding: 0 5px; background: #fff; }

/* phones and small tablets */
@media (max-width: 760px) {
  :root { --gap: 10px; }
  .brand { padding: 6px 10px 6px 8px; }
  .logo { width: 28px; height: 28px; }
  .brand h1 { font-size: 19px; }
  .brand .sub { display: none; }
  .topright { top: calc(var(--gap) + 58px); left: var(--gap); right: var(--gap); }
  .search { flex: 1; width: auto; }
  #share span { display: none; }
  #share { width: 40px; padding: 0; }
  .controls { top: auto; bottom: calc(var(--gap) + 150px); transform: none; }
  #zin, #zout { display: none; }
  .places { left: var(--gap); right: var(--gap); transform: none; width: auto; bottom: calc(var(--gap) + 16px); align-items: flex-start; }
  .placesToggle { align-self: flex-start; }
  .card { width: 112px; }
  .card span { font-size: 12px; min-height: 32px; }
  .credits { left: var(--gap); right: auto; bottom: 4px; font-size: 10px; }
  .navigator { display: none !important; }
}
@media (max-height: 520px) { .places { display: none; } }
@media (prefers-reduced-motion: reduce) { .btn, .card, .toast { transition: none; animation: none; } }
