/* ============================================
   ETHEREAL DARK-MODE PALETTE & CSS VARIABLES
   ============================================ */

:root {
  /* Color Palette */
  --void: #011627;           /* Ink Black - primary background */
  --void-light: #021b2e;     /* Slightly lighter Ink for secondary surfaces */
  --void-lighter: #03233a;   /* Even lighter for tertiary surfaces */
  --cerulean: #0097c4;       /* Primary accent - cerulean blue */
  --amber: #ff9f1c;          /* Warm accent - gold/orange */
  --ember: #0077a8;          /* Secondary accent - deep cerulean (rare use) */
  --light: #f5f9ff;          /* Alice Blue - primary text */

  /* Derived Glow Color Stops - Cerulean */
  --cerulean-glow-subtle: rgba(0, 151, 196, 0.08);
  --cerulean-glow-soft: rgba(0, 151, 196, 0.15);
  --cerulean-glow-mid: rgba(0, 151, 196, 0.35);
  --cerulean-glow-strong: rgba(0, 151, 196, 0.45);
  --cerulean-glow-intense: rgba(0, 151, 196, 0.6);

  /* Derived Glow Color Stops - Amber */
  --amber-glow-soft: rgba(255, 159, 28, 0.3);
  --amber-glow-strong: rgba(255, 159, 28, 0.6);

  /* Derived Glow Color Stops - Text/Border */
  --light-muted: rgba(245, 249, 255, 0.6);
  --light-dim: rgba(245, 249, 255, 0.4);
  --cerulean-border: rgba(0, 151, 196, 0.25);
  --cerulean-border-light: rgba(0, 151, 196, 0.35);
}

/* ============================================
   BASE HTML/BODY SETUP - DARK ONLY
   ============================================ */

html {
  color-scheme: dark;
}

html, body {
  background-color: var(--void);
  color: var(--light);
}

body {
  font-family: 'Space Grotesk', sans-serif;
  /* Cosmic radial gradient background */
  background-image: radial-gradient(
    circle at 50% 30%,
    var(--cerulean-glow-soft),
    transparent 60%
  );
  background-attachment: fixed;
  position: relative;
}

/* Geometric grid overlay - subtle triangular pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      60deg,
      transparent,
      transparent 40px,
      rgba(0, 151, 196, 0.05) 41px
    ),
    repeating-linear-gradient(
      -60deg,
      transparent,
      transparent 40px,
      rgba(0, 151, 196, 0.05) 41px
    );
  pointer-events: none;
  z-index: 0;
}

/* Ensure content sits above the background layers */
main, header, footer {
  position: relative;
  z-index: 1;
}

/* ============================================
   TYPOGRAPHY IMPROVEMENTS
   ============================================ */

h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  font-weight: 700;
}

h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  line-height: 1.3;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

p {
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.75;
  margin-bottom: 1em;
}

li {
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.75;
  margin-bottom: 0.5em;
}

/* ============================================
   BORDER & BASE ELEMENT COLORS
   ============================================ */

.border {
  border-color: var(--cerulean-border);
}

/* ============================================
   GLOW TEXT EFFECT
   ============================================ */

.glow-text {
  color: var(--light);
  text-shadow:
    0 0 6px var(--cerulean-glow-strong),
    0 0 14px var(--cerulean-glow-strong),
    0 0 28px var(--cerulean-glow-mid);
}

/* Apply glow to section headings */
h2 {
  text-shadow: 0 0 10px var(--cerulean-glow-soft), 0 0 20px var(--cerulean-glow-subtle);
}

/* ============================================
   PAGE TITLE CARD
   Backing card for the top-level page heading
   ============================================ */

.page-title-card {
  background: rgba(0, 151, 196, 0.06);
  border: 1px solid var(--cerulean-border-light);
  border-left: 4px solid var(--cerulean);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  box-shadow:
    inset 0 1px 0 rgba(245, 249, 255, 0.06),
    0 0 30px var(--cerulean-glow-soft);
}

/* ============================================
   SACRED CARD - GLASSMORPHIC CONTAINER
   ============================================ */

/* Glass panel: lower opacity so backdrop-filter blur reads as frosted glass */
.sacred-card {
  background: rgba(1, 22, 39, 0.38);
  border: 1px solid var(--cerulean-border-light);
  /* Top-edge specular highlight reinforces the glass illusion */
  border-top-color: rgba(0, 151, 196, 0.5);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow:
    inset 0 1px 0 rgba(245, 249, 255, 0.07),
    inset 0 0 40px var(--cerulean-glow-subtle),
    0 0 30px var(--cerulean-glow-soft);
  border-radius: 14px;
  transition: all 0.3s ease-in-out;
  backface-visibility: hidden;
  will-change: transform;
  /* Ensure card renders above the wrapper's ambient glow layer */
  position: relative;
  z-index: 1;
}

