:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --border: #d7dee7;
  --border-strong: #bcc7d4;
  --text: #0f172a;
  --muted: #334155;
  --accent: #0f4c81;
  --accent-dark: #0b3a61;
  --accent-soft: #e8f1f8;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 24px rgba(15, 23, 42, 0.06);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --max-width: 1080px;
  --font-sans: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  background: var(--bg);
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--accent-dark);
}

p,
ul,
dl {
  margin: 0;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
  color: var(--text);
  text-wrap: balance;
}

h1,
h2 {
  font-family: var(--font-serif);
}

.page-shell {
  width: min(100% - 2rem, var(--max-width));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-strong);
}

.site-brand {
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.85rem;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color 140ms ease, background-color 140ms ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface);
}

main {
  display: grid;
  gap: 1.5rem;
}

.hero,
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.hero {
  display: grid;
  padding: 2rem;
}

.hero-copy {
  display: grid;
  gap: 1.05rem;
  align-content: start;
}

.hero-heading,
.hero-details {
  display: grid;
  gap: 0.9rem;
}

.hero-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  gap: 1.35rem;
  align-items: stretch;
}

.hero h1 {
  font-size: clamp(2.7rem, 5vw, 4.25rem);
}

.hero-intro,
.lead {
  max-width: 64ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.72rem 1rem;
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #ffffff;
}

.button.button-secondary {
  color: var(--accent);
  background: var(--surface);
  border-color: var(--accent);
}

.button.button-secondary:hover {
  color: #ffffff;
  background: var(--accent);
}

.button.button-disabled {
  color: var(--muted);
  background: var(--surface-subtle);
  border-color: var(--border-strong);
  cursor: not-allowed;
}

.hero-panel {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.hero-photo-panel {
  position: relative;
  align-self: stretch;
  justify-self: end;
  width: 100%;
  max-width: 220px;
  box-sizing: border-box;
  min-height: 0;
}

.portrait {
  position: absolute;
  inset: 0.75rem;
  width: calc(100% - 1.5rem);
  height: calc(100% - 1.5rem);
  min-height: 0;
  display: block;
  object-fit: cover;
  object-position: 42% center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.hero-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.3rem;
}

.hero-facts div {
  display: grid;
  gap: 0.35rem;
  min-height: 100%;
  padding: 0.85rem 0.9rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.hero-facts dt {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-facts dd {
  margin: 0.3rem 0 0;
  color: var(--text);
}

.section-card {
  display: grid;
  gap: 1.25rem;
  padding: 1.8rem;
}

.section-heading {
  display: grid;
  gap: 0.4rem;
}

.section-heading p:last-child {
  color: var(--muted);
}

.about-section {
  gap: 1rem;
}

.about-section .lead {
  max-width: 72ch;
}

.about-section .focus-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.focus-grid,
.skills-grid,
.project-grid,
.resume-layout,
.resume-projects,
.project-list {
  display: grid;
  gap: 1.15rem;
}

.focus-grid,
.skills-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.skills-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.project-grid {
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
}

.project-list {
  grid-template-columns: 1fr;
}

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

.mini-card,
.project-card,
.download-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.mini-card {
  padding: 1.15rem;
}

.mini-card h3 {
  margin-bottom: 0.35rem;
  font-size: 1.02rem;
}

.mini-card p,
.resume-entry p,
.project-summary {
  color: var(--muted);
}

.project-card {
  display: grid;
  gap: 1rem;
  height: 100%;
  padding: 1.45rem;
}

.project-card-detailed {
  padding: 1.7rem;
}

.project-card-header {
  display: grid;
  gap: 0.5rem;
}

.project-card-header h2 {
  font-size: 1.48rem;
}

.project-card-header h3 {
  font-size: 1.18rem;
  line-height: 1.25;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-year,
.project-badge,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.84rem;
  border-radius: var(--radius-sm);
}

.project-year {
  color: var(--muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.project-badge {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #c8daea;
  font-weight: 700;
}

.tag-list,
.highlight-list {
  padding: 0;
  list-style: none;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  color: var(--text);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.highlight-list {
  display: grid;
  gap: 0.5rem;
}

.highlight-list li {
  margin-left: 1.15rem;
  color: var(--muted);
  padding-left: 0.15rem;
}

.project-links,
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.project-links {
  align-items: center;
  margin-top: auto;
  padding-top: 0.15rem;
}

.project-note,
.contact-note {
  color: var(--muted);
}

.page-intro {
  gap: 0.85rem;
}

.page-intro .lead {
  max-width: none;
}

.resume-page,
.resume-entry,
.resume-projects {
  display: grid;
  gap: 1rem;
}

.resume-page {
  gap: 1rem;
}

.resume-viewer-card {
  gap: 1rem;
  padding: 1.25rem;
}

.resume-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.resume-teaser {
  display: flex;
  justify-content: center;
}

.resume-teaser .button-row {
  width: 100%;
  justify-content: center;
}

.resume-cta-button {
  min-width: 240px;
  justify-content: center;
  box-shadow: 0 0 0 0 rgba(15, 76, 129, 0.28);
  animation: resume-cta-pulse 2.2s ease-out infinite;
}

.projects-cta-button {
  position: relative;
  overflow: hidden;
  border-color: var(--accent-dark);
  animation: projects-cta-shift 2.8s ease-in-out infinite;
}

.projects-cta-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 20%, rgba(15, 76, 129, 0.12) 50%, transparent 80%);
  transform: translateX(-120%);
  animation: projects-cta-sheen 2.8s ease-in-out infinite;
}

.resume-embed-shell {
  display: grid;
  gap: 0.75rem;
}

.resume-frame {
  width: 100%;
  min-height: 1100px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.resume-fallback {
  font-size: 0.94rem;
}

#contact {
  scroll-margin-top: 1.5rem;
}

@keyframes resume-cta-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(15, 76, 129, 0.24);
    transform: translateY(0);
  }

  60% {
    box-shadow: 0 0 0 10px rgba(15, 76, 129, 0);
    transform: translateY(-1px);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(15, 76, 129, 0);
    transform: translateY(0);
  }
}

@keyframes projects-cta-shift {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-1px);
  }
}

