/* Base */
:root {
  --bg: #0f1221;
  --bg-soft: #151938;
  --card: #171c3b;
  --text: #e8ebff;
  --muted: #a9b0d3;
  --brand: #7aa2ff;
  --accent: #42d392;
  --border: #252a51;
  --shadow: rgba(0, 0, 0, 0.35);
  --header-h: 96px;
  --desc-color: #cfd6ff;
  --bullets-color: #d7dcff;
  --badge-bg: #121632;
  --badge-color: #e8ebff;
}

.theme-light {
  --bg: #f7f8ff;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --text: #111225;
  --muted: #5a617b;
  --brand: #3a63ff;
  --accent: #1fa471;
  --border: #e5e8ff;
  --shadow: rgba(0, 0, 0, 0.08);
  --desc-color: #3b4364;
  --bullets-color: #3b4364;
  --badge-bg: rgba(58, 99, 255, 0.12);
  --badge-color: #2a3370;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, Segoe UI, Roboto, Helvetica, Arial, Apple Color Emoji, Segoe UI Emoji;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.hero,
.section,
.tabs-section,
.contact-bar {
  scroll-margin-top: calc(var(--header-h) + 0px);
}

.container {
  width: min(1100px, 92%);
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: linear-gradient(180deg, rgba(15, 18, 33, 0.85), rgba(15, 18, 33, 0.6));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  isolation: isolate;
}

.site-header.is-shrunk .nav-wrap {
  padding: 12px 0;
}

.theme-light .site-header {
  background: linear-gradient(180deg, rgba(247, 248, 255, 0.85), rgba(247, 248, 255, 0.6));
}

.nav-wrap {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
}

.nav-wrap > * {
  min-width: 0;
}

.legacy-nav .primary-nav {
  justify-self: flex-start;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-self: flex-end;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.legacy-brand {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  min-width: 170px;
  padding: 0px 18px;
}

.legacy-brand .brand-img,
.legacy-brand .brand-txt {
  position: absolute;
  left: 50%;
  top: 50%;
}

.legacy-brand .brand-img {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  object-fit: cover;
  transition: transform 0.35s ease, opacity 0.35s ease;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.theme-light .legacy-brand .brand-img {
  border-color: rgba(16, 20, 43, 0.2);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.legacy-brand .brand-txt {
  width: 100%;
  max-width: 240px;
  text-align: center;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  opacity: 0;
  transform: translate(-50%, -50%) translateY(8px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

.legacy-brand .brand-title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
}

.legacy-brand .brand-subtitle {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.78;
}

.site-header.is-shrunk .legacy-brand {
  padding-block: 18px;
}

.site-header.is-shrunk .legacy-brand .brand-img {
  opacity: 0;
  transform: translate(-50%, -50%) translateY(-18px) scale(0.85);
  visibility: hidden;
}

.site-header.is-shrunk .legacy-brand .brand-txt {
  opacity: 1;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.primary-nav a {
  color: var(--muted);
  text-decoration: none;
  position: relative;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.4px;
  padding-bottom: 4px;
  transition: color 0.2s ease;
}

.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.primary-nav a:hover,
.primary-nav a:focus-visible {
  color: var(--text);
}

.primary-nav a:hover::after,
.primary-nav a:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.nav-toggle-icon {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  border-color: var(--brand);
}

.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  transform-origin: center;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle .nav-toggle-bar:nth-child(1) {
  transform-origin: center;
}

.nav-toggle .nav-toggle-bar:nth-child(3) {
  transform-origin: center;
}

body.menu-open .nav-toggle .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.menu-open .nav-toggle .nav-toggle-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

body.menu-open .nav-toggle .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(6, 7, 15, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 9997;
}

body.menu-open {
  overflow: hidden;
}

body.menu-open .menu-overlay {
  opacity: 1;
  pointer-events: auto;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--muted);
  cursor: pointer;
}

.icon-toggle:hover {
  color: var(--text);
  border-color: #2a3169;
}

.icon-toggle[aria-pressed="true"] {
  color: var(--text);
  border-color: var(--brand);
}

.icon-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .primary-nav {
    gap: 20px;
  }
}

@media (max-width: 768px) {
  :root {
    --header-h: 72px;
  }

  header {
    min-height: 50px;
  } 

  .nav-wrap {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 7px 0;
  }

  .legacy-brand {
    /* grid-column: 1 / -1; */
    order: 0;
    min-width: auto;
    padding: 0;
  } 

  .nav-actions {
    position: absolute;
    gap: 8px;
    justify-self: end;
    top: 50%;
    right: 16px;
    transform: translate(0%, -50%);
  }

  .header-actions {
    gap: 6px;
  }

  .primary-nav {
    position: fixed;
    top: var(--header-h);
    right: 0;
    bottom: 0;
    width: min(280px, 85vw);
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    background: var(--bg);
    border-left: 1px solid var(--border);
    box-shadow: -16px 0 40px var(--shadow);
    padding: 24px 20px 32px;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    z-index: 9998;
    overflow-y: auto;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
  }

  body.menu-open .primary-nav {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    min-height: fit-content;
  }

  .nav-toggle {
    display: inline-flex;
    width: 36px;
    height: 36px;
  }

  .nav-toggle-bar {
    width: 20px;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  body.menu-open .nav-toggle .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
    transform-origin: center;
  }

  body.menu-open .nav-toggle .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
    transform-origin: center;
  }

  .primary-nav a {
    display: flex;
    width: 100%;
    font-size: 15px;
    letter-spacing: 0.4px;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
  }

  .theme-light .primary-nav a {
    border-color: var(--border);
    background: var(--card);
  }

  .primary-nav a::after {
    display: none;
  }

  .primary-nav a:hover,
  .primary-nav a:focus-visible {
    background: rgba(122, 162, 255, 0.14);
    color: var(--text);
  }
}

/* Legacy hero header (restored) */
.legacy-header {
  position: relative;
  padding: 3rem 0;
  min-height: 520px;
  height: min(70vh, 640px);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  background-image: linear-gradient(180deg, rgba(10, 12, 25, 0.9), rgba(10, 12, 25, 0.65)),
    url('../imgs/header.jpg');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.legacy-header__container {
  height: 100%;
  position: relative;
}

.legacy-header .header-content {
  position: absolute;
  top: 55%;
  left: 0;
  transform: translateY(-50%);
  max-width: min(820px, 92%);
}

@media (max-width: 768px) {
  .legacy-header {
    padding: 2rem 0 4.5rem;
    min-height: auto;
    height: auto;
    background-attachment: scroll;
  }

  .legacy-header .header-content {
    position: relative;
    top: auto;
    transform: none;
    text-align: center;
    max-width: 100%;
  }

  .legacy-header .header-title {
    font-size: clamp(2.2rem, 10vw, 3.5rem);
  }

  .legacy-header .header-subtitle {
    font-size: clamp(0.85rem, 2.5vw, 1.1rem);
    letter-spacing: 0.25rem;
  }

  .legacy-header .header-mono {
    font-size: clamp(0.9rem, 3vw, 1.3rem);
    letter-spacing: 0.15rem;
  } 

  .legacy-header .header-meta {
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
    font-size: 0.8rem;
  }

  .legacy-header .header-cta {
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.75rem;
    margin-top: 1.75rem;
  }

  .header-cta__btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }
}

.theme-light .legacy-header {
  color: #0f1326;
  border-bottom-color: rgba(15, 19, 38, 0.08);
  background-image: linear-gradient(180deg, rgba(247, 248, 255, 0.92), rgba(247, 248, 255, 0.78)),
    url('../imgs/header.jpg');
  background-attachment: scroll;
}

.legacy-header .header-subtitle {
  margin: 0 0 0.75rem;
  font-size: clamp(1rem, 2vw, 1.5rem);
  font-weight: 600;
  letter-spacing: 0.4rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
}

.theme-light .legacy-header .header-subtitle {
  color: rgba(15, 19, 38, 0.7);
}

.legacy-header .header-title {
  margin: 0 0 0.25rem;
  font-size: clamp(2.75rem, 8vw, 6rem);
  font-weight: 700;
  line-height: 1.1;
  text-shadow: 0 12px 45px rgba(0, 0, 0, 0.45);
}

.legacy-header .header-mono {
  margin: 0 0 1.5rem;
  font-size: clamp(1rem, 3.5vw, 2.5rem);
  letter-spacing: 0.3rem;
  text-transform: uppercase;
  white-space: pre-line;
  color: rgba(255, 255, 255, 0.85);
}

.theme-light .legacy-header .header-mono {
  color: rgba(15, 19, 38, 0.8);
}  

.legacy-header .header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
}

.legacy-header .header-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.legacy-header .header-meta svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.theme-light .legacy-header .header-meta {
  color: rgba(15, 19, 38, 0.7);
}

.legacy-header .header-cta {
  margin-top: 2.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-cta__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.95rem 2rem;
  border-radius: 999px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.85);
  color: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  background: var(--card);
}

.header-cta__btn:hover {
  transform: translateY(-2px);
  opacity: 0.95;
}

.header-cta__btn--primary {
  color: var(--brand);
  border-color: var(--brand);
}

.header-cta__btn--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.75);
}

