:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #ebf1f6;
  --text: #1a2230;
  --muted: #607086;
  --primary: #0b3d68;
  --primary-dark: #082b49;
  --border: #d9e2ef;
  --portfolio-thumb-h: 220px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

.container {
  width: min(1120px, 92%);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.nav-wrap {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.8rem 0;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  line-height: 1.22;
  min-width: 0;
}

.brand-degree {
  font-size: 0.68em;
  font-weight: 800;
  letter-spacing: 0.03em;
  margin: 0 0.12em;
  vertical-align: baseline;
  position: relative;
  top: -0.04em;
}

.brand-primary,
.brand-tagline {
  display: block;
}

.site-nav {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.38rem 0.52rem;
  border-radius: 8px;
}

.site-nav a:hover {
  color: var(--primary);
  background: rgba(19, 68, 127, 0.08);
}

.hero {
  padding: 5.5rem 0 2.6rem;
  background: radial-gradient(
      circle at 18% 12%,
      rgba(73, 132, 201, 0.15),
      transparent 36%
    ),
    linear-gradient(165deg, #f8fbff 0%, #eaf1f9 100%);
}

.hero-grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: 1.45fr 0.95fr;
  align-items: stretch;
}

.hero-main {
  background: var(--surface);
  border: 1px solid rgba(19, 68, 127, 0.12);
  border-radius: 20px;
  padding: 1.8rem;
  box-shadow: 0 8px 28px rgba(19, 68, 127, 0.08);
}

.kicker {
  margin: 0 0 0.35rem;
  color: #2b5f9c;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  line-height: 1.15;
  font-size: clamp(2.25rem, 4.2vw, 3.25rem);
}

.lead {
  margin-top: 0.9rem;
  color: var(--muted);
  max-width: 58ch;
  font-size: 1.03rem;
}

.hero-actions {
  margin-top: 1.3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.52rem;
}

.btn {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.66rem 1.15rem;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  transition: all 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(19, 68, 127, 0.18);
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-dark);
}

.stats {
  margin-top: 1.1rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.stats div {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem;
  background: linear-gradient(180deg, #f7fbff 0%, #eef4fb 100%);
}

.stats span {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary);
}

.stats p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-card {
  border-radius: 20px;
  padding: 1.2rem;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafe 100%);
  border: 1px solid rgba(19, 68, 127, 0.12);
  box-shadow: 0 8px 28px rgba(19, 68, 127, 0.08);
  container-type: inline-size;
}

.profile-photo {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(15, 30, 50, 0.12);
  margin-bottom: 0.9rem;
}

.profile-photo-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.9rem;
}

.profile-card h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(0.62rem, 5.4cqi + 0.2rem, 1.25rem);
}

.profile-card ul {
  padding-left: 1rem;
  margin: 0.6rem 0 0;
}

.section {
  padding: 3.2rem 0;
}

.section-subtitle {
  margin-top: -0.3rem;
  color: var(--muted);
}

.section.alt {
  background: linear-gradient(180deg, #eff4fa 0%, #ecf2f8 100%);
  border-block: 1px solid rgba(19, 68, 127, 0.1);
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.7rem;
}

h3 {
  margin: 0;
}

.meta {
  margin: 0.2rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.timeline-item,
.card {
  background: var(--surface);
  border: 1px solid rgba(19, 68, 127, 0.12);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 8px 28px rgba(19, 68, 127, 0.08);
}

.timeline-item + .timeline-item {
  margin-top: 0.9rem;
}

.timeline-item ul {
  margin: 0.5rem 0 0;
}

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

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

.portfolio-filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
}

.filter-chip {
  border: 1px solid var(--border);
  background: #f4f8fc;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.38rem 0.72rem;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

.filter-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.portfolio-grid {
  margin-top: 0.2rem;
  gap: 0.8rem;
}

.portfolio-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  padding-bottom: 0.3rem;
}

.portfolio-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(19, 68, 127, 0.17);
}

.portfolio-image {
  width: 100%;
  height: var(--portfolio-thumb-h);
  object-fit: cover;
  display: block;
}

.portfolio-image-diagram {
  width: 100%;
  height: var(--portfolio-thumb-h);
  object-fit: contain;
  object-position: center center;
  display: block;
  background: #08121f;
}

