/* ============================================================
   StellarForge Nexus  ·  v3.0  ·  Shard Stage
   Full-bleed angular game panels, AC-style
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #04060c;
  --text-1:    #f0f4ff;
  --text-2:    rgba(200,220,255,0.6);
  --text-3:    rgba(160,190,240,0.35);
  --border:    rgba(255,255,255,0.08);
  --skew:      72px;          /* diagonal cut width in px */

  --ff-display: 'Orbitron', sans-serif;
  --ff-ui:      'Rajdhani', sans-serif;
  --ff-body:    'Inter', sans-serif;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--ff-body);
  overflow-x: hidden;
}

/* ── TOP BAR ─────────────────────────────────────────────── */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, transparent 100%);
  pointer-events: none;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: all;
}

.topbar-icon {
  width: 72px; height: 72px;
  filter: drop-shadow(0 0 12px rgba(50,182,255,0.5));
  flex-shrink: 0;
}

.topbar-wordmark {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.topbar-title {
  font-family: var(--ff-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text-1);
  position: relative;
}

/* Glitch on title */
.topbar-title::before,
.topbar-title::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
}
.topbar-title::before { color: #0ee; animation: gtx-a 12s infinite step-end; }
.topbar-title::after  { color: #e0f; animation: gtx-b 12s infinite step-end; }

@keyframes gtx-a {
  0%,2%,8%,100% { clip-path:inset(0 0 100% 0); transform:none; }
  0.5% { clip-path:inset(15% 0 68% 0); transform:translate(-3px,0); }
  1.0% { clip-path:inset(52% 0 28% 0); transform:translate( 3px,0); }
  1.5% { clip-path:inset(0   0 100% 0); }
}
@keyframes gtx-b {
  0%,2%,8%,100% { clip-path:inset(0 0 100% 0); transform:none; }
  0.7% { clip-path:inset(68% 0 12% 0); transform:translate( 4px,0); }
  1.2% { clip-path:inset(28% 0 52% 0); transform:translate(-4px,0); }
  1.7% { clip-path:inset(0   0 100% 0); }
}

.topbar-sub {
  font-family: var(--ff-ui);
  font-size: 8px;
  letter-spacing: 0.28em;
  color: var(--text-3);
  text-transform: uppercase;
}

.topbar-indicators {
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: all;
}

.nav-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background .2s, transform .2s;
}
.nav-dot.active {
  background: var(--gc, #fff);
  box-shadow: 0 0 6px var(--gc, #fff);
  transform: scale(1.3);
}

/* ── STAGE ───────────────────────────────────────────────── */

.stage {
  position: relative;
  display: flex;
  height: 100vh;
  min-height: 580px;
  overflow: hidden;
}

/* ── SHARDS ──────────────────────────────────────────────── */

.shard {
  flex: 1;
  position: relative;
  cursor: pointer;
  margin-left: calc(-1 * var(--skew));
  overflow: hidden;
  transition:
    flex       0.58s cubic-bezier(0.4, 0, 0.2, 1),
    z-index    0s   0.3s;
}

.shard:first-child  { margin-left: 0; z-index: 30; }
.shard:nth-child(2) { z-index: 20; }
.shard:nth-child(3) { z-index: 10; }
.shard:nth-child(4) { z-index: 5;  }

.shard:hover        { z-index: 90 !important; }
.shard.selected     { z-index: 100 !important; }

/* Clip-path per position (set via JS for dynamic count) */
/* defaults set via data attributes below */

/* Game picture — sits above gradient, fades right, 80% opacity */
.shard-img {
  position: absolute;
  inset: -4px;
  background-size: cover;
  background-position: center left;
  opacity: 0.8;
  -webkit-mask-image: linear-gradient(to right, black 25%, rgba(0,0,0,0.7) 55%, transparent 88%);
  mask-image:         linear-gradient(to right, black 25%, rgba(0,0,0,0.7) 55%, transparent 88%);
  transition: opacity .4s, transform .45s;
  z-index: 1;
}

.shard:hover .shard-img  { opacity: 0.9; transform: scale(1.03); }
.shard.selected .shard-img { opacity: 0.85; }

/* Background art */
.shard-bg {
  position: absolute;
  inset: -4px;   /* slightly oversize prevents hairline gaps during transitions */
  background: var(--shard-bg, #04060c);
  background-size: cover;
  background-position: center;
  transition: filter .45s, transform .45s;
  will-change: transform;
}

.shard:hover .shard-bg {
  filter: brightness(1.25) saturate(1.15);
  transform: scale(1.04);
}

.shard.selected .shard-bg {
  filter: brightness(1.1) saturate(1.1);
}

/* Cinematic vignette */
.shard-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      to bottom,
      rgba(0,0,0,0.55) 0%,
      rgba(0,0,0,0.05) 30%,
      rgba(0,0,0,0.10) 55%,
      rgba(0,0,0,0.88) 100%
    );
  transition: opacity .45s;
  z-index: 1;
}

.shard.selected .shard-vignette {
  background:
    linear-gradient(
      to bottom,
      rgba(0,0,0,0.65) 0%,
      rgba(0,0,0,0.05) 25%,
      rgba(0,0,0,0.25) 55%,
      rgba(0,0,0,0.92) 100%
    );
}

/* Side edge glow on hover */
.shard::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  right: 0;
  width: 3px;
  background: var(--gc, #fff);
  opacity: 0;
  transition: opacity .3s;
  z-index: 5;
}
.shard:hover::after  { opacity: 0.25; }
.shard.selected::after { opacity: 0.7; }

/* Scan-line animation on selected shard */
.shard-scan {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--gc, #fff) 50%, transparent 100%);
  opacity: 0;
  z-index: 6;
  pointer-events: none;
}
.shard.selected .shard-scan {
  animation: scan 4s ease-in-out 0.4s infinite;
}
@keyframes scan {
  0%   { top: 0%;   opacity: 0; }
  5%   { opacity: 0.6; }
  95%  { opacity: 0.3; }
  100% { top: 100%; opacity: 0; }
}

/* Corner brackets (appear on selected) */
.shard-corner {
  position: absolute;
  width: 18px; height: 18px;
  opacity: 0;
  transition: opacity .25s .35s;
  z-index: 7;
  pointer-events: none;
}
.shard.selected .shard-corner { opacity: 1; }
.shard-corner.tl {
  top: 72px; left: calc(var(--skew) + 16px);
  border-top: 1.5px solid var(--gc); border-left: 1.5px solid var(--gc);
}
.shard:first-child .shard-corner.tl { left: 22px; }
.shard-corner.br {
  bottom: 22px; right: 22px;
  border-bottom: 1.5px solid var(--gc); border-right: 1.5px solid var(--gc);
}

/* ── SHARD CONTENT ───────────────────────────────────────── */

.shard-content {
  position: absolute;
  inset: 0;
  z-index: 8;
  padding: 28px 28px 32px;
  padding-left: calc(var(--skew) + 22px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.shard:first-child .shard-content { padding-left: 36px; }

/* Status row */
.shard-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--ff-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--gc);
  margin-top: 38px; /* clear topbar */
}

.spip {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gc);
  box-shadow: 0 0 7px var(--gc);
  flex-shrink: 0;
}
.spip.live { animation: pip-pulse 2.3s ease-in-out infinite; }
@keyframes pip-pulse {
  0%,100% { opacity:1;    box-shadow:0 0 8px var(--gc); }
  50%     { opacity:0.3;  box-shadow:0 0 3px var(--gc); }
}

/* Bottom section: name + detail */
.shard-bottom {
  display: flex;
  flex-direction: column;
}

.shard-nameplate { margin-bottom: 6px; }

.shard-name {
  font-family: var(--ff-display);
  font-weight: 900;
  font-size: clamp(16px, 2.4vw, 36px);
  letter-spacing: 0.1em;
  color: #fff;
  line-height: 1;
  text-shadow: 0 2px 24px rgba(0,0,0,0.9), 0 0 40px rgba(0,0,0,0.6);
  /* Filing-cabinet: characters upright, text reads bottom → top */
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  align-self: flex-start;
}

/* Snap to normal horizontal when the shard opens */
.shard.selected .shard-name {
  writing-mode: horizontal-tb;
  transform: none;
  font-size: clamp(18px, 3vw, 42px);
  align-self: auto;
}

.shard-tag {
  font-family: var(--ff-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Hidden while name is vertical — no room in narrow shard */
  display: none;
}

/* Reveal tagline when shard is open */
.shard.selected .shard-tag { display: block; }

/* When another shard is selected, shrink non-selected */
.stage.has-selection .shard { flex: 0.55; }
.stage.has-selection .shard.selected { flex: 3.5; }
.stage.has-selection .shard:not(.selected) .shard-tag  { display: none; }

/* Hover expand (when no selection) */
.stage:not(.has-selection) .shard:hover { flex: 1.55; }

/* ── SHARD DETAIL (expands on select) ────────────────────── */

.shard-detail {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(18px);
  transition:
    max-height .45s .12s cubic-bezier(0.4,0,0.2,1),
    opacity    .35s .2s,
    transform  .35s .2s;
  pointer-events: none;
}

.shard.selected .shard-detail {
  max-height: 500px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
  padding-top: 14px;
}

.shard-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  line-height: 1.7;
  margin-bottom: 16px;
  max-width: 520px;
}

.shard-feats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-bottom: 22px;
}

