@font-face {
    font-family: Pixel;
    src: url('/assets/pixel.ttf') format('truetype');
    font-display: swap
}

:root {
    color-scheme: dark;
    --bg: #111520;
    --panel: #1b2232;
    --ink: #eaf1df;
    --cyan: #72e9df;
    --yellow: #ffe56b;
    --muted: #a4b3c5;
    --line: #424e65
}

* {
    box-sizing: border-box
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.content, .topbar, .label, nav {
    overflow-wrap: anywhere;
}

.hero > div {
    min-width: 0;
}

body {
    margin: 0;
    background: var(--bg);
    background-image: linear-gradient(#1a2130 1px, transparent 1px), linear-gradient(90deg, #1a2130 1px, transparent 1px);
    background-size: 24px 24px;
    color: var(--ink);
    font: 16px/1.65 'Courier New', monospace
}

a {
    color: var(--cyan);
    text-underline-offset: 4px
}

a:hover {
    color: var(--yellow)
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 4px
}

h1,
h2,
h3,
.label,
.pixel,
.button,
nav {
    font-family: Pixel, 'Courier New', monospace
}

h1 {
    font-size: clamp(1.7rem, 3vw, 2.7rem);
    line-height: 1.35;
    color: var(--yellow);
    margin: 0 0 20px
}

h2 {
    font-size: 1.35rem;
    line-height: 1.5;
    color: var(--yellow)
}

h3 {
    font-size: 1.05rem;
    line-height: 1.5
}

p {
    margin: 0 0 20px
}

.muted,
figcaption,
footer {
    color: var(--muted)
}

.topbar {
    min-height: 62px;
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    background: #0b101b;
    border-bottom: 3px solid var(--line);
    padding: 10px 28px;
    font-size: 13px
}

.topbar a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none
}

.topbar img {
    width: 32px;
    height: 36px;
    object-fit: contain
}

.layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr) 260px;
    gap: 22px;
    max-width: 1680px;
    margin: auto;
    padding: 26px
}

.window {
    border: 3px solid #56627a;
    box-shadow: 5px 5px 0 #070b13;
    background: var(--panel);
    min-width: 0;
    align-self: start
}

.label {
    background: #303b50;
    padding: 11px 14px;
    border-bottom: 3px solid #56627a;
    font-size: 13px;
    letter-spacing: .3px
}

.sidebar {
    position: sticky;
    top: 22px
}

.brand {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 10px;
    text-decoration: none;
    padding: 26px 10px
}

.brand img {
    width: 124px;
    height: 138px;
    object-fit: contain
}

.brand strong {
    font: 18px Pixel, monospace;
    color: var(--yellow)
}

.brand span {
    font-size: 13px;
    color: var(--muted)
}

nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    font-size: 14px
}

nav a {
    text-decoration: none;
    padding: 12px 9px;
    border: 2px solid transparent
}

nav a[aria-current],
nav a:hover {
    background: #243a44;
    border-color: var(--cyan);
    color: var(--yellow)
}

.side-note {
    border-top: 2px solid var(--line);
    padding: 18px;
    font-size: 14px;
    color: var(--muted)
}

.content {
    padding: 30px
}

.hero {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-bottom: 26px;
    margin-bottom: 24px;
    border-bottom: 2px dashed var(--line)
}

.hero img {
    width: 140px;
    height: 160px;
    object-fit: contain
}

.eyebrow {
    font: 13px Pixel, monospace;
    color: var(--cyan);
    margin-bottom: 12px
}

.hero p:last-child {
    margin: 0
}

.buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 22px 0
}

.button {
    display: inline-block;
    padding: 11px 14px;
    background: var(--cyan);
    color: #10232a;
    border: 2px solid #b2fff1;
    box-shadow: 3px 3px 0 #071018;
    text-decoration: none;
    font-size: 14px
}

.button:hover {
    background: var(--yellow);
    color: #10232a
}

.button.secondary {
    background: transparent;
    color: var(--cyan);
    border-color: var(--line)
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin-top: 32px
}

.section-title a {
    font-size: 14px
}

.cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px
}

.card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    border: 2px solid var(--line);
    background: #141c2b;
    min-width: 0
}

.card:hover {
    border-color: var(--cyan);
    box-shadow: 3px 3px 0 var(--cyan)
}

.card-media {
    height: 180px;
    width: 100%;
    object-fit: cover;
    background: #0c1220;
    border-bottom: 2px solid var(--line)
}

.card-body {
    padding: 18px;
    flex: 1
}

.card h3 {
    color: var(--yellow);
    margin: 9px 0
}

.card p {
    color: var(--muted);
    margin: 0;
    font-size: 15px
}

.tag {
    font-size: 13px;
    color: var(--cyan)
}

