:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-muted: #eef3f8;
  --text: #172033;
  --text-strong: #0e1628;
  --muted: #5e6878;
  --line: #dbe4ef;
  --blue: #1769df;
  --blue-strong: #0b4fb3;
  --blue-soft: #d9e9ff;
  --shadow: 0 18px 55px rgba(23, 32, 51, 0.1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --max-width: 1180px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1118;
  --surface: #151b24;
  --surface-muted: #1b2430;
  --text: #edf3fb;
  --text-strong: #ffffff;
  --muted: #aab6c5;
  --line: #293546;
  --blue: #72adff;
  --blue-strong: #a9ccff;
  --blue-soft: #152c4b;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration-color: rgba(23, 105, 223, 0.35);
  text-underline-offset: 0.18em;
  transition:
    color 180ms ease,
    text-decoration-color 180ms ease;
}

a:hover {
  color: var(--blue);
  text-decoration-color: currentColor;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 100;
  transform: translateY(-160%);
  border-radius: 6px;
  background: var(--text-strong);
  color: var(--bg);
  padding: 0.65rem 0.85rem;
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.25rem;
  border-bottom: 1px solid rgba(219, 228, 239, 0.76);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  padding: 0.8rem max(1.25rem, calc((100vw - var(--max-width)) / 2));
  animation: header-reveal 520ms var(--ease) both;
  backdrop-filter: blur(18px);
}

html[data-theme="dark"] .site-header {
  border-bottom-color: rgba(41, 53, 70, 0.82);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 0.7rem;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--blue-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: var(--shadow);
  transition:
    border-color 180ms ease,
    transform 180ms var(--ease);
}

.brand__text {
  color: var(--text-strong);
  font-size: 0.95rem;
  font-weight: 720;
  white-space: nowrap;
}

.nav {
  display: flex;
  justify-content: center;
  gap: clamp(0.65rem, 2vw, 1.4rem);
}

.nav a {
  position: relative;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.nav a::after {
  position: absolute;
  right: 0;
  bottom: -0.35rem;
  left: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms var(--ease);
  content: "";
}

.nav a:hover {
  color: var(--text-strong);
}

.nav a:hover::after {
  transform: scaleX(1);
}

.theme-toggle {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-strong);
  cursor: pointer;
  transition:
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms var(--ease);
}

.theme-toggle:hover {
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-1px);
}

.theme-toggle__icon {
  width: 1.08rem;
  height: 1.08rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.theme-toggle__icon--sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle__icon--moon {
  display: none;
}

html[data-theme="dark"] .theme-toggle__icon--sun {
  display: block;
}

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: min(760px, 82svh);
  align-content: center;
  gap: clamp(2rem, 6vw, 5rem);
  overflow: hidden;
  background-image:
    linear-gradient(90deg, rgba(247, 249, 252, 0.96) 0%, rgba(247, 249, 252, 0.86) 36%, rgba(247, 249, 252, 0.18) 72%),
    url("assets/ai-portfolio-hero.png");
  background-position: center;
  background-size: cover;
  padding: clamp(5rem, 10vw, 8rem) max(1.25rem, calc((100vw - var(--max-width)) / 2)) clamp(2rem, 5vw, 4rem);
}

html[data-theme="dark"] .hero {
  background-image:
    linear-gradient(90deg, rgba(13, 17, 24, 0.98) 0%, rgba(13, 17, 24, 0.84) 42%, rgba(13, 17, 24, 0.34) 78%),
    url("assets/ai-portfolio-hero.png");
}

.hero::after {
  position: absolute;
  inset: auto 0 0;
  z-index: -1;
  height: 34%;
  background: linear-gradient(180deg, transparent, var(--bg));
  content: "";
}

.hero__layout {
  display: grid;
  width: 100%;
  max-width: var(--max-width);
  grid-template-columns: minmax(0, 720px) minmax(12rem, 20rem);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
  margin: 0 auto;
}

.hero__content {
  max-width: 720px;
  min-width: 0;
}

.hero__content .eyebrow,
.hero h1,
.hero__lead,
.hero__actions {
  animation: fade-up 680ms var(--ease) both;
}

.hero h1 {
  animation-delay: 90ms;
}

.hero__lead {
  animation-delay: 160ms;
}

.hero__actions {
  animation-delay: 230ms;
}