.theme-light .header-cta__btn {
  color: #10142b;
  border-color: rgba(16, 20, 43, 0.2);
  box-shadow: 0 10px 24px rgba(16, 20, 43, 0.12);
}

.theme-light .header-cta__btn--primary {
  color: var(--brand);
  border-color: var(--brand);
}

.theme-light .header-cta__btn--ghost {
  background: transparent;
}


/* Sections */
.section {
  padding: 30px 0;
}

.section h3 {
  margin: 0 0 16px;
  font-size: 22px;
}

/* Highlights two-column layout */
.highlights {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  align-items: start;
}

.highlights .skills-col,
.highlights .quals-col {
  min-width: 0;
}

@media (max-width: 900px) {
  .highlights {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.card {
  background: radial-gradient(120% 120% at -10% -10%, rgba(122, 162, 255, 0.08), transparent), var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px var(--shadow);
  border-color: #2a3169;
}

.card .media {
  position: relative;
  padding-top: 56%;
  background: #0c0f1f;
}

.card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card .body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card.expanded .body {
  align-self: stretch;
  height: 100%;
}

.card .title {
  font-weight: 600;
}

.card .subtitle {
  color: var(--muted);
  font-size: 14px;
}

.card .desc {
  color: var(--desc-color);
  font-size: 14px;
}

.card .card-summary {
  margin: 12px 0 0;
  color: var(--desc-color);
  font-size: 14px;
}

.card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.card.expanded .card-tags {
  display: none;
}

.card-media-inline {
  float: right;
  display: inline-block;
  width: auto;
  max-width: min(45%, 320px);
  max-height: 220px;
  min-height: fit-content;
  margin: 10px 20px 10px 20px;
}

.card-media-inline .media {
  position: static;
  padding-top: 0;
  background: none;
  display: inline-block;
  max-width: 100%;
  max-height: 220px;
  min-height: fit-content;
}

.card-media-inline .media img {
  display: block;
  position: static;
  width: auto; 
  max-width: 100%;
  max-height: 400px; 
  object-fit: contain;
  border-radius: 10px;
}

/* Improve logo visibility on darker/blue backgrounds */
.card-media-inline .media.is-logo {
  background: transparent;
  border: 1px solid transparent;
  /* padding: 6px 8px; */
  border-radius: 10px;
  max-height: 110px;
  max-width: 110px;
}

.theme-light .card-media-inline .media.is-logo {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
}

/* Generalized layout so all cards behave like experience cards */
.card.collapsed .card-media-inline {
  float: right;
  max-width: clamp(5px, 35%, 220px);
}

.card.expanded .card-details.has-media {
  display: block;
  position: relative;
}

.card.expanded .card-details.has-media::after {
  content: '';
  display: table;
  clear: both;
}

.card.expanded .card-details.has-media > ul {
  margin-top: 0;
}

.card.expanded .card-details.has-media .links {
  clear: both;
  margin-top: 16px;
}

@media (max-width: 720px) {
  .card-media-inline {
    float: none;
    display: block;
    width: 100%;
    max-width: none;
    margin: 0 0 16px 0;
  }

  .card-media-inline .media {
    display: block;
  }

  .card-media-inline .media img {
    width: 100%;
    max-width: 100%;
  }

  .experience-card.expanded .card-details.has-media .links {
    clear: none;
  }
}



.card .card-details {
  display: none;
  margin-top: 12px;
}

.card .card-details > * + * {
  margin-top: 12px;
}

.card .card-details .links {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card.expanded .card-details {
  display: block;
}

.experience-card.expanded .card-details {
  display: block;
}

.experience-card .card-details {
  gap: 16px;
}

/* .card.expanded .card-summary {
  display: none;
} */

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}
.lightbox.open { display: flex; }
.lightbox-inner {
  max-width: min(95vw, 1400px);
  max-height: 90vh;
}
.lightbox-inner img {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  box-shadow: 0 12px 36px rgba(0,0,0,0.6);
  border-radius: 10px;
}


.badge {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 28px;
  border: 1px solid var(--border);
  color: var(--badge-color);
  font-size: 12px;
  margin-right: 6px;
  margin-bottom: 6px;
  background: var(--badge-bg);
}

.links a {
  color: var(--brand);
  text-decoration: none;
  margin-right: 10px;
  font-size: 14px;
}

.links a:hover {
  text-decoration: underline;
}

/* Skills Masonry (Pinterest-style) */
.skills {
  --skills-min-width: 250px;
  --skills-max-width: 380px;
  --skills-row-height: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--skills-min-width), 1fr));
  grid-auto-rows: var(--skills-row-height);
  grid-auto-flow: dense;   /* pack tightly */
  gap: 16px;
  align-content: start;
}