.sacred-card:hover {
  box-shadow:
    inset 0 1px 0 rgba(245, 249, 255, 0.1),
    inset 0 0 40px var(--cerulean-glow-subtle),
    0 0 50px var(--cerulean-glow-mid),
    0 0 80px var(--cerulean-glow-soft);
  border-color: rgba(255, 159, 28, 0.4);
  border-top-color: rgba(255, 159, 28, 0.55);
}

/* Geometric curve pattern overlay for cards */
.sacred-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  background-image: 
    repeating-radial-gradient(
      circle at 0 0, 
      transparent 0, 
      rgba(0, 151, 196, 0.06) 14px, 
      transparent 15px, 
      transparent 30px
    ),
    repeating-radial-gradient(
      circle at 100% 0, 
      transparent 0, 
      rgba(0, 151, 196, 0.06) 14px, 
      transparent 15px, 
      transparent 30px
    ),
    repeating-radial-gradient(
      circle at 0 100%, 
      transparent 0, 
      rgba(0, 151, 196, 0.06) 14px, 
      transparent 15px, 
      transparent 30px
    ),
    repeating-radial-gradient(
      circle at 100% 100%, 
      transparent 0, 
      rgba(0, 151, 196, 0.06) 14px, 
      transparent 15px, 
      transparent 30px
    );
  /* Fade the pattern slightly towards the center to keep text highly readable */
  -webkit-mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,0.1) 0%, rgba(0,0,0,1) 80%);
  mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,0.1) 0%, rgba(0,0,0,1) 80%);
}

/* .skills-glow-card is now a plain style pass-through;            */
/* the ambient outer halo lives on the .card-glow-wrapper instead. */
.skills-glow-card {
  position: relative;
}

/* ============================================
   CARD GLOW WRAPPER
   Sits outside the backdrop-filter stacking
   context so the halo is never clipped or
   buried behind the card's own background.
   ============================================ */

.card-glow-wrapper {
  position: relative;
  border-radius: 28px;
  border: 1px solid var(--cerulean-border);
  /* background: radial-gradient(circle at 50% 55%, rgba(0, 151, 196, 0.5), transparent 94%); */
  background: radial-gradient(circle at 50% 55%, rgba(0, 151, 196, 0.5), transparent 84%);
}

/* Ambient halo — softly visible at rest, stronger on hover */
.card-glow-wrapper::before {
  content: '';
  position: absolute;
  inset: -20px;
  border-radius: 28px;
  background: radial-gradient(circle at 50% 50%, var(--cerulean-glow-mid), transparent 68%);
  filter: blur(24px);
  opacity: 0.3;
  pointer-events: none;
  /* z-index: 0 keeps it below .sacred-card (z-index: 1) */
  z-index: 0;
  transition: opacity 0.35s ease-in-out, filter 0.35s ease-in-out;
}

.card-glow-wrapper:hover::before {
  opacity: 0.65;
  filter: blur(30px);
}

/* ============================================
   AMBER ACCENT NODES
   ============================================ */

.node {
  width: 10px;
  height: 10px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow:
    0 0 6px var(--amber),
    0 0 18px var(--amber-glow-strong);
}

/* ============================================
   SMART IMAGE GLOW
   ============================================ */

.smart-glow {
  position: relative;
  display: inline-block;
  width: 100%;
}

.smart-glow img {
  display: block;
  width: 100%;
  height: auto;
  backdrop-filter: blur(15px) saturate(3);
  -webkit-backdrop-filter: blur(15px) saturate(3);
  padding: 20px;
  margin: -20px;
  backface-visibility: hidden;
  will-change: filter;
}

/* ============================================
   SPECULAR SCROLL OVERLAY
   ============================================ */

.specular-overlay::after {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 126, 167, 0.03) 25%,
    rgba(255, 159, 28, 0.02) 50%,
    rgba(0, 126, 167, 0.03) 75%,
    transparent 100%
  );
  background-attachment: fixed;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 0;
}

/* ============================================
   PROSE/BLOG CONTENT STYLING
   ============================================ */

.prose {
  --tw-prose-body: var(--light);
  --tw-prose-headings: var(--light);
  --tw-prose-links: var(--cerulean);
  --tw-prose-code: var(--amber);
  --tw-prose-pre-bg: rgba(1, 22, 39, 0.8);
}

