/* ===== Variables: change these to restyle the whole site ===== */
:root {
    --bg: #1c1a33;          /* page background */
    --surface: #35315B;     /* cards, header (your original color) */
    --text: #f2f0ff;
    --text-muted: #b9b4d9;
    --accent: #EADBBB;      /* buttons and links */
    --radius: 0;            /* square corners everywhere; raise (e.g. 10px) to round them */
    --max-width: 1100px;
}

/* ===== Reset: predictable sizing everywhere ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;   /* smooth scrolling for #links */
}

body {
    font-family: "Lexend", system-ui, sans-serif;   /* fallbacks if Lexend fails to load */
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

img {
    max-width: 100%;   /* images never overflow their container */
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Centers content and keeps it from getting too wide */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== Header / nav (flexbox) ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--surface);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.logo {
    color: var(--accent);   /* cream */
    font-weight: 700;
    font-size: 1.2rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--accent);   /* cream */
}

/* ===== Hero banner ===== */
.hero {
    min-height: 30vh;
    display: flex;
    align-items: center;
    /* Dark gradient over the image keeps text readable */
    background-image:
        linear-gradient(rgba(28, 26, 51, 0.2), rgba(28, 26, 51, 0.6)),
        url("assets/images/GamesHero.png");
    background-size: cover;
    background-position: center;
}

    .hero h1 {
        text-align: center;
        color: var(--accent);   /* cream */
        -webkit-text-stroke: 10px black;
        paint-order: stroke fill;
        text-shadow: 4px 4px 6px rgba(0, 0, 0, 0.7);
        font-size: 3rem;
        line-height: 1.1;
    }

.tagline {
    text-align: center;
    font-size: 1.25rem;
    color: var(--accent);   /* cream */
    margin: 1rem 0 2rem;
    max-width: 40ch;
}

.button {
    display: inline-block;
    background-color: var(--accent);
    color: #1c1a33;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    transition: transform 0.15s ease;
}

.button:hover {
    text-decoration: none;
    transform: translateY(-2px);
}

/* ===== Sections ===== */
.section {
    padding-top: 4rem;
    padding-bottom: 4rem;
}

.section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

/* ===== Project grid (CSS grid) ===== */
.project-grid {
    display: grid;
    /* As many 260px+ columns as fit, then they wrap. Responsive with no media query. */
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.project-card {
    position: relative;   /* the title link's click area stretches over this whole card */
    background-color: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;   /* clips the image to the rounded corners */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.project-card img {
    width: 100%;
    height: auto;
    /* Steam Main Capsule shape (1232 x 706). Every card's image area is this shape,
       so a hover video at the same size can swap in later without the card jumping. */
    aspect-ratio: 1232 / 706;
    object-fit: cover;   /* if an image isn't exactly this shape, crop it instead of stretching */
    transition: filter 0.2s ease;
}

/* The clickable image at the top of each card */
.project-image-link {
    display: block;   /* makes the whole image area clickable, with no gap underneath */
    position: relative;   /* the hover video is positioned over the image inside this box */
    overflow: hidden;
}

.project-card:hover img {
    filter: brightness(1.1);   /* slight brighten so it's clear the card is clickable */
}

/* The title is a link whose click area is stretched over the whole card,
   so clicking the text (or anywhere else on the card) opens the project page. */
.project-card-link {
    color: inherit;
}

.project-card-link:hover {
    text-decoration: none;
}

.project-card-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Hover video preview (created by script.js), laid over the capsule image */
.project-hover-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none;   /* clicks pass through to the link underneath */
    opacity: 0;             /* hidden until the video is ready... */
    transition: opacity 0.3s ease;
}

.project-hover-video.is-playing {
    opacity: 1;             /* ...then fades in over the image */
}

.project-info {
    padding: 1rem 1.25rem 1.25rem;
}

.project-info h3 {
    margin-bottom: 0.5rem;
}

.project-info p {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* Genre line right under the title */
.project-genre {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Awards and sales, one plain line of text each */
.project-highlights {
    list-style: none;
    margin-bottom: 0.75rem;
}

.project-highlights li {
    color: var(--text-muted);
}

/* Your roles on the project */
.project-info .project-roles {
    color: var(--text);
    font-size: 0.95rem;
}

/* ===== Individual project pages (projects/*.html) ===== */
.project-page {
    padding-top: 2rem;
    padding-bottom: 4rem;
}

/* --- 1. Banner: library hero with the logo layered on top, full page width --- */
.project-banner {
    position: relative;   /* lets the logo be positioned inside this box */
    overflow: hidden;
}

.project-banner-bg {
    width: 100%;
    height: auto;          /* banner keeps the hero image's own shape (about 3:1) */
    max-height: 70vh;      /* on very wide screens, don't fill more than 70% of the window height... */
    object-fit: cover;     /* ...crop the top and bottom instead of squashing the art */
}

.project-banner-logo {
    position: absolute;
    /* Centered in the banner: move the logo's corner to the middle,
       then shift it back by half its own width and height */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 40%;   /* logo width relative to the banner */
    max-width: 700px;   /* so it doesn't get huge on very wide screens */
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));   /* keeps the logo readable on busy art */
}

/* --- Two-column layout: trailer + details on the left, info on the right --- */
.project-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "trailer about"
        "details about";
    gap: 2rem 2.5rem;
    align-items: start;
}

