/* ==========================================================================
   BASE — loaded by every page.
   Design tokens, reset, layout, header/navigation, language switch,
   buttons, section headings and footer.

   Look: a pixel-art lab, taken from the logo (the pixel flask) and the slime.
   Boxes have stepped pixel corners (clip-path) instead of rounded ones,
   labels and display text use a pixel font, and buttons have 8-bit depth.
   ========================================================================== */

/* ---------- Design tokens ---------- */

:root {
    /* Colors */
    --bg: #0b0b14;
    --surface: #12121f;
    --surface-2: #1a1a2c;
    --border: #26263d;
    --edge: #2e2e4a;            /* 3px pixel frames around panels */
    --text: #f7f5ff;
    --text-muted: #b9b7cc;
    --brand: #172ceb;
    --brand-light: #5b6cff;     /* brand blue that is readable as text on the dark background */
    --brand-deep: #0d1a9e;
    --ink: #0b0b14;             /* dark text on colored labels */
    --success: #00b31e;
    --pending: #ffb84d;         /* placeholders: content that is still missing */

    /* One accent color per portfolio area (tags, filters, area cards) */
    --area-games: #5b6cff;
    --area-3d: #ff8a3d;
    --area-vr: #a66bff;
    --area-video: #ff4d6a;
    --area-web: #2fd08a;

    /* Typography */
    --font: 'Rubik', sans-serif;
    /* Pixel titles (logo, hero, page and card titles). Jersey 10 has a single weight:
       always use it at 400, a fake bold smudges the pixels. */
    --font-display: 'Jersey 10', 'Rubik', sans-serif;
    /* Small UI text (menu, buttons, tags, dates): a monospace that stays readable at small sizes */
    --font-label: 'JetBrains Mono', ui-monospace, monospace;
    --fs-hero: clamp(3.5rem, 11.5vw, 8.5rem);
    --fs-h1: clamp(2.75rem, 7.5vw, 5rem);
    --fs-h2: clamp(1.75rem, 4vw, 2.75rem);
    --fs-h3: 1.2rem;
    --fs-small: 0.875rem;

    /* Layout */
    --max-width: 1200px;
    --gutter: max(16px, calc((100% - var(--max-width)) / 2));   /* side padding that centers content */
    --section-space: clamp(64px, 9vw, 120px);
    --header-height: 72px;

    /* Pixel corners (clip-path shapes). A custom property can't take a size,
       so there is one shape per size:
       --notch:    removes the 3px corner pixel; with a 3px frame it draws a pixel-art box
       --notch-sm: same, 2px (small boxes with a 2px frame)
       --steps:    two 3px steps, for filled shapes (buttons, icon tiles)
       --steps-sm: two 2px steps (tags)
       --steps-lg: two 6px steps (big blocks) */
    --notch: polygon(3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 3px calc(100% - 3px), 0 calc(100% - 3px), 0 3px, 3px 3px);
    --notch-sm: polygon(2px 0, calc(100% - 2px) 0, calc(100% - 2px) 2px, 100% 2px, 100% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 100%, 2px 100%, 2px calc(100% - 2px), 0 calc(100% - 2px), 0 2px, 2px 2px);
    --steps: polygon(6px 0, calc(100% - 6px) 0, calc(100% - 6px) 3px, calc(100% - 3px) 3px, calc(100% - 3px) 6px, 100% 6px, 100% calc(100% - 6px), calc(100% - 3px) calc(100% - 6px), calc(100% - 3px) calc(100% - 3px), calc(100% - 6px) calc(100% - 3px), calc(100% - 6px) 100%, 6px 100%, 6px calc(100% - 3px), 3px calc(100% - 3px), 3px calc(100% - 6px), 0 calc(100% - 6px), 0 6px, 3px 6px, 3px 3px, 6px 3px);
    --steps-sm: polygon(4px 0, calc(100% - 4px) 0, calc(100% - 4px) 2px, calc(100% - 2px) 2px, calc(100% - 2px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 2px) calc(100% - 4px), calc(100% - 2px) calc(100% - 2px), calc(100% - 4px) calc(100% - 2px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 2px), 2px calc(100% - 2px), 2px calc(100% - 4px), 0 calc(100% - 4px), 0 4px, 2px 4px, 2px 2px, 4px 2px);
    --steps-lg: polygon(12px 0, calc(100% - 12px) 0, calc(100% - 12px) 6px, calc(100% - 6px) 6px, calc(100% - 6px) 12px, 100% 12px, 100% calc(100% - 12px), calc(100% - 6px) calc(100% - 12px), calc(100% - 6px) calc(100% - 6px), calc(100% - 12px) calc(100% - 6px), calc(100% - 12px) 100%, 12px 100%, 12px calc(100% - 6px), 6px calc(100% - 6px), 6px calc(100% - 12px), 0 calc(100% - 12px), 0 12px, 6px 12px, 6px 6px, 12px 6px);

    /* Pixel-dotted line (header and footer edges) */
    --dots: repeating-linear-gradient(90deg, var(--edge) 0 6px, transparent 6px 12px);
}

