/* Layout: a searchable monument index grouped by state on the left; the stage on the right opens on a map of India, then shows a full-bleed 3D model with a floating plaque. On phones the plaque collapses to a bar under the model and the index becomes a swipeable strip below it. */
:root {
  --bg: #eceef3;
  --fg: #1c1f30;
  --muted: #5a5f77;
  --line: rgba(28, 31, 48, 0.12);
  --panel: rgba(248, 249, 252, 0.86);
  --active: rgba(208, 106, 18, 0.12);
  --accent: #b8590c;
  --sky-top: #86afd4;
  --sky-horizon: #ebe2d3;
  --ground: #b7a684;
  --scene-mode: day;
  --sea: #dde6ec;
  --land: #f1e8d5;
  --land-line: rgba(122, 92, 52, 0.32);
  --outline: #8a6a45;
  --t-sacred: #cf5f12;
  --t-fort: #b02a5c;
  --t-memorial: #2d6aa6;
  --t-civic: #2c8452;
  --pin-ring: #ffffff;
  --font-display: "Rozha One", "Georgia", serif;
  --font-body: "Hind", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10121d;
    --fg: #ebeaf2;
    --muted: #a0a3ba;
    --line: rgba(235, 234, 242, 0.12);
    --panel: rgba(18, 20, 33, 0.8);
    --active: rgba(242, 160, 61, 0.14);
    --accent: #f2a03d;
    --sky-top: #060a1a;
    --sky-horizon: #2c2944;
    --ground: #24242f;
    --scene-mode: night;
    --sea: #0b0d17;
    --land: #1e2132;
    --land-line: rgba(235, 234, 242, 0.16);
    --outline: #8d8fb2;
    --t-sacred: #f39a4b;
    --t-fort: #ec6b97;
    --t-memorial: #66a8e6;
    --t-civic: #55c98f;
    --pin-ring: #10121d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10121d;
  --fg: #ebeaf2;
  --muted: #a0a3ba;
  --line: rgba(235, 234, 242, 0.12);
  --panel: rgba(18, 20, 33, 0.8);
  --active: rgba(242, 160, 61, 0.14);
  --accent: #f2a03d;
  --sky-top: #060a1a;
  --sky-horizon: #2c2944;
  --ground: #24242f;
  --scene-mode: night;
  --sea: #0b0d17;
  --land: #1e2132;
  --land-line: rgba(235, 234, 242, 0.16);
  --outline: #8d8fb2;
  --t-sacred: #f39a4b;
  --t-fort: #ec6b97;
  --t-memorial: #66a8e6;
  --t-civic: #55c98f;
  --pin-ring: #10121d;
  color-scheme: dark;
}

