:root {
  color-scheme: dark;
  --background: #101010;
  --surface: #191919;
  --surface-card: #222222;
  --text-primary: #f2f2f2;
  --text-secondary: #999999;
  --border: #333333;
  --highlight: #ffffff;
  --font-display: "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --page-width: 1440px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--background); color: var(--text-primary); font-family: var(--font-body); line-height: 1.55; overflow-x: hidden; }
body.modal-open, body.chat-open { overflow: hidden; }
button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
img { display: block; max-width: 100%; }
::selection { color: var(--background); background: var(--text-primary); }
:focus-visible { outline: 2px solid var(--highlight); outline-offset: 4px; }
.page-shell { width: min(calc(100% - 112px), var(--page-width)); margin-inline: auto; }
.visually-hidden, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; z-index: 1000; top: 12px; left: 12px; padding: 12px 16px; background: var(--text-primary); color: var(--background); }
.eyebrow, .project-number, .status, .ownership-label, .text-link, .site-footer, .about-portrait figcaption { font: 500 10px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }

/* Navigation */
.site-header { position: sticky; top: 0; z-index: 30; min-height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 56px; border-bottom: 1px solid var(--border); background: rgb(16 16 16 / 94%); backdrop-filter: blur(12px); }
.brand { display: inline-flex; align-items: center; gap: 12px; font: 500 11px var(--font-mono); letter-spacing: .1em; }
.primary-nav { display: flex; align-items: center; gap: 38px; }
.primary-nav a { color: var(--text-secondary); font-size: 13px; transition: color .2s ease; }
.primary-nav a:hover { color: var(--highlight); }
.mobile-menu-toggle { display: none; }

