/* Catppuccin Macchiato terminal theme */
:root {
    --base:      #24273a;
    --mantle:    #1e2030;
    --crust:     #181926;
    --surface0:  #363a4f;
    --surface1:  #494d64;
    --surface2:  #5b6078;
    --overlay0:  #6e738d;
    --text:      #cad3f5;
    --subtext:   #a5adcb;
    --red:       #ed8796;
    --peach:     #f5a97f;
    --yellow:    #eed49f;
    --green:     #a6da95;
    --teal:      #8bd5ca;
    --sky:       #91d7e3;
    --blue:      #8aadf4;
    --lavender:  #b7bdf8;
    --mauve:     #c6a0f6;
    --pink:      #f5bde6;
    --mono: ui-monospace, "JetBrains Mono", "Fira Code", "Cascadia Code",
            SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

html, body {
    height: 100%;
    background: var(--crust);
}

body {
    font-family: var(--mono);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.seo-hidden { position: absolute; left: -9999px; }

.noscript-box {
    max-width: 640px;
    margin: 40px auto;
    padding: 24px;
    background: var(--base);
    border: 1px solid var(--surface1);
    border-radius: 8px;
    line-height: 1.6;
}
.noscript-box a { color: var(--blue); }
.noscript-box ul { padding-left: 24px; }

/* Terminal window chrome */
.term-window {
    width: 100%;
    max-width: 1440px;
    height: min(96vh, 1200px);
    background: var(--base);
    border: 1px solid var(--surface1);
    border-radius: 10px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.term-titlebar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--mantle);
    border-bottom: 1px solid var(--surface0);
    user-select: none;
}

.tb-dot { width: 12px; height: 12px; border-radius: 50%; }
.tb-red    { background: var(--red); }
.tb-yellow { background: var(--yellow); }
.tb-green  { background: var(--green); }

.term-title {
    flex: 1;
    text-align: center;
    font-size: 0.78rem;
    color: var(--subtext);
    /* offset the dots so the title is visually centered */
    margin-right: 48px;
}

.term-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px 24px;
    font-size: 0.92rem;
    line-height: 1.5;
    cursor: text;
    scrollbar-width: thin;
    scrollbar-color: var(--surface1) transparent;
}

/* Output */
#term-output { white-space: pre-wrap; word-break: break-word; }

#term-output .line { min-height: 1.5em; }
#term-output pre {
    font-family: inherit;
    overflow-x: auto;
    white-space: pre;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--surface1) transparent;
}

.c-red    { color: var(--red); }
.c-peach  { color: var(--peach); }
.c-yellow { color: var(--yellow); }
.c-green  { color: var(--green); }
.c-teal   { color: var(--teal); }
.c-sky    { color: var(--sky); }
.c-blue   { color: var(--blue); }
.c-mauve  { color: var(--mauve); }
.c-pink   { color: var(--pink); }
.c-lavender { color: var(--lavender); }
.c-dim    { color: var(--overlay0); }
.c-sub    { color: var(--subtext); }
.c-bold   { font-weight: 700; }

#term-output a { color: var(--blue); text-decoration-color: var(--surface2); }
#term-output a:hover { color: var(--sky); }

/* Echoed command lines */
.echo .prompt-label { color: var(--green); }

/* Prompt + input */
.input-line { display: flex; align-items: baseline; }
.input-line[hidden] { display: none; }
.prompt-label { color: var(--green); white-space: pre; flex: none; }

.input-wrap { flex: 1; position: relative; display: block; }

#term-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font: inherit;
    caret-color: transparent;
}

/* Block cursor drawn after the typed text */
.input-wrap::after {
    content: "";
    position: absolute;
    top: 0.1em;
    left: var(--caret-x, 0px);
    width: 0.6em;
    height: 1.25em;
    background: var(--text);
    animation: blink 1.1s steps(1) infinite;
    pointer-events: none;
}
.input-wrap.no-focus::after { opacity: 0.35; animation: none; }

@keyframes blink { 50% { opacity: 0; } }

