/* ================================================
   Darthmichael.com — Visual Design Overhaul v20260525a
   Palette: deep sky / coral accents / warm cream
   Typography: Playfair Display (headings) + Inter (body)
   ================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* --- Design Tokens --- */
:root {
  --bg-primary:       #0a0a1a;
  --bg-secondary:     #0e0e24;
  --bg-card:          #111128;
  --bg-card-hover:    #16163a;
  --text-primary:     #e8e8f0;
  --text-secondary:   #9898b8;
  --text-muted:       #6a6a8a;
  --accent-1:         #6366f1;
  --accent-2:         #06b6d4;
  --accent-3:         #a855f7;
  --gradient-hero:    linear-gradient(135deg, #6366f1 0%, #06b6d4 50%, #a855f7 100%);
  --gradient-card:    linear-gradient(135deg, rgba(99,102,241,0.12) 0%, rgba(6,182,212,0.08) 100%);
  --shadow-sm:        0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:        0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg:        0 8px 40px rgba(0,0,0,0.5);
  --border-color:     rgba(255,255,255,0.06);
  --border-hover:     rgba(99,102,241,0.3);
  --nav-blur:         rgba(10,10,26,0.85);
  --max-content:      900px;
  --max-cards:        1200px;
}

/* --- Base Reset --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.page-loaded {
  opacity: 1;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: clamp(2.2rem, 6vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 1rem; }
h3 { font-size: clamp(1.2rem, 3vw, 1.6rem); margin-bottom: 0.75rem; }

p {
  margin-bottom: 1.1rem;
  color: var(--text-secondary);
  font-weight: 300;
  font-size: 1.05rem;
}

a {
  color: var(--accent-2);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-1);
}

/* ================================================
   ANIMATED HERO
   ================================================ */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding: 80px 20px 60px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(99,102,241,0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(6,182,212,0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(168,85,247,0.10) 0%, transparent 50%);
  z-index: 0;
}

.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255,255,255,0.015) 2px,
      rgba(255,255,255,0.015) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(255,255,255,0.015) 2px,
      rgba(255,255,255,0.015) 4px
    );
  mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 70%);
}

.hero-mesh {
  position: absolute;
  inset: -50%;
  z-index: 0;
  background:
    conic-gradient(from 0deg at 50% 50%, transparent 0deg, rgba(99,102,241,0.06) 60deg, transparent 120deg),
    conic-gradient(from 120deg at 50% 50%, transparent 0deg, rgba(6,182,212,0.05) 60deg, transparent 120deg),
    conic-gradient(from 240deg at 50% 50%, transparent 0deg, rgba(168,85,247,0.05) 60deg, transparent 120deg);
  animation: meshRotate 30s linear infinite;
  filter: blur(40px);
}

@keyframes meshRotate {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero h1 {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 700;
  letter-spacing: -2px;
  margin-bottom: 0.5rem;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: heroFadeIn 1.2s ease-out;
}

.hero .tagline {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--text-secondary);
  font-weight: 300;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 2rem;
  animation: heroFadeIn 1.2s ease-out 0.3s both;
}

.hero .hero-description {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.8;
  animation: heroFadeIn 1.2s ease-out 0.5s both;
}

.hero-scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  width: 24px;
  height: 40px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  animation: heroFadeIn 1.2s ease-out 0.8s both;
}

.hero-scroll-indicator::after {
  content: '';
  width: 3px;
  height: 10px;
  background: var(--accent-1);
  border-radius: 2px;
  margin-top: 8px;
  animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(8px); opacity: 0.3; }
}

@keyframes heroFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================
   STICKY NAV — Glass Morphism
   ================================================ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 28px;
  padding: 14px 20px;
  background: var(--nav-blur);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  transition: border-color 0.3s ease;
}

nav a {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  padding: 6px 16px;
  border-radius: 8px;
  transition: all 0.25s ease;
  position: relative;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: var(--gradient-hero);
  border-radius: 2px;
  transition: transform 0.25s ease;
}

nav a:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}

nav a.active {
  color: #fff;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.25);
}

nav a.active::after {
  transform: translateX(-50%) scaleX(1);
}

/* ================================================
   CONTENT WRAPPER
   ================================================ */
.content-wrapper {
  flex: 1;
  width: 100%;
  max-width: var(--max-cards);
  margin: 0 auto;
  padding: 0 24px 60px;
}

.content-wrapper.narrow {
  max-width: var(--max-content);
}

/* ================================================
   PAGE HEADER
   ================================================ */
.page-header {
  text-align: center;
  padding: 60px 20px 30px;
  position: relative;
}

.page-header h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  margin-bottom: 0.5rem;
}

.page-header .page-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 300;
}

/* ================================================
   TOPIC CARDS (Homepage)
   ================================================ */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 40px 0;
}

.topic-card {
  display: flex;
  flex-direction: column;
  padding: 32px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.35s ease;
  position: relative;
  overflow: hidden;
}

.topic-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-hero);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.topic-card:hover::before {
  transform: scaleX(1);
}

.topic-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.topic-card .card-icon {
  font-size: 2.2rem;
  margin-bottom: 16px;
}

.topic-card h3 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1.2rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.topic-card p {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 0;
  line-height: 1.6;
}

.topic-card .card-arrow {
  margin-top: auto;
  align-self: flex-end;
  font-size: 1.2rem;
  color: var(--accent-2);
  opacity: 0;
  transform: translateX(-8px);
  transition: all 0.3s ease;
}

.topic-card:hover .card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ================================================
   BLOG SECTION — Empty State
   ================================================ */
