/* ============================================================
   The Office of 2035 — The Listening Cave
   Warm, dark, quiet, organic. Firelight in a cave, not sci-fi.
   ============================================================ */

:root {
  --bg: #14100c;            /* cave dark, warm brown-black */
  --bg-raise: #1e1712;      /* raised surfaces (cards)     */
  --ink: #f3ead9;           /* warm off-white              */
  --ink-dim: #b9a98f;       /* muted text                  */
  --ember: #d98e4a;         /* fire-amber accent           */
  --ember-bright: #f0b476;  /* ember highlight             */
  --line: rgba(243, 234, 217, 0.14);
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.33, 1, 0.68, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

[hidden] { display: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: rgba(217, 142, 74, 0.35); }

/* ============================================================
   Landing — one dark, quiet screen, lit from below like embers
   ============================================================ */

#landing {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
  background:
    radial-gradient(120% 55% at 50% 118%, rgba(217, 142, 74, 0.20), transparent 62%),
    radial-gradient(90% 45% at 50% 112%, rgba(240, 180, 118, 0.10), transparent 55%),
    radial-gradient(140% 100% at 50% 0%, #191410 0%, var(--bg) 60%);
  overflow: hidden;
}

/* faint grain so the dark reads as material, not void */
#landing::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.landing-inner {
  position: relative;
  max-width: 46rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#landing h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.5rem, 7.5vw, 4.75rem);
  line-height: 1.08;
  letter-spacing: 0.01em;
  text-wrap: balance;
  animation: rise 0.9s var(--ease) 0.15s backwards;
}

#landing .subtitle {
  margin: 1.1rem 0 0;
  font-family: var(--sans);
  font-size: clamp(0.72rem, 1.6vw, 0.85rem);
  font-weight: 500;
  letter-spacing: 0.42em;
  text-indent: 0.42em; /* optically recenter tracked caps */
  text-transform: uppercase;
  color: var(--ember);
  animation: rise 0.9s var(--ease) 0.3s backwards;
}

.ember-rule {
  width: 4.5rem;
  height: 1px;
  margin: 2.2rem 0;
  background: linear-gradient(90deg, transparent, var(--ember), transparent);
  animation: rise 0.9s var(--ease) 0.45s backwards;
}

#landing .thesis {
  margin: 0;
  max-width: 36rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  line-height: 1.65;
  color: var(--ink-dim);
  text-wrap: pretty;
  animation: rise 0.9s var(--ease) 0.6s backwards;
}

#enter {
  margin-top: 3rem;
  padding: 0.85rem 3.2rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
  color: var(--ember-bright);
  border: 1px solid rgba(217, 142, 74, 0.45);
  border-radius: 999px;
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease),
              box-shadow 0.35s var(--ease), color 0.35s var(--ease);
  animation: rise 0.9s var(--ease) 0.8s backwards;
}

#enter:hover {
  background: rgba(217, 142, 74, 0.12);
  border-color: var(--ember);
  color: var(--ink);
  box-shadow: 0 0 32px rgba(217, 142, 74, 0.22);
}

/* language toggle — quiet, corner */
.lang {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 0.4rem 0.6rem;
  transition: color 0.35s var(--ease);
}

.lang:hover { color: var(--ember-bright); }

#landing > .lang {
  position: absolute;
  top: max(1.1rem, env(safe-area-inset-top));
  right: max(1.2rem, env(safe-area-inset-right));
  z-index: 2;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(1.1rem); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Experience — viewer, cards, HUD, menu
   ============================================================ */

#experience {
  position: fixed;
  inset: 0;
}

#viewer {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

/* Pannellum inherits the cave mood */
#viewer .pnlm-load-box {
  background: var(--bg-raise);
  color: var(--ink-dim);
  font-family: var(--sans);
  border-radius: 10px;
}
#viewer .pnlm-lbar { border-color: var(--ink-dim); }
#viewer .pnlm-lbar-fill { background: var(--ember); }
#viewer .pnlm-loading { background: var(--ember); }

/* ------------------------------------------------------------
   Cards — narration + hotspot. Bottom-centered above the HUD,
   34rem max on desktop, full-width bottom sheet on mobile.
   Kept in the layout when [hidden] so 0.35s fade/rise works.
   ------------------------------------------------------------ */

