/* ==========================================================================
   Learning Git — "Enter the Matrix"
   Terminal / CRT inspired theme, vanilla CSS only.
   ========================================================================== */

:root {
    /* Palette */
    --matrix-black: #010401;
    --matrix-green: #00ff41;
    --matrix-green-bright: #b6ffca;
    --matrix-green-mid: #17c455;
    --matrix-green-dim: #0b7a2c;
    --matrix-green-dark: #063d16;
    --text-body: #8fe0a8;

    /* Surfaces */
    --edge: rgba(0, 255, 65, 0.25);

    /* Type */
    --mono: "Courier New", "Lucida Console", ui-monospace, SFMono-Regular,
        Menlo, Consolas, monospace;

    /* Effects */
    --glow: 0 0 6px rgba(0, 255, 65, 0.55), 0 0 24px rgba(0, 255, 65, 0.2);
    --glow-soft: 0 0 12px rgba(0, 255, 65, 0.12);
    --radius: 2px;
    --shell: 68rem;
}

/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */

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

html {
    color-scheme: dark;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    gap: clamp(1.25rem, 3vw, 2.25rem);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding-block: 1.25rem 1.75rem;
    font-family: var(--mono);
    font-size: clamp(0.95rem, 0.6rem + 0.5vw, 1.0625rem);
    line-height: 1.8;
    color: var(--text-body);
    background-color: var(--matrix-black);
    background-image:
        radial-gradient(
            ellipse 80% 55% at 50% -10%,
            rgba(0, 255, 65, 0.11),
            transparent 70%
        ),
        radial-gradient(
            ellipse 55% 45% at 92% 105%,
            rgba(0, 255, 65, 0.07),
            transparent 70%
        ),
        repeating-linear-gradient(
            90deg,
            rgba(0, 255, 65, 0.035) 0 1px,
            transparent 1px 80px
        ),
        repeating-linear-gradient(
            0deg,
            rgba(0, 255, 65, 0.025) 0 1px,
            transparent 1px 80px
        );
    background-attachment: fixed;
    overflow-x: hidden;
}

/* Shared shell width for the three main regions */
header,
main,
footer {
    width: min(100% - 2rem, var(--shell));
    margin-inline: auto;
}

h1,
h2,
p,
ul {
    margin: 0;
}

img {
    max-width: 100%;
    display: block;
}

::selection {
    background: var(--matrix-green);
    color: #00180a;
    text-shadow: none;
}

:focus-visible {
    outline: 1px solid var(--matrix-green);
    outline-offset: 3px;
    box-shadow: var(--glow);
}

/* --------------------------------------------------------------------------
   Digital rain (decorative, fixed behind everything)
   -------------------------------------------------------------------------- */

body::before {
    content: "";
    position: fixed;
    inset: -240px 0;
    z-index: -2;
    pointer-events: none;
    opacity: 0.5;
    background-repeat: repeat-y;
    background-size:
        2px 240px, 1px 240px, 1px 240px, 2px 240px, 1px 240px, 3px 240px,
        1px 240px, 2px 240px, 1px 240px, 1px 240px, 2px 240px, 1px 240px,
        1px 240px, 3px 240px;
    background-position:
        4% 0px, 11% 70px, 17% 150px, 24% 30px, 31% 110px, 38% 190px,
        45% 60px, 53% 130px, 60% 10px, 67% 200px, 74% 90px, 81% 160px,
        89% 40px, 95% 120px;
    background-image:
        linear-gradient(180deg, transparent 55%, rgba(0, 255, 65, 0.55) 72%, transparent 77%),
        linear-gradient(180deg, transparent 38%, rgba(0, 255, 65, 0.35) 48%, transparent 53%),
        linear-gradient(180deg, transparent 62%, rgba(0, 255, 65, 0.45) 78%, transparent 83%),
        linear-gradient(180deg, transparent 30%, rgba(0, 255, 65, 0.3) 40%, transparent 45%),
        linear-gradient(180deg, transparent 48%, rgba(0, 255, 65, 0.5) 64%, transparent 69%),
        linear-gradient(180deg, transparent 66%, rgba(0, 255, 65, 0.22) 82%, transparent 87%),
        linear-gradient(180deg, transparent 22%, rgba(0, 255, 65, 0.4) 34%, transparent 39%),
        linear-gradient(180deg, transparent 58%, rgba(0, 255, 65, 0.5) 70%, transparent 75%),
        linear-gradient(180deg, transparent 42%, rgba(0, 255, 65, 0.3) 52%, transparent 57%),
        linear-gradient(180deg, transparent 70%, rgba(0, 255, 65, 0.35) 84%, transparent 89%),
        linear-gradient(180deg, transparent 34%, rgba(0, 255, 65, 0.45) 46%, transparent 51%),
        linear-gradient(180deg, transparent 60%, rgba(0, 255, 65, 0.28) 74%, transparent 79%),
        linear-gradient(180deg, transparent 26%, rgba(0, 255, 65, 0.35) 38%, transparent 43%),
        linear-gradient(180deg, transparent 50%, rgba(0, 255, 65, 0.2) 66%, transparent 71%);
    -webkit-mask-image: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.95),
        rgba(0, 0, 0, 0.35) 70%,
        rgba(0, 0, 0, 0.12)
    );
    mask-image: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.95),
        rgba(0, 0, 0, 0.35) 70%,
        rgba(0, 0, 0, 0.12)
    );
    animation: rain-fall 16s linear infinite;
}