.shard-feats li {
  font-family: var(--ff-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 7px;
}

.shard-feats li::before {
  content: '';
  width: 5px; height: 1px;
  background: var(--gc);
  flex-shrink: 0;
  box-shadow: 0 0 4px var(--gc);
}

.shard-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 26px;
  background: rgba(0,0,0,0.35);
  border: 1px solid color-mix(in srgb, var(--gc) 55%, transparent);
  color: var(--gc);
  font-family: var(--ff-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background .2s, box-shadow .2s;
  backdrop-filter: blur(4px);
}

.shard-cta:not(.muted):hover {
  background: color-mix(in srgb, var(--gc) 18%, rgba(0,0,0,0.4));
  box-shadow: 0 0 22px color-mix(in srgb, var(--gc) 28%, transparent);
}

.shard-cta.muted {
  color: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.12);
  cursor: default;
}

.shard-cta .arr { transition: transform .2s; }
.shard-cta:not(.muted):hover .arr { transform: translateX(5px); }

/* ── BELOW STAGE ─────────────────────────────────────────── */

.below-stage {
  background: var(--bg);
  padding: 80px 48px 32px;
  position: relative;
}

.below-stage::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(50,182,255,0.25), transparent);
}

.eyebrow {
  text-align: center;
  font-family: var(--ff-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: var(--text-3);
  margin-bottom: 32px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 960px;
  margin: 0 auto 64px;
}

.feature-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: background .2s, border-color .2s;
}