.portfolio-image-placeholder {
  width: 100%;
  height: var(--portfolio-thumb-h);
  background: linear-gradient(135deg, #dce9f5 0%, #c8ddf0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 2rem;
}

.portfolio-tag {
  display: inline-block;
  margin: 0.8rem 1rem 0.45rem;
  padding: 0.2rem 0.52rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(19, 68, 127, 0.12);
  color: var(--primary-dark);
}

.portfolio-card h3,
.portfolio-card p,
.portfolio-card .inline-link,
.portfolio-card .tech-pills,
.portfolio-card ul,
.portfolio-card .inline-note {
  margin-left: 1rem;
  margin-right: 1rem;
}

.portfolio-card h3 {
  font-size: 1.05rem;
}

.portfolio-card p {
  font-size: 0.92rem;
}

.tech-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-bottom: 1rem;
}

.tech-pills span {
  font-size: 0.68rem;
  font-weight: 700;
  color: #325271;
  background: #e8f0f8;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
}

.pub-list {
  padding-left: 1.1rem;
  margin: 0;
}

.pub-list li {
  margin-bottom: 0.6rem;
}

.pub-list a,
.card h3 a {
  color: var(--text);
  text-decoration: none;
}

.pub-list a:hover,
.card h3 a:hover {
  color: var(--primary);
}

.inline-note {
  margin-top: 0.9rem;
}

.inline-note a,
.contact-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}

.inline-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 800;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.inline-link:hover {
  color: var(--primary-dark);
}

.quote-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

.quote-card cite {
  display: block;
  margin-top: 0.7rem;
  color: var(--muted);
  font-style: normal;
}

.endorsement-slider {
  border: 1px solid rgba(19, 68, 127, 0.16);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}

.endorsement-track {
  display: flex;
  transition: transform 0.35s ease;
  touch-action: pan-y;
  user-select: none;
}

.endorsement-card {
  min-width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 0;
  border-radius: 0;
  padding: 1rem 1.1rem;
  box-shadow: none;
}

.endorsement-card + .endorsement-card {
  border-left: 1px solid var(--border);
}

.endorsement-card p {
  margin: 0;
}

.endorsement-meta {
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.endorsement-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.endorsement-meta cite {
  margin: 0;
}

.endorsement-meta a {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.endorsement-meta small {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted);
}

.endorsement-controls {
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, #f4f8fd 0%, #eef4fb 100%);
  padding: 0.55rem 0.7rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.7rem;
}

.endorsement-nav {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  font-weight: 800;
  cursor: pointer;
}

.endorsement-nav:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.endorsement-dots {
  display: flex;
  gap: 0.35rem;
}

.endorsement-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: #b5c3d3;
  cursor: pointer;
}

.endorsement-dot.active {
  background: var(--primary);
}

details {
  border: 1px solid rgba(19, 68, 127, 0.14);
  border-radius: 14px;
  padding: 0.7rem 0.8rem;
  background: var(--surface);
}

details + details {
  margin-top: 0.7rem;
}

summary {
  cursor: pointer;
  font-weight: 700;
  font-family: "Roboto", "Open Sans", Arial, sans-serif;
}

.contact-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.contact-form-wrap {
  margin-top: 1.75rem;
  padding: 1.35rem 1.4rem 1.5rem;
  max-width: 560px;
}

.contact-form-title {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
}

