@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

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

/* ===== Smooth Scrolling for Skip Links & Anchor Navigation ===== */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

main [id] {
  scroll-margin-top: 6.5rem;
}

@media (max-width: 768px) {
  main [id] {
    scroll-margin-top: 5.25rem;
  }
}

/* ====== Light Mode Styles ====== */

:root {
    --primary-bg: #FBFDFD;
    --secondary-bg: #E7F1F2;
    --heading-color: #1F2A32;
    --body-text: #3C4A54;
    --accent: #1E6F72;
    --hover-accent: #33A6A6;
    --border: #D6DEE2;
}

html {
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--primary-bg);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow-x: hidden;
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--primary-bg);
  color: var(--body-text);
}

header,
footer {
  flex-shrink: 0;
}

/* ===== Full-Screen Article Image Viewer ===== */
.article-image-trigger {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
  overflow: hidden;
}

.code-screenshot .article-image-trigger {
  border-radius: 18px;
}

.article-image-trigger::after {
  content: "View full screen";
  position: absolute;
  right: 0.65rem;
  bottom: 0.65rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(7, 16, 19, 0.86);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.article-image-trigger:hover::after,
.article-image-trigger:focus-visible::after {
  background: var(--accent);
}

.article-image-trigger:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.image-viewer[hidden] {
  display: none;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  background: rgba(4, 9, 12, 0.97);
  color: #fff;
}

.image-viewer__close {
  position: fixed;
  top: max(0.8rem, env(safe-area-inset-top));
  right: max(0.8rem, env(safe-area-inset-right));
  z-index: 2;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: rgba(7, 16, 19, 0.88);
  cursor: pointer;
}

.image-viewer__close::before,
.image-viewer__close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.45rem;
  height: 2px;
  border-radius: 999px;
  background: #fff;
}

.image-viewer__close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.image-viewer__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.image-viewer__close:hover {
  background: var(--accent);
}

.image-viewer__close:focus-visible,
.image-viewer__stage:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.image-viewer__stage {
  width: 100%;
  height: 100%;
  padding: calc(5rem + env(safe-area-inset-top)) 1rem calc(4.5rem + env(safe-area-inset-bottom));
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.image-viewer__image {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  margin: 0 auto;
  border-radius: 8px;
  background: #fff;
}

.image-viewer__caption {
  width: min(100%, 70ch);
  margin: 1rem auto 0;
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
}

.image-viewer__hint {
  position: fixed;
  left: 50%;
  bottom: max(0.8rem, env(safe-area-inset-bottom));
  z-index: 2;
  width: max-content;
  max-width: calc(100% - 2rem);
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  background: rgba(7, 16, 19, 0.88);
  color: #fff;
  font-size: 0.82rem;
  line-height: 1.2;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

@media (max-width: 768px) {
  .article-image-trigger::after {
    right: 0.5rem;
    bottom: 0.5rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .image-viewer {
    animation: image-viewer-fade-in 0.16s ease-out;
  }

  @keyframes image-viewer-fade-in {
    from {
      opacity: 0;
    }
  }
}

html.high-contrast .article-image-trigger {
  border: 2px solid var(--border) !important;
  background: transparent !important;
}

html.high-contrast .article-image-trigger::after,
html.high-contrast .image-viewer__close {
  background: #000 !important;
  color: #fff !important;
  border-color: var(--border) !important;
}

/* ===== CV PDF Viewer ===== */
.cv-viewer[hidden] {
  display: none;
}

.cv-viewer {
  position: fixed;
  inset: 0;
  z-index: 5200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background:
    linear-gradient(120deg, rgba(244, 246, 247, 0.92), rgba(231, 241, 242, 0.86)),
    rgba(255, 255, 255, 0.82);
  color: var(--heading-color);
  backdrop-filter: blur(8px);
}

.cv-viewer__dialog {
  display: flex;
  flex-direction: column;
  width: min(100%, 96rem);
  height: min(100%, 56rem);
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(214, 222, 226, 0.88);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 28px 74px rgba(31, 42, 50, 0.24);
}

.cv-viewer__header {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) auto auto;
  align-items: center;
  gap: clamp(0.85rem, 1.4vw, 1.6rem);
  min-height: 7.5rem;
  padding: 1.35rem 1.95rem;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  color: var(--heading-color);
}

.cv-viewer__header-text {
  min-width: 0;
}

.cv-viewer__title {
  margin: 0 0 0.28rem;
  font-size: clamp(1.35rem, 1.9vw, 1.75rem);
  line-height: 1.2;
}

.cv-viewer__meta {
  margin: 0;
  color: #6a7a86;
  font-size: 0.95rem;
  line-height: 1.3;
}

.cv-viewer__actions {
  display: flex;
  align-items: center;
  gap: clamp(0.7rem, 1vw, 1rem);
  flex-shrink: 0;
}

.cv-viewer__action,
.cv-viewer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-height: 3.35rem;
  border-radius: 10px;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.cv-viewer__action {
  padding: 0 1.35rem;
  border: 1px solid rgba(30, 111, 114, 0.18);
  background: linear-gradient(140deg, #218489 0%, #0e686e 100%);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(30, 111, 114, 0.2);
}

.cv-viewer__icon {
  flex: 0 0 auto;
  width: 1.2rem;
  height: 1.2rem;
  stroke: currentColor;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.cv-viewer__action:nth-child(2) {
  border-color: var(--border);
  background: #ffffff;
  color: var(--heading-color);
  box-shadow: 0 8px 18px rgba(31, 42, 50, 0.06);
}

.cv-viewer__action:hover,
.cv-viewer__action:focus-visible {
  background: linear-gradient(140deg, #26999f 0%, #13777e 100%);
  border-color: rgba(30, 111, 114, 0.28);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(30, 111, 114, 0.24);
}

.cv-viewer__action:nth-child(2):hover,
.cv-viewer__action:nth-child(2):focus-visible {
  border-color: rgba(30, 111, 114, 0.38);
  background: #f8fbfb;
  color: var(--accent);
  box-shadow: 0 10px 22px rgba(31, 42, 50, 0.09);
}

.cv-viewer__action:disabled {
  opacity: 0.58;
  cursor: wait;
}

.cv-viewer__action:visited {
  color: #ffffff;
}

.cv-viewer__close {
  position: relative;
  width: 3.35rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--heading-color);
  box-shadow: 0 8px 18px rgba(31, 42, 50, 0.06);
}

.cv-viewer__close::before,
.cv-viewer__close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.05rem;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.cv-viewer__close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.cv-viewer__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.cv-viewer__close:hover,
.cv-viewer__close:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(31, 42, 50, 0.09);
}

.cv-viewer__action:focus-visible,
.cv-viewer__close:focus-visible {
  outline: 3px solid var(--hover-accent);
  outline-offset: 2px;
}

.cv-viewer__toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  min-height: 0;
  padding: 0;
  border-bottom: 0;
  background: transparent;
  color: var(--heading-color);
}

.cv-viewer__toolbar-group {
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 3.35rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(31, 42, 50, 0.06);
}

.cv-viewer__toolbar-group--right {
  margin-left: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.cv-viewer__toolbar-button,
.cv-viewer__fit-button {
  min-height: 3.35rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--heading-color);
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.cv-viewer__toolbar-button {
  width: 3.1rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}

.cv-viewer__zoom-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-width: 4.7rem;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--heading-color);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  text-align: center;
}

.cv-viewer__fit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0 1.25rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(31, 42, 50, 0.06);
}

