/* ==========================================================================
   Drew Barth, PE — Portfolio Stylesheet
   Zero-build modular CSS3 with Light/Dark themes & WCAG AA contrast
   ========================================================================== */

:root {
  /* Light Theme Tokens */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-header: rgba(248, 250, 252, 0.88);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: rgba(29, 78, 216, 0.1);
  --highlight: #b45309;
  --highlight-soft: rgba(180, 83, 9, 0.12);
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
  --slider-divider: #ffffff;
  --slider-label-bg: rgba(15, 23, 42, 0.82);
  --slider-label-text: #f8fafc;

  /* Typography & Spacing */
  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --container-max: 1180px;
  --nav-height: 72px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #0b1120;
  --bg-secondary: #111827;
  --bg-elevated: #1e293b;
  --bg-header: rgba(11, 17, 32, 0.88);
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --highlight: #fbbf24;
  --highlight-soft: rgba(251, 191, 36, 0.14);
  --border: #1e293b;
  --border-strong: #334155;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  --slider-divider: #f8fafc;
  --slider-label-bg: rgba(15, 23, 42, 0.88);
  --slider-label-text: #f8fafc;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color var(--transition), color var(--transition);
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 1000;
  background: var(--accent);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  top: 16px;
}

[data-theme="dark"] .skip-link {
  color: #0b1120;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 42px 0;
}

.section--alt {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-header {
  margin-bottom: 40px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.section-lead {
  margin: 0;
  font-size: 1.0625rem;
  color: var(--text-secondary);
  max-width: 68ch;
}

/* ==========================================================================
   Sticky Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  color: var(--accent);
}

.brand-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: inline-block;
  padding: 8px 14px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
}

.nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition);
}

.icon-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
}

.menu-toggle {
  display: none;
}

/* Mobile Drawer */
.mobile-drawer {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 16px 24px 24px;
  z-index: 99;
}

.mobile-drawer.is-open {
  display: block;
}

.mobile-drawer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-drawer a {
  display: block;
  padding: 12px 14px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
}

.mobile-drawer a:hover {
  background: var(--bg-elevated);
  color: var(--accent);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  font-family: var(--font-sans);
  font-size: 0.96875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, background-color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .btn-primary {
  color: #0b1120;
}

[data-theme="dark"] .btn-primary:hover {
  color: #0b1120;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ==========================================================================
   Two-Column Grid Layouts
   ========================================================================== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.two-col--hero {
  grid-template-columns: 0.92fr 1.08fr;
}

.media-frame {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md);
}

.media-frame img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.hero-title {
  margin: 0 0 12px;
  font-size: clamp(2.1rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.hero-subtitle {
  margin: 0 0 18px;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent);
}

.hero-summary {
  margin: 0;
  font-size: 1.03125rem;
  color: var(--text-secondary);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Skills & Technical Tools
   ========================================================================== */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 36px;
  align-items: stretch;
}

.skills-cell--photo {
  align-self: start;
}

.skill-group {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}

.skill-group h3 {
  margin: 0 0 14px;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tag-list li {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
}

.tag-list--single {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
}

.tag-list--single li {
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

/* Custom Icon-Bulleted Technical Tools List */
.tools-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 14px;
}

.tools-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.tool-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 4px;
}

/* ==========================================================================
   Experience Timeline & Inline Before/After Comparison Sliders
   ========================================================================== */
.experience-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

.experience-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100%;
}

.experience-col > .exp-card:last-child {
  flex: 1;
}

.exp-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.exp-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.exp-company {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.exp-dates {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
}

.exp-role {
  font-size: 0.96875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
}

.exp-bullets {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.exp-bullets li + li {
  margin-top: 6px;
}

.slider-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.slider-card-title {
  margin: 0 0 4px;
  font-size: 1.0625rem;
  font-weight: 700;
}

.slider-card-caption {
  margin: 0 0 14px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.compare-slider {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius-sm);
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  cursor: ew-resize;
  background: var(--bg-elevated);
  --position: 50%;
}

.compare-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.compare-img--before {
  clip-path: inset(0 calc(100% - var(--position)) 0 0);
}

.compare-label {
  position: absolute;
  bottom: 12px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--slider-label-bg);
  color: var(--slider-label-text);
  border-radius: 6px;
  pointer-events: none;
  z-index: 2;
}

.compare-label--before {
  left: 12px;
}

.compare-label--after {
  right: 12px;
}

.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--position);
  width: 3px;
  background: var(--slider-divider);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.45);
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: var(--position);
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  pointer-events: none;
}

[data-theme="dark"] .compare-handle {
  color: #0b1120;
}

/* ==========================================================================
   Education & Credentials
   ========================================================================== */
.education-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 36px;
  align-items: start;
}

.cred-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
}

.cred-card h3 {
  margin: 0 0 10px;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cred-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.cred-card li + li {
  margin-top: 6px;
}

.license-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--highlight);
  background: var(--highlight-soft);
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 6px;
}

/* ==========================================================================
   Contact & Footer
   ========================================================================== */
.contact-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.contact-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 28px;
  flex: 1;
  min-width: 0;
}

.contact-copy {
  flex: 1 1 380px;
  min-width: 0;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  flex-shrink: 0;
}

.contact-gif {
  max-height: 155px;
  width: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

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

/* 404 Page */
.error-page {
  min-height: calc(100vh - var(--nav-height) - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
}

.error-code {
  font-family: var(--font-mono);
  font-size: clamp(3.5rem, 10vw, 6rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin: 0 0 12px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 960px) {
  .two-col,
  .two-col--hero,
  .skills-grid,
  .experience-columns,
  .education-columns {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .experience-col {
    height: auto;
  }

  .experience-col > .exp-card:last-child {
    flex: none;
  }

  .edu-cell--purdue {
    order: 1;
  }

  .edu-cell--photo {
    order: 2;
  }

  .edu-cell--licensure {
    order: 3;
  }

  .edu-cell--honors {
    order: 4;
  }

  .section {
    padding: 32px 0;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .contact-box {
    padding: 28px 22px;
    flex-direction: column;
    align-items: stretch;
  }

  .contact-gif {
    max-width: 100%;
    align-self: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 18px;
  }

  .tools-list {
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
