:root {
  --navy-950: #0a1229;
  --navy-900: #121d42;
  --navy-800: #1e2856;
  --cobalt-700: #12489c;
  --cobalt-600: #0860d0;
  --cyan-500: #0ea5e9;
  --cyan-400: #38bdf8;
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --bg-page: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --border-subtle: rgba(30, 40, 86, 0.11);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 34px -8px rgba(18, 29, 66, 0.11), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 56px -14px rgba(12, 22, 56, 0.16), 0 4px 14px rgba(15, 23, 42, 0.06);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-display: 'Titillium Web', system-ui, -apple-system, sans-serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--slate-900);
  background-color: var(--bg-page);
  background-image:
    radial-gradient(1100px 540px at 15% -5%, rgba(8, 96, 208, 0.09), transparent 65%),
    radial-gradient(900px 480px at 88% 8%, rgba(14, 165, 233, 0.08), transparent 60%);
  line-height: 1.62;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--cobalt-600);
  text-decoration: none;
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

a:hover {
  color: var(--navy-800);
}

/* ==========================================================================
   CSS 3D Parabolic Shard Stream (Modernized tribute to original main.js)
   ========================================================================== */
.ambient-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  perspective: 820px;
  -webkit-perspective: 820px;
}

.ambient-canvas::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(244, 247, 251, 0.02) 0%,
    rgba(244, 247, 251, 0.48) 52%,
    rgba(244, 247, 251, 0.86) 100%
  );
}

.shard-stage {
  position: absolute;
  left: 50%;
  top: 250px;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  will-change: transform;
}

.shard {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 2px 10px rgba(10, 18, 41, 0.08);
  backface-visibility: visible;
  will-change: transform, opacity;
}

/* ==========================================================================
   Sticky Top Navigation
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(244, 247, 251, 0.82);
  border-bottom: 1px solid rgba(30, 40, 86, 0.09);
}

.topbar-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: 0.01em;
  color: var(--navy-800);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--navy-800), var(--cobalt-600));
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 3px 10px rgba(8, 96, 208, 0.25);
  transform: perspective(180px) rotateX(-6deg) rotateY(8deg);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-links a {
  padding: 0.38rem 0.72rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--slate-600);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--navy-800);
  background: rgba(8, 96, 208, 0.09);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.44rem 0.85rem;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--surface-solid);
  color: var(--navy-800);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  border-color: rgba(8, 96, 208, 0.35);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--navy-800), var(--cobalt-600));
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(8, 96, 208, 0.26);
}

.btn-primary:hover {
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(8, 96, 208, 0.36);
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.motion-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

body.motion-paused .motion-dot {
  background: var(--slate-500);
  box-shadow: none;
}

/* ==========================================================================
   Main Container & Hero
   ========================================================================== */
.shell {
  position: relative;
  z-index: 2;
  max-width: 1060px;
  margin: 0 auto;
  padding: 2.2rem 1.5rem 4.5rem;
}

.hero-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.96));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(30, 40, 86, 0.13);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2.6rem 2rem;
  margin-bottom: 2rem;
  animation: fadeRise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  z-index: 3;
  background: linear-gradient(90deg, var(--navy-800) 0%, var(--cobalt-600) 55%, var(--cyan-500) 100%);
}

.hero-perspective {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  perspective: 560px;
  -webkit-perspective: 560px;
}

.hero-perspective::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 68% 78% at 34% 44%,
    rgba(255, 255, 255, 0.94) 0%,
    rgba(255, 255, 255, 0.78) 58%,
    rgba(255, 255, 255, 0.18) 100%
  );
}

.hero-shard-stage {
  position: absolute;
  left: 58%;
  top: 44%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  will-change: transform;
}

.hero-top {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
}

.portrait-frame {
  position: relative;
  width: 144px;
  height: 144px;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(135deg, var(--navy-800), var(--cobalt-600), var(--cyan-400));
  box-shadow:
    0 14px 30px -8px rgba(18, 29, 66, 0.28),
    0 0 0 6px rgba(8, 96, 208, 0.07);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.portrait-frame:hover {
  transform: perspective(400px) rotateX(4deg) rotateY(-6deg) scale(1.02);
}

.portrait-frame img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  background: var(--navy-900);
}

.hero-identity {
  min-width: 0;
  perspective: 650px;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.78rem;
  border-radius: 999px;
  background: rgba(8, 96, 208, 0.09);
  border: 1px solid rgba(8, 96, 208, 0.2);
  color: var(--cobalt-700);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 0.65rem;
}

