@font-face {
    font-family: "Edosz";
    src: url("../fonts/edosz.ttf") format("truetype");
    font-display: swap;
}

@font-face {
    font-family: "TojoCaptioner";
    src: url("../fonts/TheTojoCaptioner-Regular.ttf") format("truetype");
    font-display: swap;
}

/* ---------- Global defaults ---------- */

:root {
    color-scheme: dark;

    --color-background: #000000;
    --color-surface: #151515;
    --color-text: #f2f2f2;
    --color-muted: #aaa;
    --color-accent: #7d4071;

    --font-heading: "Edosz", serif;
    --font-body: "TojoCaptioner", sans-serif;

    --page-padding: clamp(1rem, 3vw, 3rem);
    --card-gap: clamp(0.75rem, 2vw, 1.75rem);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--color-background);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;

    background:
        radial-gradient(
            ellipse at 50% 0%,
            #242020 0%,
            var(--color-background) 100%
        );

    color: var(--color-text);
    font-family: var(--font-body);
}

/* ---------- Main homepage container ---------- */

.archive-home {
    display: flex;
    flex-direction: column;
    align-items: center;

    width: 100%;
    min-height: 100vh;
    padding: var(--page-padding);

    overflow: hidden;
}

/* ---------- Archive heading ---------- */

.archive-header {
    position: relative;
    z-index: 1;

    display: flex;
    flex-direction: column;
    align-items: center;

    width: 100%;
    margin: 0 0 clamp(1.5rem, 4vh, 3rem);

    text-align: center;
}

.archive-title {
    margin: 0;

    font-family: var(--font-heading);
    font-size: clamp(2.25rem, 5.5vw, 5rem);
    font-weight: normal;
    line-height: 1.1;
    letter-spacing: 0.035em;

    color: var(--color-text);

    text-shadow:
        0 2px 12px rgb(0 0 0 / 70%),
        0 0 28px rgb(181 31 43 / 12%);
}

.archive-subtitle {
    margin: 0.55rem 0 0;

    color: var(--color-muted);
    font-family: var(--font-body);
    font-size: clamp(0.9rem, 1.5vw, 1.15rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ---------- Four-cover selection layout ---------- */

.arc-selection {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: start;

    width: 100%;
    max-width: 1500px;
    margin: auto 0;

    gap: var(--card-gap);
}

/* ---------- Individual arc cards ---------- */

.arc-card {
    position: relative;
    min-width: 0;
    margin: 0;
}

.arc-link {
    position: relative;

    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;

    overflow: hidden;
    isolation: isolate;

    background: var(--color-surface);
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 3px;

    color: inherit;
    text-decoration: none;

    box-shadow:
        0 8px 24px rgb(0 0 0 / 35%),
        0 0 0 0 rgb(125 64 113 / 0%);

    transition:
        transform 220ms ease,
        border-color 220ms ease,
        box-shadow 220ms ease;
}

/* Cover image */

.arc-cover {
    position: absolute;
    inset: 0;
    z-index: -2;

    display: block;
    width: 100%;
    height: 100%;

    object-fit: cover;
    object-position: center;

    opacity: 1;

    transition:
        transform 350ms ease,
        filter 350ms ease;
}

/* Dark gradient keeps the arc title readable. */

.arc-link::after {
    position: absolute;
    inset: 0;
    z-index: -1;

    content: "";

    background: linear-gradient(
        to bottom,
        rgb(0 0 0 / 0%) 45%,
        rgb(0 0 0 / 20%) 62%,
        rgb(0 0 0 / 88%) 100%
    );

    pointer-events: none;
}

/* ---------- Arc titles ---------- */

.arc-title {
    position: absolute;
    right: 0.5rem;
    bottom: clamp(0.75rem, 2vw, 1.5rem);
    left: 0.5rem;

    margin: 0;
    padding: 0.5rem 0.25rem;

    font-family: var(--font-heading);
    font-size: clamp(1rem, 2vw, 1.8rem);
    font-weight: normal;
    line-height: 1.15;
    text-align: center;

    color: #fff;
    overflow-wrap: anywhere;

    text-shadow:
        0 2px 5px rgb(0 0 0 / 90%),
        0 0 14px rgb(0 0 0 / 70%);

    pointer-events: none;
}

/* ---------- Hover and keyboard interaction ---------- */

@media (hover: hover) and (pointer: fine) {
    .arc-link:hover {
        z-index: 2;

        transform: translateY(-6px);
        border-color: rgb(255 255 255 / 45%);

        box-shadow:
            0 16px 32px rgb(0 0 0 / 55%),
            0 0 18px rgb(181 31 43 / 12%);
    }

    .arc-link:hover .arc-cover {
        transform: scale(1.035);
    }
}

.arc-link:focus-visible {
    z-index: 3;

    outline: 3px solid var(--color-accent);
    outline-offset: 5px;
}

/* ---------- Selection state for JavaScript ---------- */

/*
   JavaScript can add .is-selected to the selected .arc-card.
   The flashing animation itself will be defined in
   animations.css and triggered by JavaScript.
*/

.arc-card.is-selected {
    z-index: 4;
}

.arc-card.is-selected .arc-link {
    border-color: var(--color-accent);
}

/* ---------- Medium screens ---------- */

@media (max-width: 900px) {
    .archive-home {
        padding: 1.5rem;
    }

    .archive-header {
        margin-bottom: 2rem;
    }

    .arc-selection {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-width: 680px;
        gap: 1.5rem;
    }

    .arc-title {
        font-size: clamp(1.2rem, 3vw, 1.8rem);
    }
}


/* ---------- Credits button ---------- */

.archive-footer {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: clamp(2rem, 5vw, 4rem);
    padding: 0 1rem clamp(2rem, 4vw, 3rem);
}

.credits-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 14px 42px;

    border: 2px solid #333;
    background: #181818;
    color: #fff;

    font-family: var(--font-body);
    font-size: 24px;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;

    cursor: pointer;

    transition:
        background-color 160ms ease,
        border-color 160ms ease;
}

.credits-link:hover,
.credits-link:focus-visible {
    background: #353535;
    border-color: #888;
}

.credits-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}


/* ---------- Small screens ---------- */

@media (max-width: 480px) {
    .archive-home {
        padding: 1rem;
    }

    .archive-title {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .archive-subtitle {
        font-size: 0.85rem;
        letter-spacing: 0.08em;
    }

    .arc-selection {
        gap: 0.85rem;
    }

    .arc-link {
        border-radius: 2px;
    }

    .arc-title {
        right: 0.25rem;
        bottom: 0.5rem;
        left: 0.25rem;

        font-size: clamp(0.9rem, 4vw, 1.3rem);
    }
}

/* ---------- Reduced motion accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
    .arc-link,
    .arc-cover {
        transition: none;
    }
}
