/* =====================================================
   Meherun Nesa Riya — Personal Website Styles
   ===================================================== */

/* ─── CSS Custom Properties ─── */
:root {
  /* Colors */
  --bg:          #FFFAF7;
  --bg-alt:      #F8F2EE;
  --bg-dark:     #2A1F3D;
  --dark:        #2A1F3D;
  --dark-2:      #3D2E5C;
  --text:        #3A3050;
  --text-light:  #6B5F7D;
  --text-muted:  #6B6285;   /* darkened for WCAG AA contrast on light bg */

  /* Accent palette */
  --terracotta:  #C4875A;
  --purple:      #8A5BAE;
  --teal:        #5B9BA8;
  --gold:        #D4A855;
  --rose:        #D47B8F;
  --sage:        #7BAA8A;
  --lavender:    #B9A4D8;
  --cream:       #F5E4D2;

  /* Borders & Shadows */
  --border:      #E8DDD4;
  --shadow-sm:   0 2px 8px rgba(42, 31, 61, 0.08);
  --shadow-md:   0 8px 32px rgba(42, 31, 61, 0.12);
  --shadow-lg:   0 20px 60px rgba(42, 31, 61, 0.16);

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-script:  'Dancing Script', cursive;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  /* Spacing */
  --section-py:  100px;
  --container:   1200px;
  --nav-h:       72px;

  /* Transitions */
  --ease:        cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Dark Mode — Pitch Black Galaxy Theme ─── */
[data-theme="dark"] {
  --bg:          #04040C;
  --bg-alt:      #08081A;
  --bg-dark:     #000006;
  --dark:        #F0EAF8;
  --dark-2:      #D8D0F0;
  --text:        #E0D8F0;
  --text-light:  #B0A8CC;
  --text-muted:  #827AA4;   /* sufficient contrast on near-black bg */

  --terracotta:  #E09A70;
  --purple:      #B88AE0;
  --teal:        #70C0CC;
  --gold:        #EAC860;
  --rose:        #EE98B4;
  --sage:        #90C8A0;
  --lavender:    #CCC0F0;
  --cream:       #10102A;

  --border:      #1C1838;
  --shadow-sm:   0 2px 8px rgba(0, 0, 5, 0.6);
  --shadow-md:   0 8px 32px rgba(0, 0, 5, 0.7);
  --shadow-lg:   0 20px 60px rgba(0, 0, 5, 0.8);
}

/* ─── Smooth theme transition ─── */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition:
    background-color 0.2s var(--ease),
    color            0.2s var(--ease),
    border-color     0.2s var(--ease),
    box-shadow       0.2s var(--ease) !important;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.preloading {
  overflow: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s var(--ease);
}

ul { list-style: none; }

button { cursor: pointer; border: none; background: none; font: inherit; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--lavender); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* ─── Selection ─── */
::selection { background: var(--lavender); color: var(--dark); }

/* =====================================================
   PRELOADER
   ===================================================== */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.8s var(--ease), visibility 0.8s var(--ease);
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#preloader-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.preloader-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.preloader-ring {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--cream);
  stroke-width: 4;
}

.ring-progress {
  fill: none;
  stroke: var(--gold);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 339.29;
  stroke-dashoffset: 339.29;
  transition: stroke-dashoffset 0.05s linear;
}

.preloader-initials {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: 0.1em;
  z-index: 1;
}

.preloader-name {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 600;
  color: var(--dark);
  letter-spacing: 0.05em;
  min-height: 2.5rem;
  text-align: center;
}

.preloader-tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* =====================================================
   CURSOR
   ===================================================== */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
}

.cursor-dot {
  width: 8px; height: 8px;
  background: var(--terracotta);
}

.cursor-ring {
  width: 36px; height: 36px;
  border: 2px solid var(--purple);
  opacity: 0.5;
  transition: width 0.3s var(--ease), height 0.3s var(--ease), opacity 0.3s;
}

.cursor-ring.hovered {
  width: 56px; height: 56px;
  opacity: 0.3;
}