.role-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cobalt-600);
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4.4vw, 3.25rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.015em;
  color: var(--navy-800);
  transform: rotateX(-4deg) rotateY(3deg);
  transform-origin: left center;
  text-shadow: 0 2px 0 rgba(30, 40, 86, 0.08);
}

.hero-subtitle {
  margin: 0.55rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.08rem, 2vw, 1.32rem);
  font-weight: 600;
  color: var(--slate-700);
  line-height: 1.35;
}

.hero-subtitle strong {
  color: var(--cobalt-700);
  font-weight: 700;
}

.contact-row {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
}

.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.36rem 0.76rem;
  border-radius: var(--radius-sm);
  background: var(--slate-100);
  border: 1px solid rgba(30, 40, 86, 0.1);
  color: var(--slate-700);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
}

a.contact-chip:hover,
button.contact-chip:hover {
  background: #ffffff;
  color: var(--navy-800);
  border-color: rgba(8, 96, 208, 0.35);
  box-shadow: var(--shadow-sm);
}

.contact-chip svg {
  width: 15px;
  height: 15px;
  color: var(--cobalt-600);
  flex-shrink: 0;
}

.contact-chip.static {
  cursor: default;
}

.copy-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.08rem 0.38rem;
  border-radius: 4px;
  background: rgba(8, 96, 208, 0.1);
  color: var(--cobalt-700);
}

/* Metrics Strip */
.metrics-strip {
  position: relative;
  z-index: 2;
  margin-top: 1.85rem;
  padding-top: 1.45rem;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.metric-item {
  padding-left: 0.85rem;
  border-left: 3px solid var(--cobalt-600);
}

.metric-value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--navy-800);
}

.metric-label {
  margin-top: 0.18rem;
  font-size: 0.8rem;
  line-height: 1.38;
  color: var(--slate-600);
}

/* ==========================================================================
   Content Sections
   ========================================================================== */
.section-block {
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem 2.4rem;
  margin-bottom: 1.65rem;
  scroll-margin-top: 4.75rem;
  animation: fadeRise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  margin-bottom: 1.45rem;
  border-bottom: 2px solid rgba(30, 40, 86, 0.12);
}

.section-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--navy-800);
  letter-spacing: -0.01em;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 22px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--navy-800), var(--cobalt-600));
  transform: skewX(-12deg);
}

.section-subtitle {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--slate-500);
}

.profile-lead {
  font-size: 1.03rem;
  line-height: 1.72;
  color: var(--slate-700);
  margin: 0 0 0.95rem;
}

.profile-lead:last-child {
  margin-bottom: 0;
}

.profile-lead strong {
  color: var(--navy-800);
  font-weight: 600;
}

/* ==========================================================================
   Experience Timeline (Modernized expandable cards)
   ========================================================================== */
.view-toggle-group {
  display: inline-flex;
  background: var(--slate-100);
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
}

.view-toggle-btn {
  border: 0;
  background: transparent;
  padding: 0.25rem 0.72rem;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-toggle-btn.active {
  background: #ffffff;
  color: var(--navy-800);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.role-card {
  position: relative;
  background: var(--surface-solid);
  border: 1px solid rgba(30, 40, 86, 0.1);
  border-left: 5px solid var(--navy-800);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.45rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.role-card.current {
  border-left-color: var(--cobalt-600);
  background: linear-gradient(180deg, rgba(8, 96, 208, 0.025) 0%, #ffffff 100%);
}

.role-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: rgba(8, 96, 208, 0.28);
  border-left-color: var(--cobalt-600);
}

.role-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
  user-select: none;
}

.role-main {
  min-width: 0;
}

.role-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.65rem;
}

.role-company {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--navy-800);
}

.role-company a {
  color: inherit;
}

.role-company a:hover {
  color: var(--cobalt-600);
}

.role-position {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--cobalt-700);
}

.role-summary {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  color: var(--slate-600);
}

.role-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.role-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--slate-600);
  background: var(--slate-100);
  padding: 0.24rem 0.62rem;
  border-radius: 999px;
  white-space: nowrap;
}

.role-card.current .role-date {
  background: rgba(8, 96, 208, 0.11);
  color: var(--cobalt-700);
  font-weight: 600;
}

.role-chevron {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  color: var(--slate-500);
  background: transparent;
  transition: transform 0.22s ease, background-color 0.15s ease, color 0.15s ease;
}

.role-head:hover .role-chevron {
  background: var(--slate-100);
  color: var(--navy-800);
}

