/* The Cedars 3D tour (The Filston, house type 02). Full-bleed three.js canvas; four quiet panels pinned to the
   corners; room chips along the bottom edge. Colours: Inhouse navy #11232D and orange #F45111. Fonts: Poppins (the
   site font) and the system monospace. */
:root {
  --ground: #eef0f1;
  --panel: rgba(250, 250, 249, 0.9);
  --panel-solid: #fafaf9;
  --ink: #11232d;
  --muted: #5f656b;
  --line: #d8dadb;
  --accent: #f45111;           /* Inhouse orange */
  --accent-ink: #11232d;       /* navy on orange: 4.6:1 */
  --orange: #f45111;
  --chip: #ffffff;
  --shadow: 0 6px 24px rgba(20, 24, 28, 0.12);
  --display: "Poppins", "Helvetica Neue", Arial, sans-serif;
  --body: "Poppins", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #121416; --panel: rgba(26, 29, 32, 0.9); --panel-solid: #1a1d20; --ink: #eceae6; --muted: #a3a8ad;
    --line: #34383c; --accent: #f45111; --accent-ink: #11232d; --chip: #24282c; --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #121416; --panel: rgba(26, 29, 32, 0.9); --panel-solid: #1a1d20; --ink: #eceae6; --muted: #a3a8ad;
  --line: #34383c; --accent: #f45111; --accent-ink: #11232d; --chip: #24282c; --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--body); overflow: hidden;
  -webkit-font-smoothing: antialiased; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.panel { position: fixed; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 5; }
#brand { top: calc(14px + env(safe-area-inset-top, 0px)); left: max(16px, env(safe-area-inset-left, 0px));
  padding: 12px 16px 13px; max-width: min(340px, calc(100vw - 32px)); }
.eyebrow { font: 600 11px/1.2 var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); margin: 0 0 4px; }
.eyebrow::before { content: ""; display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--orange); vertical-align: middle; margin: -2px 7px 0 0; }
h1 { font: 600 24px/1.1 var(--display); letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
.meta { font: 400 12px/1.4 var(--mono); color: var(--muted); margin: 6px 0 0; font-variant-numeric: tabular-nums; }
#where { font: 500 12px/1.3 var(--mono); color: var(--ink); margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); }
#where span { color: var(--muted); }

#modes { top: calc(14px + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); padding: 4px; display: flex; gap: 4px; }
.seg { display: flex; gap: 4px; }
button { font: 600 13px/1 var(--body); color: var(--ink); background: transparent; border: 0; border-radius: 7px;
  padding: 9px 12px; cursor: pointer; white-space: nowrap; }
button:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
button[aria-pressed="true"] { background: var(--ink); color: var(--panel-solid); }

#dock { left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(14px + env(safe-area-inset-bottom, 0px)); padding: 8px; display: grid; gap: 8px;
  grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
#floors { border-right: 1px solid var(--line); padding-right: 8px; }
#rooms { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding: 4px; min-width: 0;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); padding-right: 36px; }
#rooms button:focus-visible { outline-offset: -3px; }
#rooms button { background: var(--chip); border: 1px solid var(--line); font-weight: 500; padding: 8px 11px; }
#rooms button .fl { font: 500 10px/1 var(--mono); color: var(--muted); margin-right: 6px; }
#rooms button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
#rooms button[aria-pressed="true"] .fl { color: inherit; opacity: 0.8; }
#tools { border-left: 1px solid var(--line); padding-left: 8px; }
.label-tag { position: fixed; z-index: 3; transform: translate(-50%, -50%); pointer-events: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; white-space: nowrap;
  font: 600 12px/1.15 var(--body); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,0.08); text-align: center; }
.label-tag small { display: block; font: 400 10.5px/1.2 var(--mono); color: var(--muted); }
#hint { position: fixed; z-index: 4; left: 0; right: 0; margin-inline: auto; width: max-content;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  font: 500 12px/1.3 var(--body); color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 999px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); text-align: center;
  box-sizing: border-box; }
