/* ============================================================
   Calera Computing, Inc. — Corporate Website
   Design System · Light Mode · Premium Aesthetic
   ============================================================ */

/* --- Google Fonts (loaded in HTML) --- */
/* Inter (body), Space Grotesk (display/headings) */

/* --- CSS Houdini Properties for Smooth Gradient Transitions --- */
@property --hero-gradient-center {
  syntax: '<color>';
  inherits: true;
  initial-value: rgba(253, 253, 255, 0.92);
}
@property --hero-gradient-mid {
  syntax: '<color>';
  inherits: true;
  initial-value: rgba(253, 253, 255, 0.6);
}
@property --hero-gradient-bottom {
  syntax: '<color>';
  inherits: true;
  initial-value: rgba(253, 253, 255, 0.95);
}
@property --hero-gradient-top {
  syntax: '<color>';
  inherits: true;
  initial-value: rgba(253, 253, 255, 0.1);
}

/* --- CSS Custom Properties --- */
:root {
  /* Stone palette — inspired by limestone (calera) */
  --stone-50:  #fafaf9;
  --stone-100: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-300: #d6d3d1;
  --stone-400: #a8a29e;
  --stone-500: #78716c;
  --stone-600: #57534e;
  --stone-700: #44403c;
  --stone-800: #292524;
  --stone-900: #1c1917;

  /* Accent — crystalline sapphire blue (from logo) */
  --accent-400: #60a5fa;
  --accent-500: #3b82f6;
  --accent-600: #2563eb;

  /* Primary blue — deep sapphire for scholarly gravitas */
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;

  /* Semantic */
  --bg-primary: #fdfdff;
  --bg-secondary: #f5f7fb;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-card-hover: rgba(255, 255, 255, 0.88);
  --text-primary: var(--stone-900);
  --text-secondary: var(--stone-600);
  --text-muted: var(--stone-400);
  --border-color: var(--stone-200);
  --border-subtle: rgba(0, 0, 0, 0.06);

  /* Canvas animation colors */
  --canvas-node-color: rgba(29, 78, 216, 0.35);
  --canvas-edge-color-rgb: 29, 78, 216;
  --canvas-edge-opacity: 0.14;
  --canvas-highlight-color: rgba(37, 99, 235, 0.55);
  --canvas-highlight-glow: rgba(37, 99, 235, 0.12);

  /* Hero Gradient overlay colors */
  --hero-gradient-top: rgba(253, 253, 255, 0.1);
  --hero-gradient-center: rgba(253, 253, 255, 0.92);
  --hero-gradient-mid: rgba(253, 253, 255, 0.6);
  --hero-gradient-bottom: rgba(253, 253, 255, 0.95);

  /* Navigation Scroll Background */
  --nav-bg: rgba(253, 253, 255, 0.85);

  /* Mobile Navigation Background */
  --mobile-nav-bg: rgba(253, 252, 251, 0.95);

  /* Table hover */
  --table-row-hover: rgba(0, 0, 0, 0.015);

  /* Typography scale */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;
  --text-6xl:  3.75rem;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Borders */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.15);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
}

/* ============================================================
   DARK THEME PALETTE
   ============================================================ */
html[data-theme="dark"] {
  /* Override Semantic variables for dark mode */
  --bg-primary: #0a0908;
  --bg-secondary: #12100e;
  --bg-card: rgba(28, 25, 23, 0.65);
  --bg-card-hover: rgba(41, 37, 36, 0.85);
  --text-primary: var(--stone-100);
  --text-secondary: var(--stone-300);
  --text-muted: var(--stone-500);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-subtle: rgba(255, 255, 255, 0.05);

  /* Shift accents to keep strong visibility on dark backdrop */
  --accent-400: #93c5fd;
  --accent-500: #60a5fa;
  --accent-600: #3b82f6;

  --blue-400: #93c5fd;
  --blue-500: #60a5fa;
  --blue-600: #3b82f6;
  --blue-700: #2563eb;
  --blue-800: #1d4ed8;
  --blue-900: #1e40af;

  /* Canvas animation dark mode colors */
  --canvas-node-color: rgba(96, 165, 250, 0.45);
  --canvas-edge-color-rgb: 96, 165, 250;
  --canvas-edge-opacity: 0.22;
  --canvas-highlight-color: rgba(96, 165, 250, 0.75);
  --canvas-highlight-glow: rgba(96, 165, 250, 0.25);

  /* Hero Gradient overlay dark colors */
  --hero-gradient-top: rgba(10, 9, 8, 0.05);
  --hero-gradient-center: rgba(10, 9, 8, 0.2);
  --hero-gradient-mid: rgba(10, 9, 8, 0.45);
  --hero-gradient-bottom: rgba(10, 9, 8, 0.85);

  /* Navigation Scroll Dark Background */
  --nav-bg: rgba(10, 9, 8, 0.85);

  /* Mobile Navigation Dark Background */
  --mobile-nav-bg: rgba(18, 16, 14, 0.95);

  /* Table hover */
  --table-row-hover: rgba(255, 255, 255, 0.02);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Global transitions for theme shifts */
body, nav, section, .pillar, .research__card, .social-card, .footer, .btn, td, th {
  transition: background-color var(--duration-normal) var(--ease-out),
              color var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container--narrow {
  max-width: 800px;
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-4) 0;
  transition: all var(--duration-normal) var(--ease-out);
}

.nav--scrolled {
  background-color: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav__logo {
  width: 36px;
  height: 36px;
}

.nav__name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.nav__name span {
  font-weight: 400;
  color: var(--text-secondary);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  list-style: none;
}

.nav__link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--duration-fast) var(--ease-out);
  position: relative;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-500);
  transition: width var(--duration-normal) var(--ease-out);
  border-radius: var(--radius-full);
}

