/* Vivestia 3D — shared styles for tour.html, viewer.html and index.html */
:root {
  --accent: #c8a46a;            /* overridden per tour by tour.json → brand.accent */
  --accent-ink: #1a1408;
  --bg: #0b0b0d;
  --panel: rgba(16, 16, 20, 0.62);
  --panel-solid: #141418;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4f1ec;
  --muted: rgba(244, 241, 236, 0.62);
  --radius: 14px;
  --gap: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); }
body { overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

/* ---------- stage ---------- */
#stage { position: fixed; inset: 0; }
#stage iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
#fade {
  position: absolute; inset: 0; background: var(--bg) center/cover no-repeat;
  opacity: 0; pointer-events: none; transition: opacity .45s ease;
}
#fade.on { opacity: 1; pointer-events: auto; }

/* ---------- glass building blocks ---------- */
.glass {
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); display: grid; place-items: center; cursor: pointer;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: background .2s, border-color .2s;
}
.icon-btn:hover { background: rgba(40, 40, 46, .8); border-color: rgba(255,255,255,.25); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .txt { font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.icon-btn[aria-pressed="true"] { border-color: var(--accent); }

.cta {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: 999px; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  transition: transform .15s, filter .2s;
}
.cta:hover { filter: brightness(1.08); transform: translateY(-1px); }
.cta.secondary { background: var(--panel); color: var(--text); border: 1px solid var(--line); box-shadow: none;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }

/* ---------- header ---------- */
#topbar {
  position: fixed; top: max(14px, env(safe-area-inset-top)); left: 16px; right: 16px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--gap);
  pointer-events: none; z-index: 5;
}
#topbar > * { pointer-events: auto; }
#brand { display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; min-width: 0; }
#brand img { height: 30px; width: auto; display: block; border-radius: 8px; }
#brand .mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--accent); color: var(--accent-ink); font-family: var(--serif); font-size: 20px; font-weight: 700;
}
#brand .titles { min-width: 0; }
#brand h1 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 17px; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---------- scenes / stops rail ---------- */
#rail {
  position: fixed; left: 16px; top: 84px; bottom: 96px; width: 212px; z-index: 4;
  display: flex; flex-direction: column; padding: 10px; gap: 6px; overflow: hidden;
  transition: transform .3s ease, opacity .3s ease;
}
#rail.collapsed { transform: translateX(calc(-100% - 24px)); opacity: 0; pointer-events: none; }
#rail .rail-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 6px; }
#rail .rail-head span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
#rail .list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin; padding-right: 2px; }
.item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; text-align: left;
  border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer;
}
.item:hover { background: rgba(255,255,255,.06); }
.item.active { border-color: var(--accent); background: rgba(255,255,255,.06); }
.item .thumb {
  width: 64px; height: 44px; border-radius: 7px; flex: none; background: #222 center/cover no-repeat;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--muted);
}
.item .label { font-size: 13px; line-height: 1.25; min-width: 0; }
.item .label small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.stop { padding-left: 18px; }
.stop .thumb { width: 26px; height: 26px; border-radius: 999px; background: rgba(255,255,255,.08); font-size: 11px; }
.stop.active .thumb { background: var(--accent); color: var(--accent-ink); }

#railToggle { position: fixed; left: 16px; top: 84px; z-index: 4; }

/* ---------- footer (credits) ---------- */
#credits {
  position: fixed; right: 16px; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 64px); z-index: 3;
  font-size: 10.5px; color: var(--muted); max-width: 46ch; text-align: right; pointer-events: auto;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
#credits a { color: var(--muted); }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 20;
  padding: 10px 16px; font-size: 13px; opacity: 0; transition: opacity .25s; pointer-events: none;
}
#toast.on { opacity: 1; }

/* ---------- embed mode ---------- */
body.embed #credits { display: none; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  #topbar { left: 10px; right: 10px; flex-wrap: wrap; justify-content: flex-end; row-gap: 8px; }
  #topbar #brand { flex: 1 1 100%; }
  #brand { padding: 6px 10px 6px 6px; }
  #brand h1 { font-size: 15px; }
  #actions .cta .cta-label-long { display: none; }
  #actions .hide-sm { display: none; }
  #rail {
    left: 10px; right: 10px; width: auto; top: auto; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 64px);
    max-height: 38vh;
  }
  #rail.collapsed { transform: translateY(calc(100% + 90px)); }
  #railToggle { left: 10px; top: calc(max(14px, env(safe-area-inset-top)) + 64px); }
  #toast { top: 130px; }
  #credits { display: none; }
}

/* ---------- drop viewer ---------- */
.page { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; overflow: auto; }
.drop {
  width: min(520px, 100%); padding: 36px 28px; text-align: center; border: 1.5px dashed rgba(255,255,255,.22);
  border-radius: 18px; background: rgba(255,255,255,.02); transition: border-color .2s, background .2s;
}
.drop.over { border-color: var(--accent); background: rgba(200,164,106,.08); }
.drop h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; margin: 14px 0 8px; }
.drop p { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 20px; }
.drop .formats { margin-top: 18px; font-size: 11px; letter-spacing: .16em; color: var(--muted); }
.urlrow { display: flex; gap: 8px; margin-top: 22px; }
.urlrow input {
  flex: 1; min-width: 0; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255,255,255,.04); color: var(--text); font: inherit; font-size: 14px;
}
.urlrow input:focus { outline: none; border-color: var(--accent); }
.upl { width: 52px; height: 52px; margin: 0 auto; border-radius: 14px; border: 1px solid var(--line); display: grid; place-items: center; }
.upl svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#status { margin-top: 14px; font-size: 13px; color: var(--muted); min-height: 1.2em; }
#status.err { color: #ff9b8a; }

/* ---------- landing ---------- */
body.landing { overflow: auto; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 16px 64px; }
.hero { padding: 36px 0 28px; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 5vw, 48px); margin: 0 0 10px; line-height: 1.1; }
.hero p { color: var(--muted); max-width: 60ch; line-height: 1.55; margin: 0 0 22px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { display: block; text-decoration: none; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-solid); transition: transform .2s, border-color .2s; }
.card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.28); }
.card .img { aspect-ratio: 16 / 10; background: #222 center/cover no-repeat; }
.card .body { padding: 14px 16px 16px; }
.card h3 { margin: 0 0 4px; font-family: var(--serif); font-weight: 600; font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 13px; }
.topnav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topnav .logo { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 18px; font-weight: 600; text-decoration: none; }

/* sound button icon state */
#btnSound[aria-pressed="true"] .off,
#btnSound[aria-pressed="false"] .on { display: none; }