.hero__portrait {
  width: clamp(12rem, 24vw, 18rem);
  aspect-ratio: 1;
  justify-self: end;
  border: 1px solid color-mix(in srgb, var(--blue) 38%, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  box-shadow: var(--shadow);
  padding: 0.38rem;
  animation: portrait-reveal 760ms var(--ease) 260ms both;
}

.hero__portrait img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.9rem;
  color: var(--blue-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 9ch;
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(3.7rem, 9vw, 7.5rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.hero__lead {
  max-width: 650px;
  margin: 1.55rem 0 0;
  color: var(--text);
  font-size: clamp(1.05rem, 2.3vw, 1.35rem);
}

.hero__actions {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  align-items: stretch;
  gap: 0.65rem;
  overflow-x: auto;
  flex-wrap: nowrap;
  margin-top: 2rem;
  padding-bottom: 0.12rem;
}

.hero__actions .button {
  min-height: 2.85rem;
  flex: 0 0 auto;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  min-height: 2.85rem;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.72rem 1rem;
  font-weight: 760;
  text-decoration: none;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms var(--ease);
}

.button--primary {
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(23, 105, 223, 0.24);
}

.button--primary:hover {
  background: var(--blue-strong);
  color: #ffffff;
}

.button--secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text-strong);
}

.button--ghost {
  border-color: var(--line);
  border-color: color-mix(in srgb, var(--blue) 35%, var(--line));
  color: var(--blue-strong);
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.section {
  padding: clamp(4rem, 8vw, 7rem) max(1.25rem, calc((100vw - var(--max-width)) / 2));
}

.section--muted {
  background: var(--surface-muted);
}

.section__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

.profile-stack {
  display: grid;
  gap: clamp(1.25rem, 3vw, 2rem);
}

.profile-stack .intro-copy {
  max-width: 820px;
}

.section-heading {
  max-width: 780px;
  margin-bottom: clamp(1.75rem, 4vw, 3rem);
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.15rem;
}

.profile-links a {
  border: 1px solid color-mix(in srgb, var(--blue) 34%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  color: var(--blue-strong);
  padding: 0.5rem 0.7rem;
  font-size: 0.86rem;
  font-weight: 760;
  text-decoration: none;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    transform 180ms var(--ease);
}

.profile-links a:hover {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
  transform: translateY(-1px);
}

.profile-links--section {
  margin-top: 1.15rem;
}

h2,
h3,
p {
  overflow-wrap: anywhere;
}

h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 1.05rem;
  line-height: 1.32;
}

p {
  margin: 0;
}

.intro-copy {
  display: grid;
  gap: 1rem;
  color: var(--muted);
  font-size: 1.05rem;
}

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

.focus-card,
.detail-card,
.publication {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms var(--ease);
}

.focus-card:hover,
.detail-card:hover,
.publication:hover {
  border-color: color-mix(in srgb, var(--blue) 32%, var(--line));
  box-shadow: 0 22px 60px rgba(23, 32, 51, 0.14);
  transform: translateY(-3px);
}

html[data-theme="dark"] .focus-card:hover,
html[data-theme="dark"] .detail-card:hover,
html[data-theme="dark"] .publication:hover {
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

.focus-card {
  padding: 1.25rem;
}

.focus-card p,
.detail-card p,
.publication p,
.skill-group p,
.timeline-item p,
.timeline-item li {
  color: var(--muted);
}

.focus-card p {
  margin-top: 0.65rem;
}

.timeline {
  display: grid;
  gap: 1rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: minmax(11rem, 0.36fr) minmax(0, 1fr);
  gap: 1.5rem;
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
}

.timeline-item__meta {
  display: grid;
  gap: 0.35rem;
  align-content: start;
}

.timeline-item__meta span,
.date,
.publication__venue {
  color: var(--blue-strong);
  font-size: 0.82rem;
  font-weight: 790;
}

.timeline-item__meta strong {
  color: var(--text-strong);
  line-height: 1.25;
}

.timeline-item__body {
  display: grid;
  gap: 0.75rem;
}

.timeline-item ul {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding-left: 1.15rem;
}

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

.publication {
  display: grid;
  gap: 0.65rem;
  padding: 1.2rem;
}

.publication__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.publication__citations,
.publication__award {
  border: 1px solid color-mix(in srgb, var(--blue) 30%, var(--line));
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-strong);
  padding: 0.15rem 0.5rem;
  font-size: 0.76rem;
  font-weight: 790;
  line-height: 1.25;
}

.publication__award {
  border-color: color-mix(in srgb, #c6862a 38%, var(--line));
  background: color-mix(in srgb, #f4bf56 18%, var(--surface));
  color: color-mix(in srgb, #9a5a11 85%, var(--text-strong));
}

.publication a {
  text-decoration-thickness: 1px;
}

.stacked-cards,
.skill-groups {
  display: grid;
  gap: 1rem;
}

.detail-card {
  padding: 1.25rem;
}

.detail-card p {
  margin-top: 0.6rem;
}

.project-meta {
  color: var(--blue-strong) !important;
  font-size: 0.82rem;
  font-weight: 790;
}

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

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

.skill-group {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.skill-group p {
  margin-top: 0.35rem;
}

.contact-section {
  background: #0e1628;
  color: #f7f9fc;
  padding: clamp(4rem, 8vw, 6.5rem) max(1.25rem, calc((100vw - var(--max-width)) / 2));
}

html[data-theme="dark"] .contact-section {
  background: #080c12;
  color: #edf3fb;
}

.contact-section__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.contact-section .section-kicker {
  color: var(--blue);
}

.contact-section h2 {
  max-width: 900px;
  color: currentColor;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.contact-links a {
  border: 1px solid rgba(247, 249, 252, 0.28);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: currentColor;
  font-weight: 730;
  text-decoration: none;
  transition:
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms var(--ease);
}

.contact-links a:hover {
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-1px);
}

.contact-links .contact-link--primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.contact-links .contact-link--primary:hover {
  background: var(--blue-strong);
  color: #ffffff;
}

.site-footer {
  padding: 1.5rem max(1.25rem, calc((100vw - var(--max-width)) / 2));
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  max-width: var(--max-width);
  margin: 0 auto;
}

.chat-widget {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.chat-widget__label {
  border: 1px solid color-mix(in srgb, var(--blue) 24%, var(--line));
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-strong);
  box-shadow: var(--shadow);
  padding: 0.38rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 780;
  line-height: 1;
}

.chat-widget__launcher {
  display: grid;
  width: 3.4rem;
  height: 3.4rem;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--blue) 42%, var(--line));
  border-radius: 50%;
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 18px 42px rgba(23, 105, 223, 0.32);
  cursor: pointer;
  transition:
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms var(--ease);
}

.chat-widget__launcher:hover {
  background: var(--blue-strong);
  transform: translateY(-2px);
}

.chat-widget__launcher[aria-expanded="true"] {
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px) scale(0.96);
}

.chat-widget.is-open .chat-widget__label {
  opacity: 0;
  pointer-events: none;
}

.chat-widget__launcher[aria-expanded="true"] + .chat-widget__panel {
  bottom: 0;
}

.chat-widget__launcher svg,
.chat-widget__close svg {
  width: 1.28rem;
  height: 1.28rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.chat-widget__panel {
  position: absolute;
  right: 0;
  bottom: 4.25rem;
  display: grid;
  width: min(25rem, calc(100vw - 2rem));
  max-height: min(38rem, calc(100svh - 7rem));
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(23, 32, 51, 0.22);
  animation: chat-panel-in 180ms var(--ease) both;
}

html[data-theme="dark"] .chat-widget__panel {
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
}

.chat-widget__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding: 1rem;
}

.chat-widget__kicker {
  margin: 0 0 0.18rem;
  color: var(--blue-strong);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.chat-widget__header h2 {
  font-size: 1.05rem;
  line-height: 1.2;
}

.chat-widget__close {
  display: grid;
  flex: 0 0 auto;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition:
    border-color 180ms ease,
    color 180ms ease;
}

.chat-widget__close:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.chat-widget__messages {
  display: grid;
  align-content: start;
  gap: 0.7rem;
  overflow-y: auto;
  padding: 1rem;
}

.chat-message {
  max-width: 88%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--text);
  padding: 0.68rem 0.78rem;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chat-message--assistant {
  justify-self: start;
}

.chat-message--user {
  justify-self: end;
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.chat-widget__status {
  min-height: 1.5rem;
  padding: 0 1rem 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.chat-widget__status.is-busy::before {
  display: inline-block;
  width: 0.68rem;
  height: 0.68rem;
  margin-right: 0.45rem;
  border: 2px solid color-mix(in srgb, var(--blue) 28%, transparent);
  border-top-color: var(--blue);
  border-radius: 50%;
  vertical-align: -0.08rem;
  animation: chat-status-spin 780ms linear infinite;
  content: "";
}

.chat-widget__fallback {
  margin: 0 1rem 0.65rem;
  border: 1px solid color-mix(in srgb, var(--blue) 24%, var(--line));
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
  padding: 0.62rem 0.72rem;
  font-size: 0.84rem;
  line-height: 1.35;
}

.chat-widget__fallback a {
  color: var(--blue-strong);
  font-weight: 760;
}

.chat-widget__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  border-top: 1px solid var(--line);
  padding: 0.85rem;
}

.chat-widget__privacy {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.chat-widget__form textarea {
  width: 100%;
  min-height: 2.75rem;
  max-height: 7rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 0.68rem 0.75rem;
  font: inherit;
  line-height: 1.35;
}

.chat-widget__form textarea:focus {
  border-color: var(--blue);
  outline: none;
}

.chat-widget__form button {
  min-height: 2.75rem;
  align-self: end;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  cursor: pointer;
  font-weight: 760;
  padding: 0 0.9rem;
  transition:
    background-color 180ms ease,
    transform 180ms var(--ease);
}

.chat-widget__form button:hover {
  background: var(--blue-strong);
  transform: translateY(-1px);
}

.chat-widget__form button:disabled,
.chat-widget__form textarea:disabled {
  cursor: wait;
  opacity: 0.68;
}

@keyframes header-reveal {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes portrait-reveal {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes scroll-reveal {
  from {
    opacity: 0.9;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chat-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes chat-status-spin {
  to {
    transform: rotate(360deg);
  }
}

@supports (animation-timeline: view()) {
  .section-heading,
  .split > *,
  .profile-stack > *,
  .focus-card,
  .timeline-item,
  .publication,
  .detail-card,
  .skill-group,
  .contact-section__inner {
    animation: scroll-reveal 1ms var(--ease) both;
    animation-timeline: view();
    animation-range: entry 0% cover 22%;
  }
}

@media (max-width: 920px) {
  .site-header {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 100vw;
    gap: 0.8rem;
    overflow: hidden;
  }

  .brand,
  .theme-toggle {
    flex: 0 0 auto;
  }

  .nav {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    white-space: nowrap;
    scrollbar-width: none;
  }

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

  .hero {
    min-height: auto;
    background-position: 58% center;
    padding-top: 4.5rem;
  }

  .hero__layout,
  .focus-grid,
  .award-grid,
  .publication-list,
  .education-grid,
  .skill-groups,
  .split {
    grid-template-columns: 1fr;
  }

  .hero__layout {
    width: 100%;
    max-width: calc(100vw - 2.5rem);
    min-width: 0;
    justify-items: center;
    text-align: center;
  }

  .hero__content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 auto;
  }

  .hero__portrait {
    width: min(12rem, 48vw);
    justify-self: center;
    order: -1;
  }

  .hero h1,
  .hero__lead {
    max-width: 100%;
    margin-right: auto;
    margin-left: auto;
  }

  .hero__actions {
    justify-content: center;
    justify-content: safe center;
  }

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

@media (max-width: 620px) {
  .brand__text {
    display: none;
  }

  .site-header {
    gap: 0.5rem;
    justify-content: center;
    padding: 0.68rem 3.35rem;
  }

  .brand,
  .theme-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
  }

  .brand {
    left: 0.78rem;
  }

  .theme-toggle {
    right: 0.78rem;
  }

  .theme-toggle:hover {
    transform: translateY(calc(-50% - 1px));
  }

  .brand__mark,
  .theme-toggle {
    width: 2.15rem;
    height: 2.15rem;
  }

  .nav {
    gap: clamp(0.42rem, 2.1vw, 0.72rem);
  }

  .nav a {
    font-size: clamp(0.74rem, 3.25vw, 0.84rem);
  }

  .hero__content .eyebrow {
    max-width: 21rem;
    margin-right: auto;
    margin-left: auto;
  }

  .hero__lead {
    width: min(100%, 24rem);
  }

  .hero {
    background-image:
      linear-gradient(180deg, rgba(247, 249, 252, 0.98) 0%, rgba(247, 249, 252, 0.88) 56%, rgba(247, 249, 252, 0.42) 100%),
      url("assets/ai-portfolio-hero.png");
    background-position: 64% center;
    padding-top: 3.6rem;
  }

  html[data-theme="dark"] .hero {
    background-image:
      linear-gradient(180deg, rgba(13, 17, 24, 0.98) 0%, rgba(13, 17, 24, 0.9) 56%, rgba(13, 17, 24, 0.52) 100%),
      url("assets/ai-portfolio-hero.png");
  }

  .hero h1 {
    max-width: 8ch;
    font-size: clamp(3.1rem, 17vw, 4.5rem);
  }

  .contact-links {
    align-items: stretch;
    flex-direction: column;
  }

  .contact-links a {
    width: 100%;
  }

  .chat-widget {
    right: 1rem;
    bottom: 0.85rem;
  }

  .chat-widget__label {
    max-width: 7.5rem;
  }

  .chat-widget__panel {
    position: fixed;
    right: 0;
    bottom: 0 !important;
    left: 0;
    width: 100vw;
    height: min(82svh, 44rem);
    max-height: min(82svh, 44rem);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 12px 12px 0 0;
  }

  .chat-widget__form {
    grid-template-columns: 1fr;
    padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
  }

  .chat-widget__form button {
    width: 100%;
  }

}

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

  .button:hover,
  .contact-links a:hover,
  .focus-card:hover,
  .detail-card:hover,
  .publication:hover,
  .profile-links a:hover,
  .theme-toggle:hover,
  .chat-widget__launcher:hover,
  .chat-widget__form button:hover {
    transform: none;
  }
}