@keyframes projects-cta-sheen {
  0%,
  55% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(120%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .resume-cta-button,
  .projects-cta-button,
  .projects-cta-button::after {
    animation: none;
  }
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.7rem;
  padding: 0.68rem 0.95rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
}

.contact-links a:hover {
  color: #ffffff;
  background: var(--accent);
}

.contact-links.stacked {
  display: grid;
  gap: 0.75rem;
}

.site-footer {
  padding-top: 1.25rem;
  text-align: right;
}

.site-footer a {
  color: var(--muted);
}

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

.stats dt {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats dd {
  margin: 0.2rem 0 0;
}

#scrollytelling,
#files-scrollytelling {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 1rem;
}

#scroll-container,
#file-scroll-container {
  position: relative;
  max-height: 30rem;
  overflow: auto;
  padding-right: 0.5rem;
}

#chart,
.files,
.tooltip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

#chart,
.files {
  min-height: 18rem;
  padding: 1rem;
}

.files {
  display: grid;
  gap: 0.75rem;
}

.files dt code {
  font-family: "SFMono-Regular", "Menlo", monospace;
}

.tooltip {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
}

.tooltip dt {
  font-weight: 700;
}

.tooltip dd {
  margin: 0 0 0.65rem;
}

#spacer,
#file-spacer {
  width: 100%;
  background: none;
  pointer-events: none;
}

#items-container,
#file-items-container {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
}

.file-item {
  min-height: 120px;
  box-sizing: border-box;
  padding-right: 0.5rem;
  border-bottom: 1px solid var(--border);
}

#scroll-indicator,
#selection-count {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

@media (max-width: 900px) {
  #scrollytelling,
  #files-scrollytelling,
  .download-panel {
    grid-template-columns: 1fr;
  }

  .hero-main {
    grid-template-columns: minmax(0, 1fr) minmax(140px, 180px);
  }

  .hero-facts,
  .about-section .focus-grid {
    grid-template-columns: 1fr;
  }

  .download-panel {
    align-items: start;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 1rem, var(--max-width));
  }

  .site-header {
    align-items: start;
    flex-direction: column;
    gap: 0.5rem;
  }

  .hero,
  .section-card {
    padding: 1.35rem;
  }

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

  .hero-photo-panel {
    align-self: start;
    justify-self: start;
    max-width: min(220px, 100%);
  }

  .portrait {
    position: static;
    width: 100%;
    aspect-ratio: 1 / 1.18;
    height: auto;
  }

  .hero h1 {
    font-size: clamp(2.35rem, 11vw, 3.25rem);
  }

  .site-nav ul,
  .button-row,
  .resume-actions,
  .project-links,
  .contact-links {
    width: 100%;
  }

  .site-nav a,
  .button,
  .resume-actions .button,
  .project-links .button,
  .contact-links a {
    width: 100%;
  }

  .project-grid,
  .skills-grid,
  .focus-grid,
  .skills-grid.compact {
    grid-template-columns: 1fr;
  }
}