/* Vignette — keeps the edges of the "screen" in shadow */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(
        ellipse at 50% 45%,
        transparent 45%,
        rgba(0, 0, 0, 0.55) 100%
    );
}

/* CRT scanlines over the whole viewport */
html::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: repeating-linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.16) 0 1px,
        transparent 1px 4px
    );
}

/* Slow phosphor sweep drifting down the screen */
html::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: 32vh;
    z-index: 4;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        transparent,
        rgba(0, 255, 65, 0.05) 55%,
        transparent
    );
    animation: phosphor-sweep 11s linear infinite;
}

/* --------------------------------------------------------------------------
   Header / terminal bar
   -------------------------------------------------------------------------- */

header {
    position: sticky;
    top: 1rem;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
    padding: clamp(0.9rem, 2vw, 1.25rem) clamp(1rem, 3vw, 1.75rem);
    background: linear-gradient(
        180deg,
        rgba(0, 22, 6, 0.92),
        rgba(0, 10, 3, 0.82)
    );
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    box-shadow: var(--glow-soft), inset 0 1px 0 rgba(0, 255, 65, 0.12);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

/* Bright hairline along the top edge of the bar */
header::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--matrix-green) 18%,
        var(--matrix-green-bright) 50%,
        var(--matrix-green) 82%,
        transparent
    );
    opacity: 0.7;
}

h1 {
    position: relative;
    font-size: clamp(1.3rem, 1rem + 1.6vw, 2rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--matrix-green);
    text-shadow: var(--glow), 2px 0 1px rgba(0, 255, 120, 0.25),
        -2px 0 1px rgba(0, 90, 40, 0.5);
    animation: title-pulse 6s ease-in-out infinite;
}

/* Block cursor blinking after the title */
h1::after {
    content: "";
    display: inline-block;
    width: 0.55em;
    height: 0.95em;
    margin-left: 0.4em;
    vertical-align: -0.1em;
    background: var(--matrix-green);
    box-shadow: var(--glow);
    animation: blink 1.15s steps(1, end) infinite;
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

nav ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 1.5rem);
    padding: 0;
    list-style: none;
}

nav a {
    position: relative;
    display: inline-block;
    padding: 0.3rem 0.1rem;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--matrix-green-dim);
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

/* Terminal-style brackets that appear on hover / focus */
nav a::before,
nav a::after {
    display: inline-block;
    color: var(--matrix-green-mid);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

nav a::before {
    content: "[";
    transform: translateX(4px);
}

nav a::after {
    content: "]";
    transform: translateX(-4px);
}

/* Current page marker */
nav ul > li.active {
    position: relative;
    display: flex;
    align-items: center;
}

nav ul > li.active > a {
    color: var(--matrix-green);
    text-shadow: var(--glow);
}

/* Vertical indicator on the active list item */
nav ul > li.active::before {
    content: "";
    flex: 0 0 auto;
    width: 2px;
    height: 0.9em;
    margin-right: 0.6rem;
    background: var(--matrix-green);
    box-shadow: var(--glow);
}

/* Blinking underscore after the active link */
nav ul > li.active > a::after {
    content: "_";
    opacity: 1;
    transform: none;
    animation: blink 1.15s steps(1, end) infinite;
}

/* Keep the hover brackets off the active item */
nav ul > li.active > a::before {
    content: none;
}

nav ul > li.active > a:hover,
nav ul > li.active > a:focus-visible {
    color: var(--matrix-green-bright);
    text-shadow: 0 0 9px rgba(0, 255, 65, 0.8), 0 0 28px rgba(0, 255, 65, 0.3);
}

nav a:hover,
nav a:focus-visible {
    color: var(--matrix-green-bright);
    text-shadow: var(--glow);
}

nav a:hover::before,
nav a:hover::after,
nav a:focus-visible::before,
nav a:focus-visible::after {
    opacity: 1;
    transform: none;
}

/* --------------------------------------------------------------------------
   Style picker (select#style)
   -------------------------------------------------------------------------- */

.style-picker {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.style-picker__label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--matrix-green-dim);
    white-space: nowrap;
}