.cv-viewer__toolbar-button:hover,
.cv-viewer__toolbar-button:focus-visible,
.cv-viewer__fit-button:hover,
.cv-viewer__fit-button:focus-visible {
  border-color: var(--accent);
  outline: 3px solid rgba(51, 166, 166, 0.18);
  outline-offset: 2px;
  background: #f8fbfb;
  color: var(--accent);
}

.cv-viewer__toolbar-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.cv-viewer__mobile-controls,
.cv-viewer__page-rail-close {
  display: none;
}

.cv-viewer__preview {
  display: grid;
  grid-template-columns: clamp(6.75rem, 8.5vw, 8.75rem) minmax(0, 1fr);
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #dfe3e8;
}

.cv-viewer__page-rail {
  min-height: 0;
  overflow-y: auto;
  border-right: 1px solid rgba(31, 42, 50, 0.12);
  padding: 1.4rem 0.45rem;
  background: rgba(248, 251, 251, 0.72);
}

.cv-viewer__page-rail-title {
  margin: 0 0 1.25rem;
  color: #60717d;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.cv-viewer__page-list {
  display: grid;
  gap: 1.35rem;
}

.cv-viewer__page-button {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--heading-color);
  font: inherit;
  cursor: pointer;
}

.cv-viewer__page-button:hover,
.cv-viewer__page-button:focus-visible,
.cv-viewer__page-button.is-active {
  background: transparent;
}

.cv-viewer__page-button:focus-visible {
  outline: 3px solid var(--hover-accent);
  outline-offset: 2px;
}

.cv-viewer__page-button.is-active {
  box-shadow: none;
}

.cv-viewer__page-thumb {
  position: relative;
  display: block;
  width: min(100%, 5.35rem);
  aspect-ratio: 0.72;
  border: 1px solid rgba(31, 42, 50, 0.14);
  border-radius: 5px;
  background: linear-gradient(180deg, #ffffff, #fbfdfd);
  box-shadow: 0 8px 16px rgba(31, 42, 50, 0.12);
  opacity: 0.85;
  overflow: hidden;
  transform: scale(0.95);
  transform-origin: center bottom;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}

.cv-viewer__page-button.is-active .cv-viewer__page-thumb {
  border-color: var(--accent);
  opacity: 1;
  box-shadow:
    0 0 0 2px var(--accent),
    0 10px 20px rgba(31, 42, 50, 0.14);
  transform: scale(1);
}

.cv-viewer__page-preview {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  border: 0;
  background: #ffffff;
  pointer-events: none;
}

.cv-viewer__page-label {
  display: grid;
  align-items: center;
  justify-content: center;
  justify-items: center;
  gap: 0.18rem;
  min-width: 0;
  color: #40505a;
  line-height: 1.1;
}

.cv-viewer__page-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  min-height: 1.45rem;
  padding: 0 0.35rem;
  border-radius: 8px;
  background: rgba(214, 222, 226, 0.72);
  color: #1f2a32;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.cv-viewer__page-title {
  color: #60717d;
  font-size: 0.72rem;
  font-weight: 700;
}

.cv-viewer__page-button.is-active .cv-viewer__page-number {
  background: var(--accent);
  color: #ffffff;
}

.cv-viewer__page-button.is-active .cv-viewer__page-title {
  color: var(--accent);
}

.cv-viewer__frame-wrap {
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 0;
  background: #dfe3e8;
  box-shadow: none;
  color-scheme: light;
}

.cv-viewer__frame-stage {
  position: relative;
  display: block;
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  padding: 1rem;
  box-sizing: border-box;
  background: transparent;
}

.cv-viewer__document {
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  width: 100%;
}

.cv-viewer__document-page {
  display: block;
  max-width: 100%;
  background: transparent;
}

.cv-viewer__status {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  margin: 0;
  max-width: min(28rem, calc(100% - 2rem));
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--heading-color);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 8px 18px rgba(31, 42, 50, 0.12);
}

.cv-viewer__status[hidden] {
  display: none;
}

.cv-viewer__print-frame {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.cv-viewer__frame {
  flex: 0 0 auto;
  display: block;
  width: auto;
  height: auto;
  min-height: 0;
  max-width: none;
  border: 0;
  outline: 0;
  background: #ffffff;
  box-shadow: none;
  color-scheme: light;
  transform-origin: top left;
}

@media (max-width: 760px) {
  .cv-viewer {
    padding: 0;
    background: #f6f8f9;
  }

  .cv-viewer__dialog {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
  }

  .cv-viewer__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title actions";
    align-items: center;
    gap: 0.35rem;
    min-height: 6.4rem;
    overflow: visible;
    padding: calc(1.35rem + env(safe-area-inset-top)) max(1.05rem, env(safe-area-inset-right)) 1.35rem max(1.05rem, env(safe-area-inset-left));
    border-bottom-color: rgba(31, 42, 50, 0.1);
    box-shadow: 0 1px 0 rgba(31, 42, 50, 0.03);
    position: relative;
    z-index: 2;
  }

  .cv-viewer__header-text {
    grid-area: title;
    display: block;
    min-width: 0;
    min-height: 0;
  }

  .cv-viewer__header-text::before {
    content: none;
    display: none;
  }

  .cv-viewer__title {
    margin-bottom: 0.14rem;
    overflow: hidden;
    font-size: clamp(1.45rem, 6.8vw, 1.9rem);
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cv-viewer__meta {
    overflow: hidden;
    font-size: clamp(1rem, 4.5vw, 1.35rem);
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cv-viewer__actions {
    grid-area: actions;
    justify-content: flex-end;
    gap: 0.42rem;
  }

  .cv-viewer__action {
    flex: 0 0 auto;
    width: 3.4rem;
    height: 3.4rem;
    min-height: 3.4rem;
    padding: 0;
    gap: 0;
    border-radius: 10px;
    font-size: 0;
  }

  .cv-viewer__action .cv-viewer__icon {
    display: block;
    width: 1.5rem;
    height: 1.5rem;
    margin: 0;
  }

  .cv-viewer__action:nth-child(2) {
    width: 3.4rem;
    height: 3.4rem;
    min-height: 3.4rem;
    border-color: rgba(31, 42, 50, 0.12);
  }

  .cv-viewer__close {
    width: 3.4rem;
    height: 3.4rem;
    min-height: 3.4rem;
    border-color: rgba(31, 42, 50, 0.12);
    border-radius: 10px;
  }

  .cv-viewer__close::before,
  .cv-viewer__close::after {
    width: 1.3rem;
  }

  .cv-viewer__toolbar {
    display: none;
  }

  .cv-viewer__mobile-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    position: relative;
    z-index: 4;
  }

  .cv-viewer__mobile-pages-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    border: 1px solid rgba(31, 42, 50, 0.1);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--heading-color);
    font: inherit;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(31, 42, 50, 0.1);
    cursor: pointer;
  }

  .cv-viewer__mobile-pages-toggle {
    gap: 0.5rem;
    padding: 0 0.9rem;
    color: var(--accent);
  }

  .cv-viewer__mobile-controls .cv-viewer__icon {
    width: 1rem;
    height: 1rem;
    stroke-width: 2.2;
  }

  .cv-viewer__mobile-chevron {
    width: 0.48rem;
    height: 0.48rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.16s ease;
  }

  .cv-viewer.is-pages-panel-open .cv-viewer__mobile-chevron {
    transform: translateY(2px) rotate(225deg);
  }

  .cv-viewer__preview {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem max(1.05rem, env(safe-area-inset-right)) max(0.95rem, env(safe-area-inset-bottom)) max(1.05rem, env(safe-area-inset-left));
    overflow: hidden;
    background: #f2f5f6;
    position: relative;
    z-index: 1;
  }

  .cv-viewer__page-rail {
    display: none;
    position: absolute;
    top: 4.55rem;
    right: max(1.05rem, env(safe-area-inset-right));
    left: max(1.05rem, env(safe-area-inset-left));
    z-index: 5;
    overflow: visible;
    min-height: 0;
    border-right: 0;
    border-bottom: 0;
    border: 1px solid rgba(31, 42, 50, 0.08);
    border-radius: 10px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 22px 44px rgba(31, 42, 50, 0.22);
  }

  .cv-viewer.is-pages-panel-open .cv-viewer__page-rail {
    display: block;
  }

  .cv-viewer.is-pages-panel-open .cv-viewer__frame-wrap {
    filter: brightness(0.92);
  }

  .cv-viewer__page-rail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
  }

  .cv-viewer__page-rail-title {
    margin: 0;
    color: var(--heading-color);
    font-size: 0.98rem;
    letter-spacing: 0;
    text-transform: none;
  }

  .cv-viewer__page-rail-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0 0.2rem;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
  }

  .cv-viewer__page-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.62rem;
    overflow: visible;
    padding: 0;
  }

  .cv-viewer__page-button {
    display: grid;
    grid-template-columns: 4.4rem minmax(0, 1fr);
    align-items: center;
    justify-items: stretch;
    gap: 0.9rem;
    width: 100%;
    min-height: 5.15rem;
    padding: 0.68rem 0.8rem;
    border: 1px solid rgba(31, 42, 50, 0.1);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(31, 42, 50, 0.06);
  }

  .cv-viewer__page-button.is-active {
    border-color: var(--accent);
    background: linear-gradient(90deg, rgba(30, 111, 114, 0.08), rgba(255, 255, 255, 0.94));
    box-shadow: 0 8px 18px rgba(30, 111, 114, 0.1);
  }

  .cv-viewer__page-thumb {
    width: 3.75rem;
    border-radius: 5px;
    opacity: 0.88;
    transform: none;
    box-shadow: 0 6px 14px rgba(31, 42, 50, 0.12);
  }

  .cv-viewer__page-button.is-active .cv-viewer__page-thumb {
    border-color: rgba(31, 42, 50, 0.14);
    box-shadow: 0 6px 14px rgba(31, 42, 50, 0.12);
  }

  .cv-viewer__page-label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.72rem;
  }

  .cv-viewer__page-number {
    min-width: 1.6rem;
    min-height: 1.6rem;
    border-radius: 8px;
    font-size: 0.8rem;
  }

  .cv-viewer__page-title {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.92rem;
    line-height: 1.1;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cv-viewer__frame-wrap {
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transition: filter 0.16s ease;
  }

  .cv-viewer__frame-stage {
    padding: 0;
  }

  .cv-viewer__document {
    gap: 1rem;
  }

  .cv-viewer__frame {
    box-shadow: 0 12px 28px rgba(31, 42, 50, 0.08);
  }
}