/* ---------- Reset ---------- */

/* The font is set once on <body> and inherited, so text nested inside a pixel label
   (e.g. "Image pending" inside the placeholder label) keeps the label's font */
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    text-decoration: none;
    list-style: none;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-synthesis: style;          /* never fake a bold: it would smudge the pixel font */
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--brand);
    color: var(--text);
}

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

a {
    color: inherit;
}

/* Half the space above and below, so two sections in a row are --section-space apart */
section {
    padding: calc(var(--section-space) / 2) var(--gutter);
}

/* Hides the page for a moment while a non-default language is applied,
   so English text doesn't flash before the translation (see i18n.js). */
.i18n-loading body {
    visibility: hidden;
}

/* ---------- Utilities ---------- */

.pixelated {
    image-rendering: pixelated;
}

.link {
    color: var(--brand-light);
}

.link:hover {
    text-decoration: underline;
}

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding-inline: var(--gutter);
    background: var(--dots) bottom / 100% 3px no-repeat, rgb(11 11 20 / 88%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.logo {
    display: inline-flex;
    align-items: center;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.logo-mark {
    width: 36px;
    height: 36px;
    margin-right: 10px;
    image-rendering: pixelated;
}

.logo span {
    color: var(--brand-light);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.navbar {
    display: flex;
    gap: 0.25rem;
}

/* Menu items work like a game menu: a ▸ cursor marks the current page and the hovered item */
.navbar a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    color: var(--text-muted);
    font-family: var(--font-label);
    font-size: 0.92rem;
    font-weight: 500;
    transition: color .15s steps(2);
}

.navbar a::before {
    content: '';
    width: 0;
    height: 0;
    border-block: 5px solid transparent;
    border-left: 6px solid currentColor;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .15s steps(2), transform .15s steps(2);
}

.navbar a:hover {
    color: var(--text);
}

.navbar a:hover::before,
.navbar a[aria-current="page"]::before {
    opacity: 1;
    transform: none;
}

.navbar a[aria-current="page"] {
    color: var(--text);
}

.navbar a[aria-current="page"]::before {
    color: var(--brand-light);
}

#menu-icon {
    display: none;
    font-size: 30px;
    cursor: pointer;
}

/* ---------- Language switch (buttons are created by i18n.js) ---------- */

.lang-switch {
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--edge);
    clip-path: var(--notch-sm);
}

.lang-switch button {
    background: var(--bg);
    color: var(--text-muted);
    border: none;
    padding: 4px 9px;
    font-family: var(--font-label);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: color .15s steps(2), background .15s steps(2);
}

.lang-switch button:hover {
    color: var(--text);
}

.lang-switch button[aria-pressed="true"] {
    background: var(--brand);
    color: var(--text);
}

/* ---------- Buttons: 8-bit, with a lit top edge and a shaded bottom edge ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 22px 3px;
    background: var(--brand);
    color: var(--text);
    border: none;
    clip-path: var(--steps);
    box-shadow:
        inset 0 3px 0 rgb(255 255 255 / 20%),
        inset 0 -5px 0 rgb(0 0 0 / 35%);
    font-family: var(--font-label);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform .12s steps(2), filter .12s steps(2);
}

.btn:hover {
    transform: translateY(-3px);
    filter: brightness(1.15);
}

/* Pressed: the button sinks and loses most of its depth */
.btn:active {
    transform: translateY(1px);
    box-shadow:
        inset 0 2px 0 rgb(255 255 255 / 12%),
        inset 0 -2px 0 rgb(0 0 0 / 35%);
}

