/* ==========================================================================
   Magazine page — editorial layout (Vice / RA-inspired)
   ========================================================================== */

.mag-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 1.5rem 4rem;
    color: #eee;
}

.mag-page a {
    text-decoration: none;
}

/* --- Masthead ------------------------------------------------------------ */

.mag-masthead {
    position: relative;
    border-bottom: 3px solid #fff;
    padding-bottom: 1.25rem;
    margin-bottom: 0;
}

.mag-masthead-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.mag-kicker {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #ff0000;
}

.mag-date {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #777;
}

.mag-title {
    /* The floor gives way under 362px: at 3.5rem the one word is 299px wide,
       27px more than a 320px phone has. */
    font-size: clamp(min(3.5rem, 15.5vw), 10vw, 7rem);
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: #fff;
    margin: 0;
}

.mag-strapline {
    margin-top: 0.75rem;
    color: #999;
    font-size: 1rem;
    max-width: 46ch;
}

.mag-new-post {
    position: absolute;
    right: 0;
    bottom: 1.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #fff;
    background: #ff0000;
    padding: 0.5rem 1rem;
}

.mag-new-post:hover {
    background: #cc0000;
}

/* --- Category tabs ------------------------------------------------------- */

.mag-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.75rem;
    border-bottom: 1px solid #333;
    margin-bottom: 2.5rem;
    overflow: visible;
}

.mag-tab {
    padding: 0.85rem 0;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #888;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color 0.15s;
}

.mag-tab:hover {
    color: #fff;
}

.mag-tab.is-active {
    color: #fff;
    border-bottom-color: #ff0000;
}

/* --- Shared bits --------------------------------------------------------- */

.mag-cat {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #ff0000;
}

.mag-byline {
    font-size: 0.78rem;
    color: #888;
    letter-spacing: 0.02em;
}

.mag-byline-author {
    color: #ccc;
    font-weight: 600;
}

.mag-section-heading {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #fff;
    margin: 3rem 0 1.5rem;
}

.mag-section-heading::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #333;
}

/* --- Lead story ---------------------------------------------------------- */

.mag-lead {
    margin-bottom: 2px;
}

.mag-lead-link {
    position: relative;
    display: block;
    overflow: hidden;
    background: #111;
}

.mag-lead-media img {
    display: block;
    width: 100%;
    height: clamp(340px, 55vw, 560px);
    object-fit: cover;
    filter: grayscale(20%) contrast(1.05);
    transition: transform 0.4s ease, filter 0.4s ease;
}

.mag-lead-link:hover .mag-lead-media img {
    transform: scale(1.03);
    filter: grayscale(0%) contrast(1.05);
}

.mag-lead-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: clamp(1.5rem, 4vw, 3rem);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 20%, rgba(0, 0, 0, 0.55) 65%, transparent);
}

.mag-lead-tags {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.mag-featured-flag {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #000;
    background: #fff;
    padding: 0.2rem 0.6rem;
}

.mag-lead-title {
    font-size: clamp(1.8rem, 4.5vw, 3.2rem);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: #fff;
    margin: 0 0 0.75rem;
    max-width: 22ch;
}

.mag-lead-link:hover .mag-lead-title {
    text-decoration: underline;
    text-decoration-color: #ff0000;
    text-decoration-thickness: 4px;
    text-underline-offset: 6px;
}

.mag-lead-excerpt {
    color: #ccc;
    font-size: 1rem;
    line-height: 1.55;
    max-width: 62ch;
    margin-bottom: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Second tier --------------------------------------------------------- */

.mag-second-tier {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    margin-bottom: 0;
}

.mag-second-link {
    position: relative;
    display: block;
    overflow: hidden;
    background: #111;
}

.mag-second-media img {
    display: block;
    width: 100%;
    height: 280px;
    object-fit: cover;
    filter: grayscale(35%);
    transition: transform 0.4s ease, filter 0.4s ease;
}

.mag-second-link:hover .mag-second-media img {
    transform: scale(1.04);
    filter: grayscale(0%);
}

.mag-second-body {
    position: absolute;
    inset: auto 0 0 0;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 30%, rgba(0, 0, 0, 0.4) 75%, transparent);
}

.mag-second-title {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.2;
    color: #fff;
    margin: 0.4rem 0 0.5rem;
}

.mag-second-link:hover .mag-second-title {
    text-decoration: underline;
    text-decoration-color: #ff0000;
    text-decoration-thickness: 3px;
    text-underline-offset: 4px;
}

/* --- Latest grid --------------------------------------------------------- */

.mag-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem 2rem;
}

.mag-card-link {
    display: block;
}

.mag-card-media {
    overflow: hidden;
    background: #111;
    margin-bottom: 0.9rem;
}

.mag-card-media img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
    filter: grayscale(35%);
    transition: transform 0.35s ease, filter 0.35s ease;
}

.mag-card-link:hover .mag-card-media img {
    transform: scale(1.04);
    filter: grayscale(0%);
}