@media (hover: none) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* =====================================================
   NAVIGATION
   ===================================================== */
#site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(255, 250, 247, 0.0);
  backdrop-filter: blur(0px);
  transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease), backdrop-filter 0.4s;
}

#site-header.scrolled {
  background: rgba(255, 250, 247, 0.95);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] #site-header.scrolled {
  background: rgba(4, 4, 12, 0.95);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 2rem;
  height: var(--nav-h);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
  transition: color 0.3s;
}

.nav-logo:hover { color: var(--purple); }

.logo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--terracotta);
  display: inline-block;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.7; }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-light);
  padding: 0.5rem 0.9rem;
  border-radius: 100px;
  position: relative;
  transition: color 0.3s, background 0.3s;
  letter-spacing: 0.02em;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 4px; left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 16px; height: 2px;
  background: var(--terracotta);
  border-radius: 2px;
  transition: transform 0.3s var(--ease);
}

.nav-link:hover,
.nav-link.active {
  color: var(--dark);
}

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

.hamburger {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-alt);
  padding: 0;
  z-index: 10;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease),
              transform 0.25s var(--ease-spring);
}

.hamburger:hover {
  border-color: var(--purple);
  transform: scale(1.08);
}

.hamburger span {
  display: block;
  width: 18px; height: 1.5px;
  background: var(--dark);
  border-radius: 2px;
  transition: transform 0.35s var(--ease-spring), opacity 0.25s var(--ease),
              background 0.25s var(--ease), width 0.25s var(--ease);
}

.hamburger.open {
  border-color: var(--purple);
  background: rgba(138, 91, 174, 0.08);
}

.hamburger.open span { background: var(--purple); }
.hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ─── Mobile Nav Overlay ─── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}

.nav-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ─── Mobile Nav Inner Header (close btn + title) ─── */
.mobile-nav-header {
  display: none;
}

/* ─── In-menu Theme Toggle (mobile only) ─── */
.nav-theme-item {
  display: none;
}

/* ─── Theme Toggle Button ─── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-light);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s var(--ease), color 0.3s var(--ease),
              border-color 0.3s var(--ease), transform 0.3s var(--ease-spring);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
  transform: rotate(20deg) scale(1.08);
}

/* icon visibility logic */
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }

.scroll-progress-bar {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--terracotta), var(--purple), var(--teal));
  width: 0;
  transition: width 0.1s linear;
}

/* =====================================================
   SECTIONS - Base
   ===================================================== */
.section {
  padding: var(--section-py) 0;
  position: relative;
  overflow: hidden;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 2rem;
}

.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 0.75rem;
  background: #C4875A14;
  padding: 0.4rem 1rem;
  border-radius: 100px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 700;
  color: var(--dark);
  line-height: 1.2;
  margin-bottom: 1rem;
}

.section-divider {
  width: 60px; height: 3px;
  border-radius: 2px;
  margin: 0 auto 1.5rem;
  background: var(--gold);
}

.section-desc {
  max-width: 600px;
  margin: 0 auto;
  color: var(--text-light);
  font-size: 1.05rem;
}

/* ─── Scroll reveal animations ─── */
.reveal-up,
.reveal-left,
.reveal-right {
  opacity: 0;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal-up     { transform: translateY(40px); }
.reveal-left   { transform: translateX(-40px); }
.reveal-right  { transform: translateX(40px); }

.reveal-up.visible,
.reveal-left.visible,
.reveal-right.visible {
  opacity: 1;
  transform: none;
}

.delay-1 { transition-delay: 0.15s !important; }
.delay-2 { transition-delay: 0.3s !important; }
.delay-3 { transition-delay: 0.45s !important; }
.delay-4 { transition-delay: 0.6s !important; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.8rem;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease), background 0.3s, color 0.3s;
  cursor: pointer;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: #8B5A2B;
  color: #fff;
  box-shadow: 0 4px 16px rgba(139, 90, 43, 0.35);
}