.blog-section {
  padding: 40px 0;
}

.blog-section h2 {
  text-align: center;
  margin-bottom: 2rem;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.blog-card-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-card);
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 16px;
  color: var(--text-muted);
}

.blog-card-empty .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.blog-card-empty h4 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.blog-card-empty p {
  font-size: 0.88rem;
  margin-bottom: 0;
}

/* ================================================
   ARTICLE STYLES (Topic Pages)
   ================================================ */
.article-section {
  padding: 40px 0;
}

.article-section h2 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  position: relative;
  padding-bottom: 12px;
  margin-bottom: 1.5rem;
}

.article-section h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--gradient-hero);
  border-radius: 3px;
}

.article-section p {
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 1.2rem;
}

/* Drop Cap */
.drop-cap::first-letter {
  float: left;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 3.5rem;
  line-height: 0.85;
  padding-right: 10px;
  padding-top: 4px;
  color: var(--accent-1);
  font-weight: 700;
}

/* Pull Quote */
.pull-quote {
  margin: 2rem 0;
  padding: 24px 32px;
  border-left: 3px solid var(--accent-2);
  background: linear-gradient(135deg, rgba(6,182,212,0.06) 0%, transparent 100%);
  border-radius: 0 12px 12px 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 1.2rem;
  color: var(--text-primary);
  line-height: 1.6;
}

.pull-quote .quote-attribution {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: normal;
  font-family: 'Inter', sans-serif;
}

/* ================================================
   IMAGE HANDLING
   ================================================ */
.image-wrapper {
  margin: 28px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.3s ease;
}

.image-wrapper:hover {
  box-shadow: var(--shadow-lg);
}

.image-wrapper img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.45s ease;
  border-radius: 12px;
  cursor: pointer;
}

.image-wrapper:hover img {
  transform: scale(1.03);
}

.image-wrapper .image-caption {
  padding: 12px 16px;
  background: var(--bg-card);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border-color);
}

/* --- Image Gallery (3-wide grid) --- */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 28px 0;
}

.gallery-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}

.gallery-item .responsive-img {
  margin: 0;
  border-radius: 0;
  width: 100%;
  height: 200px;
  object-fit: cover;
  cursor: pointer;
}

.gallery-item:hover .responsive-img {
  transform: scale(1.03);
}

.gallery-item .image-caption {
  padding: 10px 12px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
  background: none;
  border: none;
}

@media (max-width: 768px) {
  .image-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .image-gallery {
    grid-template-columns: 1fr;
  }
  .gallery-item .responsive-img {
    height: 180px;
  }
}

/* ================================================
   LIGHTBOX
   ================================================ */
.lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  justify-content: center;
  align-items: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.lightbox.active {
  display: flex;
}

.lightbox-content {
  max-width: 92vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.6);
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 2.8rem;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: color 0.2s ease;
  line-height: 1;
  z-index: 10000;
}

.lightbox-close:hover {
  color: #fff;
}

/* Placeholder Image */
.image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  background: linear-gradient(135deg, rgba(99,102,241,0.12) 0%, rgba(6,182,212,0.08) 50%, rgba(168,85,247,0.06) 100%);
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,0.1);
  margin: 28px 0;
}

.image-placeholder .placeholder-icon {
  font-size: 3rem;
  opacity: 0.4;
  margin-bottom: 12px;
}

.image-placeholder .placeholder-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 300;
}

/* Two-column image layout */
.image-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 28px 0;
}

@media (max-width: 600px) {
  .image-row {
    grid-template-columns: 1fr;
  }
}

/* ================================================
   SECTION REVEAL ANIMATIONS
   ================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  animation: sectionReveal 0.8s ease forwards;
}

.reveal:nth-child(2) { animation-delay: 0.1s; }
.reveal:nth-child(3) { animation-delay: 0.2s; }
.reveal:nth-child(4) { animation-delay: 0.3s; }
.reveal:nth-child(5) { animation-delay: 0.4s; }
.reveal:nth-child(6) { animation-delay: 0.5s; }

@keyframes sectionReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================================================
   DIVIDER
   ================================================ */
.divider {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
  margin: 40px auto;
  max-width: 600px;
}

/* ================================================
   FOOTER
   ================================================ */
footer {
  background: var(--bg-secondary);
  padding: 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
  position: relative;
}

footer .footer-accent {
  height: 3px;
  background: var(--gradient-hero);
}

footer .footer-content {
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

footer .footer-content p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer .back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-2);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

footer .back-to-top:hover {
  color: var(--accent-1);
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 768px) {
  .hero {
    min-height: 80vh;
    padding: 100px 16px 40px;
  }

  nav {
    gap: 6px 12px;
    padding: 10px 12px;
  }

  nav a {
    font-size: 0.82rem;
    padding: 5px 10px;
  }

  .content-wrapper {
    padding: 0 16px 40px;
  }

  .topic-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .topic-card {
    padding: 24px 20px;
  }

  .blog-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    padding: 40px 16px 20px;
  }

  .article-section {
    padding: 24px 0;
  }

  .pull-quote {
    padding: 16px 20px;
    font-size: 1.05rem;
  }

  footer .footer-content {
    padding: 24px 16px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 2.8rem;
  }

  nav {
    gap: 4px 8px;
    padding: 8px 8px;
  }

  nav a {
    font-size: 0.75rem;
    padding: 4px 8px;
    letter-spacing: 0.3px;
  }

  .content-wrapper {
    padding: 0 12px 32px;
  }

  .topic-card {
    padding: 20px 16px;
  }
}