/* ============================================================
   JAKOB M. HELTON — Personal Website
   Revised Main Stylesheet
   Deep space dark / jade green / LaTeX-inspired typography
   ============================================================ */

/* Fonts: Latin Modern (LaTeX-like) for display, Libre Franklin for body */
/* Google Fonts loaded via <link> in each HTML file for non-blocking load */
/* LMROMAN (Latin Modern Roman) served from CDN for true LaTeX feel */
@font-face {
  font-family: 'Latin Modern Roman';
  src: url('https://cdn.jsdelivr.net/gh/edwardtufte/et-book@gh-pages/et-book/roman-line-figures/et-book-roman-line-figures.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Latin Modern Roman';
  src: url('https://cdn.jsdelivr.net/gh/aaaakshat/cm-web-fonts@master/fonts/Serif/cmunrm.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --jade-50:  #ecfdf5;
  --jade-100: #d1fae5;
  --jade-200: #a7f3d0;
  --jade-300: #6ee7b7;
  --jade-400: #34d399;
  --jade-500: #00a878;
  --jade-600: #059669;
  --jade-700: #047857;
  --jade-800: #065f46;
  --jade-900: #064e3b;

  --gray-50:  #fafafa;
  --gray-100: #f4f4f5;
  --gray-200: #e4e4e7;
  --gray-300: #d4d4d8;
  --gray-400: #a1a1aa;
  --gray-500: #71717a;
  --gray-600: #52525b;
  --gray-700: #3f3f46;
  --gray-800: #27272a;
  --gray-900: #18181b;
  --gray-950: #0c0c0e;

  --bg-primary:    #08090c;
  --bg-secondary:  #0f1117;
  --bg-tertiary:   #161821;
  --bg-card:       #12141d;
  --bg-card-hover: #1a1c28;

  --text-primary:   #e4e4e7;
  --text-secondary: #a1a1aa;
  --text-tertiary:  #71717a;
  --text-inverse:   #18181b;

  --accent:        var(--jade-500);
  --accent-light:  var(--jade-400);
  --accent-dark:   var(--jade-700);
  --accent-glow:   rgba(0, 168, 120, 0.15);
  --accent-glow-strong: rgba(0, 168, 120, 0.3);

  --border:        rgba(255, 255, 255, 0.06);
  --border-accent: rgba(0, 168, 120, 0.25);

  --shadow-sm:  0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 30px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(0, 168, 120, 0.1);

  /* Typography — LaTeX-inspired */
  --font-display: 'Playfair Display', 'Latin Modern Roman', Georgia, serif;
  --font-body:    'Libre Franklin', 'Latin Modern Roman', -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  --max-width: 1200px;
  --max-width-narrow: 800px;
  --nav-height: 64px;
  --border-radius: 8px;
  --border-radius-lg: 16px;

  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-in-out: cubic-bezier(0.42, 0, 0.58, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-med:  300ms var(--ease-out);
  --transition-slow: 500ms var(--ease-out);
}

/* Light Mode */
[data-theme="light"] {
  --bg-primary:    #d8d4d0;
  --bg-secondary:  #ccc8c4;
  --bg-tertiary:   #bdb9b5;
  --bg-card:       #dedad6;
  --bg-card-hover: #ccc8c4;
  --text-primary:   #1c1917;
  --text-secondary: #44403c;
  --text-tertiary:  #78716c;
  --text-inverse:   #d8d4d0;
  --accent:        var(--jade-600);
  --accent-light:  var(--jade-500);
  --accent-dark:   var(--jade-800);
  --accent-glow:   rgba(5, 150, 105, 0.08);
  --accent-glow-strong: rgba(5, 150, 105, 0.15);
  --border:        rgba(0, 0, 0, 0.08);
  --border-accent: rgba(5, 150, 105, 0.2);
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 30px rgba(0,0,0,0.1);
  --shadow-glow: 0 0 20px rgba(5, 150, 105, 0.06);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-med), color var(--transition-med);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.4rem, 5vw, 4rem); font-weight: 600; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); }
h3 { font-size: clamp(1.3rem, 2.5vw, 1.8rem); }
h4 { font-size: clamp(1.1rem, 2vw, 1.3rem); }

p {
  text-align: justify;
  text-justify: inter-word;
  hyphens: none;
  -webkit-hyphens: none;
  -ms-hyphens: none;
  overflow-wrap: break-word;
  word-break: normal;
  text-wrap: pretty;
  margin-bottom: var(--space-md);
}

figcaption {
  text-align: justify;
  text-justify: inter-word;
  hyphens: none;
  -webkit-hyphens: none;
  text-wrap: pretty;
}

li {
  text-align: justify;
  text-justify: inter-word;
  hyphens: none;
  -webkit-hyphens: none;
  text-wrap: pretty;
  overflow-wrap: break-word;
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

strong { font-weight: 600; }

::selection {
  background: var(--accent);
  color: var(--bg-primary);
}

/* Star Field Canvas */
#star-field {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}
[data-theme="light"] #star-field { opacity: 0.15; }

/* Navigation */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  background: rgba(8, 9, 12, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-med);
}
[data-theme="light"] .site-nav { background: rgba(250, 250, 249, 0.85); }

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.nav-logo:hover { color: var(--accent-light); text-decoration: none; }
.nav-logo .logo-icon {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
}
.nav-links a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: var(--space-xs) 0;
  position: relative;
  transition: color var(--transition-fast);
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1.5px;
  background: var(--accent);
  transition: width var(--transition-med);
}
.nav-links a:hover, .nav-links a.active { color: var(--text-primary); text-decoration: none; }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); box-shadow: var(--shadow-glow); }
.theme-toggle svg { width: 18px; height: 18px; }

