:root {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #ffffff;
    --text: #111314;
    --muted: #5f6468;
    --rule: #c9c9c9;
    --border-idle: #8a8a8a;
    --window-border-active: #005f73;
    --selection-bg: #eef6f7;
    --selection-fg: #111314;
    --accent: #005f73;
    --accent-soft: #eef6f7;
    --accent-text: #005f73;
    --on-bg: #111314;
    --on-accent: #ffffff;
    --on-accent-soft: #111314;
    --on-tile: #111314;
    --mark: #005f73;
    --term-bg: #ffffff;
    --term-fg: #111314;
    --term-accent: #005f73;
    --term-border: #111314;
    --term-muted: #5f6468;
    --term-active-border: #005f73;
    --term-on-accent: #ffffff;
    --code: #234;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--text);
    text-decoration-color: var(--accent);
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--accent-text);
}

a:hover {
    text-decoration-thickness: 0.15em;
}

a:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
    border-radius: 0;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 0.75rem;
    z-index: 10;
    padding: 0.6rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--accent);
}

.skip-link:focus {
    left: 0.75rem;
}

.site {
    width: min(72rem, 100% - 2rem);
    margin: 0 auto;
}

.site-header {
    display: flex;
    justify-content: flex-end;
    padding: 1.5rem 0 0;
}

.site-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.75rem, 1.5vw, 1.5rem);
    font-weight: 600;
}

.site-header a {
    text-decoration: none;
    padding: 0.3rem 0;
    border-bottom: 2px solid transparent;
}

.site-header a.active,
.site-header a:hover {
    border-bottom-color: var(--accent);
}

main h1:focus {
    outline: none;
}

main {
    display: block;
    max-width: 72ch;
    margin: 0 auto;
    padding: 2.5rem 0 4rem;
}

/* Wide application pages: the page owns its grid, not the reading column. */
main:has(.resume-page),
main:has(.playground-page),
main:has(.dis-page) {
    max-width: 72rem;
}

h1,
h2,
h3 {
    line-height: 1.2;
    letter-spacing: -0.01em;
}

h1 {
    margin: 0 0 0.4rem;
    font-size: clamp(2rem, 5vw, 3.25rem);
}

h2 {
    margin: 2.4rem 0 0.8rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--rule);
    font-size: 1.3rem;
}

h3 {
    margin: 1.4rem 0 0.3rem;
    font-size: 1.05rem;
}

p {
    margin: 0 0 0.85rem;
}

details:not([open]) > *:not(summary) {
    display: none;
}

ul {
    margin: 0.4rem 0 0.9rem;
    padding-left: 1.25rem;
}

li {
    margin-bottom: 0.25rem;
}

.resume-page {
    width: 100%;
    margin: 0;
    font-size: clamp(0.95rem, 0.2vw + 0.88rem, 1.06rem);
}

.resume-grid {
    display: grid;
    grid-template-columns: minmax(15rem, 20rem) minmax(0, 1fr);
    grid-template-areas:
        "identity summary"
        "skills experience"
        "certs education"
        "projects projects"
        "hardware hardware"
        "packages packages"
        "github github";
    gap: clamp(1rem, 2vw, 2rem);
    align-items: start;
}

.resume-identity {
    grid-area: identity;
    padding-left: 1rem;
    border-left: 3px solid var(--window-border-active);
}

.resume-summary { grid-area: summary; }
.resume-skills { grid-area: skills; }
.resume-experience { grid-area: experience; }
.resume-education { grid-area: education; }
.resume-certifications { grid-area: certs; }
.resume-projects { grid-area: projects; }
.resume-hardware { grid-area: hardware; }
.resume-packages { grid-area: packages; }
.resume-github { grid-area: github; }

.resume-identity,
.resume-grid > section {
    min-width: 0;
}

.resume-summary p,
.resume-experience,
.resume-education {
    max-width: 75ch;
}

.resume-grid > section > h2:first-child {
    margin-top: 0;
}

.resume-grid > section > h2 {
    border-bottom: 2px solid var(--accent);
}

.resume-skills .skill-grid {
    grid-template-columns: 1fr;
}

.resume-projects .project-grid,
.resume-hardware .project-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

.resume-header {
    margin-bottom: 1.5rem;
}

.headline {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--accent-text);
}

.location,
.meta,
.eyebrow {
    color: var(--muted);
    font-size: 0.92rem;
}

.contact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.skill-grid,
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    gap: 1rem;
}

.skill,
.project-card,
.text-block {
    break-inside: avoid;
}

