/* =========================================================
   PORTFOLIO — MODERN THEME
   Light/dark mode · responsive · accessible
   Matches index.html + js/main.js (modern version)
   ========================================================= */

/* ---------- 1. Design tokens ---------- */
:root {
  --brand: #0F4761;          /* CV navy */
  --brand-2: #1A8F93;        /* teal accent */
  --brand-3: #2E86C1;
  --bg: #F5F7FA;
  --bg-alt: #EDF1F6;
  --surface: #FFFFFF;
  --surface-2: #F1F4F8;
  --text: #142030;
  --muted: #5A6878;
  --line: #E1E7EE;
  --line-strong: #CCD6E0;
  --heading: #0F4761;
  --link: #0F4761;
  --btn-bg: #0F4761;
  --btn-bg-hover: #0A3347;
  --btn-text: #FFFFFF;
  --accent-soft: rgba(26, 143, 147, .12);
  --accent-text: #12777A;
  --header-bg: rgba(255, 255, 255, .78);
  --shadow-sm: 0 1px 2px rgba(16, 38, 58, .06), 0 2px 8px rgba(16, 38, 58, .05);
  --shadow-md: 0 8px 30px rgba(16, 38, 58, .09);
  --shadow-lg: 0 24px 60px rgba(16, 38, 58, .16);
  --grad: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 55%, var(--brand-3) 100%);

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --header-h: 68px;
  --container: 1160px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --fast: .18s;
  --med: .35s;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand: #4FB3D9;
  --brand-2: #3CC6C9;
  --brand-3: #7AA8FF;
  --bg: #0B1620;
  --bg-alt: #0E1B27;
  --surface: #122230;
  --surface-2: #172A3A;
  --text: #E4ECF3;
  --muted: #98AABB;
  --line: #22374A;
  --line-strong: #2E465B;
  --heading: #EAF2F8;
  --link: #6CC6E4;
  --btn-bg: #3CC6C9;
  --btn-bg-hover: #5CD6D8;
  --btn-text: #06202A;
  --accent-soft: rgba(60, 198, 201, .14);
  --accent-text: #6FDCDE;
  --header-bg: rgba(11, 22, 32, .78);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);

  color-scheme: dark;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--med) var(--ease), color var(--med) var(--ease);
  /* Clip horizontal overflow without creating a scroll container. Otherwise
     locking html scroll makes the sticky header follow body instead. */
  overflow-x: clip;
}

img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
ul { padding-left: 1.2rem; }
h1, h2, h3, h4 { color: var(--heading); line-height: 1.2; letter-spacing: -.015em; }
strong { font-weight: 700; }
[hidden] { display: none !important; }

::selection { background: var(--brand-2); color: #fff; }

:focus-visible {
  outline: 3px solid var(--brand-2);
  outline-offset: 3px;
  border-radius: 6px;
}

.container { width: min(var(--container), 100% - 2.5rem); margin-inline: auto; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 200;
  padding: .7rem 1rem; border-radius: var(--radius-sm);
  background: var(--btn-bg); color: var(--btn-text); font-weight: 700; text-decoration: none;
  transform: translateY(-160%); transition: transform var(--fast) var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* Scroll progress bar */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 120;
  background: var(--grad); transform: scaleX(0); transform-origin: 0 50%;
  pointer-events: none;
}

/* ---------- 3. Buttons, chips, tags ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: .7rem 1.35rem;
  border: 2px solid var(--btn-bg); border-radius: 12px;
  background: var(--btn-bg); color: var(--btn-text);
  font-weight: 700; font-size: .95rem; line-height: 1.2; text-decoration: none; white-space: normal; text-align: center;
  transition: transform var(--fast) var(--ease), background var(--fast), border-color var(--fast),
              color var(--fast), box-shadow var(--fast);
}
.btn:hover { background: var(--btn-bg-hover); border-color: var(--btn-bg-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }

.btn--ghost { background: transparent; color: var(--heading); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface); color: var(--heading); border-color: var(--brand-2); }

.btn--light { background: #fff; color: #0F4761; border-color: #fff; }
.btn--light:hover { background: #EAF6F7; border-color: #EAF6F7; color: #0F4761; }

.btn--outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }
.btn--outline:hover { background: rgba(255, 255, 255, .12); border-color: #fff; color: #fff; }

.btn--sm { min-height: 38px; padding: .45rem .95rem; font-size: .86rem; border-radius: 10px; }

.chip {
  display: inline-flex; align-items: center;
  padding: .28rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: .78rem; font-weight: 500; color: var(--text); line-height: 1.4;
}

.tools { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; }

.tag {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .7rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-text);
  font-family: var(--mono); font-size: .68rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--mono); font-size: .76rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text);
}
.eyebrow::before { content: ""; width: 22px; height: 2px; border-radius: 2px; background: var(--grad); }
.eyebrow--light { color: #BFF1F2; }
.eyebrow--light::before { background: #BFF1F2; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--heading);
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
}
.icon-btn:hover { border-color: var(--brand-2); transform: translateY(-1px); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- 4. Header & navigation ---------- */
.header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--med), box-shadow var(--med), background var(--med);
}
.header.is-scrolled { border-bottom-color: var(--line); box-shadow: var(--shadow-sm); }

