:root {
  --text-xs: 0.72rem;
  --text-sm: 0.85rem;
  --text-md: 1rem;
  --text-lg: 1.1rem;
  --text-xl: 1.4rem;
  --text-hero: clamp(2.6rem, 3.6vw, 4rem);
  --text-eyebrow: 0.7rem;
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 14px;
  --space-lg: 20px;
  --space-xl: 28px;
  --space-2xl: 40px;
}

:where(*, *::before, *::after) {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:where(body) {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  color: var(--ink);
  background: var(--bg-body);
  min-height: 100vh;
  line-height: 1.6;
}

:where(body) {
  transition: background 0.4s ease, color 0.4s ease;
}

body {
  opacity: 1;
  transform: none;
}

.js body .page-content {
  transform: translateX(14px) scale(0.995);
}

.js body.page-ready .page-content {
  transform: translateX(0) scale(1);
  transition: transform 280ms cubic-bezier(0.22, 0.8, 0.2, 1);
}

.js body.is-leaving .page-content {
  transform: translateX(-14px) scale(0.995);
  transition: transform 180ms cubic-bezier(0.4, 0, 1, 1);
}

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

a {
  color: inherit;
  text-decoration: none;

  &:hover {
    color: var(--accent);
  }

  &:not(:hover) {
    color: inherit;
  }
}
p {
  margin-bottom: var(--space-md);
}
.noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
  mix-blend-mode: multiply;
  z-index: 0;
}

.bg-shape {
  position: fixed;
  width: 380px;
  height: 380px;
  border-radius: 32% 68% 62% 38% / 42% 45% 55% 58%;
  filter: blur(0.5px);
  z-index: 0;
}

.bg-shape-one {
  top: -80px;
  left: -60px;
  background: var(--shape-one-bg);
  opacity: var(--shape-one-opacity);
}

.bg-shape-two {
  bottom: -120px;
  right: -80px;
  background: var(--shape-two-bg);
  opacity: var(--shape-two-opacity);
}

.page {
  position: relative;
  z-index: 1;
  --page-pad-block: 80px;
  --page-pad-inline: 24px;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--page-pad-block) var(--page-pad-inline) 96px;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.brand {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 1.7vw, 1.75rem);
  font-weight: var(--type-weight-brand);
  line-height: 1.1;
}

.nav-links {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--muted);

  & a {
    position: relative;
    z-index: 1;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    transition: color 0.2s ease, transform 0.2s ease;
  }

  & a[aria-current="page"] {
    border-color: transparent;
    background: transparent;
    color: var(--ink);
    transform: translateY(-1px);
  }
}

.nav-pill-indicator {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1), width 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-sm);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;

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

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

.theme-toggle__icon {
  font-size: 1rem;
  line-height: 1;
}

.hero {
  display: flex;
  align-items: center;
  gap: var(--space-2xl);

  & .hero-identity {
    --hero-photo-size: 160px;
    display: flex;
    align-items: center;
    gap: var(--space-md);
  }

  & .hero-photo {
    width: var(--hero-photo-size);
    height: var(--hero-photo-size);
    border-radius: 100vh;
    overflow: hidden;
    border: 4px solid var(--hero-photo-border);
    box-shadow: var(--hero-photo-shadow);
    transform: none;

    & img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
}

/* Keep these stable across cross-page transitions (About <-> Resume). */
.hero .hero-photo,
.hero .hero-copy h1 {
  view-transition-name: none;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: var(--text-eyebrow);
  color: var(--muted);
  margin-bottom: 12px;
}

h1 {
  font-weight: var(--type-weight-h1);
  font-size: var(--text-hero);
  line-height: 1.05;
  margin-bottom: 12px;
}

.role {
  font-size: var(--text-lg);
  color: var(--muted);
}

.hero-meta {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--card-border);
}

.hero-copy {
  display: grid;
  gap: var(--space-xs);
}

.hero-blurb {
  font-size: var(--text-md);
  max-width: 320px;
  color: var(--muted);
  margin-left: auto;
}

.landing-hero h1 {
text-wrap: balance;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--button-primary-text);
  font-size: var(--text-sm);
  font-weight: 500;
}

.button:hover {
  color: var(--button-primary-text);
}

.button.button-secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.page-content {
  display: grid;
  gap: var(--space-xl);
}

.page-content .service-grid {
  margin-top: 0;
}

.capability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.capability-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 16px;
  display: grid;
  gap: var(--space-xs);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.capability-card:hover,
.capability-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
  border-color: var(--accent);
}

.capability-card:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

.capability-card h3 {
  margin-bottom: 0;
}

.capability-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.contact-form {
  display: grid;
  gap: var(--space-md);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.contact-form label {
  display: grid;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--muted);
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
}

.contact-form textarea {
  resize: vertical;
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
}

.hp-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.hero-links {
  display: grid;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--muted);

  & a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
  }

  & .icon {
    width: 18px;
    height: 18px;
    display: inline-flex;

    & svg {
      width: 100%;
      height: 100%;
      fill: currentColor;
    }
  }
}

.grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) minmax(0, 1fr);
  align-items: start;
  gap: var(--space-xl);
  margin-top: var(--space-2xl);
}

