/* ============================================================
   HACK TO THE FUTURE — Thinkathon brand system
   Standalone sub-brand of TrustedHub. Bright / fresh.
   Palette: orange #EB7928 · cyan #9BDFF3 · yellow #FCEE9F
   Type: Bricolage Grotesque (chunky display) + Space Mono (accent)
   ============================================================ */
:root{
  --orange:#EB7928;  --orange-deep:#D8631A;
  --cyan:#9BDFF3;    --cyan-deep:#5DBDE2;
  --yellow:#FCEE9F;  --yellow-deep:#F2C94B;
  --ink:#16140F;     --ink-soft:#4a463d;
  --bg:#FAF7F0;      --paper:#FFFFFF;
  --line:rgba(22,20,15,.12);
  --shadow-1:0 2px 0 rgba(22,20,15,.9);
  --display:"Bricolage Grotesque", "Arial Black", sans-serif;
  --mono:"Space Mono", "JetBrains Mono", monospace;
  --ease:cubic-bezier(.22,.78,.28,1);
}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
html,body{height:100%;}
body{
  font-family:var(--display); color:var(--ink); background:var(--bg);
  -webkit-font-smoothing:antialiased; line-height:1.55; overflow:hidden;
  overscroll-behavior:none; touch-action:none;
}
::selection{background:var(--orange);color:#fff;}
a{color:inherit;}

/* ---- shared chunky 3D button --------------------------------- */
.btn3d{
  --c:var(--orange); --cd:var(--orange-deep);
  font-family:var(--mono); font-weight:700; font-size:13px;
  letter-spacing:.02em; text-transform:uppercase; text-decoration:none;
  display:inline-flex; align-items:center; gap:.55em;
  color:var(--ink); background:var(--c);
  padding:.85em 1.3em; border:2.5px solid var(--ink);
  border-radius:13px; cursor:pointer;
  box-shadow:0 5px 0 var(--ink); transform:translateY(0);
  transition:transform .12s var(--ease), box-shadow .12s var(--ease), background .15s;
}
.btn3d:hover{ transform:translateY(-2px); box-shadow:0 7px 0 var(--ink); }
.btn3d:active{ transform:translateY(4px); box-shadow:0 1px 0 var(--ink); }
.btn3d.alt{ --c:var(--paper); }
.btn3d.cyan{ --c:var(--cyan); }
.btn3d.yellow{ --c:var(--yellow); }

.eyebrow{
  font-family:var(--mono); font-size:11px; font-weight:700;
  letter-spacing:.22em; text-transform:uppercase; color:var(--ink-soft);
  display:inline-flex; align-items:center; gap:.6em;
}
.eyebrow::before{
  content:""; width:9px; height:9px; border-radius:2px;
  background:var(--c,var(--orange)); border:2px solid var(--ink);
}

/* ===========================================================
   MAP PAGE — fixed 3D canvas + scroll spacer + HUD overlay
   =========================================================== */
#scene{ position:fixed; inset:0; width:100vw; height:100vh; display:block; z-index:0; }
#scroll-spacer{ position:relative; z-index:1; pointer-events:none; }
/* one viewport per keyframe (overview + 5 stops) */

.hud{ position:fixed; inset:0; z-index:5; pointer-events:none; }
.hud > *{ pointer-events:auto; }

/* corner brand / back link */
.hud-tl{
  position:fixed; top:26px; left:30px; display:flex; flex-direction:column; gap:10px;
}
.back-link{
  font-family:var(--mono); font-size:11px; font-weight:700; letter-spacing:.12em;
  text-transform:uppercase; text-decoration:none; color:var(--ink);
  background:var(--paper); border:2.5px solid var(--ink); border-radius:10px;
  padding:.5em .8em; box-shadow:0 4px 0 var(--ink); display:inline-flex; gap:.5em;
  transition:transform .12s var(--ease), box-shadow .12s var(--ease);
}
.back-link:hover{ transform:translateY(-2px); box-shadow:0 6px 0 var(--ink); }
.hud-tag{
  font-family:var(--mono); font-size:10px; font-weight:700; letter-spacing:.2em;
  text-transform:uppercase; color:var(--ink-soft); padding-left:2px;
}

/* ---- floating map labels (project 3D pins → 2D) ---- */
.maplabel{
  position:fixed; transform:translate(-50%,-100%); pointer-events:none;
  font-family:var(--mono); font-size:10px; font-weight:700; letter-spacing:.12em;
  text-transform:uppercase; white-space:nowrap;
  background:var(--paper); color:var(--ink);
  border:2.5px solid var(--ink); border-radius:9px;
  padding:.32em .6em; box-shadow:0 4px 0 var(--ink);
  display:flex; align-items:center; gap:.5em;
  transition:opacity .3s; will-change:transform,left,top;
}
.maplabel b{ font-size:11px; }
.maplabel .dot{ width:11px;height:11px;border-radius:3px;border:2px solid var(--ink);background:var(--c);}
.maplabel::after{
  content:""; position:absolute; bottom:-9px; left:50%; transform:translateX(-50%);
  width:3px; height:9px; background:var(--ink);
}

/* ---- TOP-RIGHT logo + content panel (Kasander layout) ---- */
.hud-tr{
  position:fixed; top:22px; right:28px; width:min(36vw,400px);
  display:flex; flex-direction:column; align-items:flex-end; gap:12px;
  height:calc(100vh - 150px);
}
.brand-logo{ width:100%; max-width:300px; height:auto; display:block; flex:none;
  filter:drop-shadow(0 8px 14px rgba(22,20,15,.18)); }

.panel-stack{ position:relative; width:100%; min-height:0; flex:1 1 auto; display:flex; }
.panel{
  display:none;
  width:100%; align-self:flex-start;
  background:#fff;
  border:3px solid var(--ink); border-radius:20px;
  box-shadow:0 8px 0 var(--ink);
  padding:22px 24px 24px;
  max-height:calc(100vh - 300px); overflow-y:auto;
  scrollbar-width:thin; scrollbar-color:var(--orange) transparent;
}
.panel::-webkit-scrollbar{ width:4px; }
.panel::-webkit-scrollbar-thumb{ background:var(--orange); border-radius:4px; }
.panel::-webkit-scrollbar-track{ background:transparent; }
.panel.is-active{ display:block; }
.panel .tag{ --c:var(--orange); margin-bottom:12px; }
.panel h2{
  font-family:var(--display); font-weight:800; font-size:clamp(23px,2.2vw,31px);
  line-height:1.04; letter-spacing:-.02em; margin-bottom:11px; text-wrap:balance;
}
.panel h2 .hl{ background:var(--c,var(--orange)); padding:0 .12em; border-radius:5px;
  box-decoration-break:clone; -webkit-box-decoration-break:clone; }
.panel p{ font-size:14.5px; line-height:1.6; color:var(--ink-soft); margin-bottom:14px; }
.panel p:last-child{ margin-bottom:0; }
.panel .num-big{
  position:absolute; top:14px; right:20px; font-family:var(--display); font-weight:800;
  font-size:54px; line-height:1; color:var(--c,var(--orange)); opacity:.18; letter-spacing:-.04em;
}
.panel .findings{ list-style:none; display:flex; flex-direction:column; gap:11px; margin:4px 0 16px;}
.panel .findings li{ display:grid; grid-template-columns:26px 1fr; gap:11px; align-items:start;
  font-size:14px; color:var(--ink); line-height:1.45; }
.panel .findings li b{ font-family:var(--mono); font-size:12px; color:var(--orange-deep);
  border:2px solid var(--ink); border-radius:7px; width:26px; height:26px;
  display:flex; align-items:center; justify-content:center; }
.panel .chips{ display:flex; flex-wrap:wrap; gap:8px; margin:2px 0 16px; }
.panel .chips span{ font-family:var(--mono); font-size:11px; font-weight:700; letter-spacing:.03em;
  padding:.4em .7em; border:2px solid var(--ink); border-radius:20px; background:var(--paper); }
.panel .chips span.on{ background:var(--cyan); }
.panel .stat-row{ display:flex; gap:18px; margin:2px 0 16px; flex-wrap:wrap; }
.panel .stat b{ display:block; font-family:var(--display); font-weight:800; font-size:26px; line-height:1; }
.panel .stat span{ font-family:var(--mono); font-size:10px; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-soft);}
.panel-actions{ display:flex; flex-wrap:wrap; gap:10px; margin-top:6px; }

