/* Cabin status: full-bleed 3D scene with live pop-ups, a readings panel and a scene menu.
   Same dark look as the public site. Text sits on solid-ish glass so it stays readable over bright snow and sky. */
:root {
  color-scheme: dark;
  --bg: #0b0d0a;
  --ink: #ecebe4;
  --ink-2: #c9c8bf;
  --ink-3: #a3a59a;
  --glass: rgba(14, 16, 13, 0.78);
  --glass-2: rgba(14, 16, 13, 0.9);
  --line: rgba(236, 235, 228, 0.16);
  --forest: oklch(0.66 0.09 148);
  --ok: oklch(0.74 0.13 150);
  --warn: oklch(0.80 0.14 80);
  --alert: oklch(0.70 0.17 28);
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --g: 16px;
  --safe-l: max(var(--g), env(safe-area-inset-left, 0px) + var(--g));
  --safe-r: max(var(--g), env(safe-area-inset-right, 0px) + var(--g));
  --safe-t: calc(env(safe-area-inset-top, 0px) + var(--g));
  --safe-b: calc(env(safe-area-inset-bottom, 0px) + var(--g));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 14px; line-height: 1.4; overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible + .track, summary:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }

#scene { position: fixed; inset: 0; }
#scene canvas { display: block; touch-action: none; }
.shade { position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(to bottom, rgba(8,10,8,0.62), rgba(8,10,8,0) 26%), linear-gradient(to top, rgba(8,10,8,0.45), rgba(8,10,8,0) 30%); }
#loading { position: fixed; inset: 0; display: grid; place-items: center; z-index: 30; background: var(--bg);
  font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); transition: opacity .8s; }