.btn-primary:hover {
  background: #7A4E23;
  box-shadow: 0 8px 24px rgba(139, 90, 43, 0.4);
  color: #fff;
}

[data-theme="dark"] .btn-primary {
  background: #8B5A2B;
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--dark);
  border: 2px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--purple);
  color: var(--purple);
  background: #8A5BAE0D;
}

.btn-full { width: 100%; justify-content: center; }

/* sub heading */
.sub-heading {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sub-heading i { color: var(--purple); }

/* =====================================================
   HERO SECTION
   ===================================================== */
.section-hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--nav-h) 2rem 4rem;
  background: var(--bg);
  position: relative;
}

#math-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 780px;
  margin: 0 auto;
}

.hero-greeting {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.hero-greeting i {
  color: var(--gold);
  font-size: 0.85em;
  animation: sparkle-spin 3s ease-in-out infinite;
}

@keyframes sparkle-spin {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.2); }
}

.hero-name {
  font-family: var(--font-display);
  font-size: clamp(3rem, 9vw, 6.5rem);
  font-weight: 700;
  line-height: 1.05;
  color: var(--dark);
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

.name-first {
  display: block;
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: initial;
  color: var(--dark);
}

.name-last {
  display: block;
  color: var(--purple);
  font-style: italic;
}

.hero-tagline {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: var(--text-light);
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.hero-institution {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--teal);
  font-weight: 500;
  background: #5B9BA810;
  padding: 0.4rem 1.2rem;
  border-radius: 100px;
  margin-bottom: 2.5rem;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Math decorative formulas */
.hero-math-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.math-formula {
  position: absolute;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-muted);
  opacity: 0.18;
  user-select: none;
  pointer-events: none;
  animation: float-formula linear infinite;
}

.formula-1 { font-size: clamp(1rem, 2.5vw, 1.6rem); top: 15%; left: 4%; animation-duration: 20s; animation-delay: 0s; }
.formula-2 { font-size: clamp(0.8rem, 1.8vw, 1.2rem); top: 72%; left: 3%; animation-duration: 25s; animation-delay: 5s; }
.formula-3 { font-size: clamp(1rem, 2.5vw, 1.6rem); top: 20%; right: 4%; animation-duration: 22s; animation-delay: 2s; }
.formula-4 { font-size: clamp(0.9rem, 2vw, 1.4rem); top: 75%; right: 5%; animation-duration: 18s; animation-delay: 8s; }

@keyframes float-formula {
  0%, 100% { transform: translateY(0px) rotate(-2deg); }
  33% { transform: translateY(-12px) rotate(1deg); }
  66% { transform: translateY(8px) rotate(-1.5deg); }
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2rem; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  z-index: 2;
  animation: bounce-down 2s ease-in-out infinite;
}

.scroll-text {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.scroll-arrow {
  color: var(--terracotta);
  font-size: 0.8rem;
}

@keyframes bounce-down {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

/* =====================================================
   ABOUT SECTION
   ===================================================== */
.section-about {
  background: var(--bg-alt);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 5rem;
  align-items: center;
  margin-bottom: 3rem;
}

.about-image-frame {
  position: relative;
  border-radius: 2rem;
  overflow: visible;
}

.about-image-placeholder {
  border-radius: 2rem;
  overflow: hidden;
  background: var(--cream);
  aspect-ratio: 4 / 5;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--border);
  position: relative;
}

.avatar-art {
  width: 80%;
  max-width: 200px;
  position: relative;
}

.avatar-svg {
  width: 100%;
  height: auto;
}

.avatar-math-ring {
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  border: 2px dashed var(--lavender);
  animation: spin-slow 30s linear infinite;
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.about-img-badge {
  position: absolute;
  bottom: -16px; right: -16px;
  width: 56px; height: 56px;
  background: var(--purple);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  border: 4px solid var(--bg-alt);
  box-shadow: var(--shadow-md);
  z-index: 2;
}

.about-intro {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--dark);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.about-text p {
  color: var(--text-light);
  margin-bottom: 1rem;
}

.about-quote {
  background: var(--bg);
  border-left: 4px solid var(--gold);
  border-radius: 0 1rem 1rem 0;
  padding: 1.2rem 1.5rem;
  margin: 1.5rem 0;
  position: relative;
}

.about-quote i {
  color: var(--gold);
  margin-right: 0.5rem;
  font-size: 1rem;
  opacity: 0.6;
}

.about-quote span {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--dark);
}

.about-quote cite {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: normal;
}

.about-stats {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.stat-card {
  text-align: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 1rem;
  padding: 1rem 1.4rem;
  flex: 1;
  min-width: 80px;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--terracotta);
  line-height: 1;
}

.stat-suffix {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--terracotta);
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.about-details {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  padding-top: 2rem;
  border-top: 1.5px solid var(--border);
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-light);
  background: var(--bg);
  padding: 0.5rem 1rem;
  border-radius: 100px;
  border: 1.5px solid var(--border);
}

.detail-item i { color: var(--purple); }

/* =====================================================
   ACADEMICS SECTION
   ===================================================== */
.academics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  margin-bottom: 4rem;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 2.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--gold), var(--lavender), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -2.5rem;
  top: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 3px solid var(--lavender);
  transition: border-color 0.3s, background 0.3s;
}

