:root {
  color-scheme: dark;

  /* Backgrounds */
  --bg-body: #000000;
  --bg-surface: #16181c;
  --bg-surface-soft: #202327;

  /* Borders */
  --border-subtle: #2f3336;
  --border-strong: #41454a;

  /* Text & Accents */
  --text-main: #e7e9ea;
  --text-muted: #a3a8ad;
  --text-soft: #8b9197;
  --accent: #aeb4ba;
  --accent-strong: #d7dbdf;

  /* Interactive */
  --action-bg: #cbd0d4;
  --action-hover: #b8bfc5;
  --action-text: #111111;
  --control-bg: #16181c;
  --control-hover: #25282b;
  --control-text: #aeb4ba;
  --control-border: #41454a;
  --control-focus: #aeb4ba;

  /* Icons */
  --icon-color: #aeb4ba;
}

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

/* Custom Webkit Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  border: 2px solid var(--bg-body);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

/* Text selection */
::selection {
  background: rgba(174, 180, 186, 0.35);
  color: #ffffff;
}

/* Keyboard focus rings */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

html {
  /* Let JS handle smooth scrolling offset calculations to prevent Safari jank */
  scroll-padding-top: 100px; /* Prevents native hard anchor loads from hiding behind header */
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  position: relative;
}

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

a {
  color: inherit;
}

button {
  font: inherit;
}

.app {
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
  position: relative;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: #000000;
  background: #d7dbdf;
  border-radius: 6px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Header / Navigation */

.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(18px);
  background: rgba(0, 0, 0, 0.92);
  border-bottom: 1px solid var(--border-subtle);
}

.site-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 66px; /* deterministic height so the mobile nav panel aligns exactly below it */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #3a3d41;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: #e7e9ea;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 600;
  font-size: 15px;
}

.brand-role {
  font-size: 12px;
  color: var(--text-muted);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-link {
  position: relative;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
  padding-block: 4px;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: #aeb4ba;
  transition: width 0.25s ease;
}

.nav-link:hover {
  color: var(--text-main);
}

.nav-link.is-active {
  color: var(--text-main);
}

.nav-link.is-active::after {
  width: 100%;
}

.header-actions {
  display: none;
  align-items: center;
  gap: 10px;
}

/* Layout */

.page-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 96px 24px 72px;
}

.section {
  padding-block: 40px;
}

.section-alt {
  position: relative;
}

.section-alt::before {
  content: "";
  position: absolute;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  inset-block: 0;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.025), transparent 58%);
  pointer-events: none;
}

.section-inner {
  position: relative;
  z-index: 1;
}

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

.section-header-center {
  text-align: center;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 4px;
}

.section-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-intro {
  margin-top: 10px;
  color: var(--text-muted);
  max-width: 640px;
}

.section-header-center .section-intro {
  margin-inline: auto;
}

.text-strong {
  color: #e5e7eb;
  font-weight: 600;
}

/* Hero */

.section-hero {
  padding-top: 24px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr);
  gap: 40px;
  align-items: center;
}

.hero-title {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.hero-role {
  color: #c5c9cd;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.hero-body {
  font-size: 15px;
  color: var(--text-muted);
}

.hero-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

/* Loading state for buttons */
.btn-loading {
  opacity: 0.7;
  pointer-events: none;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.meta-item {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.meta-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-soft);
  margin-bottom: 2px;
}

.meta-value {
  font-size: 13px;
}

.hero-aside {
  display: flex;
  justify-content: flex-end;
}

.card-profile {
  max-width: 320px;
  transition: border-color 0.3s ease;
  will-change: auto;
}

.card-profile:hover {
  transform: none;
}

.card-profile .card-profile-body {
  padding: 16px 18px 18px;
}
.avatar-wrapper {
  padding: 4px;
  border-radius: 26px;
  background: #3a3d41;
}

.avatar {
  border-radius: 22px;
  border: 4px solid var(--bg-surface);
  object-fit: cover;
  width: 100%;
  height: auto;
}

.card-profile-body p {
  font-size: 14px;
  color: var(--text-muted);
}

.inline-links {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* Cards & grids */

.card {
  background: var(--bg-surface);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--border-subtle);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease;
  will-change: transform;
}

.card:hover {
  transform: translateY(-4px);
  border-color: #5b6065;
}

.card h3 {
  font-size: 17px;
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-soft);
}

.card-meta {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 4px;
}

.card-body {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}

.card-list {
  margin-top: 10px;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 14px;
}

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

.grid {
  display: grid;
  gap: 18px;
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-skill-group h3 {
  margin-bottom: 6px;
}

.card-skill-group ul {
  list-style: none;
  margin-top: 6px;
}

.card-skill-group li {
  font-size: 14px;
  color: var(--text-muted);
}

.card-skill-group li + li {
  margin-top: 4px;
}

/* Skills section */

.skills-grid {
  margin-top: 10px;
}

/* Timeline */

.timeline {
  position: relative;
  margin-top: 16px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #5b6065;
  opacity: 0.5;
}

.timeline-item {
  position: relative;
  margin-left: 32px;
  margin-bottom: 16px;
}

.timeline-dot {
  position: absolute;
  left: -22px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #16181c;
  border: 2px solid var(--text-soft);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.07);
}

.timeline-content {
  padding-left: 4px;
}

/* Contact section */

