/* Directional View Transition setup */
:root {
  /* Color theme variables */
  --bg-color: #ffffff;
  --text-color: #333333;
  --link-color: #444444;
  --link-hover-color: #222222;
  --input-bg: #ffffff;
  --input-text: #000000;
  --input-border: #cccccc;
  --nav-bg: rgba(255,255,255,0.97);
  --nav-active-bg: #f0f1f3;
  --nav-shadow: 0 2px 8px rgba(0,0,0,0.06);
  --nav-border: 1.5px solid #d0d7de;
  --btn-bg: #f4f4f7;
  --btn-bg-hover: #e0e0e7;
  --btn-text: #232b36;
  --btn-active-bg: #111;
  --btn-active-text: #fff;
  --btn-active-underline: #232b36;
}

/* Dark theme overrides */
.dark-theme {
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --link-color: #bbbbbb;
  --link-hover-color: #ffffff;
  --input-bg: #333333;
  --input-text: #f0f0f0;
  --input-border: #555555;
  --nav-bg: rgba(30,30,30,0.98);
  --nav-active-bg: #232b36;
  --nav-shadow: 0 4px 24px rgba(0,0,0,0.32);
  --nav-border: 1.5px solid #333a40;
  --btn-bg: #232b36;
  --btn-bg-hover: #232b36;
  --btn-text: #fff;
  --btn-active-bg: #fff;
  --btn-active-text: #232b36;
  --btn-active-underline: #fff;
}

/* System mode: use the same variables as .dark-theme and :root via media queries */
@media (prefers-color-scheme: dark) {
  :root:not(.light-theme):not(.dark-theme) {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --link-color: #bbbbbb;
    --link-hover-color: #ffffff;
    --input-bg: #333333;
    --input-text: #f0f0f0;
    --input-border: #555555;
    --nav-bg: rgba(30,30,30,0.98);
    --nav-active-bg: #232b36;
    --nav-shadow: 0 4px 24px rgba(0,0,0,0.32);
    --nav-border: 1.5px solid #333a40;
    --btn-bg: #232b36;
    --btn-bg-hover: #232b36;
    --btn-text: #fff;
    --btn-active-bg: #fff;
    --btn-active-text: #232b36;
    --btn-active-underline: #fff;
  }
}
@media (prefers-color-scheme: light) {
  :root:not(.light-theme):not(.dark-theme) {
    --bg-color: #ffffff;
    --text-color: #333333;
    --link-color: #444444;
    --link-hover-color: #222222;
    --input-bg: #ffffff;
    --input-text: #000000;
    --input-border: #cccccc;
    --nav-bg: rgba(255,255,255,0.97);
    --nav-active-bg: #f0f1f3;
    --nav-shadow: 0 2px 8px rgba(0,0,0,0.06);
    --nav-border: 1.5px solid #d0d7de;
    --btn-bg: #f4f4f7;
    --btn-bg-hover: #e0e0e7;
    --btn-text: #232b36;
    --btn-active-bg: #111;
    --btn-active-text: #fff;
    --btn-active-underline: #232b36;
  }
}

/* Global resets/base styles */
* {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

/* Layout containers */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
}

/* Add a new class for the right-side controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Add a divider for the right-side controls */
.header-divider {
  width: 0;
  height: 2.2rem;
  border-left: var(--nav-border);
  margin: 0 0.3rem 0 1.1rem;
  align-self: center;
  border-radius: 2px;
  background: none;
  transition: border-color 0.2s;
}
.dark-theme .header-divider {
  border-left: var(--nav-border);
}
.high-contrast .header-divider {
  border-left: 2px solid #ffff00 !important;
  background: none !important;
}

/* Accessibility icon (Aa) styling, no button look */
.accessibility-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.8rem;
  height: 2.8rem;
  font-size: 2rem;
  color: var(--text-color);
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.15s;
  outline: none;
  margin-left: 0;
}
.accessibility-icon .material-symbols-outlined {
  font-size: 2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.accessibility-icon:focus, .accessibility-icon:hover {
  background: none;
  color: var(--link-hover-color);
  outline: none;
  box-shadow: none;
}
.dark-theme .accessibility-icon:focus, .dark-theme .accessibility-icon:hover {
  background: none;
  color: #fff;
  outline: none;
  box-shadow: none;
}

/* Remove button-specific styles from accessibility icon */
#accessibility-btn {
  all: unset;
}