.style-picker select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    max-width: 12rem;
    padding: 0.35rem 2rem 0.35rem 0.7rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--matrix-green);
    background-color: rgba(0, 18, 5, 0.9);
    /* Custom caret drawn with two gradients */
    background-image:
        linear-gradient(45deg, transparent 50%, currentColor 50%),
        linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position:
        calc(100% - 13px) calc(50% + 1px),
        calc(100% - 8px) calc(50% + 1px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    box-shadow: inset 0 0 12px rgba(0, 255, 65, 0.07);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.style-picker select:hover {
    border-color: rgba(0, 255, 65, 0.6);
    box-shadow: inset 0 0 14px rgba(0, 255, 65, 0.12), var(--glow-soft);
}

.style-picker select:focus-visible {
    border-color: var(--matrix-green);
    outline: 1px solid var(--matrix-green);
    outline-offset: 2px;
    box-shadow: var(--glow);
}

.style-picker select option {
    background-color: #02150a;
    color: var(--matrix-green-bright);
}

/* --------------------------------------------------------------------------
   Main panel
   -------------------------------------------------------------------------- */

main {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(1rem, 2.5vw, 1.6rem);
    padding: clamp(1.6rem, 4vw, 3.25rem);
    background: linear-gradient(
        160deg,
        rgba(0, 30, 8, 0.78),
        rgba(0, 12, 4, 0.62) 60%,
        rgba(0, 22, 6, 0.7)
    );
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    box-shadow: inset 0 0 60px rgba(0, 255, 65, 0.05),
        0 0 30px rgba(0, 255, 65, 0.06);
}

/* Corner brackets — top-left and bottom-right */
main::before,
main::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 1px solid var(--matrix-green);
    opacity: 0.75;
    pointer-events: none;
}

main::before {
    top: -1px;
    left: -1px;
    border-right: 0;
    border-bottom: 0;
}

main::after {
    right: -1px;
    bottom: -1px;
    border-top: 0;
    border-left: 0;
}

main h2 {
    position: relative;
    padding-left: 1.6em;
    padding-bottom: 0.85rem;
    font-size: clamp(1.05rem, 0.85rem + 1vw, 1.55rem);
    font-weight: 700;
    line-height: 1.45;
    letter-spacing: 0.015em;
    color: var(--matrix-green-bright);
    text-shadow: 0 0 14px rgba(0, 255, 65, 0.35);
    border-bottom: 1px dashed rgba(0, 255, 65, 0.22);
}

/* Terminal prompt before the heading */
main h2::before {
    content: ">";
    position: absolute;
    left: 0.15em;
    color: var(--matrix-green-mid);
    text-shadow: var(--glow);
}

main p {
    max-width: 62ch;
    color: var(--text-body);
    line-height: 1.9;
    text-wrap: pretty;
}

/* Faint green wash behind the copy */
main p::first-line {
    color: #a5ecc0;
}

/* --------------------------------------------------------------------------
   Contact form — terminal input panel
   -------------------------------------------------------------------------- */

.contact-form {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.15rem;
    width: 100%;
    max-width: 46rem;
    margin-top: 0.25rem;
    padding: clamp(1.1rem, 3vw, 1.6rem);
    background-color: rgba(0, 14, 4, 0.6);
    background-image: repeating-linear-gradient(
        180deg,
        rgba(0, 255, 65, 0.03) 0 1px,
        transparent 1px 4px
    );
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    box-shadow: inset 0 0 32px rgba(0, 255, 65, 0.06);
}

