/* ═══════════ HUB — האימפריה של אופיר ═══════════
   © אופיר ברנס (Ofir Baranes) 2026 - כל הזכויות שמורות */

:root {
  --bg: #080817;
  --ink: #eef0ff;
  --ink-dim: #8b90b3;
  --gold: #f2c86b;
  --gold-soft: rgba(242, 200, 107, .16);
  --glass: rgba(255, 255, 255, .045);
  --glass-border: rgba(255, 255, 255, .09);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overflow-x: clip; max-width: 100vw; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Heebo', system-ui, sans-serif;
  min-height: 100dvh;
}

::selection { background: var(--gold-soft); color: var(--gold); }

/* ---------- loading veil ---------- */
#veil {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity .9s ease, visibility .9s;
}
#veil.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.veil-emblem {
  width: 92px; height: 92px; object-fit: contain; mix-blend-mode: screen;
  animation: veilspin 7s linear infinite;
  filter: drop-shadow(0 0 22px rgba(242, 200, 107, .45));
}
@keyframes veilspin { to { transform: rotate(360deg); } }
.veil-bar {
  width: min(240px, 60vw); height: 2px; border-radius: 2px;
  background: rgba(255, 255, 255, .08); overflow: hidden;
}
.veil-bar i {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: veilslide 1.2s ease-in-out infinite;
}
@keyframes veilslide { from { transform: translateX(-120%); } to { transform: translateX(320%); } }
.veil-txt { font-size: 13px; font-weight: 300; color: var(--ink-dim); letter-spacing: .14em; }

/* ---------- header ---------- */
#top {
  position: fixed; top: 0; right: 0; left: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: calc(10px + env(safe-area-inset-top)) clamp(14px, 4vw, 34px) 10px;
  background: linear-gradient(180deg, rgba(8, 8, 23, .92), rgba(8, 8, 23, .55) 70%, transparent);
  pointer-events: none;
}
#top > * { pointer-events: auto; }
.brand-emblem {
  width: 52px; height: 52px; object-fit: contain; mix-blend-mode: screen;
  filter: drop-shadow(0 0 14px rgba(242, 200, 107, .5));
  animation: emblempulse 5s ease-in-out infinite;
}
@keyframes emblempulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(242, 200, 107, .35)); }
  50% { filter: drop-shadow(0 0 22px rgba(242, 200, 107, .65)); }
}
.brand-txt h1 {
  font-size: clamp(19px, 3.4vw, 27px); font-weight: 800; letter-spacing: .02em;
  background: linear-gradient(120deg, #fff0cf, var(--gold) 55%, #b8873a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { font-size: clamp(11px, 1.7vw, 13px); font-weight: 300; color: var(--ink-dim); letter-spacing: .06em; }
.tagline #live-count { color: var(--gold); font-weight: 600; }
.ghost-link {
  margin-inline-start: auto;
  font-size: 12.5px; color: var(--ink-dim); text-decoration: none;
  border: 1px solid var(--glass-border); border-radius: 999px; padding: 7px 15px;
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: all .35s var(--spring);
}
.ghost-link:hover { color: var(--gold); border-color: rgba(242, 200, 107, .4); transform: translateY(-1px); }

/* ---------- the 3D stage ---------- */
#stage { position: relative; width: 100%; height: 100dvh; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.p-label {
  position: absolute; transform: translate(-50%, -50%);
  pointer-events: auto; cursor: pointer;
  font-size: 12.5px; font-weight: 400; color: var(--ink);
  background: rgba(10, 11, 28, .55); border: 1px solid var(--glass-border);
  border-radius: 999px; padding: 4px 12px; white-space: nowrap;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: color .25s, border-color .25s, background .25s;
  will-change: left, top, opacity;
  user-select: none; -webkit-user-select: none;
}
.p-label b { font-weight: 400; margin-inline-end: 4px; }
.p-label.hot {
  color: var(--gold); border-color: rgba(242, 200, 107, .55);
  background: rgba(20, 16, 6, .72);
  box-shadow: 0 0 18px rgba(242, 200, 107, .22);
}

#hint {
  position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  font-size: 11.5px; font-weight: 300; color: var(--ink-dim); letter-spacing: .1em;
  background: rgba(10, 11, 28, .5); border: 1px solid var(--glass-border);
  border-radius: 999px; padding: 6px 16px; white-space: nowrap;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: hintfade 1s 2.2s both;
  transition: opacity .8s;
}
@keyframes hintfade { from { opacity: 0; transform: translate(-50%, 8px); } }
#hint.gone { opacity: 0; }