/* Header navigation */
header {
  margin-top: 2.5rem;
}
header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav-bg);
  border-radius: 1.5rem;
  box-shadow: var(--nav-shadow);
  border: var(--nav-border); /* Add border */
  padding: 0.5rem 2.2rem 0.5rem 1.5rem;
  margin-top: 0.5rem;
  gap: 1.2rem;
  height: 3.6rem;
}
.brand {
  font-weight: bold;
  font-size: 1.2em;
  text-decoration: none;
  color: var(--text-color);
  margin-right: 1.2rem;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
}
.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.2rem;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
}
.menu a {
  display: flex;
  align-items: center;
  background: none;
  color: var(--link-color);
  font-weight: 600; /* Unified font-weight */
  font-size: 1.05em;
  padding: 0.2em 0.7em 0.2em 0.7em;
  border: none;
  border-radius: 0;
  box-shadow: none;
  text-decoration: none;
  transition: color 0.15s, opacity 0.15s;
  position: relative;
  height: 100%;
  margin-top: 10px;
  opacity: 0.55; /* Lower opacity for non-active tabs */
}
.menu a:hover, .menu a:focus {
  color: var(--link-hover-color);
  background: none;
  outline: none;
  opacity: 0.85; /* Slightly higher on hover */
}
.menu a.active {
  color: #111 !important; /* Pure black for active tab in light theme */
  font-weight: 600; /* Unified font-weight */
  background: none;
  box-shadow: none;
  border-radius: 0;
  z-index: 1;
  opacity: 1;
}
.dark-theme .menu a.active {
  color: #fff !important; /* Pure white for active tab in dark theme */
}
/* System mode: active tab color matches system theme */
@media (prefers-color-scheme: dark) {
  :root:not(.light-theme):not(.dark-theme) .menu a.active {
    color: #fff !important;
  }
}
@media (prefers-color-scheme: light) {
  :root:not(.light-theme):not(.dark-theme) .menu a.active {
    color: #111 !important;
  }
}
#theme-toggle {
  margin-left: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border: none;
  background: none;
  color: var(--text-color);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04); /* Softer, subtler shadow */
  font-size: 1.2rem;
  position: relative;
}
#theme-toggle:hover, #theme-toggle:focus {
  background: var(--link-hover-color);
  color: #fff;
  outline: none;
}
/* Make sun icon black on hover in dark mode */
.dark-theme #theme-toggle:hover .icon-sun svg,
.dark-theme #theme-toggle:focus .icon-sun svg {
  color: #111;
}
#theme-toggle svg {
  display: block;
}
.icon-sun, .icon-moon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
  display: none; /* Hidden on desktop */
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1002; /* Ensure above nav */
}

.hamburger-icon {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--text-color);
  position: relative;
  transition: background-color 0.2s ease-in-out;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--text-color);
  transition: transform 0.2s ease-in-out, top 0.2s ease-in-out;
}

.hamburger-icon::before {
  top: -8px;
}

.hamburger-icon::after {
  top: 8px;
}

/* "X" icon when nav is open */
.mobile-nav-toggle[aria-expanded="true"] .hamburger-icon {
  background-color: transparent; /* Middle bar disappears */
}

.mobile-nav-toggle[aria-expanded="true"] .hamburger-icon::before {
  transform: rotate(45deg);
  top: 0;
}

.mobile-nav-toggle[aria-expanded="true"] .hamburger-icon::after {
  transform: rotate(-45deg);
  top: 0;
}

/* Responsive adjustments */
@media (max-width: 650px) {
  header nav {
    flex-direction: row;
    flex-wrap: nowrap; /* Changed from wrap */
    align-items: center;
    justify-content: space-between;
    height: 3.6rem; /* Set fixed height */
    padding: 0.5rem 1rem;
    gap: 0.5rem;
    margin-top: 0.7rem;
    position: relative; /* For menu positioning */
  }
  .brand {
    margin-right: 0;
    margin-bottom: 0; /* Removed bottom margin */
    justify-content: flex-start;
  }
  .header-controls {
    display: flex !important;
    position: static !important;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    background: none;
    box-shadow: none;
    border: none;
    padding: 0;
  }
  .header-controls.mobile-nav-open {
    display: flex;
  }
  .menu {
    display: none;
    flex-direction: column;
    gap: 0.3rem;
    align-items: stretch;
    justify-content: flex-start;
  }
  .menu a {
    font-size: 1em;
    padding: 0.3em 0.5em;
    margin-top: 0;
    justify-content: flex-start;
  }
  #theme-toggle {
    margin-left: 0;
    align-self: flex-end;
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }
  .mobile-nav-toggle {
    display: block;
  }
  .header-divider {
    display: none !important;
  }
}

