/* ===== Design tokens ===== */
:root {
  --bg: #ffffff;
  --surface: #fafafa;
  --text: #0b0b0c;
  --muted: #5c667a;
  --card: #ffffff;
  --brand: #7c5cff;
  --brand2: #16c3a7;
  --border: rgba(0,0,0,.12);
}
:root[data-theme="dark"] {
  --bg: #0b0b0c;
  --surface: #101215;
  --text: #e8eaed;
  --muted: #a7b0bf;
  --card: #111317;
  --border: rgba(255,255,255,.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.wrap { width: min(1100px, 92vw); margin: 0 auto; }

/* ===== Top nav ===== */
.nav { position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(180%) blur(6px); background: color-mix(in oklab, var(--bg) 88%, transparent); border-bottom: 1px solid var(--border); }
.nav-inner { display: flex; align-items: center; gap: 16px; padding: 10px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.logo { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; }
.nav-links { display: none; gap: 14px; }
@media (min-width: 820px) { .nav-links { display: flex; } }
.cta { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.theme-toggle { border: 1px solid var(--border); background: transparent; padding: 8px 12px; border-radius: 10px; cursor: pointer; color: var(--text); }

/* ===== Dropdown Menu ===== */
.dropdown { 
  position: relative; 
  display: inline-block; 
}
.dropdown-toggle { 
  display: flex; 
  align-items: center; 
  gap: 4px; 
}
.dropdown-menu { 
  position: absolute; 
  top: calc(100% + 8px);
  right: 0; 
  z-index: 1000;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px) scale(0.95);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 8px 0;
  backdrop-filter: blur(8px);
}
.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s ease;
  text-align: left;
  white-space: nowrap;
  gap: 8px;
  border-radius: 0;
}
.dropdown-item:hover, .dropdown-item:focus {
  background: var(--surface);
  color: var(--brand);
  text-decoration: none;
  outline: none;
}
.dropdown-item:active {
  transform: scale(0.98);
}

/* Mobile dropdown adjustments */
@media (max-width: 640px) {
  .dropdown-menu {
    right: -4px;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
  }
  .dropdown-item {
    padding: 14px 16px;
    font-size: 0.9rem;
    min-height: 44px;
  }
}

/* ===== Buttons & chips ===== */
.btn { appearance: none; border: none; border-radius: 12px; padding: 10px 14px; font-weight: 600; background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.btn:hover { filter: brightness(.98); }
.btn.outline { 
  background: transparent; 
  color: var(--text); 
  border: 1px solid var(--border); 
  box-shadow: none; 
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
.btn.small { padding: 8px 12px; font-size: .92rem; }
.chip { display: inline-block; border: 1px solid var(--border); padding: 4px 8px; border-radius: 999px; margin-right: 6px; color: var(--muted); }

/* ===== Hero ===== */
.hero { display: grid; grid-template-columns: 1fr; gap: 18px; padding: 36px 0; }
.kicker { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; margin-bottom: 6px; }
.hero h1 { font-size: clamp(1.8rem, 2.5vw + 1rem, 2.4rem); margin: 0; }
.lead { font-size: 1.05rem; margin: 10px 0 8px; line-height: 1.6; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 14px 0; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
.tile small { display: block; color: var(--muted); }
.tile b { font-size: 1.2rem; }
@media (min-width: 920px) { .hero { grid-template-columns: 1.5fr .9fr; align-items: start; } }

.avatar-card { display: grid; gap: 10px; align-content: start; }
.avatar { width: 84px; height: 84px; border-radius: 18px; display: grid; place-items: center; border: 1px solid var(--border); font-weight: 700; }

/* ===== Sections ===== */
h2 { font-size: 1.55rem; margin: 24px 0 10px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.06); }
.pad { padding: 16px; }
.list-plain { list-style: none; padding: 0; margin: 0; }
/* Removed - now using .bullets for consistency */
.micro { font-size: .88rem; }

/* Experience timeline */
.timeline { display: grid; gap: 14px; }
.item h3 { margin: 6px 0; }

/* Projects */
.projects { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .projects { grid-template-columns: 1fr 1fr; } }
.project .meta { margin: 6px 0 8px; }

/* Skills grid */
.skills { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
@media (min-width: 820px) { .skills { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.skill { border: 1px dashed var(--border); padding: 10px 12px; border-radius: 12px; color: var(--muted); }

/* Contact grid */
.contact-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
@media (min-width: 820px) { .contact-grid { grid-template-columns: repeat(3, 1fr); } }

/* Footer styling */
footer {
  text-align: center;
  padding: 2rem 0 1rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

footer p {
  margin: 0.5rem 0;
  color: var(--text);
}

.footer-tagline {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.4;
}

.footer-disclaimer {
  font-size: 0.8rem;
  color: var(--muted-light);
  font-style: italic;
}

/* ===== Icon button ===== */
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: currentColor; cursor: pointer; }
.icon-btn:hover { background: rgba(0,0,0,.06); border-color: var(--border); }
:root[data-theme="dark"] .icon-btn:hover { background: rgba(255,255,255,.06); }

/* ===== High-contrast Modal ===== */
.modal-backdrop { 
  position: fixed; 
  inset: 0; 
  background: rgba(8, 11, 15, 0.65); 
  backdrop-filter: blur(6px); 
  opacity: 0; 
  visibility: hidden; 
  transition: opacity .2s ease, visibility 0s linear .2s; 
  z-index: 1000;
  display: none;
}
.modal-backdrop[aria-hidden="false"] { 
  opacity: 1; 
  visibility: visible; 
  transition: opacity .2s ease;
  display: block;
}
.modal { 
  width: min(900px, 94vw); 
  margin: 6vh auto; 
  background: var(--surface); 
  color: var(--text); 
  border: 1px solid var(--border); 
  border-radius: 16px; 
  box-shadow: 0 30px 80px rgba(0,0,0,.5); 
  overflow: hidden;
  max-height: calc(100vh - 12vh);
  display: flex;
  flex-direction: column;
}
@media (min-width: 1024px) {
  .modal { 
    width: min(1000px, 90vw);
    margin: 8vh auto;
  }
}
@media (min-width: 1280px) {
  .modal { 
    width: min(1100px, 85vw);
  }
}
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); }
.tabs { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 6px; 
  padding: 10px 12px 0; 
}
@media (min-width: 1024px) {
  .tabs { 
    gap: 8px; 
    padding: 12px 16px 0; 
  }
}
.tab { 
  border: 1px solid var(--border); 
  background: color-mix(in oklab, var(--surface) 80%, transparent); 
  border-radius: 10px; 
  padding: 8px 12px; 
  cursor: pointer; 
  transition: all 0.2s ease;
  color: var(--muted);
}
.tab.active { 
  background: var(--brand); 
  color: #fff; 
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(124, 92, 255, 0.3); 
  transform: translateY(-1px);
}
.tab:hover:not(.active) {
  background: var(--card);
  border-color: var(--brand);
}
.tabpanes { 
  padding: 12px 16px 18px; 
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 1024px) {
  .tabpanes { padding: 16px 20px 24px; }
}
.pane { display: none; }
.pane.active { display: block; }
.kpi { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 680px) { 
  .kpi { grid-template-columns: repeat(3, 1fr); } 
}
@media (min-width: 1024px) { 
  .kpi { gap: 14px; } 
}
.kbox { border: 1px dashed var(--border); padding: 10px 12px; border-radius: 12px; }
@media (min-width: 1024px) {
  .kbox { padding: 12px 16px; }
}

/* Code box */
.codebox { background: #0f1115; color: #e8eaed; padding: 12px; border-radius: 12px; overflow: auto; border: 1px solid rgba(255,255,255,.08); }

/* ===== Resume overlay (print-ready) ===== */
#resume-overlay { position: fixed; inset: 0; background: rgba(8,11,15,.55); backdrop-filter: blur(3px); opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s linear .2s; z-index: 900; }
#resume-overlay[aria-hidden="false"] { opacity: 1; visibility: visible; transition: opacity .2s ease; }
.resume-sheet { 
  width: min(900px, 94vw); 
  margin: 5vh auto; 
  max-height: calc(100vh - 10vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface); 
  color: var(--text); 
  border: 1px solid var(--border); 
  border-radius: 16px; 
  box-shadow: 0 30px 80px rgba(0,0,0,.45); 
  padding: 20px; 
}
.resume-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: flex-start; 
  margin-bottom: 20px; 
  gap: 20px; 
}
.resume-info { flex: 1; }
.resume-name { 
  font-weight: 800; 
  letter-spacing: .08em; 
  font-size: 1.8rem;
  margin-bottom: 8px;
}
.resume-title { 
  font-weight: 600; 
  color: var(--brand); 
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.resume-contact { 
  color: var(--muted); 
  font-size: 0.9rem;
}
.resume-headshot { 
  flex-shrink: 0; 
}
.resume-subsection { 
  margin-left: 20px; 
  margin-bottom: 16px; 
}
.resume-subsection p em { 
  font-weight: 600; 
  color: var(--text); 
}
.resume-actions { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 8px; }
.resume-section { margin-top: 16px; }
.resume-rule { height: 1px; background: var(--border); margin: 6px 0 10px; }
.resume-list { 
  list-style: none;
  margin: .35rem 0;
  padding: 0;
}
.resume-list li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.25rem;
  line-height: 1.6;
}
.resume-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  top: 0.2rem;
  color: var(--brand);
  font-weight: bold;
}
.resume-skills, .resume-tools { line-height: 1.6; }

/* ===== Focus ring ===== */
:where(button, a, [tabindex]):focus-visible { outline: 2px solid #7c5cff; outline-offset: 2px; border-radius: 8px; }

/* ===== REVIEWMYBITS UI TOKENS (mobile-first responsive) ===== */
.card-enhanced { 
  background: rgba(17,17,17,.6); 
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px; 
  padding: 16px; 
  box-shadow: 0 10px 30px rgba(0,0,0,.35); 
}
:root[data-theme="light"] .card-enhanced {
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 10px 30px rgba(0,0,0,.1);
}

.section-title { 
  display: flex; 
  align-items: center; 
  gap: 0.75rem; 
  margin-bottom: 1rem; 
  font-weight: 600; 
  font-size: 1.25rem;
}
@media (min-width: 640px) {
  .section-title { 
    gap: 0.5rem; 
    font-size: 1.4rem; 
  }
}

.section-title::before { 
  content: ""; 
  width: 16px; 
  height: 16px; 
  border-radius: 999px;
  background: linear-gradient(90deg, rgb(56,189,248), transparent); 
  flex-shrink: 0;
}
@media (min-width: 640px) {
  .section-title::before { 
    width: 14px; 
    height: 14px; 
  }
}

.lead-enhanced { 
  margin-bottom: 1rem; 
  color: #a3a3a3; 
  font-size: 1rem; 
  line-height: 1.6;
}
@media (min-width: 640px) {
  .lead-enhanced { 
    font-size: 0.925rem; 
    margin-bottom: 0.75rem; 
  }
}

.bullets { 
  list-style: none; 
  padding: 0; 
  margin: 0; 
}
.bullets li { 
  position: relative; 
  padding-left: 1.5rem; 
  line-height: 1.6; 
  margin-bottom: 0.5rem;
}
@media (min-width: 640px) {
  .bullets li { 
    padding-left: 1.25rem; 
    line-height: 1.5rem; 
    margin-bottom: 0.25rem;
  }
}
.bullets li::before { 
  content: "•"; 
  position: absolute; 
  left: 0; 
  top: 0.2rem; 
  color: var(--brand); 
  font-weight: bold;
}

/* Enhanced chips with better mobile touch targets */
.chip-enhanced { 
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  gap: 4px; 
  font-weight: 600; 
  font-size: 0.8rem;
  color: #fff; 
  background: #0ea5e9; 
  border: 1px solid rgba(255,255,255,.15);
  padding: 0.5rem 0.875rem; 
  border-radius: 999px;
  margin: 0;
  min-height: 36px;
  white-space: nowrap;
  text-align: center;
  flex-shrink: 0;
}
@media (min-width: 640px) {
  .chip-enhanced { 
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    min-height: 32px;
  }
}
@media (min-width: 1024px) {
  .chip-enhanced { 
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    min-height: 36px;
  }
}
.chip-enhanced.emerald { background: #10b981; }
.chip-enhanced.purple { background: #8b5cf6; }
.chip-enhanced.rose { background: #f43f5e; }

/* Light theme chip improvements for better contrast */
:root[data-theme="light"] .chip-enhanced {
  background: #1e40af; /* Darker blue for better contrast */
  color: #ffffff;
  border: 1px solid rgba(30, 64, 175, 0.2);
}
:root[data-theme="light"] .chip-enhanced.emerald { 
  background: #047857; /* Darker green for better contrast */
  border: 1px solid rgba(4, 120, 87, 0.2);
}
:root[data-theme="light"] .chip-enhanced.purple { 
  background: #6d28d9; /* Darker purple for better contrast */
  border: 1px solid rgba(109, 40, 217, 0.2);
}
:root[data-theme="light"] .chip-enhanced.rose { 
  background: #be185d; /* Darker rose for better contrast */
  border: 1px solid rgba(190, 24, 93, 0.2);
}

/* Enhanced modal shell with better mobile UX */
[data-modal-enhanced] { 
  position: fixed; 
  inset: 0; 
  z-index: 90; 
  display: grid; 
  place-items: center;
  padding: 1rem;
}
[data-modal-enhanced] .overlay { 
  position: absolute; 
  inset: 0; 
  background: rgba(0,0,0,.7); 
  backdrop-filter: blur(8px); 
}
[data-modal-enhanced] .panel { 
  position: relative; 
  width: min(980px, 100%); 
  max-height: calc(100vh - 2rem); 
  overflow: auto;
  background: rgba(17,17,17,.98); 
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px; 
  padding: 1.5rem; 
  box-shadow: 0 25px 80px rgba(0,0,0,.8);
}
:root[data-theme="light"] [data-modal-enhanced] .panel {
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(0,0,0,.12);
}
@media (min-width: 640px) {
  [data-modal-enhanced] { padding: 2rem; }
  [data-modal-enhanced] .panel { border-radius: 16px; }
}

.icon-btn-enhanced { 
  border: 1px solid rgba(255,255,255,.12); 
  background: transparent; 
  color: inherit; 
  border-radius: 12px; 
  padding: 12px 16px; 
  cursor: pointer;
  min-height: 44px; /* Better touch target */
  font-size: 0.9rem;
}
@media (min-width: 640px) {
  .icon-btn-enhanced { 
    border-radius: 8px; 
    padding: 6px 8px;
    min-height: auto;
    font-size: 0.8rem;
  }
}
:root[data-theme="light"] .icon-btn-enhanced {
  border: 1px solid rgba(0,0,0,.12);
}

/* Enhanced tab system with mobile-first design */
.tab-enhanced { 
  border-radius: 999px; 
  padding: 0.5rem 1rem; 
  border: 1px solid rgba(255,255,255,.12); 
  color: #d1d5db;
  min-height: 44px; /* Touch-friendly */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}
@media (min-width: 640px) {
  .tab-enhanced { 
    padding: 0.25rem 0.6rem;
    min-height: auto;
    font-size: 0.8rem;
  }
}
.tab-enhanced[data-active="true"] { 
  background: rgba(2,132,199,.9); 
  color: #fff; 
  border-color: transparent; 
}
:root[data-theme="light"] .tab-enhanced {
  border: 1px solid rgba(0,0,0,.12);
  color: #6b7280;
}

/* Chiprow container for better mobile layout */
.chiprow { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 0.5rem; 
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
}
:root[data-theme="light"] .chiprow {
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.1);
}
@media (min-width: 640px) {
  .chiprow { 
    gap: 0.75rem; 
    padding: 1rem;
  }
}
@media (min-width: 1024px) {
  /* Hide mini tabs navigation on desktop since main navigation is available at top */
  #miniTabs { 
    display: none !important;
  }
}

/* Enhanced utility classes */
.hidden { display: none !important; }



/* ===== MOBILE OPTIMIZATIONS ===== */

/* Improved touch targets for mobile */
@media (max-width: 639px) {
  .btn { 
    min-height: 44px; 
    padding: 12px 18px;
    font-size: 1rem;
    touch-action: manipulation;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  
  .chip { 
    min-height: 40px;
    padding: 8px 12px;
    font-size: 0.875rem;
  }
  
  .tab { 
    min-height: 44px;
    padding: 12px 16px;
    font-size: 0.9rem;
  }
  
  /* Better spacing for mobile cards */
  .card, .card-enhanced { 
    padding: 20px;
    margin-bottom: 1.5rem;
  }
  
  /* Improved readability on mobile */
  .section-title { 
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
  }
  
  .lead, .lead-enhanced { 
    font-size: 1.1rem;
    line-height: 1.7;
  }
  
  /* Better bullet spacing on mobile */
  .bullets li { 
    margin-bottom: 0.75rem;
    line-height: 1.7;
  }
  
  /* Mobile-optimized navigation */
  .nav-inner { 
    padding: 12px 0;
  }
  
  .brand { 
    gap: 12px;
  }
  
  /* Hide nav headshot on mobile to avoid duplication */
  .brand .headshot-container {
    display: none;
  }
  
  /* Improved hero section on mobile */
  .hero { 
    padding: 48px 0;
    gap: 24px;
  }
  
  /* Avatar card mobile sizing */
  .avatar-card {
    padding: 16px;
  }
  
  .tiles { 
    gap: 12px;
  }
  
  .tile { 
    padding: 16px;
  }
  
  /* Better modal experience on mobile */
  [data-modal-enhanced] { 
    padding: 0.5rem;
  }
  
  [data-modal-enhanced] .panel { 
    padding: 1.25rem;
    border-radius: 16px;
  }
  
  /* Mobile modal improvements for Learn More modal */
  .modal {
    margin: 2vh auto;
    max-height: calc(100vh - 4vh);
    width: min(900px, 96vw);
  }
  
  .tabpanes {
    padding: 8px 12px 12px;
    max-height: 65vh;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
  }
  
  .tabs {
    padding: 8px 12px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .tabs::-webkit-scrollbar {
    display: none;
  }
  
  .tab {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  .modal-header {
    padding: 12px 16px;
    flex-shrink: 0;
  }
  
  .modal-footer {
    padding: 8px 16px;
    flex-shrink: 0;
  }
  
  .chiprow {
    margin: 8px 12px 12px;
    flex-shrink: 0;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .chiprow::-webkit-scrollbar {
    display: none !important;
  }
  
  /* Prevent iOS zoom on form focus/tap */
  .tab, .btn, .chip-enhanced {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Ensure modal content is scrollable */
  .modal-backdrop {
    touch-action: pan-y;
  }
  
  /* Better content spacing in modal panes */
  .pane {
    padding-bottom: 20px;
    line-height: 1.6;
  }

  /* Add visual scroll indicator for better UX */
  .tabpanes {
    position: relative;
  }

  .tabpanes::after {
    content: '';
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    height: 12px;
    background: linear-gradient(transparent, var(--card) 80%);
    pointer-events: none;
    margin: -8px -12px 0;
    opacity: 0.8;
  }
  
  .bullets li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
  }
  
  .kpi {
    gap: 12px;
  }
  
  .kbox {
    padding: 12px 14px;
  }
  
  /* Improved skills grid on mobile */
  .skills { 
    gap: 12px;
  }
  
  .skill { 
    padding: 14px 16px;
    font-size: 0.9rem;
  }
  
  /* Better contact grid on mobile */
  .contact-grid { 
    gap: 12px;
  }
  
  /* Improved project cards */
  .projects { 
    gap: 16px;
  }
  
  /* Ensure Learn More button is properly touchable */
  #learnMoreBtn {
    position: relative;
    z-index: 1;
    pointer-events: auto;
  }
  
  /* Mini tabs mobile optimization */
  #miniTabs ul { 
    padding: 1rem;
    gap: 0.75rem;
  }
  
  .tab-enhanced { 
    font-size: 0.875rem;
    white-space: nowrap;
  }
  
  /* Timeline mobile improvements */
  .timeline { 
    gap: 20px;
  }
  
  .timeline .card { 
    padding: 18px;
  }
}

/* Specific improvements for very small screens */
@media (max-width: 375px) {
  .wrap { 
    width: min(1100px, 95vw);
  }
  
  .hero h1 { 
    font-size: 1.75rem;
  }
  
  .tiles { 
    grid-template-columns: 1fr;
  }
  
  .chiprow { 
    gap: 0.25rem;
  }
  
  .chip-enhanced { 
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }
}

/* Responsive headshot container */
.headshot-container {
  display: inline-block;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.15);
  flex-shrink: 0;
}
:root[data-theme="light"] .headshot-container {
  border: 2px solid rgba(0,0,0,.1);
}

.headshot-small { width: 48px; height: 48px; }
.headshot-medium { width: 60px; height: 60px; }
.headshot-large { width: 80px; height: 80px; }

@media (min-width: 640px) {
  .headshot-small { width: 56px; height: 56px; }
  .headshot-medium { width: 72px; height: 72px; }
  .headshot-large { width: 96px; height: 96px; }
}

.headshot-img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: optimize-quality;
}

/* Print (resume only) */
@media print {
  @page {
    margin: 0.75in 0.6in;
    size: letter;
  }

  * { 
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  
  html, body { 
    background: #fff !important; 
    color: #1a1a1a !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-font-smoothing: antialiased !important;
    overflow: visible !important;
  }
  
  /* Hide all non-resume content - be very explicit */
  body > *:not(#resume-overlay) {
    display: none !important;
  }
  
  /* Hide specific elements that might interfere */
  .nav, .hero, #about, #ethos, #experience, #projects, #skills, #site, #contact, 
  .modal-backdrop, .modal, .resume-actions, #resumeToggle,
  main, header, .container {
    display: none !important; 
  }

  /* Override any visibility or display issues */
  .nav *, .hero *, #about *, #ethos *, #experience *, #projects *, #skills *, #site *, #contact * {
    display: none !important;
    visibility: hidden !important;
  }

  /* Show resume data sections in print */
  .bullets, .resume-tools {
    display: block !important;
    visibility: visible !important;
  }

  /* Print-optimized bullets - keep custom styling but adjust for print */
  .bullets {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 3pt 0 6pt 0 !important;
  }

  .bullets li {
    position: relative !important;
    padding-left: 12pt !important;
    margin-left: 0 !important;
    margin-bottom: 2pt !important;
    font-size: 9pt !important;
    line-height: 1.3 !important;
  }

  .bullets li::before {
    content: "•" !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    color: #7c5cff !important; /* Use brand color in print */
    font-weight: bold !important;
    display: block !important;
  }
  
  #resume-overlay { 
    position: static !important; 
    opacity: 1 !important; 
    visibility: visible !important; 
    background: white !important;
    z-index: auto !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    transform: none !important;
  }

  /* Force resume overlay to be visible and prioritized */
  #resume-overlay.show {
    display: block !important;
  }
  
  .resume-sheet { 
    box-shadow: none !important; 
    margin: 0 !important; 
    border: none !important;
    padding: 0 !important;
    background: #fff !important;
    color: #1a1a1a !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
  }
  
  /* Professional header with modern layout */
  .resume-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 16pt !important;
    page-break-inside: avoid !important;
    border-bottom: 2pt solid #2563eb !important;
    padding-bottom: 10pt !important;
    min-height: 72pt !important;
  }

  .resume-info {
    flex-grow: 1 !important;
  }
  
  .resume-name {
    font-size: 28pt !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
    margin: 0 0 4pt 0 !important;
    line-height: 1.1 !important;
    letter-spacing: -0.5px !important;
  }
  
  .resume-title {
    font-size: 14pt !important;
    color: #2563eb !important;
    margin: 0 0 6pt 0 !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
  }
  
  .resume-contact {
    font-size: 10pt !important;
    color: #4b5563 !important;
    margin: 0 !important;
    line-height: 1.4 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0 12pt !important;
  }

  .resume-contact span {
    white-space: nowrap !important;
  }

  .resume-contact a {
    color: #2563eb !important;
    text-decoration: none !important;
  }

  .resume-contact a:hover {
    text-decoration: underline !important;
  }
  
  .resume-headshot {
    flex-shrink: 0 !important;
    margin-left: 20pt !important;
    align-self: center !important;
  }

  /* Print headshot styling - clean and professional */
  .resume-headshot img {
    width: 60pt !important;
    height: 60pt !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    object-position: center center !important;
    border: none !important;
    box-shadow: none !important;
    background: none !important;
    display: block !important;
  }

  /* Web headshots - styled and attractive */
  @media screen {
    .headshot-img {
      border: 2px solid var(--border) !important;
      box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
      object-fit: cover !important;
      object-position: center center !important;
    }
    
    :root[data-theme="dark"] .headshot-img {
      border-color: rgba(255,255,255,0.2) !important;
      box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    }

    /* Resume modal headshot on screen should also be styled */
    .resume-headshot img {
      border: 2px solid var(--border) !important;
      box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
      width: 80px !important;
      height: 80px !important;
    }
  }
  
  /* Professional section styling */
  .resume-section {
    margin-bottom: 12pt !important;
    page-break-inside: avoid !important;
  }
  
  .resume-section h3 {
    font-size: 12pt !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
    margin: 0 0 8pt 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
    border-bottom: 1pt solid #d1d5db !important;
    padding-bottom: 3pt !important;
  }
  
  .resume-rule {
    display: none !important;
  }
  
  /* Experience entries with better spacing */
  .resume-subsection {
    margin-bottom: 8pt !important;
    page-break-inside: avoid !important;
  }
  
  .resume-subsection p {
    margin: 0 0 4pt 0 !important;
    font-size: 11pt !important;
    color: #1a1a1a !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
  }
  
  .resume-subsection p em {
    font-style: normal !important;
    color: #6b7280 !important;
    font-weight: 400 !important;
    font-size: 9pt !important;
    display: block !important;
    margin-top: 2pt !important;
  }
  
  .resume-list {
    margin: 3pt 0 6pt 0 !important;
    padding-left: 0 !important;
    list-style: none !important;
  }
  
  .resume-list li {
    position: relative !important;
    padding-left: 12pt !important;
    margin-bottom: 2pt !important;
    font-size: 9pt !important;
    line-height: 1.3 !important;
    color: #374151 !important;
    text-align: justify !important;
  }

  .resume-list li::before {
    content: "•" !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    color: #7c5cff !important;
    font-weight: bold !important;
  }
  
  /* Skills section */
  .resume-skills {
    font-size: 10pt !important;
    line-height: 1.5 !important;
    color: #374151 !important;
    text-align: justify !important;
  }

  /* Resume tools/additional section */
  .resume-tools {
    font-size: 10pt !important;
    line-height: 1.5 !important;
    color: #374151 !important;
    text-align: justify !important;
    margin: 0 !important;
  }

  /* Professional summary styling */
  .resume-section:first-of-type p {
    font-size: 10pt !important;
    color: #374151 !important;
    line-height: 1.5 !important;
    text-align: justify !important;
    margin-bottom: 0 !important;
  }
  
  /* Ensure proper page breaks */
  .resume-section:nth-child(n+4) {
    page-break-before: auto !important;
  }

  /* Professional typography */
  strong {
    font-weight: 600 !important;
    color: #1a1a1a !important;
  }
}