.skills-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  break-inside: avoid; /* not strictly needed in Grid */
} 


.skills-group h4 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
}

.skills-group h4 .ico {
  display: inline-flex;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  color: var(--brand);
}

.skills-group .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}



/* Bullets */
.bullets {
  margin: 0;
  padding-left: 18px;
  color: var(--bullets-color);
}

.bullets li {
  margin: 8px 0;
}

/* Pretty qualifications */
.bullets.pretty {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}

.bullets.pretty li {
  list-style: none;
  margin: 0;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* Contact bar */
.contact-bar {
  padding: 14px 0 0;
}

.contact-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.contact-link {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  text-decoration: none;
  background: var(--bg-soft);
}

.contact-link:hover {
  color: var(--text);
  border-color: #2a3169;
}

.contact-loc {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  padding: 6px 0;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 0;
  color: var(--muted);
}

.site-footer .container {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.site-footer a {
  color: var(--brand);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

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

/* Responsive */
@media (max-width: 640px) {
  .about {
    grid-template-columns: 1fr;
  }

  .hero-content {
    grid-template-columns: 1fr;
  }

  .avatar {
    width: 84px;
    height: 84px;
  }
}

/* Detail toggle */
.toggle-more {
  display: inline-flex;
  margin-top: 12px;
  padding: 6px 12px;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
}

.toggle-more:hover {
  color: var(--text);
  border-color: #2a3169;
}

.card .toggle-more {
  margin-top: 16px;
  align-self: flex-start;
}
/* Clickable image affordance */
.clickable-image { cursor: zoom-in; }
/* Tabs */
.tabs-section {
  padding: 26px 0 34px;
}

.tabs {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--header-h);
  background: linear-gradient(180deg, rgba(15, 18, 33, 0.9), rgba(15, 18, 33, 0.7));
  backdrop-filter: blur(8px);
  z-index: 10;
  margin-top: 0;
}

.theme-light .tabs {
  background: linear-gradient(180deg, rgba(247, 248, 255, 0.95), rgba(247, 248, 255, 0.8));
}

.tabs [role="tab"] {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-weight: 600;
}

.tabs [role="tab"][aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--brand);
}

.panel {
  padding: 16px 0;
}

.panel-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.panel-toolbar input[type="search"] {
  flex: 1;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
}

.panel-toolbar .btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.panel-toolbar .btn:hover {
  color: var(--text);
  border-color: #2a3169;
}

/* Timeline */
.timeline {
  position: relative;
  display: grid;
  gap: 16px;
  margin-left: 6px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 26px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, rgba(122, 162, 255, 0.35), rgba(66, 211, 146, 0.25));
}