.skill {
    padding: 0.9rem 1rem;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-top: 3px solid var(--accent);
    border-radius: 0;
}

.skill h3 {
    margin-top: 0;
}

.skill p {
    margin: 0;
    color: var(--muted);
    font-size: 0.93rem;
}

.project-card {
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-top: 3px solid var(--accent);
    border-radius: 0;
}

.project-card h3 {
    margin-top: 0;
}

.project-card .tagline {
    color: var(--muted);
}

.package-headline {
    margin-bottom: 0.25rem;
}

.package-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.package-group {
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-top: 3px solid var(--accent);
    border-radius: 0;
    break-inside: avoid;
}

.package-group h3 {
    margin-top: 0;
}

.package-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.package-list li {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--rule);
    overflow-wrap: anywhere;
}

.package-list li:last-child {
    border-bottom: 0;
}

.package-list .meta {
    font-size: 0.82rem;
}

.repo-link {
    overflow-wrap: anywhere;
    font-size: 0.88rem;
}

.text-block {
    margin-bottom: 1.4rem;
}

.text-block h3 {
    margin-bottom: 0.2rem;
}

.subtitle {
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.certifications {
    list-style: none;
    padding-left: 0;
}

.certifications li {
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--rule);
}

.project-detail header {
    margin-bottom: 1.6rem;
}

.project-detail h1 {
    margin-bottom: 0.3rem;
}

.project-callout {
    margin: 1.5rem 0;
    padding: 1rem 1.1rem;
    background: var(--accent-soft);
    color: var(--on-accent-soft);
    border-left: 5px solid var(--accent);
    border-radius: 0;
}

.project-callout h2 {
    margin-top: 0;
    padding-bottom: 0;
    border-bottom: 0;
    font-size: 1.15rem;
}

.project-callout p:last-child {
    margin-bottom: 0;
}

.generated-summary {
    margin-top: 0.8rem;
    padding: 0.8rem 0.9rem;
    background: var(--accent-soft);
    color: var(--on-accent-soft);
    border-left: 4px solid var(--accent);
    border-radius: 0;
}

.generated-marker {
    margin: 0.5rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.site-footer {
    padding: 1.5rem 0 2.5rem;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 0.88rem;
}

.site-footer p {
    margin: 0.2rem 0;
}

@media (max-width: 40rem) {
    .site {
        width: min(100% - 1.25rem, 72rem);
    }

    .site-header {
        padding-top: 1rem;
    }

    .site-header nav {
        flex-wrap: wrap;
        gap: 0.85rem;
    }

    main {
        padding: 1.5rem 0 3rem;
    }

    .contact {
        gap: 0.35rem;
    }

    h1,
    h2,
    h3,
    .project-card,
    .github-card,
    .generated-summary,
    .project-callout,
    .package-group {
        overflow-wrap: anywhere;
    }

    .skill-grid,
    .project-grid {
        gap: 0.75rem;
    }

    .project-card,
    .github-card {
        padding: 0.85rem;
    }
}


.playground-page h1 {
    font-size: clamp(1.8rem, 2.4vw, 2.5rem);
}

.playground-intro {
    max-width: 82ch;
    color: var(--muted);
}

.playground {
    width: 100%;
    margin: 0;
    font-size: clamp(0.95rem, 0.25vw + 0.85rem, 1.08rem);
}

.playground-path {
    margin: 0.8rem 0 0.5rem;
}

.playground-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr);
    grid-template-rows: minmax(0, 1fr);
    gap: clamp(0.75rem, 1.4vw, 1.25rem);
    align-items: stretch;
    height: clamp(22rem, 60vh, 42rem);
    margin: 0.75rem 0;
}

.tree-panel,
.terminal-panel,
.inspector-strip {
    margin: 0;
    min-height: 0;
    padding: 0.55rem;
    border: 3px solid color-mix(in srgb, var(--window-border-active) 55%, white);
    border-radius: 0;
    background: var(--surface);
    box-shadow: none;
}

.terminal-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    background: var(--term-bg);
}

.tree-panel:focus-within,
.terminal-panel:focus-within,
.inspector-strip[open] {
    border-color: var(--window-border-active);
}

.inspector-strip {
    margin: 0.75rem 0;
}

.inspector-strip summary {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    background: var(--w-patch-1);
    color: var(--on-patch-1);
}

.inspector-strip[open] summary {
    border-bottom-color: var(--rule);
}

.inspector-strip .ninep-inspector {
    border: 0;
    background: transparent;
    max-height: 22rem;
    direction: rtl;
    overflow: auto;
}