.role-card.is-collapsed .role-chevron {
  transform: rotate(-90deg);
}

/* Smooth CSS Grid accordion */
.role-details {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.26s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
  opacity: 1;
}

.role-card.is-collapsed .role-details {
  grid-template-rows: 0fr;
  opacity: 0;
}

.role-details-inner {
  overflow: hidden;
}

.role-bullets {
  margin: 0.85rem 0 0;
  padding-left: 1.15rem;
  color: var(--slate-700);
  font-size: 0.93rem;
}

.role-bullets li {
  margin-bottom: 0.44rem;
}

.role-bullets li:last-child {
  margin-bottom: 0;
}

.role-bullets strong {
  color: var(--slate-900);
  font-weight: 600;
}

.tag-list {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  padding: 0;
  list-style: none;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(30, 40, 86, 0.055);
  color: var(--navy-800);
  border: 1px solid rgba(30, 40, 86, 0.09);
}

/* ==========================================================================
   Education Grid
   ========================================================================== */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.15rem;
}

.edu-card {
  background: var(--surface-solid);
  border: 1px solid rgba(30, 40, 86, 0.1);
  border-left: 5px solid var(--navy-800);
  border-radius: var(--radius-md);
  padding: 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.edu-card.ongoing {
  border-left-color: var(--cobalt-600);
}

.edu-school {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.16rem;
  font-weight: 700;
  color: var(--navy-800);
}

.edu-degree {
  margin: 0.28rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cobalt-700);
}

.edu-note {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
  color: var(--slate-600);
  line-height: 1.55;
}

.edu-footer {
  margin-top: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* ==========================================================================
   Skills Matrix (Modernizing signature left-border .elskill columns)
   ========================================================================== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
}

.skill-card {
  background: var(--surface-solid);
  border: 1px solid rgba(30, 40, 86, 0.1);
  border-left: 5px solid var(--navy-800);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.35rem;
}

.skill-card:nth-child(odd) {
  border-left-color: var(--cobalt-600);
}

.skill-card.full-span {
  grid-column: 1 / -1;
}

.skill-heading {
  margin: 0 0 0.7rem;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--navy-800);
}

/* ==========================================================================
   Open Source & Research Portfolio
   ========================================================================== */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.15rem;
}

.project-card {
  background: var(--surface-solid);
  border: 1px solid rgba(30, 40, 86, 0.1);
  border-top: 4px solid var(--navy-800);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.45rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-top-color: var(--cobalt-600);
}

.project-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.project-year {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--slate-500);
  background: var(--slate-100);
  padding: 0.18rem 0.52rem;
  border-radius: 999px;
  white-space: nowrap;
}

.project-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy-800);
  line-height: 1.28;
}

.project-desc {
  margin: 0.65rem 0 0.95rem;
  font-size: 0.9rem;
  color: var(--slate-600);
  line-height: 1.6;
}

.project-links {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--cobalt-600);
}

.project-link:hover {
  color: var(--navy-800);
  text-decoration: underline;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  margin-top: 2.2rem;
  text-align: center;
  font-size: 0.83rem;
  color: var(--slate-500);
}

.site-footer p {
  margin: 0.25rem 0;
}

@keyframes fadeRise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Responsive Breakpoints (Screen only so Print keeps desktop CV layout)
   ========================================================================== */
@media screen and (max-width: 860px) {
  .nav-links {
    display: none;
  }

  .hero-card {
    padding: 1.75rem 1.25rem 1.45rem;
  }

  .hero-top {
    grid-template-columns: minmax(0, 1fr);
    text-align: center;
    justify-items: center;
    gap: 1.15rem;
  }

  .hero-identity {
    width: 100%;
    max-width: 100%;
  }

  .role-pill {
    max-width: 100%;
    white-space: normal;
    text-align: center;
    justify-content: center;
  }

  .hero-title {
    transform: none;
    overflow-wrap: break-word;
  }

  .hero-subtitle {
    overflow-wrap: break-word;
  }

  .contact-row {
    justify-content: center;
  }

  .contact-chip {
    max-width: 100%;
  }

  .metrics-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
  }

  .section-block {
    padding: 1.45rem 1.2rem;
  }

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

  .role-head {
    flex-direction: column;
    gap: 0.55rem;
  }
}