.header__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }

.brand {
  font-weight: 800; font-size: 1.3rem; letter-spacing: -.03em;
  color: var(--heading); text-decoration: none;
}
.brand span { color: var(--brand-2); }

.nav { display: flex; align-items: center; gap: .25rem; }
.nav a:not(.btn) {
  position: relative; padding: .5rem .8rem; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: .92rem; text-decoration: none;
  transition: color var(--fast), background var(--fast);
}
.nav a:not(.btn):hover { color: var(--heading); background: var(--surface-2); }
.nav a.active { color: var(--heading); }
.nav a.active::after {
  content: ""; position: absolute; left: .8rem; right: .8rem; bottom: .25rem;
  height: 2px; border-radius: 2px; background: var(--grad);
}
.nav__resume { display: none; }

.header__actions { display: flex; align-items: center; gap: .6rem; }

/* Theme icon swap */
.theme-icon--sun { display: none; }
:root[data-theme="dark"] .theme-icon--sun { display: block; }
:root[data-theme="dark"] .theme-icon--moon { display: none; }

/* Hamburger */
.menu-btn { display: none; position: relative; }
.menu-btn span {
  position: absolute; left: 11px; right: 11px; height: 2px; border-radius: 2px;
  background: currentColor; transition: transform var(--med) var(--ease), top var(--med) var(--ease);
}
.menu-btn span:first-child { top: 16px; }
.menu-btn span:last-child { top: 24px; }
.menu-btn.is-open span:first-child { top: 20px; transform: rotate(45deg); }
.menu-btn.is-open span:last-child { top: 20px; transform: rotate(-45deg); }