/* Clickable command chips */
.chip {
    display: inline-block;
    margin: 2px 6px 2px 0;
    padding: 1px 10px;
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 6px;
    color: var(--lavender);
    font: inherit;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.chip:hover { background: var(--surface1); border-color: var(--overlay0); }

/* Skill bars */
.bar { color: var(--surface2); }
.bar .fill-proficient { color: var(--green); }
.bar .fill-working    { color: var(--blue); }
.bar .fill-learning   { color: var(--peach); }

/* Infra diagram (inline SVG) */
.infra-svg svg {
    display: block;
    width: 100%;
    max-width: 580px;
    height: auto;
    margin: 10px 0 6px;
    font-family: var(--mono);
}
.infra-svg .box rect {
    fill: var(--mantle);
    stroke: var(--surface2);
    stroke-width: 1.5;
    transition: filter 0.15s ease, stroke 0.15s ease;
}
.infra-svg .box-blue rect  { stroke: var(--blue); }
.infra-svg .box-green rect { stroke: var(--green); }
.infra-svg .box-dim rect   { stroke: var(--overlay0); }
.infra-svg .box-dashed rect { stroke: var(--overlay0); stroke-dasharray: 5 4; }
.infra-svg .box:hover rect {
    filter: drop-shadow(0 0 6px rgba(138, 173, 244, 0.35));
    stroke: var(--lavender);
}
.infra-svg .flow {
    stroke: var(--blue);
    stroke-width: 1.5;
}
.infra-svg .flow-vpn { stroke: var(--teal); stroke-dasharray: 6 4; }
.infra-svg .arr-head { fill: var(--blue); }
.infra-svg .boundary { stroke: var(--surface1); stroke-dasharray: 3 5; stroke-width: 1.5; }
.infra-svg .divider  { stroke: var(--surface0); stroke-width: 1.5; }
.infra-svg text { font-family: var(--mono); }
.infra-svg .t-title { fill: var(--text); font-size: 15px; font-weight: 700; }
.infra-svg .t-name  { fill: var(--lavender); font-size: 13px; }
.infra-svg .t-note  { fill: var(--subtext); font-size: 13px; }
.infra-svg .t-dim   { fill: var(--overlay0); font-size: 12px; }
.infra-svg .t-vpn   { fill: var(--teal); font-size: 13px; }
.infra-svg .t-here  { fill: var(--green); font-weight: 700; }

/* Vim contact overlay */
.vim-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--mantle);
    z-index: 10;
    font-size: 0.88rem;
    line-height: 1.5;
}

.vim-buffer {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.vim-line { display: flex; }
.vim-gutter { color: var(--surface2); flex: none; width: 3ch; user-select: none; }
.vim-field-label { color: var(--mauve); flex: none; }
.vim-field-value { color: var(--text); min-height: 1.5em; }
.vim-tilde { color: var(--surface2); }

.vim-cursor {
    background: var(--text);
    color: var(--base);
}
.vim-cursor-insert {
    box-shadow: inset 2px 0 0 var(--green);
}

.vim-statusbar {
    flex: none;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 14px;
    background: var(--surface0);
    color: var(--text);
    font-size: 0.8rem;
}
.vim-mode { font-weight: 700; }
.vim-mode.insert { color: var(--green); }
.vim-mode.normal { color: var(--blue); }
.vim-hints { color: var(--subtext); }
.vim-hints .chip { font-size: 0.75rem; padding: 0 8px; }

.vim-cmdline {
    flex: none;
    padding: 2px 14px 6px;
    background: var(--mantle);
    color: var(--text);
    min-height: 1.6em;
}
.vim-cmdline .err { color: var(--red); }

/* container needs relative positioning for the vim overlay */
.term-window { position: relative; }

/* Mobile */
@media (max-width: 600px) {
    body { padding: 0; }
    .term-window {
        max-width: none;
        height: 100dvh;
        border-radius: 0;
        border: none;
    }
    .term-body { font-size: 0.78rem; padding: 12px 10px 20px; }
    .vim-overlay { font-size: 0.78rem; }
    .vim-hints .hide-mobile { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .input-wrap::after { animation: none; }
}
