/* ===== Chart Library — wide Ethereal tile wall (long horizontal page, rotating charts) ===== */
#gallery .panel-inner{ position:relative; height:100vh; max-height:100vh; overflow:hidden; padding:0; width:100vw; background:#c7cad6; }
.g-stage{ display:grid; grid-template-columns:repeat(5,1fr); grid-template-rows:repeat(3,1fr); gap:9px; padding:9px; padding-top:62px; width:100vw; height:100vh; box-sizing:border-box; }
.g-col{ display:flex; flex-direction:column; gap:9px; flex:0 0 auto; }
.g-cell{ position:relative; flex:1 1 0; min-height:0; overflow:hidden; border-radius:7px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.20), inset 0 0 80px rgba(255,255,255,.06), 0 18px 40px -26px rgba(38,26,58,.65);
  opacity:0; transform:scale(.99) translateY(10px); transition:opacity .5s ease, transform .34s ease, box-shadow .3s ease; }
.g-cell.inview{ opacity:1; transform:none; }
.g-cell:not(.g-intro){ cursor:pointer; }
.g-cell:not(.g-intro):hover{ transform:scale(1.04); z-index:6;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.30), 0 28px 56px -22px rgba(38,26,58,.85), 0 0 0 1.5px rgba(201,163,224,.55), 0 0 44px rgba(160,120,210,.4); }
.g-cell .body{ position:absolute; inset:0; }
.g-cell .chart-layer{ position:absolute; top:11px; left:12px; right:12px; bottom:26px; opacity:0; transition:opacity .42s ease; }
.g-cell .chart-layer svg{ width:100%; height:100%; display:block; overflow:visible; }
.g-cell .cap{ position:absolute; left:14px; bottom:10px; right:14px; z-index:3; font-size:.6rem; font-weight:700;
  letter-spacing:.11em; text-transform:uppercase; color:rgba(255,255,255,.85); text-shadow:0 1px 8px rgba(0,0,0,.45);
  pointer-events:none; opacity:0; transition:opacity .42s ease; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.g-use{ position:absolute; top:9px; right:9px; z-index:7; font-family:'Inter',sans-serif; font-weight:700; font-size:.6rem; letter-spacing:.03em;
  color:#fff; background:linear-gradient(135deg,#8a6fc0,#c9738f); border-radius:999px; padding:6px 11px; text-decoration:none; white-space:nowrap;
  opacity:0; transform:translateY(-5px); transition:opacity .2s ease, transform .2s ease; pointer-events:none; box-shadow:0 8px 20px -8px rgba(0,0,0,.55); }
.g-cell:not(.g-intro):hover .g-use{ opacity:1; transform:none; pointer-events:auto; }
/* selected charts */
.g-cell.picked{ box-shadow: 0 0 0 2.5px #b49be6, 0 0 44px rgba(160,120,210,.55), 0 22px 46px -22px rgba(38,26,58,.85); }
.g-cell.picked::before{ content:"✓"; position:absolute; top:8px; left:8px; z-index:8; width:20px; height:20px; border-radius:50%;
  background:linear-gradient(135deg,#8a6fc0,#c9738f); color:#fff; font-size:.72rem; font-weight:800; display:flex; align-items:center; justify-content:center; box-shadow:0 6px 14px -6px rgba(0,0,0,.6); }
.g-cell.picked .g-use{ opacity:1; transform:none; pointer-events:auto; background:linear-gradient(135deg,#5aa06a,#3f8f6a); }
/* selection tray */
.g-tray{ position:absolute; left:50%; bottom:18px; transform:translate(-50%,22px); z-index:30; display:flex; align-items:center; gap:14px;
  background:rgba(28,20,40,.72); backdrop-filter:blur(12px); border:1px solid rgba(201,163,224,.32); border-radius:999px; padding:8px 8px 8px 20px;
  box-shadow:0 22px 54px -22px rgba(0,0,0,.7); opacity:0; pointer-events:none; transition:opacity .3s ease, transform .3s ease; }
.g-tray.show{ opacity:1; transform:translate(-50%,0); pointer-events:auto; }
.g-tray.full{ animation:gtrayshake .5s ease; }
@keyframes gtrayshake{ 0%,100%{ transform:translate(-50%,0);} 25%{ transform:translate(-52%,0);} 75%{ transform:translate(-48%,0);} }
.g-tray-c{ font-family:'Inter',sans-serif; font-size:.8rem; font-weight:600; color:#f0eaf7; letter-spacing:.02em; white-space:nowrap; }
.g-build{ border:0; cursor:pointer; font-family:'Inter',sans-serif; font-weight:700; font-size:.85rem; color:#fff; white-space:nowrap;
  background:linear-gradient(135deg,#8a6fc0,#c9738f); border-radius:999px; padding:10px 20px; box-shadow:0 12px 26px -12px rgba(138,111,192,.7); transition:transform .14s ease; }
.g-build:hover{ transform:translateY(-1px); }

/* ===== 3D showcase ===== */
.g-3dtoggle{ position:absolute; top:70px; right:16px; z-index:40; display:flex; gap:2px; padding:3px;
  background:rgba(28,20,40,.6); backdrop-filter:blur(10px); border:1px solid rgba(201,163,224,.3); border-radius:999px; box-shadow:0 10px 24px -12px rgba(0,0,0,.6); }
.g-3dbtn{ border:0; cursor:pointer; font-family:'Inter',sans-serif; font-weight:700; font-size:.74rem; letter-spacing:.06em; color:rgba(240,234,247,.72);
  background:transparent; border-radius:999px; padding:6px 14px; transition:.15s; }
.g-3dbtn.on{ color:#fff; background:linear-gradient(135deg,#8a6fc0,#c9738f); box-shadow:0 6px 16px -8px rgba(138,111,192,.8); }
.g-3d{ display:none; grid-template-columns:repeat(3,1fr); grid-template-rows:repeat(2,1fr); gap:10px; min-height:0; }
.g-3dcard canvas{ transition:opacity .5s ease; }
#gallery.show3d .g-3d{ display:grid; }
#gallery.show3d #g-grid > .g-cell:not(.g-intro){ display:none; }
#gallery.show3d .g-tray{ display:none; }
.g-3dcard{ position:relative; border-radius:10px; overflow:hidden;
  background:radial-gradient(120% 100% at 30% 12%, #2b2340, #171226 70%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 20px 44px -24px rgba(0,0,0,.7); }
.g-3dcard canvas{ position:absolute; inset:0; width:100%; height:100%; display:block; }
.g-3dcap{ position:absolute; left:14px; bottom:11px; z-index:3; font-family:'Inter',sans-serif; font-size:.62rem; font-weight:700;
  letter-spacing:.11em; text-transform:uppercase; color:rgba(255,255,255,.82); text-shadow:0 1px 8px rgba(0,0,0,.6); pointer-events:none; }
@media (max-width:900px){ .g-3d{ grid-column:1 / -1 !important; grid-template-columns:1fr; grid-template-rows:none; grid-auto-rows:40vh; } }
.g-cell .body svg text{ fill:rgba(255,255,255,.78); }

/* intro tile */
.g-cell.g-intro{ display:flex; flex-direction:column; justify-content:center; padding:30px 30px; color:#fff; }
.g-intro h1{ font-family:'Poppins',sans-serif; font-weight:700; font-size:2.1rem; line-height:1.02; margin:0; letter-spacing:-.5px; text-shadow:0 2px 14px rgba(0,0,0,.28); }
.g-intro h1 .spark{ color:#f4dfe8; }
.g-intro .rule{ width:48px; height:3px; background:rgba(255,255,255,.55); border-radius:2px; margin:15px 0 16px; }
.g-intro p{ font-size:.9rem; line-height:1.6; color:rgba(255,255,255,.92); margin:0 0 20px; max-width:290px; text-shadow:0 1px 9px rgba(0,0,0,.28); }
.g-intro .hint{ font-size:.72rem; color:rgba(255,255,255,.72); margin-top:16px; letter-spacing:.04em; }
.g-dl{ align-self:flex-start; border:0; cursor:pointer; font-family:'Inter',sans-serif; font-weight:700; font-size:.84rem; color:#5b4a6a;
  background:rgba(255,255,255,.94); border-radius:10px; padding:11px 17px; display:inline-flex; align-items:center; gap:8px;
  box-shadow:0 14px 28px -14px rgba(0,0,0,.55); transition:transform .12s ease; }
.g-dl:hover{ transform:translateY(-1px); }

@media (max-width:900px){
  #gallery .panel-inner{ overflow-y:auto; overflow-x:hidden; width:100vw; }
  .g-stage{ grid-template-columns:repeat(2,1fr); grid-template-rows:none; grid-auto-rows:200px; height:auto; min-height:100vh; padding-top:60px; }
  .g-cell.g-intro{ grid-column:1 / -1 !important; grid-row:auto !important; }
  .g-cell{ min-height:200px; }
}
