/*
 * Konar Sandal North - interactive 3D reconstruction
 * © 2026 The Game Intelligence. All rights reserved.
 * https://thegameintelligence.com
 * Unauthorised copying, modification or distribution of this code, in whole or in part, is prohibited.
 */
/* Konar Sandal North - styles */
*,*::before,*::after{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0;font:14px system-ui,-apple-system,'Segoe UI',sans-serif}

:root{--bg:#d8c6a6;--ink:#4a2f17;--glow:rgba(255,240,215,.75);color-scheme:light}
html,body{height:100%;overscroll-behavior:none}
body{background:var(--bg);overflow:hidden;margin:0;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;-webkit-text-size-adjust:100%}
#stage{position:fixed;top:0;left:0;right:0;bottom:0}
#stage canvas{display:block;width:100%;height:100%;touch-action:none;outline:none}
.ctrl{position:fixed;right:calc(16px + env(safe-area-inset-right,0px));bottom:calc(16px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:8px}
.ctrl button{width:46px;height:46px;border-radius:50%;border:1px solid rgba(74,47,23,.35);background:rgba(246,236,218,.82);
  -webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);color:var(--ink);display:flex;align-items:center;justify-content:center;
  cursor:pointer;padding:0;box-shadow:0 2px 10px rgba(60,35,10,.25);touch-action:manipulation}
.ctrl button:active,.levels button:active{transform:scale(.94)}
.levels{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(16px + env(safe-area-inset-bottom,0px));display:flex;gap:8px;
  padding:6px;border-radius:30px;background:rgba(246,236,218,.55);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}
.levels button{width:44px;height:44px;border-radius:50%;border:1px solid rgba(74,47,23,.35);background:rgba(246,236,218,.9);color:var(--ink);
  font:700 18px/1 "Cinzel Decorative","Trajan Pro","Times New Roman",serif;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;touch-action:manipulation}
.levels button[aria-pressed="true"]{background:var(--ink);color:#f6ecda;border-color:var(--ink)}
.levels svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round}
.levels button:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
@media (max-width:560px){.levels{left:16px;transform:none}}
.levels[hidden]{display:none}
#sound .mute{display:none}#sound[aria-pressed="false"] .mute{display:inline}#sound[aria-pressed="false"] .wave{display:none}
.loader{position:fixed;top:0;left:0;right:0;bottom:0;z-index:30;display:flex;align-items:center;justify-content:center;background:var(--bg);transition:opacity .6s}
.loader.done{opacity:0;pointer-events:none}
.loader svg{width:72px;height:72px;fill:none;stroke:var(--ink);stroke-width:2.4;stroke-linejoin:round;stroke-linecap:round;animation:pulse 1.4s ease-in-out infinite}
@keyframes pulse{0%,100%{opacity:.35;transform:scale(.96)}50%{opacity:1;transform:scale(1)}}
@media (prefers-reduced-motion:reduce){.loader svg{animation:none}}
/* compact controls on short screens so the whole column fits */
@media (max-height:700px) and (min-height:521px){.ctrl{gap:6px}.ctrl button{width:40px;height:40px}.ctrl svg{width:19px;height:19px}}
@media (max-height:520px){.ctrl button{width:40px;height:40px}.ctrl svg{width:19px;height:19px}.ctrl{gap:6px}}
.info-back{position:fixed;top:0;left:0;right:0;bottom:0;z-index:20;background:rgba(30,20,10,.55);display:flex;align-items:center;justify-content:center;
  padding:calc(16px + env(safe-area-inset-top,0px)) max(16px,env(safe-area-inset-right,0px)) calc(16px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px))}
.info-back[hidden]{display:none}
.info-panel{position:relative;background:#f4ead6;color:#3b2714;border-radius:10px;max-width:760px;width:100%;max-height:100%;overflow:auto;
  display:grid;grid-template-columns:minmax(0,300px) minmax(0,1fr);gap:24px;padding:24px;box-shadow:0 20px 60px rgba(20,10,0,.45);-webkit-user-select:text;user-select:text}
