/* Property panel v2, phases/status legend, modals, lightbox, regional map, toast */
:root {
  --ok: #34a853; --warn: #f0a020; --bad: #d93025;
}
#lightbox[hidden], #modal[hidden], #map-modal[hidden], #poi-card[hidden] { display: none !important; }
.legend-sub { margin-top: 10px; }
#parcel-items { display: flex; flex-wrap: wrap; gap: 4px; }
.pchip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: transparent; cursor: pointer; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.pchip:hover { background: rgba(16,20,24,0.06); }
.pchip.off { opacity: 0.35; text-decoration: line-through; }
.pchip small { font-weight: 400; color: var(--ink-2); }
#status-items { display: flex; gap: 6px; flex-wrap: wrap; }
.schip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 7px; background: transparent; cursor: pointer; }
.schip:hover { background: rgba(16,20,24,0.06); }
.schip.off { opacity: 0.35; text-decoration: line-through; }
.schip.toggle { border-style: dashed; }
.schip.toggle.on { border-style: solid; background: rgba(16,20,24,0.06); }
#status-by-phase { margin-top: 6px; font-size: 11.5px; }
#status-by-phase[hidden] { display: none; }
.sbp-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 4px; padding: 2px 4px; border-radius: 6px; }
.sbp-row.head { color: var(--ink-2); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.sbp-row:not(.head):nth-child(even) { background: rgba(16,20,24,0.04); }
.sbp-row.off { opacity: 0.4; }
.sbp-row span:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
body.night .sbp-row:not(.head):nth-child(even), body.night .schip:hover, body.night .schip.toggle.on { background: rgba(255,255,255,0.08); }
.schip b { color: var(--ink); font-weight: 600; }

/* panel */
#panel { width: 500px; }
.panel-scroll { flex: 1; overflow: auto; display: flex; flex-direction: column; }
#panel figure { flex: none; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.status-badge { flex: none; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 5px 9px; border-radius: 999px; color: #fff; background: var(--ok); }
.status-badge.reserved { background: #2b7de9; }   /* GRANRESERVA-MAIN11: reserved = blue (STATUS.reserved) */
.status-badge.sold { background: var(--bad); }
.pid-line { font-size: 11px; color: var(--ink-2); margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pid-line code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; background: rgba(16,20,24,0.06); padding: 2px 6px; border-radius: 5px; }
#panel-body { padding: 6px 18px 8px; flex: none; overflow: visible; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.fact.wide { grid-column: 1 / -1; }
.plan-section { padding: 6px 18px 14px; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 6px; }
.section-head h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-2); font-weight: 600; }
.btn.small { height: 30px; padding: 0 10px; font-size: 12px; box-shadow: none; }
#panel-plan { width: 100%; height: auto; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); cursor: zoom-in; display: block; }
#panel-plan-name { font-size: 12px; margin-top: 6px; }
.panel-actions { display: flex; gap: 8px; padding: 10px 18px 6px; border-top: 1px solid var(--line); flex: none; }
.panel-actions .btn { height: 40px; padding: 0 12px; box-shadow: none; flex: 1; font-size: 13px; }
.panel-actions .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.panel-nav { display: flex; gap: 6px; padding: 0 18px 14px; flex: none; }
.panel-nav .btn { height: 34px; padding: 0 10px; box-shadow: none; font-size: 12px; }
.panel-nav #panel-fly { flex: 1; }
.sheet-toggle { display: none; }
.inferred-note { font-size: 11px; color: var(--ink-2); font-style: italic; }

/* lightbox */
#lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(10, 14, 18, 0.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
#lightbox img { max-width: 100%; max-height: calc(100% - 40px); border-radius: 12px; background: #fff; }
#lightbox p { color: #fff; margin-top: 10px; font-size: 13px; }
.lb-close { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; font-size: 24px; }

/* modal (lead form / password) */
#modal { position: fixed; inset: 0; z-index: 55; background: rgba(10, 14, 18, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { position: relative; width: 440px; max-width: 100%; max-height: 92vh; overflow: auto; background: var(--paper-solid); border-radius: 18px; box-shadow: var(--shadow); padding: 22px 22px 18px; }
.modal-card h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin-bottom: 4px; }
.modal-card p.intro { color: var(--ink-2); font-size: 13px; margin-bottom: 14px; }
.modal-card .ref { font-size: 12px; background: rgba(16,20,24,0.05); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 12px; color: var(--ink-2); }
.field input, .field textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,150,42,0.25); }
.field textarea { min-height: 84px; resize: vertical; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.modal-actions .btn { box-shadow: none; height: 40px; }
.form-msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--bad); }
.field.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.modal-close { top: 10px; right: 10px; }

