:root {
  color-scheme: light;
  --paper: #f7f7f2;
  --ink: #1b201f;
  --muted: #505953;
  --line: #d9ddd5;
  --accent: #fc6842;
  --accent-text: #ab391f;
  --night: #171f2d;
  --button-bg: #1b201f;
  --button-ink: #fff;
  --button-hover: #394840;
  --mono: ui-monospace, "Cascadia Mono", "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 Arial, Helvetica, sans-serif; }
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; }
img { display: block; max-width: 100%; }
p, h1, h2, h3 { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #b3442a; outline-offset: 5px; }
.symbol-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.shell { width: min(1200px, calc(100% - 112px)); margin-inline: auto; }
.skip { position: absolute; top: 10px; left: 10px; z-index: 3; padding: 10px 16px; background: white; transform: translateY(-160%); }
.skip:focus { transform: none; }

.header { border-bottom: 1px solid var(--line); }
.header-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 74px; gap: 20px; }
.wordmark { display: inline-flex; align-items: center; gap: 11px; justify-self: start; font-size: 16px; font-weight: 750; letter-spacing: -.025em; }
.header nav { display: flex; gap: clamp(20px, 3vw, 44px); font-size: 14px; color: var(--muted); }
.header nav a, .header-contact { padding-block: 10px; }
.header nav a:hover, .header-contact:hover, .text-link:hover, .footer-inner a:hover { color: var(--accent-text); }
.header-actions { justify-self: end; display: flex; align-items: center; gap: 12px; }
.header-contact { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.header-contact .icon { width: 15px; height: 15px; }
.theme-toggle { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: transparent; cursor: pointer; }
.theme-toggle:hover { color: var(--accent-text); border-color: var(--accent-text); }
.theme-toggle .icon { width: 18px; height: 18px; }
.theme-toggle .theme-sun, .dark .theme-toggle .theme-moon { display: none; }
.dark .theme-toggle .theme-sun { display: block; }

.hero { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr); align-items: center; gap: clamp(24px, 4.2vw, 65px); padding-block: clamp(52px, 6.1vw, 87px); }
.hero-copy { padding-bottom: 8px; }
.kicker { color: var(--muted); font: 700 11px/1.5 var(--mono); letter-spacing: .11em; }
.hero .kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.accent-dot { width: 8px; height: 8px; display: inline-block; flex: none; border-radius: 50%; background: var(--accent); }
.kicker-slash { color: #8d968d; }
h1 { max-width: 670px; font-size: clamp(58px, 6.4vw, 96px); line-height: .97; letter-spacing: -.079em; font-weight: 800; }
h1 span { display: block; color: var(--accent-text); }
.intro { margin-top: 27px; max-width: 460px; color: var(--muted); font-size: clamp(16px, 1.55vw, 19px); line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 23px; margin-top: 32px; }
.button { min-height: 49px; display: inline-flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 18px; border-radius: 6px; font-size: 14px; font-weight: 700; transition: background-color .2s ease, color .2s ease; }
.button .icon, .text-link .icon { width: 17px; height: 17px; }
.button-dark { background: var(--button-bg); color: var(--button-ink); }
.button-dark:hover { background: var(--button-hover); }
.button-outline { border: 1px solid var(--line); }
.button-outline:hover { border-color: var(--accent-text); color: var(--accent-text); }
.text-link { display: inline-flex; gap: 7px; align-items: center; padding-block: 12px; font-size: 14px; font-weight: 700; }

.credential { background: #eef0e9; border-block: 1px solid var(--line); }
.credential-icon { width: 42px; height: 42px; border: 1px solid #cdd6cb; border-radius: 8px; display: grid; place-items: center; color: #3c5e4d; background: #f7f8f3; flex: none; }

.section { padding-block: clamp(60px, 7.2vw, 106px); }
.section-kicker { margin-bottom: 12px; }
.section-kicker > span { color: var(--accent-text); }
h2 { font-size: clamp(43px, 5.2vw, 72px); line-height: .99; letter-spacing: -.073em; font-weight: 800; }
h2 > span { color: var(--accent-text); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 34px; }
.section-head > p { color: var(--muted); max-width: 310px; line-height: 1.5; }
.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.project { min-width: 0; display: flex; }
.project-button { display: flex; flex-direction: column; width: 100%; padding: 0; background: #fbfbf8; border: 1px solid #d9ddd5; border-radius: 10px; overflow: hidden; text-align: left; cursor: pointer; transition: border-color .18s, box-shadow .18s; }
.project-button:hover { border-color: #8b998e; box-shadow: 0 8px 22px #272f2110; }
.project-art { position: relative; width: 100%; aspect-ratio: 1.95; display: grid; place-items: center; overflow: hidden; }
.project-art::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(currentColor 1px, transparent 1px); background-size: 13px 13px; opacity: .20; pointer-events: none; }
.art-index { position: absolute; z-index: 1; top: 11px; left: 13px; font: 700 9px/1.3 var(--mono); letter-spacing: .07em; }
.project-art > svg { position: relative; width: 91%; height: auto; margin-top: 16px; }
.project-body { flex: 1; width: 100%; padding: 16px 19px 19px; display: flex; flex-direction: column; }
.project-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 11px; }
.status { padding: 4px 7px; border-radius: 4px; font: 700 9px/1.2 var(--mono); letter-spacing: .07em; }
.status-lab { color: #24554a; background: #e4efe8; }
.status-demo { color: #83412d; background: #f5e8df; }
.project-arrow { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid #dce2d9; border-radius: 50%; transition: background-color .18s, border-color .18s; }
.project-arrow .icon { width: 14px; height: 14px; }
.project-button:hover .project-arrow { background: var(--accent); border-color: var(--accent); }
.project-title { font-size: clamp(18px, 1.8vw, 24px); font-weight: 750; line-height: 1.15; letter-spacing: -.045em; }
.project-desc { display: block; margin: 10px 0 17px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.tag-row { margin-top: auto; display: flex; flex-wrap: wrap; gap: 5px; }
.tag-row > span { font: 600 10px/1.35 var(--mono); color: #505a52; padding: 3px 6px; border: 1px solid #dce2d9; border-radius: 3px; }

.contact { display: flex; align-items: end; justify-content: space-between; gap: 25px; }
.contact-intro { display: flex; align-items: center; gap: 24px; min-width: 0; }
.contact h2 + p { color: var(--muted); max-width: 410px; margin-top: 22px; font-size: 16px; }
.contact-portrait { width: 96px; height: 112px; flex: none; object-fit: cover; object-position: center 44%; border: 1px solid var(--line); border-radius: 9px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 8px; flex: none; }
.contact-links .button { flex: none; }
footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; gap: 14px; justify-content: space-between; align-items: center; min-height: 62px; color: #586259; font: 700 10px/1.4 var(--mono); letter-spacing: .08em; }
.footer-name > span { color: var(--accent-text); margin-inline: 4px; }
.footer-inner a { padding-block: 10px; }

.detail-dialog { width: min(620px, calc(100% - 24px)); max-height: calc(100% - 28px); max-height: calc(100dvh - 28px); padding: 0; overflow: auto; border: 1px solid #d5dbd1; border-radius: 13px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 96px #060e1e65; }
.detail-dialog::backdrop { background: #141d2bbc; }
body:has(.detail-dialog[open]) { overflow: hidden; }
.dialog-inner { position: relative; padding: clamp(23px, 5vw, 42px); }
.close-button { position: absolute; top: 13px; right: 13px; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #ccd5c9; border-radius: 50%; background: #fff; cursor: pointer; }
.close-button:hover { background: #f4dfd6; }
.dialog-inner > .kicker { padding-right: 41px; }
.dialog-inner h2 { margin-bottom: 15px; font-size: clamp(35px, 5vw, 52px); }
.dialog-inner > p:not(.kicker) { color: var(--muted); }
.dialog-inner > h3 { font-size: 18px; margin: 12px 0 5px; }
.dialog-inner .detail-note { margin-top: 16px; font-size: 13px; }

:root.dark {
  color-scheme: dark;
  --paper: #151b24;
  --ink: #f2f3ee;
  --muted: #bec7d0;
  --line: #3a4553;
  --accent-text: #ff9a7e;
  --button-bg: #f4f4ed;
  --button-ink: #1b201f;
  --button-hover: #ffc3ae;
}
.dark :focus-visible { outline-color: var(--accent-text); }
.dark .credential { background: #1b2431; }
.dark .credential-icon { background: #253343; border-color: var(--line); color: #c7e2d3; }
.dark .footer-inner { color: var(--muted); }
.dark .project-button { background: #1d2633; border-color: var(--line); }
.dark .project-button:hover { border-color: #758598; }
.dark .project-arrow, .dark .tag-row > span { border-color: var(--line); }
.dark .project-button:hover .project-arrow { color: #1b201f; border-color: var(--accent); }
.dark .tag-row > span { color: var(--muted); }
.dark .detail-dialog { border-color: var(--line); }
.dark .skip, .dark .close-button { background: #253343; border-color: var(--line); }
.dark .close-button:hover { background: #45566a; }

@media (max-width: 1080px) {
  .shell { width: min(1200px, calc(100% - 76px)); }
  h1 { font-size: clamp(52px, 6.9vw, 79px); }
}

@media (max-width: 780px) {
  .shell { width: calc(100% - 44px); }
  h1 { font-size: clamp(43px, 7.2vw, 64px); }
  .intro { margin-top: 19px; }
  .hero .kicker { font-size: 9px; margin-bottom: 16px; }
  .hero-actions { margin-top: 20px; gap: 4px 14px; }
  .projects { gap: 10px; }
  .project-body { padding: 12px; }
}

@media (max-width: 630px) {
  .shell { width: calc(100% - 36px); }
  .header-inner { min-height: 0; grid-template-columns: 1fr auto; gap: 0 12px; padding-top: 12px; }
  .header nav { grid-row: 2; grid-column: 1 / -1; gap: 23px; padding-block: 4px 3px; }
  .header nav a { padding: 8px 0; }
  .header-contact { font-size: 13px; }
  .wordmark { font-size: 15px; gap: 7px; }
  .wordmark img { width: 30px; height: 30px; }
  .hero-copy { padding-bottom: 0; }
  h1 { font-size: clamp(42px, 11.5vw, 68px); }
  .section { padding-block: 52px; }
  .section-head { display: grid; align-items: start; gap: 12px; margin-bottom: 22px; }
  .projects { grid-template-columns: 1fr; gap: 13px; }
  .project-art { aspect-ratio: 2.15; }
  .project-art > svg { width: min(85%, 325px); }
  .project-body { padding: 14px 16px 16px; }
  .project-title { font-size: 22px; }
  .contact h2 + p { margin-top: 15px; }
  .contact { align-items: start; flex-direction: column; gap: 18px; }
  .contact-intro { gap: 13px; align-items: start; }
  .contact-portrait { width: 65px; height: 79px; }
  .header-actions { gap: 6px; }
  .footer-inner { font-size: 9px; letter-spacing: .025em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

.email-dialog { width: min(485px, calc(100% - 24px)); }
.email-field { display: grid; gap: 5px; color: var(--muted); font: 700 11px/1.4 var(--mono); }
.email-field input { min-width: 0; width: 100%; padding: 10px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); font: 600 clamp(12px, 3.2vw, 14px)/1.4 var(--mono); }
.email-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.email-actions .button { min-height: 40px; padding: 7px 11px; font-size: 12px; cursor: pointer; }
.email-actions .button-dark { border: 1px solid transparent; }
#email-feedback { min-height: 19px; margin-top: 8px; font-size: 12px; }