.read {
    display: block;
    margin-top: 16px;
    font-size: 14px
}

.aside-inner {
    padding: 18px
}

.aside-inner h3 {
    color: var(--yellow);
    margin-top: 0
}

.aside-inner a {
    display: block;
    margin: 12px 0
}

.aside-inner p {
    font-size: 14px
}

.divider {
    border: 0;
    border-top: 2px dashed var(--line);
    margin: 24px 0
}

.mini {
    padding: 14px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 14px
}

.mini strong {
    color: var(--yellow)
}

footer {
    padding: 24px 0 0;
    font-size: 13px
}

.breadcrumbs {
    font-size: 14px;
    margin-bottom: 22px
}

.lead {
    font-size: 18px;
    color: #c3cfdb
}

.gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin: 28px 0
}

figure {
    margin: 0;
    min-width: 0
}

figure a {
    display: block
}

figure img {
    width: 100%;
    height: 240px;
    object-fit: contain;
    background: #0b111e;
    border: 2px solid var(--line)
}

figcaption {
    font-size: 13px;
    line-height: 1.6;
    margin-top: 8px
}

.prose {
    max-width: 78ch
}

.prose h2 {
    margin-top: 32px
}

.notice {
    border-left: 4px solid var(--yellow);
    padding: 16px 18px;
    background: #282735;
    margin: 24px 0
}

.notice p:last-child {
    margin: 0
}

.steps {
    counter-reset: step;
    padding: 0;
    list-style: none
}

.steps li {
    counter-increment: step;
    margin: 16px 0;
    padding: 18px 18px 18px 62px;
    background: #141c2b;
    border: 1px solid var(--line);
    position: relative
}

.steps li:before {
    content: counter(step, decimal-leading-zero);
    position: absolute;
    left: 16px;
    top: 18px;
    color: var(--cyan);
    font-family: Pixel
}

.steps strong {
    display: block;
    color: var(--yellow);
    margin-bottom: 6px
}

details {
    padding: 16px;
    border: 2px solid var(--line);
    margin: 18px 0
}

summary {
    cursor: pointer;
    color: var(--cyan)
}

details p {
    margin: 16px 0 0
}

.skip {
    position: absolute;
    left: 12px;
    top: -100px;
    background: var(--yellow);
    color: #111;
    padding: 10px;
    z-index: 5
}

.skip:focus {
    top: 12px
}

.project-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 18px;
    border-top: 2px dashed var(--line);
    padding-top: 24px;
    margin-top: 32px
}

.wide {
    grid-column: 1/-1
}

@media(max-width:1250px) {
    .layout {
        grid-template-columns: 185px minmax(0, 1fr)
    }

    .rail {
        grid-column: 2
    }

    .rail .aside-inner {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px
    }

    .content {
        padding: 24px
    }
}

@media(max-width:760px) {
    .layout {
        display: flex;
        flex-direction: column;
        padding: 14px;
        gap: 18px
    }

    .window {
        width: 100%
    }

    .sidebar {
        position: static
    }

    .brand {
        flex-direction: row;
        justify-content: center;
        padding: 14px;
        flex-wrap: wrap
    }

    .brand img {
        width: 58px;
        height: 64px
    }

    .brand span {
        display: none
    }

    .sidebar>.label,
    .side-note {
        display: none
    }

    nav {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        font-size: 13px
    }

    nav a {
        padding: 9px
    }

    .topbar {
        padding: 10px 16px
    }

    .topbar>span {
        display: none
    }

    .hero {
        gap: 16px;
        flex-direction: column;
        align-items: flex-start;
    }

    .hero img {
        width: 84px;
        height: 100px
    }

    .content {
        padding: 20px
    }

    .cards,
    .gallery {
        grid-template-columns: 1fr
    }

    .rail .aside-inner {
        display: block
    }

    figure img {
        height: auto;
        max-height: 420px
    }

    .card-media {
        height: 210px
    }

    .hero h1 {
        font-size: clamp(1.25rem, 4.5vw, 1.7rem)
    }

    h1 { font-size: clamp(1.25rem, 4.5vw, 1.7rem); }
    h2 { font-size: clamp(1.05rem, 3.5vw, 1.35rem); }
    h3 { font-size: clamp(.95rem, 3vw, 1.05rem); }

    .section-title {
        flex-wrap: wrap
    }

    .lead {
        font-size: 17px
    }
}

@media(prefers-reduced-motion:reduce) {
    * {
        scroll-behavior: auto
    }
}

.showcase {
    margin: 30px 0
}

.showcase img {
    height: auto;
    max-height: none;
    object-fit: contain
}

.topology {
    max-width: 1000px
}

.card-media[src$=".svg"],
.card-media[src$="ikemen.png"],
.card-media[src$="rp2350.jpg"],
.card-media[src$="xgunner.jpg"] {
    object-fit: contain
}