.sidebar {
  display: grid;
  gap: var(--space-md);

  & .card {
    align-self: start;
  }
}

.card {
  --card-pad: 28px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: var(--card-pad);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-soft);

  &:has(.project-grid) {
    --card-pad: 24px;
  }
}

.row {
  display: grid;
  gap: var(--space-md);
  align-content: start;
}

/* Normalize cards that use row-style utility classes (e.g. "card section section row"). */
.card.section.row,
.card.section.section.row {
  display: grid;
  gap: var(--space-md);
  align-content: start;
}

.card.section.row > *:last-child,
.card.section.section.row > *:last-child {
  margin-bottom: 0;
}

h2 {
  font-weight: var(--type-weight-h2);
  font-size: var(--text-xl);
  margin-bottom: var(--space-md);
}

h3 {
  font-size: 1.02rem;
  margin-bottom: var(--space-xs);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: var(--space-lg) 0;
}

.pill-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: 4px;

  & li {
    padding: var(--space-xs) 12px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--muted);
    font-size: var(--text-sm);
  }
}

.stack-list {
  list-style: none;
  display: grid;
  gap: var(--space-sm);
  color: var(--muted);
  font-size: var(--text-sm);
}

.timeline {
  display: grid;
  gap: var(--space-lg);

  & article {
    padding-left: 16px;
    border-left: 2px solid var(--accent-soft);
  }
}

.timeline-heading {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--muted);

  & h3 {
    color: var(--ink);
  }
}

.timeline-date {
  align-self: flex-end;
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.project-grid {
  display: grid;
  gap: var(--space-lg);

  & article {
    background: var(--project-item-bg);
    border-radius: var(--radius-md);
    padding: 18px;
    border: 1px solid var(--project-item-border);
  }

  & span {
    display: block;
    margin-top: var(--space-sm);
    font-size: var(--text-sm);
    color: var(--muted);
  }
}

.site-footer {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-sm);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.site-footer p {
  margin-bottom: 0;
}

.blog-list {
  display: grid;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.blog-card h2 {
  font-size: 1.2rem;
}

.blog-meta {
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.markdown-article {
  max-width: 760px;
  margin-top: var(--space-xl);
}

.markdown-article h1 {
  margin-bottom: var(--space-md);
}

.markdown-article h2 {
  font-size: 1.15rem;
  margin-top: var(--space-xl);
}

.markdown-article ul {
  margin: 0 0 var(--space-md) 22px;
  display: grid;
  gap: var(--space-xs);
}

.markdown-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 6px;
}

@media print {
  @page {
    size: letter;
    margin: 0.25in;
  }

  :root {
    --text-xs: 0.52rem;
    --text-sm: 0.62rem;
    --text-md: 0.74rem;
    --text-lg: 0.82rem;
    --text-xl: 0.92rem;
    --text-hero: 1.7rem;
  }

  :where(body) {
    background: #fff;
    color: #000;
    line-height: 1.22;
  }

  .noise,
  .bg-shape,
  .theme-toggle,
  .top-nav {
    display: none !important;
  }

  .page {
    padding: 0;
    max-width: none;
  }

  .hero {
    gap: 8px;
  }

  .hero-photo {
    width: 64px;
    height: 64px;
    border: 2px solid #ddd;
    box-shadow: none;
  }

  .grid {
    grid-template-columns: minmax(160px, 0.32fr) minmax(0, 1fr);
    gap: 10px;
    margin-top: 8px;
  }

  .card {
    --card-pad: 10px;
    background: transparent;
    border: 1px solid #ddd;
    box-shadow: none;
  }

  .divider {
    margin: 6px 0;
  }

  .hero-links {
    gap: 4px;
  }

  .pill-list li {
    padding: 2px 6px;
    font-size: var(--text-xs);
  }

  .pill-list,
  .stack-list {
    gap: 4px;
  }

  .stack-list,
  .hero-links,
  .timeline-heading {
    font-size: var(--text-xs);
  }

  .timeline {
    gap: 6px;
  }

  .project-grid {
    gap: 6px;
  }

  .project-grid article {
    padding: 8px;
  }

  h1 {
    margin-bottom: 4px;
  }

  h2 {
    margin-bottom: 6px;
  }

  p {
    margin-bottom: 6px;
  }

  .site-footer {
    margin-top: 8px;
    padding-top: 6px;
  }

  .card,
  .timeline article,
  .project-grid article {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  * {
    animation: none !important;
    transition: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js body .page-content,
  .js body.page-ready .page-content,
  .js body.is-leaving .page-content,
  .nav-pill-indicator,
  .nav-links a {
    transition: none !important;
    transform: none !important;
  }
}

@media (max-width: 980px) {
  .top-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

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

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

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

  .content {
    order: 1;
  }

  .sidebar {
    order: 2;
  }

}

@media (max-width: 640px) {
  .page {
    --page-pad-block: 56px;
    --page-pad-inline: 18px;
  }

  .hero-meta {
    padding: 22px;
  }

  .card {
    --card-pad: 22px;
  }

  .theme-toggle {
    top: 16px;
    right: 16px;
  }

  .nav-links {
    gap: 4px;
  }

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