:root {
  --content-width: 72rem;
  --page-gutter: clamp(1rem, 3.5vw, 2.5rem);
  --section-space: clamp(2.5rem, 5vw, 4rem);
  --grid-gap: clamp(0.9rem, 2vw, 1.25rem);
  --card-padding: clamp(1rem, 2.5vw, 1.5rem);
  --card-radius: 0.75rem;
}

.container {
  width: 100%;
  max-width: var(--content-width);
  padding-inline: var(--page-gutter);
}

.portfolio-masthead {
  position: sticky;
  z-index: 1000;
  top: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.portfolio-masthead .navbar-fixed {
  position: static;
  background: transparent;
  border: 0;
}

.nav {
  min-width: 0;
  gap: clamp(0.8rem, 2vw, 1.5rem);
  flex-wrap: nowrap;
  padding-block: 0.5rem;
}

.logo {
  flex: 0 0 auto;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.nav-links {
  min-width: 0;
  flex-wrap: nowrap;
  gap: 0.3rem;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.nav-links a {
  flex: 0 0 auto;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
}

.section {
  padding-block: var(--section-space);
  scroll-margin-top: 4.5rem;
  border-bottom: 1px solid var(--border);
}

section :is(article, details)[id] {
  scroll-margin-top: 4.5rem;
}

.section-header {
  margin-bottom: var(--grid-gap);
}

.section-header h2 {
  font-size: clamp(1.65rem, 3vw, 2rem);
  line-height: 1.2;
  color: var(--text);
}

.section-icon {
  width: 1.5rem;
  height: 1.5rem;
}

.section-header p {
  margin: 0.4rem 0 0;
}

.section-subtitle {
  font-size: 1.125rem;
  margin: 1.5rem 0 0.75rem;
}

#about {
  padding-block: clamp(2rem, 5vw, 3.75rem);
}

#about .about-grid {
  grid-template-columns: minmax(0, 1fr) minmax(8rem, 13rem);
  gap: clamp(1.25rem, 5vw, 4rem);
}

.about-text {
  min-width: 0;
}

.about-text h1 {
  margin: 0 0 0.55rem;
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.about-text p {
  max-width: none;
  margin: 0 0 0.9rem;
  font-size: 1rem;
}

.about-text .intro-role {
  margin-bottom: 1.4rem;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 600;
}

#about .profile-card {
  width: 100%;
  margin: 0;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: none;
}

#about .profile-photo {
  display: block;
  border-radius: 50%;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.35rem;
}

.profile-actions .btn {
  display: inline-flex;
  align-items: center;
  min-height: 2.65rem;
  padding: 0.5rem 0.8rem;
  line-height: 1.35;
  font-size: 0.9rem;
}

.card,
.role,
.repo-item,
.repo-details,
.github-activity,
.cert-list {
  min-width: 0;
  padding: var(--card-padding);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--card);
  box-shadow: none;
}

.card:hover,
.role:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border);
}

.card h3,
.role h3,
.github-activity h3,
.training-section > h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  line-height: 1.35;
}

.card p,
.role p,
.repo-item p {
  font-size: 1rem;
}

.card > :last-child,
.role > :last-child {
  margin-bottom: 0;
}

.project-featured-grid,
.project-grid,
.project-grid.compact,
.education-grid,
.repo-grid,
.skills-grid,
.cert-featured,
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--grid-gap);
  align-items: stretch;
}

.project-featured {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 0.65rem;
}

.project-featured h3 {
  margin-bottom: 0;
}

.project-featured-chips,
.journey-tags {
  margin: 0;
}

.project-featured-chips span,
.journey-tags span,
.skills-grid .chips span {
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.5;
}

.project-featured .link,
.project .link {
  font-size: 0.95rem;
  color: var(--accent);
}

.project-featured > a:first-of-type,
.project > a:first-of-type {
  margin-top: auto;
}

.repo-item::before {
  display: none;
}

.repo-note,
.repo-item .repo-archive-note,
.cert-card span,
.role-disclosure summary span,
.role-disclosure summary time,
.education-disclosure summary span {
  color: var(--muted);
  font-size: 0.9rem;
}

