:root {
  color-scheme: light dark;
  --canvas: #f5f5f6;
  --surface: #ffffff;
  --surface-muted: #eaeaed;
  --surface-strong: #dedee2;
  --ink: #171719;
  --ink-muted: #65656d;
  --border: #d5d5da;
  --accent: #242428;
  --accent-ink: #ffffff;
  --focus: #5f6368;
  --radius: 1.25rem;
  --shadow: 0 1.2rem 3.5rem rgb(20 20 24 / 9%);
  --content: 76rem;
  --mobile-nav-height: 0rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0c0c0e; --surface: #171719; --surface-muted: #222226; --surface-strong: #2b2b30;
    --ink: #f5f5f6; --ink-muted: #aaaab1; --border: #35353b; --accent: #f1f1f3; --accent-ink: #111113;
    --focus: #d2d2d7; --shadow: 0 1.2rem 3.5rem rgb(0 0 0 / 32%);
  }
}

:root[data-theme="dark"] {
  --canvas: #0c0c0e; --surface: #171719; --surface-muted: #222226; --surface-strong: #2b2b30;
  --ink: #f5f5f6; --ink-muted: #aaaab1; --border: #35353b; --accent: #f1f1f3; --accent-ink: #111113;
  --focus: #d2d2d7; --shadow: 0 1.2rem 3.5rem rgb(0 0 0 / 32%);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 6rem; }
body { margin: 0; background: var(--canvas); color: var(--ink); line-height: 1.6; padding-bottom: var(--mobile-nav-height); }
body:has(dialog[open]) { overflow: hidden; }
a { color: inherit; text-underline-offset: .2em; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .75rem 1rem; background: var(--accent); color: var(--accent-ink); }
.skip-link:focus { top: 1rem; }
.site-header, main, footer { width: min(calc(100% - 2rem), var(--content)); margin-inline: auto; }
.site-header { position: sticky; top: .75rem; z-index: 30; min-height: 4.5rem; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: .6rem .75rem; border: 1px solid color-mix(in srgb, var(--border) 80%, transparent); border-radius: 1.15rem; background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: 0 .5rem 2rem rgb(20 20 24 / 7%); backdrop-filter: blur(1rem); }
.wordmark { display: inline-flex; align-items: center; gap: .75rem; font-weight: 760; text-decoration: none; letter-spacing: -.02em; }
.wordmark-mark { display: grid; place-items: center; width: 2.35rem; aspect-ratio: 1; border: 1px solid var(--border); border-radius: .7rem; background: var(--surface-muted); font-size: .75rem; }
.desktop-nav { display: flex; gap: .25rem; }
.desktop-nav a { padding: .6rem .8rem; color: var(--ink-muted); font-size: .9rem; font-weight: 650; text-decoration: none; }
.desktop-nav a:hover { color: var(--ink); }
.header-actions { display: flex; justify-content: flex-end; align-items: center; gap: .4rem; }
.quiet-button, .primary-button, .icon-button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.7rem; border-radius: 999px; font-weight: 700; text-decoration: none; cursor: pointer; }
.quiet-button { padding: .6rem 1rem; border: 1px solid var(--border); background: var(--surface); }
.primary-button { padding: .65rem 1.15rem; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); }
.icon-button { width: 2.7rem; padding: 0; border: 1px solid var(--border); background: var(--surface); font-size: 1.15rem; }
.quiet-button:hover, .icon-button:hover { background: var(--surface-muted); }
.primary-button:hover { filter: contrast(1.15); }