.timeline::after {
  content: "";
  position: absolute;
  left: 20px;
  width: 14px;
  bottom: -2px;
  height: 2px;
  background: rgba(66, 211, 146, 0.25);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
}

.timeline-item .dot {
  position: relative;
  top: 6px;
  left: 21px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--card);
  box-shadow: 0 0 0 4px rgba(122, 162, 255, 0.18);
  transition: transform .15s ease, box-shadow .2s ease;
}

.timeline-item:hover .dot {
  transform: scale(1.2);
  box-shadow: 0 0 0 6px rgba(122, 162, 255, 0.22);
}

.timeline-item .dot::after {
  content: attr(data-date);
  position: absolute;
  left: 20px;
  top: -6px;
  transform: translateY(-100%);
  white-space: nowrap;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  box-shadow: 0 6px 18px var(--shadow);
  z-index: 2;
}

.timeline-item:hover .dot::after,
.timeline-item .dot:focus-visible::after {
  opacity: 1;
  transform: translateY(-110%);
}

.timeline-item .dot::before {
  content: "";
  position: absolute;
  left: 10px;
  top: -10px;
  width: 10px;
  height: 10px;
  transform: translateY(-100%) rotate(45deg);
  background: var(--bg-soft);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 2;
}

.timeline-item:hover .dot::before,
.timeline-item .dot:focus-visible::before {
  opacity: 1;
}