.nav__link:hover {
  color: var(--text-primary);
}

.nav__link:hover::after {
  width: 100%;
}

.nav__right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--duration-normal) var(--ease-out),
              color var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.theme-toggle:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--stone-400);
  transform: scale(1.05);
}

.theme-toggle__icon {
  width: 20px;
  height: 20px;
  transition: transform var(--duration-normal) var(--ease-spring),
              opacity var(--duration-normal) var(--ease-out);
  position: absolute;
}

/* Theme toggle icon state changes */
html[data-theme="dark"] .theme-toggle__icon--sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

html[data-theme="dark"] .theme-toggle__icon--moon {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

.theme-toggle__icon--sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0);
}

.theme-toggle__icon--moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* Mobile menu */
.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-2);
}

.nav__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: var(--radius-full);
  transition: all var(--duration-normal) var(--ease-out);
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--bg-primary);
}

.hero__canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__canvas canvas {
  width: 100%;
  height: 100%;
}

/* Subtle grain texture overlay */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* Warm gradient overlay for hero readability */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, var(--hero-gradient-center) 0%, var(--hero-gradient-mid) 60%, transparent 100%),
    linear-gradient(180deg, var(--hero-gradient-top) 0%, var(--hero-gradient-bottom) 100%);
  pointer-events: none;
  transition: --hero-gradient-center var(--duration-normal) var(--ease-out),
              --hero-gradient-mid var(--duration-normal) var(--ease-out),
              --hero-gradient-top var(--duration-normal) var(--ease-out),
              --hero-gradient-bottom var(--duration-normal) var(--ease-out);
}

.hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 820px;
  padding: var(--space-20) var(--space-6);
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-700);
  margin-bottom: var(--space-8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hero__badge__dot {
  width: 6px;
  height: 6px;
  background: var(--blue-500);
  border-radius: var(--radius-full);
  animation: pulse-dot 2s infinite;
}

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

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, var(--text-6xl));
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
  color: var(--text-primary);
  margin-bottom: var(--space-6);
}

.hero__title em {
  font-style: normal;
  background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__subtitle {
  font-size: clamp(var(--text-lg), 2.2vw, var(--text-xl));
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto var(--space-10);
  font-weight: 400;
}

.hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.btn--primary {
  background: var(--stone-900);
  color: white;
  box-shadow: var(--shadow-md), 0 0 0 0 rgba(28, 25, 23, 0);
}

.btn--primary:hover {
  background: var(--stone-800);
  box-shadow: var(--shadow-lg), 0 0 0 4px rgba(28, 25, 23, 0.08);
  transform: translateY(-1px);
}

.btn--secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn--secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--stone-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn__icon {
  width: 16px;
  height: 16px;
  transition: transform var(--duration-normal) var(--ease-out);
}

.btn:hover .btn__icon {
  transform: translateX(2px);
}

/* ============================================================
   EQUATION DIVIDER
   ============================================================ */
.equation-divider {
  text-align: center;
  padding: var(--space-16) 0;
  position: relative;
}

.equation-divider__line {
  width: 80px;
  height: 1px;
  background: var(--border-color);
  margin: 0 auto var(--space-6);
}

.equation-divider__formula {
  font-family: 'Times New Roman', 'Georgia', serif;
  font-size: var(--text-2xl);
  font-style: italic;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  opacity: 0.5;
}

/* ============================================================
   ABOUT SECTION
   ============================================================ */
.about {
  padding: var(--space-24) 0;
  background-color: var(--bg-secondary);
  position: relative;
}

.about::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent);
}

