/* Harbor House — Dino Discovery PREMIUM scene (Phase 3)
   Proto build-6 styles, every selector scoped under #p3dScene so the
   scene and the museum chrome can never leak into each other.
   Calm rules key off the museum's body.hh-calm (HHEx), not a proto class. */
#p3dScene{--ink:#20301f;
  --cream:#fff8ea;
  --paper:#fffdf6;
  --sun:#f2b33d;
  --sun-deep:#d18f1d;
  --leaf:#2e7d4f;
  --navy:#17352a;
  --shadow:0 14px 34px rgba(16,32,18,.35);}
#p3dScene *{box-sizing:border-box}
#p3dScene{font-family:"Avenir Next","Segoe UI",system-ui,-apple-system,sans-serif;color:var(--ink);-webkit-font-smoothing:antialiased}
#p3dScene h1, #p3dScene h2, #p3dScene h3{font-family:"Avenir Next Rounded","Avenir Next","Segoe UI",system-ui,sans-serif;letter-spacing:.01em}
#p3dScene button{font:inherit;cursor:pointer}
#p3dScene :focus-visible{outline:3px solid var(--sun);outline-offset:2px}
#p3dScene .scene{position:relative;overflow:hidden;
  height:min(900px,calc(100svh - 53px));min-height:620px;
  background:#274d33;}
#p3dScene .layer{position:absolute;inset:-4%;will-change:transform;pointer-events:none}
#p3dScene .layer img{width:100%;height:100%;object-fit:cover;display:block}
#p3dScene .layer-far{z-index:1;inset:-11%}
#p3dScene .layer-clearing{z-index:2;inset:auto -4% -4% -4%;height:88%;
  -webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 32%);
          mask-image:linear-gradient(to bottom,transparent 0,#000 32%);}
#p3dScene .layer-clearing img{object-position:50% 100%}
#p3dScene .rays{position:absolute;inset:-10%;z-index:3;pointer-events:none;opacity:.5;
  background:
    linear-gradient(112deg,transparent 22%,rgba(255,214,120,.16) 34%,transparent 46%),
    linear-gradient(104deg,transparent 48%,rgba(255,224,150,.12) 58%,transparent 70%);
  animation:rayDrift 11s ease-in-out infinite alternate;}
@keyframes rayDrift{from{transform:translateX(-1.2%) rotate(-.4deg);opacity:.38}to{transform:translateX(1.2%) rotate(.4deg);opacity:.58}}
#p3dScene #pollen{position:absolute;inset:0;z-index:4;pointer-events:none}
#p3dScene .title-block{position:absolute;z-index:8;top:26px;left:28px;max-width:450px;pointer-events:none;
  color:var(--cream);text-shadow:0 2px 14px rgba(10,26,14,.65),0 1px 3px rgba(10,26,14,.8);}
#p3dScene .kicker{margin:0 0 6px;font-weight:800;letter-spacing:.22em;text-transform:uppercase;
  font-size:.78rem;color:var(--sun);}
#p3dScene .title-block h1{margin:0;font-size:clamp(30px,4.4vw,52px);line-height:1.04;font-weight:800}
#p3dScene .title-block .sub{margin:10px 0 0;font-size:clamp(.92rem,1.4vw,1.05rem);line-height:1.45;font-weight:600;opacity:.95}
#p3dScene .daisy-wrap{position:absolute;z-index:5;right:0.5%;bottom:16%;width:min(54%,680px);
  pointer-events:none;will-change:transform;}
#p3dScene .daisy-frame{position:relative;aspect-ratio:16/9;
  -webkit-mask-image:linear-gradient(to right,transparent 0,#000 12%,#000 96%,transparent 100%),linear-gradient(to bottom,transparent 0,#000 10%,#000 97%,transparent 100%);
  -webkit-mask-composite:source-in;
          mask-image:linear-gradient(to right,transparent 0,#000 12%,#000 96%,transparent 100%),linear-gradient(to bottom,transparent 0,#000 10%,#000 97%,transparent 100%);
          mask-composite:intersect;
  filter:brightness(.985) saturate(1.04);}
#p3dScene .daisy-frame img, #p3dScene .daisy-frame video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;
  opacity:0;transition:opacity .25s ease;}
#p3dScene .daisy-frame .on{opacity:1}
#p3dScene #daisyStill{z-index:1}
#p3dScene #vidIdle{z-index:2}
#p3dScene #vidReact{z-index:3}
#p3dScene .daisy-shadow{position:absolute;left:46%;bottom:-4.5%;width:56%;height:9%;z-index:-1;
  background:radial-gradient(ellipse at center,rgba(24,26,8,.5) 0%,rgba(24,26,8,0) 68%);
  filter:blur(3px);}