.ninep-tree,
.ninep-graph {
    list-style: none;
    padding-left: 0;
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.95rem;
}

.ninep-graph li {
    overflow-wrap: anywhere;
}

.tree-scroll {
    direction: rtl;
    height: 100%;
    max-height: 100%;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--window-border-active) var(--surface);
}

.tree-scroll-inner,
.terminal-flow,
.ninep-message {
    direction: ltr;
}

.tree-scroll::-webkit-scrollbar,
.terminal-pane::-webkit-scrollbar,
.ninep-inspector::-webkit-scrollbar {
    width: 10px;
}

.tree-scroll::-webkit-scrollbar-track,
.terminal-pane::-webkit-scrollbar-track,
.ninep-inspector::-webkit-scrollbar-track {
    background: var(--surface);
}

.tree-scroll::-webkit-scrollbar-thumb,
.terminal-pane::-webkit-scrollbar-thumb,
.ninep-inspector::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--window-border-active) 65%, white);
    border-radius: 0;
}

.ninep-graph-host {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.ninep-graph {
    max-height: none;
    overflow: visible;
    border: 0;
    padding: 0;
    background: transparent;
    font-size: clamp(0.88rem, 0.2vw + 0.8rem, 1rem);
}

.link-button {
    appearance: none;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    padding: 0;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: var(--mark);
    text-underline-offset: 0.18em;
    cursor: pointer;
}

.link-button:hover {
    text-decoration-thickness: 0.15em;
}

.link-button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.ninep-inspector {
    max-height: 28rem;
    overflow: auto;
    border: 1px solid var(--rule);
    background: var(--surface);
    padding: 0.5rem;
}

.ninep-message {
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--rule);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.78rem;
}

.ninep-message:last-child {
    border-bottom: 0;
}

.ninep-message strong {
    margin-right: 0.5rem;
}

.ninep-message code {
    display: block;
    margin-top: 0.25rem;
    overflow-wrap: anywhere;
    color: var(--muted);
}

.terminal-pane {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    height: 100%;
    direction: rtl;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--window-border-active) var(--surface);
    padding: 0.1rem;
    background: var(--term-bg);
    color: var(--term-fg);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: clamp(0.8rem, 0.22vw + 0.72rem, 0.98rem);
    line-height: 1.45;
    cursor: text;
}

.terminal-flow {
    direction: ltr;
}

.terminal-scrollback {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.terminal-live {
    position: relative;
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap;
    gap: 0;
    min-width: 0;
}

.terminal-live .prompt {
    flex: 0 0 auto;
    color: var(--term-accent);
    white-space: pre;
}

.terminal-live .typed {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: pre;
}

.terminal-input {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
}

.prompt {
    color: var(--term-accent);
    font-family: inherit;
    font-size: inherit;
    overflow-wrap: anywhere;
}

.block-cursor {
    display: inline-block;
    flex: 0 0 auto;
    width: 0.62em;
    height: 1.05em;
    margin: 0 0 0 1px;
    align-self: baseline;
    background: var(--term-accent);
    animation: rc-blink 1.1s steps(1, end) infinite;
}

@keyframes rc-blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}
}

.ninep-output {
    margin-top: 1rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--rule);
    border-left: 4px solid var(--accent);
    background: var(--surface);
}

.ninep-output.flowing {
    animation: ninep-flow 260ms ease-out;
}

@keyframes ninep-flow {
    from {
        background: var(--selection-bg);
    }
    to {
        background: transparent;
    }
}

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

@media (max-width: 767px) {
    .playground-layout {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ninep-output.flowing,
    .block-cursor {
        animation: none;
    }

    .block-cursor {
        opacity: 1;
    }
}





.ninep-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    margin: 0.2rem 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: clamp(0.76rem, 0.2vw + 0.7rem, 0.86rem);
}

.ninep-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ninep-breadcrumb ol li + li::before {
    content: "/";
    color: var(--muted);
    margin-right: 0.25rem;
}

.crumb,
.crumb-up {
    appearance: none;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 0.18em;
}

.crumb.current {
    background: var(--w-tile-3);
    color: var(--on-tile-3);
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    text-decoration-color: var(--on-tile-3);
}

.crumb:focus-visible,
.crumb-up:focus-visible,
.graph-directory:focus-visible,
.graph-file:focus-visible {
    outline-color: var(--accent);
}