@media (max-width: 430px) {
  .cv-viewer__header {
    gap: 0.3rem;
    min-height: 6.1rem;
    padding-right: max(0.85rem, env(safe-area-inset-right));
    padding-left: max(0.85rem, env(safe-area-inset-left));
  }

  .cv-viewer__title {
    font-size: 1.48rem;
  }

  .cv-viewer__meta {
    font-size: 1.05rem;
  }

  .cv-viewer__actions {
    gap: 0.35rem;
  }

  .cv-viewer__action,
  .cv-viewer__action:nth-child(2),
  .cv-viewer__close {
    width: 3.05rem;
    height: 3.05rem;
    min-height: 3.05rem;
  }

  .cv-viewer__action .cv-viewer__icon {
    width: 1.38rem;
    height: 1.38rem;
  }

  .cv-viewer__mobile-pages-toggle {
    min-height: 2.62rem;
    padding: 0 0.78rem;
    font-size: 0.86rem;
  }

  .cv-viewer__preview {
    padding-right: max(0.85rem, env(safe-area-inset-right));
    padding-left: max(0.85rem, env(safe-area-inset-left));
  }

  .cv-viewer__page-rail {
    top: 4.35rem;
    right: max(0.85rem, env(safe-area-inset-right));
    left: max(0.85rem, env(safe-area-inset-left));
    padding: 0.85rem;
  }

  .cv-viewer__page-button {
    grid-template-columns: 4rem minmax(0, 1fr);
    gap: 0.75rem;
    min-height: 4.9rem;
    padding: 0.62rem 0.68rem;
  }

  .cv-viewer__page-thumb {
    width: 3.45rem;
  }

  .cv-viewer__page-title {
    font-size: 0.84rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .cv-viewer {
    animation: image-viewer-fade-in 0.16s ease-out;
  }
}

html.reduce-motion .cv-viewer,
html.reduce-motion .cv-viewer *,
html.reduce-motion .cv-viewer *::before,
html.reduce-motion .cv-viewer *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

html.reduce-motion .cv-viewer__action:hover,
html.reduce-motion .cv-viewer__action:focus-visible,
html.reduce-motion .cv-viewer__close:hover,
html.reduce-motion .cv-viewer__close:focus-visible,
html.reduce-motion .cv-viewer__toolbar-button:hover,
html.reduce-motion .cv-viewer__toolbar-button:focus-visible,
html.reduce-motion .cv-viewer__fit-button:hover,
html.reduce-motion .cv-viewer__fit-button:focus-visible {
  transform: none !important;
}

html.reduce-motion .cv-viewer__page-thumb,
html.reduce-motion .cv-viewer__page-button.is-active .cv-viewer__page-thumb {
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .cv-viewer,
  .cv-viewer *,
  .cv-viewer *::before,
  .cv-viewer *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .cv-viewer__action:hover,
  .cv-viewer__action:focus-visible,
  .cv-viewer__close:hover,
  .cv-viewer__close:focus-visible,
  .cv-viewer__toolbar-button:hover,
  .cv-viewer__toolbar-button:focus-visible,
  .cv-viewer__fit-button:hover,
  .cv-viewer__fit-button:focus-visible {
    transform: none !important;
  }

  .cv-viewer__page-thumb,
  .cv-viewer__page-button.is-active .cv-viewer__page-thumb {
    transform: none !important;
  }
}

body.dark-mode .cv-viewer__dialog {
  border-color: var(--border);
  background: #0f171b;
  box-shadow: 0 28px 74px rgba(0, 0, 0, 0.46);
}

body.dark-mode .cv-viewer__header,
body.dark-mode .cv-viewer__close {
  background: #101a1f;
  color: #f5fbfc;
}

body.dark-mode .cv-viewer__meta {
  color: #aebbc2;
}

body.dark-mode .cv-viewer__header-text::before {
  border-color: rgba(99, 210, 207, 0.22);
  background: rgba(99, 210, 207, 0.12);
  color: var(--hover-accent);
}

body.dark-mode .cv-viewer__preview {
  background:
    linear-gradient(180deg, rgba(16, 26, 31, 0.98), rgba(9, 15, 18, 0.98)),
    #0b1216;
}

body.dark-mode .cv-viewer__page-rail {
  background: #141f24;
  border-color: rgba(255, 255, 255, 0.16);
  border-right-color: var(--border);
}

body.dark-mode .cv-viewer__page-label {
  color: #d7e1e4;
}

body.dark-mode .cv-viewer__page-rail-title,
body.dark-mode .cv-viewer__page-title {
  color: #d7e1e4;
}

body.dark-mode .cv-viewer__page-number {
  background: rgba(255, 255, 255, 0.16);
  color: #f5fbfc;
}

body.dark-mode .cv-viewer__page-button.is-active .cv-viewer__page-title {
  color: var(--hover-accent);
}

body.dark-mode .cv-viewer__page-button {
  border-color: rgba(255, 255, 255, 0.12);
  background: #101a1f;
  color: #f5fbfc;
}

body.dark-mode .cv-viewer__page-button:hover,
body.dark-mode .cv-viewer__page-button:focus-visible,
body.dark-mode .cv-viewer__page-button.is-active {
  border-color: var(--hover-accent);
  background: rgba(99, 210, 207, 0.12);
}

body.dark-mode .cv-viewer__mobile-pages-toggle {
  border-color: rgba(255, 255, 255, 0.16);
  background: #121d22;
  color: #f5fbfc;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

body.dark-mode .cv-viewer__mobile-pages-toggle,
body.dark-mode .cv-viewer__page-rail-close {
  color: var(--hover-accent);
}

body.dark-mode .cv-viewer__toolbar {
  border-bottom-color: var(--border);
  background: #101a1f;
}

body.dark-mode .cv-viewer__toolbar-button,
body.dark-mode .cv-viewer__fit-button,
body.dark-mode .cv-viewer__action:nth-child(2),
body.dark-mode .cv-viewer__close {
  border-color: rgba(255, 255, 255, 0.16);
  background: #121d22;
  color: #f5fbfc;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

body.dark-mode .cv-viewer__toolbar-group {
  border-color: rgba(255, 255, 255, 0.16);
  background: #121d22;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

body.dark-mode .cv-viewer__zoom-value {
  border-left-color: rgba(255, 255, 255, 0.16);
  border-right-color: rgba(255, 255, 255, 0.16);
}

body.dark-mode .cv-viewer__zoom-value {
  color: #f5fbfc;
}

body.dark-mode .cv-viewer__page-thumb {
  border-color: rgba(255, 255, 255, 0.22);
  background: #000000;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.28);
}

body.dark-mode .cv-viewer__page-preview,
body.dark-mode .cv-viewer__frame {
  background: #000000;
  filter: invert(1) hue-rotate(180deg);
}

body.dark-mode .cv-viewer__frame-wrap,
body.dark-mode .cv-viewer__frame-stage {
  background: #0b1216;
  box-shadow: none;
}

body.dark-mode .cv-viewer__frame-wrap,
body.dark-mode .cv-viewer__page-rail,
body.dark-mode .cv-viewer__page-list {
  scrollbar-color: rgba(215, 225, 228, 0.42) #0b1216;
}

body.dark-mode .cv-viewer__frame-wrap::-webkit-scrollbar,
body.dark-mode .cv-viewer__page-rail::-webkit-scrollbar,
body.dark-mode .cv-viewer__page-list::-webkit-scrollbar {
  background: #0b1216;
}

body.dark-mode .cv-viewer__frame-wrap::-webkit-scrollbar-track,
body.dark-mode .cv-viewer__page-rail::-webkit-scrollbar-track,
body.dark-mode .cv-viewer__page-list::-webkit-scrollbar-track,
body.dark-mode .cv-viewer__frame-wrap::-webkit-scrollbar-corner,
body.dark-mode .cv-viewer__page-rail::-webkit-scrollbar-corner,
body.dark-mode .cv-viewer__page-list::-webkit-scrollbar-corner {
  background: #0b1216;
}

body.dark-mode .cv-viewer__frame-wrap::-webkit-scrollbar-thumb,
body.dark-mode .cv-viewer__page-rail::-webkit-scrollbar-thumb,
body.dark-mode .cv-viewer__page-list::-webkit-scrollbar-thumb {
  background: rgba(215, 225, 228, 0.42);
  border: 2px solid #0b1216;
  border-radius: 999px;
}

body.dark-mode .cv-viewer__action:nth-child(2):hover,
body.dark-mode .cv-viewer__action:nth-child(2):focus-visible,
body.dark-mode .cv-viewer__toolbar-button:hover,
body.dark-mode .cv-viewer__toolbar-button:focus-visible,
body.dark-mode .cv-viewer__fit-button:hover,
body.dark-mode .cv-viewer__fit-button:focus-visible,
body.dark-mode .cv-viewer__close:hover,
body.dark-mode .cv-viewer__close:focus-visible {
  border-color: rgba(99, 210, 207, 0.52);
  background: rgba(99, 210, 207, 0.12);
  color: var(--hover-accent);
}

html.high-contrast .cv-viewer,
html.high-contrast .cv-viewer__dialog,
html.high-contrast .cv-viewer__header,
html.high-contrast .cv-viewer__preview,
html.high-contrast .cv-viewer__frame-wrap,
html.high-contrast .cv-viewer__page-rail,
html.high-contrast .cv-viewer__page-button,
html.high-contrast .cv-viewer__page-thumb,
html.high-contrast .cv-viewer__toolbar,
html.high-contrast .cv-viewer__toolbar-group,
html.high-contrast .cv-viewer__toolbar-button,
html.high-contrast .cv-viewer__fit-button,
html.high-contrast .cv-viewer__mobile-pages-toggle,
html.high-contrast .cv-viewer__page-rail-close,
html.high-contrast .cv-viewer__action,
html.high-contrast .cv-viewer__close {
  border-color: var(--border) !important;
  background: #000000 !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

html.high-contrast .cv-viewer__action:focus-visible,
html.high-contrast .cv-viewer__close:focus-visible {
  outline-color: var(--border) !important;
}

html.high-contrast .cv-viewer__header-text::before {
  border: 2px solid var(--border) !important;
  background: #000000 !important;
  color: #ffffff !important;
}

html.high-contrast .cv-viewer__zoom-value {
  border-left-color: var(--border) !important;
  border-right-color: var(--border) !important;
}

html.high-contrast .cv-viewer__preview {
  background: #dfe3e8 !important;
}

html.high-contrast .cv-viewer__frame-wrap,
html.high-contrast .cv-viewer__frame-stage {
  background: #dfe3e8 !important;
  box-shadow: none !important;
  color-scheme: light;
}

html.high-contrast .cv-viewer__frame {
  background: #ffffff !important;
  box-shadow: none !important;
  color-scheme: light;
}

html.high-contrast .cv-viewer__status {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: transparent !important;
}

/* ===== Shared Back-To-Top Control ===== */
.back-to-top {
  position: fixed;
  right: calc(1.25rem + env(safe-area-inset-right, 0px));
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 1200;
  max-width: calc(100vw - 2.5rem);
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

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

.back-to-top:hover {
  background: var(--hover-accent);
}

.back-to-top:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 768px) {
  .back-to-top {
    right: calc(0.85rem + env(safe-area-inset-right, 0px));
    bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 1.7rem);
    padding: 0.64rem 0.9rem;
    font-size: 0.86rem;
  }
}

/* ===== Accessibility: Skip Link (Fully Detached - No Layout Shift) ===== */
.skip-link {
  position: fixed;
  top: 0;
  left: 1rem;
  transform: translateY(-120%);
  background: linear-gradient(
    to bottom right,
    rgba(255, 255, 255, 0.25),
    rgba(30, 111, 114, 0.06)
  );
  backdrop-filter: blur(6px);
  border: 1px solid rgba(30, 111, 114, 0.15);
  border-radius: 50px;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--heading-color);
  letter-spacing: 0.01875rem;
  text-align: center;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3),
              inset 0 -1px 2px rgba(0, 0, 0, 0.05),
              0 2px 6px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  height: auto;
}
/* ===== Accessibility: Skip Link Focused State ===== */
.skip-link:focus-visible {
  transform: translateY(10px);
  opacity: 1;
  pointer-events: auto;
  background: linear-gradient(
    to bottom right,
    rgba(255, 255, 255, 0.35),
    rgba(30, 111, 114, 0.08)
  );
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.4),
              0 3px 6px rgba(30, 111, 114, 0.15);
  color: var(--accent);
  outline: none;
}

/* Dark Mode Adaptation */
body.dark-mode .skip-link {
  background: linear-gradient(
    to bottom right,
    rgba(255, 255, 255, 0.08),
    rgba(92, 194, 194, 0.1)
  );
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--body-text);
}