@media screen and (max-width: 520px) {
  .shell {
    padding: 1rem 0.75rem 2.75rem;
  }

  .topbar-inner {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }

  .brand-text-full {
    display: none;
  }

  .topbar-actions {
    gap: 0.35rem;
  }

  .btn {
    padding: 0.36rem 0.65rem;
    font-size: 0.76rem;
  }

  .portrait-frame {
    width: 120px;
    height: 120px;
  }

  .role-pill {
    font-size: 0.7rem;
    padding: 0.24rem 0.6rem;
  }

  .contact-chip {
    font-size: 0.78rem;
    padding: 0.32rem 0.62rem;
    flex-wrap: wrap;
    justify-content: center;
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .hero-card,
  .section-block {
    animation: none;
  }
  .role-details {
    transition: none;
  }
}

/* ==========================================================================
   Print / Save-as-PDF Executive CV Stylesheet
   ========================================================================== */
@page {
  size: A4;
  margin: 10mm 12mm;
}

@media print {
  body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 8.8pt;
    line-height: 1.36;
  }

  .ambient-canvas,
  .hero-perspective,
  .topbar,
  .view-toggle-group,
  .role-chevron,
  .copy-badge,
  .site-footer {
    display: none !important;
  }

  .shell {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  .hero-card,
  .section-block,
  .role-card,
  .edu-card,
  .skill-card,
  .project-card {
    background: #ffffff !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    animation: none !important;
  }

  .hero-card {
    border: 0;
    border-bottom: 2px solid var(--navy-800);
    border-radius: 0;
    padding: 0 0 8pt;
    margin-bottom: 8pt;
  }

  .hero-card::before {
    display: none;
  }

  .hero-top {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 12pt;
    text-align: left;
  }

  .portrait-frame {
    width: 72px;
    height: 72px;
    padding: 2px;
    box-shadow: none;
  }

  .hero-title {
    font-size: 18pt;
    transform: none !important;
    text-shadow: none !important;
  }

  .hero-subtitle {
    font-size: 9.8pt;
    margin-top: 2pt;
  }

  .role-pill {
    margin-bottom: 2pt;
    padding: 1pt 5pt;
    font-size: 7pt;
  }

  .contact-row {
    margin-top: 4pt;
    gap: 3pt 9pt;
  }

  .contact-chip {
    padding: 0;
    border: 0;
    background: transparent !important;
    font-size: 8pt;
  }

  .metrics-strip {
    margin-top: 7pt;
    padding-top: 6pt;
    grid-template-columns: repeat(4, 1fr);
    gap: 7pt;
  }

  .metric-value {
    font-size: 10pt;
  }

  .metric-label {
    font-size: 7.2pt;
  }

  .profile-lead {
    font-size: 8.8pt;
    line-height: 1.38;
    margin-bottom: 4pt;
  }

  .section-block {
    border: 0;
    border-radius: 0;
    padding: 0;
    margin-bottom: 9pt;
  }

  .section-header {
    margin-bottom: 5pt;
    padding-bottom: 2pt;
    page-break-after: avoid;
    break-after: avoid-page;
  }

  .section-title {
    font-size: 11.5pt;
  }

  .section-title::before {
    width: 5px;
    height: 12px;
  }

  /* Force all role cards open when printing */
  .role-card.is-collapsed .role-details {
    grid-template-rows: 1fr !important;
    opacity: 1 !important;
  }

  .timeline {
    gap: 5pt;
  }

  .role-card {
    padding: 5pt 8pt;
    border: 1px solid #e2e8f0;
    border-left: 3px solid var(--navy-800);
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .role-company {
    font-size: 9.8pt;
  }

  .role-position {
    font-size: 8.8pt;
  }

  .role-summary {
    font-size: 8.1pt;
    margin-top: 1.5pt;
  }

  .role-date {
    font-size: 7.4pt;
    padding: 1pt 5pt;
  }

  .role-bullets {
    margin-top: 3pt;
    font-size: 8.2pt;
  }

  .role-bullets li {
    margin-bottom: 1.5pt;
  }

  .tag-list {
    margin-top: 3pt;
    gap: 2.5pt;
  }

  .tag {
    font-size: 6.7pt;
    padding: 0.8pt 3.5pt;
  }

  .edu-grid,
  .skills-grid,
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 5pt;
  }

  .edu-card,
  .skill-card,
  .project-card {
    padding: 5pt 8pt;
    border: 1px solid #e2e8f0;
    border-left: 3px solid var(--navy-800);
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .edu-school,
  .skill-heading,
  .project-title {
    font-size: 9.4pt;
  }

  .edu-degree {
    font-size: 8.4pt;
  }

  .edu-note,
  .project-desc {
    font-size: 7.9pt;
    margin: 3pt 0;
    line-height: 1.35;
  }
}