.timeline-item .card {
  margin: 0;
}

@media (max-width: 768px) {
  .timeline {
    margin-left: 0;
  }

  .timeline::before,
  .timeline::after {
    display: none;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .timeline-item .dot {
    display: none;
  }
}

/* Expanded card layout */
.card.expanded.has-media {
  display: grid;
  grid-template-columns: minmax(220px, 32%) 1fr;
  gap: 20px;
}

.card.expanded.has-media .media {
  position: relative;
  padding-top: 0;
  height: 100%;
  min-height: 200px;
}

.card.expanded.has-media img {
  position: static;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card.expanded .body {
  align-self: stretch;
}

@media (max-width: 1024px) {
  .card.expanded.has-media {
    grid-template-columns: minmax(200px, 42%) 1fr;
  }
}

@media (max-width: 768px) {
  .card.expanded.has-media {
    grid-template-columns: 1fr;
  }

  .card.expanded.has-media .media {
    padding-top: 56%;
    min-height: 0;
  }
}



/* Additional mobile fixes */
@media (max-width: 768px) {
  .tabs {
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tabs [role="tab"] {
    padding: 10px 12px;
    font-size: 14px;
    white-space: nowrap;
  }

  .panel-toolbar {
    flex-wrap: wrap;
  }

  .panel-toolbar input[type="search"] {
    min-width: 0;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .card .body {
    padding: 12px;
  }

  .section {
    padding: 20px 0;
  }

  .section h3 {
    font-size: 20px;
  }

  .highlights {
    gap: 24px;
  }

  .skills {
    --skills-min-width: 100%;
  }

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

  .menu-overlay {
    top: var(--header-h);
  }
}

@media (max-width: 480px) {
  .legacy-header .header-cta {
    flex-direction: row;
    gap: 0.5rem;
  }

  .header-cta__btn {
    padding: 0.65rem 1rem;
    font-size: 0.8rem;
  }

  .contact-link {
    padding: 5px 8px;
    font-size: 13px;
  }

  .contact-link svg {
    width: 16px;
    height: 16px;
  }

  .legacy-brand {
    justify-content: left;
  }

  .legacy-brand .brand-img {
    width: 98px;
    height: 98px;
    border-width: 2px; 
  }
}


@media (max-width: 340px) {
  .legacy-brand .brand-img {
    width: 48px;
    height: 48px; 
    position: static;
    transform: none;
  }
}

/* Print */
@media print {

  .site-header,
  .tabs,
  .panel-toolbar,
  .site-footer,
  .hero-bg {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    box-shadow: none;
    border-color: #ddd;
  }
}

/* (Removed section-specific education media rules to unify with experience/project layout) */