body.dark-mode .skip-link:focus-visible {
  background: linear-gradient(
    to bottom right,
    rgba(255, 255, 255, 0.15),
    rgba(92, 194, 194, 0.15)
  );
  color: var(--hover-accent);
}

/* ===== Accessibility: Hidden Utility Class ===== */
.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* ====== Dark Mode Styles ====== */
body.dark-mode {
  --primary-bg: #10171b;
  --secondary-bg: #172126;
  --heading-color: #eef5f6;
  --body-text: #cad6da;
  --accent: #63d2cf;
  --hover-accent: #8ee8e3;
  --border: #33434a;
  --surface-bg: #1a252b;
  --surface-bg-strong: #223039;
  --surface-muted: #142026;
  --field-bg: #111b20;
  --shadow-soft: 0 18px 42px rgba(0, 0, 0, 0.34);
  background-color: var(--primary-bg);
  color: var(--body-text);
  color-scheme: dark;
  transition: background-color 0.4s ease, color 0.4s ease;
}

body.dark-mode main,
body.dark-mode section {
  color: var(--body-text);
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
  color: var(--heading-color);
}

body.dark-mode p,
body.dark-mode li,
body.dark-mode dt,
body.dark-mode dd,
body.dark-mode figcaption,
body.dark-mode td,
body.dark-mode th {
  color: var(--body-text);
}

