*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --c-bg:      #09090f;
    --c-surface: #0d0d1a;
    --c-text:    #f0f2ff;
    --c-muted:   #8886a8;
    --c-accent:  #4aa3ff;
    --c-a2:      #7b6cff;
    --c-border:  #1e1e35;
    --c-green:   #22c55e;
    --c-node:    #4aa3ff;
}

html { font-size: 100%; }

body {
    background: var(--c-bg);
    color: var(--c-text);
    font-family: 'Outfit', sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 0.1875rem solid var(--c-accent); outline-offset: 0.25rem; }

.skip-link {
    position: absolute;
    top: -10rem;
    left: 1rem;
    z-index: 9999;
    background: var(--c-accent);
    color: #000;
    font-family: 'DM Mono', monospace;
    font-size: 0.875rem;
    padding: 0.625rem 1.25rem;
    text-decoration: none;
    transition: top 0.2s;
}

.skip-link:focus { top: 1rem; }

#boot-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: #000;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: clamp(1.5rem, 5vw, 3.5rem);
    overflow: hidden;
    transition: opacity 0.45s ease-out;
}

#boot-overlay.is-done {
    opacity: 0;
    pointer-events: none;
}

#boot-screen {
    font-family: 'DM Mono', monospace;
    font-size: clamp(0.6875rem, 1.4vw, 0.875rem);
    line-height: 1.8;
    color: var(--c-accent);
    max-height: 100%;
    overflow: hidden;
    width: 100%;
    max-width: 56rem;
}

#boot-lines p {
    margin: 0;
    white-space: pre-wrap;
    opacity: 0;
    animation: bl-in 0.2s ease-out forwards;
}

.boot-ok { color: var(--c-green) !important; }

.boot-cursor {
    display: inline-block;
    width: 0.5rem;
    height: 1.1em;
    background: var(--c-accent);
    vertical-align: middle;
    animation: blink 1s step-end infinite;
    margin-left: 0.125rem;
}

@keyframes bl-in {
    from { opacity: 0; transform: translateX(-0.5rem); }
    to   { opacity: 1; transform: none; }
}

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

body[data-page="home"] #main-content { display: contents; }

.stage {
    position: relative;
    height: 100dvh;
    min-height: 36rem;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 0 3vw;
    padding: 2.25rem clamp(1.5rem, 4vw, 4rem);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease-out 0.05s;
}

.stage.is-visible { opacity: 1; }

.speed-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.sl {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 200 550;
    animation: flow-thick 4.5s linear infinite;
}

.sl.thin { stroke-width: 1.1; stroke-dasharray: 80 440; animation: flow-thin 3.2s linear infinite; }
.sl.base { stroke-dasharray: none; animation: none; opacity: 0.13; }

@keyframes flow-thick { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -750; } }
@keyframes flow-thin  { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -520; } }

.stage-left {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.stage-eyebrow {
    font-family: 'DM Mono', monospace;
    font-size: 1rem;
    color: var(--c-muted);
    margin-bottom: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.blog-corner-link {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: var(--c-muted);
    text-decoration: none;
    letter-spacing: 0.06em;
    transition: color 0.2s;
}

.blog-corner-link:hover { color: var(--c-text); }

.stage-hero { margin: 0 0 auto; }

.stage-hero h1 {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2.75rem, min(7vw, 11vh), 6.25rem);
    line-height: 0.92;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
}

.stage-lead {
    max-width: 28rem;
    font-size: clamp(0.9375rem, 2vh, 1.125rem);
    line-height: 1.55;
    color: var(--c-muted);
}

.panel {
    position: relative;
    flex: 0 1 auto;
    height: clamp(14rem, 40vh, 22rem);
    display: flex;
    flex-direction: column;
    border: 0.0625rem solid var(--c-border);
    background: var(--c-surface);
    margin-top: auto;
    border-radius: 0.5rem;
    overflow: hidden;
}

.panel-port {
    position: absolute;
    right: -0.3125rem;
    top: 1.125rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--c-node);
    transition: background 0.3s;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 0.0625rem solid var(--c-border);
    font-family: 'DM Mono', monospace;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.panel-head b { font-weight: 500; color: var(--c-node); transition: color 0.3s; }
.panel-head span { color: var(--c-muted); }

.panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.125rem 1.25rem;
    scrollbar-width: thin;
    scrollbar-color: var(--c-border) transparent;
}