#cross { position: fixed; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; z-index: 4; pointer-events: none; }
#cross::before, #cross::after { content: ""; position: absolute; background: rgba(255,255,255,0.85); box-shadow: 0 0 2px rgba(0,0,0,0.5); }
#cross::before { left: 6px; top: 0; width: 2px; height: 14px; }
#cross::after { top: 6px; left: 0; height: 2px; width: 14px; }
#joy { position: fixed; z-index: 6; box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 35%, transparent); left: max(28px, calc(env(safe-area-inset-left, 0px) + 20px));
  bottom: calc(150px + env(safe-area-inset-bottom, 0px)); width: 120px; height: 120px; border-radius: 50%;
  background: color-mix(in srgb, var(--panel-solid) 55%, transparent); border: 1px solid var(--line); touch-action: none; }
#joy i { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%;
  background: var(--panel-solid); border: 1px solid var(--line); box-shadow: var(--shadow); }
.sheet { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; background: rgba(10, 12, 14, 0.55);
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); }
.sheet .card { box-sizing: border-box; background: var(--panel-solid); color: var(--ink); border-radius: 12px; border: 1px solid var(--line);
  max-width: 980px; width: 100%; max-height: calc(100% - 32px); overflow: auto; padding: 20px; box-shadow: var(--shadow); }
.sheet h2 { font: 600 20px/1.15 var(--display); margin: 0; }
.sheet .head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.grid figure { margin: 0; display: grid; gap: 6px; }
.grid img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; background: var(--line); }
.grid figcaption { font: 500 13px/1.3 var(--body); }
.grid figcaption span { font: 400 11px/1.3 var(--mono); color: var(--muted); display: block; }
#bigimg { width: 100%; height: auto; border-radius: 8px; display: block; }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 14px; line-height: 1.45; max-width: 62ch; }
kbd { font: 500 12px/1 var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 3px 6px; background: var(--chip); }
.note { font-size: 13px; color: var(--muted); line-height: 1.5; max-width: 65ch; margin: 16px 0 0; }
#loader { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: var(--ground); }
#loader .box { text-align: center; display: grid; gap: 10px; justify-items: center; padding: 0 16px; }
#loader .bar { width: 220px; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
#loader .bar i { display: block; height: 100%; width: 10%; background: var(--orange); transition: width 0.25s ease; }
#loader .lt { font: 600 24px/1.1 var(--display); color: var(--ink); }
#loader p { margin: 0; font: 400 12px/1.4 var(--mono); color: var(--muted); }
#err { color: var(--ink); font: 500 13px/1.5 var(--body); max-width: 46ch; }
@media (max-width: 760px) {
  h1 { font-size: 19px; }
  #brand { padding: 10px 12px; max-width: calc(100vw - 32px - 150px); }
  .meta { display: none; }
  #dock { grid-template-columns: minmax(0, 1fr) auto; }
  #floors { grid-column: 1 / -1; border-right: 0; padding-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
  #floors button { flex: 1; padding: 9px 6px; }
  #tools { border-left: 0; padding-left: 0; }
  #dock button { min-height: 40px; }
  #hint { bottom: auto; top: calc(96px + env(safe-area-inset-top, 0px)); white-space: normal; }
  .label-tag { font-size: 10.5px; padding: 3px 5px; }
  .label-tag small { font-size: 9.5px; }
}
@media (prefers-reduced-motion: reduce) { #loader .bar i { transition: none; } }

/* Back link to the Cedars page (hidden when the tour is embedded on that page) */
.back { display: inline-flex; align-items: center; gap: 6px; margin: -2px 0 8px; padding: 6px 10px 6px 8px; border-radius: 999px;
  background: #11232d; color: #fff; font: 600 12px/1 var(--body); text-decoration: none; min-height: 32px; box-sizing: border-box; }
.back:hover { background: #18323f; }
.back svg { width: 14px; height: 14px; flex: none; }
.embedded .back { display: none; }
@media (max-width: 760px) { .back { min-height: 36px; } }
