:root {
  /* Light theme */
  --light-bg: #ffffff;
  --light-panel: #f8fafc;
  --light-card: #ffffff;
  --light-card-alt: #f1f5f9;
  --light-text: #1e293b;
  --light-muted: #64748b;
  --light-accent: #3b82f6;
  --light-accent-strong: #2563eb;
  --light-border: rgba(0, 0, 0, 0.1);
  --light-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
  --light-btn-text: #ffffff;

  /* Dark theme */
  --dark-bg: #0b1224;
  --dark-panel: #0f172a;
  --dark-card: #111a30;
  --dark-card-alt: #10182b;
  --dark-text: #d9e2f5;
  --dark-muted: #9fb2d5;
  --dark-accent: #6aa9ff;
  --dark-accent-strong: #3a7bff;
  --dark-border: rgba(255, 255, 255, 0.08);
  --dark-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --dark-btn-text: #ffffff;

  /* Default to light theme */
  --bg: var(--light-bg);
  --panel: var(--light-panel);
  --card: var(--light-card);
  --card-alt: var(--light-card-alt);
  --text: var(--light-text);
  --muted: var(--light-muted);
  --accent: var(--light-accent);
  --accent-strong: var(--light-accent-strong);
  --border: var(--light-border);
  --shadow: var(--light-shadow);
  --btn-text: var(--light-btn-text);

  --radius: 16px;
  --transition: all 200ms ease;
}

/* Dark theme class */
.dark-theme {
  --bg: var(--dark-bg);
  --panel: var(--dark-panel);
  --card: var(--dark-card);
  --card-alt: var(--dark-card-alt);
  --text: var(--dark-text);
  --muted: var(--dark-muted);
  --accent: var(--dark-accent);
  --accent-strong: var(--dark-accent-strong);
  --border: var(--dark-border);
  --shadow: var(--dark-shadow);
  --btn-text: var(--dark-btn-text);
}

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

body {
  font-family: 'Press Start 2P', 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  display: none;
}

.pixel-heading {
  font-family: 'Press Start 2P', 'Inter', system-ui, sans-serif;
  letter-spacing: -0.02em;
}

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

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.hero {
  max-width: 1040px;
  width: min(1040px, calc(100% - 2.5rem));
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 3rem 1.25rem 2rem;
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  align-items: center;
  justify-items: center;
  text-align: center;
  box-sizing: border-box;
}

.hero__text .lede {
  color: var(--muted);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.lede {
  font-size: 1.05rem;
}

.hero__actions {
  margin-top: 1.25rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.hero__card {
  background: linear-gradient(145deg, var(--card), var(--card-alt));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  animation: fadeIn 0.6s ease;
}

.hero__card .tag {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(106, 169, 255, 0.12);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.theme-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
}

.language-toggle {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1000;
}

.language-text {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  font-weight: bold;
  color: var(--text);
}

.language-toggle__button {
  border: none !important;
  background: transparent !important;
}


.theme-toggle__button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  outline: none;
}

.theme-toggle__button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

.dark-theme .theme-toggle__button .fa {
  content: "\f185"; /* sun icon */
}

/* Override NES.css container for theme compatibility */
.hero.nes-container {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Ensure all text in hero section uses theme colors */
.hero.nes-container * {
  color: inherit;
}

.hero.nes-container h1 {
  color: var(--text) !important;
}

.hero.nes-container .pixel-heading {
  color: var(--text) !important;
}

.highlights {
  list-style: none;
  display: grid;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: left;
}

.btn {
  display: inline-flex;
  align-items: center; /* Vertically centers content */
  justify-content: center;
  gap: 0.5rem;         /* Space between icon and text */
  padding: 0.85rem 1.15rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
  line-height: 1;      /* Helps prevent text from pushing the icon down */
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent-strong), var(--accent));
  color: var(--btn-text);
  box-shadow: 0 12px 30px rgba(58, 123, 255, 0.25);
  justify-content: center;
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 15px 35px rgba(58, 123, 255, 0.3);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text);
}

.btn.ghost:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.dropdown {
  position: relative;
}

.dropdown__content {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 12px;
  min-width: 180px;
  padding: 0.5rem 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: var(--transition);
  z-index: 5;
}