.prose a {
  transition: all 0.3s ease-in-out;
  text-decoration: underline;
  text-decoration-color: var(--cerulean);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.prose a:hover {
  text-shadow: 0 0 8px var(--cerulean-glow-strong);
  text-decoration-color: var(--amber);
}

.prose code {
  background: rgba(1, 22, 39, 0.8);
  border: 1px solid var(--cerulean-border);
  border-radius: 4px;
  padding: 0.25em 0.5em;
  font-weight: 500;
}

.prose pre {
  background: rgba(1, 22, 39, 0.8);
  border: 1px solid var(--cerulean-border-light);
  border-radius: 8px;
  padding: 1em;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--light);
}

.prose blockquote {
  border-left: 4px solid var(--cerulean);
  color: var(--light-muted);
  font-style: italic;
  padding-left: 1rem;
}

/* ============================================
   PROSE HEADING HIERARCHY
   Left-border accents + spacing create a clear
   visual level structure without card clutter.
   h1 = in-content #    (largest, cerulean bar)
   h2 = primary ##      (cerulean bar, divider)
   h3 = sub-section ### (amber bar, indented)
   h4 = detail ####     (muted, small-caps)
   ============================================ */

/* # — largest in-content heading */
.prose h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  border-left: 4px solid var(--cerulean);
  padding-left: 0.85em;
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  text-shadow:
    0 0 10px var(--cerulean-glow-mid),
    0 0 22px var(--cerulean-glow-soft);
}

.prose h1::before {
  content: '';
  display: block;
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, var(--cerulean-border-light), transparent);
  margin-bottom: 0.75rem;
}

/* ## — primary section */
.prose h2 {
  font-size: clamp(1.35rem, 2.75vw, 1.9rem);
  font-weight: 700;
  line-height: 1.25;
  /* Strong cerulean left bar — marks a new top-level section */
  border-left: 4px solid var(--cerulean);
  padding-left: 0.85em;
  padding-top: 0;
  padding-bottom: 0;
  /* Clear section break above */
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  background: none;
  border-radius: 0;
  box-shadow: none;
  text-shadow:
    0 0 10px var(--cerulean-glow-mid),
    0 0 22px var(--cerulean-glow-soft);
}

/* Thin divider line above each h2 to visually cut sections */
.prose h2::before {
  content: '';
  display: block;
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, var(--cerulean-border-light), transparent);
  margin-bottom: 0.75rem;
}

/* ### — sub-section */
.prose h3 {
  font-size: clamp(1.1rem, 2.25vw, 1.45rem);
  font-weight: 600;
  line-height: 1.3;
  /* Amber left bar, thinner + indented → child of h2 */
  border-left: 2px solid var(--amber);
  padding-left: 0.75em;
  margin-left: 1rem;
  margin-top: 2rem;
  margin-bottom: 0.9rem;
  background: none;
  border-radius: 0;
  box-shadow: none;
  text-shadow: 0 0 8px rgba(255, 159, 28, 0.35);
  color: var(--light);
}