/* ---------- 5. Hero ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  padding: clamp(3.5rem, 8vw, 6.5rem) 0 clamp(3rem, 6vw, 4.5rem);
}

.hero__bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(600px 400px at 85% 10%, rgba(26, 143, 147, .18), transparent 70%),
    radial-gradient(520px 380px at 5% 90%, rgba(46, 134, 193, .14), transparent 70%),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 40%, transparent 100%);
  opacity: .9;
}

.hero__grid {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem); align-items: center;
}

.badge {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .4rem .9rem .4rem .7rem; margin-bottom: 1.4rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  font-size: .82rem; font-weight: 600; color: var(--text);
}
.dot { position: relative; width: 9px; height: 9px; border-radius: 50%; background: #22C55E; }
.dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid #22C55E; opacity: 0; animation: ping 2s var(--ease) infinite;
}
@keyframes ping { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.1rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.05;
}
.grad {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero__role { margin-top: 1.1rem; font-size: clamp(1rem, 1.6vw, 1.15rem); font-weight: 600; color: var(--heading); }
.hero__lead { margin-top: .9rem; max-width: 58ch; color: var(--muted); font-size: 1.02rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.hero__button {
  min-height: 52px; padding: .85rem 1.35rem; gap: .85rem;
  border-width: 1px; border-radius: 14px;
  font-size: .92rem; font-weight: 600; line-height: 1.4;
  box-shadow: var(--shadow-sm);
}
.hero__button svg {
  width: 19px; height: 19px; flex-shrink: 0;
  transition: transform var(--fast) var(--ease);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .hero__button--primary:hover svg { transform: translateX(3px); }
}
.hero__social { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.4rem; }

.pill-link {
  padding: .35rem .85rem; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); font-size: .85rem; font-weight: 600; text-decoration: none;
  transition: color var(--fast), border-color var(--fast), background var(--fast);
}
.pill-link:hover { color: var(--heading); border-color: var(--brand-2); background: var(--surface); }

.social-link,
.cta__links .btn.social-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; min-height: 44px; padding: 0; flex: 0 0 44px;
}
.social-link svg { width: 22px; height: 22px; }

.hero__visual { position: relative; justify-self: center; width: min(400px, 100%); }

.photo-frame {
  position: relative; padding: 6px; border-radius: 28px;
  background: var(--grad); box-shadow: var(--shadow-lg);
  transform: rotate(-1.5deg);
}
.photo-frame img, .photo-frame .ph {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
  border-radius: 22px; background: var(--surface-2);
}

.float-card {
  position: absolute; display: grid; gap: .1rem;
  padding: .75rem 1rem; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-md);
  font-size: .76rem; color: var(--muted); line-height: 1.3;
  animation: float 6s ease-in-out infinite;
}
.float-card strong { font-size: 1.05rem; color: var(--heading); }
.float-card--a { left: -2rem; bottom: 12%; }
.float-card--b { right: -1.5rem; top: 10%; animation-delay: -3s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* Stats */
.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem;
  margin-top: clamp(2.5rem, 6vw, 4rem);
}
.stat {
  padding: 1.3rem 1.4rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.stat__value {
  display: block; font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 800; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.stat__label { display: block; margin-top: .2rem; font-size: .84rem; color: var(--muted); line-height: 1.4; }

/* ---------- 6. Sections ---------- */
.section { padding: clamp(4rem, 9vw, 6.5rem) 0; }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.section__head { max-width: 720px; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section__title { margin-top: .7rem; font-size: clamp(1.75rem, 3.6vw, 2.5rem); font-weight: 800; }
.section__sub { margin-top: .8rem; color: var(--muted); font-size: 1.02rem; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(1.25rem, 2.5vw, 1.75rem);
  box-shadow: var(--shadow-sm);
}

/* ---------- 7. About & bento ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; }
.about__bio { font-size: clamp(1.02rem, 1.6vw, 1.15rem); line-height: 1.75; }

.edu h3 { margin-top: .6rem; font-size: 1.1rem; }
.edu__meta { margin-top: .25rem; color: var(--muted); font-size: .9rem; }

.kv { display: grid; gap: .55rem; margin-top: 1.1rem; }
.kv > div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding-bottom: .55rem; border-bottom: 1px dashed var(--line); font-size: .9rem;
}
.kv > div span:first-child { color: var(--muted); }
.kv > div span:last-child { font-weight: 600; text-align: right; }

.bento {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: dense; gap: 1.25rem; margin-top: 1.25rem;
}
.bento__item {
  position: relative; overflow: hidden;
  transition: transform var(--med) var(--ease), border-color var(--med), box-shadow var(--med);
}
.bento__item::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--grad); opacity: 0; transition: opacity var(--med);
}
.bento__item:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.bento__item:hover::before { opacity: 1; }
.bento__item--wide { grid-column: span 2; }
.bento__index { font-family: var(--mono); font-size: .75rem; font-weight: 600; color: var(--accent-text); }
.bento__item h3 { margin: .6rem 0 .5rem; font-size: 1.08rem; }
.bento__item p { color: var(--muted); font-size: .93rem; }

/* ---------- 8. Project filters & cards ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem;
  overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
}
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none; min-height: 44px; padding: .55rem 1.05rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: .88rem; font-weight: 600;
  transition: all var(--fast) var(--ease);
}
.filter:hover { color: var(--heading); border-color: var(--line-strong); }
.filter.active { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-text); }

.projects {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 1.5rem;
}

.project-card { display: flex; }
.project-card__link {
  display: flex; flex-direction: column; width: 100%;
  border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  color: inherit; text-decoration: none;
  transition: transform var(--med) var(--ease), box-shadow var(--med), border-color var(--med);
}
.project-card__link:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }

.project-card__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); }
.project-card__media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(8, 25, 38, .35));
  pointer-events: none;
}
.project-card__img, .project-card__media .ph {
  width: 100%; height: 100%; object-fit: cover; border: 0; border-radius: 0;
  transition: transform .6s var(--ease);
}
.project-card__link:hover .project-card__img { transform: scale(1.05); }

.project-card__body { display: flex; flex-direction: column; flex: 1; padding: 1.4rem 1.5rem 1.5rem; }
.project-card__title { margin-top: .8rem; font-size: 1.12rem; font-weight: 700; line-height: 1.35; }
.project-card__meta { margin-top: .35rem; color: var(--muted); font-size: .82rem; }
.project-card__summary { margin-top: .75rem; color: var(--text); font-size: .92rem; opacity: .9; }

.project-card__kpis {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem;
  list-style: none; padding: 0; margin-top: 1.1rem;
}
.project-card__kpis li { padding: .65rem .8rem; border-radius: 12px; background: var(--surface-2); border-left: 3px solid var(--brand-2); }
.project-card__kpis strong { display: block; font-size: 1rem; color: var(--heading); line-height: 1.25; }
.project-card__kpis span { font-size: .74rem; color: var(--muted); }

.project-card__more {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-top: auto; padding-top: 1.2rem;
  color: var(--link); font-weight: 700; font-size: .9rem;
}
.project-card__more span { transition: transform var(--fast) var(--ease); }
.project-card__link:hover .project-card__more span { transform: translateX(4px); }

/* ---------- 9. Timeline ---------- */
.timeline { position: relative; display: grid; gap: 1.25rem; padding-left: 2.2rem; }
.timeline::before {
  content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(180deg, var(--brand-2), var(--line) 85%);
  border-radius: 2px;
}
.tl-item { position: relative; }
.tl-dot {
  position: absolute; left: calc(-2.2rem + 2px); top: 1.6rem;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--brand-2);
  box-shadow: 0 0 0 5px var(--accent-soft);
}
.tl-card { transition: transform var(--med) var(--ease), box-shadow var(--med); }
.tl-card:hover { transform: translateX(4px); box-shadow: var(--shadow-md); }
.tl-period { font-family: var(--mono); font-size: .76rem; font-weight: 600; color: var(--accent-text); }
.tl-card h3 { margin-top: .35rem; font-size: 1.12rem; }
.tl-org { margin-top: .2rem; color: var(--muted); font-size: .88rem; }
.tl-card ul { margin-top: .8rem; display: grid; gap: .35rem; font-size: .93rem; }
.tl-card li::marker { color: var(--brand-2); }
.tl-link {
  display: inline-flex; gap: .35rem; margin-top: 1rem;
  font-weight: 700; font-size: .88rem; text-decoration: none;
}
.tl-link:hover { text-decoration: underline; }

/* ---------- 10. Skills ---------- */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1.25rem; }
.skill { display: flex; flex-direction: column; }
.skill h3 { font-size: 1.05rem; }
.skill .tools { margin-top: .9rem; }
.proof {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  margin-top: auto; padding-top: 1.1rem;
  border-top: 1px dashed var(--line); font-size: .8rem; color: var(--muted);
}
.skill .tools + .proof { margin-top: 1.1rem; }
.proof > span { margin-right: .2rem; font-weight: 600; }
.proof__link {
  padding: .2rem .65rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-text);
  font-weight: 600; text-decoration: none; transition: background var(--fast);
}
.proof__link:hover { background: var(--brand-2); color: #fff; }

/* ---------- 11. Leadership ---------- */
.leaders { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1.25rem; }
.leader { display: flex; flex-direction: column; }
.leader__media { margin: -.25rem -.25rem 1.1rem; }
.leader__media img, .leader__media .ph {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px;
}
.leader__period { font-family: var(--mono); font-size: .74rem; font-weight: 600; color: var(--accent-text); }
.leader h3 { margin-top: .35rem; font-size: 1.02rem; line-height: 1.35; }
.leader__org { margin-top: .25rem; color: var(--muted); font-size: .84rem; }
.leader__text { margin-top: .7rem; font-size: .92rem; }

/* ---------- 12. Contact CTA & footer ---------- */
.cta {
  position: relative; overflow: hidden; isolation: isolate;
  padding: clamp(2.5rem, 6vw, 4.5rem); border-radius: 28px;
  background: linear-gradient(135deg, #0F4761 0%, #125E73 50%, #1A8F93 100%);
  color: #E8F6F7; text-align: center; box-shadow: var(--shadow-lg);
}
.cta::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(400px 260px at 15% 0%, rgba(255, 255, 255, .16), transparent 70%),
    radial-gradient(380px 260px at 90% 100%, rgba(122, 168, 255, .25), transparent 70%);
}
.cta h2 { margin: .9rem auto 0; max-width: 20ch; color: #fff; font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 800; }
.cta p { margin: 1rem auto 0; max-width: 56ch; opacity: .9; }
.cta__links { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 2rem; }

.footer { padding: 2rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; }
.footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }

.back-to-top {
  position: fixed;
  right: max(1.25rem, env(safe-area-inset-right));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  z-index: 90;
  width: 36px;
  height: 36px;
  background: transparent;
  color: #000;
  border: 1px solid currentColor;
  border-radius: 50%;
  box-shadow: none;
  transition: border-color var(--fast), color var(--fast), transform var(--fast);
}
.back-to-top:hover {
  background: transparent;
  border-color: currentColor;
}
:root[data-theme="dark"] .back-to-top { color: #fff; }
.back-to-top svg { width: 16px; height: 16px; }
.menu-open .back-to-top { display: none; }
.resume-download {
  min-height: 46px; padding: .7rem 1rem; gap: .5rem;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); color: var(--heading);
  font-size: .92rem; font-weight: 600; line-height: 1.4;
  white-space: nowrap; text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.resume-download:hover { background: var(--surface-2); border-color: var(--brand-2); }
.resume-download svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav .resume-download { flex: 0 0 auto; }
@media print { .back-to-top { display: none !important; } }

/* ---------- 13. Placeholder for missing media ---------- */
.ph {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  width: 100%; min-height: 140px; aspect-ratio: 16 / 10; padding: 1rem;
  border: 2px dashed var(--line-strong); border-radius: 12px;
  background:
    repeating-linear-gradient(45deg, transparent 0 12px, var(--accent-soft) 12px 13px),
    var(--surface-2);
  color: var(--muted); text-align: center; font-size: .82rem; line-height: 1.35;
}
.ph strong { color: var(--heading); font-size: .86rem; }
.ph code {
  max-width: 100%; padding: .15rem .45rem; border-radius: 6px;
  background: var(--surface); font-family: var(--mono); font-size: .68rem; word-break: break-all;
}

/* ---------- 14. Case-study modal ---------- */
.modal {
  width: min(1100px, calc(100vw - 2rem));
  max-width: none; max-height: min(90vh, 920px); max-height: min(90dvh, 920px);
  padding: 0; margin: auto;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal[open] { display: flex; flex-direction: column; animation: modal-in var(--med) var(--ease); }
.modal::backdrop {
  background: rgba(5, 15, 24, .6);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fade-in var(--med) var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal__bar {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1rem .8rem 1.5rem; border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.modal__body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: clamp(1.25rem, 3.5vw, 2.5rem);
}

.cs__head { max-width: 820px; }
.cs__head h2 { margin-top: .8rem; font-size: clamp(1.45rem, 3vw, 2.1rem); font-weight: 800; }
.cs__meta { margin-top: .5rem; color: var(--muted); font-size: .9rem; }
.cs__summary { margin-top: 1rem; font-size: 1.04rem; }

.cs__metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: .8rem; margin-top: 1.75rem;
}
.metric {
  padding: .95rem 1.1rem; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 4px solid var(--brand-2);
}
.metric strong { display: block; font-size: 1.1rem; color: var(--heading); line-height: 1.3; font-variant-numeric: tabular-nums; }
.metric span { display: block; margin-top: .15rem; font-size: .78rem; color: var(--muted); }

.cs__grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(1.5rem, 4vw, 2.75rem); margin-top: 2rem; align-items: start;
}
.cs__section + .cs__section { margin-top: 1.5rem; }
.cs__section h3 {
  font-family: var(--mono); font-size: .78rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text);
  margin-bottom: .55rem;
}
.cs__section p, .cs__section li { font-size: .95rem; }
.cs__section ul { display: grid; gap: .4rem; }
.cs__section li::marker { color: var(--brand-2); }

.notice {
  margin-top: 1.4rem; padding: .8rem 1rem; border-radius: 12px;
  background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .35);
  color: var(--text); font-size: .84rem;
}
.cs__links { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }

.cs__pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
}
.cs__pager-link {
  display: grid; gap: .2rem; padding: 1rem 1.2rem; border-radius: 14px;
  border: 1px solid var(--line); text-decoration: none; color: inherit;
  transition: border-color var(--fast), background var(--fast);
}
.cs__pager-link:hover { border-color: var(--brand-2); background: var(--surface-2); }
.cs__pager-link span { font-size: .78rem; color: var(--muted); }
.cs__pager-link strong { color: var(--heading); }
.cs__pager-link--next { text-align: right; }

/* Gallery (inside modal) */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.gallery__item { min-width: 0; }
.gallery__item--wide { grid-column: 1 / -1; }
.gallery__item img, .gallery__item .ph, .gallery__item video {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
}
.gallery__item video { object-fit: contain; background: #000; }
.gallery__item figcaption { margin-top: .45rem; font-size: .78rem; color: var(--muted); line-height: 1.4; }

.gallery__zoom {
  display: block; width: 100%; padding: 0; border: 0; background: none;
  border-radius: 12px; overflow: hidden; cursor: zoom-in;
}
.gallery__zoom img { transition: transform .5s var(--ease), filter var(--fast); }
.gallery__zoom:hover img { transform: scale(1.03); filter: brightness(1.05); }
.gallery__zoom:has(.ph) { cursor: default; }

/* ---------- 15. Lightbox ---------- */
.lightbox {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgba(4, 12, 18, .94); color: #fff;
}
.lightbox[open] { display: grid; place-items: center; animation: fade-in var(--fast) var(--ease); }
.lightbox::backdrop { background: transparent; }

.lightbox__fig {
  display: grid; place-items: center; gap: .8rem;
  width: 100%; height: 100%; padding: 4.5rem 4.5rem 3rem;
}
.lightbox__fig img {
  max-width: 100%; max-height: calc(100dvh - 9rem);
  object-fit: contain; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  touch-action: pan-y pinch-zoom;
}
.lightbox__fig figcaption { max-width: 70ch; text-align: center; font-size: .9rem; opacity: .85; }

.lb-btn {
  position: fixed; z-index: 2; display: grid; place-items: center;
  width: 48px; height: 48px; padding: 0; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #fff;
  font-size: 1.6rem; line-height: 1;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: background var(--fast), transform var(--fast);
}
.lb-btn:hover { background: rgba(255, 255, 255, .2); }
.lb-close { top: 1rem; right: 1rem; font-size: 1.1rem; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lb-prev:hover { transform: translateY(-50%) translateX(-2px); }
.lb-next:hover { transform: translateY(-50%) translateX(2px); }
.lb-count {
  position: fixed; top: 1.4rem; left: 1.4rem; z-index: 2;
  font-family: var(--mono); font-size: .8rem; opacity: .8;
}

/* ---------- 16. Reveal animation (only when JS is active) ---------- */
.js .reveal {
  opacity: 0; transform: translateY(22px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: var(--d, 0ms);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- 17. Responsive ---------- */
@media (max-width: 1080px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .float-card--a { left: -.75rem; }
  .float-card--b { right: -.75rem; }
}

@media (max-width: 1080px) {
  :root { --header-h: 62px; }

  /* Keep the fixed menu relative to the viewport on mobile Safari. */
  .header { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
  .menu-btn { display: inline-grid; }
  .header__resume { display: none; }
  .nav__resume { display: inline-flex; margin-top: 1rem; }

  .nav {
    position: fixed; inset: var(--header-h) 0 auto 0; z-index: 99;
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    flex-direction: column; align-items: stretch; gap: .25rem;
    padding: 1.5rem 1.25rem max(2rem, env(safe-area-inset-bottom)); overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity var(--med) var(--ease), transform var(--med) var(--ease), visibility 0s linear var(--med);
  }
  .nav.open {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity var(--med) var(--ease), transform var(--med) var(--ease), visibility 0s;
  }
  .nav a:not(.btn) { padding: .95rem 1rem; font-size: 1.15rem; color: var(--heading); border-bottom: 1px solid var(--line); border-radius: 0; }
  .nav a.active::after { display: none; }
  .nav a.active { color: var(--accent-text); }
  .nav > a { flex-shrink: 0; }

  .hero__grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 2rem; }
  .hero__visual { width: min(300px, 100%); }
  .float-card { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

}

@media (max-width: 760px) {
  .hero__grid { grid-template-columns: 1fr; gap: 2rem; }
  .hero__visual { width: min(220px, 60%); justify-self: center; }
  .hero__content { max-width: 620px; }
  .hero h1 { font-size: clamp(2rem, 7vw, 3.2rem); }
  .about { grid-template-columns: 1fr; }
  .cs__grid { grid-template-columns: 1fr; }

  /* Modal becomes a bottom sheet */
  .modal {
    width: 100%; max-width: 100%;
    max-height: 92vh; max-height: 92dvh;
    margin: auto 0 0; border-radius: 22px 22px 0 0; border-bottom: 0;
  }
  .modal[open] { animation: sheet-up var(--med) var(--ease); }
  .modal__bar { position: relative; padding-top: 1.1rem; }
  .modal__bar::before {
    content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 42px; height: 4px; border-radius: 4px; background: var(--line-strong);
  }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }

@media (max-width: 640px) {
  .container { width: min(var(--container), 100% - 2rem); }
  .bento { grid-template-columns: 1fr; }
  .bento__item--wide { grid-column: auto; }
  .hero { padding-block: 2.5rem; }
  .section { padding-block: 3rem; }
  .section__head { margin-bottom: 1.5rem; }
  .header__inner { gap: .75rem; }
  .hero__cta > * { flex: 1 1 auto; }
  .hero__cta { margin-top: 1.5rem; }
  .projects, .skills, .leaders { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .project-card__body { padding: 1.25rem; }
  .cta { padding: 2rem 1.25rem; border-radius: 20px; }
  .modal__body { padding: 1.25rem 1rem max(1.25rem, env(safe-area-inset-bottom)); }
  .modal__bar { padding-inline: 1rem; gap: .75rem; }
  .modal__bar .icon-btn { flex-shrink: 0; }
  .stat { padding: 1rem; }
  .gallery { grid-template-columns: 1fr; }
  .cs__pager { grid-template-columns: 1fr; }
  .cs__pager-link--next { text-align: left; }
  .timeline { padding-left: 1.8rem; }
  .tl-dot { left: calc(-1.8rem + 2px); }
  .footer__inner { flex-direction: column; text-align: center; }
  .lightbox__fig { padding: 4rem .75rem 5rem; }
  .lb-prev, .lb-next { top: auto; bottom: 1rem; transform: none; }
  .lb-prev { left: calc(50% - 60px); }
  .lb-next { right: calc(50% - 60px); }
  .lb-prev:hover, .lb-next:hover { transform: none; }
}

/* ---------- 18. Accessibility & print ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

@media print {
  .header, .progress, .filters, .hero__bg, .float-card, .modal, .lightbox, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  .section--alt { background: none; }
  .card, .project-card__link, .stat { box-shadow: none; break-inside: avoid; }
  .js .reveal { opacity: 1; transform: none; }
}
/* Layout resilience and media-free presentation. */
.brand, .header__actions { flex-shrink: 0; }
.header__actions { position: relative; z-index: 101; }
.brand { position: relative; z-index: 101; }
.nav a, .header__resume { white-space: nowrap; }
.hero__content, .card, .cs__text, .cta__links > *, .project-card, .stat { min-width: 0; }
.hero__content, .card, .project-card__body, .cs__head, .cs__text, .cs__pager-link { overflow-wrap: anywhere; }
.chip, .tag { max-width: 100%; overflow-wrap: anywhere; }
.stat__value { overflow-wrap: anywhere; }
.hero__role { max-width: 55ch; }
.cta__links a, .project-card__kpis strong, .metric strong { overflow-wrap: anywhere; }
.cs__grid--text { grid-template-columns: minmax(0, 1fr); }
.profile-monogram {
  width: 100%; aspect-ratio: 4 / 5; border-radius: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; background: var(--grad); color: #fff; text-align: center;
}
.profile-monogram > span:first-child { font-size: clamp(4rem, 12vw, 8rem); font-weight: 800; letter-spacing: -.06em; line-height: 1; }
.profile-monogram > span:last-child { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; }
.gallery__zoom:disabled { cursor: default; }
@media (max-width: 1080px) {
  html:not(.js) .header { height: auto; }
  html:not(.js) .header__inner { flex-wrap: wrap; padding-block: .75rem; }
  html:not(.js) .nav { position: static; height: auto; width: 100%; opacity: 1; visibility: visible; transform: none; padding: 0; }
  html:not(.js) .header__actions { display: none; }
}
@media (max-width: 400px) {
  .stats { grid-template-columns: 1fr; }
  .kv > div { flex-direction: column; align-items: flex-start; }
  .kv > div span:last-child { text-align: left; }
  .cta__links .btn:not(.social-link) { width: 100%; padding-inline: .75rem; }
  .hero__cta > * { flex-basis: 100%; }
  .project-card__kpis { grid-template-columns: 1fr; }
}