.hero { min-height: min(46rem, calc(100svh - 5rem)); padding: 5rem 0; }
.hero-grid { display: grid; grid-template-columns: repeat(12, 1fr); align-items: center; gap: 1.25rem; }
.hero-copy-block { grid-column: span 8; }
.profile-card { grid-column: span 4; align-self: stretch; display: flex; flex-direction: column; padding: .65rem; border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.1); background: var(--surface); box-shadow: var(--shadow); }
.portrait-wrap { position: relative; overflow: hidden; border-radius: .95rem; background: var(--surface-muted); aspect-ratio: 1 / 1.08; }
.portrait-wrap img { width: 100%; height: 100%; object-fit: cover; object-position: center; filter: saturate(.72) contrast(1.04); }
.portrait-wrap span { position: absolute; left: .75rem; bottom: .75rem; padding: .4rem .65rem; border-radius: 999px; background: rgb(18 18 20 / 78%); color: #fff; font-size: .68rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; backdrop-filter: blur(.5rem); }
.profile-card-copy { padding: 1.3rem .75rem 1rem; }
.profile-card-copy .eyebrow { margin-bottom: .35rem; }
.profile-card-copy h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.profile-card-copy > p:last-child { margin: .55rem 0 0; color: var(--ink-muted); }
.eyebrow { margin: 0 0 1rem; color: var(--ink-muted); font-size: .75rem; font-weight: 780; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; line-height: 1.04; letter-spacing: -.045em; }
h1 { max-width: 13ch; overflow-wrap: anywhere; font-size: clamp(3.5rem, 7.6vw, 7.25rem); }
h2 { font-size: clamp(2.25rem, 5vw, 4.4rem); }
h3 { font-size: 1.55rem; }
.hero-copy { max-width: 42rem; margin: 1.75rem 0 0; color: var(--ink-muted); font-size: clamp(1.05rem, 2vw, 1.32rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 2rem; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 42rem; margin: 2.75rem 0 0; }
.hero-stats div { padding-right: 1rem; border-right: 1px solid var(--border); }
.hero-stats div + div { padding-left: 1rem; }
.hero-stats div:last-child { border-right: 0; }
.hero-stats dt { overflow: hidden; font-size: 1.2rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.hero-stats dd { margin: .15rem 0 0; color: var(--ink-muted); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

.section { padding: 7rem 0; border-top: 1px solid var(--border); }
.section-heading { display: grid; gap: .25rem; margin-bottom: 2.75rem; }
.horizontal-heading { grid-template-columns: 1fr minmax(16rem, 28rem); align-items: end; }
.horizontal-heading > p { margin: 0; color: var(--ink-muted); }
.about-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.25rem; }
.about-grid .section-heading { grid-column: span 4; }
.about-copy { grid-column: 5 / -1; }
.about-copy > p { margin: 0; white-space: pre-line; color: var(--ink-muted); font-size: clamp(1.05rem, 1.8vw, 1.3rem); }
.expertise-list { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 2rem; }
.expertise-list span { padding: .5rem .75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: .85rem; font-weight: 680; }
.project-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem; }
.project-card { grid-column: span 6; min-height: 20rem; display: flex; flex-direction: column; padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.project-card p { color: var(--ink-muted); }
.project-card > a { margin-top: auto; font-weight: 750; }
.card-meta { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 4rem; color: var(--ink-muted); font-size: .82rem; }
.empty-state { padding: 3rem; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--ink-muted); text-align: center; }
.contact-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-block: 4rem 8rem; padding: clamp(2rem, 6vw, 5rem); border-radius: calc(var(--radius) * 1.5); background: var(--surface-muted); }
.contact-panel h2 { max-width: 12ch; }
.contact-panel p:not(.eyebrow) { max-width: 36rem; margin: 0 0 1.5rem; color: var(--ink-muted); }
footer { display: flex; justify-content: space-between; gap: 1rem; padding: 2rem 0 calc(2rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); color: var(--ink-muted); font-size: .9rem; }
.legal-page { min-height: 70svh; max-width: 52rem; padding: 8rem 0; }
.legal-page p:not(.eyebrow) { color: var(--ink-muted); font-size: 1.12rem; }

.mobile-nav { display: none; }
.contact-fab { position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: 1rem; z-index: 45; width: 3.5rem; aspect-ratio: 1; border: 1px solid var(--accent); border-radius: 50%; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); font-size: 1.45rem; cursor: pointer; }
.contact-sheet { width: min(calc(100% - 2rem), 38rem); max-height: min(52rem, calc(100svh - 2rem)); padding: 0; border: 1px solid var(--border); border-radius: 1.5rem; background: var(--surface); color: var(--ink); box-shadow: 0 2rem 6rem rgb(0 0 0 / 35%); }
.contact-sheet::backdrop { background: rgb(0 0 0 / 55%); backdrop-filter: blur(.25rem); }
.sheet-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.5rem 1.5rem 1rem; }
.sheet-header .eyebrow { margin-bottom: .4rem; }
.sheet-header h2 { font-size: 2rem; }
.contact-sheet form { display: grid; gap: 1rem; padding: 1rem 1.5rem 1.5rem; overflow: auto; }
.contact-sheet label:not(.consent-row) { display: grid; gap: .4rem; font-size: .85rem; font-weight: 700; }
.contact-sheet input:not([type="checkbox"]), .contact-sheet textarea { width: 100%; padding: .8rem .9rem; border: 1px solid var(--border); border-radius: .75rem; background: var(--canvas); color: var(--ink); }
.contact-sheet textarea { resize: vertical; }
.consent-row { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: .65rem; color: var(--ink-muted); font-size: .82rem; }
.consent-row input { margin-top: .25rem; }
.sheet-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.sheet-actions p { margin: 0; color: var(--ink-muted); font-size: .85rem; }