/* ---------- top bar ---------- */
.top { position: fixed; z-index: 10; top: var(--safe-t); left: var(--safe-l); right: var(--safe-r);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: grid; gap: 4px; justify-items: start; text-shadow: 0 1px 2px rgba(0,0,0,.7), 0 0 14px rgba(0,0,0,.45); }
.eyebrow { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.dot.alert { background: var(--alert); box-shadow: 0 0 8px var(--alert); }
.brand h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 3.4vw, 2.8rem); line-height: .95; letter-spacing: -.01em; }
.brand h1 em { color: color-mix(in oklch, var(--forest) 55%, var(--ink)); }
.scene-chip { margin-top: 6px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; border-radius: 999px; cursor: pointer;
  background: var(--glass); border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; text-shadow: none;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.scene-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.scene-chip.preview::before { background: var(--warn); }

.top-right { display: flex; gap: 8px; align-items: stretch; flex: none; }
.brand { min-width: 0; }
.wx, .menu-btn { background: var(--glass); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.wx { display: flex; align-items: center; gap: 10px; padding: 6px 12px; }
.wx-t { font-family: var(--display); font-size: 30px; line-height: 1; }
.wx-d { display: grid; white-space: nowrap; font-size: 12px; color: var(--ink-2); line-height: 1.35; font-variant-numeric: tabular-nums; }
.menu-btn { display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; cursor: pointer; font-weight: 500; font-size: 13px; min-height: 44px; }
.menu-btn:hover { border-color: rgba(236,235,228,.35); }

/* ---------- alerts ---------- */
.alerts { position: fixed; z-index: 9; left: 50%; transform: translateX(-50%); top: var(--safe-t); display: grid; gap: 6px; justify-items: center; pointer-events: none; }
.alert { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-weight: 500; font-size: 13px;
  background: var(--glass-2); border: 1px solid currentColor; }
.alert.warn { color: var(--warn); }
.alert.alert { color: var(--alert); }
.alert span { color: var(--ink); }

/* ---------- pop-ups in the scene ---------- */
.pops { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.pops.off, body.covered .pops { display: none; }
/* readings older than a few minutes: still shown, but greyed so they don't read as live */
body.stale .pop button, body.stale .now-list .val { filter: grayscale(1); opacity: .62; }
.menu:focus { outline: none; }
.pop { position: absolute; left: 0; top: 0; display: block; pointer-events: auto; transition: opacity .3s; will-change: transform; }
.pop button { position: relative; z-index: 1; }
.pop button { display: grid; gap: 1px; text-align: left; cursor: pointer; padding: 7px 11px 8px; border-radius: 12px; min-width: 76px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(0,0,0,.28); }
.pop .l { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.pop .l::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
.pop.warn .l::before { background: var(--warn); } .pop.alert .l::before { background: var(--alert); }
.pop.off .l::before { background: var(--ink-3); }
.pop .v { font-family: var(--display); font-size: 24px; line-height: 1.05; white-space: nowrap; }
.pop .v small { font-family: var(--body); font-size: 12px; color: var(--ink-2); margin-left: 2px; }
.pop .v.txt { font-family: var(--body); font-size: 14px; font-weight: 600; padding: 3px 0 1px; }
.pop .n { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; display: none; }
.pop.open .n, .pop.open .dl { display: block; }
.pop .dl { display: none; margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--line); font-size: 12px; }
.pop .dl div { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-2); }
.pop .dl dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.pop:not(.dot) { z-index: 1; }   /* labels sit above crowded dots */
.pop.open { z-index: 2; }
/* owner controls under an open card */
.pop .ctl { position: relative; z-index: 1; margin-top: 6px; display: grid; gap: 6px; padding: 8px 10px; border-radius: 12px; width: max-content; min-width: 100%; box-sizing: border-box;
  background: var(--glass-2); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.pop .ctl .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pop .ctl .k { font-size: 12px; color: var(--ink-2); }
.pop .ctl .seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(236,235,228,.07); }
.pop .ctl button { display: inline-block; min-width: 40px; min-height: 30px; padding: 0 10px; border: 0; border-radius: 999px; background: none; color: var(--ink-2);
  font: 500 12.5px/1 var(--body); cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.pop .ctl button:hover { color: var(--ink); }
.pop .ctl button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.pop .ctl button:disabled { opacity: .35; cursor: default; }
.pop .ctl .step output { min-width: 44px; text-align: center; align-self: center; font: 500 14px/1 var(--body); color: var(--ink); font-variant-numeric: tabular-nums; }
.pop .ctl .msg { margin: 0; font-size: 11.5px; color: var(--ink-2); max-width: 220px; }
@media (max-width: 720px) { .pop .ctl button { min-height: 36px; min-width: 44px; } }
.pop i { display: none; }
.pop b { position: absolute; left: 0; top: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px rgba(0,0,0,.35); pointer-events: none; }
/* a closed pin is one line: name and value; open, it's the full card */
.pop:not(.open):not(.mini) button { display: flex; align-items: center; gap: 8px; padding: 5px 11px 5px 9px; border-radius: 999px; min-width: 0; }
.pop:not(.open):not(.mini) .v { font-size: 18px; line-height: 1; }
.pop:not(.open):not(.mini) .v.txt { font-size: 13px; padding: 0; }
/* no room for its label: just the dot, a little larger, in its status colour; tap to open */
.pop.dot button { opacity: 0; pointer-events: none; }
.pop.dot b { width: 10px; height: 10px; margin: -2px 0 0 -2px; background: var(--ok); box-shadow: 0 0 0 2px rgba(0,0,0,.4), 0 0 10px rgba(0,0,0,.4); pointer-events: auto; cursor: pointer; }
.pop.dot.warn b { background: var(--warn); } .pop.dot.alert b { background: var(--alert); } .pop.dot.off b { background: var(--ink-3); }
.pop.dot.mini b { background: var(--ink-2); }

/* place-name labels from the model (off by default) */
.labels { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.labels .tag { position: absolute; left: 0; top: 0; display: grid; justify-items: center; }
.labels .tag span { font: 500 11.5px/1 var(--body); color: var(--ink); white-space: nowrap; background: var(--glass); border: 1px solid var(--line); padding: 5px 8px; border-radius: 999px; }
.labels .tag i { width: 1px; height: 12px; background: rgba(236,235,228,.5); }
.labels .tag b { width: 4px; height: 4px; border-radius: 50%; background: var(--ink); }
.labels.off .tag { opacity: 0 !important; }

/* ---------- readings panel ---------- */
.now { position: fixed; z-index: 8; left: var(--safe-l); bottom: var(--safe-b); width: 290px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 16px; backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  max-height: calc(100vh - 200px); display: flex; flex-direction: column; }
.now-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; background: none; border: 0; text-align: left; cursor: default; }
.now-title { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); flex: 1; }
.now-sum { font-size: 12px; color: var(--ink-2); display: none; }
.chev { display: none; color: var(--ink-2); transition: transform .25s; }
.now-list { list-style: none; margin: 0; padding: 0 6px 4px; overflow: auto; }
.now-list li button { width: 100%; display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: center; padding: 8px; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; }
.now-list li button:hover, .now-list li button[aria-pressed="true"] { background: rgba(236,235,228,.07); }
.now-list .d { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.now-list .warn .d { background: var(--warn); } .now-list .alert .d { background: var(--alert); } .now-list .off .d { background: var(--ink-3); }
.now-list .nm { display: grid; }
.now-list .nm b { font-weight: 500; font-size: 13.5px; }
.now-list .nm small { font-size: 11.5px; color: var(--ink-2); }
.now-list .val { font-family: var(--display); font-size: 22px; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.now-list .val small { font-family: var(--body); font-size: 11.5px; color: var(--ink-2); margin-left: 2px; }
.now-list .val.txt { font-family: var(--body); font-size: 13px; font-weight: 600; }
.now-foot { margin: 0; padding: 6px 14px 12px; font-size: 11.5px; color: var(--ink-3); border-top: 1px solid var(--line); }
.badge { display: inline-block; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--warn); border: 1px solid currentColor; padding: 1px 6px; border-radius: 999px; margin-right: 6px; }

/* ---------- menu ---------- */
.menu { position: fixed; z-index: 20; top: calc(var(--safe-t) + 54px); right: var(--safe-r); width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - var(--safe-t) - 70px); overflow: auto; display: grid; gap: 14px; padding: 16px;
  background: var(--glass-2); border: 1px solid var(--line); border-radius: 16px; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 18px 60px rgba(0,0,0,.4); }
.menu-head { display: flex; justify-content: space-between; align-items: center; }
.menu h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 26px; }
.x { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.x:hover { color: var(--ink); }
.k { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.field { display: grid; gap: 7px; }
.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1 1 auto; background: transparent; border: 0; border-radius: 9px; padding: 9px 10px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-2); min-height: 38px; }
.seg button:hover { color: var(--ink); background: rgba(236,235,228,.06); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.tog { display: inline-flex; align-items: center; gap: 7px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.tog::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--ink-3); }
.tog[aria-pressed="true"] { color: var(--ink); }
.tog[aria-pressed="true"]::before { background: var(--forest); border-color: var(--forest); }
.switch { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; cursor: pointer; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: rgba(236,235,228,.18); position: relative; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transition: transform .2s; }
.switch input:checked + .track { background: var(--forest); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch b { display: block; font-weight: 600; font-size: 13.5px; }
.switch small { display: block; font-size: 12px; color: var(--ink-2); }
.setup p { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
#setup-extra { margin-top: 10px; }
.signout button { width: 100%; background: none; border: 1px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.signout button:hover { color: var(--ink); border-color: rgba(236,235,228,.35); }

/* ---------- phones ---------- */
@media (max-width: 720px) {
  .brand h1 { font-size: 1.75rem; }
  .shade { background: linear-gradient(to bottom, rgba(8,10,8,0.7), rgba(8,10,8,0) 30%), linear-gradient(to top, rgba(8,10,8,0.5), rgba(8,10,8,0) 30%); }
  .menu-btn span { display: none; }
  .menu-btn { padding: 0 12px; }
  .top-right { align-items: flex-start; }
  .menu-btn { min-width: 44px; justify-content: center; }
  .wx { padding: 0 10px; gap: 8px; min-height: 44px; }
  .wx-t { font-size: 24px; }
  #wx-hum, .wx-gust { display: none; }
  body.public .wx { display: none; }   /* the weather pop-up carries it; the title and Owner Access need the room */
  .signin-top { min-height: 44px; padding: 0 12px; }
  .alerts { top: auto; bottom: calc(var(--safe-b) + 64px); width: calc(100vw - 32px); }
  .now { left: 0; right: 0; bottom: 0; width: auto; border-radius: 18px 18px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px);
    max-height: 62vh; }
  .now-head { cursor: pointer; padding: 14px 16px; min-height: 52px; }
  .now-sum { display: block; }
  .chev { display: block; }
  .now:not(.open) .now-list, .now:not(.open) .now-foot { display: none; }
  .now.open .chev { transform: rotate(180deg); }
  .menu { top: auto; bottom: 0; right: 0; left: 0; width: auto; border-radius: 18px 18px 0 0; max-height: 82vh; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .pop button { padding: 5px 9px 6px; min-width: 0; }
  .pop .v { font-size: 20px; }
  .pop .l { font-size: 9.5px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- arriving from the home page's sign-in (arrive.js, status.js) ---------- */
#arrive { position: fixed; inset: 0; z-index: 40; background: #000; pointer-events: none; transition: opacity 1.7s cubic-bezier(.45,0,.25,1); }
#arrive img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
#arrive.gone { opacity: 0; }
/* the photo wipes away outward from the cabin (status.js sets --cx/--cy), with a soft edge */
#arrive.reveal { --r: -12%; -webkit-mask-image: radial-gradient(circle at var(--cx, 50%) var(--cy, 50%), transparent var(--r), #000 calc(var(--r) + 22%));
  mask-image: radial-gradient(circle at var(--cx, 50%) var(--cy, 50%), transparent var(--r), #000 calc(var(--r) + 22%));
  animation: arrive-wipe 1.1s cubic-bezier(.55,0,.2,1) forwards; transition: none; }
#arrive.reveal .arrive-note { animation: none; opacity: 0; transition: opacity .25s; }
@keyframes arrive-wipe { to { --r: 130%; } }
.arrive-note { position: absolute; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0; padding: 7px 14px; border-radius: 999px;
  background: rgba(8,10,8,.62); color: #f3f1ea; font: 500 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; white-space: nowrap;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; animation: arrive-note .6s 1.2s ease forwards, arrive-pulse 2.4s 1.8s ease-in-out infinite; }
#arrive.gone .arrive-note { animation: none; opacity: 0; transition: opacity .3s; }
@keyframes arrive-note { to { opacity: 1; } }
@keyframes arrive-pulse { 50% { opacity: .6; } }
html.arriving #loading { display: none; }
.top, .now, .alerts, .pops, .shade { transition: opacity .9s ease; }
html.arriving .top, html.arriving .now, html.arriving .alerts, html.arriving .pops, html.arriving .shade { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { #arrive { transition-duration: .3s; } .arrive-note { animation: none; opacity: 1; } }
.add-user { display: block; margin-top: 10px; text-align: center; font-size: 12.5px; color: var(--ink-2); }
.add-user:hover { color: var(--ink); }

/* ---------- public visitors ---------- */
.signin-top { font-weight: 600; }
.now-foot a { color: var(--ink); }

/* ---------- camera pins and viewer ---------- */
.pop.mini button { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--ink); }
.pop.mini button svg { color: var(--ink-2); }
.cam { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: max(16px, var(--safe-t)) 16px max(16px, var(--safe-b)); background: rgba(6,8,6,.62); }
.cam[hidden] { display: none; }
.cam-box { width: min(980px, 100%); max-height: 100%; display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: rgba(14,16,13,.94); border: 1px solid var(--line); box-shadow: 0 24px 80px rgba(0,0,0,.5); }
.cam-head { display: flex; align-items: baseline; gap: 12px; }
.cam-head h2 { margin: 0; font: 400 26px/1 var(--display); }
.cam-head span { flex: 1; font-size: 12.5px; color: var(--ink-2); }
#cam-img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; border-radius: 10px; transition: opacity .3s; }
#cam-img.loading { opacity: .35; }
.cam-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.cam-live { font-size: 13px; color: var(--ink-2); }
.cam-live:hover { color: var(--ink); }
.cam-row .d { background: var(--ink-3); }

.login-box { width: min(380px, 100%); gap: 12px; padding: 18px 18px 20px; }
.login-box label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.login-box input { font: inherit; font-size: 16px; color: var(--ink); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16); border-radius: 10px; padding: 11px 12px; min-height: 46px; width: 100%; }
.login-box input:focus { outline: 2px solid rgba(255,255,255,.6); outline-offset: 1px; border-color: transparent; }
.login-go { margin-top: 4px; font: 600 15px/1 inherit; color: #0b0d0a; background: #f3f1ea; border: 0; border-radius: 10px; padding: 14px; min-height: 48px; cursor: pointer; }
.login-go:hover { background: #fff; }
.login-go:disabled { opacity: .7; cursor: progress; }
.login-err { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; color: #f2a48a; border: 1px solid currentColor; }
.login-box.shake { animation: login-shake .4s; }
@keyframes login-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* Netlify's free-plan "Powered by Netlify" badge, injected into every page: not on this site */
#nl-badge-frame,#nl-hud-frame{display:none!important}
