:root {
  /* Layout variables */
  --container-max-width: 800px;
  --page-padding: 0px;
  --card-padding: 24px;
  --nav-horizontal: 24px;
  --ad-width: 160px;
  --ad-gap: 40px; /* space between container edge and ad */

  /* Colors and fonts */
  --accent-blue: #007acc;
  --font-main: 'Open Sans', sans-serif;
  --text-color: #444;
  --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Base styles */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  margin: 0;
  padding: 0;
  background: #f5f5f5; /* restore subtle off-white page background */
  color: var(--text-color);
  line-height: 1.6;
}

/* Base container layout; About and CV refine this below */
.container {
  max-width: min(var(--container-max-width), calc(100% - 2 * var(--page-padding)));
  margin: 0 auto;
  padding: var(--card-padding);
  background: #fff;
  box-shadow: var(--box-shadow);
  border-radius: 8px;
  box-sizing: border-box;
}

/* Base header layout; CV and About refine this below */
header {
  position: relative;
  width: 100%;
  max-width: min(var(--container-max-width), calc(100% - 2 * var(--page-padding)));
  margin: 0 auto 18px;
  padding: 20px 24px;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  text-align: center;
  box-sizing: border-box;
}

/* Section-nav wrapper: non-fixed by default */
.sticky-wrapper {
  position: relative;
  width: 100%;
  padding: 0;
  background: transparent;
}

/* Default section-nav appearance (non-CV pages) */
.sticky-wrapper .section-nav {
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

.sticky-wrapper .section-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

/* Main content default spacing for non-cv pages */
.main-content {
  padding-top: 0;
  box-sizing: border-box;
  width: 100%;
}

/* CV layout: container becomes a transparent shell; .doc-card draws the card */
.container {
  max-width: min(var(--container-max-width), calc(100% - 2 * var(--page-padding)));
  margin: 0 auto;
  padding: 0;              /* content padding moved to .doc-card */
  background: transparent; /* container itself no longer shows the white card */
  box-shadow: none;
}

/* CV header: fixed and visually acts as the top of the card */
header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(var(--container-max-width), calc(100% - 2 * var(--page-padding)));
  max-width: 100%;
  z-index: 1200;
  background: #fff;
  box-sizing: border-box;
  padding: 12px 24px 6px;       /* reduce bottom padding so nav sits closer */
  border: none;
  border-radius: 8px 8px 0 0;   /* keep rounded top only */
  box-shadow: var(--box-shadow);    /* header provides the card shadow */
}

/* sticky-wrapper sits inside the header (static) so it visually belongs to header */
.sticky-wrapper {
  position: static;         /* no longer fixed */
  top: auto;
  left: auto;
  transform: none;
  width: 100%;
  padding: 4px 24px 0;        /* small spacing inside header */
  background: transparent;
}

/* keep nav visual style but integrated into header */
.sticky-wrapper .section-nav {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

.sticky-wrapper .section-nav ul {
  list-style: none;
  margin: 0;
  padding: 4px 0 4px;  /* remove extra vertical gap */
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  justify-content: center;
  align-items: center;
}

/* Main content padding: reserve space for fixed header (nav lives inside header) */
.main-content {
  padding-top: var(--header-height, 88px);
  box-sizing: border-box;
}

/* Headings */
h1, h2, h3 {
  color: #111;
}

/* Reset footer defaults so both pages start from same baseline */
footer {
  margin: 0;
  padding: 0;
}

h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
  text-align: center;
  font-weight: 600;
  padding: 0 16px;
}

h2 {
  font-size: 1.3em;
  border-bottom: 2px solid #eee;
  padding-bottom: 5px;
  margin-top: 30px;
}

/* Sections */
.section {
  margin-bottom: 30px;
}

.section h2 {
  padding-top: 10px;
}

/* Footers inside cards: consistent placement across pages */
.doc-card footer,
body:not(.cv-page) footer {
  margin-top: 20px;
  padding-top: 6px;
  border-top: 1px solid #e6e6e6;
  text-align: center;
  width: 100%;
}
.doc-card footer hr,
body:not(.cv-page) footer hr {
  display: none;
}

.doc-card footer p,
body:not(.cv-page) footer p {
  margin: 4px 0 0;
}

/* Shared document card styling (CV and About) */
.doc-card {
  width: min(var(--container-max-width), calc(100% - 2 * var(--page-padding)));
  margin: 0 auto;
  background: #fff;
  box-shadow: var(--box-shadow);
  border-radius: 8px;
  padding: var(--card-padding);
  box-sizing: border-box;
}

.section ul {
  margin-top: 0.4rem;
  margin-bottom: 1rem;
  padding-left: 18px;
}