.timeline-item.active .timeline-dot {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 0 4px #D4A85520;
}

.timeline-period {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--terracotta);
  background: #C4875A14;
  padding: 0.2rem 0.7rem;
  border-radius: 100px;
  display: inline-block;
  margin-bottom: 0.4rem;
}

.timeline-content h4 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 0.3rem;
}

.timeline-institution {
  font-size: 0.9rem;
  color: var(--purple);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.timeline-desc {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 0.8rem;
  line-height: 1.6;
}

.timeline-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.7rem;
  border-radius: 100px;
  background: #8A5BAE14;
  color: var(--purple);
  font-weight: 500;
}

/* Subject Cards */
.subject-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.subject-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.2rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 1rem;
  transition: transform 0.3s var(--ease), box-shadow 0.3s, border-color 0.3s;
  border-left: 3px solid var(--accent);
}

.subject-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.subject-icon {
  width: 40px; height: 40px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  border-radius: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.subject-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 0.2rem;
}

.subject-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Equations showcase */
.math-showcase {
  background: var(--bg-alt);
  border-radius: 1.5rem;
  padding: 2.5rem;
  text-align: center;
  border: 1.5px solid var(--border);
}

.showcase-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.equations-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.equation-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 1rem;
  padding: 1.2rem 1.8rem;
  min-width: 200px;
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}

.equation-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.equation-formula {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--dark);
  margin-bottom: 0.5rem;
  letter-spacing: 0.03em;
}

.equation-name {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
}

/* =====================================================
   GALLERY SECTION
   ===================================================== */
.section-gallery {
  background: var(--bg-alt);
}

.gallery-filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.filter-btn {
  padding: 0.5rem 1.2rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  background: var(--bg);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all 0.3s var(--ease);
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 220px;
  gap: 1rem;
}

.gallery-item {
  overflow: hidden;
  border-radius: 1rem;
  cursor: pointer;
  transition: transform 0.3s var(--ease), opacity 0.4s var(--ease);
}

.gallery-item.tall { grid-row: span 2; }
.gallery-item.wide { grid-column: span 2; }

.gallery-item.hidden {
  display: none;
}

.gallery-img-wrap {
  width: 100%; height: 100%;
  position: relative;
  overflow: hidden;
}