body.dark-mode .nav-menu,
body.dark-mode .nav-footer {
  background: var(--secondary-bg);
  border-color: var(--border);
}

body.dark-mode .nav-footer::before {
  background: linear-gradient(to top, var(--secondary-bg), rgba(23, 33, 38, 0));
}

body.dark-mode .theme-toggle,
body.dark-mode .theme-toggle span,
body.dark-mode .copyright p {
  color: var(--body-text);
}

body.dark-mode .nav-menu a {
  color: var(--heading-color);
}

body.dark-mode .nav-menu a:hover,
body.dark-mode .nav-menu a:focus-visible,
body.dark-mode .nav-menu a[aria-current="page"] {
  color: var(--hover-accent);
}

body.dark-mode .nav-overlay {
  background: rgba(0, 0, 0, 0.58);
}

body.dark-mode .drawer-close .close-icon,
body.dark-mode .social-links img {
  filter: brightness(0) invert(1);
}

/* =========================================================
   NAVIGATION: Active / Current Page Indicator
   ========================================================= */

/* Active page text styling */
nav a[aria-current="page"],
.nav-menu a[aria-current="page"],
nav a.active,
.nav-menu a.active {
  color: var(--accent);
  font-weight: 600;
}

/* Make underline permanent for active page */
nav a[aria-current="page"]::after,
.nav-menu a[aria-current="page"]::after,
nav a.active::after,
.nav-menu a.active::after {
  transform: scaleX(1);
  transition: none;
}


/* ===== Desktop Reset for Navigation ===== */
@media (min-width: 901px) {
  .nav-menu ul {
    list-style: none;
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 2.5rem;
    text-align: right;
  }
  .nav-menu {
    flex: 0 1 auto; /* allow nav to shrink so the icon can move closer */
    display: flex;
    justify-content: center;
    position: static;
    width: auto;
    height: auto;
    background: none;
    box-shadow: none;
    border: none;
    align-items: center;
    visibility: visible;
    opacity: 1;
  }


  /* Hide mobile drawer logo on tablet and desktop */
  .nav-menu .nav-logo {
    display: none !important;
  }

  .nav-top,
  .nav-header {
    all: unset;
    display: flex;
    align-items: center;
  }

  header .container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;  /* equal spacing between logo, nav, accessibility */
    width: 100%;
  }

  .close-menu {
    display: none !important;
  }

  .nav-logo {
    width: clamp(48px, 5vw, 80px);
    margin: 0;
  }

  

  .accessibility-button {
    position: relative;   /* allow natural flow */
    top: 0;
    right: 0;
    left: 0;
    transform: none;
  }
}

/* ===== Header & Logo Optimization for Large Screens ===== */
@media (min-width: 1200px) {
    .logo img {
        height: clamp(46px, 3.8vw, 68px);
    }

    header .container {
        max-width: 1400px;
        margin: 0 auto;
        padding: 0.35rem 2rem;
    }
    /* (Do not touch .nav-menu ul here) */
}

/* =========================================================
   TABLET RESPONSIVE STYLING (e.g., iPad / iPad Pro)
   Handles mid-size layouts between desktop and mobile.
   ========================================================= */
@media (max-width: 1024px) and (min-width: 769px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 3rem 1.5rem;
    }

    .hero-text h1 {
        font-size: 2.2rem;
    }

    .stats {
        flex-wrap: wrap;
        gap: 1.2rem;
    }

    .project-card {
        flex: 1 1 calc(50% - 1rem);
    }

}

/* =========================================================
   MOBILE RESPONSIVE STYLING (Light Mode)
   This section handles layout and text adjustments for 
   mobile and tablet screens up to 768px wide.
   ========================================================= */