.section-contact {
  padding-bottom: 56px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.contact-card {
  border-radius: 16px;
  padding: 14px 15px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
  will-change: transform;
}

.contact-card i {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-soft);
  border: 1px solid var(--control-border);
  color: var(--icon-color);
  font-size: 15px;
}

.contact-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.contact-value {
  display: block;
  font-size: 14px;
  color: var(--text-main);
  overflow-wrap: anywhere;
}

.contact-card:hover {
  transform: translateY(-2px);
  border-color: #5b6065;
}

.contact-card:hover i {
  background: #2a2e32;
  border-color: #71767b;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 16px 0 18px;
  background: var(--bg-surface);
}

.site-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding-inline: 24px;
  font-size: 13px; /* Slightly bumped for legibility */
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-footer strong {
  font-weight: 600;
  color: var(--text-main);
}

/* Scroll behavior styling */

.site-header--scrolled {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* Shared controls: every action uses the same size, shape, and states. */

.btn,
.link-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--action-bg);
  color: var(--action-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn:hover,
.link-inline:hover {
  background: var(--action-hover);
}

.btn i,
.link-inline i {
  width: 16px;
  font-size: 14px;
  line-height: 1;
  text-align: center;
  flex-shrink: 0;
}

.link-inline {
  align-self: flex-start;
  margin-top: 18px;
}

.card-cert {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.cert-icon,
.skill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--control-hover);
  color: var(--icon-color);
  font-size: 20px;
}

.card-cert .card-body {
  margin-bottom: 18px;
}

.card-cert .link-inline {
  margin-top: auto;
}

.icon-button,
.inline-links a,
.back-to-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--control-border);
  border-radius: 50%;
  background: var(--control-bg);
  color: var(--control-text);
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.icon-button:hover,
.inline-links a:hover,
.back-to-top:hover {
  background: var(--control-hover);
  border-color: var(--text-muted);
}

.icon-button i,
.inline-links a i,
.back-to-top i {
  font-size: 15px;
}

.btn:focus-visible,
.link-inline:focus-visible,
.icon-button:focus-visible,
.inline-links a:focus-visible,
.back-to-top:focus-visible {
  outline: 2px solid var(--control-focus);
  outline-offset: 4px;
}

.nav-toggle {
  display: none;
}

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
}

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

@media (max-width: 520px) {
  .hero-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Responsive */

@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.1fr);
    gap: 30px;
  }

  .hero-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Collapse the nav into a hamburger: the uppercase links don't fit next to the brand */
  .header-actions {
    display: flex;
  }

  .site-nav {
    position: fixed;
    inset-inline: 0;
    top: 66px; /* flush with the fixed header height */
    background: rgba(0, 0, 0, 0.98);
    border-bottom: 1px solid #2f3336;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 16px 14px;
    gap: 10px;
    transform: translateY(-20px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  }

  .site-nav.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    /* Become visible immediately so keyboard focus can move into the menu */
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
  }

  .nav-toggle {
    display: flex;
  }
}

@media (max-width: 768px) {
  .site-header-inner {
    padding-inline: 16px;
  }

  .page-main {
    padding-inline: 16px;
  }

  .hero-grid {
    display: flex;
    flex-direction: column-reverse;
    gap: 24px;
  }

  .hero-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .contact-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 26px;
  }

  .site-footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

/* Experience */

.card-experience {
  padding: 28px;
}

.card-experience:hover,
.card-featured:hover {
  transform: none;
}

.experience-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-experience .experience-header h3 {
  font-size: 22px;
  margin-bottom: 2px;
}

.experience-company {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-strong);
}

.experience-meta {
  font-size: 13px;
  line-height: 1.5;
  text-align: right;
  color: var(--text-soft);
}

.focus-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.focus-item {
  padding: 16px 18px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-surface-soft);
  transition: border-color 0.2s ease;
}

.focus-item:hover {
  border-color: var(--border-strong);
}

.focus-item h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.focus-item p {
  font-size: 14px;
  color: var(--text-muted);
}

.company-logo {
  box-sizing: content-box;
  width: 24px;
  height: 24px;
  padding: 5px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
}

.focus-item-head,
.project-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.focus-item-head {
  margin-bottom: 10px;
}

.project-head h3 {
  margin-bottom: 0;
}

.project-head {
  align-items: flex-start;
  margin-bottom: 14px;
}

.focus-item-head .skill-icon,
.project-head .skill-icon {
  flex-shrink: 0;
  margin-bottom: 0;
}

/* Projects */

.project-category {
  margin-bottom: 4px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.card-featured {
  padding: 28px;
  border-color: var(--border-strong);
}

.card-featured h3 {
  font-size: 22px;
}

.featured-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 8px 32px;
  align-items: start;
}

.featured-body .card-body,
.featured-body .card-list {
  margin-top: 0;
}

.card-tech {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-soft);
}

.project-group-label {
  margin: 32px 0 14px;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.card-project {
  display: flex;
  flex-direction: column;
}

.card-project h3 {
  font-size: 16px;
}

.card-project .card-tech {
  margin-top: auto;
}

.card-project .card-list {
  margin-bottom: 18px;
}

.card-project .link-inline {
  margin-top: 16px;
}

@media (max-width: 768px) {
  .card-experience,
  .card-featured {
    padding: 20px;
  }

  .experience-header {
    flex-direction: column;
  }

  .experience-meta {
    text-align: left;
  }

  .focus-grid,
  .project-grid,
  .featured-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .featured-body {
    gap: 0;
  }

  .featured-body .card-list {
    margin-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

