* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #1c2230;
  background-color: #f7f8fa;
  line-height: 1.6;
}

a {
  color: #0066cc;
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

.hero {
  background: radial-gradient(circle at 0 0, rgba(114, 162, 255, 0.35), transparent 55%),
              radial-gradient(circle at 100% 0, rgba(44, 110, 255, 0.4), transparent 60%),
              #0f1b33;
  color: #ffffff;
  padding: 1.75rem 1.5rem 3.5rem;
  position: relative;
  overflow: hidden;
}

.hero--compact {
  padding-bottom: 2.5rem;
}

.nav {
  max-width: 1000px;
  margin: 0 auto 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.nav__brand {
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 1rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}

.nav__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.nav__links a {
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  font-size: 0.95rem;
}

.hero__content {
  max-width: 1000px;
  margin: 0 auto;
  text-align: left;
}

.hero__eyebrow {
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  margin: 0 0 0.5rem;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero__lede {
  font-size: 1.05rem;
  max-width: 760px;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 1.5rem;
}

.hero__cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.hero__meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
}

.hero__meta-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  transition: background 0.2s ease, transform 0.2s ease;
}

.hero__meta-link:hover,
.hero__meta-link:focus {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.hero__meta-link .icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.section {
  padding: 3.25rem 1.5rem;
  background-color: #ffffff;
}

.section--muted {
  background-color: #eef2f7;
}

.section__inner {
  max-width: 1000px;
  margin: 0 auto;
}

.section h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.section__header h2 {
  margin: 0;
}

.section h3 {
  margin-top: 0;
  font-size: 1.1rem;
}

.card-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card-grid--two {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.card {
  background: #ffffff;
  padding: 1.35rem 1.5rem;
  border-radius: 10px;
  border: 1px solid #e0e5ee;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card .meta {
  margin: auto 0 0;
  font-size: 0.85rem;
  color: #5c6782;
  font-weight: 500;
}

.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  background: #0f1b33;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(15, 98, 254, 0.9);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(15, 27, 51, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  z-index: 1000;
}

.back-to-top:hover,
.back-to-top:focus {
  text-decoration: none;
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(15, 27, 51, 0.35);
  background: rgba(15, 98, 254, 1);
}

.back-to-top:active {
  transform: translateY(-1px);
}

/* Portfolio */

.portfolio-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.portfolio-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #ffffff;
  border: 1px solid #e0e5ee;
  border-radius: 10px;
  padding: 1.35rem 1.5rem;
}

.portfolio-card h3 {
  margin: 0;
  line-height: 1.35;
}

.portfolio-card__links {
  list-style: none;
  margin: -0.25rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  font-size: 0.85rem;
}

.doc-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 500;
}

.doc-link__icon {
  width: 14px;
  height: 14px;
  flex: none;
}

.doc-link__status {
  margin-left: 0.4rem;
  color: #5c6782;
  font-weight: 400;
  font-style: italic;
}

.portfolio-card__gallery {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.portfolio-card__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.portfolio-card__figure img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid #e0e5ee;
  border-radius: 6px;
}

.portfolio-card__figure figcaption {
  font-size: 0.8rem;
  color: #5c6782;
  line-height: 1.45;
}

.portfolio-card__summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: #0066cc;
}

.portfolio-card__summary::-webkit-details-marker {
  display: none;
}

.portfolio-card__summary::before {
  content: '';
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}

.portfolio-card__details[open] .portfolio-card__summary::before {
  transform: rotate(45deg);
}

.portfolio-card__summary:hover {
  text-decoration: underline;
}

.portfolio-card__description {
  margin-top: 0.6rem;
  font-size: 0.95rem;
  color: #3a4459;
}

.portfolio-card__description p {
  margin: 0 0 0.6rem;
}

.portfolio-card__description p:last-child {
  margin-bottom: 0;
}

/* Home page: compact CV components */

.card h3,
.card p {
  margin: 0;
}

.card-grid--pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 720px) {
  .card-grid--pair {
    grid-template-columns: 1fr;
  }
}

.card-grid--four {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

a.card {
  color: inherit;
}

a.card h3 {
  color: #0066cc;
}

a.card:hover,
a.card:focus {
  text-decoration: none;
  border-color: #b9c6db;
}

a.card:hover h3,
a.card:focus h3 {
  text-decoration: underline;
}

.collab {
  margin: 1.5rem 0 0;
  font-size: 0.92rem;
  color: #5c6782;
}

.collab span {
  display: block;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1c2230;
  margin-bottom: 0.25rem;
}

.cv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.45;
}

.cv-table th,
.cv-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.45rem 1.25rem 0.45rem 0;
  border: 0;
}

.cv-table td:first-child {
  padding-left: 0.6rem;
}

.cv-table td:last-child {
  padding-right: 0.6rem;
}

.cv-table tr:nth-child(odd of :not(.cv-table__head)) {
  background: rgba(15, 27, 51, 0.035);
}

.cv-table .cv-table__group {
  padding: 1.4rem 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5c6782;
}

.cv-table tbody:first-child .cv-table__group {
  padding-top: 0;
}

.cv-table__when {
  width: 7.5rem;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f62fe;
  font-variant-numeric: tabular-nums;
  padding-top: 0.55rem;
}

.cv-table__what {
  width: 40%;
  font-weight: 600;
}

.cv-table--two .cv-table__what {
  width: 12rem;
}

.cv-table__detail {
  color: #5c6782;
}

@media (max-width: 720px) {
  .hero {
    padding: 1.25rem 1rem 2.5rem;
  }

  .nav {
    margin-bottom: 1.75rem;
    gap: 0.6rem;
  }

  .nav__links {
    gap: 0.4rem 1rem;
  }

  .nav__links a {
    font-size: 0.9rem;
  }

  .hero__lede {
    font-size: 1rem;
  }

  .section {
    padding: 2.5rem 1rem;
  }

  .section h2 {
    font-size: 1.4rem;
    margin-bottom: 1.1rem;
  }

  .cv-table,
  .cv-table tbody,
  .cv-table tr,
  .cv-table th,
  .cv-table td {
    display: block;
    width: auto;
  }

  .cv-table tr {
    padding: 0.55rem 0.6rem;
  }

  .cv-table th,
  .cv-table td,
  .cv-table td:first-child,
  .cv-table td:last-child {
    padding: 0;
  }

  .cv-table tr.cv-table__head {
    padding: 0;
  }

  .cv-table__when {
    white-space: normal;
  }

  .hero__content {
    text-align: left;
  }

  .back-to-top {
    right: 1rem;
    bottom: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