.panel-body section[hidden] { display: none; }

.about-avatar {
    float: right;
    width: 4.5rem;
    height: 4.5rem;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--c-node);
    margin: 0 0 0.75rem 1rem;
    transition: border-color 0.3s;
}

.panel-body p {
    margin: 0 0 0.875rem;
    max-width: 32rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1.0625rem;
    line-height: 1.65;
    color: rgba(240, 242, 255, 0.72);
}

.panel-body p:last-child { margin-bottom: 0; }

/* typewriter about */
.about-typed { }
.about-typed p { margin: 0 0 0.875rem; }
.about-typed p:last-child { margin-bottom: 0; }

.type-cursor {
    display: inline-block;
    width: 0.55em;
    height: 1.1em;
    vertical-align: text-bottom;
    background: var(--c-node, #4aa3ff);
    border-radius: 1px;
    margin-left: 1px;
    animation: blink-caret 0.9s step-end infinite;
    opacity: 0.85;
}
.type-cursor.is-done {
    animation: blink-caret 1.4s step-end infinite;
    opacity: 0.5;
}
@keyframes blink-caret {
    0%, 100% { opacity: 0.85; }
    50%       { opacity: 0; }
}

.panel-rows { margin: 0; padding: 0; list-style: none; }

.panel-rows li {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 0.25rem 1rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    transition: background 0.15s;
}

.panel-rows li:hover { background: rgba(74,163,255,0.05); }
.panel-rows li + li { margin-top: 0.25rem; }

.pk {
    font-family: 'DM Mono', monospace;
    font-size: 0.8125rem;
    color: var(--c-accent);
    align-self: start;
    padding-top: 0.125rem;
}

.pv { margin: 0; color: rgba(240, 242, 255, 0.82); }
.pv a { text-decoration: none; transition: color 0.2s; }
.pv a:hover { color: var(--c-accent); }

.pt {
    grid-column: 2;
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: var(--c-a2);
    margin-top: 0.125rem;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    background: transparent;
    border: 0.0625rem solid var(--c-border);
    color: var(--c-text);
    font-family: 'DM Mono', monospace;
    font-size: 0.8125rem;
    padding: 0.4375rem 0.75rem;
    outline: none;
    resize: none;
    transition: border-color 0.18s;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 0;
}

.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--c-accent); }

.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--c-muted); }

.contact-form textarea { height: 5rem; }