.repo-item a,
.repo-link,
.cert-card a {
  overflow-wrap: anywhere;
}

.repo-link,
.research-list li {
  background: var(--bg);
  border-radius: 0.5rem;
}

.repo-link:hover {
  border-color: var(--accent);
  box-shadow: none;
}

.repo-title,
.repo-item a,
.contact-card a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.timeline,
.journey-grid {
  gap: var(--grid-gap);
  padding-left: 0;
}

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

.role-icon,
.cert-card img,
.card-icon,
.skill-header img {
  flex: 0 0 auto;
}

.role-header {
  gap: 0.55rem 1rem;
  margin-bottom: 0.65rem;
}

.education-featured {
  grid-column: 1 / -1;
}

.education-featured .education-sections {
  margin-top: 1rem;
}

.education-sections > div:first-child {
  grid-column: 1 / -1;
}

.coursework-list {
  margin: 0;
  padding-left: 1.2rem;
}

.cert-list summary {
  cursor: pointer;
  font-weight: 650;
  margin: 0;
}

.cert-list[open] > summary {
  margin-bottom: var(--grid-gap);
}

.about-text a:not(.btn),
.role a,
.education a,
.cert-card a,
.project-featured p a,
.project-featured .link,
.journey-meta a,
.research-list a,
.github-activity a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.github-activity {
  margin-block: var(--grid-gap);
}

.v3-calendar-figure {
  margin: 0;
  min-width: 0;
}

