/* =========================================================
   base.css — @font-face, Body, Global Styles
   =========================================================
   Font files must be placed in assets/fonts/.
   Download from Google Fonts or Nerd Fonts:
     JetBrains Mono  → https://www.jetbrains.com/lp/mono/
     Share Tech Mono → https://fonts.google.com/specimen/Share+Tech+Mono
     VT323           → https://fonts.google.com/specimen/VT323
   ========================================================= */

/* -------------------------------------------------------
   @font-face declarations
------------------------------------------------------- */

@font-face {
    font-family: "JetBrains Mono";
    src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("../fonts/JetBrainsMono-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Share Tech Mono";
    src: url("../fonts/ShareTechMono-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "VT323";
    src: url("../fonts/VT323-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* -------------------------------------------------------
   HTML & Body
------------------------------------------------------- */

html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

body {
    font-family: var(--font-primary);
    font-size: var(--fs-base);
    font-weight: 400;
    line-height: var(--lh-normal);
    color: var(--color-green);
    background-color: var(--color-void);
    overflow-x: hidden;
    /* Subtle dot-grid texture on the void */
    background-image: radial-gradient(
        circle,
        rgba(0, 255, 65, 0.07) 1px,
        transparent 1px
    );
    background-size: 36px 36px;
    background-attachment: fixed;
}

/* -------------------------------------------------------
   Skip-to-content (accessibility)
------------------------------------------------------- */

.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    padding: var(--space-2) var(--space-4);
    background: var(--color-green);
    color: var(--color-void);
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: var(--fs-sm);
    border-radius: var(--radius-md);
    z-index: var(--z-toast);
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: var(--space-4);
    outline: 2px solid var(--color-cyan);
    outline-offset: 2px;
}

/* -------------------------------------------------------
   Selection
------------------------------------------------------- */

::selection {
    background-color: var(--color-green-30);
    color: var(--color-green);
}

/* -------------------------------------------------------
   Custom scrollbar (WebKit)
------------------------------------------------------- */

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

::-webkit-scrollbar-track {
    background: var(--color-navy);
}

::-webkit-scrollbar-thumb {
    background: var(--color-green-40);
    border-radius: var(--radius-full);
    border: 2px solid var(--color-navy);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-cyan-40);
}

::-webkit-scrollbar-corner {
    background: var(--color-navy);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-green-40) var(--color-navy);
}

/* -------------------------------------------------------
   Focus styles
------------------------------------------------------- */

:focus-visible {
    outline: 2px solid var(--color-cyan);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* -------------------------------------------------------
   Global type hierarchy
------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-primary);
    font-weight: 700;
    line-height: var(--lh-tight);
    color: var(--color-green);
}

p {
    line-height: var(--lh-relaxed);
    color: var(--text-secondary);
}

a {
    color: var(--color-cyan);
    transition:
        color var(--transition-fast),
        text-shadow var(--transition-fast);
}

a:hover {
    color: var(--color-green);
    text-shadow: 0 0 8px var(--color-green-40);
}

code,
kbd,
samp {
    font-family: var(--font-code);
    font-size: 0.9em;
    color: var(--color-cyan);
}

/* -------------------------------------------------------
   Sections — base layout
------------------------------------------------------- */

.section {
    position: relative;
    padding: var(--section-padding-y) var(--section-padding-x);
    z-index: var(--z-content);
    /* Offset for fixed nav */
    scroll-margin-top: var(--nav-height);
}

.section__inner {
    max-width: var(--content-width);
    margin: 0 auto;
}

/* -------------------------------------------------------
   Section titles
------------------------------------------------------- */

.section__title {
    font-family: var(--font-primary);
    font-size: var(--fs-3xl);
    font-weight: 700;
    letter-spacing: var(--ls-tight);
    color: var(--color-green);
    line-height: var(--lh-tight);
    margin-bottom: var(--space-12);
    display: inline-block;
    position: relative;
}

/* Decorative comment prefix */
.section__title::before {
    content: "// ";
    color: var(--color-amber);
    font-weight: 400;
    font-size: 0.75em;
    opacity: 0.9;
}

/* Underline accent bar */
.section__title::after {
    content: "";
    display: block;
    width: 100%;
    height: 2px;
    margin-top: var(--space-3);
    background: linear-gradient(
        to right,
        var(--color-green-60),
        var(--color-cyan-30),
        transparent
    );
    border-radius: var(--radius-full);
}

/* Title accent span (the ::namespace part) */
.section__title-accent {
    color: var(--color-cyan);
}

/* -------------------------------------------------------
   Reveal animation hook
   (JS IntersectionObserver adds .visible class)
------------------------------------------------------- */

.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity var(--duration-slow) var(--ease-out),
        transform var(--duration-slow) var(--ease-out);
    will-change: opacity, transform;
}

/* JS (observer.js) adds .revealed — NOT .visible */
.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children of a reveal group */
.reveal-group > * {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity var(--duration-slow) var(--ease-out),
        transform var(--duration-slow) var(--ease-out);
}

.reveal-group.visible > *:nth-child(1) {
    transition-delay: 0ms;
    opacity: 1;
    transform: none;
}
.reveal-group.visible > *:nth-child(2) {
    transition-delay: 80ms;
    opacity: 1;
    transform: none;
}
.reveal-group.visible > *:nth-child(3) {
    transition-delay: 160ms;
    opacity: 1;
    transform: none;
}
.reveal-group.visible > *:nth-child(4) {
    transition-delay: 240ms;
    opacity: 1;
    transform: none;
}

/* -------------------------------------------------------
   Cursor blink utility
------------------------------------------------------- */

.cursor {
    display: inline-block;
    animation: blink 1s step-end infinite;
    color: var(--color-green);
}

.cursor--block {
    font-family: var(--font-retro);
    font-size: 1em;
    line-height: 1;
}

/* -------------------------------------------------------
   Utility: visually hidden (accessible)
------------------------------------------------------- */

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

/* -------------------------------------------------------
   Utility: neon text
------------------------------------------------------- */

.neon-green {
    color: var(--color-green);
    text-shadow:
        0 0 8px var(--color-green-60),
        0 0 20px var(--color-green-30);
}

.neon-cyan {
    color: var(--color-cyan);
    text-shadow:
        0 0 8px var(--color-cyan-40),
        0 0 20px var(--color-cyan-20);
}

.neon-amber {
    color: var(--color-amber);
    text-shadow: 0 0 8px var(--color-amber-30);
}
