/* ═══════════════════════════════════════════════════════════════
   CELESTIAL BLOG — STYLESHEET
   Deep-space galaxy navigation system
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS CUSTOM PROPERTIES ── */
:root {
  --deep-space:     #03040a;
  --void:           #060818;
  --nebula-blue:    #0d1b4b;
  --nebula-purple:  #1a0b3b;
  --nebula-magenta: #2d0d3d;
  --star-white:     #f0f4ff;
  --star-blue:      #a8d4ff;
  --star-gold:      #ffe89a;
  --accent-cyan:    #40c8f0;
  --accent-violet:  #9f70ff;
  --accent-rose:    #f060a0;
  --accent-amber:   #ffb830;
  --text-primary:   rgba(230, 240, 255, 0.9);
  --text-dim:       rgba(180, 200, 240, 0.45);

  /* Portal-specific accent colors */
  --col-philosophy: #9f70ff;   /* violet — black hole */
  --col-projects:   #40c8f0;   /* cyan   — pulsar     */
  --col-photo:      #f060a0;   /* rose   — nebula     */
  --col-journal:    #ffb830;   /* amber  — binary     */

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-ui:      'Raleway', sans-serif;

  /* Portal layout constants — adjusted per media query */
  --portal-size:     110px;
  --ring-size:       160px;
  --label-offset:    90px;
}

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--deep-space);
  color: var(--text-primary);
  font-family: var(--font-ui);
  cursor: none; /* custom cursor via JS */
}

/* ══════════════════════════════════════════════
   PAGE-LOAD VEIL
══════════════════════════════════════════════ */
#veil {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 1000;
  pointer-events: none;
  transition: opacity 2.4s ease;
}
#veil.fade-out { opacity: 0; }

/* ══════════════════════════════════════════════
   MAIN SCENE
══════════════════════════════════════════════ */
#scene {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ── CANVAS ── */
#spaceCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ── VIGNETTE ── */
.vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(
    ellipse at center,
    transparent 30%,
    rgba(3, 4, 10, 0.55) 70%,
    rgba(2, 3, 8, 0.92) 100%
  );
  pointer-events: none;
}

/* ══════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════ */
#siteHeader {
  position: absolute;
  top: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  text-align: center;
  opacity: 0;
  animation: fadeInDown 1.8s ease 2.2s forwards;
}

.site-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.1rem, 2.2vw, 1.7rem);
  letter-spacing: 0.45em;
  color: var(--star-white);
  text-transform: uppercase;
}

.site-tagline {
  display: block;
  font-family: var(--font-ui);
  font-weight: 100;
  font-size: clamp(0.55rem, 1vw, 0.72rem);
  letter-spacing: 0.55em;
  color: var(--text-dim);
  margin-top: 6px;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════
   HUD CENTER LABEL
══════════════════════════════════════════════ */
#hudLabel {
  position: absolute;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  animation: fadeInUp 1.8s ease 2.8s forwards;
}

#hudLabel p {
  font-family: var(--font-ui);
  font-weight: 100;
  font-size: clamp(0.5rem, 0.9vw, 0.68rem);
  letter-spacing: 0.5em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════ */
#siteFooter {
  position: absolute;
  bottom: 20px;
  right: 30px;
  z-index: 10;
  font-size: 0.55rem;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  opacity: 0;
  text-transform: uppercase;
  animation: fadeIn 2s ease 3.2s forwards;
}