/* ---- manual / scroll hint on overview ---- */
.manual{ font-family:var(--mono); font-size:12px; color:var(--ink-soft); line-height:1.7; }
.manual .k{ display:inline-flex; align-items:center; justify-content:center; min-width:22px; height:22px;
  padding:0 6px; border:2px solid var(--ink); border-radius:6px; background:var(--yellow);
  font-weight:700; font-size:11px; color:var(--ink); margin:0 2px; vertical-align:-3px; }

/* ---- bottom legend (route nav) ---- */
.legend{
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%);
  display:flex; align-items:stretch; gap:10px;
  background:rgba(255,255,255,.92); backdrop-filter:blur(8px);
  border:3px solid var(--ink); border-radius:18px; padding:10px;
  box-shadow:0 6px 0 var(--ink); max-width:calc(100vw - 40px);
}
.leg-btn{
  font-family:var(--mono); font-weight:700; cursor:pointer; background:var(--paper);
  border:2.5px solid var(--ink); border-radius:11px; padding:8px 13px;
  display:flex; flex-direction:column; align-items:center; gap:3px; min-width:62px;
  box-shadow:0 4px 0 var(--ink); transform:translateY(0);
  transition:transform .12s var(--ease), box-shadow .12s var(--ease), background .18s;
}
.leg-btn .ln{ font-size:15px; line-height:1; }
.leg-btn .lt{ font-size:8.5px; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-soft); }
.leg-btn:hover{ transform:translateY(-2px); box-shadow:0 6px 0 var(--ink); }
.leg-btn.active{ background:var(--c,var(--orange)); box-shadow:0 2px 0 var(--ink); transform:translateY(2px); }
.leg-btn.active .lt{ color:var(--ink); }