.section-label {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue-600);
  margin-bottom: var(--space-4);
}

.section-heading {
  font-family: var(--font-display);
  font-size: clamp(var(--text-3xl), 4vw, var(--text-4xl));
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: var(--space-6);
}

.section-body {
  font-size: var(--text-lg);
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 680px;
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
  align-items: center;
  margin-top: var(--space-16);
}

.about__text {
  max-width: 560px;
}

/* Pillar cards */
.pillars {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pillar {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}

.pillar:hover {
  background-color: var(--bg-card-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--stone-300);
}

.pillar__header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  cursor: pointer;
  list-style: none; /* Hide standard details triangle */
}

.pillar__header::-webkit-details-marker {
  display: none; /* Webkit browser marker hide */
}

.pillar__header-text {
  flex: 1;
  min-width: 0;
}

.pillar__chevron {
  width: 18px;
  height: 18px;
  margin-top: var(--space-1);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--duration-normal) var(--ease-out),
              color var(--duration-normal) var(--ease-out);
}

.pillar[open] .pillar__chevron {
  transform: rotate(180deg);
  color: var(--blue-500);
}

.pillar__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-800));
  border-radius: var(--radius-md);
  color: white;
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.pillar__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.pillar__desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Expanded contents */
.pillar__expanded {
  padding-top: var(--space-4);
  margin-top: var(--space-4);
  border-top: 1px solid var(--border-color);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
}

.pillar__expanded p {
  margin-bottom: var(--space-3);
}

.pillar__expanded p:last-of-type {
  margin-bottom: 0;
}

.pillar__key-insight {
  background: rgba(59, 130, 246, 0.05);
  border-left: 3px solid var(--blue-500);
  padding: var(--space-3) var(--space-4);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: var(--space-4);
  font-weight: 500;
  color: var(--text-primary);
}

/* ============================================================
   RESEARCH SECTION (Zenodo Paper)
   ============================================================ */
.research {
  padding: var(--space-32) 0;
  position: relative;
}

.research__card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-10);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  max-width: 900px;
  margin: var(--space-12) auto 0;
  position: relative;
  overflow: hidden;
}

.research__card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--blue-600), var(--blue-400), var(--blue-600));
  background-size: 200% 100%;
  animation: gradient-shift 6s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.research__paper-label {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue-600);
  margin-bottom: var(--space-4);
}

.research__paper-title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-xl), 3vw, var(--text-2xl));
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.research__paper-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.research__meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.research__meta-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.research__paper-abstract {
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  padding-left: var(--space-4);
  border-left: 3px solid var(--border-color);
}

.research__paper-actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* Multiple paper cards container */
.research__cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  max-width: 900px;
  margin: var(--space-12) auto 0;
}

.research__cards .research__card {
  margin: 0;
}

/* Research card expansion styling */
.research__card-summary {
  list-style: none;
  cursor: pointer;
  outline: none;
}

.research__card-summary::-webkit-details-marker {
  display: none;
}

.research__expand-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--blue-500);
  transition: color var(--duration-fast) var(--ease-out);
}

.research__expand-toggle:hover {
  color: var(--blue-600);
}

.research__expand-chevron {
  width: 16px;
  height: 16px;
  transition: transform var(--duration-normal) var(--ease-out);
}

.research__card[open] .research__expand-chevron {
  transform: rotate(180deg);
}

.research__paper-body {
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-color);
  margin-top: var(--space-6);
}

/* NEW badge */
.research__badge-new {
  display: inline-flex;
  align-items: center;
  margin-left: var(--space-3);
  padding: 2px 10px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: white;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  border-radius: var(--radius-full);
  vertical-align: middle;
  animation: badge-pulse 3s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Hierarchy table */
.hierarchy {
  margin-top: var(--space-16);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.hierarchy__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-6);
  text-align: center;
}

.hierarchy__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.hierarchy__table thead th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--border-color);
  text-align: left;
}

.hierarchy__table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.hierarchy__table tbody tr:hover {
  background: var(--table-row-hover);
}

.hierarchy__table .highlight {
  background: rgba(59, 130, 246, 0.06);
  font-weight: 600;
  color: var(--text-primary);
}

.hierarchy__table .constant {
  font-family: 'Times New Roman', Georgia, serif;
  font-style: italic;
  font-size: var(--text-base);
}

/* ============================================================
   SOCIAL SECTION
   ============================================================ */
.social {
  padding: var(--space-24) 0 var(--space-32);
  background-color: var(--bg-secondary);
  position: relative;
}

.social::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent);
}

.social__header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.social__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  max-width: 960px;
  margin: 0 auto;
}

.social-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-out);
  text-decoration: none;
  color: var(--text-primary);
}