@media (max-width: 768px) {
    /* General adjustments */
    body {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    header {
        padding: 0.8rem 1rem;
    }





    /* Remove default focus highlight when menu first opens */
    .nav-menu a:focus:not(:focus-visible) {
      background: none;
      outline: none;
    }

/* Prevent any nav link from looking active on drawer open */
    .nav-menu.open a:focus,
    .nav-menu.open a:focus-visible {
      background: none !important;
      box-shadow: none !important;
      transform: none !important;
      color: var(--heading-color) !important;
      font-weight: 500 !important;
    }

    /* Keep hover/active styling only when user actually taps */
    .nav-menu a:hover,
    .nav-menu a:active {
      background: linear-gradient(
        to bottom right,
        rgba(255, 255, 255, 0.35),
        rgba(30, 111, 114, 0.08)
      );
      transform: translateY(-1px) scale(1.02);
      box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.4),
                  0 3px 6px rgba(30, 111, 114, 0.15);
      color: var(--accent);
      font-weight: 600;
    }

    /* Button fade-in animation */
    @keyframes fadeInUp {
      from {
        transform: translateY(10px);
        opacity: 0;
      }
      to {
        transform: translateY(0);
        opacity: 1;
      }
    }

    /* Dimmed overlay */
    .nav-overlay {
      position: fixed;
      inset: 0;
      background-color: rgba(0, 0, 0, 0.25);
      backdrop-filter: blur(4px);
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.3s ease;
      z-index: 999;
    }

    .nav-overlay.active {
      opacity: 1;
      visibility: visible;
    }

    /* === Accessibility Focus Trap Support for Mobile Drawer === */
    body.menu-open.using-keyboard main,
    body.menu-open.using-keyboard header,
    body.menu-open.using-keyboard footer {
      pointer-events: none;
      user-select: none;
      filter: blur(2px); /* only for keyboard users */
    }

    /* --- Overrides: keep header and controls interactive in keyboard (Tab) mode --- */
    body.menu-open.using-keyboard header {
      pointer-events: auto !important;
      user-select: auto !important;
      filter: none !important;
    }
    /* Ensure hamburger and close buttons remain focusable and visible */
    body.menu-open.using-keyboard .menu-toggle,
    body.menu-open.using-keyboard .drawer-close {
      pointer-events: auto !important;
      visibility: visible !important;
      opacity: 1 !important;
      z-index: 2000 !important;
    }

    /* For normal users (mouse/touch), keep background sharp */
    body.menu-open main,
    body.menu-open header,
    body.menu-open footer {
      filter: none;
    }

    /* Overlay stays beneath the menu but above main content */
    .nav-overlay.active {
      z-index: 1100 !important;
    }

    /* Animations */
    @keyframes slideIn {
      0% {
        transform: translateX(40px);
        opacity: 0;
      }
      100% {
        transform: translateX(0);
        opacity: 1;
      }
    }

    @keyframes linkFade {
      from {
        opacity: 0;
        transform: translateX(10px);
      }
      to {
        opacity: 1;
        transform: translateX(0);
      }
    }

    /* Hero Section */
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 2rem 1rem;
    }

    .hero-text {
        padding-right: 0;
        margin-bottom: 1.5rem;
    }

    .hero-text h1 {
        font-size: 1.8rem;
        line-height: 1.3;
        margin-bottom: 0.8rem;
    }

    .hero-text p {
        font-size: 0.95rem;
        margin-bottom: 1.2rem;
    }

    .btn-accent {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }

    .hero-image img {
        max-width: 90%;
        height: auto;
        margin-top: 1rem;
    }

    /* Stats Section */
    .stats {
        flex-direction: column;
        gap: 1rem;
        margin: 2rem 1rem;
    }

    .stat-box {
        width: 100%;
        min-width: unset;
        padding: 1.2rem;
    }

    .stat-info h3 {
        font-size: 1.2rem;
    }

    .stat-info p {
        font-size: 0.9rem;
    }

    /* Highlighted Work */
    .highlighted-work {
        padding: 0 1rem;
        margin-top: 2.5rem;
    }

    .highlighted-work h2 {
        font-size: 1.5rem;
        text-align: center;
        margin-bottom: 1.5rem;
    }

    .project-card {
        flex: 1 1 100%;
        padding: 1.2rem;
    }

    .project-card h3 {
        font-size: 1.1rem;
    }

    .project-card p {
        font-size: 0.9rem;
    }

    /* Header Layout Adjustment for Mobile */
   header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: visible;
}
    /* Prevent accessibility icon from appearing lower than hamburger */
    .accessibility-button img {
      width: 22px;
      height: 22px;
      display: block;
      transform: translateY(-1px); /* optical alignment */
    }

    /* Ensure logo and hamburger are on same line */
    .logo {
        flex: 0 0 auto;
    }

  
    /* Prevent focus skipping caused by disabled pointer events during drawer animation */
    .nav-menu.open,
    .nav-menu.open.is-ready {
      pointer-events: auto !important;
    }

    /* Add clear visual focus for keyboard users */
    .menu-toggle:focus-visible {
      outline: 3px solid var(--accent);
      outline-offset: 3px;
      border-radius: 6px;
      background: rgba(30, 111, 114, 0.08);
    }

    /* Ensure bars remain visible and properly spaced */
    .menu-toggle .bar {
      height: 3px;
      width: 100%;
      background-color: var(--heading-color);
      border-radius: 10px;
      transition: all 0.3s ease;
    }

    /* Dark mode support */
    body.dark-mode .menu-toggle .bar {
      background-color: var(--body-text);
    }

    /* Animate hamburger to X when active */
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
   
}
    /* Hide duplicate X close icon in header */
    header .drawer-close {
      display: none !important;
    }

/* Hide any accidental duplicate X buttons not inside nav-menu */
header > .drawer-close,
header > .close-menu {
  display: none !important;
}


/* Unified footer styling */

.nav-footer {
  background: linear-gradient(180deg, rgba(231, 241, 242, 0.95), rgba(231, 241, 242, 1));
  border-top: 1px solid rgba(30, 111, 114, 0.1);
  box-shadow: inset 0 6px 10px rgba(0, 0, 0, 0.02);
  text-align: center;
  width: 100%;
  padding: 0.6rem 1rem 0.8rem;
  position: relative;
}

/* Subtle hover glow for Dark Mode toggle */
.theme-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  font-weight: 600;
  transition: color 0.3s ease;
}
/* Hover effect */
.theme-toggle:hover {
  color: var(--accent);
}

/* Footer height scaling on taller screens */
@media (min-height: 820px) {
  .nav-footer {
    padding: 0.5rem 1rem 0.7rem;
  }
}

/* Gentle vertical fade blending main menu and footer */
.nav-footer::before {
  content: "";
  position: absolute;
  top: -16px;
  left: 0;
  width: 100%;
  height: 16px;
  background: linear-gradient(to top, rgba(231, 241, 242, 1), rgba(231, 241, 242, 0));
}

/* ===== Global Focus-Visible Styles for Accessibility ===== */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
  background-color: rgba(30, 111, 114, 0.15);
  transition: outline 0.2s ease, background-color 0.2s ease;
}

/* Avoid a section-wide focus ring after touch/click anchor navigation. */
body:not(.using-keyboard) [data-scroll-focus-temp]:focus {
  outline: none;
  background-color: transparent;
}

/* Links */
a:focus-visible {
  outline: 3px solid var(--hover-accent);
  outline-offset: 3px;
  border-radius: 4px;
  text-decoration: none;
}

/* Buttons */
button:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
  background-color: rgba(30, 111, 114, 0.15);
}

/* Form Elements */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
  background-color: #f9f9f9;
}

/* Dark Mode Variants */
body.dark-mode :focus-visible {
  outline: 3px solid var(--hover-accent);
  background-color: rgba(92, 194, 194, 0.12);
}

body.dark-mode input:focus-visible,
body.dark-mode textarea:focus-visible,
body.dark-mode select:focus-visible {
  background-color: #1a1a1a;
}

/* === Final Accessibility Fix for Hamburger and Drawer Buttons === */

/* Keep it fixed when drawer is open */
body.menu-open .menu-toggle {
  position: fixed !important;
  top: 1.2rem;
  right: 1.2rem;
}

/* Match accessibility button positioning with hamburger when menu is open */
body.menu-open .accessibility-button {
  position: fixed !important;
  top: 1.2rem;
  right: 4.2rem; /* stays just left of hamburger */
}

/* Ensure overlay allows click-to-close but never blocks menu controls */
.nav-overlay {
  pointer-events: auto; /* allow clicking overlay to close */
  z-index: 1100 !important;
}
body.menu-open.using-keyboard .nav-overlay {
  pointer-events: auto; /* still clickable in keyboard mode */
}

