:root {
    --page-bg: #f5f3ec;
    --surface: #fcfbf7;
    --ink: #252b23;
    --muted: #62695c;
    --accent: #526b17;
    --lime: #a8d438;
    --rule: #d5d8cb;
    --panel-bg: #eef0e5;
    --panel-rule: #c8cebc;
    --grid-line: #526b1709;
    --preview-bg: #f0f1e8;
    --node-line: #81935d;
    --node-fill: #e2ebc8;
    --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    --gutter: clamp(20px, 4vw, 64px);
}
:root:has(.portfolio-shell[data-view="gamer"]) {
    --page-bg: #181a18;
    --surface: #232720;
    --ink: #eef1e9;
    --muted: #bbc4b1;
    --accent: #b0dc4a;
    --rule: #454e3f;
    --panel-bg: #1f251b;
    --panel-rule: #515e41;
    --grid-line: #b0dc4a10;
    --preview-bg: #1c2218;
    --node-line: #8fa86c;
    --node-fill: #354923;
}
html { scroll-behavior: smooth; }
html, body { background: var(--page-bg); color: var(--ink); font-family: var(--font-body); transition: background-color 200ms ease, color 200ms ease; }
.portfolio-shell { min-height: 100vh; --header-height: 117px; }
.site-header, .identity-visual, .detail-panel { transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease; }
.portfolio-shell .mud-typography, .portfolio-shell .mud-button, .mud-dialog { font-family: var(--font-body); }
.portfolio-shell .mud-button { text-transform: none; letter-spacing: normal; }
.portfolio-shell :where(a, button, [tabindex]):focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
.pre-line { white-space: pre-line; }
.skip-link { position: absolute; z-index: 2000; top: 10px; left: var(--gutter); padding: 12px 18px; background: #252b23; color: white; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.site-header { min-height: var(--header-height); background: transparent; }
.site-header .mud-toolbar { max-width: 1320px; margin: auto; padding: 16px var(--gutter); height: auto; width: 100%; }
.site-header-inner { position: relative; width: 100%; min-height: 85px; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 28px; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); box-shadow: 0 8px 24px #252b2312; }
.site-header :where(a, button):focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; box-shadow: 0 0 0 6px #252b23; }
.site-brand { display: inline-flex; align-items: center; gap: 14px; white-space: nowrap; }
.brand-mark { width: 56px; height: 56px; padding: 6px; border: 2px solid var(--lime); border-radius: 50%; background: #252b23; display: grid; place-items: center; flex-shrink: 0; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-wordmark { color: var(--ink); font-size: 17px; font-weight: 650; line-height: 1.3; letter-spacing: -.025em; }
.site-nav { display: flex; align-items: center; gap: 28px; color: var(--ink); }
.site-nav a { display: inline-block; font-size: 13px; font-weight: 550; line-height: 44px; white-space: nowrap; }
.site-nav a:hover { text-decoration: underline; text-underline-offset: 6px; }
.site-nav a span { margin-inline-start: 6px; font: 10px var(--font-mono); vertical-align: baseline; color: var(--muted); }
.portfolio-main { width: 100%; max-width: 1320px; margin: auto; padding: 0 var(--gutter); }
.identity-stage { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr); grid-template-areas: "visual identity" "visual intro" "visual contact"; column-gap: clamp(32px, 5vw, 80px); row-gap: 24px; min-height: calc(100svh - var(--header-height)); padding: 64px 0 112px; align-content: center; position: relative; }
.hero-identity { grid-area: identity; min-width: 0; }
.identity-selector { display: flex; flex-direction: column; align-items: stretch; gap: 18px; margin: 0; }
.identity-option.mud-button-root { padding: 8px 0 12px; border-radius: 0; border-bottom: 3px solid transparent; text-align: left; width: fit-content; max-width: 100%; }
.identity-option:first-child { align-self: flex-end; }
/* Keep text colors stable while prerendered selectors remain disabled. */
.identity-name { display: flex; align-items: center; gap: clamp(12px, 1.4vw, 20px); font-size: clamp(48px, 7.5vw, 104px); font-weight: 650; line-height: 1.02; letter-spacing: -.065em; white-space: nowrap; color: var(--muted); }
.identity-name .mud-icon-root { font-size: .52em; color: var(--accent); flex-shrink: 0; }
.identity-option[aria-pressed="true"] { border-bottom-color: var(--accent); }
.identity-option[aria-pressed="true"] .identity-name { color: var(--ink); }
.hero-copy { grid-area: intro; min-width: 0; }
.eyebrow { font: 11px/1.6 var(--font-mono); text-transform: uppercase; letter-spacing: .075em; color: var(--accent); }
.name-period { color: var(--accent); }
.hero-statement { font-size: clamp(24px, 2.1vw, 30px); line-height: 1.3; letter-spacing: -.035em; font-weight: 500; }
.hero-statement span { color: var(--muted); }
.hero-role { margin-top: 16px; padding-left: 12px; border-left: 3px solid var(--lime); font-size: 14px; font-weight: 600; }
.hero-contact { grid-area: contact; min-width: 0; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 24px; margin-top: 22px; }
.primary-action.mud-button-filled { padding: 12px 20px; box-shadow: none; font-weight: 600; font-size: 13px; background: var(--lime); color: #252b23; }
.primary-action.mud-button-filled:hover { background: #99c62e; box-shadow: none; }
.secondary-action { color: var(--ink); font-size: 13px; font-weight: 550; }
.secondary-action span { margin-left: 6px; color: var(--accent); }
.resume-download { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.resume-download .mud-button-root { min-height: 44px; padding: 8px 0; color: var(--accent); font-size: 13px; }
#resume-format { color: var(--muted); font-size: 12px; }
.social-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.social-pair { display: flex; align-items: center; justify-content: inherit; flex-wrap: wrap; max-width: 100%; gap: 8px; }
.social-links > .eyebrow { margin-right: 8px; font-size: 10px; color: var(--muted); }
.social-links a, .social-placeholder { padding: 8px 12px; border: 1px solid var(--rule); background: var(--surface); }
.social-links a { color: var(--accent); }
.social-contact.mud-button-root { min-width: 0; padding: 8px 12px; border: 1px solid var(--rule); background: var(--surface); color: var(--accent); font-size: 13px; line-height: 1.5; }
.social-contact .mud-button-label { gap: 6px; }
.contact-copy-status { flex-basis: 100%; font-size: 12px; color: var(--accent); }
.contact-copy-status:empty { display: none; }
.contact-dialog { color: var(--ink); }
.contact-form p { margin: 0; }
/* MudBlazor's hidden label overflow clips glyph descenders. */
.contact-form .mud-input-label { overflow: visible; }
.contact-form .mud-button { text-transform: none; letter-spacing: normal; }
.contact-form .contact-privacy { margin: 20px 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.contact-section { padding: 40px 0 64px; border-top: 1px solid var(--rule); scroll-margin-top: 24px; }
.contact-panel.detail-panel { width: 100%; }
.contact-section .contact-identity-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.contact-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.contact-honeypot { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.contact-form :where(a, button, input, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.social-placeholder { color: var(--muted); border-style: dashed; }
.identity-visual { grid-area: visual; min-width: 0; align-self: center; margin: 0; padding: 12px; border: 1px solid var(--panel-rule); background: var(--surface); box-shadow: -14px 14px 0 var(--panel-bg); }
.identity-image { aspect-ratio: 4 / 5; background: #252b23; overflow: hidden; }
.identity-image .mud-image { display: block; width: 100%; height: 100%; object-position: 55% 40%; }
.portfolio-shell[data-view="gamer"] .identity-image img { padding: 28px; object-position: center; }
.identity-visual figcaption { padding: 16px 4px 4px; font: 10px/1.6 var(--font-mono); color: var(--muted); }
.hero-scroll { position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 14px; color: var(--muted); font: 10px/1.6 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.hero-scroll span { color: var(--accent); font-size: 20px; }
.about-section { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 64px 0; border-top: 1px solid var(--rule); scroll-margin-top: 24px; }
.about-section .section-heading { margin: 0 0 24px; }
.about-copy { min-width: 0; }
.about-visual.detail-panel { position: relative; min-height: 400px; padding: 12px; overflow: hidden; }
.about-visual .mud-image { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); object-position: 45% 35%; }
.portfolio-shell[data-view="gamer"] .about-visual .mud-image { object-position: 60% 35%; }
.hero-biography { max-width: 65ch; font-size: 15px; line-height: 1.9; color: var(--muted); overflow-wrap: anywhere; }
.project-section { border-top: 1px solid var(--rule); padding: 40px 0 56px; scroll-margin-top: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 20px; margin-bottom: 28px; }
.section-heading h2 { font-size: clamp(28px, 3vw, 40px); line-height: 1.2; font-weight: 550; letter-spacing: -.045em; margin-top: 10px; }
.section-note { color: var(--muted); font-size: 12px; line-height: 1.7; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.project-card.mud-button-root { display: flex; align-items: stretch; padding: 24px; background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: 2px; text-align: left; width: 100%; min-width: 0; transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background-color 200ms ease, color 200ms ease; }
.project-card .mud-button-label { display: flex; flex: 1; flex-direction: column; align-items: stretch; width: 100%; }
.project-card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font: 10px/1.6 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; }
.project-reference { overflow-wrap: anywhere; }
.project-number { color: var(--accent); }
.project-preview {
    --trace: color-mix(in srgb, var(--node-line) 72%, var(--accent));
    display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 4px; flex: none; min-width: 0;
    height: 68px; margin: 20px 0; padding: 5px 13px 6px;
    background: repeating-linear-gradient(90deg, transparent 0 23px, var(--grid-line) 23px 24px), var(--preview-bg);
}
.preview-map { position: relative; margin: 3px 7px; }
.preview-wire { position: absolute; left: 8%; right: 8%; top: 50%; height: 1px; background: var(--trace); }
.preview-node, .preview-junction, .preview-module {
    position: absolute; border: 1px solid var(--trace); border-radius: 1px;
    background: var(--node-fill); transform: translate(-50%, -50%);
}
.preview-node { top: 50%; }
.preview-node-start { left: 8%; width: 22px; height: 14px; }
.preview-node-end { left: 92%; width: 28px; height: 19px; background: var(--surface); }
.preview-junction { left: 49%; top: 50%; width: 5px; height: 5px; }
.preview-branch { position: absolute; border: 1px solid var(--trace); }
.preview-branch:is([data-stage="2"], [data-stage="5"]) { left: 19%; width: 30%; }
.preview-branch:is([data-stage="3"], [data-stage="4"]) { left: 49%; width: 33%; }
.preview-branch:is([data-stage="2"], [data-stage="4"]) { top: 20%; bottom: 50%; border-bottom: 0; }
.preview-branch:is([data-stage="3"], [data-stage="5"]) { top: 50%; bottom: 18%; border-top: 0; }
.preview-branch[data-latest] { border-color: var(--accent); }
.preview-module { left: 50%; width: 13px; height: 9px; }
.preview-branch:is([data-stage="2"], [data-stage="4"]) .preview-module { top: 0; }
.preview-branch:is([data-stage="3"], [data-stage="5"]) .preview-module { top: 100%; }
.preview-branch[data-latest] .preview-module { background: var(--accent); border-color: var(--accent); }
.preview-readout { display: flex; justify-content: space-between; gap: 3px 8px; color: var(--muted); font: 9px/1.35 var(--font-mono); }
.preview-readout strong { color: var(--ink); text-align: right; white-space: nowrap; }
.project-title { display: block; font-size: 23px; line-height: 1.3; font-weight: 600; letter-spacing: -.035em; overflow-wrap: anywhere; }
.project-description { display: block; color: var(--muted); font-size: 14px; line-height: 1.7; margin-top: 8px; margin-bottom: 26px; overflow-wrap: anywhere; }
.project-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--rule); margin-top: auto; padding-top: 16px; color: var(--accent); font-size: 12px; font-weight: 600; }
.project-card-footer .mud-icon-root { transition: transform 180ms ease; }
.project-card:not(:disabled):hover, .project-card:focus-visible { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 6px 16px #252b2308; }
.project-card:hover .project-card-footer .mud-icon-root { transform: translateX(3px); }
.supporting-content { padding-bottom: 48px; }
.section-toggle-heading { border-top: 1px solid var(--rule); scroll-margin-top: 24px; }
.support-toggle.mud-button-root { width: 100%; padding: 26px 0; text-align: left; border-radius: 0; color: var(--ink); }
.support-toggle .mud-button-label { display: flex; width: 100%; align-items: center; gap: 20px; }
.section-index { font: 11px var(--font-mono); color: var(--accent); }
.support-title { flex: 1; font-size: clamp(19px, 2.2vw, 26px); line-height: 1.35; font-weight: 550; letter-spacing: -.035em; }
.support-toggle .mud-icon-root { color: var(--accent); flex-shrink: 0; }
.detail-grid.mud-grid { margin-top: 0; margin-bottom: 24px; }
.detail-grid > .mud-grid-item { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.detail-grid .detail-panel { flex: 1; }
.detail-panel { padding: clamp(20px, 3vw, 32px); border: 1px solid var(--rule); }
.detail-panel .mud-typography-h3 { font-size: 21px; font-weight: 600; letter-spacing: -.025em; margin-bottom: 22px; }
.detail-panel .mud-typography-h4 { font-size: 16px; font-weight: 600; line-height: 1.6; }
.detail-panel .mud-typography-body1 { font-size: 14px; line-height: 1.9; }
.detail-panel .mud-typography-body2 { font-size: 12px; line-height: 1.8; }
.skills-intro { max-width: 88ch; margin: 8px 0 20px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.skill-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.skill-group-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.skill-group-heading .mud-icon-root { flex-shrink: 0; color: var(--accent); }
.skill-group-heading .mud-typography-h3 { min-width: 0; margin: 0; font-size: 18px; line-height: 1.35; }
.skill-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.skill-list li::marker { color: var(--muted); }
.influences-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 12px 0 20px; }
.influences-description.mud-typography { flex: 1 1 240px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.influences-view-switch { display: flex; flex-shrink: 0; margin-left: auto; padding: 3px; border: 1px solid var(--rule); border-radius: 28px; background: var(--surface); }
.influences-view-switch .mud-icon-button { width: 44px; height: 44px; color: var(--muted); }
.influences-view-switch .mud-icon-button[aria-pressed="true"] { background: var(--lime); color: #252b23; }
.influences-view-switch .mud-icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.influence-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin: 0 0 24px; padding: 0; list-style: none; }
.influence-item { min-width: 0; }
.influence-card.detail-panel { height: 100%; padding: 12px; }
.influence-card figure { margin: 0; }
.influence-cover { position: relative; overflow: hidden; aspect-ratio: 2 / 3; background: var(--panel-bg); }
.influence-cover .mud-image { position: absolute; display: block; max-width: none; object-fit: fill; }
.influence-card figcaption { margin-top: 12px; min-height: 2.8em; color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.site-footer { max-width: 1320px; width: 100%; margin: auto; padding: 24px var(--gutter) 32px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; font: 10px/1.6 var(--font-mono); color: var(--muted); }
.site-footer a { color: var(--accent); font: inherit; }
.page-message { padding: 64px 0; min-height: 50vh; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; width: 100%; padding: 1rem; background: #8f2424; color: white; z-index: 2000; }
#blazor-error-ui a { color: white; text-decoration: underline; }
@media (min-width: 801px) and (max-height: 850px) {
    .identity-stage { padding: 32px 0 80px; row-gap: 18px; }
    .identity-name { font-size: clamp(48px, 7vw, 86px); }
    .identity-visual { width: min(100%, 350px); justify-self: center; }
}
@media (max-width: 1050px) {
    .influence-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .skill-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .identity-stage { column-gap: 32px; }
    .identity-name { font-size: clamp(48px, 7.3vw, 76px); }
    .project-card.mud-button-root { padding: 20px; }
}
@media (max-width: 800px) {
    .identity-stage { grid-template-columns: minmax(0, 1fr); grid-template-areas: "identity" "visual" "intro" "contact" "scroll"; gap: 28px; padding: 40px 0 32px; }
    .hero-identity { width: 100%; max-width: 620px; justify-self: center; }
    .identity-name { font-size: clamp(42px, 11.5vw, 74px); }
    .identity-visual { width: min(100%, 360px); justify-self: center; }
    .identity-image { aspect-ratio: 5 / 4; }
    .hero-copy, .hero-contact { text-align: center; }
    .hero-role { border-left: 0; padding-left: 0; }
    .social-links, .hero-actions, .resume-download { justify-content: center; }
    .social-links > .eyebrow { width: 100%; margin: 0; }
    .hero-scroll { grid-area: scroll; position: static; transform: none; justify-self: center; margin-top: 12px; }
    .about-section { grid-template-columns: minmax(0, 1fr); padding: 40px 0; }
    .about-visual.detail-panel { min-height: 0; aspect-ratio: 5 / 4; }
    .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
    .contact-section .contact-identity-fields { display: block; }
    .influence-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .skill-groups { grid-template-columns: minmax(0, 1fr); }
    .portfolio-shell { --header-height: 88px; }
    .site-header .mud-toolbar { padding: 12px clamp(8px, 2.5vw, 20px); }
    .site-header-inner { min-height: 64px; padding: 6px; gap: 6px; border-radius: 20px; }
    .site-brand { gap: 8px; min-height: 44px; flex-shrink: 0; }
    .brand-mark { width: 40px; height: 40px; padding: 4px; }
    .site-nav { gap: 12px; flex-shrink: 0; }
}
@media (max-width: 420px) {
    .site-brand { min-width: 44px; justify-content: center; }
    .brand-wordmark { display: none; }
}
@media (max-width: 460px) {
    .site-header .mud-toolbar { padding-inline: 2px; }
    .site-header-inner { padding-inline: 10px; gap: 4px; }
    .site-brand { min-width: 32px; }
    .brand-mark { width: 32px; height: 32px; padding: 3px; }
}
/* Keep wide system fonts and the returning wordmark contained at the tightest widths. */
@media (max-width: 340px), (min-width: 421px) and (max-width: 440px) {
    .site-header-inner { padding-inline: 2px; gap: 0; }
}
@media (max-width: 520px) {
    .hero-statement { font-size: 25px; }
    .hero-biography { font-size: 14px; }
    .hero-actions { gap: 18px; }
    .project-grid { grid-template-columns: 1fr; }
    .identity-selector { gap: 10px; }
    .identity-visual { width: min(100%, 320px); }
    .identity-visual figcaption { font-size: 9px; }
    .project-section { padding-top: 32px; }
    .support-toggle .mud-button-label { gap: 12px; }
    .section-index { font-size: 10px; }
    .support-title { font-size: 19px; }
    .site-footer { flex-direction: column; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    html, body { transition-duration: .01ms !important; }
    .portfolio-shell *, .portfolio-shell *::before, .portfolio-shell *::after, .mud-dialog *, .mud-dialog *::before, .mud-dialog *::after, .mud-popover, .mud-popover * {
        animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important;
    }
    .project-card:not(:disabled):hover, .project-card:focus-visible, .project-card:hover .project-card-footer .mud-icon-root { transform: none; }
}
