* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Share Tech Mono", "Courier New", Courier, monospace;
  color: #eef2ff;
  overflow-x: hidden;
  background: #060608;
  transition: opacity 0.3s ease;
}

/* ── Background gradient layers ── */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  will-change: opacity;
}

.bg-layer-1 { opacity: 1; }
.bg-layer-2 { opacity: 0; }

/* ── Top character nav ── */
.char-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 4vw;
  z-index: 1000;
  background: #0a0a0c;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-family: "Share Tech Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  overflow-x: auto;
  scrollbar-width: none;
}
.char-nav::-webkit-scrollbar { display: none; }

.char-nav a {
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  text-transform: uppercase;
  padding: 0 0.9rem;
  white-space: nowrap;
  transition: color 0.18s;
  flex-shrink: 0;
}

.char-nav a:hover { color: #fff; }

.char-nav .nav-home {
  color: #fff;
  font-weight: 700;
}
.char-nav .nav-home:hover { color: #fff; }

.char-nav .nav-section {
  color: rgba(255, 255, 255, 0.55);
}

.char-nav .nav-active {
  color: #fff;
  font-weight: 700;
  position: relative;
}

.char-nav .nav-active::after {
  content: '';
  position: absolute;
  bottom: -18px;
  left: 0.9rem;
  right: 0.9rem;
  height: 2px;
  background: var(--accent, #cc2222);
  border-radius: 1px;
}

.char-nav .nav-section {
  color: rgba(255, 255, 255, 0.75);
}

.char-nav .sep {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
}

/* ── Fixed split layout ── */
.fixed-overlay {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5vw;
  padding: 4vh 8vw;
  contain: layout style paint;
}

.fixed-overlay--reversed {
  flex-direction: row-reverse;
}

/* ── Hero copy ── */
.hero-copy {
  flex: 1 1 0;
  min-width: 0;
  max-width: 500px;
  overflow: hidden;
}

.char-name-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.45em;
  margin: 0 0 0.5rem;
  flex-wrap: wrap;
}

.char-name {
  font-family: "Anton", "Bebas Neue", Impact, "Arial Narrow", sans-serif;
  font-size: clamp(5rem, 10vw, 11rem);
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: 0.03em;
  color: #ffffff;
  margin: 0;
  text-shadow: 0 4px 60px rgba(0, 0, 0, 0.6);
}

.char-arabic {
  font-family: system-ui, -apple-system, Arial, sans-serif;
  font-size: clamp(1.8rem, 3.2vw, 3.6rem);
  color: var(--accent, #cc2222);
  line-height: 1;
  flex-shrink: 0;
  direction: rtl;
}

.char-tagline {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.71rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.44);
  margin: 0.7rem 0 1rem;
  line-height: 2;
}

.char-divider {
  width: 36px;
  height: 2px;
  background: var(--accent, #cc2222);
  margin: 0 0 1.2rem;
  border-radius: 1px;
}

.char-quote {
  border-left: 3px solid var(--accent, #cc2222);
  padding: 0.2rem 0 0.2rem 1rem;
  margin: 0 0 1.6rem;
  font-size: 0.88rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.85;
  font-family: Georgia, "Times New Roman", serif;
}

.char-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0;
}

.stat-item {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.69rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  padding-right: 1.2rem;
  margin-right: 1.2rem;
}

.stat-item:not(:last-child) {
  border-right: 1px solid rgba(255, 255, 255, 0.16);
}

.stat-label {
  color: var(--accent, #cc2222);
  margin-right: 0.38em;
  font-weight: 700;
}

/* ── Canvas frame ── */
.canvas-frame {
  flex: 0 0 auto;
  width: min(38vw, 390px);
  height: min(76vh, 680px);
  border-radius: 24px;
  overflow: hidden;
  background: #04091a;
  box-shadow:
    0 50px 160px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  will-change: transform;
  contain: layout style paint;
}

#three-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Scroll spacer ── */
.scene-scroll { height: 400vh; }

/* ── Scroll hint ── */
.scroll-hint {
  position: fixed;
  bottom: 3.5rem;
  right: 3.5vw;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  opacity: 0.5;
  transition: opacity 0.7s ease;
  pointer-events: none;
}

.scroll-hint.hidden { opacity: 0; }

.scroll-hint-label {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.scroll-mouse {
  width: 20px;
  height: 32px;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  position: relative;
  flex-shrink: 0;
}

.scroll-mouse::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 6px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 2px;
  animation: scrollDot 1.6s ease-in-out infinite;
}

@keyframes scrollDot {
  0%   { transform: translateX(-50%) translateY(0);    opacity: 1; }
  70%  { transform: translateX(-50%) translateY(10px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0);    opacity: 0; }
}

/* ── Page navigation ── */
.page-nav {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 0.7rem;
  align-items: center;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 1.4rem;
  background: rgba(18, 18, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.82);
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  font-family: "Share Tech Mono", monospace;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  white-space: nowrap;
}

.nav-btn:hover {
  background: rgba(40, 40, 55, 0.98);
  border-color: rgba(255, 255, 255, 0.38);
  color: #fff;
}

.nav-btn--disabled {
  opacity: 0.2;
  pointer-events: none;
  cursor: default;
}

/* ── Tablet ── */
@media (max-width: 960px) {
  .fixed-overlay,
  .fixed-overlay--reversed {
    flex-direction: column;
    gap: 3vh;
    padding: 3vh 6vw;
  }

  .hero-copy {
    text-align: center;
    max-width: 80vw;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .char-name-wrap { justify-content: center; }
  .char-stats     { justify-content: center; }

  .canvas-frame {
    width: min(65vw, 340px);
    height: min(52vh, 460px);
    order: -1; /* video always at top on tablet/mobile */
  }
}

/* ── Mobile ── */
@media (max-width: 560px) {
  .char-name { font-size: clamp(3.5rem, 17vw, 5.5rem); }
  .char-arabic { font-size: clamp(1.2rem, 6vw, 2rem); }

  .fixed-overlay {
    padding: 2vh 4vw;
    gap: 2vh;
  }

  .canvas-frame {
    width: 82vw;
    height: min(44vh, 360px);
    border-radius: 18px;
  }

  .page-nav { bottom: 1.2rem; }

  .nav-btn {
    padding: 0.55rem 1rem;
    font-size: 0.72rem;
  }

  .scroll-hint { display: none; }
}