.feature-card:hover {
  background: rgba(255,255,255,0.055);
  border-color: rgba(255,255,255,0.13);
}

.feature-icon { font-size: 22px; }

.feature-card h4 {
  font-family: var(--ff-ui);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.04em;
}

.feature-card p {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.65;
}

/* ── FOOTER ─────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 24px 48px;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-brand {
  font-family: var(--ff-display);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text-3);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  font-size: 12px;
  color: var(--text-3);
  text-decoration: none;
  transition: color .2s;
}
.footer-links a:hover { color: rgba(50,182,255,0.8); }

.footer-sub {
  font-size: 11px;
  color: var(--text-3);
  width: 100%;
  text-align: center;
}

/* ── DISCOVERY PROGRESS (Xylon-learning shards) ─────────── */

.shard-discovery {
  padding: 6px 0 4px;
}

.sdp-label {
  font-family: var(--ff-ui); font-size: 9px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255,255,255,0.35); margin-bottom: 5px;
  display: flex; justify-content: space-between;
}

.sdp-track {
  height: 3px; background: rgba(255,255,255,0.08);
  border-radius: 2px; overflow: hidden;
}

.sdp-fill {
  height: 100%; border-radius: 2px;
  background: var(--gc);
  box-shadow: 0 0 6px var(--gc);
  transition: width .6s ease;
}

/* ── MOBILE ─────────────────────────────────────────────── */

@media (max-width: 768px) {
  .stage {
    flex-direction: column;
    height: auto;
  }

  .shard {
    flex: none !important;
    height: 42vh;
    min-height: 220px;
    margin-left: 0 !important;
    clip-path: none !important;
    transition: height .5s cubic-bezier(0.4,0,0.2,1);
    z-index: 1 !important;
  }

  .shard.selected { height: 72vh !important; z-index: 2 !important; }
  .stage.has-selection .shard:not(.selected) { height: 22vh !important; }

  .shard-content { padding: 24px !important; }

  .shard-corner.tl { left: 18px !important; }

  .below-stage { padding: 60px 20px 24px; }
  .features-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

  .topbar { padding: 0 20px; }

  .site-footer { padding: 20px; }
  .footer-inner { flex-direction: column; align-items: center; text-align: center; }
}

@media (max-width: 480px) {
  .features-grid { grid-template-columns: 1fr; }
}