@media (max-width: 60rem) {
  .hero-copy-block { grid-column: span 7; }
  .profile-card { grid-column: span 5; }
  .desktop-nav { display: none; }
  .site-header { grid-template-columns: 1fr auto; }
}

@media (max-width: 52rem) {
  :root { --mobile-nav-height: calc(5.25rem + env(safe-area-inset-bottom)); }
  html { scroll-padding-top: 5rem; }
  .site-header { top: .35rem; }
  .desktop-contact { display: none; }
  .hero { min-height: auto; padding: 4.5rem 0 5.5rem; }
  .hero-copy-block, .profile-card { grid-column: 1 / -1; }
  .profile-card { display: grid; grid-template-columns: 10rem 1fr; align-items: center; }
  .portrait-wrap { aspect-ratio: 1; }
  .about-grid .section-heading, .about-copy { grid-column: 1 / -1; }
  .horizontal-heading { grid-template-columns: 1fr; }
  .project-card { grid-column: 1 / -1; min-height: 17rem; }
  .contact-panel { grid-template-columns: 1fr; }
  .contact-fab { right: 1rem; bottom: calc(var(--mobile-nav-height) + .75rem); }
  .mobile-nav { position: fixed; left: .5rem; right: .5rem; bottom: max(.5rem, env(safe-area-inset-bottom)); z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr); min-height: 4.5rem; padding: .35rem; border: 1px solid var(--border); border-radius: 1rem; background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(1rem); }
  .mobile-nav a, .mobile-nav button { display: grid; place-items: center; align-content: center; gap: .12rem; min-width: 0; padding: .25rem; border: 0; border-radius: .75rem; background: transparent; color: var(--ink-muted); font-size: .7rem; text-decoration: none; cursor: pointer; }
  .mobile-nav a > span:first-child, .mobile-nav button > span:first-child { color: var(--ink); font-size: 1.15rem; }
  footer { padding-bottom: 2rem; }
}

@media (max-width: 34rem) {
  .site-header { min-height: 4.25rem; }
  .wordmark > span:last-child { display: none; }
  .header-actions { gap: .3rem; }
  .quiet-button, .primary-button { min-height: 2.55rem; padding-inline: .85rem; }
  h1 { font-size: clamp(3rem, 14vw, 4.5rem); }
  .hero-stats { grid-template-columns: 1fr; gap: .75rem; }
  .hero-stats div, .hero-stats div + div { padding: 0 0 .75rem; border-right: 0; border-bottom: 1px solid var(--border); }
  .profile-card { grid-template-columns: 7.5rem 1fr; }
  .section { padding: 5rem 0; }
  .project-grid { grid-template-columns: repeat(4, 1fr); }
  .contact-panel { margin-bottom: 4rem; }
  .contact-sheet { width: 100%; max-width: none; height: 100svh; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .sheet-actions { align-items: stretch; flex-direction: column; }
  .sheet-actions .primary-button { width: 100%; }
}

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