/* ═══════════════════════════════════════════════════════
   Castiel's Website — Deep Space + Bioluminescent Ocean
   ═══════════════════════════════════════════════════════ */

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

:root {
  --bg:          #0a1a2e;
  --bg2:         #0d2240;
  --bg3:         #102a50;
  --teal:        #00bcd4;
  --aqua:        #7fffd4;
  --sky:         #87ceeb;
  --cornflower:  #6495ed;
  --text:        #d0eaf7;
  --text-muted:  #7aa8c8;
  --glow-teal:   0 0 12px #00bcd4, 0 0 30px rgba(0,188,212,0.3);
  --glow-aqua:   0 0 12px #7fffd4, 0 0 30px rgba(127,255,212,0.25);
  --card-bg:     rgba(13,34,64,0.85);
  --card-border: rgba(0,188,212,0.25);
  --radius:      12px;
  --font-main:   'Segoe UI', system-ui, sans-serif;
  --font-mono:   'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-main);
  line-height: 1.65;
  overflow-x: hidden;
}

/* ── Nav ────────────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(10,26,46,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 24px;
  height: 52px;
}

nav .nav-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--aqua);
  text-shadow: var(--glow-aqua);
  margin-right: auto;
  letter-spacing: 0.04em;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0 14px;
  height: 52px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
nav a:hover { color: var(--aqua); }

/* ── Section Helpers ────────────────────────────────────── */
section {
  padding: 80px 24px 60px;
  max-width: 960px;
  margin: 0 auto;
}

section + section { border-top: 1px solid var(--card-border); }

.section-label {
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 8px;
}

.section-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--aqua);
  text-shadow: var(--glow-aqua);
  margin-bottom: 20px;
}

.section-body {
  color: var(--text-muted);
  max-width: 680px;
  font-size: 1.02rem;
  margin-bottom: 32px;
}

/* ── Hero ───────────────────────────────────────────────── */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  max-width: 100%;
  overflow: hidden;
}

#starfield {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 24px;
}

.hero-greeting {
  font-size: 1.1rem;
  color: var(--teal);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hero-name {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 900;
  background: linear-gradient(135deg, var(--teal) 0%, var(--aqua) 40%, var(--cornflower) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}

.hero-tagline {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--sky);
  margin-bottom: 32px;
}

.hero-infinity {
  display: inline-block;
  font-size: 3.5rem;
  background: linear-gradient(90deg,
    #f87 0%, #fc7 15%, #ff7 30%, #7f7 45%,
    #7ff 60%, #77f 75%, #f7f 90%, #f87 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(127,255,212,0.4));
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

.hero-scroll {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  animation: fadeInUp 2s ease 1.5s both;
}

.scroll-arrow {
  width: 20px; height: 20px;
  border-right: 2px solid var(--teal);
  border-bottom: 2px solid var(--teal);
  transform: rotate(45deg);
  animation: scrollBounce 1.8s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.5; }
  50%       { transform: rotate(45deg) translateY(5px); opacity: 1; }
}

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

.hero-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 24px;
}

.chip {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: rgba(0,188,212,0.08);
  color: var(--teal);
  font-size: 0.88rem;
  transition: border-color 0.2s, background 0.2s;
}
.chip:hover {
  border-color: var(--teal);
  background: rgba(0,188,212,0.15);
}

/* ── Interest Cards ─────────────────────────────────────── */
.interest-intro {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.interest-icon {
  font-size: 3.2rem;
  line-height: 1;
  flex-shrink: 0;
}

/* ── Music Section ─────────────────────────────────────── */
.music-instruments {
  display: flex;
  gap: 16px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.instrument-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.instrument-badge::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,188,212,0.06), transparent);
}

.instrument-badge .badge-icon { font-size: 2rem; }
.instrument-badge .badge-name {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
}
.instrument-badge .badge-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.note-float {
  display: inline-block;
  animation: noteFloat 3s ease-in-out infinite;
  font-size: 1.4rem;
  margin: 0 4px;
}
.note-float:nth-child(2) { animation-delay: 0.5s; }
.note-float:nth-child(3) { animation-delay: 1.0s; }
.note-float:nth-child(4) { animation-delay: 1.5s; }

@keyframes noteFloat {
  0%, 100% { transform: translateY(0) rotate(-5deg); opacity: 0.7; }
  50%       { transform: translateY(-10px) rotate(5deg); opacity: 1; }
}

.compositions-heading {
  font-size: 1.05rem;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#music-player-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.audio-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.audio-card:hover {
  border-color: var(--teal);
  box-shadow: 0 0 18px rgba(0,188,212,0.12);
}

