/* ============================================================
   The Wildlife Museum — 3D walkthrough interface
   Everything here floats over the WebGL canvas.
   ============================================================ */

:root{
  --bg:#07080a;
  --panel:#15161a;
  --line:rgba(255,255,255,.1);
  --text:#edeae3;
  --muted:#9c9890;
  --dim:#6e6b64;
  --brass:#c9983f;
  --ease:cubic-bezier(.22,.61,.36,1);
  --serif:"Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;
  --sans:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
}

*,*::before,*::after{ box-sizing:border-box; }

html,body{ height:100%; }
body{
  margin:0; overflow:hidden;
  background:var(--bg); color:var(--text);
  font-family:var(--sans);
  -webkit-font-smoothing:antialiased;
  touch-action:none;
}
#scene{ position:fixed; inset:0; width:100%; height:100%; display:block; }
/* Outdoor garden: a soft, warm vignette frames the view like a photograph. */
body[data-theme="trail"]::before{
  content:""; position:fixed; inset:0; z-index:1; pointer-events:none;
  background:radial-gradient(ellipse 85% 75% at 50% 48%, transparent 60%, rgba(28,22,10,.32) 100%);
}
kbd{
  display:inline-block; padding:.12em .45em;
  font:inherit; font-size:.78em; font-weight:600;
  background:#24262b; border:1px solid var(--line);
  border-bottom-width:2px; border-radius:4px; color:#ded9cf;
}
:focus-visible{ outline:2px solid var(--brass); outline-offset:2px; }

/* ── boot ───────────────────────────────────────────────── */
.boot{
  position:fixed; inset:0; z-index:60;
  display:grid; place-items:center;
  background:var(--bg);
  transition:opacity .5s var(--ease);
}
.boot.gone{ opacity:0; pointer-events:none; }
.boot__inner{ text-align:center; padding:2rem; }
.boot__mark{
  display:block; width:46px; height:46px; margin:0 auto 1.6rem;
  border-radius:50%; border:2px solid var(--brass);
  background:radial-gradient(circle,var(--brass) 0 26%,transparent 27%);
  animation:pulse 1.6s var(--ease) infinite;
}
@keyframes pulse{ 50%{ transform:scale(.86); opacity:.6; } }
.boot h1{ font-family:var(--serif); font-weight:400; font-size:clamp(1.7rem,4vw,2.5rem); margin:0 0 .5rem; }
.boot__sub{ margin:0 0 2rem; font-size:.74rem; letter-spacing:.17em; text-transform:uppercase; color:var(--dim); }
.boot__bar{ width:min(300px,70vw); height:2px; margin:0 auto 1rem; background:var(--line); overflow:hidden; }
.boot__bar i{ display:block; height:100%; width:0; background:var(--brass); transition:width 1s var(--ease); }
.boot__status{ margin:0; font-size:.8rem; color:var(--muted); }