/* Mobile menu toggle */
.nav-menu-toggle {
  display: none;
  background: none; border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: var(--space-xs);
}
.nav-menu-toggle svg { width: 24px; height: 24px; }
.nav-backdrop {
  position: fixed; inset: 0; z-index: 998;
  background: rgba(0,0,0,0.95);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.nav-backdrop.active { opacity: 1; pointer-events: auto; }
@media (min-width: 769px) { .nav-backdrop { display: none !important; } }

/* Main Content */
.page-content {
  position: relative;
  z-index: 1;
  padding-top: var(--nav-height);
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}
.container--narrow { max-width: var(--max-width-narrow); }

/* Sections */
.section { padding: var(--space-4xl) 0; }
.section-header { margin-bottom: var(--space-3xl); }

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.section-label::before {
  content: ''; display: inline-block;
  width: 24px; height: 1px;
  background: var(--accent);
}

.section-title { color: var(--text-primary); margin-bottom: var(--space-md); }
.section-subtitle { color: var(--text-secondary); font-size: 1.1rem; max-width: 600px; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-med);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--transition-med);
}
.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.card:hover::before { opacity: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-sm);
  font-family: var(--font-body);
  font-size: 0.875rem; font-weight: 500;
  padding: 0.7rem 1.5rem;
  border-radius: var(--border-radius);
  border: none; cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: 0.02em;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-light); color: #fff; box-shadow: 0 0 20px rgba(0,168,120,0.3); }
.btn--outline { background: transparent; color: var(--text-primary); border: 1px solid var(--border); }
.btn--outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.btn--small { font-size: 0.8rem; padding: 0.45rem 1rem; }
.btn svg { width: 16px; height: 16px; }

/* Icon Links */
.icon-links { display: flex; align-items: center; gap: var(--space-md); flex-wrap: wrap; }
.icon-link {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.icon-link:hover {
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
  text-decoration: none;
}
.icon-link svg { width: 20px; height: 20px; }
.icon-link--cv {
  width: auto;
  padding: 0 var(--space-md);
  gap: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* Tags */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem; font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  background: var(--accent-glow);
  color: var(--accent-light);
  border: 1px solid var(--border-accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Divider */
.divider {
  border: none; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: var(--space-3xl) 0;
}

/* Footer */
.site-footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--border);
  padding: var(--space-2xl) 0;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}
.site-footer a { color: var(--text-secondary); }
.site-footer a:hover { color: var(--accent); }
.site-footer p { text-align: center; }

/* Fade-in Animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s 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; }

/* Scroll Progress */
.scroll-progress {
  position: fixed;
  top: var(--nav-height); left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--jade-300));
  z-index: 999;
  transition: width 50ms linear;
}

/* Scroll To Top Button */
#scroll-top-btn {
  position: fixed; bottom: var(--space-xl); right: var(--space-xl);
  z-index: 990; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border-accent); background: var(--bg-card);
  color: var(--accent); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity var(--transition-med), transform var(--transition-med), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
#scroll-top-btn.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
#scroll-top-btn:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); background: var(--accent-glow); }
#scroll-top-btn svg { width: 20px; height: 20px; }

/* Loading Shimmer */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-card-hover) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Image Credits */
.credited-image { border-radius: var(--border-radius-lg); }
.credited-image > a { display: block; overflow: hidden; border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0; line-height: 0; }
.credited-image > a > img { width: 100%; height: auto; display: block; }
.credited-image > img { width: 100%; display: block; border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0; overflow: hidden; }
.image-credit {
  padding: 0.4rem var(--space-md);
  background: rgba(0,0,0,0.55);
  font-size: 0.65rem;
  color: rgba(255,255,255,0.65);
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}
.image-credit a { color: rgba(255,255,255,0.85); text-decoration: underline; }
[data-theme="light"] .image-credit { background: var(--bg-secondary); color: var(--text-tertiary); border: 1px solid var(--border); border-top: none; }
[data-theme="light"] .image-credit a { color: var(--text-secondary); }

/* Blog Article Styles */
.blog-article { font-size: 1.05rem; line-height: 1.8; }
.blog-article h2 { margin-top: var(--space-2xl); margin-bottom: var(--space-md); }
.blog-article h3 { margin-top: var(--space-xl); margin-bottom: var(--space-sm); }
.blog-article ul, .blog-article ol { margin-bottom: var(--space-md); padding-left: var(--space-xl); }
.blog-article li { margin-bottom: var(--space-sm); }
.blog-article blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-lg);
  margin: var(--space-lg) 0;
  color: var(--text-secondary);
  font-style: italic;
}
.blog-article img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  margin: var(--space-lg) 0;
}
.blog-article .video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: var(--space-lg) 0;
  border-radius: var(--border-radius);
}
.blog-article .video-embed iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* Utility */
.text-accent { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-justify { text-align: justify; text-justify: inter-word; }
.text-left { text-align: left; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}