.audio-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.audio-icon { font-size: 1.6rem; }

.sheet-music-btn {
  margin-left: auto;
  font-size: 1.4rem;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.sheet-music-btn:hover { opacity: 1; transform: scale(1.15); }
.audio-title {
  font-weight: 600;
  color: var(--aqua);
  font-size: 1rem;
}
.audio-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.audio-card audio {
  width: 100%;
  accent-color: var(--teal);
  filter: hue-rotate(170deg) saturate(1.3) brightness(1.1);
}

.media-note, .media-error {
  color: var(--text-muted);
  font-style: italic;
  padding: 14px 0;
}
.media-error { color: #f87; }

/* ── Coding Section ─────────────────────────────────────── */
.coding-tools {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.tool-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  font-size: 0.92rem;
  transition: border-color 0.2s;
}
.tool-chip:hover { border-color: var(--teal); }
.tool-chip .tool-icon { font-size: 1.4rem; }

.code-viewer-wrap {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

#code-script-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 160px;
}

.script-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 16px;
  cursor: pointer;
  text-align: left;
  font-size: 0.9rem;
  transition: border-color 0.2s, background 0.2s;
}
.script-btn:hover  { border-color: var(--teal); background: rgba(0,188,212,0.08); }
.script-btn.active { border-color: var(--aqua); color: var(--aqua); background: rgba(127,255,212,0.07); }

#code-viewer {
  flex: 1;
  min-width: 280px;
  display: none;
}

.code-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

#code-viewer-title {
  font-weight: 600;
  color: var(--aqua);
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(0,188,212,0.1);
  border: 1px solid var(--teal);
  color: var(--teal);
  text-decoration: none;
  font-size: 0.82rem;
  transition: background 0.2s;
}
.download-btn:hover { background: rgba(0,188,212,0.2); }

#code-viewer-pre {
  border-radius: var(--radius);
  overflow: auto;
  max-height: 420px;
  font-size: 0.85rem;
  border: 1px solid var(--card-border);
}

/* Override Prism theme to match our palette */
#code-viewer-pre code[class*="language-"] {
  background: #071624 !important;
}
#code-viewer-pre pre[class*="language-"] {
  background: #071624 !important;
  margin: 0;
}

/* ── Math & Science Section ─────────────────────────────── */
.fractal-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.fractal-label {
  font-size: 0.84rem;
  color: var(--text-muted);
}

#mandelbrot {
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  cursor: crosshair;
  display: block;
  max-width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#mandelbrot:hover {
  border-color: var(--teal);
  box-shadow: var(--glow-teal);
}

.science-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.fact-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.2s, transform 0.2s;
}
.fact-card:hover {
  border-color: var(--aqua);
  transform: translateY(-3px);
}
.fact-card .fact-icon { font-size: 1.8rem; margin-bottom: 8px; }
.fact-card .fact-title {
  font-weight: 600;
  color: var(--aqua);
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.fact-card .fact-body {
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* ── Books Section ──────────────────────────────────────── */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.book-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  cursor: default;
}
.book-card:hover {
  border-color: var(--teal);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,188,212,0.12);
}
.book-cover {
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  border-radius: 6px;
}
.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.book-title {
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
}
.book-author {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.book-tag {
  font-size: 0.76rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0,188,212,0.1);
  border: 1px solid var(--card-border);
  color: var(--teal);
}

/* ── Movies Section ─────────────────────────────────────── */
.movies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.movie-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  cursor: default;
}
.movie-card:hover {
  border-color: var(--teal);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,188,212,0.15);
}

.movie-poster {
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--bg3);
}
.movie-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.movie-card:hover .movie-poster img {
  transform: scale(1.04);
}

.movie-info {
  padding: 14px;
}
.movie-title {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.movie-year {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.movie-note {
  font-size: 0.8rem;
  color: var(--teal);
  font-style: italic;
}

/* ── Footer ─────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--card-border);
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-infinity {
  display: inline-block;
  font-size: 1.8rem;
  background: linear-gradient(90deg,
    #f87 0%, #fc7 14%, #ff7 28%, #7f7 43%,
    #7ff 57%, #77f 71%, #f7f 86%, #f87 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 100%;
  animation: rainbowSlide 4s linear infinite;
  vertical-align: middle;
}

@keyframes rainbowSlide {
  0%   { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

.footer-made {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  nav a { padding: 0 8px; font-size: 0.78rem; }
  .code-viewer-wrap { flex-direction: column; }
  #code-script-list { flex-direction: row; flex-wrap: wrap; }
}

/* ── Scroll-reveal fade-in ──────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