/* ══════════════════════════════════════════════
   PORTALS — BASE
══════════════════════════════════════════════ */
.portal {
  position: absolute;
  z-index: 5;
  width: var(--portal-size);
  height: var(--portal-size);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  /* individual portals positioned in JS for fluid responsiveness */
  transform: translate(-50%, -50%);
  cursor: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.portal.revealed { opacity: 1; }

/* ── Portal inner wrapper ── */
.portal-inner {
  position: relative;
  width: var(--portal-size);
  height: var(--portal-size);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal:hover .portal-inner {
  transform: scale(1.12);
}

/* ── Orbital Rings (hover reveal) ── */
.ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0;
  transform: scale(0.7) rotate(0deg);
  transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.portal:hover .ring { opacity: 1; transform: scale(1) rotate(0deg); }

.ring-1 { width: 130%; height: 130%; animation: spin 14s linear infinite paused; }
.ring-2 { width: 155%; height: 155%; animation: spinR 20s linear infinite paused; }
.ring-3 { width: 182%; height: 182%; animation: spin 30s linear infinite paused; }

.portal:hover .ring-1 { animation-play-state: running; }
.portal:hover .ring-2 { animation-play-state: running; }
.portal:hover .ring-3 { animation-play-state: running; }

/* ── Portal Label ── */
.portal-label {
  position: absolute;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s ease 0.1s, transform 0.5s ease 0.1s;
  white-space: nowrap;
}

.portal:hover .portal-label {
  opacity: 1;
  transform: translateY(0);
}

.portal-name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(0.9rem, 1.6vw, 1.25rem);
  color: var(--star-white);
  letter-spacing: 0.15em;
}

.portal-desc {
  display: block;
  font-family: var(--font-ui);
  font-weight: 100;
  font-size: clamp(0.48rem, 0.75vw, 0.6rem);
  color: var(--text-dim);
  letter-spacing: 0.35em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════
   PORTAL LABEL POSITIONS (per portal)
══════════════════════════════════════════════ */
#portal-philosophy .portal-label { right: calc(100% + 20px); text-align: right; }
#portal-projects   .portal-label { left:  calc(100% + 20px); text-align: left; }
#portal-photography .portal-label { right: calc(100% + 20px); text-align: right; }
#portal-journal    .portal-label { left:  calc(100% + 20px); text-align: left; }

/* ══════════════════════════════════════════════
   PORTAL 1 — BLACK HOLE (Philosophy · Violet)
══════════════════════════════════════════════ */
#portal-philosophy { color: var(--col-philosophy); }

#portal-philosophy .ring-1 {
  border-color: rgba(159, 112, 255, 0.6);
  border-style: dashed;
  border-width: 1px;
}
#portal-philosophy .ring-2 {
  border-color: rgba(159, 112, 255, 0.3);
  transform-origin: center;
  border-width: 1px;
}
#portal-philosophy .ring-3 {
  border-color: rgba(159, 112, 255, 0.15);
}

.bh-core {
  position: relative;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
}

.bh-singularity {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, #000 55%, #0b0020 80%, transparent);
  box-shadow:
    0 0 20px 8px rgba(159, 112, 255, 0.35),
    0 0 60px 20px rgba(80, 30, 180, 0.2),
    inset 0 0 15px rgba(0,0,0,1);
  transition: box-shadow 0.5s ease;
}

.portal:hover .bh-singularity {
  box-shadow:
    0 0 30px 14px rgba(159, 112, 255, 0.7),
    0 0 80px 35px rgba(80, 30, 180, 0.45),
    inset 0 0 15px rgba(0,0,0,1);
}

.bh-glow {
  position: absolute;
  width: 70px; height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 30%, rgba(159,112,255,0.12) 70%);
  animation: pulse 4s ease-in-out infinite;
}

.lens-flare {
  position: absolute;
  width: 2px; height: 70px;
  background: linear-gradient(to bottom, transparent, rgba(200,160,255,0.5), transparent);
  border-radius: 2px;
  animation: lensFlare 8s ease-in-out infinite;
  opacity: 0.4;
}

/* ══════════════════════════════════════════════
   PORTAL 2 — PULSAR STAR (Projects · Cyan)
══════════════════════════════════════════════ */
#portal-projects { color: var(--col-projects); }

#portal-projects .ring-1 { border-color: rgba(64, 200, 240, 0.55); }
#portal-projects .ring-2 { border-color: rgba(64, 200, 240, 0.28); border-style: dotted; }

.star-core {
  position: relative;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
}

.star-surface {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%,
    #d0f4ff 0%, #60d8f8 40%, #0090c0 80%, #003858 100%);
  box-shadow:
    0 0 16px 5px rgba(64, 200, 240, 0.5),
    0 0 50px 15px rgba(20, 130, 200, 0.25);
  transition: box-shadow 0.5s ease;
  animation: stellarPulse 3s ease-in-out infinite;
}

.portal:hover .star-surface {
  box-shadow:
    0 0 28px 10px rgba(64, 200, 240, 0.9),
    0 0 80px 30px rgba(20, 130, 200, 0.55);
}