@media (min-width: 601px) {
  .header-controls {
    display: flex !important;
    position: static;
    max-height: none;
    opacity: 1;
    flex-direction: row;
    align-items: center;
    gap: 1.2rem;
    background: none;
    box-shadow: none;
    border: none;
    padding: 0;
  }
  .header-controls {
    padding-right: 1.2rem;
  }
  .brand {
    padding-left: 1.2rem;
  }
  .menu {
    display: flex;
    flex-direction: row;
    gap: 1.2rem;
    align-items: center;
    width: auto;
    background: none;
    padding: 0;
    margin: 0;
    border: none;
    box-shadow: none;
  }
  .menu li {
    flex: none;
    text-align: left;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .menu a {
    display: inline-block;
    width: auto;
    padding: 0.3em 0.8em;
    font-size: 1em;
    border-radius: 0.7em;
    background: none;
    border: none;
    margin: 0;
    text-align: center;
    transition: background 0.15s, color 0.15s;
  }
  .mobile-nav-toggle {
    display: none;
  }
}

/* Intro (About section) */
.intro {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin: 2rem 0;
}
.headshot {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 50%;
}
.intro-text h1 {
  margin: 0 0 0.3rem;
}
.tagline {
  font-style: italic;
  opacity: 0.8;
  margin: 0 0 1rem;
}
.tagline .sep {
  opacity: 0.5;
  margin: 0 0.4em;
}

/* Typography & element spacing */
h1 { font-size: 2em; margin: 1rem 0; }
h2 { font-size: 1.5em; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1.2em; margin: 1rem 0 0.5rem; }
small { opacity: 0.7; }
p { margin: 0.5rem 0 1rem; }
ul {
  padding-left: 1.2rem;
  margin: 0.5rem 0 1rem;
}
ul li { margin-bottom: 0.5rem; }

/* General link styles */
a {
  color: var(--text-color);
  text-decoration: underline;
  transition: color 0.15s;
}

a:hover, a:focus {
  color: var(--text-color);
  text-decoration: underline;
}

/* Buttons */
.btn {
  display: inline-block;
  background: var(--btn-bg);
  color: var(--btn-text);
  text-decoration: none;
  padding: 0.35em 1em;
  border: 1px solid #333;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.98em;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 1.5px 6px rgba(0,0,0,0.07); /* Softer, more natural shadow */
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, border 0.15s;
}
.btn:hover, .btn:focus {
  background: var(--btn-bg-hover);
  color: var(--btn-text);
  border-color: #444;
  outline: none;
  box-shadow: 0 3px 12px rgba(0,0,0,0.10); /* Softer hover shadow */
}
.btn:active {
  background: var(--btn-active-bg);
  color: var(--btn-active-text);
  border-color: #222;
}

/* Form styles */
form p { margin: 0 0 1rem; }
label { font-weight: 500; }
input[type=text], input[type=email], textarea {
  width: 100%;
  padding: 0.5rem;
  background: var(--input-bg);
  color: var(--input-text);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  font: inherit;
}
textarea { resize: vertical; }

/* Enhanced mobile responsiveness */
@media (max-width: 650px) {
  html, body {
    font-size: 15px;
    padding: 0;
  }
  .container {
    padding: 0.5rem;
    max-width: 100%;
  }
  .intro {
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
    align-items: center;
  }
  .headshot {
    width: 100px;
    height: 100px;
  }
  .intro-text h1 {
    font-size: 1.3em;
  }
  h1 {
    font-size: 1.4em;
  }
  h2 {
    font-size: 1.1em;
  }
  h3 {
    font-size: 1em;
  }
  .btn {
    font-size: 0.95em;
    padding: 0.3em 0.7em;
  }
  form p {
    margin-bottom: 0.7rem;
  }
  input[type=text], input[type=email], textarea {
    font-size: 1em;
    padding: 0.4rem;
  }
  ul {
    padding-left: 1rem;
  }
  /* Make images and containers fluid */
  img, .headshot {
    max-width: 100%;
    height: auto;
  }
}

.resume-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.resume-header h1 {
  margin-top: 0;
}

.pdf-btn {
  background: var(--nav-bg);
  color: var(--text-color);
  border: var(--nav-border);
  border-radius: 1.5rem;
  box-shadow: var(--nav-shadow);
  padding: 0.5em 1.5em;
  font-weight: 600;
  font-size: 1em;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, border 0.15s;
  text-decoration: none;
  display: inline-block;
}
.pdf-btn:hover, .pdf-btn:focus {
  background: var(--nav-active-bg);
  color: var(--link-hover-color);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  outline: none;
}

.projects-main > h1 {
  margin-top: 0;
}

/* Accessibility: High Contrast Mode */
.high-contrast {
  --bg-color: #000 !important;
  --text-color: #fff !important;
  --link-color: #ffff00 !important;
  --link-hover-color: #00ffff !important;
  --input-bg: #000 !important;
  --input-text: #fff !important;
  --input-border: #fff !important;
  --nav-bg: #000 !important;
  --nav-active-bg: #222 !important;
  --nav-shadow: none !important;
  --nav-border: 2px solid #fff !important;
  --btn-bg: #000 !important;
  --btn-bg-hover: #222 !important;
  --btn-text: #fff !important;
  --btn-active-bg: #fff !important;
  --btn-active-text: #000 !important;
  --btn-active-underline: #fff !important;
}

/* Accessibility: Font size scaling */
:root {
  --base-font-size: 16px;
}
html, body {
  font-size: var(--base-font-size);
  transition: background 0.2s, color 0.2s, font-size 0.2s;
}

/* Accessibility Button (matches theme toggle style) */
/*
#accessibility-btn {
  margin-left: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 1.5px solid #c0c0c0;
  background: #f7f7f9;
  color: var(--text-color);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border 0.15s;
  font-size: 1.2rem;
  position: relative;
}
#accessibility-btn:hover, #accessibility-btn:focus {
  background: #ececf0;
  color: #111;
  outline: none;
  border-color: #888;
}
.dark-theme #accessibility-btn {
  border: 1.5px solid #444a55;
  background: #23242a;
  color: #fff;
}
.dark-theme #accessibility-btn:hover, .dark-theme #accessibility-btn:focus {
  background: #2d2e36;
  color: #fff;
  border-color: #888;
}
*/
.icon-accessibility svg {
  display: block;
}
.icon-accessibility {
  font-size: 1em;
  font-weight: bold;
  font-family: inherit;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

/* Accessibility Menu */
.accessibility-menu {
  position: absolute;
  right: 0;
  top: 3.2rem;
  background: var(--nav-bg);
  border: var(--nav-border);
  box-shadow: var(--nav-shadow);
  border-radius: 1.2rem;
  padding: 0.7rem 1.1rem;
  z-index: 1000;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  font-size: 1em;
}
.access-section {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.2rem;
}
.access-label {
  font-weight: 600;
  font-size: 1em;
  margin-bottom: 0.1em;
  color: var(--text-color);
  opacity: 0.8;
}
.access-radio {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 1em;
  cursor: pointer;
  margin-bottom: 0.1em;
}
.access-radio input[type="radio"] {
  accent-color: var(--link-color);
  margin-right: 0.4em;
}
.access-toggle {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 1em;
  cursor: pointer;
}
.access-toggle input[type="checkbox"] {
  accent-color: var(--link-color);
  margin-right: 0.4em;
}
.access-textsize {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
}
.access-textsize .access-label {
  margin-right: 0.7em;
  margin-bottom: 0;
}
.access-textsize button {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid #333;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1em;
  font-family: inherit;
  cursor: pointer;
  padding: 0.2em 0.7em;
  margin: 0 0.1em;
  transition: background 0.15s, color 0.15s, border 0.15s;
}
.access-textsize button:hover, .access-textsize button:focus {
  background: var(--btn-bg-hover);
  color: var(--btn-text);
  border-color: #444;
  outline: none;
}
.access-textsize button:active {
  background: var(--btn-active-bg);
  color: var(--btn-active-text);
  border-color: #222;
}
.access-radio input[disabled] {
  opacity: 0.5;
  pointer-events: none;
}
.access-radio.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

/* Ensure menu is above nav */
.header-controls {
  position: relative;
}

/* Responsive: accessibility menu */
@media (max-width: 650px) {
  .accessibility-menu {
    left: 0.5rem;
    right: 0.5rem;
    top: 3.2rem;
    min-width: unset;
    max-width: calc(100vw - 1rem);
    width: auto;
    border-radius: 1.2rem;
    padding: 0.7rem 0.7rem;
    font-size: 1.05em;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .access-section {
    gap: 0.3rem;
  }
  .access-theme-btns {
    display: flex;
    flex-direction: row;
    gap: 0.5em;
    justify-content: center;
    align-items: center;
    margin-top: 0.3em;
    margin-bottom: 0.2em;
  }
  .access-radio {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--btn-bg);
    color: var(--btn-text);
    border: 1.5px solid #c0c0c0;
    border-radius: 999px;
    font-size: 1em;
    font-weight: 600;
    padding: 0.35em 1.1em;
    margin: 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border 0.15s;
    text-align: center;
    min-width: 0;
    min-height: 2.2em;
    box-sizing: border-box;
    flex: 1 1 0;
    outline: none;
  }
  .access-radio.selected, .access-radio:active, .access-radio:focus {
    background: var(--btn-active-bg);
    color: var(--btn-active-text);
    border-color: #222;
    outline: none;
  }
  .access-radio input[type="radio"] {
    display: none;
  }
  .access-textsize button {
    font-size: 1em;
    padding: 0.2em 0.7em;
  }
}

/* Consistent button style for .access-radio on all screens */
.access-radio {
  background: var(--nav-bg);
  color: var(--text-color);
  border: var(--nav-border);
  border-radius: 1.5rem;
  box-shadow: var(--nav-shadow);
  padding: 0.5em 1.5em;
  font-weight: 600;
  font-size: 1em;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, border 0.15s;
  text-decoration: none;
  display: inline-block;
  outline: none;
  margin: 0 0.2em 0.2em 0;
  cursor: pointer;
  min-width: 0;
  min-height: 2.2em;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
}
.access-radio:hover:not(.selected):not(:active):not(:focus) {
  background: var(--nav-active-bg);
  color: var(--link-hover-color);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  outline: none;
}
.dark-theme .access-radio:hover:not(.selected):not(:active):not(:focus) {
  background: var(--nav-active-bg);
  color: #fff;
}
.high-contrast .access-radio:hover:not(.selected):not(:active):not(:focus) {
  background: #222 !important;
  color: #00ffff !important;
}
.access-radio.selected, .access-radio:active, .access-radio:focus {
  background: var(--nav-active-bg);
  color: var(--link-hover-color);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  border-color: #444;
  outline: none;
}
.access-radio input[type="radio"] {
  display: none;
}
@media (max-width: 650px) {
  .access-theme-btns {
    display: flex;
    flex-direction: row;
    gap: 0.5em;
    justify-content: center;
    align-items: center;
    margin-top: 0.3em;
    margin-bottom: 0.2em;
  }
  .access-radio {
    width: 100%;
    min-width: 0;
    padding: 0.5em 0.7em;
    font-size: 1em;
    border-radius: 1.5rem;
    margin: 0 0.2em 0.2em 0;
    box-shadow: var(--nav-shadow);
  }
}

.textsize-round {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 1.5px solid #c0c0c0;
  background: #f7f7f9;
  color: var(--text-color);
  font-size: 1.1em;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0.1em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border 0.15s;
}
.textsize-round:hover, .textsize-round:focus {
  background: #ececf0;
  color: #111;
  border-color: #888;
  outline: none;
}
.dark-theme .textsize-round {
  border: 1.5px solid #444a55;
  background: #23242a;
  color: #fff;
}
.dark-theme .textsize-round:hover, .dark-theme .textsize-round:focus {
  background: #2d2e36;
  color: #fff;
  border-color: #888;
}
.textsize-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--link-color);
  font-size: 1em;
  font-weight: 500;
  margin: 0 0.2em;
  cursor: pointer;
  text-decoration: none;
  padding: 0 0.3em;
  min-width: 2.1rem;
  min-height: 2.1rem;
}
.textsize-reset:focus, .textsize-reset:hover {
  color: var(--link-hover-color);
  outline: none;
  text-decoration: none;
}