/* Job and education blocks */
.job-title {
  font-weight: 700;
  font-size: 1.05em;
  margin-bottom: 0;
}

.institution {
  font-style: italic;
  color: #666;
  margin: 0 0 0.3rem 0;
}

.tight-line {
  margin: 0.1rem 0 0.3rem;
  line-height: 1.3;
}

.edu-block {
  margin-bottom: 1rem;
}

.edu-block + .edu-block {
  margin-top: 1.2rem;
}

.job-block {
  margin-bottom: 2rem;
}

/* Role titles and wrappers */
.role-wrapper {
  margin-left: 1rem;
  margin-top: 0.5rem;
}

.role-title {
  font-weight: 600;
  margin: 0.8rem 0 0.3rem 0;
}

.role-title strong {
  color: #111;
}

/* Links and top navigation */
a,
.contact-list a,
.nav li a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

a:hover,
a:focus,
.contact-list a:hover,
.contact-list a:focus,
.nav li a:hover,
.nav li a:focus {
  text-decoration: underline;
}

.nav {
  display: flex;
  gap: 30px;
  justify-content: center;
  padding: 0 16px;
  list-style: none;
}

.nav a.active {
  font-weight: 700;
  border-bottom: 2px solid var(--accent-blue);
}

/* Top nav sizing for smaller screens (shared by index and about) */
@media (max-width: 720px) {
  .nav {
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 10px;
  }
  .nav a {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .nav {
    gap: 8px;
  }
  .nav a {
    font-size: 14px;
  }
}

/* CV button */
.cv-button {
  display: inline-block;
  background-color: var(--accent-blue);
  color: #fff;
  padding: 10px 18px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.8em;
  border: 3px solid #333;
  border-radius: 0;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 4px 4px 0 #222;
  transition: all 0.1s ease-in-out;
  margin: 10px 0 20px 0;
}

.cv-button:hover,
.cv-button:focus {
  background-color: #005f99;
  box-shadow: 2px 2px 0 #111;
  transform: translate(2px, 2px);
}

.api-demo-box {
  background: #f3f7fa;
  border: 3px solid #333;
  padding: 10px 12px;
  border-radius: 0;
  margin: 16px 0;
  text-align: center;
  box-shadow: 3px 3px 0 #222;
  font-family: 'Press Start 2P', monospace;
  max-width: 100%;
  box-sizing: border-box;
}

.api-demo-box button {
  background-color: var(--accent-blue);
  color: #fff;
  padding: 8px 14px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75em;
  border: 3px solid #333;
  border-radius: 0;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 3px 3px 0 #222;
  transition: all 0.1s ease-in-out;
  margin-top: 8px;
}

.api-demo-box button:hover {
  background-color: #005f99;
  box-shadow: 2px 2px 0 #111;
  transform: translate(2px, 2px);
}

.api-result {
  margin-top: 10px;
  color: #333;
  line-height: 1.4;
  font-size: 0.75em;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-family: 'Press Start 2P', monospace;
}

.api-toggle-btn {
  background-color: var(--accent-blue);
  color: #fff;
  border: 3px solid #333;
  padding: 6px 10px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7em;
  cursor: pointer;
  box-shadow: 3px 3px 0 #222;
  border-radius: 0;
  text-transform: uppercase;
}

.api-toggle-btn:hover {
  background-color: #005f99;
  box-shadow: 1px 1px 0 #111;
  transform: translate(2px, 2px);
}

/* Download box */
.download-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 14px;
  margin: 0 auto 20px;
  background: #f3f7fa;
  border-radius: 8px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-sizing: border-box;
  box-shadow: none;
}

.download-note {
  font-size: 0.95em;
  color: #555;
  text-align: center;
  white-space: nowrap;
  margin: 0;
}

/* Contact list */
.contact-list {
  list-style: none;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.contact-list li {
  display: flex;
  align-items: center;
  gap: 5px;
}

.linkedin-icon {
  fill: #0077b5;
  vertical-align: middle;
  margin-right: 5px;
}

/* Media elements: scale within card */
img,
video,
iframe,
canvas,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Desktop main layout: CV card centered with side demo ads */
.main-layout {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 32px;
  padding: 0;
  box-sizing: border-box;
}

/* Desktop ad slots pinned to left/right of the CV card */
.ad-slot {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--ad-width);
}

.left-ad {
  left: calc((100vw - var(--container-max-width)) / 4 - var(--ad-width) / 2);
}

.right-ad {
  right: calc((100vw - var(--container-max-width)) / 4 - var(--ad-width) / 2);
}