.brand strong {
    text-align: center;
    font-size: 16px;
    overflow-wrap: anywhere
}

.topbar .pixel {
    min-width: 0;
    overflow-wrap: anywhere
}

.hero img[src="/assets/profile.png"] {
    width: 144px;
    height: 144px;
    object-fit: contain
}

@media(max-width:760px) {
    .hero img[src="/assets/profile.png"] {
        width: 96px;
        height: 96px;
        flex-shrink: 0
    }

    .topbar .pixel {
        font-size: 12px
    }

    .brand strong {
        font-size: 16px
    }
}

/* Project showcases: readable images and short summaries of the work. */
.project-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 28px 0;
    border: 1px solid var(--line);
    background: #141c2b;
}
.project-facts > div { padding: 16px; border-right: 1px solid var(--line); }
.project-facts > div:last-child { border-right: 0; }
.project-facts dt { color: var(--cyan); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.project-facts dd { margin: 7px 0 0; font-size: 14px; line-height: 1.5; }
.project-image { margin: 28px 0; }
.project-gallery .project-image { margin: 0; }
.project-image img { height: auto; max-height: 500px; object-fit: contain; display: block; }
.project-image.wide img { max-height: 640px; }
.project-gallery { align-items: start; }
.project-image figcaption a { display: inline; }
.card-media[src*="/showcase/"] { object-fit: contain; height: 220px; padding: 10px; }
.archive-section { margin-top: 44px; padding-top: 30px; border-top: 2px dashed var(--line); }
.archive-section h2 { margin-top: 0; }
.collection-intro { color: var(--muted); }
@media (max-width: 760px) {
    .project-facts { grid-template-columns: 1fr; }
    .project-facts > div { border-right: 0; border-bottom: 1px solid var(--line); }
    .project-facts > div:last-child { border-bottom: 0; }
    .project-image img, .project-image.wide img { max-height: none; }
    .project-gallery .wide { grid-column: auto; }
}

/* Contact forms */
.form-panel{padding:24px;border:2px solid var(--line);background:#141c2b;margin:28px 0}.form-panel h2{margin-top:0}form{display:grid;gap:20px}form label{display:grid;gap:8px}input,textarea{font:inherit;color:var(--ink);background:#0b111e;border:2px solid #61728b;padding:12px;width:100%;min-width:0;border-radius:0}textarea{resize:vertical}input:focus,textarea:focus{outline:3px solid var(--yellow);outline-offset:3px}.consent{display:flex;align-items:flex-start;gap:12px;font-size:15px}.consent input{width:22px;height:22px;flex:0 0 22px;accent-color:var(--cyan)}button{justify-self:start;font:14px Pixel,monospace;padding:14px;background:var(--cyan);color:#10232a;border:2px solid #b2fff1;cursor:pointer}button:disabled{opacity:.55;cursor:wait}[role="status"]{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.honeypot{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.aside-inner a{overflow-wrap:anywhere}.form-panel .muted{font-size:14px}@media(max-width:760px){.form-panel{padding:16px}.consent{font-size:14px}}

/* Shared language selector: normal buttons work with mouse, keyboard and touch. */
.topbar { flex-wrap: wrap; gap: 14px 24px; }
.language-switch { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.language-switch[hidden] { display: none; }
.language-switch button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 7px 10px; font: 14px/1.4 Arial, sans-serif; color: var(--ink); background: #141c2b; border: 2px solid #61728b; }
.language-switch button[aria-pressed="true"] { border-color: var(--cyan); background: #203c46; }
.language-switch button:hover { border-color: var(--yellow); }
.topbar .language-switch img { width: 28px; height: 20px; object-fit: cover; image-rendering: auto; margin: 0; }
@media(max-width:760px) { .language-switch { margin-left: 0; } }

.captcha{min-width:0;border:1px solid #61728b;padding:16px;display:grid;gap:14px}.captcha legend{padding:0 8px}.captcha p{margin:0;font-size:14px}.captcha-image{width:240px;max-width:100%;height:auto;background:#eff7fa}.captcha-image[hidden]{display:none}.captcha input{max-width:240px;text-transform:uppercase;letter-spacing:.15em}.captcha button{font:14px/1.4 Arial,sans-serif;padding:8px 12px;min-height:44px}

/* Supplied artwork fills a consistent preview area without cropping the composition. */
.card-media.card-illustration { height: 220px; padding: 0; object-fit: contain; }

.blog-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.blog-cards .card h2, .blog-article .card h2 { margin: 8px 0; font-size: 1.2rem; }
.blog-cards .card-media { aspect-ratio: 4 / 3; height: auto; object-fit: cover; }
.blog-article { max-width: 960px; }
.blog-feature { display: block; width: 100%; max-height: 460px; object-fit: contain; margin: 20px 0 32px; border: 2px solid var(--line); background: #101827; }
.blog-title-image { margin: 20px 0 32px; }
.blog-title-image a { display: block; }
.blog-title-image .blog-feature { margin: 0; max-height: none; }
.blog-app-story { margin: 32px 0; }
.blog-app-story .blog-dashboard { margin: 0; max-width: 360px; }
.blog-app-story .blog-dashboard img { max-height: 490px; }
.blog-app-story .blog-dashboard figcaption { margin-top: 8px; }
.blog-article .prose { max-width: 72ch; }
.blog-article .prose section { margin-bottom: 32px; }
@media (max-width: 1100px) { .blog-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .blog-cards { grid-template-columns: minmax(0, 1fr); } }

/* Keep project images beside their related explanation, stacking on narrow screens. */
.prose:has(.project-story) { max-width: none; container-type: inline-size; }
.project-story { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,.85fr); align-items: start; gap: 24px; margin: 30px 0; }
.project-story-text { min-width: 0; }
.project-story-text section:first-child h2 { margin-top: 0; }
.project-story .project-image { margin: 0; min-width: 0; width: 100%; max-width: 360px; justify-self: center; }
.project-story .project-image img { width: 100%; height: auto; max-height: 440px; object-fit: contain; }
.story-compact .project-image { max-width: 230px; }
.story-setup .project-image { max-width: 340px; }
.story-setup .project-image img { max-height: 560px; }
.story-game .project-image { max-width: 320px; }
.story-game .project-image img { aspect-ratio: 4 / 3; max-height: 240px; }
@container (max-width: 590px) { .project-story { grid-template-columns: minmax(0,1fr); gap: 16px; } }
@media (max-width: 760px) { .project-story { grid-template-columns: minmax(0,1fr); gap: 16px; } }

/* Reusable media column for the remaining project stories. */
.story-media { min-width: 0; width: 100%; display: grid; gap: 18px; justify-items: center; align-items: start; }
.story-media-pair { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.story-media .project-image { max-width: 320px; }
.story-media .project-image img { max-height: 360px; }
.story-dashboard .project-image { max-width: 340px; }
.story-dashboard .project-image img { max-height: 330px; }
.story-pinout .project-image { max-width: 230px; }
.story-pinout .project-image img { max-height: 370px; }
.story-oled .project-image img { max-height: 180px; }
.story-controls .project-image img { max-height: 270px; }
.story-diagram .project-image { max-width: 340px; }
.story-media figcaption { overflow-wrap: anywhere; }
.story-compact .story-media .project-image { max-width: 230px; }
.story-game .story-media .project-image img { max-height: 240px; }

.legal-gate { margin: 24px 0; }
.legal-gate form[hidden] { display: none; }

/* Equal outer columns keep the tagline centred on the page. */
.topbar.site-header { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); gap:16px; }
.topbar.site-header > .pixel { justify-self:start; }
.topbar.site-header > span { justify-self:center; text-align:center; }
.topbar.site-header > .language-switch { justify-self:end; margin-left:0; }
@media(max-width:1100px) { .topbar.site-header { grid-template-columns:minmax(0,1fr) auto; } .topbar.site-header > span { grid-row:2; grid-column:1 / -1; } .topbar.site-header > .language-switch { grid-column:2; grid-row:1; } }
@media(max-width:760px) { .topbar.site-header { grid-template-columns:minmax(0,1fr); } .topbar.site-header > span { display:block; grid-row:2; } .topbar.site-header > .language-switch { grid-row:3; grid-column:1; justify-self:center; } }

/* Shared modal image viewer. Native dialog traps focus and makes the page inert. */
html.lightbox-open { overflow:hidden; }
.image-lightbox { width:min(1100px,94vw); max-width:94vw; max-height:92vh; max-height:92dvh; margin:auto; padding:16px; color:var(--ink); background:var(--panel); border:2px solid var(--cyan); overflow:auto; }
.image-lightbox::backdrop { background:rgb(0 0 0 / 82%); }
.lightbox-toolbar { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:12px; }
.lightbox-toolbar h2 { font-size:16px; margin:0; }
.lightbox-toolbar button { min-height:44px; padding:8px 12px; flex-shrink:0; }
.image-lightbox figure { margin:0; }
.image-lightbox figure img { display:block; width:100%; height:auto; max-height:70vh; max-height:70dvh; object-fit:contain; }
.image-lightbox figcaption { margin-top:12px; color:var(--muted); font:14px/1.5 'Courier New',monospace; }
.lightbox-error { color:var(--yellow); }
a[aria-haspopup="dialog"] { cursor:zoom-in; }
@media(max-width:600px) { .image-lightbox { padding:10px; } .lightbox-toolbar h2 { font-size:12px; } }
