:root {
  color-scheme: light;
  --paper: #f7f9fc;
  --white: #fff;
  --ink: #14253c;
  --muted: #4f6076;
  --blue: #2054a0;
  --blue-dark: #173f7a;
  --ice: #eaf1fa;
  --line: #d6e0ec;
  --green: #246347;
  --gutter: clamp(1rem, 5vw, 3.5rem);
  --measure: 72rem;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 6rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.65 system-ui, -apple-system, "Segoe UI", sans-serif;
}
h1, h2, h3, p, figure, ul { margin: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; }
svg { flex: none; vertical-align: middle; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
::selection { color: var(--ink); background: #cfe2fc; }
.accent { color: var(--blue); }

.skip-link {
  position: fixed;
  top: .75rem;
  left: 1rem;
  z-index: 3;
  padding: .6rem 1rem;
  background: var(--white);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

#nav {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.nav-inner, .section-inner, footer {
  width: min(calc(100% - 2 * var(--gutter)), var(--measure));
  margin-inline: auto;
}
.nav-inner { display: flex; min-height: 4.5rem; align-items: center; justify-content: space-between; gap: 1rem; }
.nav-logo { display: inline-flex; align-items: center; gap: .65rem; font-size: .95rem; font-weight: 750; text-decoration: none; }
.monogram {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .5rem;
  background: var(--ink);
  color: var(--white);
  font: 600 .83rem var(--mono);
}
.nav-links { display: flex; flex-wrap: wrap; gap: .35rem clamp(.75rem, 2vw, 1.7rem); padding: 0; list-style: none; }
.nav-links a, .nav-cta { font-size: .875rem; font-weight: 650; text-decoration: none; }
.nav-links a { display: inline-block; padding-block: .4rem; color: var(--muted); }
.nav-links a:hover, .hero-link:hover, footer a:hover { color: var(--blue); text-decoration: underline; text-underline-offset: .3em; }

.button, .nav-cta, .contact-cta {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .65rem;
  min-height: 2.75rem;
  padding: .65rem 1rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  font-weight: 700;
  text-decoration: none;
}
.primary, .contact-cta { background: var(--blue); color: var(--white); }
.primary:hover, .contact-cta:hover { background: var(--blue-dark); }
.secondary, .nav-cta { background: var(--white); color: var(--blue); border-color: var(--line); }
.secondary:hover, .nav-cta:hover { background: var(--ice); border-color: var(--blue); }

#hero {
  border-bottom: 1px solid var(--line);
  background: radial-gradient(ellipse at 88% 25%, #e8f0fb, transparent 62%), var(--paper);
}
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 7vw, 6rem);
  padding-block: clamp(3rem, 7vw, 5.5rem) clamp(2.5rem, 5vw, 4rem);
}
.eyebrow, .section-label {
  color: var(--blue);
  font: 650 .76rem/1.5 var(--mono);
  letter-spacing: .105em;
  text-transform: uppercase;
}
.eyebrow { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; }
.eyebrow span { width: 1.5rem; height: 1px; background: #8ea9ce; }
.hero-title { margin-bottom: 1.25rem; font-size: clamp(3rem, 7.5vw, 7rem); line-height: .94; letter-spacing: -.072em; font-weight: 780; }
.hero-sub { font-size: clamp(1.05rem, 2.4vw, 1.55rem); font-weight: 700; line-height: 1.35; }
.hero-intro { max-width: 36ch; margin-top: .7rem; color: var(--muted); }
.hero-actions, .hero-links { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.hero-actions { margin-top: 1.55rem; }
.hero-links { gap: .7rem 1.35rem; margin-top: 1.2rem; }
.hero-link { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .875rem; font-weight: 650; text-decoration: none; }

.hero-photo-wrap {
  width: min(100%, 23rem);
  justify-self: center;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--white);
  box-shadow: 0 16px 44px #25446d14;
}
.hero-photo {
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 6;
  object-fit: cover;
  object-position: center 8%;
  border: 1px solid #edf0f4;
  border-radius: .55rem;
  background: var(--paper);
}
.photo-caption { display: flex; align-items: center; gap: .7rem; padding: .8rem .2rem .1rem; }
.photo-caption strong, .photo-caption div span { display: block; }
.photo-caption strong { font-size: .88rem; }
.photo-caption div span { font-size: .79rem; color: var(--muted); }
.photo-index, .skill-index {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: .45rem;
  background: var(--ice);
  color: var(--blue);
  font: 600 .84rem var(--mono);
}
.hero-footer {
  display: flex;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  flex-wrap: wrap;
  padding-block: .95rem;
  border-top: 1px solid var(--line);
  font-size: .86rem;
  font-weight: 650;
}
.hero-footer a { color: var(--blue); text-underline-offset: .25em; }
.availability { display: flex; align-items: center; gap: .55rem; color: var(--green); }
.availability span { flex: none; width: .55rem; height: .55rem; border-radius: 50%; background: var(--green); }

main section:not(#hero) { padding-block: clamp(3rem, 7.5vw, 6rem); }
#about, #skills { background: var(--white); }
#projects, #contact { border-block: 1px solid var(--line); }
.section-label { margin-bottom: .75rem; }
.section-title, .about-text h2, .contact-title { font-size: clamp(1.95rem, 4.4vw, 3.45rem); font-weight: 760; line-height: 1.06; letter-spacing: -.052em; }
.section-title { margin-bottom: 1.6rem; }
.section-intro { color: var(--muted); margin: -1rem 0 1.75rem; }

.about-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: start; gap: clamp(1.5rem, 6vw, 5rem); }
.about-text p { margin-top: 1rem; color: var(--muted); max-width: 64ch; }
.about-text strong { color: var(--ink); }
.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 1.5rem;
}
.stat { display: grid; align-content: start; gap: .2rem; }
.stat-n { color: var(--blue); font-size: 1.35rem; line-height: 1.2; font-weight: 750; }
.stat-l { color: var(--muted); font-size: .85rem; }
.about-tags { padding: 1.35rem; border-radius: .75rem; background: var(--paper); border: 1px solid var(--line); }
.about-tags h3 { margin-bottom: .9rem; font-size: 1.05rem; }