/* progress rail */
.prog{ position:fixed; left:0; right:0; bottom:0; height:5px; background:rgba(22,20,15,.08); z-index:6; }
.prog i{ display:block; height:100%; width:0; background:var(--orange); transition:width .12s linear; }

/* scroll cue */
.scroll-cue{
  position:fixed; bottom:96px; left:30px; font-family:var(--mono); font-size:11px;
  font-weight:700; letter-spacing:.14em; text-transform:uppercase; color:var(--ink-soft);
  display:flex; align-items:center; gap:8px; transition:opacity .4s;
}
.scroll-cue .arr{ display:inline-block; animation:bob 1.4s var(--ease) infinite; }
@keyframes bob{ 0%,100%{transform:translateY(0)} 50%{transform:translateY(5px)} }

/* loading screen — branded route-plotting animation */
#loader{ position:fixed; inset:0; z-index:40;
  background:radial-gradient(120% 90% at 50% 36%, #ffffff 0%, var(--bg) 68%);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:30px;
  transition:opacity .55s var(--ease), transform .55s var(--ease); }
#loader.gone{ opacity:0; transform:scale(1.05); pointer-events:none; }
#loader.hard-hide{ display:none; }
.load-logo{ width:min(62vw,250px); height:auto; display:block;
  filter:drop-shadow(0 10px 16px rgba(22,20,15,.16)); animation:floaty 2.6s var(--ease) infinite; }
@keyframes floaty{ 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }

.load-route{ position:relative; width:min(84vw,360px); height:90px; }
.load-route svg{ position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
.load-route .rline{ fill:none; stroke:var(--ink); stroke-width:3.5; stroke-linecap:round; stroke-linejoin:round;
  stroke-dasharray:360; stroke-dashoffset:360; }
.load-route .chip{ position:absolute; transform:translate(-50%,-50%) scale(0);
  width:40px; height:40px; border:2.5px solid var(--ink); border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  font-family:var(--display); font-weight:800; font-size:17px; color:var(--ink);
  box-shadow:0 4px 0 var(--ink); will-change:transform; }
.load-tag{ font-family:var(--mono); font-size:11.5px; letter-spacing:.18em; text-transform:uppercase; color:var(--ink-soft); }
.load-tag::after{ content:attr(data-dots); display:inline-block; width:1.4em; text-align:left; }
.no3d .load-route .chip{ transform:translate(-50%,-50%) scale(1); }

/* ============================ MOBILE ============================ */
@media (max-width:820px){
  /* let logo + panel position independently of the desktop column */
  .hud-tr{ display:contents; }
  .brand-logo{ position:fixed; top:12px; right:14px; width:142px; max-width:142px; z-index:7; }

  /* content panel becomes a bottom sheet */
  .panel-stack{ position:fixed; left:10px; right:10px; bottom:68px; width:auto;
    display:block; min-height:0; z-index:6; }
  .panel{ max-height:42vh; padding:16px 18px 18px; border-width:2.5px; box-shadow:0 6px 0 var(--ink); }
  .panel .num-big{ display:none; }
  .panel h2{ font-size:21px; }
  .panel p{ font-size:14px; }
  .panel .findings li{ font-size:13.5px; }
  .panel-actions .btn3d{ font-size:12px; padding:.75em 1em; }

  /* compact, swipeable legend pinned to the very bottom */
  .legend{ left:8px; right:8px; bottom:10px; transform:none; max-width:none;
    overflow-x:auto; justify-content:flex-start; padding:8px; gap:8px;
    -webkit-overflow-scrolling:touch; }
  .leg-btn{ min-width:52px; padding:7px 9px; flex:0 0 auto; }

  .hud-tl{ top:11px; left:12px; gap:7px; }
  .back-link{ font-size:10px; padding:.45em .7em; }
  .hud-tag{ font-size:9px; }
  .scroll-cue{ display:none; }

  /* loader scales down */
  .load-logo{ width:min(70vw,210px); }
  .load-route{ width:min(86vw,320px); height:80px; }
  .load-route .chip{ width:34px; height:34px; font-size:15px; }
}

/* short / landscape phones: keep the panel from eating the screen */
@media (max-height:520px) and (max-width:980px){
  .panel{ max-height:38vh; }
  .brand-logo{ width:120px; }
}