/* Hero */
.hero { position: relative; min-height: min(910px, calc(100svh - 76px)); display: flex; flex-direction: column; justify-content: center; padding-top: 92px; padding-bottom: 104px; }
.hero > .eyebrow { margin: 0 0 42px; color: var(--text-secondary); }
.hero-title { max-width: 1300px; margin: 0 0 73px -8px; font: 600 clamp(64px, 10.7vw, 158px)/.86 var(--font-display); letter-spacing: -.095em; text-transform: uppercase; }
.period { color: var(--text-secondary); }
.hero-bottom { display: grid; grid-template-columns: minmax(230px, .8fr) 1.2fr; gap: 60px; border-top: 1px solid var(--border); padding-top: 24px; }
.identity-line { margin: 2px 0; color: var(--text-secondary); font: 500 10px/1.6 var(--font-mono); letter-spacing: .06em; }
.identity-line span { color: var(--highlight); padding-inline: 4px; }
.hero-copy-cta { max-width: 660px; }
.hero-copy-cta p { max-width: 630px; margin: 0; color: #c5c5c5; font-size: clamp(15px, 1.4vw, 18px); line-height: 1.7; }
.text-link { display: inline-flex; align-items: center; gap: 18px; width: fit-content; padding-bottom: 8px; border-bottom: 1px solid #777; transition: gap .25s ease, border-color .25s ease; }
.text-link:hover { gap: 26px; border-color: var(--highlight); }
.hero-copy-cta .text-link { margin-top: 32px; }
.hero-index { position: absolute; bottom: 35px; right: 0; color: #626262; font: 10px var(--font-mono); letter-spacing: .08em; }

/* Section headings and grids */
.projects, .about, .contact { padding-top: 132px; }
.section-heading { display: grid; grid-template-columns: minmax(180px, .75fr) 1.25fr; align-items: end; gap: 40px; padding-bottom: 28px; border-bottom: 1px solid var(--border); }
.section-heading .eyebrow { margin: 0 0 8px; color: var(--text-secondary); }
.section-heading h2 { margin: 0; font: 500 clamp(42px, 7vw, 94px)/.92 var(--font-display); letter-spacing: -.075em; text-transform: uppercase; }
.projects-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 52px 24px; margin-top: 38px; }
.project-card { display: block; min-width: 0; width: 100%; padding: 0; border: 0; text-align: left; cursor: pointer; background: transparent; color: var(--text-primary); }
.card-art { position: relative; display: block; aspect-ratio: 1.43 / 1; overflow: hidden; background: var(--surface-card); }
.card-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .65s cubic-bezier(.2,.7,.2,1), filter .4s ease; }
.card-art.is-portrait { background-image: var(--gallery-backdrop); background-position: center; background-size: cover; }
.card-art.is-portrait::before, .modal-gallery.is-portrait::before { position: absolute; z-index: 0; inset: -14px; content: ""; background: var(--gallery-backdrop) center / cover; filter: blur(18px) brightness(.38); transform: scale(1.05); }
.card-art.is-portrait .card-image { position: relative; z-index: 1; width: auto; max-width: 48%; height: calc(100% - 18px); margin: 9px auto; border-radius: 9px; object-fit: contain; box-shadow: 0 12px 30px rgb(0 0 0 / 55%); }
.project-card:hover .card-art img { transform: scale(1.035); filter: brightness(1.15); }
.art-mark { position: absolute; z-index: 2; left: 20px; bottom: 16px; color: rgb(255 255 255 / 45%); font: 500 clamp(34px, 7vw, 90px)/1 var(--font-mono); letter-spacing: -.1em; mix-blend-mode: screen; }
.open-mark { position: absolute; z-index: 2; top: 16px; right: 16px; display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgb(255 255 255 / 40%); border-radius: 50%; background: rgb(16 16 16 / 35%); font-size: 18px; transition: color .2s ease, background .2s ease, transform .2s ease; }
.project-card:hover .open-mark { color: var(--background); background: var(--text-primary); transform: rotate(45deg); }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 17px; color: var(--text-secondary); }
.project-number { color: #858585; }
.status { display: inline-flex; align-items: center; gap: 7px; color: #c4c4c4; letter-spacing: .04em; }
.status i { width: 5px; height: 5px; border-radius: 50%; background: #aaa; }
.card-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; min-width: 0; margin-top: 9px; }
.card-title { min-width: 0; overflow-wrap: anywhere; font: 500 clamp(25px, 3.2vw, 44px)/1 var(--font-display); letter-spacing: -.06em; }
.ownership-label { flex: 0 0 auto; color: var(--text-secondary); font-size: 9px; }
.card-description { display: block; max-width: 570px; margin-top: 11px; color: var(--text-secondary); font-size: 13px; line-height: 1.65; }

/* About and contact */
.about-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(40px, 9vw, 140px); align-items: center; padding-top: 45px; }
.about-portrait { margin: 0; max-width: 490px; }
.about-portrait img { width: 100%; max-height: 620px; object-fit: cover; filter: grayscale(100%); }
.about-portrait figcaption { display: flex; justify-content: space-between; gap: 10px; margin-top: 13px; color: #d0d0d0; font-size: 9px; }
.about-portrait figcaption span { color: var(--text-secondary); text-align: right; }
.about-copy { position: relative; max-width: 670px; padding: 10px 0 35px; }
.about-copy p { margin: 0 0 24px; font-size: clamp(19px, 2.5vw, 32px); line-height: 1.3; letter-spacing: -.04em; }
.about-copy p + p { color: #b5b5b5; }
.about-index { position: absolute; bottom: 0; right: 0; color: var(--text-secondary); font: 10px var(--font-mono); letter-spacing: .08em; }
.contact { padding-bottom: 140px; }
.contact .section-heading { grid-template-columns: .65fr 1.35fr; }
.contact .section-heading h2 { font-size: clamp(44px, 8vw, 112px); }
.contact-bottom { display: grid; grid-template-columns: .65fr 1.35fr; gap: 40px; align-items: start; padding-top: 33px; }
.contact-bottom > p { max-width: 270px; margin: 0; color: var(--text-secondary); font-size: 14px; }
.email-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-width: 0; padding-bottom: 16px; border-bottom: 1px solid #777; font: 500 clamp(21px, 3.4vw, 46px)/1.2 var(--font-display); letter-spacing: -.045em; overflow-wrap: anywhere; transition: color .2s ease; }
.email-link:hover { color: #bdbdbd; }
.email-link span { font: 18px var(--font-mono); }

/* Footer */
.site-footer { min-height: 80px; display: grid; grid-template-columns: 1fr auto auto auto auto; gap: 28px; align-items: center; padding-top: 20px; padding-bottom: 20px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 9px; }
.site-footer > span:first-child { color: var(--text-primary); }
.site-footer a { transition: color .2s ease; }
.site-footer a:hover { color: var(--highlight); }

/* Project dialog */
.project-dialog { width: min(900px, calc(100% - 32px)); max-width: none; max-height: min(88svh, 1000px); padding: 0; border: 1px solid #4a4a4a; background: var(--surface); color: var(--text-primary); overflow: visible; }
.project-dialog::backdrop { background: rgb(0 0 0 / 78%); backdrop-filter: blur(5px); }
.dialog-shell { position: relative; max-height: min(88svh, 1000px); overflow-y: auto; overscroll-behavior: contain; }
.dialog-close { position: sticky; z-index: 3; top: 14px; float: right; width: 44px; height: 44px; margin: 14px 14px -58px 0; border: 1px solid #777; border-radius: 50%; background: rgb(16 16 16 / 85%); color: var(--text-primary); font-size: 28px; line-height: 1; cursor: pointer; }
.dialog-close:hover { background: var(--text-primary); color: var(--background); }
.modal-project { padding: 0 44px 48px; }
.modal-gallery { position: relative; width: calc(100% + 88px); height: min(34vh, 300px); margin: 0 -44px 32px; overflow: hidden; background: var(--surface-card); }
.modal-cover { position: relative; z-index: 1; display: block; width: 100%; height: 100%; margin: 0; object-fit: contain; }
.modal-gallery.is-portrait .modal-cover { width: auto; max-width: 48%; height: 100%; margin-inline: auto; object-fit: contain; box-shadow: 0 12px 30px rgb(0 0 0 / 55%); }
.gallery-arrow { position: absolute; z-index: 2; top: 50%; display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid rgb(255 255 255 / 45%); border-radius: 50%; background: rgb(16 16 16 / 72%); color: var(--text-primary); font-size: 20px; cursor: pointer; transform: translateY(-50%); }
.gallery-arrow:hover { background: var(--text-primary); color: var(--background); }
.gallery-previous { left: 14px; }
.gallery-next { right: 14px; }
.gallery-count { position: absolute; z-index: 2; right: 14px; bottom: 12px; padding: 5px 8px; background: rgb(16 16 16 / 72%); color: var(--text-primary); font: 10px var(--font-mono); letter-spacing: .06em; }
.modal-project > .eyebrow { color: var(--text-secondary); }
.modal-project > h2 { margin: 12px 0 30px; font: 500 clamp(42px, 8vw, 88px)/.95 var(--font-display); letter-spacing: -.08em; }
.modal-section { display: grid; grid-template-columns: 180px 1fr; gap: 25px; padding: 22px 0; border-top: 1px solid var(--border); }
.modal-section h3 { margin: 0; color: var(--text-secondary); font: 500 10px/1.5 var(--font-mono); letter-spacing: .08em; }
.modal-section p { margin: 0; max-width: 570px; color: #d0d0d0; font-size: 15px; line-height: 1.7; white-space: pre-line; }
.tech-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tech-list li { padding: 7px 10px; border: 1px solid var(--border); color: #ccc; font: 10px var(--font-mono); }
.modal-links { display: flex; align-items: flex-start; }
.modal-links a { color: var(--text-primary); font: 10px var(--font-mono); text-decoration: underline; text-underline-offset: 4px; }

/* Legacy project URLs remain usable while the homepage uses overlays. */
.section-container { width: min(calc(100% - 112px), var(--page-width)); margin-inline: auto; }
.site-header .logo { display: inline-flex; align-items: center; gap: 10px; font: 500 11px var(--font-mono); letter-spacing: .1em; }
.project-hero { padding-top: 62px; padding-bottom: 55px; }
.back-link { display: inline-block; margin-bottom: 50px; color: var(--text-secondary); font: 10px var(--font-mono); letter-spacing: .08em; }
.project-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.project-meta span { padding: 7px 9px; border: 1px solid var(--border); color: var(--text-secondary); font: 9px var(--font-mono); }
.project-page-title { margin: 0; font: 500 clamp(54px, 11vw, 130px)/.9 var(--font-display); letter-spacing: -.08em; }
.project-page-description { max-width: 760px; margin: 30px 0 0; color: #bbb; font-size: clamp(19px, 3vw, 28px); line-height: 1.3; }
.project-content { padding-top: 10px; padding-bottom: 70px; }
.project-detail-block { display: grid; grid-template-columns: 180px 1fr; gap: 25px; padding: 24px 0; border-top: 1px solid var(--border); }
.detail-label { color: var(--text-secondary); font: 10px var(--font-mono); letter-spacing: .08em; }
.detail-content { max-width: 700px; }
.detail-content p { margin: 0; color: #d0d0d0; font-size: 16px; line-height: 1.65; }
.project-tech-list { display: flex; flex-wrap: wrap; gap: 8px; }
.project-tech-list span { padding: 7px 10px; border: 1px solid var(--border); color: #ccc; font: 10px var(--font-mono); }
.project-links { display: flex; gap: 15px; padding-top: 25px; }
.project-external-link { padding: 10px 14px; border: 1px solid #777; font: 10px var(--font-mono); }

/* Chat */
.chat-launcher { position: fixed; right: 26px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 25; display: flex; align-items: center; gap: 10px; padding: 14px 18px; border: 1px solid var(--text-primary); background: var(--text-primary); color: var(--background); box-shadow: 0 10px 35px rgb(0 0 0 / 35%); font: 500 10px var(--font-mono); letter-spacing: .07em; cursor: pointer; transition: transform .2s ease, bottom .2s ease, background .2s ease; }
.chat-launcher.footer-visible { bottom: calc(var(--footer-height, 80px) + 12px + env(safe-area-inset-bottom, 0px)); }
.chat-launcher:hover { transform: translateY(-3px); background: #d7d7d7; }
.chat-launcher span { font-size: 17px; }
.chat-overlay { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end; overflow: hidden; background: rgb(0 0 0 / 0%); visibility: hidden; pointer-events: none; transition: background .25s ease, visibility .25s; }
.chat-overlay.active { background: rgb(0 0 0 / 65%); visibility: visible; pointer-events: auto; }
.chat-panel { width: min(520px, 100%); height: 100vh; height: 100dvh; min-width: 0; min-height: 0; display: flex; flex-direction: column; border-left: 1px solid #444; background: var(--surface); transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.7,.2,1); }
.chat-overlay.active .chat-panel { transform: translateX(0); }
.chat-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 27px 28px 22px; border-bottom: 1px solid var(--border); }
.chat-header .eyebrow { margin: 0 0 7px; color: var(--text-secondary); }
.chat-header h2 { margin: 0; font: 500 30px var(--font-display); letter-spacing: -.05em; }
.chat-close { width: 38px; height: 38px; flex: 0 0 auto; border: 1px solid #555; background: transparent; color: var(--text-primary); font-size: 25px; cursor: pointer; }
.chat-messages { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 25px 28px; }
.chat-message { margin: 0 0 25px; }
.message-label { display: block; margin-bottom: 6px; color: #999; font: 500 9px var(--font-mono); letter-spacing: .08em; }
.message-content { margin: 0; max-width: 94%; color: #ddd; font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.markdown-body > * + * { margin-top: .8em; }
.markdown-body p { margin-bottom: 0; white-space: normal; overflow-wrap: anywhere; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { color: var(--text-primary); font: 600 1.08em/1.3 var(--font-display); }
.markdown-body ul, .markdown-body ol { padding-left: 1.4em; white-space: normal; }
.markdown-body li + li { margin-top: .25em; }
.markdown-body a { color: var(--text-primary); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.markdown-body code { padding: .08em .3em; background: #2a2a2a; font: .9em var(--font-mono); overflow-wrap: anywhere; }
.markdown-body pre { max-width: 100%; margin-inline: 0; padding: 12px; overflow: auto; border: 1px solid #3d3d3d; background: #141414; white-space: pre; }
.markdown-body pre code { padding: 0; background: transparent; overflow-wrap: normal; }
.markdown-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); }
.markdown-body table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: normal; }
.markdown-body th, .markdown-body td { min-width: 90px; padding: 7px 9px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.markdown-body th { color: var(--text-primary); font-family: var(--font-mono); font-size: 10px; }
.markdown-body hr { border: 0; border-top: 1px solid var(--border); }
.chat-message.user .message-label { color: #fff; }
.typing-dots { display: flex; gap: 5px; padding-top: 5px; }
.typing-dots span { width: 5px; height: 5px; border-radius: 50%; background: #aaa; animation: pulse 1s infinite alternate; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { to { opacity: .25; transform: translateY(-3px); } }
.quick-prompts { display: flex; gap: 7px; padding: 14px 20px; overflow-x: auto; border-top: 1px solid var(--border); }
.quick-prompts button { flex: 0 0 auto; padding: 8px 10px; border: 1px solid #444; background: transparent; color: #bbb; font: 9px var(--font-mono); cursor: pointer; }
.quick-prompts button:hover { border-color: #aaa; color: white; }
.chat-input-area { display: flex; align-items: end; gap: 10px; padding: 16px 22px 22px; border-top: 1px solid var(--border); }
.chat-input-area textarea { width: 100%; min-width: 0; min-height: 46px; max-height: 140px; resize: none; padding: 12px 14px; border: 1px solid #444; background: var(--background); color: var(--text-primary); outline: none; font-size: 13px; }
.chat-input-area textarea:focus { border-color: #aaa; }
.send-button { width: 46px; height: 46px; flex: 0 0 auto; border: 0; background: var(--text-primary); color: var(--background); font-size: 22px; cursor: pointer; }
.send-button:disabled { opacity: .45; cursor: wait; }

/* Motion and cursor */
.reveal { opacity: 1; transform: none; }
body.has-reveal .reveal { opacity: 0; transform: translateY(16px); transition: opacity .65s ease, transform .65s cubic-bezier(.2,.7,.2,1); }
body.has-reveal .reveal.is-visible { opacity: 1; transform: none; }
.cursor-dot { position: fixed; z-index: 9999; top: 0; left: 0; width: 8px; height: 8px; border-radius: 50%; background: white; pointer-events: none; opacity: 0; transform: translate(-50%, -50%); mix-blend-mode: difference; transition: opacity .2s ease, width .2s ease, height .2s ease; }
@media (hover: hover) and (pointer: fine) { body.has-custom-cursor, body.has-custom-cursor a, body.has-custom-cursor button { cursor: none; } body.has-custom-cursor .cursor-dot.is-visible { opacity: 1; } body.has-custom-cursor .cursor-dot.is-hover { width: 28px; height: 28px; } }

/* Tablet */
@media (max-width: 900px) {
  .page-shell { width: min(calc(100% - 64px), var(--page-width)); }
  .site-header { padding-inline: 32px; }
  .hero-title { font-size: clamp(64px, 11.4vw, 110px); }
  .hero-bottom, .section-heading, .contact .section-heading, .contact-bottom { grid-template-columns: 1fr 1.5fr; gap: 26px; }
  .projects-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-grid { gap: 45px; }
}

/* Mobile */
@media (max-width: 640px) {
  html { scroll-padding-top: 72px; }
  .page-shell { width: calc(100% - 40px); }
  .section-container { width: calc(100% - 40px); }
  .site-header { min-height: 66px; padding-inline: 20px; }
  .brand { font-size: 9px; }
  .mobile-menu-toggle { z-index: 2; display: flex; width: 42px; height: 42px; flex-direction: column; justify-content: center; gap: 6px; padding: 10px; border: 1px solid #444; background: transparent; }
  .mobile-menu-toggle span { height: 1px; width: 100%; background: white; transition: transform .2s ease; }
  .mobile-menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .mobile-menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
  .primary-nav { position: absolute; top: calc(100% + 8px); right: 20px; display: flex; width: min(240px, calc(100vw - 40px)); flex-direction: column; align-items: stretch; gap: 0; padding: 7px; border: 1px solid var(--border); background: var(--surface); box-shadow: 0 14px 36px rgb(0 0 0 / 45%); opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .18s ease, transform .18s ease, visibility .18s; }
  .primary-nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .primary-nav a { padding: 12px 13px; color: var(--text-primary); font-size: 13px; transition: background .18s ease; }
  .primary-nav a + a { border-top: 1px solid var(--border); }
  .primary-nav a:hover { background: #292929; }
  .hero { min-height: unset; padding-top: 90px; padding-bottom: 82px; }
  .hero > .eyebrow { margin-bottom: 30px; }
  .hero-title { margin: 0 0 48px -3px; font-size: clamp(48px, 14vw, 86px); line-height: .9; letter-spacing: -.09em; }
  .hero-title br { display: none; }
  .hero-title { max-width: 9ch; }
  .hero-bottom { grid-template-columns: 1fr; gap: 20px; padding-top: 17px; }
  .identity-line { max-width: 250px; }
  .hero-copy-cta p { font-size: 15px; }
  .hero-index { bottom: 26px; font-size: 9px; }
  .projects, .about, .contact { padding-top: 84px; }
  .section-heading, .contact .section-heading { display: block; padding-bottom: 20px; }
  .section-heading .eyebrow { margin-bottom: 14px; }
  .section-heading h2 { font-size: clamp(43px, 12vw, 68px); }
  .projects-grid { grid-template-columns: 1fr; gap: 38px; margin-top: 27px; }
  .card-title { font-size: 30px; }
  .card-title-row { flex-wrap: wrap; align-items: flex-start; }
  .card-description { font-size: 12px; }
  .card-art { aspect-ratio: 1.25 / 1; }
  .projects-grid .card-title { font-size: 31px; }
  .about-grid { grid-template-columns: 1fr; gap: 35px; padding-top: 27px; }
  .about-portrait { width: min(86%, 400px); }
  .about-portrait figcaption { flex-direction: column; }
  .about-portrait figcaption span { text-align: left; }
  .about-copy { padding-bottom: 38px; }
  .about-copy p { font-size: 23px; }
  .about-index { font-size: 8px; }
  .contact { padding-bottom: 90px; }
  .contact .section-heading h2 { font-size: clamp(40px, 11vw, 64px); }
  .contact-bottom { display: flex; flex-direction: column; gap: 27px; padding-top: 25px; }
  .contact-bottom > p { max-width: 320px; }
  .email-link { width: 100%; font-size: clamp(19px, 5.3vw, 30px); }
  .site-footer { grid-template-columns: 1fr auto; gap: 15px; padding-block: 22px; font-size: 8px; }
  .site-footer .footer-name { grid-column: 1; grid-row: 1; }
  .site-footer .back-top { grid-column: 2; grid-row: 1; }
  .site-footer .footer-copy { grid-column: 1; grid-row: 2; }
  .site-footer .footer-github { grid-column: 2; grid-row: 2; }
  .site-footer .footer-linkedin { grid-column: 1; grid-row: 3; }
  .project-dialog { width: calc(100% - 16px); max-height: 92svh; }
  .dialog-shell { max-height: 92svh; }
  .dialog-close { width: 40px; height: 40px; margin: 9px 9px -49px 0; }
  .modal-project { padding: 0 22px 30px; }
  .modal-gallery { width: calc(100% + 44px); height: 190px; margin: 0 -22px 24px; }
  .modal-section { grid-template-columns: 1fr; gap: 10px; padding: 17px 0; }
  .modal-project > h2 { font-size: 53px; }
  .project-detail-block { grid-template-columns: 1fr; gap: 10px; }
  .project-hero { padding-top: 35px; }
  .project-page-title { font-size: clamp(52px, 17vw, 88px); }
  .chat-launcher { right: max(13px, env(safe-area-inset-right, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding: 12px 13px; font-size: 9px; }
  .chat-panel { width: 100%; }
  .chat-header { padding: 20px; }
  .chat-intro { padding: 15px 20px; }
  .chat-messages { padding: 20px; }
  .quick-prompts { padding-inline: 14px; }
  .chat-input-area { padding: 16px 15px max(16px, env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 420px) {
  .page-shell, .section-container { width: calc(100% - 32px); }
  .site-header { padding-inline: 16px; }
  .hero-title { font-size: clamp(44px, 13.5vw, 58px); }
  .card-title-row { flex-direction: column; gap: 6px; }
  .ownership-label { font-size: 8px; }
  .project-meta span { font-size: 8px; }
  .project-page-title { font-size: clamp(44px, 14vw, 64px); overflow-wrap: anywhere; }
  .contact .section-heading h2 { max-width: 14ch; font-size: clamp(32px, 10.5vw, 42px); }
  .email-link { font-size: clamp(17px, 5vw, 24px); }
  .project-dialog { width: calc(100% - 8px); }
  .modal-project { padding-inline: 16px; }
  .modal-gallery { width: calc(100% + 32px); margin-inline: -16px; }
  .modal-project > h2 { font-size: clamp(36px, 12vw, 50px); overflow-wrap: anywhere; }
}

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