.proj-tech span {
  padding: .23rem .55rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: var(--white);
  color: var(--muted);
  font: .76rem/1.5 var(--mono);
}


.projects-grid, .skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.proj-card, .skill-card {
  padding: clamp(1.1rem, 3vw, 1.7rem);
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--white);
}
.proj-card { display: flex; flex-direction: column; align-items: start; gap: .8rem; }
.proj-card.featured {
  border-top: 3px solid var(--blue);
  background: linear-gradient(155deg, #f0f5fd, var(--white) 68%);
}
.proj-meta { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: .6rem; }
.proj-tag { padding: .25rem .6rem; border-radius: .35rem; background: var(--ice); color: var(--blue-dark); font-size: .76rem; font-weight: 750; }
.proj-year { color: var(--muted); font: .78rem var(--mono); }
.proj-card h3, .skill-card h3 { font-size: 1.13rem; line-height: 1.3; letter-spacing: -.02em; }
.proj-card.featured h3 { font-size: clamp(1.25rem, 2.5vw, 1.65rem); }
.proj-card p, .skill-card ul { color: var(--muted); font-size: .93rem; }
.proj-card p { flex: 1; }
.proj-actions { display: flex; flex-wrap: wrap; gap: .55rem 1.1rem; }
.proj-btn { display: inline-flex; align-items: center; gap: .4rem; color: var(--blue-dark); font-size: .86rem; font-weight: 750; text-underline-offset: .27em; padding-block: .2rem; }
.proj-btn:hover { text-decoration-thickness: 2px; }

.skills-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.skill-card { background: var(--paper); }
.skill-card h3 { margin-block: .9rem .65rem; }
.skill-card ul { display: grid; gap: .36rem; padding-left: 1rem; }
.skill-card li::marker { color: var(--blue); }

#contact { background: var(--ice); }
.contact-inner { text-align: center; }
.contact-sub { margin: 1rem auto 1.4rem; color: var(--muted); max-width: 54ch; }
.contact-links { display: flex; justify-content: center; flex-wrap: wrap; gap: .45rem 1.5rem; margin-top: 1rem; }
.contact-links a { display: inline-flex; align-items: center; gap: .5rem; padding-block: .35rem; color: var(--blue-dark); font-size: .875rem; font-weight: 650; text-underline-offset: .25em; overflow-wrap: anywhere; }
.contact-links svg { width: 1rem; height: 1rem; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem 1rem; padding-block: 1.35rem; color: var(--muted); font-size: .85rem; }
footer a { font-weight: 650; text-underline-offset: .25em; }

@media (max-width: 58rem) {
  .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 48rem) {
  html { scroll-padding-top: 1rem; }
  #nav { position: static; }
  .nav-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding-block: .7rem .35rem; gap: .45rem .75rem; }
  .nav-links { grid-area: 2 / 1 / auto / -1; border-top: 1px solid var(--line); padding-top: .25rem; }
  .hero-inner, .about-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-photo-wrap { width: min(100%, 19rem); }
}
@media (max-width: 35rem) {
  .projects-grid, .skills-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-title { font-size: clamp(2.65rem, 11vw, 4rem); }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
[hidden] { display: none !important; }

.reading-progress {
  position: absolute;
  inset: auto 0 -1px;
  height: 3px;
  background: #4178c4;
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: left;
}
.nav-links a[aria-current="location"] {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: .35em;
  text-decoration-thickness: 2px;
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(6.25rem, 100%), 1fr));
  gap: .45rem;
  list-style: none;
  padding: 0;
}
.tech-grid li {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-height: 2.6rem;
  padding: .4rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: var(--white);
  color: var(--ink);
  font-size: .75rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.tech-grid img, .proj-tech img { flex: none; object-fit: contain; }
.proj-tech { display: flex; flex-wrap: wrap; gap: .45rem; }
.proj-tech span {
  display: inline-flex;
  align-items: center;
  gap: .36rem;
}

.project-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .7rem 1.25rem;
  margin-bottom: 1.05rem;
}
.project-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.project-filters button {
  min-height: 2.5rem;
  padding: .35rem .85rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--white);
  color: var(--ink);
  font: 650 .85rem/1.4 system-ui, sans-serif;
  cursor: pointer;
}
.project-filters button:hover { border-color: var(--blue); }
.project-filters button[aria-pressed="true"] {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
}
.project-count { color: var(--muted); font-size: .85rem; }