.mag-card-title {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.25;
    color: #fff;
    margin: 0.4rem 0 0.5rem;
}

.mag-card-link:hover .mag-card-title {
    text-decoration: underline;
    text-decoration-color: #ff0000;
    text-decoration-thickness: 3px;
    text-underline-offset: 4px;
}

.mag-card-excerpt {
    color: #999;
    font-size: 0.88rem;
    line-height: 1.55;
    margin-bottom: 0.6rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Empty state --------------------------------------------------------- */

.mag-empty {
    padding: 5rem 1rem;
    text-align: center;
    color: #888;
    border-bottom: 1px solid #333;
}

.mag-empty a {
    color: #ff0000;
    font-weight: 600;
}

/* --- Pagination ---------------------------------------------------------- */

.mag-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    margin-top: 3rem;
}

.mag-pagination a,
.mag-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.8rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #aaa;
    border: 1px solid #333;
    transition: all 0.15s;
}

.mag-pagination a:hover {
    color: #fff;
    border-color: #ff0000;
}

.mag-pagination span.current {
    color: #fff;
    background: #ff0000;
    border-color: #ff0000;
}

/* --- On the radar (city links) ------------------------------------------ */

.mag-radar-intro {
    color: #888;
    font-size: 0.9rem;
    margin: -0.5rem 0 1.25rem;
}

.mag-radar-cities {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mag-radar-city {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ddd;
    border: 1px solid #333;
    transition: all 0.15s;
}

.mag-radar-city:hover {
    border-color: #ff0000;
    color: #fff;
}

.mag-radar-count {
    font-size: 0.7rem;
    color: #ff0000;
}

.mag-radar-all {
    border-style: dashed;
    color: #888;
}

/* --- Elsewhere on Moshradar ---------------------------------------------- */

.mag-elsewhere-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
}

/* Applied when the Merch tile is hidden, so three tiles still fill the row
   instead of leaving a fourth column empty. The mobile override below wins on
   source order and keeps small screens at two columns. */
.mag-elsewhere-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.mag-elsewhere-tile {
    position: relative;
    display: block;
    overflow: hidden;
    background: #111;
}

.mag-elsewhere-tile img {
    display: block;
    width: 100%;
    height: 190px;
    object-fit: cover;
    filter: grayscale(60%) brightness(0.75);
    transition: transform 0.35s ease, filter 0.35s ease;
}

.mag-elsewhere-tile:hover img {
    transform: scale(1.05);
    filter: grayscale(0%) brightness(0.85);
}

.mag-elsewhere-body {
    position: absolute;
    inset: auto 0 0 0;
    padding: 1rem 1.1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
}

.mag-elsewhere-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #fff;
}

.mag-elsewhere-tile:hover .mag-elsewhere-title {
    color: #ff0000;
}

.mag-elsewhere-sub {
    display: block;
    font-size: 0.75rem;
    color: #aaa;
    margin-top: 0.15rem;
}

.mag-tools-links {
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: #888;
}

.mag-tools-links a {
    color: #ddd;
    font-weight: 600;
    border-bottom: 1px solid #ff0000;
}

.mag-tools-links a:hover {
    color: #ff0000;
}

/* --- Responsive ---------------------------------------------------------- */

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

    .mag-elsewhere-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .mag-page {
        padding-top: 90px;
    }

    .mag-second-tier {
        grid-template-columns: 1fr;
    }

    .mag-second-media img {
        height: 220px;
    }

    .mag-grid {
        grid-template-columns: 1fr;
    }

    .mag-card-media img {
        height: 220px;
    }

    .mag-new-post {
        position: static;
        margin-top: 1rem;
    }

    .mag-lead-excerpt {
        display: none;
    }
}

/* --- Custom scrollbars (page + inner scroll areas) ----------------------- */

html {
    scrollbar-width: thin;
    scrollbar-color: #444 #101010;
}

::-webkit-scrollbar {
    width: 10px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #101010;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border: 2px solid #101010;
}

::-webkit-scrollbar-thumb:hover {
    background: #ff0000;
}

::-webkit-scrollbar-corner {
    background: #101010;
}

/* --- Festival guides on the Magazine front page -------------------------
 *
 * The festival section is part of the Magazine, so it sits inside the
 * masthead's world rather than looking like a widget bolted on: same surface,
 * same hairline, same red. Tokens are re-declared with the mag- prefix because
 * this sheet, like every other in the project, scopes its own.
 */

.mag-tab--section {
    border-color: rgba(255, 0, 0, .45);
}

.mag-festivals {
    margin: 2rem 0 2.5rem;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, .10);
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.mag-festivals-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Same treatment as .mag-section-heading ("On The Radar") so every section
   head on the page reads as one set. */
.mag-festivals-head h2 {
    font-size: 1rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin: 0;
    color: #fff;
}

.mag-festivals-all {
    font-size: .8rem;
    color: #ff4444;
    text-decoration: none;
    white-space: nowrap;
}