/* Bright hairline along the top edge of the panel */
.contact-form::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--matrix-green-mid) 25%,
        var(--matrix-green) 50%,
        transparent 85%
    );
    opacity: 0.7;
}

.contact-form__field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.contact-form__field--wide,
.contact-form button {
    grid-column: 1 / -1;
}

.contact-form label {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--matrix-green-dim);
}

/* Terminal prompt before each label */
.contact-form label::before {
    content: "> ";
    color: var(--matrix-green-mid);
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-family: var(--mono);
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--matrix-green-bright);
    background-color: rgba(0, 20, 6, 0.88);
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    box-shadow: inset 0 0 14px rgba(0, 255, 65, 0.06);
    caret-color: var(--matrix-green);
    transition: border-color 0.2s ease, box-shadow 0.2s ease,
        background-color 0.2s ease;
}

.contact-form textarea {
    min-height: 8.5rem;
    resize: vertical;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: rgba(143, 224, 168, 0.35);
}

.contact-form input:hover,
.contact-form textarea:hover {
    border-color: rgba(0, 255, 65, 0.5);
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--matrix-green);
    background-color: rgba(0, 26, 8, 0.95);
    box-shadow: var(--glow), inset 0 0 16px rgba(0, 255, 65, 0.1);
}

.contact-form button {
    justify-self: start;
    padding: 0.6rem 1.5rem;
    font-family: var(--mono);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--matrix-green);
    background-color: rgba(0, 26, 8, 0.8);
    border: 1px solid rgba(0, 255, 65, 0.55);
    border-radius: var(--radius);
    box-shadow: inset 0 0 18px rgba(0, 255, 65, 0.08);
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease,
        box-shadow 0.2s ease, transform 0.12s ease;
}

.contact-form button::before {
    content: "[ ";
}

.contact-form button::after {
    content: " ]";
}

.contact-form button:hover,
.contact-form button:focus-visible {
    color: #00180a;
    background-color: var(--matrix-green);
    box-shadow: var(--glow);
}

.contact-form button:active {
    transform: translateY(1px);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

footer {
    margin-top: auto;
    padding-top: clamp(1rem, 2.5vw, 1.5rem);
    border-top: 1px solid rgba(0, 255, 65, 0.15);
    text-align: center;
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--matrix-green-dim);
}

footer p::before,
footer p::after {
    color: var(--matrix-green-mid);
    opacity: 0.65;
}

footer p::before {
    content: "// ";
}

footer p::after {
    content: " //";
}

/* --------------------------------------------------------------------------
   Scrollbar (WebKit / Blink)
   -------------------------------------------------------------------------- */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #010a03;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--matrix-green-dark), #021b09);
    border: 1px solid rgba(0, 255, 65, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--matrix-green-dim), #04320f);
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

@keyframes rain-fall {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(240px);
    }
}

@keyframes phosphor-sweep {
    from {
        transform: translateY(-35vh);
    }
    to {
        transform: translateY(105vh);
    }
}

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

@keyframes title-pulse {
    0%,
    100% {
        text-shadow: 0 0 6px rgba(0, 255, 65, 0.55),
            0 0 24px rgba(0, 255, 65, 0.2), 2px 0 1px rgba(0, 255, 120, 0.25),
            -2px 0 1px rgba(0, 90, 40, 0.5);
    }
    50% {
        text-shadow: 0 0 9px rgba(0, 255, 65, 0.8),
            0 0 34px rgba(0, 255, 65, 0.32), 2px 0 1px rgba(0, 255, 120, 0.3),
            -2px 0 1px rgba(0, 90, 40, 0.55);
    }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 720px) {
    header {
        position: static;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    nav ul {
        gap: 0.85rem;
    }

    h1 {
        letter-spacing: 0.12em;
    }

    .style-picker {
        align-self: flex-start;
    }

    main::before,
    main::after {
        width: 14px;
        height: 14px;
    }

    footer {
        letter-spacing: 0.2em;
        line-height: 1.7;
    }

    .contact-form {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .contact-form button {
        justify-self: stretch;
    }
}

/* --------------------------------------------------------------------------
   Accessibility: respect reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    body::before,
    html::after,
    h1,
    h1::after,
    nav ul > li.active > a::after {
        animation: none;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }
}