.project-trailer { grid-area: trailer; }
.project-about   { grid-area: about; }
.project-details { grid-area: details; }

/* --- 2. Trailer: always 16:9, whatever the column width --- */
.project-trailer iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: var(--radius);
}

/* --- 3. Info text block --- */
.project-about {
    background-color: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.project-about h1 {
    font-size: 1.75rem;
    line-height: 1.2;
}

.project-about .project-genre {
    color: var(--text-muted);
    margin: 0.25rem 0 1rem;
}

.project-about p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* --- 4. Details and roles lists --- */
.project-details section {
    margin-bottom: 2rem;
}

.project-details h2 {
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
}

.project-details ul {
    padding-left: 1.25rem;   /* room for the bullets */
}

.project-details li {
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.project-details strong {
    color: var(--text);
    font-weight: 600;
}

/* Phones and narrow tablets: stack everything in one column */
@media (max-width: 800px) {
    .project-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        grid-template-areas:
            "trailer"
            "about"
            "details";
    }
}

/* --- 5. Gallery: screenshot grid --- */
.gallery-section {
    margin-top: 1rem;
}

.gallery-section h2 {
    font-size: 1.35rem;
    margin-bottom: 1rem;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);   /* 3 x 3 for nine screenshots */
    gap: 1rem;
}

.gallery-item {
    display: block;
    border-radius: var(--radius);
    overflow: hidden;   /* rounds the image corners */
}

.gallery-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    cursor: zoom-in;   /* magnifying-glass cursor hints it can be enlarged */
    transition: transform 0.2s ease, filter 0.2s ease;
}

.gallery-item:hover img {
    transform: scale(1.04);
    filter: brightness(1.1);
}

@media (max-width: 800px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- 6. Related articles --- */
.articles-section {
    margin-top: 3rem;
}

/* Hide the whole section (heading included) until it has at least one article */
.articles-section:not(:has(.article-card)) {
    display: none;
}

.articles-section h2 {
    font-size: 1.35rem;
    margin-bottom: 1rem;
}

.articles {
    display: grid;
    /* Cards are 280-340px wide and never widen to fill leftover space */
    grid-template-columns: repeat(auto-fill, minmax(280px, 340px));
    align-items: start;   /* each card is only as tall as its own content */
    gap: 1rem;
}

/* On phones, one card per row at full width */
@media (max-width: 600px) {
    .articles {
        grid-template-columns: 1fr;
    }
}

.article-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background-color: var(--surface);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    overflow: hidden;   /* clips the image to the rounded corners */
    transition: transform 0.15s ease, background-color 0.15s ease;
}