.v3-calendar-scroll {
  max-width: 100%;
  overflow: auto hidden;
  padding: 0.4rem 0 0.6rem;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.v3-calendar-scroll a {
  display: block;
  width: fit-content;
}

.v3-calendar {
  display: block;
  max-width: none;
  height: auto;
}

.v3-calendar text {
  fill: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
}

.v3-day { stroke: rgba(38, 53, 47, 0.09); stroke-width: 0.7; }
.v3-level-0 { fill: #e9ede7; }
.v3-level-1 { fill: #bad5bf; }
.v3-level-2 { fill: #7aaf89; }
.v3-level-3 { fill: #458366; }
.v3-level-4 { fill: #245b48; }

.v3-calendar-key,
.v3-calendar-legend {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.v3-calendar-key {
  flex-wrap: wrap;
  justify-content: space-between;
  margin: 0.45rem 0;
  color: var(--muted);
}

.v3-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border: 1px solid rgba(38, 53, 47, 0.08);
  border-radius: 2px;
}

.v3-swatch-0 { background: #e9ede7; }
.v3-swatch-1 { background: #bad5bf; }
.v3-swatch-2 { background: #7aaf89; }
.v3-swatch-3 { background: #458366; }
.v3-swatch-4 { background: #245b48; }

.v3-calendar-figure figcaption,
.v3-calendar-data {
  color: var(--muted);
  font-size: 0.9rem;
}

.v3-calendar-data {
  margin-top: 0.75rem;
}

.v3-calendar-data summary {
  cursor: pointer;
}

.v3-calendar-data table {
  width: 100%;
  max-width: 34rem;
  margin-top: 0.5rem;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.v3-calendar-data th,
.v3-calendar-data td {
  border-bottom: 1px solid var(--border);
  padding: 0.3rem 0.5rem 0.3rem 0;
  text-align: left;
}

.v3-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.role-disclosure {
  padding-block: 0;
}

.role-disclosure summary,
.education-disclosure summary {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.45rem 0.7rem;
  cursor: pointer;
  list-style: none;
}

.role-disclosure summary {
  padding-block: 0.85rem;
}

.role-disclosure summary::-webkit-details-marker,
.education-disclosure summary::-webkit-details-marker {
  display: none;
}

.role-disclosure summary::before,
.education-disclosure summary::before {
  content: "+";
  color: var(--accent);
  font-weight: 700;
}

.role-disclosure[open] > summary::before,
.education-disclosure[open] > summary::before {
  content: "−";
}

.role-detail-body {
  border-top: 1px solid var(--border);
  padding: 0 0 0.45rem 1.7rem;
}

.experience-subrole {
  margin-top: 0.65rem;
}

.experience-subrole summary {
  cursor: pointer;
  font-weight: 600;
}

.experience-subrole p {
  margin: 0.4rem 0 0.2rem 1.2em;
  color: var(--muted);
}

.education-disclosure summary {
  grid-template-columns: 1rem minmax(0, 1fr) auto;
}

.training-section {
  margin-top: 1.5rem;
}

:is(a, button, summary, .v3-calendar-scroll):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 700px) {
  #about .about-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  #about .profile-card {
    width: 6rem;
    order: -1;
  }

  .project-featured-grid,
  .project-grid,
  .project-grid.compact,
  .education-grid,
  .repo-grid,
  .skills-grid,
  .cert-featured,
  .contact-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .role-disclosure summary,
  .education-disclosure summary {
    grid-template-columns: 1rem minmax(0, 1fr);
  }

  .role-disclosure summary span,
  .role-disclosure summary time,
  .education-disclosure summary span {
    grid-column: 2;
  }
}

.skills-disclosure,
.credentials-disclosure {
  padding: var(--card-padding);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--card);
}

.skills-disclosure > summary,
.credentials-disclosure > summary {
  cursor: pointer;
  font-weight: 650;
}

.skills-disclosure[open] > summary,
.credentials-disclosure[open] > summary {
  margin-bottom: var(--grid-gap);
}

.credential-profile-links {
  margin-top: var(--grid-gap);
}

.supporting-figure-links a,
.contact-actions a,
.footer a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

#about .profile-photo {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

.skip-link:not(:focus) {
  transform: translateY(-100%);
}


#top {
  position: absolute;
  top: 0;
}

#main-content {
  scroll-margin-top: 4.5rem;
}

.about-text .profile-actions {
  margin: 0.95rem 0 1.1rem;
}

.footer a {
  color: #e2e8f0;
}

.skills-summary {
  color: var(--muted);
  margin: 0 0 1rem;
}

#certifications .cert-list a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

@media (max-width: 640px) {
  .nav {
    gap: 0.65rem;
  }

  .nav-links {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0 0.25rem;
    overflow: visible;
    white-space: normal;
  }

  .nav-links a {
    padding: 0.55rem 0.24rem;
    font-size: 0.82rem;
  }

  .nav-links .nav-wide {
    display: none;
  }

  #about {
    padding-block: 1.65rem 2.3rem;
  }

  #about .profile-card {
    width: 6rem;
  }
}

#certifications .section-header a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

@media (max-width: 640px) {
  .nav-links {
    gap: 0 0.125rem;
  }

  .nav-links a {
    padding-inline: 0.12rem;
    font-size: 0.8rem;
  }

  #about .profile-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #about .profile-actions .btn {
    justify-content: center;
    text-align: center;
  }

  #about .profile-actions .btn.primary {
    grid-column: 1 / -1;
  }
}

@media (max-width: 360px) {
  .nav-links {
    display: grid;
    grid-template-columns: repeat(3, auto);
  }
}

#research-output,
#project-59-details {
  scroll-margin-top: 6rem;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
}

.project-evidence {
  align-self: stretch;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.project-evidence summary {
  color: var(--accent);
  cursor: pointer;
  font-size: 0.94rem;
  font-weight: 600;
}

.project-evidence :is(p, figure) {
  margin: 0.65rem 0 0;
}

.project-evidence img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.project-evidence figcaption {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.applied-project-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--grid-gap);
  align-items: stretch;
}

.applied-project-group h3 {
  text-wrap: balance;
}

.applied-project-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.applied-project-group li {
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.applied-project-group li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.applied-project-group h4 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.applied-project-group p {
  margin: 0;
}

.applied-project-group a,
.project-evidence p a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

@media (max-width: 960px) {
  .applied-project-groups {
    grid-template-columns: minmax(0, 1fr);
  }
}

.code-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-bottom: 1rem;
}

.code-quick-links a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