.info-fig{margin:0}
.info-fig img{display:block;width:100%;height:auto;border-radius:6px;border:1px solid rgba(74,47,23,.3)}
.info-fig figcaption{font:italic 13px/1.4 Georgia,"Times New Roman",serif;color:#6b5236;margin-top:8px}
.info-text{min-width:0;font:16px/1.6 Georgia,"Times New Roman",serif}
.info-text h2{font:700 22px/1.25 "Cinzel Decorative","Trajan Pro","Times New Roman",serif;margin:4px 40px 12px 0;color:#4a2f17;text-wrap:balance}
.info-text p{margin:0 0 12px;max-width:62ch}
.info-close{position:absolute;top:10px;right:10px;width:40px;height:40px;border-radius:50%;border:1px solid rgba(74,47,23,.35);background:#fbf4e6;color:#4a2f17;
  display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0}
.info-close svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round}
.info-close:focus-visible{outline:2px solid #4a2f17;outline-offset:2px}
@media (max-width:620px){.info-panel{grid-template-columns:1fr;gap:16px;padding:18px}.info-fig img{max-width:240px;margin:0 auto}}
@media (max-height:520px){.ctrl{flex-direction:row;flex-wrap:wrap-reverse;justify-content:flex-end;max-width:calc(100vw - 32px)}}
.ctrl button:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.ctrl svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.ctrl button[aria-pressed="true"]{background:var(--ink);color:#f6ecda;border-color:var(--ink)}
.nogl{z-index:31;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;padding:24px;text-align:center;
  font:16px/1.5 Georgia,serif;color:var(--ink)}
.is-night .site-name{color:#e9e2cf;text-shadow:0 0 10px rgba(0,0,0,.6),0 1px 2px rgba(0,0,0,.8)}
.site-name{position:fixed;left:calc(20px + env(safe-area-inset-left,0px));top:calc(16px + env(safe-area-inset-top,0px));margin:0;
  font:700 clamp(20px,3.4vw,38px)/1.1 "Cinzel Decorative","Trajan Pro","Times New Roman",serif;letter-spacing:.06em;
  color:var(--ink);text-shadow:0 0 10px var(--glow),0 0 2px var(--glow),0 1px 0 rgba(255,245,225,.6);pointer-events:none;user-select:none}

.site-copy{position:fixed;left:calc(8px + env(safe-area-inset-left,0px));bottom:calc(3px + env(safe-area-inset-bottom,0px));margin:0;z-index:5;
  font:9px/1.2 Georgia,"Times New Roman",serif;letter-spacing:.02em;color:var(--ink);opacity:.75;text-shadow:0 0 3px rgba(255,245,225,.8);pointer-events:none}
.is-night .site-copy{color:#e9e2cf;text-shadow:0 1px 2px rgba(0,0,0,.8)}
.info-copy{margin:16px 0 0;padding-top:12px;border-top:1px solid rgba(74,47,23,.2);font:13px/1.5 Georgia,"Times New Roman",serif;color:#6b5236}
.info-copy a{color:#4a2f17}

/* phones, short screens and small embeds: one small menu button opens a compact panel */
.menu-btn{display:none}
@media (max-width:600px),(max-height:600px){
  :root{--mb:40px;--cb:36px;--cg:7px;--cp:9px}
  .menu-btn{display:flex;position:fixed;z-index:7;right:calc(16px + env(safe-area-inset-right,0px));bottom:calc(16px + env(safe-area-inset-bottom,0px));
    width:var(--mb);height:var(--mb);border-radius:50%;border:1px solid rgba(74,47,23,.35);background:rgba(246,236,218,.9);color:var(--ink);
    -webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);align-items:center;justify-content:center;padding:0;cursor:pointer;
    box-shadow:0 2px 8px rgba(60,35,10,.25);touch-action:manipulation}
  .menu-btn svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round}
  .menu-btn .i-close{display:none}
  .menu-btn[aria-expanded="true"]{background:var(--ink);color:#f6ecda;border-color:var(--ink)}
  .menu-btn[aria-expanded="true"] .i-open{display:none}
  .menu-btn[aria-expanded="true"] .i-close{display:inline}
  .ctrl{display:none;flex-direction:row;flex-wrap:nowrap;z-index:6;
    bottom:calc(16px + var(--mb) + 8px + env(safe-area-inset-bottom,0px));right:calc(16px + env(safe-area-inset-right,0px));
    grid-template-columns:repeat(5,var(--cb));gap:var(--cg);padding:var(--cp);border-radius:14px;
    background:rgba(246,236,218,.94);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);
    border:1px solid rgba(74,47,23,.2);box-shadow:0 8px 24px rgba(40,25,10,.3);
    max-height:calc(100vh - 32px);max-width:calc(100vw - 32px);overflow:auto;-webkit-overflow-scrolling:touch}
  .ctrl.open{display:grid}
  .ctrl button{width:var(--cb);height:var(--cb);box-shadow:none}
  .ctrl svg{width:17px;height:17px}
  /* standing view: the 1-4 bar sits just above the menu button; an open menu panel moves up above the bar */
  .levels{left:auto;right:calc(16px + env(safe-area-inset-right,0px));transform:none;bottom:calc(16px + var(--mb) + 8px + env(safe-area-inset-bottom,0px));
    gap:5px;padding:4px;max-width:calc(100vw - 32px)}
  .fp-on .ctrl{bottom:calc(16px + var(--mb) + 8px + var(--cb) + 8px + 8px + env(safe-area-inset-bottom,0px))}
  .levels button{width:min(var(--cb),calc((100vw - 70px)/5));height:min(var(--cb),calc((100vw - 70px)/5));min-width:24px;min-height:24px;font-size:15px}
  .levels svg{width:15px;height:15px}
}
/* very short frames: the panel becomes one row beside the menu button */
@media (max-height:180px){
  .ctrl{grid-template-columns:repeat(10,var(--cb));bottom:calc(16px + env(safe-area-inset-bottom,0px));
    right:calc(16px + var(--mb) + 8px + env(safe-area-inset-right,0px));max-width:calc(100vw - 32px - var(--mb) - 8px)}
}
/* small screens: the information panel scrolls under a close button that always stays in reach */
@media (max-width:620px),(max-height:520px){
  .info-panel{padding-top:64px}
  .info-close{position:fixed;top:calc(26px + env(safe-area-inset-top,0px));right:calc(26px + env(safe-area-inset-right,0px));z-index:21;width:44px;height:44px;box-shadow:0 2px 8px rgba(40,25,10,.25)}
  .info-fig img{max-width:220px}
}
@media (max-height:520px) and (min-width:521px){.info-panel{grid-template-columns:minmax(0,200px) minmax(0,1fr)}.info-fig img{max-width:200px}}