/* ── gate ───────────────────────────────────────────────── */
.gate{
  position:fixed; inset:0; z-index:50;
  display:grid; place-items:center;
  padding:1.5rem;
  background:radial-gradient(ellipse at center,rgba(7,8,10,.82),rgba(7,8,10,.97));
  backdrop-filter:blur(6px);
}
.gate[hidden]{ display:none; }
.gate__card{
  width:min(100%,520px); text-align:center;
  padding:2.6rem 2rem;
  background:rgba(21,22,26,.9);
  border:1px solid var(--line); border-radius:16px;
}
.gate__eyebrow{ margin:0 0 .7rem; font-size:.7rem; letter-spacing:.22em; text-transform:uppercase; color:var(--brass); }
.gate__card h2{ font-family:var(--serif); font-weight:400; font-size:clamp(1.8rem,5vw,2.6rem); margin:0 0 .8rem; }
.gate__lede{ margin:0 0 2rem; color:var(--muted); }
.gate__btn{
  padding:.95rem 2.3rem; font:inherit; font-weight:650; font-size:.95rem;
  color:#191304; background:var(--brass);
  border:0; border-radius:999px; cursor:pointer;
  transition:transform .2s var(--ease), background .2s;
}
.gate__btn:hover{ background:#ddac4f; transform:translateY(-2px); }

.keys{
  list-style:none; margin:2.2rem 0 1.4rem; padding:1.6rem 0 0;
  border-top:1px solid var(--line);
  display:grid; gap:.6rem 1.2rem;
  grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
  text-align:left;
}
.keys li{ display:flex; align-items:center; gap:.35rem; font-size:.82rem; color:var(--muted); }
.keys span{ margin-left:.4rem; }
.gate__foot{ margin:0; font-size:.82rem; }
.gate__foot a{ color:var(--brass); text-decoration:none; }
.gate__foot a:hover{ text-decoration:underline; }

/* ── hud ────────────────────────────────────────────────── */
.hud{ position:fixed; inset:0; z-index:20; pointer-events:none; }
.hud[hidden]{ display:none; }

/* Walls are light and coloured now, so the HUD needs its own backing
   rather than relying on a dark room behind it. */
.hud__hall{
  position:absolute; top:1.3rem; left:1.5rem;
  padding:.45rem .9rem .5rem;
  background:rgba(12,13,15,.6); backdrop-filter:blur(7px);
  border:1px solid rgba(255,255,255,.12); border-radius:10px;
}
.hud__hallName{
  display:block; font-family:var(--serif); font-size:1.3rem; letter-spacing:.01em;
}
.hud__hallSub{
  display:block; font-size:.72rem; letter-spacing:.12em;
  text-transform:uppercase; color:var(--muted);
}

.reticle{
  position:absolute; top:50%; left:50%; translate:-50% -50%;
  width:26px; height:26px; display:grid; place-items:center;
}
.reticle span{
  width:6px; height:6px; border-radius:50%;
  background:rgba(255,255,255,.9);
  box-shadow:0 0 0 1.5px rgba(0,0,0,.45);   /* stays visible on a pale wall */
  transition:all .18s var(--ease);
}
.reticle.on span{
  width:16px; height:16px; background:transparent;
  border:2px solid var(--brass);
  box-shadow:0 0 0 1.5px rgba(0,0,0,.4), 0 0 12px rgba(201,152,63,.7);
}

.prompt{
  position:absolute; left:50%; top:calc(50% + 34px); translate:-50% 0;
  padding:.55rem 1rem; text-align:center;
  background:rgba(12,13,15,.82); backdrop-filter:blur(7px);
  border:1px solid var(--line); border-left:2px solid var(--brass);
  border-radius:8px; white-space:nowrap;
}
.prompt[hidden]{ display:none; }
.prompt strong{ display:block; font-family:var(--serif); font-weight:400; font-size:1.02rem; }
.prompt em{ display:block; font-size:.76rem; color:var(--muted); }
.prompt__key{ display:block; margin-top:.35rem; font-size:.7rem; letter-spacing:.1em; text-transform:uppercase; color:var(--dim); }

.hud__corner{
  position:absolute; top:1.3rem; right:1.5rem;
  display:flex; gap:.5rem; pointer-events:auto;
}
.hud__btn{
  padding:.45rem .95rem; font:inherit; font-size:.78rem;
  letter-spacing:.09em; text-transform:uppercase; text-decoration:none;
  color:var(--muted); background:rgba(14,15,18,.8);
  border:1px solid var(--line); border-radius:999px;
  cursor:pointer; backdrop-filter:blur(6px);
  transition:all .2s var(--ease);
}
.hud__btn:hover{ color:#191304; background:var(--brass); border-color:var(--brass); }

.draghint{
  position:absolute; left:50%; bottom:1.2rem; translate:-50% 0;
  margin:0; padding:.5rem 1rem; max-width:calc(100% - 2rem);
  font-size:.76rem; color:var(--muted); text-align:center;
  background:rgba(12,13,15,.82); backdrop-filter:blur(6px);
  border:1px solid var(--line); border-radius:999px;
}
.draghint[hidden]{ display:none; }
.draghint strong{ color:var(--brass); font-weight:600; }
.draghint kbd{ margin:0 .15em; }
/* The "mouse is yours" notice sits above the drag hint so the two can
   never land on top of each other. */
.draghint--free{ bottom:3.6rem; border-color:rgba(201,152,63,.5); }

.hud__fps{
  position:absolute; bottom:1rem; right:1.5rem;
  font-size:.68rem; letter-spacing:.1em; color:var(--dim);
  font-variant-numeric:tabular-nums;
}

/* ── touch ──────────────────────────────────────────────── */
.touch{ position:fixed; inset:0; z-index:25; pointer-events:none; }
.touch[hidden]{ display:none; }
.stick{
  position:absolute; left:1.4rem; bottom:1.8rem;
  width:112px; height:112px; border-radius:50%;
  background:rgba(14,15,18,.45); border:1px solid var(--line);
  display:grid; place-items:center; pointer-events:auto;
  backdrop-filter:blur(4px);
}
.stick i{
  width:46px; height:46px; border-radius:50%;
  background:rgba(201,152,63,.55); border:1px solid rgba(255,255,255,.25);
  transition:transform .06s linear;
}
.touch__inspect{
  position:absolute; right:1.4rem; bottom:2.6rem;
  padding:1rem 1.4rem; font:inherit; font-size:.82rem; font-weight:600;
  letter-spacing:.06em; color:#191304; background:var(--brass);
  border:0; border-radius:999px; pointer-events:auto;
}

/* ── hall jump ──────────────────────────────────────────── */
.jump{
  position:fixed; inset:0; z-index:55;
  display:grid; place-items:center; padding:1.5rem;
  background:rgba(7,8,10,.93); backdrop-filter:blur(10px);
}
.jump[hidden]{ display:none; }
.jump__card{ width:min(100%,540px); }
.jump__card h3{
  font-family:var(--serif); font-weight:400; font-size:1.7rem;
  margin:0 0 1.3rem; text-align:center;
}
.jump__list{ display:grid; gap:.5rem; }
.jump__row{
  display:grid; grid-template-columns:1fr auto; gap:.1rem 1rem;
  align-items:center; text-align:left;
  padding:.85rem 1.1rem; font:inherit;
  color:var(--text); background:var(--panel);
  border:1px solid var(--line); border-radius:10px; cursor:pointer;
  transition:all .2s var(--ease);
}
.jump__row:hover{ border-color:var(--brass); transform:translateX(3px); }
.jump__row b{ font-family:var(--serif); font-weight:400; font-size:1.1rem; }
.jump__row span{ grid-column:1; font-size:.76rem; color:var(--muted); letter-spacing:.06em; text-transform:uppercase; }
.jump__row em{ grid-column:2; grid-row:1/3; font-style:normal; font-size:1.3rem; color:var(--brass); font-family:var(--serif); }
.jump__close{
  display:block; width:100%; margin-top:1.2rem; padding:.8rem;
  font:inherit; font-size:.85rem; color:var(--muted);
  background:transparent; border:1px solid var(--line);
  border-radius:999px; cursor:pointer;
}
.jump__close:hover{ color:var(--text); border-color:var(--brass); }

/* ── close-up view ──────────────────────────────────────── */
.view{
  position:fixed; inset:0; z-index:70;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  padding:clamp(.75rem,2.5vw,2.2rem);
  background:rgba(5,6,7,.97);
  animation:fade .2s var(--ease);
}
.view[hidden]{ display:none; }
@keyframes fade{ from{ opacity:0; } }

.view__fig{
  margin:0; display:flex; flex-direction:column; gap:1rem;
  width:100%; max-width:1150px; min-height:0; max-height:100%;
}
.view__stage{
  flex:1 1 auto; min-height:0; overflow:hidden;
  display:flex; align-items:center; justify-content:center;
}
.view__stage img{
  max-width:100%; max-height:100%; width:auto; height:auto;
  object-fit:contain; border-radius:5px;
  box-shadow:0 30px 80px -30px rgba(0,0,0,.95);
}

.plaque{
  flex:none; width:100%; max-width:72ch; margin:0 auto;
  padding:1.05rem 1.25rem;
  background:var(--panel); border:1px solid var(--line);
  border-left:3px solid var(--brass); border-radius:8px;
}
.plaque__top{ display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; margin-bottom:.55rem; }
.plaque h3{ margin:0; font-family:var(--serif); font-weight:400; font-size:1.45rem; line-height:1.2; }
.plaque .sci{ margin:.1rem 0 0; font-style:italic; font-size:.88rem; color:var(--muted); }
.plaque .status{
  flex:none; padding:.26rem .66rem; white-space:nowrap;
  font-size:.65rem; font-weight:700; letter-spacing:.09em; text-transform:uppercase;
  border-radius:4px; border:1px solid var(--line); color:var(--muted);
}
.plaque .status[data-risk="high"]{ background:rgba(126,29,29,.5); color:#ffd9d9; border-color:rgba(255,120,120,.35); }
.plaque .status[data-risk="mid"] { background:rgba(124,80,16,.5);  color:#ffe6bd; border-color:rgba(255,190,90,.3); }
.plaque .status[data-risk="low"] { background:rgba(34,54,32,.5);   color:#d6ead2; border-color:rgba(140,200,130,.25); }
.plaque__note{ margin:0 0 .75rem; font-size:.94rem; color:#cbc7bf; line-height:1.6; }
.plaque__meta{
  display:flex; justify-content:space-between; gap:1rem; margin:0;
  font-size:.7rem; letter-spacing:.13em; text-transform:uppercase; color:var(--dim);
}

.view__close,.view__nav{
  position:absolute; z-index:2; display:grid; place-items:center;
  color:var(--text); background:rgba(22,24,27,.85);
  border:1px solid var(--line); border-radius:50%;
  cursor:pointer; font-family:var(--sans);
  transition:all .2s var(--ease);
}
.view__close:hover,.view__nav:hover{ background:var(--brass); color:#191304; border-color:var(--brass); }
.view__close{ top:.5rem; right:1rem; width:42px; height:42px; font-size:1.6rem; line-height:1; }
.view__nav{ top:50%; translate:0 -50%; width:46px; height:46px; font-size:1.9rem; line-height:1; padding-bottom:4px; }
.view__nav--prev{ left:1rem; }
.view__nav--next{ right:1rem; }

/* On a touch device the inspect key hint is meaningless — there is a button. */
@media (hover:none){
  .prompt__key{ display:none; }
  .prompt{ pointer-events:auto; cursor:pointer; }   /* tap the name tag to open */
}

@media (max-width:700px){
  /* Hall label top-left, buttons top-right, and the label is told exactly
     how much room is left so the two can never overlap. */
  .hud__hall{
    top:.8rem; left:.8rem;
    max-width:calc(100% - 1.6rem - 9.6rem);
    padding:.35rem .7rem .4rem;
  }
  .hud__hallName{ font-size:1rem; }
  .hud__hallSub{ font-size:.62rem; letter-spacing:.08em; }
  .hud__hallName,.hud__hallSub{
    overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  }
  .hud__corner{ top:.8rem; right:.8rem; gap:.35rem; }
  .hud__btn{ padding:.42rem .62rem; font-size:.64rem; letter-spacing:.06em; }
  .hud__fps{ display:none; }
  .view__nav{ top:auto; bottom:1rem; translate:none; }
  .plaque h3{ font-size:1.15rem; }
  .plaque__note{ font-size:.86rem; }
  .keys{ grid-template-columns:1fr; }
}

/* Very narrow phones: no room for two buttons beside the label, so the
   buttons drop to their own row underneath it. */
@media (max-width:340px){
  .hud__hall{ max-width:calc(100% - 1.6rem); }
  .hud__corner{ top:4rem; right:auto; left:.8rem; }
}