.star-corona {
  position: absolute;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 25%, rgba(64,200,240,0.08) 70%);
  animation: pulse 2.5s ease-in-out infinite;
}

/* Pulsar beams */
.pulsar-beam {
  position: absolute;
  background: linear-gradient(to right, transparent, rgba(64,200,240,0.7), transparent);
  border-radius: 2px;
  animation: pulsarBeam 2.2s ease-in-out infinite;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.portal:hover .pulsar-beam { opacity: 1; }

.beam-h { width: 200px; height: 1px; }
.beam-v { width: 1px; height: 200px; }

/* Star diffraction spikes (always visible) */
.star-spikes {
  position: absolute;
  width: 100%; height: 100%;
  pointer-events: none;
  animation: starRotate 20s linear infinite;
}
.star-spikes::before,
.star-spikes::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  background: linear-gradient(to right, transparent, rgba(160,220,255,0.6), transparent);
  border-radius: 1px;
}
.star-spikes::before { width: 90px; height: 1px; transform: translate(-50%,-50%) rotate(45deg); }
.star-spikes::after  { width: 90px; height: 1px; transform: translate(-50%,-50%) rotate(-45deg); }

/* ══════════════════════════════════════════════
   PORTAL 3 — NEBULA (Photography · Rose)
══════════════════════════════════════════════ */
#portal-photography { color: var(--col-photo); }

#portal-photography .ring-1 { border-color: rgba(240, 96, 160, 0.45); border-style: dashed; }
#portal-photography .ring-2 { border-color: rgba(240, 96, 160, 0.25); }

.nebula-cloud {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  animation: nebulaFloat 6s ease-in-out infinite;
  transition: opacity 0.5s ease, filter 0.5s ease;
}
.portal:hover .nebula-cloud { filter: blur(5px); }

.cloud-1 {
  width: 80px; height: 60px;
  background: radial-gradient(ellipse, rgba(240,96,160,0.5) 0%, transparent 70%);
  transform: translate(-10px, 5px);
  animation-delay: 0s;
}
.cloud-2 {
  width: 65px; height: 50px;
  background: radial-gradient(ellipse, rgba(160,60,220,0.45) 0%, transparent 70%);
  transform: translate(12px, -8px);
  animation-delay: -2s;
}
.cloud-3 {
  width: 55px; height: 45px;
  background: radial-gradient(ellipse, rgba(255,140,200,0.35) 0%, transparent 70%);
  transform: translate(-5px, -12px);
  animation-delay: -4s;
}

.nebula-nucleus {
  position: relative;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff9fb 0%, #ff80b0 40%, transparent 80%);
  box-shadow:
    0 0 12px 4px rgba(255,120,180,0.6),
    0 0 40px 12px rgba(220,60,140,0.3);
  transition: box-shadow 0.5s ease;
  animation: pulse 3.5s ease-in-out infinite;
}
.portal:hover .nebula-nucleus {
  box-shadow:
    0 0 20px 8px rgba(255,120,180,0.9),
    0 0 60px 20px rgba(220,60,140,0.6);
}

/* ══════════════════════════════════════════════
   PORTAL 4 — BINARY STAR (Journal · Amber)
══════════════════════════════════════════════ */
#portal-journal { color: var(--col-journal); }

#portal-journal .ring-1 { border-color: rgba(255,184,48,0.4); }
#portal-journal .ring-2 { border-color: rgba(255,184,48,0.2); border-style: dotted; }

.binary-orbit {
  position: absolute;
  width: 80%; height: 40%;
  border-radius: 50%;
  border: 1px solid rgba(255,184,48,0.2);
}

.binary-star {
  position: absolute;
  border-radius: 50%;
  transition: box-shadow 0.5s ease;
}

