/* ============================================================================
   Downloads - the hub (/download) and per-game landing pages.

   Token-only by construction (docs/DESIGN_PRINCIPLES.md section 2): every colour, space, radius,
   type step and motion value below comes from theme.css or core/_tokens.css, so both themes are
   covered without a single one-theme patch and there is no raw hex to migrate later.

   A separate file rather than more rules in lufulus.css: a Wavemaster page styled with class names
   that say "lufulus" would be a lie, and lufulus.css also carries the leaderboard and a pile of
   legacy raw values this family should not inherit.
   ============================================================================ */

.download-page {
    /* width:100% is load-bearing, not redundant with max-width. The shell's <main> is a flex
       column, and an auto cross-axis margin on a flex item cancels align-items:stretch - the item
       then sizes to MAX-CONTENT. Without this the CLI <pre> below dragged the whole page to 590px
       inside a 375px viewport, and overflow-x:auto on the <pre> could not help because the
       ancestor was the thing being sized by content. */
    width: 100%;
    min-width: 0;
    max-width: 1120px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-md) var(--space-2xl);
}

/* ---- Shared type -------------------------------------------------------- */

.download-kicker {
    margin: 0 0 var(--space-2xs);
    color: var(--accent);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.download-title {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--fs-3xl);
    font-weight: 700;
    line-height: var(--lh-tight);
}

.download-lede {
    max-width: 65ch;
    margin: var(--space-sm) 0 0;
    color: var(--text-secondary);
    font-size: var(--fs-md);
    line-height: var(--lh-base);
}

.download-section {
    margin-top: var(--space-2xl);
}

.download-section h2 {
    margin: 0 0 var(--space-md);
    color: var(--text-primary);
    font-size: var(--fs-xl);
    font-weight: 600;
    line-height: var(--lh-tight);
}

/* ---- Game cards (hub, and the landing pages' cross-links) --------------- */

.download-game-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

.download-game-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.download-game-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-xs);
}

.download-game-name {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--fs-lg);
    font-weight: 600;
    line-height: var(--lh-tight);
}

/* The status chip uses the semantic warning pair, never a second brand hue: doctrine section 6
   forbids per-surface accent colours outside the sanctioned room-type accents. */
.download-game-status {
    padding: 0 var(--space-xs);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    background: var(--bg-hover);
    font-size: var(--fs-xs);
    line-height: 1.8;
}

.download-game-status.is-early {
    color: var(--warning);
    background: color-mix(in srgb, var(--warning) 14%, transparent);
}

.download-game-card p {
    max-width: 60ch;
    margin: 0;
    color: var(--text-secondary);
    line-height: var(--lh-base);
}

.download-game-meta {
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.download-game-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-top: var(--space-2xs);
}

.download-game-links a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
}

.download-game-links a:hover,
.download-game-links a:focus-visible {
    text-decoration: underline;
}

/* ---- Landing hero ------------------------------------------------------- */

.download-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
    align-items: start;
}

.download-hero-copy {
    padding: var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.download-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-lg);
}

.download-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2xs);
    min-height: 2.75rem;
}

.download-hint {
    max-width: 65ch;
    margin: var(--space-md) 0 0;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    line-height: var(--lh-base);
}

.download-alert {
    margin: var(--space-md) 0 0;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border));
    border-radius: var(--radius-sm);
    color: var(--warning);
    background: color-mix(in srgb, var(--warning) 12%, transparent);
}

/* ---- Build details aside ------------------------------------------------ */

.download-build-panel {
    padding: var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.download-build-meta {
    display: grid;
    gap: var(--space-xs);
}

.download-meta-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    color: var(--text-secondary);
    font-size: var(--fs-sm);
}

.download-meta-row strong {
    color: var(--text-primary);
    text-align: right;
}

/* ---- Feature panels ----------------------------------------------------- */

.download-panel-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

.download-panel {
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.download-panel h3 {
    margin: 0 0 var(--space-2xs);
    color: var(--text-primary);
    font-size: var(--fs-md);
    font-weight: 600;
}

.download-panel p {
    max-width: 60ch;
    margin: 0;
    color: var(--text-secondary);
    line-height: var(--lh-base);
}

/* ---- Setup steps -------------------------------------------------------- */

.download-step-list {
    display: grid;
    gap: var(--space-sm);
    padding: var(--space-lg);
    margin: 0;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.download-step {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-sm);
    align-items: start;
}

.download-step-number {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
    font-weight: 700;
}

.download-step strong {
    display: block;
    color: var(--text-primary);
}

.download-step span {
    color: var(--text-secondary);
    line-height: var(--lh-base);
}

/* Long CLI examples must scroll inside their own box rather than widening the page - the layout
   audit fails the whole route on horizontal page scroll at 375. */
.download-code {
    overflow-x: auto;
    margin: var(--space-md) 0 0;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    line-height: var(--lh-loose);
}

/* ---- Responsive: canonical breakpoints only ----------------------------- */

@media (min-width: 768px) {
    .download-game-grid,
    .download-panel-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .download-hero {
        grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    }

    .download-panel-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