/* #### — detail */
.prose h4 {
  font-size: 0.85em;
  font-weight: 600;
  line-height: 1.4;
  /* No bar — just muted color, more indented */
  margin-left: 2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  color: var(--light-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Increase inter-element gap when a heading follows other content */
.prose > * + h1 { margin-top: 3.5rem; }
.prose > * + h2 { margin-top: 3.5rem; }
.prose > * + h3 { margin-top: 2.25rem; }
.prose > * + h4 { margin-top: 1.75rem; }

/* Wrap the content after headings in a visual section card via a
   container applied on the prose block itself */
.prose > p,
.prose > ul,
.prose > ol,
.prose > blockquote,
.prose > pre,
.prose > table {
  background: rgba(1, 22, 39, 0.3);
  border: 1px solid rgba(0, 151, 196, 0.12);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Keep code blocks' own darker background intact */
.prose > pre {
  background: rgba(1, 22, 39, 0.8);
  border-color: var(--cerulean-border-light);
  padding: 1em;
}

/* Lists need a bit more left room since they have item markers */
.prose > ul,
.prose > ol {
  padding-left: 2rem;
}

/* Tables should not double-pad */
.prose > table {
  padding: 0;
  overflow: hidden;
}

/* ============================================
   CAROUSEL & TECH STACK
   ============================================ */

.tech-carousel {
  width: 100%;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.carousel-container {
  width: 100%;
  overflow: hidden;
  margin-bottom: 0.5rem;
  border-bottom: 2px solid var(--cerulean-border);
  padding-bottom: 0.5rem;
}

.carousel-track,
.carousel-track-reverse {
  display: flex;
  width: fit-content;
}

.carousel-track {
  animation: scroll 45s linear infinite;
}

.carousel-track-left-to-right {
  animation: scroll-left-to-right 60s linear infinite;
}

.carousel-track-reverse {
  animation: scroll-reverse 45s linear infinite;
}

.carousel-item {
  display: flex;
  align-items: center;
  width: auto;
  padding: 0.75rem 0.5rem;
  margin: 0 0.1rem;
  border-radius: 0.5rem;
  white-space: nowrap;
  gap: 0.5rem;
  color: var(--light);
  transition: all 0.3s ease;
}

.carousel-item:hover {
  text-shadow: 0 0 10px var(--cerulean-glow-soft);
  transform: scale(1.05);
}

.carousel-item i {
  font-size: 2.25rem;
  filter: drop-shadow(0 0 6px var(--cerulean-glow-soft));
}

.carousel-item span {
  font-size: 1.25rem;
  font-weight: 500;
}

.carousel-container:hover .carousel-track,
.carousel-container:hover .carousel-track-reverse,
.carousel-container:hover .carousel-track-left-to-right {
  animation-play-state: paused;
}

@keyframes scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(calc(-100% / 2));
  }
}

@keyframes scroll-left-to-right {
  0% {
    transform: translateX(calc(-100% / 2));
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes scroll-reverse {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(calc(-100% / 2));
  }
}

/* ============================================
   PROJECT CARDS
   ============================================ */

.project-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(to bottom right, rgba(30, 41, 59, 0.5), rgba(30, 41, 59, 0.8));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--cerulean-border);
  border-radius: 12px;
  overflow: hidden;
  backface-visibility: hidden;
  will-change: transform;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.4), 0 0 40px var(--cerulean-glow-mid);
  border-color: var(--amber);
}

.aspect-w-16 {
  position: relative;
  padding-bottom: 56.25%;
}

.aspect-w-16 > img {
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  object-fit: cover;
  filter: saturate(1.1) contrast(1.1);
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-4 {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   TIMELINE STYLING
   ============================================ */

.timeline-line {
  background-color: var(--cerulean-border);
}

.timeline-dot {
  background-color: var(--void);
  border: 2px solid var(--cerulean);
  box-shadow: 0 0 12px var(--cerulean-glow-soft);
}

.timeline-dot.highlight {
  background-color: var(--cerulean);
  box-shadow: 0 0 20px var(--cerulean-glow-strong);
}

/* ============================================
   FOOTER STYLING
   ============================================ */

footer {
  background: linear-gradient(to bottom, transparent, rgba(1, 22, 39, 0.8));
  border-top: 1px solid var(--cerulean-border);
  box-shadow: 0 -1px 20px var(--cerulean-glow-soft);
}

.animated-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--cerulean);
  transition: all 0.3s ease-in-out;
}

.animated-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -3px;
  left: 0;
  background: linear-gradient(to right, var(--cerulean), var(--amber));
  box-shadow: 0 0 8px var(--cerulean-glow-soft);
  transition: width 0.3s ease-in-out;
}

.animated-link:hover {
  text-shadow: 0 0 8px var(--cerulean-glow-strong);
  color: var(--light);
}

.animated-link:hover::after {
  width: 100%;
}

/* ============================================
   TOASTER NOTIFICATIONS
   ============================================ */

.toaster {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(1, 22, 39, 0.95);
  border: 1px solid var(--cerulean-border-light);
  color: var(--light);
  padding: 12px 24px;
  border-radius: 8px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  box-shadow: 0 0 30px var(--cerulean-glow-soft);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.toaster.show {
  opacity: 1;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
  .project-card {
    margin: 0 1rem;
  }

  .aspect-w-16 {
    padding-bottom: 75%;
  }

  /* Reduce backdrop-filter complexity on mobile for perf */
  .sacred-card {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .smart-glow img {
    backdrop-filter: blur(10px) saturate(2);
    -webkit-backdrop-filter: blur(10px) saturate(2);
  }
}

/* ============================================
   UTILITY: FORCE GPU RENDERING
   ============================================ */

.gpu-accelerate {
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   PROSE DARK MODE FALLBACK
   ============================================ */

.prose-dark {
  --tw-prose-body: var(--light);
  --tw-prose-headings: var(--light);
  --tw-prose-quotes: var(--light-muted);
  --tw-prose-code: var(--amber);
  --tw-prose-pre-bg: rgba(1, 22, 39, 0.9);
  --tw-prose-pre-code: var(--light);
  --tw-prose-links: var(--cerulean);
}