.social-card:hover {
  background-color: var(--bg-card-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--stone-300);
}

.social-card__icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  transition: transform var(--duration-normal) var(--ease-spring);
}

.social-card:hover .social-card__icon {
  transform: scale(1.08);
}

.social-card__icon svg {
  width: 22px;
  height: 22px;
}

.social-card__icon--github {
  background: linear-gradient(135deg, #24292e, #444d56);
  color: white;
}

.social-card__icon--x {
  background: linear-gradient(135deg, #14171A, #333);
  color: white;
}

.social-card__icon--substack {
  background: linear-gradient(135deg, #ff6719, #ff8a50);
  color: white;
}

.social-card__icon--linkedin {
  background: linear-gradient(135deg, #0077b5, #00a0dc);
  color: white;
}

.social-card__icon--zenodo {
  background: linear-gradient(135deg, #1d71b8, #4da6e8);
  color: white;
}

.social-card__icon--email {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-400));
  color: white;
}

.social-card__text {
  flex: 1;
  min-width: 0;
}

.social-card__name {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.social-card__handle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.social-card__arrow {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--duration-normal) var(--ease-out);
}

.social-card:hover .social-card__arrow {
  transform: translateX(3px);
  color: var(--text-secondary);
}

.social-card--hero {
  grid-column: 1 / -1;
  padding: var(--space-8);
  background: linear-gradient(135deg, var(--bg-card), rgba(0, 119, 181, 0.04));
  border: 1px solid rgba(0, 119, 181, 0.22);
  box-shadow: 0 4px 20px -5px rgba(0, 119, 181, 0.1), var(--shadow-sm);
}

.social-card--hero:hover {
  background: linear-gradient(135deg, var(--bg-card-hover), rgba(0, 119, 181, 0.08));
  border-color: rgba(0, 119, 181, 0.45);
  box-shadow: 0 12px 30px -10px rgba(0, 119, 181, 0.18), var(--shadow-lg);
  transform: translateY(-4px);
}

.social-card--hero .social-card__icon {
  width: 56px;
  height: 56px;
}

.social-card--hero .social-card__icon svg {
  width: 28px;
  height: 28px;
}

.social-card--hero .social-card__name {
  font-size: var(--text-lg);
}

.social-card__desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
  line-height: var(--leading-relaxed);
  max-width: 650px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding: var(--space-12) 0;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-primary);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer__left {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.footer__brand {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.footer__legal {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.footer__right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.footer__link {
  font-size: var(--text-xs);
  color: var(--text-muted);
  transition: color var(--duration-fast) var(--ease-out);
}

.footer__link:hover {
  color: var(--text-secondary);
}

.footer__divider {
  width: 1px;
  height: 14px;
  background: var(--border-color);
}

.footer__state {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================================
   SCROLL REVEAL ANIMATIONS
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.reveal--visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal--delay-1 { transition-delay: 0.1s; }
.reveal--delay-2 { transition-delay: 0.2s; }
.reveal--delay-3 { transition-delay: 0.3s; }
.reveal--delay-4 { transition-delay: 0.4s; }

/* Hero-specific entrance animations */
.hero__badge {
  animation: fadeInUp 0.8s var(--ease-out) 0.2s both;
}

.hero__title {
  animation: fadeInUp 0.8s var(--ease-out) 0.4s both;
}

.hero__subtitle {
  animation: fadeInUp 0.8s var(--ease-out) 0.6s both;
}

.hero__actions {
  animation: fadeInUp 0.8s var(--ease-out) 0.8s both;
}

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .nav__links {
    display: none;
  }

  .nav__toggle {
    display: flex;
  }

  .nav__links--open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background-color: var(--mobile-nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: var(--space-6);
    gap: var(--space-4);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
  }

  .about__grid {
    grid-template-columns: 1fr;
    gap: var(--space-10);
  }

  .research__card {
    padding: var(--space-8) var(--space-6);
  }

  .research__paper-meta {
    flex-direction: column;
    gap: var(--space-3);
  }

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

  .footer__inner {
    flex-direction: column;
    text-align: center;
  }

  .hierarchy__table {
    font-size: var(--text-xs);
  }

  .hierarchy__table thead th,
  .hierarchy__table tbody td {
    padding: var(--space-2) var(--space-3);
  }

  .social-card--hero {
    padding: var(--space-6);
  }

  .social-card--hero .social-card__icon {
    width: 48px;
    height: 48px;
  }

  .social-card--hero .social-card__icon svg {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 480px) {
  .hero__actions {
    flex-direction: column;
    width: 100%;
  }

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

  .container {
    padding: 0 var(--space-4);
  }
}