.cf-honeypot {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.contact-submit {
    align-self: flex-start;
    background: var(--c-accent);
    color: #000;
    font-family: 'DM Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.5rem 1.375rem;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    letter-spacing: 0.02em;
}

.contact-submit:hover  { background: #3a93ef; }
.contact-submit:active { transform: scale(0.98); }
.contact-submit:disabled { opacity: 0.55; cursor: not-allowed; }

.contact-status {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: var(--c-accent);
    min-height: 1.125rem;
    margin-top: 0.125rem;
}

.contact-status.is-error { color: #ff4d4d; }

.node-map {
    position: relative;
    z-index: 2;
    min-height: 0;
    overflow: visible;
}

.node-map-img {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.node-map-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(9, 9, 15, 0.76);
}

.node-map-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: grayscale(40%) brightness(0.55);
}

.node-net {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: visible;
}

.n-edge  { fill: none; stroke: rgba(60,100,200,0.5); stroke-width: 1.2; stroke-dasharray: 4 8; }
.n-act   { fill: none; stroke: var(--c-node, var(--c-accent)); stroke-width: 2; stroke-linecap: round; }
.n-pulse { fill: var(--c-a2); }

.node-btn {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    transform: translate(-0.375rem, -50%);
    min-height: 2.5rem;
    padding-right: 0.5rem;
    font-family: 'DM Mono', monospace;
    font-size: 1rem;
    color: var(--c-muted);
    transition: color 0.2s;
}

.node-btn:hover              { color: var(--c-text); }
.node-btn[aria-pressed="true"] { color: var(--c-text); }

.node-pt {
    position: relative;
    flex: none;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--c-bg);
    border: 0.125rem solid var(--c-btn, var(--c-border));
    opacity: 0.45;
    transition: border-color 0.2s, background 0.2s, opacity 0.2s;
}

.node-btn:hover .node-pt,
.node-btn[aria-pressed="true"] .node-pt { opacity: 1; }

.node-btn[data-id="about"]   { --c-btn: #4aa3ff; }
.node-btn[data-id="stack"]   { --c-btn: #14b8a6; }
.node-btn[data-id="work"]    { --c-btn: #f472b6; }
.node-btn[data-id="blog"]    { --c-btn: #fbbf24; }
.node-btn[data-id="contact"] { --c-btn: #4aa3ff; }

.node-btn:hover .node-pt              { border-color: var(--c-btn, var(--c-accent)); }
.node-btn[aria-pressed="true"] .node-pt { border-color: var(--c-btn, var(--c-accent)); background: var(--c-btn, var(--c-accent)); }

.node-btn[aria-pressed="true"] .node-pt::after {
    content: '';
    position: absolute;
    inset: -0.5rem;
    border-radius: 50%;
    border: 0.0625rem solid var(--c-btn, var(--c-accent));
    animation: node-ping 2.4s ease-out infinite;
}

@keyframes node-ping {
    from { transform: scale(0.5); opacity: 0.9; }
    to   { transform: scale(1.6); opacity: 0; }
}

.node-hint {
    position: absolute;
    right: 0;
    bottom: 0;
    font-family: 'DM Mono', monospace;
    font-size: 1rem;
    color: var(--c-muted);
    opacity: 0.55;
}

#site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(1.5rem, 5vw, 4rem);
    background: rgba(9, 9, 15, 0.88);
    backdrop-filter: blur(1rem);
    -webkit-backdrop-filter: blur(1rem);
    border-bottom: 0.0625rem solid var(--c-border);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--c-text);
    text-decoration: none;
    letter-spacing: 0.08em;
}

.nav-logo-dot { width: 0.4375rem; height: 0.4375rem; background: var(--c-accent); border-radius: 50%; }

#site-nav { display: flex; gap: 2rem; }

.nav-link {
    font-family: 'DM Mono', monospace;
    font-size: 0.8125rem;
    color: var(--c-muted);
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: color 0.2s;
}

.nav-link:hover { color: var(--c-text); }

#site-footer {
    border-top: 0.0625rem solid var(--c-border);
    padding: 2rem clamp(1.5rem, 5vw, 4rem);
}

.footer-inner { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.footer-name  { font-weight: 600; font-size: 0.875rem; }
.footer-copy  { font-family: 'DM Mono', monospace; font-size: 0.75rem; color: var(--c-muted); margin-right: auto; }
.footer-links { display: flex; gap: 1.5rem; }

.footer-links a {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: var(--c-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--c-text); }

[data-theme="light"] {
    --c-bg:      #f1f3f9;
    --c-surface: #ffffff;
    --c-text:    #08080f;
    --c-muted:   #60618a;
    --c-accent:  #1d65d4;
    --c-a2:      #6142d8;
    --c-border:  #d2d6ec;
    --c-green:   #16a34a;
}

[data-theme="light"] #boot-overlay { background: #0a0912; }
[data-theme="light"] .speed-svg    { opacity: 0.35; }
[data-theme="light"] .node-map-img img { filter: grayscale(60%) brightness(0.9); }

[data-theme="light"] .stage-hero h1 { color: #08080f; }
[data-theme="light"] .stage-lead    { color: #4a4b6a; }
[data-theme="light"] .stage-eyebrow { color: #3a3b5a; }

[data-theme="light"] .panel {
    background: #ffffff;
    border-color: #c8ccdf;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
[data-theme="light"] .panel-head {
    border-bottom-color: #dde0f0;
    background: #f8f9ff;
}
[data-theme="light"] .panel-body p { color: #3a3c60; }

[data-theme="light"] .node-btn { color: #8a8baa; }
[data-theme="light"] .node-btn:hover,
[data-theme="light"] .node-btn[aria-pressed="true"] { color: #1a1b2e; }
[data-theme="light"] .node-pt { background: #f1f3f9; border-color: #c8ccdf; }

[data-theme="light"] .panel-rows li { border-bottom-color: #e4e7f5; }
[data-theme="light"] .pk { color: var(--c-accent); }
[data-theme="light"] .pv { color: #3a3c60; }

[data-theme="light"] .n-edge { stroke: rgba(30,50,180,0.2); }

[data-theme="light"] .node-hint { color: #8a8baa; }
[data-theme="light"] .globe-label-loc { color: #6a6b8a; }
[data-theme="light"] .globe-label-name { color: var(--c-accent); }

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.625rem;
    height: 1.625rem;
    border-radius: 50%;
    border: 0.0625rem solid var(--c-border);
    background: transparent;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.theme-toggle:hover { border-color: var(--c-accent); }

.theme-toggle-icon {
    display: block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: var(--c-muted);
    transition: background 0.2s;
}

[data-theme="light"] .theme-toggle-icon { background: var(--c-accent); }

.node-btn:focus-visible { outline: none; }

.g-recaptcha { margin: 0.375rem 0; transform-origin: left; }

#laptop-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    background: #000;
    overflow: hidden;
}

#laptop-overlay.is-active { display: block; }

#laptop-overlay.is-zooming img {
    animation: lo-zoom 4.2s cubic-bezier(.4,0,.6,1) forwards;
}

#laptop-overlay img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    transform-origin: 50% 30%;
}

@keyframes lo-zoom {
    0%   { transform: scale(1);    opacity: 0; }
    8%   { transform: scale(1);    opacity: 1; }
    52%  { transform: scale(1);    opacity: 1; }
    88%  { transform: scale(4.8);  opacity: 1; }
    100% { transform: scale(4.8);  opacity: 0; }
}

#globe-canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
}

#globe-canvas canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.globe-label {
    position: absolute;
    bottom: 0.875rem;
    left: 1.125rem;
    z-index: 4;
    pointer-events: none;
    line-height: 1.45;
}

.globe-label-loc {
    display: block;
    font-family: 'DM Mono', monospace;
    font-size: 0.625rem;
    color: var(--c-muted);
    letter-spacing: 0.07em;
}

.globe-label-name {
    display: block;
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: var(--c-accent);
    letter-spacing: 0.04em;
}

@media (max-width: 56rem) {
    body { overflow-y: auto; }

    .stage {
        height: auto;
        min-height: 100dvh;
        grid-template-columns: 1fr;
        gap: 1.5rem 0;
        padding: 1.5rem clamp(1rem, 5vw, 2rem) 2.5rem;
    }

    .node-map  { height: 18rem; order: -1; }
    .node-hint { display: none; }
    .panel-port { display: none; }
    .stage-eyebrow { flex-wrap: wrap; }
}

@media (max-width: 30rem) {
    .panel-rows li { grid-template-columns: 5rem 1fr; }
    .stage-hero h1  { font-size: clamp(2.25rem, 11vw, 3.25rem); }
}

@media (max-height: 40rem) and (min-width: 56.0625rem) {
    .stage-lead  { display: none; }
    .panel { height: clamp(12rem, 50vh, 22rem); }
}

@media (prefers-reduced-motion: reduce) {
    .stage { opacity: 1; transition: none; }
    #boot-overlay { display: none !important; }
    .sl { animation: none; }
    .sl:not(.base) { opacity: 0.3; stroke-dasharray: none; }
    .node-btn[aria-pressed="true"] .node-pt::after { animation: none; opacity: 0; }
    .boot-cursor { animation: none; }
}