.ad-content {
  width: var(--ad-width);
  height: 600px;
  background: #f0f3f5;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--box-shadow);
  padding: 10px;
  text-align: center;
}

.ad-note {
  font-size: 0.8em;
  color: #666;
  margin-top: 10px;
}

.voiceover {
  text-align: center;
  margin: 20px 0;
}

#playVoiceover {
  display: inline-block;
  background-color: var(--accent-blue);
  color: #fff;
  padding: 8px 14px;           
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75em;             
  border: 3px solid #333;
  border-radius: 0;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 4px 4px 0 #222;   
  transition: all 0.1s ease-in-out;
  margin: 10px 0 20px 0;
  cursor: pointer;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
}

#playVoiceover:hover {
  background-color: #005f99;    
  box-shadow: 2px 2px 0 #111;   
  transform: translate(2px, 2px);
}

.audio-progress {
  text-align: center;
  font-size: 0.9em;
  color: #555;
  margin-top: 5px;
}

/* Audio progress bar */
#audioProgress {
  width: 80%;
  display: block;
  margin: 10px auto;
  height: 8px;
  border-radius: 5px;
  cursor: pointer;
  appearance: none;
  background: linear-gradient(to right, var(--accent-blue) 0%, #ddd 0%);
  outline: none;
}

/* Audio progress thumb — Chrome / Safari */
#audioProgress::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent-blue);
  border: 2px solid #333;
  border-radius: 50%;
  margin-top: -3px;
  cursor: pointer;
}

/* Audio progress thumb — Firefox */
#audioProgress::-moz-range-track {
  background: linear-gradient(to right, var(--accent-blue) 0%, #ddd 0%);
  height: 8px;
  border-radius: 5px;
}
#audioProgress::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent-blue);
  border: 2px solid #333;
  border-radius: 50%;
  cursor: pointer;
}

.playback-speed {
  text-align: center;
  margin-top: 10px;
  font-size: 0.9em;
  color: #555;
}

.playback-speed select {
  margin-left: 6px;
  padding: 3px 6px;
  font-size: 0.9em;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  background-color: #fff;
}

.playback-speed label {
  font-weight: 600;
  color: #333;
}

/* CV page only: header + section nav fixed together */
.cv-page .container {
  max-width: min(var(--container-max-width), calc(100% - 2 * var(--page-padding)));
  margin: 0 auto;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.cv-page header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(var(--container-max-width), calc(100% - 2 * var(--page-padding)));
  max-width: 100%;
  z-index: 1200;
  background: #fff;
  box-sizing: border-box;
  padding: 12px 24px 6px;
  border: none;
  border-radius: 8px 8px 0 0;
  box-shadow: var(--box-shadow);
}

.cv-page .sticky-wrapper {
  position: static;
  width: 100%;
  padding: 4px var(--nav-horizontal) 0;
  background: transparent;
}

.cv-page .sticky-wrapper .section-nav {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

/* Improved balanced, single-line section nav */
.cv-page .sticky-wrapper .section-nav ul {
  display: flex;
  flex-wrap: nowrap;            /* keep a single line */
  gap: 8px;                     /* tighter spacing to prevent overflow */
  justify-content: center;      /* center the whole nav */
  align-items: center;
  white-space: nowrap;
  overflow: visible;            /* allow items to remain visible rather than clipped left */
  padding: 6px var(--nav-horizontal);            /* balanced inner padding */
  margin: 0 auto;
  box-sizing: border-box;
  width: 100%;
  max-width: min(var(--container-max-width), calc(100% - 2 * var(--page-padding))); /* keep centered and compact */
}

/* subtle left drift to counter long right-side labels (desktop only) */
@media (min-width: 961px) {
  .cv-page .sticky-wrapper .section-nav ul {
    transform: translateX(-24px); /* nudge further left to balance right-side labels */
  }
}

/* let items shrink but give a sensible preferred width for visual balance */
.cv-page .sticky-wrapper .section-nav li {
  flex: 0 1 auto;               /* allow gentle shrink on tight widths */
  min-width: 58px;
}

/* compact pills with ellipsis; slightly larger font for readability */
.cv-page .sticky-wrapper .section-nav a {
  display: inline-block;
  padding: 6px 9px;
  font-size: 12px;
  line-height: 1;
  border-radius: 6px;
  color: var(--accent-blue);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: none;              /* let full labels show; rely on flex spacing */
  text-align: center;
}

/* active pill highlight for scroll + click – compact CV-button inspired */
.cv-page .sticky-wrapper .section-nav a.active-section {
  background-color: var(--accent-blue);
  color: #fff;
  border: 1px solid #333;
  border-radius: 3px;
  box-shadow: 2px 2px 0 #222;
  padding: 4px 7px;
}

/* small-screen tweak: reduce preferred width so items still fit one line */
@media (max-width: 720px) {
  .cv-page .sticky-wrapper .section-nav li { flex: 0 1 90px; }
  .cv-page .sticky-wrapper .section-nav a { font-size: 13px; padding: 5px 8px; max-width: 10rem; }
}

.cv-page .doc-card {
  padding-top: 12px; /* slightly tighter top padding for CV card */
  margin-top: 0;
}

.cv-page .main-content {
  padding-top: var(--header-height, 88px); /* align body directly under header */
  box-sizing: border-box;
}

/* Desktop: nudge doc-card up to close the seam under the fixed header */
@media (min-width: 961px) {
  .cv-page .doc-card {
    margin-top: 0; /* align with header spacing */
    padding-top: var(--card-padding);
    box-shadow: var(--box-shadow);
  }
  .cv-page header {
    top: 16px; /* small gap like about page */
  }
  .cv-page .main-content {
    padding-top: calc(var(--header-height, 88px) + 16px); /* keep content below header with matching gap */
  }
  /* simple mask to cover the card under the header gap */
  body.cv-page::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 16px;
    background: #f5f5f5;
    z-index: 1198;
    pointer-events: none;
  }
}

