﻿@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter_24pt-Regular.woff2') format('woff2'), url('fonts/Inter_24pt-Regular.woff') format('woff');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter_24pt-SemiBold.woff2') format('woff2'), url('fonts/Inter_24pt-SemiBold.woff') format('woff');
    font-weight: 600;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --background: #171411;
    --cream: #f9e7c7;
    --muted: #cabb9e;
    --brass: #e4b46e;
    --brass-edge: #805c37;
    --dark-edge: #3a2b20;
    --heading: Georgia, 'Times New Roman', serif;
    --rivet: radial-gradient(circle at 35% 29%, #f5cd91 0, #9b663a 32%, #3b2518 59%, #140f0b 71%, transparent 76%);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior-y: auto;
}

body {
    margin: 0;
    color: var(--cream);
    background-color: var(--background);
    font: 400 14px/1.5 'Inter', sans-serif;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
:focus-visible {
    outline: 2px solid #ffdc97;
    outline-offset: 4px;
}

.hub-scroll {
    height: 100%;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: none;
    touch-action: pan-x pan-y;
    background:
        radial-gradient(ellipse at 50% 0, #52371e80, transparent 65%),
        repeating-linear-gradient(90deg, transparent 0 119px, #a5784210 119px 120px, #08060444 120px 122px);
}

.hub-scroll.is-at-top { overscroll-behavior-y: auto; }
.hub-scroll:focus-visible { outline-offset: -2px; }

.hub {
    width: min(100%, 1220px);
    margin-inline: auto;
    padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
        max(44px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}

.hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: clamp(216px, 25vw, 270px);
    padding: 28px clamp(28px, 6vw, 85px);
    overflow: hidden;
    border: 1px solid var(--brass-edge);
    border-radius: 12px;
    background:
        linear-gradient(90deg, #1a100c 0%, #21160ed9 28%, #21160e52 56%, #160e0a1a 100%),
        url('./assets/hub-machinery.webp') 61% 50% / cover no-repeat,
        #201812;
    box-shadow: inset 0 0 34px #0e0808a8, 0 14px 36px #100a07a6;
}

.hero::before, .hero::after {
    content: '';
    position: absolute;
    pointer-events: none;
}

.hero::before {
    inset: 7px;
    border: 1px solid #c18b4d70;
    border-radius: 6px;
}

.hero::after {
    inset: 11px;
    background:
        var(--rivet) left top, var(--rivet) right top,
        var(--rivet) left bottom, var(--rivet) right bottom;
    background-size: 15px 15px;
    background-repeat: no-repeat;
}

.hero-plaque {
    display: grid;
    justify-items: start;
    gap: 12px;
}

.hero-emblem {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 1px solid #ad7843;
    border-radius: 50%;
    color: var(--brass);
    background: radial-gradient(circle at 48% 28%, #523623, #20150f 64%);
    box-shadow: 0 0 0 3px #24170f, 0 0 0 4px #704d31, inset 0 0 0 3px #251910;
    font: 30px/1 'Segoe UI Symbol', 'DejaVu Sans', sans-serif;
    text-shadow: 0 2px 2px #0e0a08;
}

.hero h1 {
    margin: 0;
    font: 700 clamp(42px, 6vw, 80px) / .98 var(--heading);
    letter-spacing: -.05em;
    text-shadow: 0 3px 14px #0d0906;
}

.hub:has(.carousel:not([hidden])) .hero {
    min-height: clamp(150px, 18vw, 192px);
}

.hub:has(.carousel:not([hidden])) .hero h1 {
    font-size: clamp(40px, 6vw, 64px);
}

.library-toolbar {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 21px;
    padding: 12px 0;
    border-bottom: 1px solid #8e603d69;
    background: #1d1712;
    box-shadow: 0 10px 18px -14px #060403c9;
}

.library-toolbar h2 {
    margin: 0;
    font: 700 clamp(21px, 3.2vw, 33px)/1.1 var(--heading);
}

.view-switch {
    display: flex;
    flex-shrink: 0;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--brass-edge);
    border-radius: 7px;
    background: #15110e;
    box-shadow: inset 0 1px 5px #0a0806;
}

.view-switch button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: color 160ms ease, background 160ms ease;
}

.view-switch svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.view-switch button[aria-pressed='true'] {
    border-color: #b68b55;
    color: #28170c;
    background: linear-gradient(#ebc692, #c18a51);
    box-shadow: inset 0 1px #ffdfa8, 0 2px 3px #090705a6;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    padding: 0;
    margin: 16px 0 0;
    list-style: none;
}

.game-card {
    position: relative;
    min-width: 0;
    padding: 5px;
    border: 1px solid var(--brass-edge);
    border-radius: 8px;
    background: linear-gradient(150deg, #715036, #38291e 52%, #56402d);
    box-shadow: 0 8px 18px #090705a3, inset 0 0 0 1px #211710;
    transition: border-color 180ms ease, transform 180ms ease;
}

.game-card::after {
    content: '';
    position: absolute;
    inset: 3px;
    background:
        var(--rivet) left top, var(--rivet) right top,
        var(--rivet) left bottom, var(--rivet) right bottom;
    background-size: 9px 9px;
    background-repeat: no-repeat;
    pointer-events: none;
}

.game-art {
    position: relative;
    display: block;
    overflow: hidden;
    width: 100%;
    background: #211a15;
    color: var(--cream);
    text-decoration: none;
}

.game-art img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
    transition: filter 180ms ease;
}

.game-art:focus-visible {
    outline-offset: -2px;
    z-index: 1;
}

.game-card .game-art {
    height: 100%;
    border: 1px solid #23180f;
    border-radius: 4px;
}

.game-card img { aspect-ratio: 13 / 10; }

.card-caption {
    display: grid;
    gap: 4px;
    padding: 10px 12px 12px;
    border-top: 1px solid #97704282;
    background: linear-gradient(#30231a, #231912);
}

.card-name {
    font: 700 clamp(17px, 1.7vw, 23px)/1.12 var(--heading);
    overflow-wrap: anywhere;
}

.card-status { color: var(--brass); font-size: 11px; font-weight: 600; }

.carousel {
    margin-top: 16px;
    padding: 14px clamp(12px, 3vw, 42px) 18px;
    border: 1px solid var(--dark-edge);
    border-radius: 8px;
    background: #1d1712;
}

.game-heading { margin-bottom: 14px; text-align: center; }
.game-heading h2 { margin: 0; font: 700 clamp(25px, 4vw, 38px)/1.12 var(--heading); }

.game-counter {
    margin: 0 0 5px;
    color: var(--brass);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    letter-spacing: .16em;
}

.stage {
    display: grid;
    grid-template-columns: 48px minmax(0, min(400px, 48svh)) 48px;
    gap: clamp(8px, 2.2vw, 24px);
    align-items: center;
    justify-content: center;
}

.viewport {
    overflow: hidden;
    border: 1px solid var(--brass-edge);
    border-radius: 7px;
    background: #201913;
    box-shadow: 0 0 0 3px #3a2a1e, 0 10px 24px #100a08a6;
    touch-action: pan-y;
}

.track {
    display: flex;
    transition: transform 420ms cubic-bezier(.22, .68, .21, 1);
}

.slide { flex: 0 0 100%; min-width: 0; }
.slide .game-art { aspect-ratio: 1; }
.slide img { height: 100%; }

.play-badge {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 19px;
    border: 1px solid #f4cd8a;
    border-radius: 4px;
    background: linear-gradient(#e9c38b, #b8814d);
    box-shadow: inset 0 1px #ffe0aa, 0 4px 12px #100906a6;
    color: #291a10;
    font-weight: 600;
    white-space: nowrap;
}

.arrow {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 11px;
    border: 1px solid var(--brass-edge);
    border-radius: 50%;
    background: linear-gradient(#543d2a, #2c2018);
    box-shadow: inset 0 0 0 3px #221810, 0 4px 8px #0c0806a6;
    color: var(--brass);
    cursor: pointer;
    transition: border-color 160ms ease, transform 160ms ease;
}

.arrow svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; }
.arrow:active { transform: scale(.94); }

.thumbnails {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 56px));
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}

.thumbnail {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    padding: 3px;
    border: 1px solid var(--brass-edge);
    border-radius: 5px;
    background: #2a1e16;
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 2px;
    object-fit: cover;
    opacity: .68;
    transition: opacity 160ms ease;
}

.thumbnail[aria-current='true'] { border-color: #f9ce87; box-shadow: 0 0 0 1px #dca76e, 0 0 10px #e4b46e52; }
.thumbnail[aria-current='true'] img { opacity: 1; }

.controls-hint {
    margin: 12px 0 0;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

.noscript { text-align: center; }

@media (hover: hover) {
    .view-switch button[aria-pressed='false']:hover { background: #3a2b1f; color: var(--cream); }
    .game-card:hover { border-color: var(--brass); transform: translateY(-2px); }
    .arrow:hover, .thumbnail:hover { border-color: var(--brass); }
    .thumbnail:hover img { opacity: 1; }
    .game-art:hover img { filter: brightness(1.1); }
}

@media (max-width: 940px) {
    .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .hub {
        padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
            max(44px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    }
    .hero {
        min-height: 174px;
        padding: 23px;
        background-position: center, 60% center;
    }
    .hero::after { background-size: 10px 10px; }
    .hero-emblem { width: 39px; height: 39px; font-size: 23px; }
    .library-toolbar { margin-top: 12px; }
    .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .game-card img { aspect-ratio: 5 / 4; }
    .card-caption { padding: 8px 8px 9px; }
    .view-switch button { min-height: 40px; padding-inline: 8px; gap: 4px; }
    .view-switch svg { width: 14px; height: 14px; }
    .stage { grid-template-columns: 38px minmax(0, 360px) 38px; }
    .arrow { width: 38px; height: 38px; padding: 8px; }
    .thumbnails { grid-template-columns: repeat(5, minmax(0, 51px)); }
}

/* Leave room to scroll past the last game in mobile embeds with an overlay at the bottom. */
@media (max-width: 620px), (hover: none) and (pointer: coarse) {
    .hub { padding-bottom: max(120px, env(safe-area-inset-bottom)); }
}

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