/* Visually hidden utility for screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Skip link styles */
.skip-link {
  position: absolute;
  left: 0;
  top: 0;
  background: #ffff00;
  color: #000;
  padding: 0.7em 1.2em;
  z-index: 2000;
  font-weight: bold;
  border-radius: 0 0 8px 0;
  transform: translateY(-120%);
  transition: transform 0.2s;
  outline: 2px solid #000;
  text-decoration: none;
}
.skip-link:focus, .skip-link:active {
  transform: translateY(0);
  outline: 4px solid #00ffff;
  background: #000;
  color: #ffff00;
}

/* High contrast focus outlines for all interactive elements */
.high-contrast a,
.high-contrast button,
.high-contrast input,
.high-contrast .btn,
.high-contrast .menu a,
.high-contrast .pdf-btn,
.high-contrast [role="menuitem"],
.high-contrast [tabindex="0"] {
  outline: 3px solid #ffff00 !important;
  outline-offset: 2px !important;
  box-shadow: none !important;
}
.high-contrast a:focus,
.high-contrast button:focus,
.high-contrast input:focus,
.high-contrast .btn:focus,
.high-contrast .menu a:focus,
.high-contrast .pdf-btn:focus,
.high-contrast [role="menuitem"]:focus,
.high-contrast [tabindex="0"]:focus {
  outline: 4px solid #00ffff !important;
  outline-offset: 2px !important;
  background: #222 !important;
  color: #ffff00 !important;
}