.contact-form-note {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.contact-form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.contact-field label {
  font-weight: 600;
  font-size: 0.92rem;
}

.contact-field input,
.contact-field select,
.contact-field textarea {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.contact-field textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-hp {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.form-status {
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  font-size: 0.95rem;
}

.form-status.is-success {
  background: rgba(34, 139, 87, 0.12);
  color: #1b5c3a;
  border: 1px solid rgba(34, 139, 87, 0.35);
}

.form-status.is-error {
  background: rgba(180, 60, 60, 0.1);
  color: #7a2222;
  border: 1px solid rgba(180, 60, 60, 0.35);
}

.form-status.is-info {
  background: rgba(19, 68, 127, 0.08);
  color: var(--primary-dark);
  border: 1px solid rgba(19, 68, 127, 0.22);
}

.site-footer {
  padding: 1.5rem 0 2rem;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
}

h1,
h2,
h3,
.brand {
  font-family: "Roboto", "Open Sans", Arial, sans-serif;
  letter-spacing: 0.01em;
}

body {
  font-family: "Open Sans", Arial, sans-serif;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7fc 100%);
  color: var(--text);
}

.site-header {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(19, 68, 127, 0.12);
  box-shadow: 0 4px 22px rgba(19, 68, 127, 0.07);
}

/* Root overrides for refined palette */
:root {
  --bg: #f5f8fd;
  --surface: #ffffff;
  --surface-soft: #edf3fa;
  --text: #2a2d32;
  --muted: #5f6f83;
  --primary: #13447f;
  --primary-dark: #0d2f59;
  --border: #d7e0ec;
}

@media (max-width: 960px) {
  .hero-grid,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .endorsement-card {
    min-width: 100%;
  }

  .endorsement-card + .endorsement-card {
    border-left: 0;
  }

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

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

  h1 {
    font-size: clamp(1.9rem, 7.2vw, 2.5rem);
  }
}

/* ===== PROJECT MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 12, 30, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1.5rem;
  backdrop-filter: blur(3px);
}
.modal-overlay[hidden] { display: none; }

.modal-card {
  background: var(--surface);
  border-radius: 20px;
  max-width: 780px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 2.5rem 2.8rem 2.2rem;
  position: relative;
  box-shadow: 0 24px 60px rgba(5, 12, 30, 0.35);
}

.modal-close {
  position: absolute;
  top: 1.1rem;
  right: 1.2rem;
  background: var(--surface-soft);
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 1rem;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--border); color: var(--text); }

.modal-tag {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.4rem;
}
.modal-card h2 {
  font-size: 1.45rem;
  color: var(--primary-dark);
  margin: 0 0 0.25rem;
}
.modal-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.4rem;
}
.modal-body h4 {
  font-size: 0.95rem;
  color: var(--primary);
  margin: 1.2rem 0 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.modal-body p, .modal-body li {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.7;
}
.modal-body ul { padding-left: 1.2rem; margin: 0.3rem 0 0.8rem; }
.modal-tech-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.4rem;
}
.modal-tech-pills span {
  background: rgba(11,61,104,0.09);
  color: var(--primary);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
}
.modal-links {
  margin-top: 1.4rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

/* Modal figure styles */
.modal-hero-img {
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: 1.2rem;
  border: 1px solid var(--border);
}
.modal-hero-img--vertical {
  width: 100%;
  max-height: none;
  height: auto;
  object-fit: unset;
}
.modal-figure {
  margin: 1rem 0 1.2rem;
  text-align: center;
}
.modal-figure img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}
.modal-figure figcaption {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.45rem;
  line-height: 1.55;
  font-style: italic;
  text-align: left;
}
.modal-fig-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin: 1rem 0 1.2rem;
}
.modal-fig-row .modal-figure {
  margin: 0;
}
@media (max-width: 580px) {
  .modal-fig-row { grid-template-columns: 1fr; }
}
.modal-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.8rem 0;
}
.result-item {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
}
.result-item strong { color: var(--primary-dark); }
.result-item--highlight {
  border-color: var(--primary);
  background: rgba(11,61,104,0.07);
}
.modal-results-grid--5 {
  grid-template-columns: repeat(5, 1fr);
}
@media (max-width: 600px) {
  .modal-results-grid--5 { grid-template-columns: repeat(2, 1fr); }
}

/* ML pipeline flow */
.ml-pipeline {
  display: flex;
  align-items: stretch;
  gap: 0.3rem;
  margin: 1rem 0 1.2rem;
  flex-wrap: wrap;
}
.ml-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  text-align: center;
  flex: 1;
  min-width: 90px;
}
.ml-step--result {
  background: rgba(11,61,104,0.07);
  border-color: var(--primary);
}
.ml-step-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--primary);
  margin-bottom: 0.3rem;
}
.ml-step-text {
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.5;
}
.ml-arrow {
  align-self: center;
  color: var(--muted);
  font-size: 1.1rem;
  flex-shrink: 0;
}
@media (max-width: 580px) {
  .ml-arrow { display: none; }
  .ml-step { min-width: 42%; }
}

/* Clickable card cursor + hover hint */
.portfolio-card[data-modal] {
  cursor: pointer;
}
.portfolio-card[data-modal]::after {
  content: "Click to read more →";
  display: block;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  margin: 0.5rem 1rem 0.4rem;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.portfolio-card[data-modal]:hover::after { opacity: 1; }