/* === Fix Double X Icon Issue === */

/* Hide any drawer-close button when menu is not open */
.nav-menu:not(.open) .drawer-close {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Ensure only one close icon shows during transitions */
.nav-menu.open.is-ready .drawer-close {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  z-index: 1600 !important;
}

/* Prevent overlap or ghost icons */
.drawer-close + .drawer-close {
  display: none !important;
}
/* === Consistent Hamburger & Close Button Sizing Fix === */

body:not(.menu-open) .drawer-close {
  display: none !important; /* Hide close button when drawer closed */
}

/* Hamburger bars for balanced proportions */
.menu-toggle .bar {
  display: block;
  width: 100%;
  height: 3px;                /* thinner for elegance */
  border-radius: 2px;
  background-color:#000 ;
  transition: all 0.3s ease;
}

/* Ensure good visibility in dark mode */
body.dark-mode .menu-toggle .bar {
  background-color: var(--body-text);
}

/* === Restore Drawer Close (X) Visibility === */
.nav-menu.open .drawer-close {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  position: fixed !important;
  top: 1.4rem;
  right: 1.6rem;
  z-index: 2000 !important;
}

/* Make sure the X stays visible while menu is open */
body.menu-open .drawer-close {
  display: flex !important;
}

/* === Restrict Hamburger Menu to Mobile Only === */

/* Hide hamburger on tablet and desktop */
@media (min-width: 901px) {
  .menu-toggle {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* Ensure mobile header controls and skip-link behavior stay aligned on small screens */
@media (max-width: 900px) {
  .menu-toggle {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: absolute;
    top: 1.1rem;
    right: 1.2rem;
    width: 32px;
    height: 32px;              /* match accessibility button */
    flex-direction: column;
    justify-content: center;   /* center bars vertically */
    gap: 4px;                  /* consistent bar spacing */
    z-index: 1500;
  }

  .accessibility-button {
    position: absolute;
    top: 1.1rem;      /* exact same vertical anchor as hamburger */
    right: 4.2rem;    /* sits left of hamburger */
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
  }

  .skip-link {
    z-index: 2000 !important; /* keep above content */
  }

  /* Prevent unwanted focus outline when skip link isn't used */
  main:focus {
    outline: none !important;
  }

  /* Visually preserve order for screen readers */
  header,
  main {
    order: 0;
  }

  .menu-toggle {
    order: -1; /* keep hamburger logically next after skip link */
  }
}
/* === Prevent Automatic Focus Highlight on Drawer Open === */
.nav-menu.open a:focus,
.nav-menu.open a:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  background: none !important;
  color: var(--heading-color) !important;
}

/* Preserve keyboard accessibility focus indication */
body.using-keyboard .nav-menu.open a:focus,
body.using-keyboard .nav-menu.open a:focus-visible {
  outline: 3px solid var(--accent) !important;
  outline-offset: 3px !important;
  background: rgba(30, 111, 114, 0.08) !important;
  color: var(--accent) !important;
}
/* === Accessibility Enhancement: Dark Mode Toggle Focus Indicator === */
[data-dark-mode-toggle]:focus-visible,
[data-dark-mode-toggle]:focus-visible + .slider {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 6px rgba(30, 111, 114, 0.3);
}

body.dark-mode [data-dark-mode-toggle]:focus-visible,
body.dark-mode [data-dark-mode-toggle]:focus-visible + .slider {
  outline: 3px solid var(--hover-accent);
  box-shadow: 0 0 6px rgba(92, 194, 194, 0.4);
}
/* === Accessibility Feedback: Dark Mode Toggle Visual Cue === */
[data-dark-mode-toggle].toggled-feedback {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 6px 2px var(--accent);
  transition: outline 0.3s ease, box-shadow 0.3s ease;
}

body.dark-mode [data-dark-mode-toggle].toggled-feedback {
  outline: 3px solid var(--hover-accent);
  box-shadow: 0 0 6px 2px var(--hover-accent);
}

@media (prefers-reduced-motion: reduce) {
  [data-dark-mode-toggle].toggled-feedback {
    transition: none;
  }
}

/* === Persistent Dark Mode Active Indicator === */
[data-dark-mode-toggle].dark-active {
  box-shadow: 0 0 10px 3px var(--accent);
  outline: 2px solid var(--accent);
}

body.dark-mode [data-dark-mode-toggle].dark-active {
  box-shadow: 0 0 10px 3px var(--hover-accent);
  outline: 2px solid var(--hover-accent);
}

@media (prefers-reduced-motion: reduce) {
  [data-dark-mode-toggle].dark-active {
    transition: none;
  }
}
/* === Visible Dark Mode Toggle Feedback Fix === */

/* When checked (even before dark mode exists) */
[data-dark-mode-toggle]:checked + .slider {
  background-color: var(--accent);
  box-shadow: 0 0 8px 2px rgba(30, 111, 114, 0.5);
  transition: all 0.3s ease;
}

/* Move the white knob */
[data-dark-mode-toggle]:checked + .slider:before {
  transform: translateX(16px);
  background-color: #fff;
  box-shadow: 0 0 4px rgba(30, 111, 114, 0.4);
}

/* Flash glow when toggled via keyboard */
[data-dark-mode-toggle].toggled-feedback + .slider {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 10px 3px var(--accent);
  transition: box-shadow 0.2s ease, outline 0.2s ease;
}

/* Persistent subtle glow when active */
[data-dark-mode-toggle].dark-active + .slider {
  box-shadow: 0 0 8px 3px var(--accent);
}

/* Reduced motion safety */
@media (prefers-reduced-motion: reduce) {
  [data-dark-mode-toggle].toggled-feedback + .slider {
    transition: none;
  }
}
/* =========================================================
   ACCESSIBILITY: VISITED LINK STYLING (Matches Your Design)
   ========================================================= */

/* Base visited-link style */
a:visited {
  color: var(--accent);
  text-decoration: underline dashed;
  text-underline-offset: 3px;
  opacity: 0.95;
  transition: color 0.3s ease, text-decoration-color 0.3s ease;
}

/* Hover on visited link (small lift + colour shift) */
a:visited:hover {
  color: var(--hover-accent);
  text-decoration-color: var(--hover-accent);
  opacity: 1;
}

/* Focus-visible for visited link (follow global focus rules) */
a:visited:focus-visible {
  outline: 3px solid var(--hover-accent);
  outline-offset: 3px;
  background-color: rgba(30, 111, 114, 0.15);
  border-radius: 4px;
  text-decoration: none;
}

/* Prevent visited-link styles from breaking buttons */
.btn-accent:visited {
  color: #fff !important;
  text-decoration: none !important;
  opacity: 1 !important;
}

/* Dark Mode – visited style */
body.dark-mode a:visited {
  color: var(--hover-accent);
  text-decoration: underline dashed;
  text-underline-offset: 3px;
  opacity: 0.95;
}

body.dark-mode a:visited:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
  opacity: 1;
}
/* Dark Mode – focus-visible for visited link */
body.dark-mode a:visited:focus-visible {
  outline: 3px solid var(--accent);
  background-color: rgba(92, 194, 194, 0.12);
}
body.dark-mode .btn-accent {
  background: #2d9294;
  color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

/* Dark Mode – button visited state */
body.dark-mode .btn-accent:hover,
body.dark-mode .btn-accent:focus-visible {
  background: #3fabad;
  color: #fff;
}



/* ============================================================
   FINAL MOBILE NAVIGATION CONSOLIDATED FIX
   X stays fixed at top, content scrolls only when needed
   Overrides all previous conflicting rules
   ============================================================ */

@media (max-width: 900px) {

  /* NAV MENU (fixed container) */
  .nav-menu {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    height: 100vh !important;
    z-index: 2000 !important;
    width: 250px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
  }

  /* FIXED CLOSE BUTTON */
  .drawer-close {
    position: fixed !important;
    top: 1.2rem !important;
    right: 1.2rem !important;
    z-index: 3000 !important;
  }

  /* FIXED HEADER SECTION (LOGO + X LINE) ← YOU ARE MISSING THIS */
  .nav-header {
    flex: 0 0 auto !important;
    overflow: visible !important;
    position: relative !important;
  }

  .nav-header::after {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    width: 100% !important;
    height: 1px !important;
    pointer-events: none !important;
  }

  .nav-menu::after {
    height: 0 !important;
  }

  /* SCROLLABLE CONTENT — ONLY the UL */
  .nav-menu ul {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 0 !important;
    padding: 1.25rem 0 !important;
  }

  /* FIXED FOOTER SECTION ← NEEDS FLEX RESTRICTION */
  .nav-footer {
    flex: 0 0 auto !important;
    margin-top: auto !important;
    overflow: visible !important;
    position: relative !important;
  }
  .nav-footer::before {
    position: absolute !important;
    pointer-events: none !important;
    overflow: hidden !important;
  }
}

/* ============================================================
   FINAL NAV BREAKPOINT GUARDRAILS
   Prevent mobile drawer elements from leaking into tablet/desktop
   ============================================================ */
@media (min-width: 901px) {
  .nav-menu {
    position: static !important;
    inset: auto !important;
    width: auto !important;
    height: auto !important;
    transform: none !important;
    overflow: visible !important;
    padding: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .nav-menu ul {
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
  }

  .nav-header,
  .nav-footer,
  .drawer-close {
    display: none !important;
  }
}

@media (min-width: 901px) and (max-width: 1150px) {
  .nav-menu ul {
    gap: clamp(1rem, 1.8vw, 1.7rem) !important;
  }

  .nav-menu a {
    font-size: clamp(1rem, 1.45vw, 1.1rem) !important;
  }
}

/* ===== Header Balance: Primary CV CTA + Grouped Right Actions ===== */
.mobile-cv-item {
  display: none;
}

header .header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
}

header .header-actions .header-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

header .header-actions .header-cta:hover {
  background: var(--hover-accent);
  transform: translateY(-1px);
}

header .header-actions .header-cta:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

@media (min-width: 901px) {
  header .container {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    align-items: center !important;
    column-gap: clamp(1rem, 2vw, 2rem);
  }

  header .nav-menu {
    justify-self: center;
  }

  header .header-actions {
    justify-self: end;
    min-width: 0;
    margin-left: clamp(0.35rem, 0.8vw, 0.65rem);
    gap: 0;
    padding: 0.24rem 0.24rem 0.24rem 0.5rem;
    border-radius: 999px;
    background: linear-gradient(140deg, #4ea6ad 0%, #1f7f86 100%);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  }

  header .header-actions .header-cta {
    min-height: 2.45rem;
    padding: 0 0.62rem 0 0.08rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-size: clamp(0.8rem, 0.72vw, 0.95rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.01em;
  }

  header .header-actions .header-cta:hover {
    background: transparent;
    transform: none;
    color: #eefcff;
  }

  header .header-actions .header-cta:focus-visible {
    outline: 3px solid var(--hover-accent);
    outline-offset: 4px;
  }

  header .header-actions .accessibility-button {
    width: 2.68rem;
    height: 2.68rem;
    margin-left: 0.375rem;
    border: 0.09375rem solid var(--accent);
    border-radius: 999px;
    background: #f4f6f7;
    box-shadow: 0 4px 9px rgba(12, 54, 62, 0.14);
  }

  header .header-actions .accessibility-button img {
    width: 1.55rem;
    height: 1.55rem;
    opacity: 1;
    filter: brightness(0) saturate(100%) invert(27%) sepia(20%) saturate(1133%)
      hue-rotate(142deg) brightness(93%) contrast(95%);
  }

  header .header-actions .accessibility-button:focus-visible {
    outline: 3px solid var(--hover-accent);
    outline-offset: 4px;
  }
}

@media (max-width: 900px) {
  header .header-actions .header-cta {
    display: none;
  }

  .mobile-cv-item {
    display: list-item;
  }
}

body.dark-mode header .header-actions .header-cta {
  background: var(--accent);
  color: #ffffff;
}

@media (min-width: 901px) {
  body.dark-mode header .header-actions {
    background: linear-gradient(140deg, #2d7e84 0%, #185b61 100%);
  }

  body.dark-mode header .header-actions .header-cta {
    background: transparent;
    color: #ffffff;
  }

  body.dark-mode header .header-actions .accessibility-button {
    background: linear-gradient(180deg, #dce5e8 0%, #c6d8db 100%);
  }

  body.dark-mode header .header-actions .accessibility-button img {
    filter: brightness(0) saturate(100%) invert(27%) sepia(20%) saturate(1133%)
      hue-rotate(142deg) brightness(93%) contrast(95%);
  }
}

html.high-contrast header .header-actions .header-cta {
  background: #000000 !important;
  border: 2px solid var(--border) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

@media (min-width: 901px) {
  html.high-contrast header .header-actions {
    background: #000000 !important;
    border: 2px solid var(--border) !important;
    box-shadow: none !important;
  }

  html.high-contrast header .header-actions .header-cta {
    background: transparent !important;
    border: 0 !important;
  }

  html.high-contrast header .header-actions .accessibility-button {
    background: #111111 !important;
    border: 2px solid var(--border) !important;
    box-shadow: none !important;
  }

  html.high-contrast header .header-actions .accessibility-button img {
    width: 1.55rem;
    height: 1.55rem;
    filter: brightness(0) saturate(100%) invert(87%) sepia(29%) saturate(1633%)
      hue-rotate(121deg) brightness(105%) contrast(95%) !important;
  }
}

/* ===== Responsive Layout Guardrails ===== */
html {
  max-width: 100%;
}

body,
main {
  min-width: 0;
}

main {
  flex: 1 0 auto;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

img,
svg,
video,
canvas {
  height: auto;
}

main p,
main li,
main a,
main h1,
main h2,
main h3,
main code,
footer a {
  overflow-wrap: anywhere;
}

@media (min-width: 901px) and (max-width: 1050px) {
  header {
    padding-inline: 1rem;
  }

  header .container {
    column-gap: 0.75rem;
  }

  header .nav-menu ul {
    gap: clamp(0.7rem, 1.35vw, 1.05rem) !important;
  }

  header .nav-menu a {
    font-size: clamp(0.92rem, 1.35vw, 1rem) !important;
  }

  header .header-actions .header-cta {
    font-size: 0.78rem;
  }
}

@media (max-width: 480px) {
  header {
    padding-inline: 0.75rem;
  }

  .accessibility-panel {
    right: 0.75rem !important;
    width: min(220px, calc(100vw - 1.5rem)) !important;
    max-width: calc(100vw - 1.5rem) !important;
  }

  .nav-menu {
    width: min(250px, 100vw) !important;
  }
}