.gallery-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.gallery-item:hover .gallery-img-wrap img {
  transform: scale(1.06);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(42, 31, 61, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.gallery-overlay i { font-size: 1.5rem; }
.gallery-item:hover .gallery-overlay { opacity: 1; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(20, 12, 40, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.lightbox[hidden] { display: none; }

.lightbox-img-wrap {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 1rem;
  overflow: hidden;
}

.lightbox-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-height: 80vh;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.2);
  color: #fff;
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.3s, transform 0.3s;
  cursor: pointer;
}

.lightbox-close { top: 1.5rem; right: 1.5rem; }
.lightbox-prev  { left: 1.5rem; top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 1.5rem; top: 50%; transform: translateY(-50%); }

.lightbox-close:hover { background: rgba(255,255,255,0.25); }
.lightbox-prev:hover  { background: rgba(255,255,255,0.25); transform: translateY(-50%) scale(1.08); }
.lightbox-next:hover  { background: rgba(255,255,255,0.25); transform: translateY(-50%) scale(1.08); }

.lightbox-caption {
  position: absolute;
  bottom: 1.5rem; left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* =====================================================
   INTERESTS SECTION
   ===================================================== */
.interests-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.interest-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 1.5rem;
  padding: 2rem 1.5rem;
  text-align: center;
  transition: transform 0.35s var(--ease-spring), box-shadow 0.35s, border-color 0.3s;
  position: relative;
  overflow: hidden;
}

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

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

.interest-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--card-accent) 30%, transparent);
}

.interest-icon-wrap {
  width: 64px; height: 64px;
  border-radius: 1.2rem;
  background: color-mix(in srgb, var(--card-accent) 14%, transparent);
  color: var(--card-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 1.2rem;
  transition: transform 0.3s var(--ease-spring);
}

.interest-card:hover .interest-icon-wrap {
  transform: scale(1.12) rotate(-5deg);
}

.interest-card h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 0.6rem;
}

.interest-card p {
  font-size: 0.88rem;
  color: var(--text-light);
  line-height: 1.65;
  margin-bottom: 1.2rem;
}

.interest-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.interest-tags span {
  font-size: 0.72rem;
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  background: color-mix(in srgb, var(--card-accent) 12%, transparent);
  color: var(--card-accent);
  font-weight: 600;
}

/* =====================================================
   CONTACT SECTION
   ===================================================== */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 4rem;
  align-items: start;
}

.contact-info h3 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 0.6rem;
}

.contact-info > p {
  color: var(--text-light);
  margin-bottom: 2rem;
}

.contact-items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.contact-item-icon {
  width: 44px; height: 44px;
  border-radius: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.contact-item-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.contact-item-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--dark);
}

a.contact-item-value:hover { color: var(--purple); }

.social-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.75rem;
}

.social-icons {
  display: flex;
  gap: 0.75rem;
}

.social-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--text-light);
  transition: background 0.3s, color 0.3s, border-color 0.3s, transform 0.3s var(--ease-spring);
}

.social-icon:hover {
  background: var(--sc, var(--purple));
  color: #fff;
  border-color: var(--sc, var(--purple));
  transform: translateY(-3px);
}

/* Contact form */
.contact-form-wrap {
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: 1.5rem;
  padding: 2.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
}

.form-group input,
.form-group textarea {
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 0.75rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.3s, box-shadow 0.3s;
  resize: vertical;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px #8A5BAE20;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-status {
  margin-top: 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: center;
  min-height: 1.5rem;
}

.form-status.success { color: var(--sage); }
.form-status.error   { color: var(--rose); }

/* =====================================================
   FOOTER
   ===================================================== */
.site-footer {
  background: var(--dark);
  color: rgba(255,255,255,0.75);
  padding: 4rem 0 2rem;
}

[data-theme="dark"] .site-footer {
  background: #02020D;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 2fr;
  gap: 3rem;
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer-logo {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 0.75rem;
}

.footer-brand p {
  font-size: 0.88rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.55);
}

.footer-links h4,
.footer-quote h4 {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.footer-links ul li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.55);
  transition: color 0.3s;
}

.footer-links a:hover { color: var(--gold); }

.footer-quote {
  padding-left: 2rem;
  border-left: 2px solid rgba(255,255,255,0.1);
}

.footer-quote i {
  color: var(--gold);
  margin-right: 0.4rem;
  font-size: 0.9rem;
}

.footer-quote blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.footer-quote cite {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.70);
  font-style: normal;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-bottom p {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.70);
}