/* Project media carousel styles */
.project-media {
  margin: 2rem 0;
}

.project-media .carousel {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem; /* space for scrollbar */
}

.project-media .carousel img {
  flex: 0 0 auto;
  width: 250px;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  scroll-snap-align: start;
}

/* Optional: custom scrollbar styling */
.project-media .carousel::-webkit-scrollbar {
  height: 6px;
}
.project-media .carousel::-webkit-scrollbar-track {
  background: transparent;
}
.project-media .carousel::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

/* Screenshots grid styling */
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.screenshots-grid img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* App Store link styling */
.app-store-link {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.app-store-link a {
  display: inline-block;
  text-decoration: none;
}

.app-store-link img {
  width: 180px;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 650px) {
  .project-media .carousel {
    gap: 0.5rem;
  }
  .project-media .carousel img {
    width: 70vw;
  }
  
  .screenshots-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }
  
  .app-store-link img {
    width: 140px;
  }
}

@media (max-width: 650px) {
  header nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 3.6rem;
    height: 3.6rem;
    position: relative;
    padding-right: 0 !important;
  }
  .brand {
    flex: 1 1 auto;
    text-align: left;
    padding-left: 0.7em;
  }
  .mobile-nav-toggle {
    display: block;
    position: relative;
    z-index: 1002;
    margin-right: 0.5rem;
    margin-left: 0;
    order: 0;
  }
  .header-controls {
    display: flex !important;
    flex: 2 1 auto;
    align-items: center;
    justify-content: flex-end;
    position: static;
    background: none;
    box-shadow: none;
    border: none;
    padding: 0 1rem 0 0;
    gap: 0;
    margin-right: 0 !important;
  }
  .menu {
    display: none;
  }
  .menu.menu-in-bar {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start;
    align-items: center;
    gap: 0;
    width: 100%;
    background: none;
    box-shadow: none;
    border: none;
    margin: 0;
    padding: 0;
    z-index: auto;
    order: 1;
    height: 3.6rem;
  }
  .menu.menu-in-bar li {
    margin: 0;
    padding: 0;
    height: 100%;
    display: flex;
    align-items: center;
  }
  .menu.menu-in-bar a {
    font-size: 1em;
    padding: 0.2em 0.7em;
    margin: 0;
    opacity: 1;
    justify-content: flex-start;
    line-height: 1.2;
    min-height: 2.8rem;
    display: flex;
    align-items: center;
    height: 100%;
  }
  .brand[style*="display: none"] {
    display: none !important;
  }
  .menu.menu-in-bar ~ .header-divider,
  .menu.menu-in-bar ~ #accessibility-btn {
    display: none !important;
  }
  .mobile-nav-toggle {
    order: 2;
    margin-left: 1.2rem;
    margin-right: 0;
  }
}

/* Add consistent horizontal padding to header bar */
header {
  padding-left: 1.2rem;
  padding-right: 1.2rem;
}
@media (max-width: 650px) {
  header {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

header nav,
header nav.container {
  padding-left: 0 !important;
  padding-right: 0 !important;
}
@media (max-width: 650px) {
  header nav,
  header nav.container {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

.access-section.access-textsize {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1em;
}
.access-section.access-textsize .access-label {
  margin-bottom: 0;
  flex: 1 1 auto;
  text-align: left;
}
.access-textsize-btns {
  display: flex;
  gap: 0.3em;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
}
.brand, .profile-name {
  color: #fff !important;
  text-shadow: 0 1px 8px rgba(0,0,0,0.10);
}

.dark-theme .brand, .dark-theme .profile-name {
  color: #fff !important;
}

:root:not(.light-theme):not(.dark-theme) .brand, :root:not(.light-theme):not(.dark-theme) .profile-name {
  color: #fff !important;
}