/* ---------- project card ---------- */
#card-veil {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 4, 14, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 1; transition: opacity .4s;
}
#card {
  position: fixed; z-index: 70;
  top: 50%; left: 50%; transform: translate(-50%, -50%) scale(1);
  width: min(400px, calc(100vw - 36px));
  background: linear-gradient(160deg, rgba(22, 23, 48, .92), rgba(10, 11, 28, .96));
  border: 1px solid rgba(242, 200, 107, .28); border-radius: 24px;
  padding: 30px 26px 26px; text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 60px rgba(242, 200, 107, .08) inset;
  animation: cardin .5s var(--spring);
}
@keyframes cardin { from { opacity: 0; transform: translate(-50%, -44%) scale(.92); } }
#card.hidden, #card-veil.hidden { display: none; }
#card-close {
  position: absolute; top: 12px; inset-inline-start: 12px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--glass); border: 1px solid var(--glass-border); color: var(--ink-dim);
  font-size: 14px; cursor: pointer; transition: all .3s var(--spring);
}
#card-close:hover { color: var(--gold); transform: rotate(90deg); border-color: rgba(242, 200, 107, .4); }
.card-icon {
  font-size: 46px; line-height: 1; margin-bottom: 10px;
  filter: drop-shadow(0 4px 18px rgba(242, 200, 107, .35));
}
#card h2 {
  font-size: 23px; font-weight: 800; margin-bottom: 8px;
  background: linear-gradient(120deg, #fff0cf, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#card p { font-size: 14px; font-weight: 300; color: var(--ink-dim); line-height: 1.75; margin-bottom: 14px; }
#card-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 20px; }
#card-tags span {
  font-size: 11px; color: var(--gold); background: var(--gold-soft);
  border: 1px solid rgba(242, 200, 107, .25); border-radius: 999px; padding: 3px 11px;
}
#card-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; color: #14100a; text-decoration: none;
  background: linear-gradient(120deg, #ffe9b0, var(--gold) 60%, #d9a94e);
  border-radius: 999px; padding: 11px 30px;
  box-shadow: 0 8px 26px rgba(242, 200, 107, .3);
  transition: all .35s var(--spring);
}
#card-link:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 12px 34px rgba(242, 200, 107, .45); }

/* ---------- the grid ---------- */
#grid {
  position: relative; z-index: 10;
  padding: 70px clamp(16px, 5vw, 60px) 40px;
  background: linear-gradient(180deg, transparent, rgba(12, 13, 32, .55) 120px);
}
#grid h2 {
  text-align: center; font-size: clamp(21px, 3.5vw, 30px); font-weight: 800; margin-bottom: 34px;
  background: linear-gradient(120deg, #fff0cf, var(--gold) 55%, #b8873a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#grid h2 span { font-size: .6em; vertical-align: middle; opacity: .7; }
#grid-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px;
  max-width: 1240px; margin: 0 auto;
}
.g-card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 20px;
  padding: 20px 20px 16px; text-decoration: none; color: var(--ink);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: all .4s var(--spring);
  overflow: hidden;
  animation: gcardin .6s var(--spring) both;
  animation-delay: calc(var(--i) * 60ms);
}
@keyframes gcardin { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.g-card::before {
  content: ''; position: absolute; inset: 0; border-radius: 20px; pointer-events: none;
  background: radial-gradient(420px 140px at 85% -10%, var(--pc, var(--gold-soft)), transparent 70%);
  opacity: .14; transition: opacity .4s;
}
.g-card:hover { transform: translateY(-5px); border-color: rgba(242, 200, 107, .35); }
.g-card:hover::before { opacity: .3; }
.g-head { display: flex; align-items: center; gap: 10px; }
.g-icon { font-size: 27px; line-height: 1; filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .5)); }
.g-name { font-size: 16.5px; font-weight: 600; flex: 1; }
.g-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #8ef0a7;
  box-shadow: 0 0 10px rgba(142, 240, 167, .8);
  animation: dotpulse 2.4s ease-in-out infinite;
}
@keyframes dotpulse { 50% { opacity: .45; } }
.g-desc { font-size: 12.5px; font-weight: 300; color: var(--ink-dim); line-height: 1.7; flex: 1; }
.g-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.g-tags span {
  font-size: 10px; color: var(--ink-dim); background: rgba(255, 255, 255, .05);
  border: 1px solid var(--glass-border); border-radius: 999px; padding: 2px 9px;
}
.g-go {
  position: absolute; bottom: 14px; inset-inline-start: 16px;
  font-size: 15px; color: var(--gold); opacity: 0; transform: translateX(6px);
  transition: all .35s var(--spring);
}
.g-card:hover .g-go { opacity: 1; transform: none; }

/* ---------- footer ---------- */
footer {
  position: relative; z-index: 10;
  text-align: center; padding: 30px 16px calc(34px + env(safe-area-inset-bottom));
  font-size: 12px; font-weight: 300; color: var(--ink-dim);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.foot-emblem { width: 40px; height: 40px; object-fit: contain; mix-blend-mode: screen; opacity: .8; }
.foot-sub { font-size: 11px; opacity: .75; }
.foot-sub::before { content: ''; display: block; width: 60px; height: 1px; margin: 4px auto 10px;
  background: linear-gradient(90deg, transparent, rgba(242, 200, 107, .5), transparent); }

/* ---------- no-WebGL fallback ---------- */
body.no3d #stage { height: 42dvh; min-height: 300px; }
body.no3d #scene, body.no3d #labels, body.no3d #hint { display: none; }
body.no3d #stage::after {
  content: '✦'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 60px; color: var(--gold); opacity: .3;
}

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .brand-emblem { width: 42px; height: 42px; }
  .ghost-link { padding: 6px 12px; font-size: 11.5px; }
  #hint { font-size: 10.5px; padding: 5px 13px; }
  .p-label { font-size: 11.5px; padding: 3px 10px; }
  #grid { padding-top: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; transition-duration: .01s !important; }
}