/* Reduce rubber-band gap revealing page background on overscroll */
html, body {
  overscroll-behavior-y: contain;
}

/* About / other non-CV pages: header scrolls normally above a single card */
body:not(.cv-page) header {
  position: static;        /* not fixed */
  top: auto;
  left: auto;
  transform: none;
  z-index: 1;
  width: 100%;
  max-width: min(var(--container-max-width), calc(100% - 2 * var(--page-padding)));
  margin: 0 auto 22px;    /* push main content below the header */
  padding: 20px 24px;
  background: transparent;
  box-shadow: none;
  border-radius: 8px;
  box-sizing: border-box;
}

/* Non-CV pages: keep content directly below header */
body:not(.cv-page) .container,
body:not(.cv-page) main {
  padding-top: 0;
  margin-top: 0;
}

/* Non-CV pages: ensure sticky-wrapper never becomes fixed */
body:not(.cv-page) .sticky-wrapper {
  position: relative;
  top: auto;
  transform: none;
}

/* Non-CV pages: single centered document card */
body:not(.cv-page) .container {
  max-width: min(var(--container-max-width), calc(100% - 2 * var(--page-padding))); /* match CV width */
  margin: 16px auto 32px;   /* add a small top offset to mirror CV card spacing */
  padding: 0;
  background: #fff;
  box-shadow: var(--box-shadow);
  border-radius: 8px;
  box-sizing: border-box;
}

body:not(.cv-page) header {
  position: relative;
  margin: 0;
  padding: 28px 32px 12px;
  text-align: center;
  border-radius: 8px 8px 0 0;
  background: transparent;
}

body:not(.cv-page) header h1 {
  font-size: 34px;
  margin: 0 0 8px;
}

/* About content sizing — matches the document card width */
body:not(.cv-page) main {
  padding: 20px 40px 36px;
  font-size: 16px;
  line-height: 1.65;
  color: #333;
  box-sizing: border-box;
}

/* About page content: justify paragraph text for a clean column */
body:not(.cv-page) main p {
  text-align: justify;
  text-justify: inter-word;
}

/* About page voiceover layout */
body:not(.cv-page) .voiceover {
  max-width: 720px;
  margin: 0 auto 18px;
  text-align: center;
}