.footer-social {
  display: flex;
  gap: 0.75rem;
}

.footer-social a {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.footer-social a:hover {
  background: var(--terracotta);
  color: #fff;
  border-color: var(--terracotta);
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 2rem; right: 2rem;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  z-index: 500;
  transition: opacity 0.3s, transform 0.3s var(--ease-spring), background 0.3s;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: #3D2E5C;   /* dark purple — light mode hover */
  transform: translateY(-3px);
}

[data-theme="dark"] .back-to-top:hover {
  background: var(--purple);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
  :root { --section-py: 80px; }

  .about-grid         { grid-template-columns: 1fr; gap: 3rem; }
  .about-image-wrap   { max-width: 320px; margin: 0 auto; }
  .academics-grid     { grid-template-columns: 1fr; gap: 3rem; }
  .subject-cards      { grid-template-columns: 1fr 1fr; }
  .contact-grid       { grid-template-columns: 1fr; gap: 3rem; }
  .footer-grid        { grid-template-columns: 1fr 1fr; }
  .footer-quote       { grid-column: 1 / -1; border-left: none; padding-left: 0; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 2rem; }
}

@media (max-width: 768px) {
  :root { --section-py: 60px; --nav-h: 64px; }

  /* Nav mobile — dropdown from header */
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: auto;
    width: auto;
    background: var(--bg);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.25rem 0 0.5rem;
    box-shadow: var(--shadow-md);
    border-top: 1px solid var(--border);
    border-left: none;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: none;
    transition: max-height 0.3s var(--ease), opacity 0.2s var(--ease);
    z-index: 999;
  }

  .nav-links.open {
    max-height: 600px;
    opacity: 1;
    pointer-events: auto;
  }

  /* Nav links in mobile dropdown */
  .nav-link {
    width: 100%;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }

  .nav-link::after { display: none; }

  /* Hide in-menu theme toggle — lives outside nav beside hamburger */
  .nav-theme-item { display: none; }

  /* Show the main navbar theme toggle on mobile, grouped right beside hamburger */
  .theme-toggle {
    display: flex;
    margin-left: auto;
    margin-right: 0.5rem;
  }

  .hamburger { display: flex; }

  /* Hero */
  .hero-content { padding: 0 0.5rem; }
  .math-formula { display: none; }

  /* Gallery */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 180px;
  }
  .gallery-item.wide { grid-column: span 1; }

  /* Interests */
  .interests-grid { grid-template-columns: 1fr 1fr; }

  /* Academics */
  .subject-cards { grid-template-columns: 1fr; }

  /* Contact */
  .form-row { grid-template-columns: 1fr; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .footer-quote { grid-column: auto; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

@media (max-width: 520px) {
  /* Gallery */
  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 220px;
  }
  .gallery-item.tall { grid-row: span 1; }
  .gallery-item.wide { grid-column: span 1; }

  /* Interests */
  .interests-grid { grid-template-columns: 1fr; }

  /* Hero name */
  .hero-name { font-size: clamp(2.5rem, 12vw, 4rem); }

  /* About stats */
  .about-stats { flex-direction: column; }

  /* Equations */
  .equations-row { flex-direction: column; }
  .equation-card { min-width: unset; }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal-up, .reveal-left, .reveal-right {
    opacity: 1; transform: none;
  }
}

/* =====================================================
   DARK MODE GALAXY EXTRAS
   ===================================================== */

/* Dark scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--border); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* Galaxy nebula subtle glow on hero & body */
[data-theme="dark"] .section-hero {
  background:
    radial-gradient(ellipse at 15% 25%, rgba(10, 5, 40, 0.9) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 75%, rgba(5, 10, 35, 0.8) 0%, transparent 55%),
    var(--bg);
}

[data-theme="dark"] .section-about {
  background:
    radial-gradient(ellipse at 80% 20%, rgba(20, 8, 50, 0.5) 0%, transparent 60%),
    var(--bg-alt);
}

/* Preloader dark mode */
[data-theme="dark"] #preloader {
  background: var(--bg);
}