.ninep-graph [data-graph-row] {
    appearance: none;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: clamp(2rem, 0.6vw + 1.8rem, 2.5rem);
    border: 0;
    outline: 2px solid transparent;
    outline-offset: 1px;
    background: none;
    color: var(--text);
    font: inherit;
    text-align: left;
    padding: 0.35rem 0.45rem;
    cursor: pointer;
}

.ninep-graph [data-graph-row]:hover {
    background: var(--accent-soft);
}

.graph-directory::before,
.graph-file::before {
    display: inline-block;
    width: 1.1rem;
    flex: 0 0 1.1rem;
    color: var(--w-patch-1);
    font-size: 0.75rem;
}

.graph-file::before {
    color: var(--w-patch-2);
}

.ninep-graph .graph-root {
    background: var(--w-tile-3);
    color: var(--on-tile-3);
}

.graph-directory::before {
    content: "▶";
}

.graph-directory[aria-expanded="true"]::before {
    content: "▼";
}

.graph-file::before {
    content: "·";
    text-align: center;
}

.ninep-graph ul {
    list-style: none;
    padding-left: 0.65rem;
    margin: 0 0 0 0.9rem;
    border-left: 1px solid var(--rule);
}

.ninep-graph [data-graph-row][aria-current="page"] {
    background: var(--selection-bg);
    border: 0;
    color: var(--selection-fg);
    text-decoration: none;
}

.ninep-graph [data-graph-row][aria-current="page"]::before {
    color: var(--selection-fg);
}

.ninep-graph .graph-file {
    color: var(--text);
    text-decoration: none;
}

.ninep-graph .graph-file:hover {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.wada-theme {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.wada-theme button {
    appearance: none;
    border: 1px solid var(--rule);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
}

.wada-theme button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.wada-theme button[aria-pressed="true"] {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--on-accent);
}

.wada-lock-glyph {
    display: block;
    line-height: 1;
}

.wada-lock-open {
    display: none;
}

.wada-theme button[aria-pressed="true"] .wada-lock-closed {
    display: none;
}

.wada-theme button[aria-pressed="true"] .wada-lock-open {
    display: inline;
}

@media (max-width: 1199px) {
    .resume-grid {
        grid-template-columns: minmax(13rem, 18rem) minmax(0, 1fr);
    }
}

@media (max-width: 767px) {
    .resume-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "identity"
            "summary"
            "experience"
            "projects"
            "skills"
            "education"
            "certs"
            "hardware"
            "packages"
            "github";
    }

    .resume-identity {
        position: static;
    }
}


.dis-page {
    width: 100%;
    margin: 0;
}

.dis-intro {
    max-width: 75ch;
    color: var(--muted);
}

.dis-window {
    margin: 1rem 0;
    padding: 0.7rem;
    border: 3px solid var(--window-border-active);
    background: var(--surface);
}

.dis-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
    margin-bottom: 0.8rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.85rem;
}

.dis-controls select,
.dis-controls button {
    border: 1px solid var(--border-idle);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    padding: 0.2rem 0.4rem;
}

.dis-canvas-frame {
    display: flex;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--rule);
    padding: 0.75rem;
}

.dis-canvas-frame .disvm-display {
    width: min(640px, 100%);
    height: auto;
    aspect-ratio: 4 / 3;
    image-rendering: pixelated;
}

.dis-status {
    margin: 0.6rem 0 0.3rem;
}

.dis-log {
    margin: 0;
    max-height: 12rem;
    overflow: auto;
    padding: 0.5rem;
    border-top: 1px solid var(--rule);
    background: #fff;
    color: #111314;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
}


.dom-demo {
    margin: 1rem 0;
}

.dom-frame {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem;
    border: 2px solid var(--window-border-active);
    background: var(--surface);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.dom-label {
    min-width: 2ch;
    color: var(--text);
    font-size: 1.2rem;
}

.dom-frame button {
    border: 1px solid var(--border-idle);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    padding: 0.25rem 0.6rem;
}

@media print {
    .resume-page {
        width: auto;
        margin: 0;
    }

    .resume-grid {
        display: block;
    }

    .resume-identity {
        position: static;
        border-left: 0;
        padding-left: 0;
    }

    :root {
        color-scheme: light;
        --bg: #fff;
        --surface: #fff;
        --text: #000;
        --muted: #333;
        --rule: #999;
        --accent: #000;
        --accent-soft: #fff;
    }

    .site-header,
    .site-footer,
    .skip-link {
        display: none;
    }

    main {
        max-width: none;
        padding: 0;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        page-break-after: avoid;
    }

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