/* The article's main image ("image:" in its settings block), shown across the top of the card.
   The negative margins cancel the card's padding so it reaches the edges. */
.article-card-image {
    display: block;
    width: calc(100% + 2.5rem);
    max-width: none;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin: -1.1rem -1.25rem 0.5rem;
}

.article-card:hover {
    text-decoration: none;
    transform: translateY(-2px);
    background-color: #403b6b;   /* slightly lighter than --surface */
}

.article-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.article-title {
    color: var(--text);
    font-weight: 600;
}

.article-summary {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.article-date {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: auto;   /* pins the date to the bottom of the card */
    padding-top: 0.25rem;
}


/* ===== Articles list page (articles/index.html) ===== */
.articles-page h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

.articles-empty {
    color: var(--text-muted);
}

/* Highlights the nav link for the page you're on */
.nav-links a[aria-current="page"] {
    text-decoration: underline;
    text-underline-offset: 0.3em;
}


/* ===== Article pages (articles/*.html) ===== */
.article-page {
    max-width: 760px;   /* narrow column: long text is easier to read */
    padding-top: 2.5rem;
    padding-bottom: 4rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
}

.article-header {
    margin-bottom: 2rem;
}

.article-meta {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.article-header h1 {
    font-size: 2.5rem;
    line-height: 1.15;
    margin-bottom: 1rem;
}

.article-lead {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.article-hero {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin-bottom: 2.5rem;
}

.article-body {
    font-size: 1.05rem;
    line-height: 1.75;
}

.article-body h2 {
    font-size: 1.6rem;
    margin: 2.5rem 0 1rem;
}

.article-body h3 {
    font-size: 1.25rem;
    margin: 2rem 0 0.75rem;
}

.article-body p,
.article-body ul,
.article-body ol {
    margin-bottom: 1.25rem;
}

.article-body ul,
.article-body ol {
    padding-left: 1.5rem;
}

.article-body li {
    margin-bottom: 0.4rem;
}

.article-body figure {
    margin: 2rem 0;
}

.article-body figure img {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.article-body figcaption {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
}

.article-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.25rem 0 0.25rem 1.25rem;
    margin: 2rem 0;
    font-size: 1.15rem;
    font-style: italic;
    color: var(--text-muted);
}

.article-body blockquote p {
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .article-header h1 {
        font-size: 2rem;
    }
}

/* --- Enlarged image viewer (created by script.js) --- */
.lightbox {
    /* Fill the whole window with a dark background */
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background-color: rgba(10, 9, 20, 0.92);
    color: var(--text);
}

.lightbox[open] {
    display: flex;   /* only when open; a closed <dialog> must stay hidden */
    align-items: center;
    justify-content: center;
}

.lightbox::backdrop {
    background: transparent;   /* the dialog itself is the dark background */
}

.lightbox-image {
    width: min(90vw, 1280px);
    max-height: 85vh;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius);
}

.lightbox button {
    position: fixed;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    border: 0;
    border-radius: var(--radius);
    width: 3rem;
    height: 3rem;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.lightbox button:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-prev  { left: 1rem;  top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 1rem; top: 50%; transform: translateY(-50%); }

.lightbox-count {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Contact ===== */
.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    list-style: none;
}

/* ===== Footer ===== */
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Phones ===== */
@media (max-width: 600px) {
    .hero h1 {
        font-size: 2.25rem;
    }

    /* Four nav links plus the name is tight on a phone: shrink them a bit,
       and let the links drop to a second line if they still don't fit */
    .nav {
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
        gap: 0.25rem 1rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .nav-links {
        gap: 0.9rem;
        font-size: 0.9rem;
    }

    .logo {
        font-size: 1rem;
    }
}
