/* ====== Reset & Base ====== */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  color: var(--fg);
  font: 400 16px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI,
    Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background: #0a0e16; /* fallback if canvas doesn't paint */
  overflow: hidden; /* prevents scrollbar during cinematic */
}

/* ====== Theme Vars ====== */
:root {
  --fg: #f4f7fb;
  --fg-dim: #cbd5e1;
  --accent: #7df9ff;

  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-blur: 2px;

  /* Cinematic pan / parallax */
  --pan-duration: 4s; /* for any CSS timing you keep elsewhere */
  --parallax-scene: 66vh; /* bot/scene starts below viewport */
  --parallax-stars: -33vh; /* NEGATIVE: stars start above viewport */

  /* Layout widths */
  --content-max: 1350px;
  --title-max: 50%;

  /* Panel arrows */
  --arrow-size: 12px;
  --arrow-color: rgba(66, 167, 63, 0.8);
  --arrow-shadow: 0 0 0 4px rgba(66, 167, 63, 0.08);
}

/* Global link style override */
a {
  color: rgba(200, 200, 255, 0.75);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s, font-weight 0.2s;
}
a:hover {
  color: rgba(200, 200, 255, 0.85);
  font-weight: 700;
}

/* ====== Starfield (Canvas) ====== */
#starfield {
  position: fixed;
  top: -33dvh;
  top: -33svh;
  top: -33vh;
  left: 0;
  width: 100vw;
  height: 150dvh;
  height: 150svh;
  height: 150vh; /* taller than screen for breathing room */
  z-index: 0;

  pointer-events: none;
  background: linear-gradient(
    to bottom,
    #070a12 0%,
    #070a12 30%,
    #0a0e16 50%,
    #1a1f2c 75%,
    #1c1f2c 100%
  );

  /* No CSS transition: JS drives transform */
  transform: translateY(0);
  will-change: transform;
  backface-visibility: hidden;
}

/* ====== Scene (contains title, panels, bot) ====== */
#scene {
  position: relative;
  width: 100%;
  height: 100dvh;
  height: 100svh; /* older Safari safe */
  height: 100vh; /* fallback */
  display: grid;
  grid-template-rows: 25% 50% 25%;
  overflow: hidden;
  z-index: 1;

  transform: translateY(0);
  will-change: transform;
  backface-visibility: hidden;
}

/* ====== Title / Hero ====== */
#title-panel {
  margin: auto;
  padding: 1vh 1vh;
  text-align: center;
}

@keyframes glow-flicker {
  0%,
  100% {
    box-shadow: 0 0 18px rgba(12, 147, 225, 0.85);
    opacity: 0.9;
  }
  40% {
    box-shadow: 0 0 20px rgba(12, 147, 225, 0.95);
    opacity: 0.98;
  }
  60% {
    box-shadow: 0 0 18px rgba(12, 147, 225, 0.6);
    opacity: 0.88;
  }
  80% {
    box-shadow: 0 0 18px rgba(12, 147, 225, 0.95);
    opacity: 0.92;
  }
}

#main-logo {
  width: 20vw;
  border-radius: 2%;
  animation: glow-flicker 8s infinite ease-in-out;
}

#subtitle {
  font-size: 1.8vh;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 2vh;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

/* ====== Panels ====== */
.panels-container {
  width: fit-content;
  height: 75%;
  margin-left: auto;
  margin-right: auto;
  padding: 0 2vw;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.panels-container h1 {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 500;
  margin: 24px 0 12px 0;
  color: var(--fg);
  letter-spacing: 0.02em;
  opacity: 0.9;
  padding: 6px;
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  margin-top: 10%;
}

#panels {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 16px 24px;

  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(140px, auto);
  gap: 16px;
  align-content: start;
}

.panel.glass {
  backdrop-filter: blur(var(--glass-blur)) saturate(120%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(120%);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: calc(min(2vh, 2vw));
  padding: calc(min(2vh, 2vw));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.panel h1,
.panel h2 {
  margin: 0 0 8px;
  color: var(--fg);
  letter-spacing: 0.2px;
  font-size: 2.5rem;
  text-align: center;
}
.panel p {
  color: var(--fg-dim);
  line-height: 1.35;
  font-size: calc(min(1.65vh, 1.65vw));
  text-align: center;
  margin-top: auto;
  margin-bottom: auto;
}

/* Contact button */
.contact-btn {
  width: fit-content;
  font-size: calc(min(2vh, 2vw));
  text-align: center;
  margin-top: auto;
  margin-bottom: 0;
  padding: calc(min(1.5vh, 1.5vw));
  border-radius: 999px;
  background: rgba(108, 186, 255, 0.15);
  color: #f4f7fb;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid rgba(108, 186, 255, 0.3);
}
.contact-btn:hover {
  background: rgba(108, 186, 255, 0.3);
  border-color: rgba(108, 186, 255, 0.5);
  transform: translateY(-1px);
}

/* Progress bars */
.progress-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px;
  padding: 8px 8px 0 8px;
  margin-top: auto;
}
.progress {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: #0af;
}

/* ====== Barr.e ====== */
#bot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0vh;
  width: min(30vw, 50vh);
  margin: 0;
  padding: 0;
  z-index: 4;
}
.bot-img {
  width: 100%;
  height: auto;
  display: block;
}

#face-canvas {
  position: absolute;
  left: 56.5%;
  transform: translateX(-45%) perspective(500px) rotateY(20deg) rotate(1.2deg);
  bottom: 59%;
  width: 11%;
  height: auto;
  pointer-events: none;
  opacity: 0.78;
}

/* ====== Footer ====== */
#footer {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  gap: 16px;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  font: 500 14px/1.2 system-ui, -apple-system, Segoe UI, Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  z-index: 5;
}

/* ====== Fade-in Helpers ====== */
.fade-in-title {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.8s ease 0s, transform 0.8s ease 0s;
}
.fade-in-title.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 1s ease 0.8s, transform 1s ease 0.8s;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-delayed {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.2s ease 1.4s, transform 1s ease 1.4s;
}
.fade-in-delayed.visible {
  opacity: 1;
  transform: translateY(0);
}

#panels.scrolled {
  overflow-y: auto;
  max-height: 100vh;
  -webkit-overflow-scrolling: touch;
}