#p3dScene .daisy-wrap.celebrating .daisy-frame{animation:daisyHop .62s ease-in-out 4}
@keyframes daisyHop{0%,100%{transform:translateY(0)}30%{transform:translateY(-7px)}55%{transform:translateY(0)}75%{transform:translateY(-4px)}}
#p3dScene .daisy-bubble{position:absolute;z-index:6;left:2%;top:-3%;max-width:min(230px,60%);
  background:#fff;border:3px solid var(--sun);border-radius:16px;padding:.5rem .75rem;
  box-shadow:var(--shadow);opacity:0;visibility:hidden;transform:translateY(5px);
  transition:opacity .3s ease,transform .3s ease,visibility 0s linear .3s;}
#p3dScene .daisy-bubble.show{opacity:1;visibility:visible;transform:none;transition:opacity .3s ease,transform .3s ease}
#p3dScene .daisy-bubble p{margin:0;font-weight:800;font-size:.92rem;line-height:1.3;color:var(--navy)}
#p3dScene .daisy-bubble::after{content:"";position:absolute;right:34px;bottom:-12px;border:6px solid transparent;border-top:9px solid var(--sun);}
#p3dScene .badge-chip{position:absolute;z-index:9;top:20px;right:20px;
  background:linear-gradient(160deg,#f6d67c,#e9b64c);color:#4a3205;
  font-weight:800;font-size:.9rem;padding:9px 14px;border-radius:999px;
  border:2px solid #b8862e;box-shadow:var(--shadow);}
#p3dScene .dig-zone{position:absolute;z-index:6;left:3%;bottom:2.6%;width:min(47%,540px)}
#p3dScene .dig{position:relative;aspect-ratio:3/2;overflow:visible;
  clip-path:polygon(4% 12%,14% 5%,26% 8%,38% 2%,52% 5%,64% 1%,78% 4%,89% 6%,96% 14%,99% 32%,98% 55%,95% 76%,87% 90%,70% 97%,48% 100%,27% 98%,12% 93%,4% 81%,1% 59%,0% 37%,1% 23%);
  filter:drop-shadow(0 16px 22px rgba(20,26,6,.5));
  background:#8a6844;}
#p3dScene .fossil-img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block}
#p3dScene #dirtCanvas{position:absolute;inset:0;touch-action:none;cursor:crosshair}
#p3dScene .dig-shade{position:absolute;inset:0;pointer-events:none;
  box-shadow:inset 0 0 52px rgba(56,32,6,.5),inset 0 -20px 36px rgba(56,32,6,.45),inset 0 30px 34px rgba(56,32,6,.5);}
#p3dScene .dig-glow{position:absolute;inset:0;pointer-events:none;opacity:0;
  background:radial-gradient(ellipse 65% 55% at 50% 46%,rgba(255,216,110,.55) 0%,rgba(255,216,110,0) 70%);
  transition:opacity .8s ease;}
#p3dScene .dig.revealed .dig-glow{opacity:1;animation:glowPulse 2.6s ease-in-out infinite}
@keyframes glowPulse{0%,100%{opacity:.75}50%{opacity:1}}
#p3dScene #fxCanvas{position:absolute;inset:0;pointer-events:none}
#p3dScene .dig-progress{position:absolute;top:12px;left:50%;transform:translateX(-50%);z-index:4;
  display:flex;align-items:center;gap:9px;white-space:nowrap;
  background:rgba(23,32,16,.72);color:var(--cream);border-radius:999px;padding:7px 13px;
  font-size:.8rem;font-weight:800;letter-spacing:.02em;backdrop-filter:blur(3px);}
#p3dScene .dig-progress-bar{width:92px;height:9px;border-radius:99px;background:rgba(255,248,234,.28);overflow:hidden}
#p3dScene .dig-progress-bar span{display:block;height:100%;width:0%;background:linear-gradient(90deg,var(--sun),#ffd873);border-radius:99px;transition:width .25s ease}
#p3dScene .dig-progress-pct{color:var(--sun);min-width:2.4em;text-align:right}
#p3dScene .dig-hint{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);z-index:4;white-space:nowrap;
  background:rgba(255,253,246,.92);color:var(--navy);font-weight:800;font-size:.85rem;
  padding:8px 14px;border-radius:999px;box-shadow:0 6px 16px rgba(20,26,6,.35);
  transition:opacity .5s ease;pointer-events:none;}
