/* faboppa study room — chrome, rail, intro, hover label, parchment panels. */

:root {
  --paper: #ece0c8;
  --paper-edge: #b7a888;
  --ink: #2b2317;
  --ink-soft: #6b5d47;
  --ember: #ffb464;
  --room-chrome: #d8cbb0;
}

/* Canvas sits behind everything; fallback covers it until webgl-on. */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.fallback { position: relative; z-index: 2; }
body.webgl-on .fallback { display: none; }
body.webgl-on { overflow: hidden; }

/* ---- Intro ---- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #000;
  pointer-events: none;
}
body.webgl-on .intro { display: flex; }
.intro__mark {
  font-family: 'EB Garamond', serif;
  font-weight: 600;
  font-size: clamp(30px, 5vw, 56px);
  letter-spacing: 0.22em;
  color: var(--paper);
  opacity: 0;
  animation: intro-in 1.4s ease 0.2s forwards;
}
.intro__sub {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: clamp(13px, 1.6vw, 18px);
  color: var(--ember);
  opacity: 0;
  animation: intro-in 1.4s ease 0.7s forwards;
}
@keyframes intro-in { to { opacity: 1; } }
.intro--out { transition: opacity 0.9s ease; opacity: 0; }

/* ---- Chrome ---- */
.chrome {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 4;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  pointer-events: none;
}
body.webgl-on .chrome { display: flex; }
.chrome--top { top: 0; }
.chrome--bottom { bottom: 0; justify-content: space-between; }
.chrome__brand {
  font-family: 'EB Garamond', serif;
  font-weight: 600;
  letter-spacing: 0.18em;
  font-size: 15px;
  color: var(--room-chrome);
  text-decoration: none;
  pointer-events: auto;
}
.chrome__sub {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ember);
  opacity: 0.85;
}
.chrome__sound {
  pointer-events: auto;
  background: none;
  border: 1px solid rgba(216, 203, 176, 0.35);
  border-radius: 2px;
  color: var(--room-chrome);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  padding: 7px 12px;
  cursor: pointer;
}
.chrome__hint {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 13px;
  color: rgba(216, 203, 176, 0.6);
}
@media (max-width: 700px) { .chrome__hint { display: none; } }

/* ---- Rail ---- */
.rail {
  position: fixed;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  display: none;
  flex-direction: column;
  gap: 6px;
}
body.webgl-on .rail { display: flex; }
.rail__item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: rgba(20, 14, 8, 0.55);
  border: 1px solid rgba(216, 203, 176, 0.18);
  border-radius: 2px;
  padding: 9px 14px;
  cursor: pointer;
  color: var(--room-chrome);
  transition: border-color 0.3s, background 0.3s;
}
.rail__item:hover, .rail__item:focus-visible { border-color: var(--ember); outline: none; }
.rail__item--active { border-color: var(--ember); background: rgba(40, 26, 12, 0.75); }
.rail__no { font-family: 'Space Mono', monospace; font-size: 9px; color: var(--ember); }
.rail__label { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: 0.2em; }
@media (max-width: 700px) {
  .rail { left: 10px; gap: 5px; }
  .rail__item { padding: 7px 9px; }
  .rail__label { display: none; }
}

/* ---- Hover label ---- */
.hoverlabel {
  position: fixed;
  z-index: 4;
  transform: translate(-50%, -140%);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--paper);
  background: rgba(20, 14, 8, 0.72);
  border: 1px solid rgba(255, 180, 100, 0.5);
  padding: 6px 10px;
  border-radius: 2px;
  pointer-events: none;
  white-space: nowrap;
}

/* ---- Parchment panels ---- */
.panels {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 5vh 7vw;
  background: rgba(8, 5, 2, 0.25);
}
.panels[hidden] { display: none; }
.panel {
  width: min(430px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  position: relative;
  color: var(--ink);
  background:
    radial-gradient(ellipse 120% 100% at 50% 0%, rgba(255, 250, 235, 0.55), transparent 60%),
    radial-gradient(ellipse 160% 140% at 50% 50%, transparent 62%, rgba(120, 96, 60, 0.28) 100%),
    var(--paper);
  border: 1px solid var(--paper-edge);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  padding: 34px 36px 30px;
  font-family: 'EB Garamond', serif;
  animation: panel-in 0.45s ease both;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.panel__kicker {
  margin: 0 0 14px;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--ink-soft);
}
.panel h2 { margin: 0 0 8px; font-weight: 600; font-size: 30px; letter-spacing: 0.02em; }
.panel p { margin: 0 0 12px; font-size: 16.5px; line-height: 1.55; }
.panel__lede { font-style: italic; color: var(--ink-soft); }
.panel__meta { font-family: 'Space Mono', monospace; font-size: 11px; color: var(--ink-soft); }
.panel__cta {
  display: inline-block;
  margin-top: 6px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--ink-soft);
  padding: 10px 14px;
  border-radius: 2px;
}
.panel__cta:hover, .panel__cta:focus-visible { background: rgba(43, 35, 23, 0.08); outline: none; }
.panel__close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 14px;
  cursor: pointer;
  padding: 6px;
}
.panel__email { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.panel__copy {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: none;
  border: 1px solid var(--ink-soft);
  border-radius: 2px;
  color: var(--ink);
  padding: 4px 8px;
  cursor: pointer;
}
@media (max-width: 700px) {
  .panels { align-items: flex-end; justify-content: center; padding: 0; }
  .panel { width: 100vw; max-height: 72vh; border-left: none; border-right: none; }
}