.project-visual {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  align-items: center;
  gap: .25rem;
  width: 100%;
  min-height: 5.5rem;
  padding: .35rem .7rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: linear-gradient(125deg, #eaf1fa, #f7fbff);
}
.project-visual span {
  color: var(--blue-dark);
  font: 650 clamp(.64rem, 1.4vw, .75rem)/1.4 var(--mono);
  overflow-wrap: anywhere;
}
.project-visual svg { width: 100%; height: 5.75rem; }
.visual-guide { fill: none; stroke: #bfd0e5; stroke-dasharray: 3 3; }
.visual-shape { fill: #c8dbf4; stroke: #2054a0; stroke-width: 2; }
.visual-corners, .vision-scan { fill: none; stroke: #3477c8; stroke-width: 1.5; }
.vision-scan { stroke: #228168; }
.cluster-a { color: #3164a9; }
.cluster-b { color: #2a806d; }
.project-visual circle { fill: currentColor; }
.project-visual ellipse { fill: currentColor; fill-opacity: .13; stroke: currentColor; stroke-dasharray: 4 3; }

@media (max-width: 48rem) {
  .reading-progress { position: fixed; inset: 0 0 auto; height: 2px; }
}

@media (prefers-reduced-motion: no-preference) {
  .proj-card, .skill-card, .tech-grid li {
    transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
  }
  .proj-card:focus-within, .proj-card:hover, .skill-card:hover {
    border-color: #91add1;
    box-shadow: 0 10px 24px #25446d12;
    transform: translateY(-3px);
  }
  .tech-grid li:hover { border-color: #91add1; transform: translateY(-2px); }
  .proj-card:is(:hover, :focus-within) .vision-scan { animation: scan .8s ease-in-out; }
  .proj-card:is(:hover, :focus-within) .project-visual circle { animation: signal .65s ease-out; }
  .projects-grid.is-filtered .proj-card:not([hidden]) { animation: project-enter .24s ease-out both; }

  @keyframes scan {
    0%, 100% { transform: translateY(0); }
    40% { transform: translateY(-24px); }
    75% { transform: translateY(24px); }
  }
  @keyframes signal {
    0%, 100% { opacity: 1; }
    45% { opacity: .4; }
  }
  @keyframes project-enter {
    from { opacity: .35; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