.mag-festivals-all:hover { text-decoration: underline; }

.mag-festival-row {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: .75rem;
}

.mag-festival-card a {
    display: block;
    height: 100%;
    padding: 1rem;
    background: #101010;
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 6px;
    text-decoration: none;
    transition: border-color .15s, transform .15s;
}

.mag-festival-card a:hover {
    border-color: #cc0000;
    transform: translateY(-2px);
}

.mag-festival-name {
    display: block;
    font-weight: 600;
    color: #fff;
    margin-bottom: .35rem;
    line-height: 1.3;
}

.mag-festival-meta {
    display: block;
    font-size: .78rem;
    color: #8a8a8a;
    line-height: 1.5;
}

.mag-festival-count {
    display: block;
    font-size: .72rem;
    color: #ff4444;
    margin-top: .5rem;
    letter-spacing: .03em;
}

.mag-festival-img {
    display: block;
    width: calc(100% + 2rem);
    margin: -1rem -1rem .75rem;
    height: 96px;
    object-fit: cover;
    border-radius: 6px 6px 0 0;
}

/* Quizzes row. Directly under the festival row when both render, so it gives
 * back that row's bottom margin and skips its own top rule rather than
 * stacking a second divider two lines under the first. */
.mag-festivals + .mag-games {
    margin-top: -2.5rem;
    border-top: 0;
}

/* .mag-festival-count sets display, which would beat the hidden attribute
 * and show an empty "Your best:" to anyone who has not played. */
.mag-games [data-quiz-best-for][hidden] { display: none; }

/* The share card is the thumbnail, and it is mostly title -- shown whole at
 * its own ratio rather than cropped to the festival row's 96px strip. */
.mag-games .mag-festival-img {
    height: auto;
    aspect-ratio: 40 / 21;
}

/* --- Games & quizzes ---------------------------------------------------------
 *
 * Today's puzzle and the featured games as cards, then the quizzes as shelves.
 * The game cards are games.css's, which reads the --dp-* tokens detail.css
 * defines; this page does not load detail.css, so they are set here to the
 * same values.
 */

.mag-play {
    --dp-red: #ff0000;
    --dp-red-dim: #cc0000;
    --dp-red-soft: #ff4444;
    --dp-line: rgba(255, 255, 255, 0.10);
    --dp-line-soft: rgba(255, 255, 255, 0.06);
    --dp-surface: #101010;
    --dp-surface-2: #161616;
    --dp-muted: #8a8a8a;
    --dp-text: #d8d8d8;
}

.mag-play [hidden] { display: none !important; }

.mag-play-top {
    display: grid;
    grid-template-columns: minmax(230px, 0.85fr) minmax(0, 2.15fr);
    gap: 0.9rem;
    margin-bottom: 1.75rem;
}

.mag-play-top--games-only { grid-template-columns: 1fr; }

.mag-play-games {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.mag-play .gi-card-body { padding: 0.85rem 0.95rem 0.95rem; }

.mag-play .gi-card-title { font-size: 1.05rem; }

.mag-daily {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.25rem;
    color: #d8d8d8;
    text-decoration: none;
    background:
        radial-gradient(120% 120% at 0% 0%, rgba(241, 196, 15, 0.16), rgba(241, 196, 15, 0) 60%),
        linear-gradient(160deg, #15120a, #0d0d0d 70%);
    border: 1px solid rgba(241, 196, 15, 0.35);
    border-radius: 12px;
    transition: border-color 0.2s, transform 0.2s;
}

.mag-daily:hover { border-color: rgba(241, 196, 15, 0.75); transform: translateY(-3px); }

.mag-daily-board {
    display: grid;
    grid-template-columns: repeat(5, 20px);
    gap: 4px;
    margin-bottom: auto;
    padding-bottom: 1rem;
}

.mag-daily-board i {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.09);
}

.mag-daily-board .is-hit { background: #2ecc71; }

.mag-daily-board .is-near { background: #f1c40f; }

.mag-daily-kicker {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #f1c40f;
}

.mag-daily-title {
    font-size: 1.6rem;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #fff;
}

.mag-daily-text { font-size: 0.85rem; line-height: 1.5; color: #8a8a8a; }

.mag-daily-cta { margin-top: 0.6rem; font-size: 0.85rem; font-weight: 700; color: #fff; }

.mag-daily-cta i { color: #f1c40f; }

.mag-shelves {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem 2rem;
}

.mag-shelf-title {
    margin: 0 0 0.5rem;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #ff4444;
}

.mag-shelf-list { list-style: none; margin: 0; padding: 0; }

.mag-shelf-list a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mag-shelf-name {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    color: #fff;
    transition: color 0.15s;
}

.mag-shelf-list a:hover .mag-shelf-name { color: #ff4444; }

.mag-shelf-meta { flex: none; font-size: 0.72rem; white-space: nowrap; color: #8a8a8a; }

@media (max-width: 900px) {
    .mag-play-top { grid-template-columns: 1fr; }
    .mag-play-games { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