.bs-a {
  width: 18px; height: 18px;
  background: radial-gradient(circle at 35% 35%, #fff4d0 0%, #ffcc50 50%, #ff8800 100%);
  box-shadow: 0 0 12px 4px rgba(255,180,30,0.6);
  animation: binaryOrbitA 6s linear infinite;
}

.bs-b {
  width: 12px; height: 12px;
  background: radial-gradient(circle at 35% 35%, #ffe0f0 0%, #ff80a0 60%, #cc3060 100%);
  box-shadow: 0 0 8px 3px rgba(255,120,160,0.5);
  animation: binaryOrbitB 6s linear infinite;
}

.portal:hover .bs-a {
  box-shadow: 0 0 20px 8px rgba(255,180,30,1), 0 0 50px 16px rgba(255,140,0,0.5);
}
.portal:hover .bs-b {
  box-shadow: 0 0 14px 5px rgba(255,120,160,0.9), 0 0 35px 12px rgba(200,60,100,0.45);
}

.binary-glow {
  position: absolute;
  width: 70px; height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,180,48,0.1) 0%, transparent 70%);
  animation: pulse 4s ease-in-out infinite;
}

/* ══════════════════════════════════════════════
   KEYFRAME ANIMATIONS
══════════════════════════════════════════════ */
@keyframes spin  { to { transform: rotate(360deg);  } }
@keyframes spinR { to { transform: rotate(-360deg); } }

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(1);    }
  50%       { opacity: 1;   transform: scale(1.15); }
}

@keyframes stellarPulse {
  0%, 100% { transform: scale(1);    }
  50%       { transform: scale(1.05); }
}

@keyframes starRotate { to { transform: rotate(360deg); } }

@keyframes lensFlare {
  0%, 100% { transform: rotate(0deg)   scaleY(1); opacity: 0.35; }
  50%       { transform: rotate(180deg) scaleY(1.3); opacity: 0.55; }
}

@keyframes pulsarBeam {
  0%, 100% { opacity: 0;   }
  10%, 25% { opacity: 0.8; }
  40%      { opacity: 0;   }
}

@keyframes nebulaFloat {
  0%, 100% { transform: translate(var(--tx, 0), var(--ty, 0)) scale(1);    }
  50%       { transform: translate(var(--tx, 0), var(--ty, 0)) scale(1.08); }
}

@keyframes binaryOrbitA {
  0%   { transform: translate(-22px, 0) rotate(0deg);   }
  100% { transform: translate(-22px, 0) rotate(360deg); }
}
@keyframes binaryOrbitB {
  0%   { transform: translate(22px, 0) rotate(0deg);    }
  100% { transform: translate(22px, 0) rotate(-360deg); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-18px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0);     }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0);    }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ══════════════════════════════════════════════
   CUSTOM CURSOR
══════════════════════════════════════════════ */
#cursor {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: screen;
}

#cursor-dot {
  width: 6px; height: 6px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease, background 0.3s ease;
}

#cursor-ring {
  width: 30px; height: 30px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 50%;
  position: absolute;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease, border-color 0.4s ease, opacity 0.4s ease;
}

/* cursor expands near portals (class toggled in JS) */
#cursor.near-portal #cursor-ring {
  width: 52px; height: 52px;
  border-color: rgba(255,255,255,0.7);
}

/* ══════════════════════════════════════════════
   PLACEHOLDER PAGE STYLES (shared by sub-pages)
══════════════════════════════════════════════ */
.page-body {
  min-height: 100vh;
  background: var(--deep-space);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  padding: 40px 20px;
  text-align: center;
}

.page-back {
  position: fixed;
  top: 30px; left: 30px;
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.3s;
}
.page-back:hover { color: var(--star-white); }

.page-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(2.5rem, 7vw, 5rem);
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}

.page-sub {
  font-weight: 100;
  font-size: 0.7rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 60px;
}

.page-coming {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-dim);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 30px 60px;
  border-radius: 2px;
  letter-spacing: 0.2em;
}

/* Stars canvas on sub-pages */
.sub-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
}
.page-content {
  position: relative;
  z-index: 1;
}

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --portal-size:   80px;
    --ring-size:     120px;
    --label-offset:  60px;
  }

  .portal-name { font-size: 0.85rem; }
  .portal-desc { font-size: 0.45rem; }

  /* Labels below on mobile */
  #portal-philosophy .portal-label,
  #portal-projects   .portal-label,
  #portal-photography .portal-label,
  #portal-journal    .portal-label {
    left: 50%;
    right: auto;
    text-align: center;
    transform: translateX(-50%);
    top: calc(100% + 12px);
    bottom: auto;
  }

  /* hide large ring */
  .ring-3 { display: none; }

  #siteFooter { display: none; }
}