.card {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4.4rem;
  z-index: 20;
  margin-inline: auto;
  width: calc(100% - 2rem);
  max-width: 34rem;
  padding: 1.5rem 1.75rem 1.35rem;
  background: rgba(30, 23, 18, 0.92);
  border: 1px solid var(--line);
  border-top-color: rgba(217, 142, 74, 0.35);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease),
              visibility 0s linear 0s;
}

.card[hidden] {
  display: block;             /* stay rendered so the fade can play */
  opacity: 0;
  transform: translateY(0.9rem);
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease),
              visibility 0s linear 0.35s;
}

.card h2,
.card h3 {
  margin: 0 0 0.55rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.45rem;
  line-height: 1.2;
  color: var(--ink);
}

.card h3 { font-size: 1.25rem; }

.card p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink-dim);
}

.card button {
  display: inline-block;
  margin-top: 1.1rem;
  padding: 0.45rem 1.3rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  text-transform: uppercase;
  color: var(--ember-bright);
  border: 1px solid rgba(217, 142, 74, 0.4);
  border-radius: 999px;
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease);
}

.card button:hover {
  background: rgba(217, 142, 74, 0.12);
  border-color: var(--ember);
}

/* ------------------------------------------------------------
   HUD — one slim, semi-transparent bar along the bottom.
   Pannellum's own controls sit top-left; no overlap.
   ------------------------------------------------------------ */

#hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.9rem;
  padding-bottom: max(0.4rem, env(safe-area-inset-bottom));
  background: linear-gradient(rgba(20, 16, 12, 0.55), rgba(20, 16, 12, 0.85));
  border-top: 1px solid rgba(243, 234, 217, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#hud button {
  padding: 0.45rem 0.85rem;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border-radius: 6px;
  transition: color 0.35s var(--ease), background-color 0.35s var(--ease);
}

#hud button:hover {
  color: var(--ember-bright);
  background: rgba(217, 142, 74, 0.08);
}

#next-scene { color: var(--ember); }

#scene-label {
  flex: 1;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink-dim);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ------------------------------------------------------------
   Menu — free-roam overlay, a quiet index of rooms
   ------------------------------------------------------------ */

#menu {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(20, 16, 12, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#menu[hidden] { display: none; }

#menu-outro {
  margin: 0 0 1.4rem;
  padding: 0 2rem;
  max-width: 34rem;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.65;
  color: #b9a98f;
}

#menu-list {
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: center;
}

#menu-list li { margin: 0.35rem 0; }

#menu-list li :is(button, a) {
  display: inline-block;
  padding: 0.5rem 1.4rem;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 4vw, 1.8rem);
  line-height: 1.3;
  color: var(--ink-dim);
  text-decoration: none;
  transition: color 0.35s var(--ease), letter-spacing 0.35s var(--ease);
}

#menu-list li :is(button, a):hover {
  color: var(--ember-bright);
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------------
   Hotspots — slow-breathing embers in the dark
   ------------------------------------------------------------ */

.hotspot-ember {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 38%,
              #ffe3b8 0%, var(--ember-bright) 30%, var(--ember) 55%,
              rgba(217, 142, 74, 0) 78%);
  box-shadow: 0 0 12px 3px rgba(217, 142, 74, 0.55);
  cursor: pointer;
  animation: pulse 3s ease-in-out infinite;
}

.hotspot-ember:hover {
  box-shadow: 0 0 20px 7px rgba(217, 142, 74, 0.75);
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; box-shadow: 0 0 10px 2px rgba(217, 142, 74, 0.4); }
  50%      { opacity: 1;   box-shadow: 0 0 18px 6px rgba(217, 142, 74, 0.65); }
}

/* ============================================================
   Reduced motion & small screens
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .hotspot-ember { opacity: 0.9; }
}

@media (max-width: 640px) {
  .card {
    bottom: 3.6rem;
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-right: none;
    padding: 1.25rem 1.25rem 1.1rem;
  }

  #hud { gap: 0; padding-inline: 0.4rem; }
  #hud button { padding: 0.45rem 0.55rem; letter-spacing: 0.1em; }
  #scene-label { font-size: 0.8rem; }
  #enter { margin-top: 2.4rem; }
}
