/* vilegacy.games: the studio and its projects, in the look of catchflex.com. */

/* Cinzel, Roman capitals that match the studio logo: headings and the menu. Latin subset. */
@font-face {
    font-family: 'Cinzel';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('fonts/cinzel.woff2') format('woff2');
}

:root {
    --bg: #07070b;
    --bg-card: #111017;
    --line: rgba(255, 255, 255, .06);
    --line-strong: rgba(255, 255, 255, .26);
    --text: #ffffff;
    --text-dim: #b4b0bd;
    --text-faint: #7c7887;
    --copper: #d0824d;
    --copper-hi: #eba06c;
    color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
    background:
        radial-gradient(1500px 860px at 50% -80px, rgba(208, 130, 77, .14), rgba(208, 130, 77, 0) 70%),
        radial-gradient(1150px 800px at 4% 72%, rgba(208, 130, 77, .06), rgba(208, 130, 77, 0) 70%),
        radial-gradient(1150px 800px at 96% 52%, rgba(235, 160, 108, .05), rgba(235, 160, 108, 0) 70%),
        var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; /* the device's own font: nothing to load */
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* The studio mark as a faint pattern behind everything, drawn by pattern.js. */
.pattern {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Film grain over the whole page: static, faint, never takes clicks. */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    opacity: .07;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg, video { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--copper); color: #fff; }
:focus-visible { outline: 2px solid var(--copper-hi); outline-offset: 3px; border-radius: 4px; }

.skip {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--text);
    color: var(--bg);
    padding: 10px 18px;
    z-index: 300;
    font-weight: 700;
}
.skip:focus { left: 12px; top: 12px; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------- top menu: logo and section links as one centred group, as on catchflex.com */

.topnav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px 40px;
    min-height: 64px;
    padding: 10px 20px;
    background: rgba(7, 7, 11, .45);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.topnav-mark { display: inline-flex; border-radius: 4px; }
.topnav-mark img { height: 32px; width: auto; transition: filter .15s ease; }
.topnav-mark:hover img { filter: brightness(0) invert(1); }
.topnav-links { display: flex; gap: 28px; }
.topnav-links a {
    color: var(--copper);
    text-decoration: none;
    text-transform: uppercase;
    font-family: 'Cinzel', Georgia, serif;
    letter-spacing: .14em;
    font-size: 14px;
    font-weight: 700;
    transition: color .15s ease;
}
.topnav-links a:hover { color: #fff; }

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

/* ---------------------------------------------------------------- projects */

.projects, .about, .contact {
    max-width: 1180px;
    margin: 0 auto;
    padding: 40px 20px;
}
.projects { padding-top: 56px; }
.about { padding-top: 72px; }
.about p { color: #e4e0ea; font-size: clamp(20px, 2.6vw, 28px); font-weight: 600; line-height: 1.4; }

.section-title {
    font-family: 'Cinzel', Georgia, serif;
    font-weight: 700;
    text-transform: uppercase;
    font-size: clamp(28px, 4.4vw, 44px);
    line-height: 1;
    letter-spacing: .02em;
    margin-bottom: 28px;
}
.section-title::after {
    content: "";
    display: block;
    width: 64px;
    height: 4px;
    margin-top: 14px;
    background: var(--copper);
    border-radius: 2px;
}

.games {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 28px;
}

.game {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.game:hover {
    border-color: rgba(208, 130, 77, .6);
    transform: translateY(-5px);
    box-shadow: 0 24px 70px -18px rgba(208, 130, 77, .45), 0 0 40px -10px rgba(235, 160, 108, .25);
}

.game-art {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    border: 0;
    padding: 0;
    background: #000;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
}
.game-loop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
    z-index: -2;
}
.game-scrim {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(4, 4, 8, .6) 0%, rgba(4, 4, 8, 0) 38%);
}
.game-art:hover .game-loop { transform: scale(1.04); }
.game-logo {
    position: absolute;
    left: 18px;
    top: 16px;
    width: 16%;
    height: auto;
    filter: drop-shadow(0 3px 12px rgba(0, 0, 0, .7));
}
.play {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: #0a0a10;
    box-shadow: 0 6px 30px rgba(0, 0, 0, .5);
    opacity: .9;
    transform: scale(.92);
    transition: transform .2s ease, opacity .2s ease, background .2s ease;
}
.play svg { width: 26px; height: 26px; margin-left: 3px; }
.game-art:hover .play, .game-art:focus-visible .play { opacity: 1; transform: scale(1); background: #fff; }

.game-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px 26px 26px;
    flex: 1;
}
.game-body h3 {
    font-family: 'Cinzel', Georgia, serif;
    font-weight: 700;
    text-transform: uppercase;
    font-size: clamp(24px, 2.6vw, 32px);
    line-height: 1;
    letter-spacing: .02em;
}
.game-body p { color: var(--text-dim); font-size: 16px; }

.platforms {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 22px;
    margin-top: auto; /* pinned to the bottom of the card, so both cards end on one line */
    padding-top: 10px;
}
/* Every platform mark is one height: the PNGs are trimmed to their ink, the SVG icons fill
 * their box, and the text marks set their caps against the same line. */
.platforms {
    --mark-h: 18px;
}
/* A flex item, so the row is exactly one mark tall: as an inline box the link would sit on a text
 * baseline and the li would grow to the full line height with descender room under it. */
.platforms li { display: flex; }
.platforms a {
    display: inline-flex;
    align-items: center;
    height: var(--mark-h);
    color: var(--copper);
    text-decoration: none;
    transition: color .15s ease, transform .15s ease;
}
.platforms a:hover { color: #fff; transform: translateY(-2px); }
/* The store logos ship as single-colour PNGs. Used as a mask, they take the link colour like text does. */
.mark-img {
    display: block;
    height: var(--mark-h);
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}
.platform-text {
    gap: 6px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .02em;
    line-height: 1;
}
.platform-text svg { width: var(--mark-h); height: var(--mark-h); }

/* The game's own site, run on at the end of its description. */
.site-link {
    color: var(--copper);
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
    transition: color .15s ease;
}
.site-link:hover { color: #fff; }

/* ---------------------------------------------------------------- contact and footer */

.contact { padding-bottom: 72px; }
.contact p { font-size: clamp(20px, 2.6vw, 28px); font-weight: 800; }
.contact a { color: var(--copper); text-decoration: none; transition: color .15s ease; }
.contact a:hover { color: #fff; }

.footnote {
    border-top: 1px solid var(--line);
    padding: 22px 16px;
    text-align: center;
    color: var(--text-faint);
    font-size: 11.5px;
}
.footnote .legal { max-width: 900px; margin: 6px auto 0; font-size: 9.5px; line-height: 1.5; opacity: .5; }

/* ---------------------------------------------------------------- trailer overlay */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 64px 20px 28px;
    background: rgba(4, 4, 8, .92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.lightbox[hidden] { display: none; }
.lightbox-frame {
    width: min(1200px, 100%);
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 80px rgba(0, 0, 0, .6);
}
.lightbox-frame video { width: 100%; height: 100%; }
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
    cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .15); }
.lightbox-close svg { width: 22px; height: 22px; }

body.is-locked { overflow: hidden; }

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 480px) {
    .topnav { padding: 10px 16px; gap: 10px 20px; }
    .topnav-mark img { height: 24px; }
    .topnav-links { gap: 16px; }
    .topnav-links a { font-size: 11px; letter-spacing: .08em; }
    .game-logo { width: 22%; left: 14px; top: 12px; }
    .play { width: 54px; height: 54px; margin: -27px 0 0 -27px; }
}