[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
}
.app {
  height: 100%;
  display: grid;
  grid-template-columns: 300px 1fr;
}
.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
}
.masthead {
  position: relative;
  padding: 22px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.theme-btn { position: absolute; top: 14px; right: 14px; }
.masthead h1 {
  margin: 0;
  padding-right: 64px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.1;
  text-wrap: balance;
}
.masthead .hi {
  margin: 4px 0 0;
  color: var(--accent);
  font-size: 15px;
}
.masthead p.sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 2px 10px;
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.item:hover { background: var(--line); }
.item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.item[aria-current="true"] { background: var(--active); }
.item[aria-current="true"] .name { color: var(--accent); }
.item .name { font-weight: 600; font-size: 15px; }
.item .h {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.item .place { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; }

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
#scene { display: block; width: 100%; height: 100%; touch-action: none; }
.status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}
.toolbar {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 6px;
}
.btn {
  height: 36px;
  min-width: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--fg);
  font: 500 13px/1 var(--font-body);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[aria-pressed="true"] { color: var(--accent); }
.btn svg { width: 16px; height: 16px; }

.plaque {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: min(380px, calc(100% - 32px));
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.p-toggle { display: none; }
.plaque .eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.plaque h2 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.1;
  text-wrap: balance;
}
.plaque .local { margin: 2px 0 0; color: var(--accent); font-size: 15px; }
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
}
.stats div { min-width: 0; }
.stats dt {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.stats dd {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
details.facts { margin-top: 10px; }
details.facts summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}
details.facts ul {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hint {
  position: absolute;
  right: 16px;
  bottom: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

/* Search and state groups in the index */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.search { padding: 10px 12px 4px; }
.search input {
  width: 100%;
  box-sizing: border-box;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
}
.search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.q-empty { margin: 8px 4px 0; color: var(--muted); font-size: 13px; }
.list .grp { display: flex; flex-direction: column; }
.list .grp ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.grp-h {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  margin-top: 6px;
  padding: 6px 12px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 600 11px/1.2 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}
.grp-h::before { content: "▾"; margin-right: 6px; transition: transform 0.15s; }
.grp-h[aria-expanded="false"]::before { transform: rotate(-90deg); }
.grp-h .grp-name { flex: 1; }
.grp-h .grp-n { font-variant-numeric: tabular-nums; }
.grp-h:hover { color: var(--fg); }
.grp-h:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Map home view */
.mapview { position: absolute; inset: 0; display: none; background: var(--sea); }
.stage.is-map .mapview { display: block; }
.stage.is-map #scene, .stage.is-map .plaque, .stage.is-map .hint, .stage.is-map .toolbar { display: none; }
.map-svg { display: block; width: 100%; height: 100%; }
.map-svg .state { fill: var(--land); stroke: var(--land-line); stroke-width: 0.8; vector-effect: non-scaling-stroke; }
.map-svg .state:hover { fill: var(--active); }
.map-svg .outline { fill: none; stroke: var(--outline); stroke-width: 1.2; vector-effect: non-scaling-stroke; pointer-events: none; }
.pin { cursor: pointer; outline: none; }
.pin circle { stroke: var(--pin-ring); stroke-width: 1.6; vector-effect: non-scaling-stroke; transition: stroke 0.15s; }
.pin.t-sacred circle { fill: var(--t-sacred); }
.pin.t-fort circle { fill: var(--t-fort); }
.pin.t-memorial circle { fill: var(--t-memorial); }
.pin.t-civic circle { fill: var(--t-civic); }
.pin.cluster circle { fill: var(--fg); }
.pin.cluster text:not(.pin-label) { fill: var(--bg); font-family: var(--font-body); font-weight: 600; pointer-events: none; }
.pin:hover circle, .pin:focus-visible circle, .pin.hl circle { stroke: var(--accent); stroke-width: 3.2; }
.pin .pin-label {
  fill: var(--fg);
  font-family: var(--font-body);
  font-weight: 500;
  stroke: var(--land);
  stroke-width: 3px;
  paint-order: stroke;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.maphead {
  position: absolute;
  right: 16px;
  top: 16px;
  max-width: 280px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.maphead h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 24px; line-height: 1.1; }
.maphead p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.maphead .btn { margin-top: 10px; }
.legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  margin: 0;
  padding: 10px 14px;
  list-style: none;
  display: grid;
  gap: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 12.5px;
}
.legend li { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.t-sacred { background: var(--t-sacred); }
.dot.t-fort { background: var(--t-fort); }
.dot.t-memorial { background: var(--t-memorial); }
.dot.t-civic { background: var(--t-civic); }
.maptip {
  position: absolute;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  line-height: 1.35;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.maptip strong { font-weight: 600; }
.maptip span { color: var(--muted); }

@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .side { display: contents; }
  .masthead {
    grid-row: 1;
    padding: 12px 16px 10px;
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
  }
  .masthead h1 { font-size: 22px; padding-right: 0; }
  .theme-btn { top: 50%; right: 12px; transform: translateY(-50%); }
  .masthead .hi { margin: 0; font-size: 13px; }
  .masthead p.sub { display: none; }
  .stage { grid-row: 2; }
  .list {
    grid-row: 3;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 16px;
    border-top: 1px solid var(--line);
    scroll-snap-type: x proximity;
  }
  .list li { flex: 0 0 auto; scroll-snap-align: start; }
  .list .grp, .list .grp ul { display: contents; }
  .list .grp ul[hidden] { display: contents !important; }
  .grp-h, .search { display: none; }
  .item { width: 184px; padding: 7px 10px; }
  .maphead { right: 12px; top: 12px; max-width: 46%; padding: 8px 12px; }
  .maphead h2 { font-size: 18px; }
  .maphead p { display: none; }
  .legend { left: 12px; bottom: 12px; grid-template-columns: repeat(2, auto); }
  /* The stage stacks the model above the plaque, so the details never cover the monument. */
  .app { height: 100dvh; }
  .stage { display: flex; flex-direction: column; }
  #scene { flex: 1 1 auto; min-height: 0; height: auto; }
  .plaque {
    position: relative;
    left: auto;
    bottom: auto;
    width: auto;
    flex: none;
    padding: 10px 16px;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .p-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    cursor: pointer;
  }
  .p-head > p, .p-head > h2 { grid-column: 1; min-width: 0; }
  .plaque .eyebrow { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .plaque h2 { font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .plaque .local { font-size: 14px; }
  .p-toggle {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--fg);
    cursor: pointer;
  }
  .p-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .p-toggle svg { width: 16px; height: 16px; transition: transform 0.2s; }
  .plaque.is-open .p-toggle svg { transform: rotate(180deg); }
  .p-more { display: none; }
  .plaque.is-open .p-more {
    display: block;
    max-height: 38dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .stats { margin-top: 10px; }
  .hint { display: none; }
  .toolbar { top: 10px; right: 10px; }
  .btn { height: 40px; min-width: 40px; border-radius: 20px; padding: 0 10px; }
  .btn .label { display: none; }
  .list { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .item { grid-template-columns: minmax(0, 1fr) auto; }
  .item .name, .item .place { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) {
  .list { scroll-behavior: auto; }
  .p-toggle svg { transition: none; }
}