/* --- Mobile / responsive adjustments --- */
/* General small-screen adjustments */
@media (max-width: 960px) {
  :root {
    --ad-gap: 16px;
  }

  /* On mobile: stack main content and move ads below */
  .main-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  /* move side ads to the bottom and make them full-width */
  .left-ad,
  .right-ad {
    position: static;
    top: auto;
    transform: none;
    width: 100%;
    max-width: 360px;
    margin: 10px auto 0;
  }
  .ad-content {
    width: 100%;
    height: auto;
    padding: 10px 12px;
    border-radius: 8px;
  }
  .ad-content strong {
    font-size: 0.95em;
  }
  .ad-note {
    font-size: 0.78em;
    margin-top: 6px;
  }

  /* Make container/doc-card fluid with side padding */
  .doc-card,
  .container {
    width: calc(100% - 32px);
    max-width: none;
    margin: 12px auto;
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Tighten header on smaller screens */
  header {
    padding: 10px 16px;
    border-radius: 8px;
    width: calc(100% - 32px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }
  /* About header: match CV header width on mobile */
  body:not(.cv-page) header {
    width: calc(100% - 32px) !important;
    padding: 10px 16px !important;
  }

  h1 { font-size: 28px; }

  /* Section-nav: allow horizontal scroll on narrow screens */
  .sticky-wrapper .section-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sticky-wrapper .section-nav ul {
    gap: 10px 14px;
    padding: 6px 8px;
    white-space: nowrap;
  }
  .sticky-wrapper .section-nav ul li {
    display: inline-block;
  }
  .sticky-wrapper .section-nav a {
    padding: 6px 10px;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  /* Reduce padding inside cards on mobile */
  .cv-page .doc-card,
  body:not(.cv-page) .container {
    padding: 16px;
  }

  /* About page: avoid nested box look inside the card on mobile */
  body:not(.cv-page) .doc-card {
    background: transparent;
    box-shadow: none;
    padding: 0;
  }

  /* Audio / voiceover sizing */
  .voiceover,
  .about-audio {
    width: 100%;
    margin: 12px auto;
  }
  #audioProgress { width: 100%; }

  /* Slightly reduce text size on narrow screens */
  body, body:not(.cv-page) main, .cv-page .doc-card {
    font-size: 15px;
    line-height: 1.55;
  }

  /* CV page: let doc card stretch to header width */
  .cv-page .doc-card {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }
}

/* very small phones */
@media (max-width: 480px) {
  :root { --container-max-width: 100%; }

  /* Very compact header on extra-small screens */
  header {
    padding: 8px 12px;
  }
  h1 { font-size: 22px; }

  /* Top nav spacing */
  .nav { gap: 12px; }

  /* Buttons & interactive controls sized for touch */
  #playVoiceover,
  .api-toggle-btn,
  .api-demo-box button,
  .cv-button {
    padding: 9px 12px;
    font-size: 0.8em;
  }

  /* Reduce job/section spacing */
  .section { margin-bottom: 18px; }
  .role-wrapper { margin-left: 0.6rem; }

  /* Ensure header doesn't cover content when fixed */
  .cv-page header {
    padding-bottom: 6px;
  }
}

/* CV on mobile: use sticky header instead of fully fixed */
@media (max-width: 960px) {
  /* Make CV header sticky within the flow on mobile */
  .cv-page header {
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    transform: none !important;
    width: 100% !important;
    margin: 0 auto 0 !important;
    padding: 10px 16px !important;
    border-radius: 8px 8px 0 0 !important; /* keep rounded top corners like desktop */
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    background: #fff;
    z-index: 1200;
  }

  /* Tighten spacing around CV section-nav wrapper */
  .cv-page .sticky-wrapper {
    padding: 6px 12px 10px !important;
  }

  /* Let CV content sit directly under sticky header */
  .cv-page .main-content {
    padding-top: 12px !important; /* leave a small buffer under sticky header */
  }

  /* CV section-nav: wrap and allow horizontal scroll */
  .cv-page .section-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cv-page .sticky-wrapper .section-nav ul {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 8px;
    padding: 4px 6px;
    max-width: 100%;
    transform: none;
  }
  .cv-page .sticky-wrapper .section-nav li { flex: 0 1 100px; }
  .cv-page .sticky-wrapper .section-nav a { padding: 4px 8px; font-size: 12px; }
  .cv-page .doc-card {
    margin-top: 0;
    border-radius: 0 0 8px 8px;
  }
  /* Scale download button for narrow viewports */
  .download-box { padding: 12px 12px 16px; }
  .cv-button {
    font-size: 0.75em;
    padding: 10px 14px;
    box-shadow: 3px 3px 0 #222;
    max-width: 220px;
    width: 100%;
    text-align: center;
  }
  /* API demo: responsive text and buttons */
  .api-demo-box {
    padding: 12px;
  }
  .api-demo-box button {
    width: 100%;
    max-width: 220px;
    margin: 8px auto 0;
    display: block;
  }
  .api-result {
    font-size: 0.72em;
    text-align: left;
  }
  /* Remove top gap above CV card on small screens */
  .cv-page .container,
  .cv-page .doc-card,
  .cv-page main {
    margin-top: 0 !important;
  }
  .cv-page .main-layout {
    padding-top: 0 !important;
  }
  .cv-page header {
    margin-bottom: 0 !important;
  }
}

/* extra small phones */
@media (max-width: 480px) {
  .cv-page header h1 { font-size: 20px; }
  .cv-page .sticky-wrapper .section-nav ul { gap: 8px 12px; padding: 6px 8px; }
}

/* ensure no unwanted overflow and improve touch */
html, body {
  -webkit-tap-highlight-color: rgba(0,0,0,0.05);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