/* regional map */
#map-modal { position: fixed; inset: 0; z-index: 50; background: rgba(10, 14, 18, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.map-card { width: 1100px; max-width: 100%; max-height: 94vh; background: var(--paper-solid); border-radius: 18px; box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.map-head { display: flex; align-items: center; justify-content: space-between; }
.map-head h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; }
.map-head .btn { box-shadow: none; height: 36px; }
.map-body { display: grid; grid-template-columns: 1fr 320px; gap: 14px; min-height: 0; }
.map-canvas-wrap { position: relative; border-radius: 12px; overflow: hidden; background: #0d1b2a; aspect-ratio: 1 / 1; max-height: 70vh; }
#map-canvas { width: 100%; height: 100%; display: block; }
.map-list { overflow: auto; max-height: 70vh; display: flex; flex-direction: column; gap: 4px; }
.poi { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.poi:hover, .poi.active { background: rgba(16,20,24,0.06); }
.poi .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; color: #fff; }
.poi .nm { font-weight: 500; font-size: 13px; line-height: 1.2; }
.poi .cat { font-size: 11px; color: var(--ink-2); }
.poi .dist { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.poi .dist b { display: block; font-size: 13px; }
.map-cat-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-2); margin: 8px 8px 2px; font-weight: 600; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); z-index: 70; background: rgba(16,20,24,0.92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13px; opacity: 0; transition: opacity 0.2s ease, transform 0.2s ease; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* night mode UI tint */
body.night { --paper: rgba(24, 28, 34, 0.86); --paper-solid: #1f242b; --ink: #f1f3f5; --ink-2: #aab2bc; --line: rgba(255,255,255,0.1); }
body.night .btn:hover { background: #2a3038; }
body.night #search-results > div:hover, body.night .poi:hover, body.night .poi.active { background: rgba(255,255,255,0.08); }
body.night .field input, body.night .field textarea { background: #2a3038; }
body.night .pid-line code, body.night .modal-card .ref { background: rgba(255,255,255,0.08); }
body.night .unk-logo { filter: invert(1) brightness(0.95); }   /* the Gran Reserva logotype is gold: never inverted */
body.night #tooltip { background: rgba(240,242,245,0.92); color: #111; }
body.night #tooltip .muted { color: #444; }
body.night #panel-plan { background: #fff; }

@media (max-width: 900px) {
  .map-body { grid-template-columns: 1fr; }
  .map-canvas-wrap { max-height: 46vh; aspect-ratio: auto; height: 46vh; }
  .map-list { max-height: 30vh; }
}
@media (max-width: 640px) {
  #panel { width: auto; max-height: 56vh; transition: transform 0.35s cubic-bezier(0.2,0.8,0.2,1), max-height 0.3s ease; }
  #panel.expanded { max-height: 94vh; }
  .sheet-toggle { display: grid; place-items: center; top: 8px; right: 46px; width: 30px; height: 30px; font-size: 16px; }
  #panel.expanded .sheet-toggle { transform: rotate(180deg); }
  .facts { grid-template-columns: 1fr; }
  .panel-actions { padding: 8px 12px 4px; gap: 6px; }
  .panel-actions .btn { height: 38px; font-size: 12px; padding: 0 8px; }
  .panel-nav { padding: 0 12px 10px; }
  .plan-section { padding: 4px 14px 10px; }
  .modal-card { padding: 18px 16px 14px; }
  #btn-map, #btn-night { padding: 0 8px; }
}

/* night mode: buttons that use the ink colour would turn white-on-white */
body.night .btn.active { background: #f1f3f5; color: #111; }
body.night .btn.ghost { background: rgba(255,255,255,0.1); }
body.night .btn.ghost:hover { background: rgba(255,255,255,0.2); }
body.night .chip:hover, body.night .pchip:hover { background: rgba(255,255,255,0.08); }
body.night #controls-hint, body.night #credits { color: #aab2bc; }
body.night .icon-btn { background: rgba(255,255,255,0.12); color: #fff; }

/* tablets: keep the header reachable (the panel starts below it) and leave room for the scene */
@media (max-width: 1100px) and (min-width: 641px) { #panel { width: 420px; } }
@media (max-width: 900px) and (min-width: 641px) { #panel { top: 164px; width: 400px; } }
@media (max-width: 640px) { .map-head h2 { font-size: 18px; } .map-card { padding: 12px 12px 10px; } }

/* time of day */
.time-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 11.5px; color: var(--ink-2); }
.time-row input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); height: 18px; }
.time-row #time-label { min-width: 62px; text-align: right; color: var(--ink); font-weight: 600; }

/* points of interest in the 3D view */
#poi-layer { position: fixed; inset: 0; z-index: 15; pointer-events: none; overflow: hidden; }
.poi-dot { position: absolute; left: 0; top: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 2px solid #fff; background: var(--c); box-shadow: 0 1px 4px rgba(0,0,0,0.45); cursor: pointer; padding: 0; pointer-events: auto; will-change: transform; }
.poi-dot .ic { display: none; }
.poi-dot.edge { box-shadow: 0 0 0 2px rgba(255,255,255,0.35), 0 1px 4px rgba(0,0,0,0.5); }   /* off-screen place, pinned to the border in its direction */
.poi-dot.big { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
.poi-dot.big .ic { display: grid; place-items: center; width: 100%; height: 100%; color: #fff; font-size: 13px; line-height: 1; }
.poi-dot .lbl { display: none; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); white-space: nowrap; background: rgba(10,14,20,0.78); color: #fff; font: 500 11px/1.3 var(--font); padding: 3px 7px; border-radius: 6px; pointer-events: none; }
.poi-dot.big .lbl { left: 24px; }
.poi-dot.big .lbl, .poi-dot:hover .lbl, .poi-dot.active .lbl { display: block; }
.poi-dot.active { transform-origin: center; box-shadow: 0 0 0 4px rgba(255,179,71,0.55), 0 1px 4px rgba(0,0,0,0.45); }
#poi-card { position: fixed; left: 14px; top: 84px; z-index: 26; width: 300px; max-width: calc(100vw - 28px); background: var(--paper-solid); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 14px 12px; }
.poi-card-head { display: flex; gap: 10px; align-items: center; padding-right: 30px; }
.poi-card-head .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 17px; flex: none; }
.poi-card-head .nm { font-family: var(--serif); font-size: 17px; font-weight: 500; line-height: 1.15; }
.poi-card-head .cat { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; }
.poi-facts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 12px 0 10px; }
.poi-facts.two { grid-template-columns: 1fr 1fr; }
.poi-facts div { background: rgba(16,20,24,0.05); border-radius: 9px; padding: 7px 6px; text-align: center; }
.poi-facts b { display: block; font-size: 14px; }
.poi-facts span { font-size: 10.5px; color: var(--ink-2); }
.poi-card-actions { display: flex; gap: 6px; }
.poi-card-actions .btn { flex: 1; }
.poi-card-close { top: 8px; right: 8px; width: 28px; height: 28px; font-size: 18px; }
body.night .poi-facts div { background: rgba(255,255,255,0.08); }
@media (max-width: 900px) { #poi-card { top: 170px; } }
@media (max-width: 640px) { #poi-card { top: 132px; left: 8px; right: 8px; width: auto; padding: 10px 10px 8px; } .poi-dot .lbl { font-size: 10px; } .time-row { margin-top: 4px; } .time-row #time-label { min-width: 54px; } }
/* phases under construction (locked until the access password is accepted) */
.pchip.locked { opacity: 0.55; }
.pchip.locked::after { content: '🔒'; font-size: 9px; margin-left: 3px; }
.pchip.locked:hover { opacity: 0.9; }
/* panel gallery: arrows (always visible on touch screens), dots */
.gal-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(16,20,24,0.55); color: #fff; font-size: 26px; line-height: 30px; padding: 0 0 3px; cursor: pointer; opacity: 0; transition: opacity 0.15s, background 0.15s; }
.gal-nav.prev { left: 10px; } .gal-nav.next { right: 10px; }
.gal-nav:hover { background: rgba(16,20,24,0.8); }
#panel figure:hover .gal-nav, body.touch .gal-nav { opacity: 1; }
.gal-dots { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 5px; }
.gal-dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.55); box-shadow: 0 0 0 1px rgba(0,0,0,0.25); }
.gal-dots span.on { background: #fff; }
/* facade colour choice */
.swatches { display: inline-flex; gap: 6px; flex-wrap: wrap; vertical-align: middle; margin-right: 6px; }
.swatch-btn { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18); cursor: pointer; padding: 0; transition: transform 0.12s; }
.swatch-btn:hover { transform: scale(1.12); }
.swatch-btn.on { border-color: var(--ink); }
.colour-fact .v { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.colour-fact .v em { flex-basis: 100%; }
body.night .swatch-btn.on { border-color: #fff; }
/* lightbox navigation */
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.16); color: #fff; font-size: 34px; line-height: 40px; padding: 0 0 4px; cursor: pointer; z-index: 2; }
.lb-nav:hover { background: rgba(255,255,255,0.32); }
.lb-prev { left: 18px; } .lb-next { right: 18px; }
.lb-nav[hidden] { display: none; }
/* vertical projects: floor chips; panel figure hidden when a type has no renders */
#floor-items { display: flex; flex-wrap: wrap; gap: 4px; }
#floor-items[hidden], #legend-floors-title[hidden], #legend-parcels-title[hidden], #parcel-items[hidden] { display: none; }
#panel-figure[hidden] { display: none; }

/* ===== Gran Reserva: 360 tours, leisure menu, badges, developer card ===== */
.pano-section { padding: 6px 18px 10px; border-top: 1px solid var(--line); }
.pano-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: thin; }
.pano-card { position: relative; flex: none; width: 132px; border: 1px solid var(--line); border-radius: 10px; padding: 0; background: #fff; cursor: pointer; overflow: hidden; text-align: left; color: var(--ink); }
.pano-card img { display: block; width: 100%; height: 72px; object-fit: cover; }
.pano-card span { display: block; font-size: 11.5px; font-weight: 600; padding: 5px 7px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pano-card b { position: absolute; top: 6px; left: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; color: #fff; background: rgba(16,20,24,0.72); border-radius: 999px; padding: 2px 7px; }
.pano-card:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(0,0,0,0.12); }
.pano-card.plain img { height: 80px; }
.pano-section .muted.small { font-size: 11.5px; margin-top: 2px; }
.modal-card.wide { width: 900px; }
.lm-h { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-2); font-weight: 600; margin: 12px 0 6px; }
.modal-card.wide .pano-row.lm .pano-card { width: 156px; }
.modal-card.wide .pano-row.lm .pano-card img { height: 88px; }
#pano-markers { position: fixed; inset: 0; pointer-events: none; z-index: 12; }
.pano-marker { position: absolute; transform: translate(-50%, -100%); pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; padding: 0 0 8px; cursor: pointer; color: #fff; }
.pano-marker b { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; background: rgba(16,20,24,0.78); border: 2px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,0.35); transition: transform 0.15s ease, background 0.15s ease; }
.pano-marker span { display: none; font-size: 11px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,0.9); background: rgba(16,20,24,0.55); padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.pano-marker:hover b { transform: scale(1.12); background: var(--accent); color: #1a1208; }
.pano-marker:hover span { display: block; }
.pano-marker::after { content: ''; position: absolute; bottom: 0; left: 50%; width: 2px; height: 8px; background: #fff; transform: translateX(-1px); opacity: 0.8; }
body.pano-open #pano-markers { display: none; }
.dev-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.dev-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-2); font-weight: 600; }
.dev-logo { height: 30px; width: auto; }
body.night .dev-logo { filter: invert(1) hue-rotate(180deg) brightness(1.4); }
@media (max-width: 720px) { .pano-card { width: 112px; } .pano-card img { height: 62px; } .modal-card.wide { width: 100%; } .pano-marker span { display: none; } }

/* ===== Gran Reserva: guided tour card + cinematic intro ===== */
#tour { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 30; width: min(560px, calc(100vw - 24px)); }
#tour[hidden] { display: none !important; }
.tour-card { background: var(--paper); backdrop-filter: blur(10px); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px 12px; }
.tour-head { display: flex; align-items: center; justify-content: space-between; }
.tour-step { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; }
.tour-close { width: 30px; height: 30px; font-size: 20px; }
.tour-title { font-family: var(--serif); font-weight: 500; font-size: 20px; margin: 2px 0 4px; }
.tour-text { font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.tour-dots { display: flex; gap: 6px; }
.tour-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(16,20,24,0.18); cursor: pointer; }
.tour-dots span.on { background: var(--accent); }
body.night .tour-dots span { background: rgba(255,255,255,0.25); }
body.night .tour-dots span.on { background: var(--accent); }
body.tour-on #controls-hint, body.tour-on #pano-markers { display: none !important; }
#intro-logo { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; pointer-events: none; opacity: 1; transition: opacity 1.6s ease; }
#intro-logo img { width: min(46vw, 420px); filter: drop-shadow(0 6px 30px rgba(0,0,0,0.55)); }
#intro-logo.fade { opacity: 0; }
#intro-skip { position: fixed; right: 18px; bottom: 26px; z-index: 41; }
@media (max-width: 720px) { #tour { bottom: 12px; } .tour-title { font-size: 17px; } .tour-text { font-size: 12.5px; } }