.dropdown__content a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
}

.dropdown__content a:hover {
  background: rgba(255, 255, 255, 0.06);
}

.dropdown.open .dropdown__content {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.dropdown__trigger .chevron {
  font-size: 0.8rem;
}

.section {
  margin-top: 3.5rem;
}

.section,
.section .section__header,
.section .grid,
.section .form,
.section .carousel {
  margin-left: auto;
  margin-right: auto;
}

.section .grid,
.section .form,
.section .carousel {
  width: min(1040px, calc(100% - 2.5rem));
}

#certifications .btn {
  display: block;
  width: fit-content;
  margin: 1.5rem auto 0;
}

.section__header h2 {
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.section__header {
  text-align: center;
}

.section__header .lede {
  margin-left: auto;
  margin-right: auto;
}

.section__header .lede {
  color: var(--muted);
  max-width: 720px;
}

.carousel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: stretch;
  margin-top: 1rem;
}

.carousel__viewport {
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(145deg, var(--card), var(--card-alt));
  min-height: 84px;
}

.carousel__track {
  display: flex;
  transition: transform 350ms ease;
  will-change: transform;
}

.skill-card {
  min-width: 240px;
  padding: 1.25rem;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.skill-card:last-child {
  border-right: none;
}

.skill-card h3 {
  margin: 0;
  text-align: center;
}

.carousel__control {
  background: none;
  border: none;
  color: var(--muted);
  width: 60px;
  height: 60px;
  border-radius: 0;
  transition: var(--transition);
  align-self: center;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  outline: none;
}

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

.carousel__control:focus,
.carousel__control:active {
  outline: none;
  border: none;
  box-shadow: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.project-card {
  background: linear-gradient(145deg, var(--card), var(--card-alt));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
  display: grid;
  gap: 0.65rem;
}

.project-card:hover,
.project-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(106, 169, 255, 0.35);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
}

.project-card .meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.cert-card {
  background: linear-gradient(145deg, var(--card), var(--card-alt));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.35rem;
}

.cert-card .meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.cert-card .tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(106, 169, 255, 0.14);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
}

.form {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  max-width: 720px;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field label {
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  color: var(--text);
  transition: var(--transition);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(106, 169, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(106, 169, 255, 0.12);
}

.field.checkbox label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
}

footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.02));
}

.dialog {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 640px;
  width: 90vw;
  box-shadow: var(--shadow);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.dialog[open] {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.dialog__title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.dialog__image {
  width: 100%;
  border-radius: 12px;
  margin: 1rem 0;
  border: 1px solid var(--border);
}

.dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

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

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .hero__text {
    text-align: center;
  }
}

@media (max-width: 640px) {
  main {
    padding: 2rem 1rem 3rem;
  }

  .hero__actions {
    flex-direction: column;
  }

  .hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .hero__text {
    text-align: center;
  }

  .theme-toggle {
    bottom: 1rem;
    right: 1rem;
  }

  .language-toggle {
    top: 0.5rem;
    left: 0.5rem;
  }

  .language-text {
    font-size: 0.6rem;
  }

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

  .carousel__control {
    justify-self: start;
  }
}

.jobactionlink {
  color: var(--accent);
}

.btn .fa {
  display: inline-block;
  line-height: 0;      /* Removes extra space around the icon */
  vertical-align: middle;
  transform: translateY(-1px); /* Precise nudge for the pixel font */
}

.btn .nes-icon {
  margin-right: 4px;
  vertical-align: middle;
}

.name-favicon {
  width: 98px;            /* Adjust size to match your font height */
  height: 98px;
  border-radius: 4px;     /* Small radius to keep the "blocky" look */
  vertical-align: middle; /* Aligns it with the center of the text */
  margin-right: 12px;     /* Space between the pic and your name */
  border: 2px solid var(--border); /* Optional: adds a subtle frame */
}

/* Responsive adjustment for smaller screens */
@media (max-width: 640px) {
  .name-favicon {
    width: 32px;
    height: 32px;
    margin-right: 8px;
  }
}

#open-profile-pic {
  display: inline-flex;
  vertical-align: middle;
  outline: none;
}

#open-profile-pic:focus-visible .name-favicon {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}