/* The clip-path would hide an outer outline, so focus is drawn inside */
.btn:focus-visible {
    outline: 3px solid var(--text);
    outline-offset: -7px;
}

.btn i {
    font-size: 1.25rem;
}

/* Secondary button: a 3px pixel frame instead of a fill */
.btn-ghost {
    background: rgb(11 11 20 / 55%);
    clip-path: var(--notch);
    box-shadow: inset 0 0 0 3px var(--edge);
}

.btn-ghost:hover {
    filter: none;
    box-shadow: inset 0 0 0 3px var(--brand-light);
}

.btn-ghost:active {
    box-shadow: inset 0 0 0 3px var(--brand-light);
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

/* ---------- Page heading (top of inner pages) ---------- */

.page-head {
    padding-top: var(--section-space);
}

/* Display titles: pixel font with an extruded "game title" shadow */
.page-title {
    font-family: var(--font-display);
    font-size: var(--fs-h1);
    font-weight: 400;
    line-height: 1.05;
    text-shadow: 3px 3px 0 var(--brand-deep), 6px 6px 0 #070d52;
}

/* ---------- Section headings ---------- */

.section-head {
    max-width: 720px;
    margin-bottom: 40px;
}

/* Heading on the left, link on the right (e.g. "See all") */
.section-head-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    max-width: none;
}

/* Small label above a title, with a pixel bullet */
.eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--brand-light);
    font-family: var(--font-label);
    font-size: 0.92rem;
    font-weight: 500;
}

.eyebrow::before {
    content: '';
    flex: none;
    width: 8px;
    height: 8px;
    background: currentColor;
    box-shadow: 4px 4px 0 rgb(91 108 255 / 35%);
}

.section-title {
    font-size: var(--fs-h2);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.section-lead {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-top: 16px;
}

.arrow-link {
    color: var(--brand-light);
    font-family: var(--font-label);
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
}

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

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

.site-footer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px 48px;
    align-items: center;
    padding: 48px var(--gutter);
    background: var(--dots) top / 100% 3px no-repeat, var(--surface);
    color: var(--text-muted);
}

.footer-brand p {
    margin-top: 8px;
    font-size: var(--fs-small);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-label);
    font-size: 0.92rem;
    transition: color .15s steps(2);
}

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

.footer-links i {
    font-size: 1.25rem;
}

.footer-copy {
    grid-column: 1;
    grid-row: 2;
    font-size: var(--fs-small);
}

/* Social networks: small, muted icon tiles on the same row as the copyright */
.footer-social {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.footer-social a {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    background: var(--surface-2);
    color: var(--text-muted);
    clip-path: var(--steps-sm);
    font-size: 1.15rem;
    opacity: 0.75;
    transition: color .15s steps(2), background .15s steps(2), opacity .15s steps(2);
}

.footer-social a:hover,
.footer-social a:focus-visible {
    background: var(--brand);
    color: var(--text);
    opacity: 1;
}

.footer-social svg {
    width: 15px;
    height: 15px;
}

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0s !important;
        animation: none !important;
    }
}

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

/* Mobile: the navbar becomes a drop-down toggled by the menu icon */
@media (max-width: 860px) {
    #menu-icon {
        display: block;
    }

    .navbar {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        padding: 8px var(--gutter) 16px;
        background: var(--dots) bottom / 100% 3px no-repeat, var(--surface);
        box-shadow: 0 20px 40px rgb(0 0 0 / 50%);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity .2s steps(3), transform .2s steps(3), visibility .2s;
    }

    .navbar.active {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .navbar a {
        padding: 14px 4px;
        font-size: 1rem;
    }

    .navbar li + li a {
        background: linear-gradient(90deg, var(--edge) 0 6px, transparent 6px 12px) top / 12px 2px repeat-x;
    }
}

@media (max-width: 600px) {
    :root {
        --header-height: 64px;
    }

    .logo {
        font-size: 1.6rem;
    }

    .logo-mark {
        width: 30px;
        height: 30px;
    }

    .header-actions {
        gap: 0.75rem;
    }

    .site-footer {
        grid-template-columns: 1fr;
    }

    .footer-social,
    .footer-copy {
        grid-column: 1;
        grid-row: auto;
        justify-self: start;
    }
}