#p3dScene .dig-hint.gone{opacity:0}
@keyframes cardIn{from{opacity:0;transform:translateY(10px) scale(.96)}to{opacity:1;transform:none}}
#p3dScene .dig-controls{display:flex;gap:10px;margin-top:14px;flex-wrap:wrap}
#p3dScene .btn{border:none;border-radius:999px;padding:12px 20px;font-weight:800;font-size:.95rem;
  box-shadow:0 8px 18px rgba(20,26,6,.35);transition:transform .12s ease,box-shadow .12s ease;}
#p3dScene .btn:active{transform:translateY(1px)}
#p3dScene .btn-brush{background:var(--cream);color:var(--navy)}
#p3dScene .btn-brush[aria-pressed="true"]{background:var(--sun);color:#3a2a05}
#p3dScene .btn-again{background:transparent;color:var(--cream);border:2px solid rgba(255,248,234,.75);box-shadow:none}
#p3dScene .btn-gold{background:linear-gradient(160deg,#f6d67c,#e9b64c);color:#4a3205;border:2px solid #b8862e}
#p3dScene .btn-ghost{background:transparent;color:var(--navy);border:2px solid rgba(23,53,42,.35);box-shadow:none}
#p3dScene .sr-status{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
@keyframes medalIn{from{transform:scale(.4) rotate(-30deg);opacity:0}to{transform:none;opacity:1}}
body.hh-calm #p3dScene .rays{animation:none;opacity:.22}
body.hh-calm #p3dScene .daisy-wrap.celebrating .daisy-frame{animation:none}
body.hh-calm #p3dScene .dig.revealed .dig-glow{animation:none}
body.hh-calm #p3dScene .discovery-card{animation:none}
@media (prefers-reduced-motion: reduce){
#p3dScene .rays{animation:none}
#p3dScene .daisy-wrap.celebrating .daisy-frame{animation:none}
#p3dScene .dig.revealed .dig-glow{animation:none}
}
@media (max-width:640px){
#p3dScene .scene{height:max(640px,calc(100svh - 51px));min-height:640px}
#p3dScene .title-block{top:14px;left:16px;right:16px;max-width:none}
#p3dScene .title-block h1{font-size:27px}
#p3dScene .title-block .sub{font-size:.86rem;margin-top:6px}
#p3dScene .title-block .sub br:first-of-type{display:none}
#p3dScene .daisy-wrap{width:min(152vw,560px);right:-4%;bottom:35%}
#p3dScene .daisy-bubble{max-width:228px;left:33%;top:-5%}
#p3dScene .daisy-bubble p{font-size:.84rem;line-height:1.32}
#p3dScene .dig-zone{left:4%;right:4%;width:auto;bottom:10px}
#p3dScene .dig-progress{font-size:.74rem;padding:6px 11px}
#p3dScene .dig-progress-bar{width:64px}
#p3dScene .dig-hint{font-size:.8rem;bottom:10px}
#p3dScene .badge-chip{top:12px;right:12px;font-size:.8rem;padding:7px 11px}
#p3dScene .btn{padding:12px 17px;font-size:.9rem}
}
@media (min-width:768px){
#p3dScene .dig-zone{left:4%;bottom:4.5%;width:min(57%,700px)}
#p3dScene .daisy-wrap{width:min(52%,730px);bottom:12.5%;z-index:7}
#p3dScene .dig-progress{font-size:.88rem}
}
@media (min-width:1200px){
#p3dScene .dig-zone{width:min(52%,790px)}
#p3dScene .daisy-wrap{width:min(48%,780px)}
}
@media (min-width:768px) and (max-height:900px){
#p3dScene .dig-zone{width:min(44%,590px);bottom:3%}
#p3dScene .daisy-wrap{width:min(40%,540px);bottom:9%}
#p3dScene .title-block{max-width:400px}
#p3dScene .title-block h1{font-size:38px}
}

/* ── Integration guards: museum rules that would otherwise leak in ──
   components.css .btn{display:inline-flex} overrides the UA [hidden] rule
   (Dig Again showed on a fresh dig) and adds a 48px min-height; kept
   dino.css .daisy-bubble p sets the museum display font on Daisy's bubble. */
#p3dScene .btn{display:inline-block;min-height:0}
#p3dScene .daisy-bubble p{font-family:inherit}
/* last on purpose: equal specificity to the .btn guard above, so the
   hidden state wins whenever the attribute is present */
#p3dScene [hidden]{display:none}

/* Coordinator fix: badge chip must never cover the scene title on phones */
@media (max-width:640px){
  #p3dScene .title-block{max-width:56%}
  #p3dScene .badge-chip{font-size:.72rem;padding:.32rem .6rem;max-width:42%}
}
