/* Competitions - template-competitions.php
 *
 * DECLARES NO COLOURS OF ITS OWN, the rule starter-deck.css, rules.css and
 * news.css follow: every value resolves through main.css's brand tokens or
 * through --faction-color / --faction-accent, which the template sets per
 * competition from its 'faction' field.
 *
 * MOBILE FIRST. Most readers arrive from a show floor, phone in one hand. A
 * single column until there is real room for two, and the hero art is the
 * phone-sized copy from assets/backgrounds/mobile/.
 */

.comps {
    background: var(--bg-dark);
}

/* --- Masthead ----------------------------------------------------------- */

.comps-masthead {
    /* Clears the sticky header, as .starter-deck-hero does. */
    padding: calc(var(--header-h) + var(--cta-h) + 40px) 0 24px;
    text-align: center;
}

.comps-eyebrow,
.comp-meta,
.comp-hashtag-label,
.comp-winner-label,
.comp-dates dt {
    font-family: var(--font-data);
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.comps-eyebrow {
    color: var(--text-secondary);
    margin: 0 0 10px;
}

.comps-title {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: clamp(1.9rem, 7vw, 3.2rem);
    line-height: 1.05;
    text-transform: uppercase;
    color: var(--text-primary);
    margin: 0 0 14px;
}

.comps-intro {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.comps-intro p {
    margin: 0 auto;
    max-width: 52ch;
}

/* --- One competition ---------------------------------------------------- */

.comp {
    /* main.css derives the glow on .hero-section only, so it is derived again
       here from the colour this competition sets. */
    --faction-glow: color-mix(in srgb, var(--faction-color) 22%, transparent);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    scroll-margin-top: calc(var(--header-h) + var(--cta-h) + var(--admin-h));
}

.comp [id] {
    scroll-margin-top: calc(var(--header-h) + var(--cta-h) + var(--admin-h) + 16px);
}

.comp-hero {
    padding: 40px 0 48px;
    background:
        radial-gradient(ellipse at 75% 40%, var(--faction-glow), transparent 60%);
}

.comp-hero-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: center;
}

.comp-hero-inner > * {
    min-width: 0;
}

.comp-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin: 0 0 14px;
    color: var(--text-secondary);
}

.comp-status {
    padding: 4px 10px;
    border: 1px solid currentColor;
    color: var(--text-secondary);
}

.comp-is-open .comp-status,
.comp-is-upcoming .comp-status {
    color: #000;
    background: var(--faction-color);
    border-color: var(--faction-color);
}

.comp-title {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: clamp(2rem, 1.3rem + 3.6vw, 3.6rem);
    line-height: 1.02;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 4px 0 var(--faction-accent);
    margin: 0 0 12px;
    text-wrap: balance;
    overflow-wrap: anywhere;
}

/* On /competitions/ the title links to the competition's own page. */
.comp-title a {
    color: inherit;
    text-decoration: none;
}

.comp-title a:hover {
    color: var(--faction-color);
}

.comp-where {
    font-family: var(--font-data);
    font-size: 0.85rem;
    color: var(--faction-color);
    margin: 0 0 18px;
}

.comp-lede {
    font-size: 1.15rem;
    line-height: 1.55;
    color: var(--text-primary);
    margin: 0 0 26px;
    max-width: 48ch;
}

.comp-winner {
    margin: 0 0 26px;
    padding: 14px 18px;
    border-left: 3px solid var(--faction-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 700;
}

.comp-winner-label {
    display: block;
    color: var(--faction-color);
    margin-bottom: 4px;
}

.comp-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 24px;
}

.comp-cta {
    font-family: var(--font-heading);
    letter-spacing: 0.04em;
    text-align: center;
}

.comp-terms-link {
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.comp-terms-link:hover {
    color: var(--text-primary);
}

/* The Can over his faction's ground, faded out at the edges so the plate
   reads as part of the page rather than a pasted rectangle. */
.comp-art {
    position: relative;
    aspect-ratio: 5 / 4;
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
}

.comp-art::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--comp-art-bg) center / cover no-repeat;
    opacity: 0.55;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 35%, transparent 72%);
    mask-image: radial-gradient(ellipse at center, #000 35%, transparent 72%);
}

.comp-art img {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.6));
}

/* --- Section titles ----------------------------------------------------- */

.comp-section-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: clamp(1.3rem, 1rem + 1.4vw, 1.9rem);
    text-transform: uppercase;
    color: var(--text-primary);
    margin: 0 0 24px;
}

/* --- How to enter ------------------------------------------------------- */

.comp-enter {
    padding: 48px 0;
    background: var(--bg-card);
}

.comp-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.comp-step {
    position: relative;
    padding: 20px 20px 20px 72px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-dark);
    min-width: 0;
}

.comp-step-number {
    position: absolute;
    left: 20px;
    top: 18px;
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 2rem;
    line-height: 1;
    color: var(--faction-color);
}

.comp-step-title {
    display: block;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.comp-step-text {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.55;
}

.comp-hashtag {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 16px;
    margin: 28px 0 0;
}

.comp-hashtag-label {
    color: var(--text-secondary);
}

.comp-hashtag a {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: clamp(1.6rem, 1.1rem + 2.6vw, 2.6rem);
    color: var(--faction-color);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.comp-hashtag a:hover {
    color: var(--text-primary);
}

.comp-step-note {
    margin: 12px 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.comp-follow {
    margin: 12px 0 0;
    color: var(--text-primary);
}

.comp-follow a {
    color: var(--faction-color);
    font-weight: 700;
}

/* --- The prize ---------------------------------------------------------- */

.comp-prize {
    padding: 48px 0 56px;
}

.comp-prize-headline {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: clamp(1.4rem, 1rem + 2vw, 2.2rem);
    text-transform: uppercase;
    color: var(--faction-color);
    margin: -8px 0 28px;
}

.comp-decks {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    /* --comp-tiles is the number of tiles, up to four, set by the renderer. */
    grid-template-columns: repeat(var(--comp-tiles, 3), 1fr);
    gap: 12px;
}

.comp-deck {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.comp-deck img {
    display: block;
    width: 100%;
    max-width: 260px;
    height: auto;
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.55));
}

.comp-deck-name {
    font-family: var(--font-data);
    font-size: 0.75rem;
    text-align: center;
    color: var(--text-secondary);
}

.comp-prize-note {
    text-align: center;
    color: var(--text-secondary);
    margin: 18px 0 40px;
}

.comp-mats {
    /* The shot is nearly square; at full container width it is taller than
       a laptop screen. */
    max-width: 820px;
    margin: 0 auto;
}

.comp-mats img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.comp-mats figcaption {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- Key dates and terms ------------------------------------------------ */

.comp-small-print {
    padding: 48px 0 64px;
    background: var(--bg-card);
}

.comp-dates {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 0 0 48px;
}

.comp-dates > div {
    padding: 14px 16px;
    border-left: 3px solid var(--faction-color);
    background: var(--bg-dark);
}

.comp-dates dt {
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.comp-dates dd {
    margin: 0;
    color: var(--text-primary);
    font-weight: 700;
}

.comp-terms {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.comp-terms-heading {
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 24px 0 8px;
}

.comp-terms-list {
    margin: 0;
    padding-left: 1.8em;
}

.comp-terms-list li {
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}

.comp-terms a {
    color: var(--text-primary);
}

/* --- A competition's own page -------------------------------------------- */

/* No masthead above it, so its hero clears the sticky header itself. */
.comps-single > .comp:first-child {
    border-top: 0;
}

.comps-single > .comp:first-child .comp-hero {
    padding-top: calc(var(--header-h) + var(--cta-h) + 32px);
}

.comps-onward {
    padding: 28px 0 56px;
}

.comps-onward a {
    color: var(--text-secondary);
}

.comps-onward a:hover {
    color: var(--text-primary);
}

/* --- Editors only: a competition that cannot be shown -------------------- */

.comp-problems {
    padding: 24px 0;
}

.comp-problems .container {
    padding: 18px 22px;
    border: 1px solid var(--color-church);
    background: var(--bg-card);
    color: var(--text-primary);
}

.comps-single > .comp-problems:first-child {
    padding-top: calc(var(--header-h) + var(--cta-h) + 32px);
}

.comp-problems a {
    color: var(--color-church);
}

/* --- Nothing running, and the archive ----------------------------------- */

.comps-empty {
    padding: 24px 0 72px;
    text-align: center;
    color: var(--text-secondary);
}

.comps-past {
    padding: 56px 0 72px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.comps-past-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    text-transform: uppercase;
    color: var(--text-primary);
    margin: 0 0 16px;
}

.comps-past-item > summary {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    align-items: baseline;
    padding-top: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    list-style: none;
}

.comps-past-item > summary::-webkit-details-marker {
    display: none;
}

.comps-past-item > summary::before {
    content: "+";
    font-family: var(--font-data);
    color: var(--text-secondary);
}

.comps-past-item[open] > summary::before {
    content: "\2212";
}

.comps-past-name {
    color: var(--text-primary);
    font-weight: 700;
}

.comps-past-event,
.comps-past-winner {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- Wider screens ------------------------------------------------------ */

@media (min-width: 720px) {
    .comp-steps {
        grid-template-columns: repeat(3, 1fr);
    }

    .comp-dates {
        grid-template-columns: repeat(3, 1fr);
    }

    .comp-decks {
        gap: 28px;
    }

    .comp-deck-name {
        font-size: 0.85rem;
    }
}

@media (min-width: 960px) {
    .comp-hero {
        padding: 56px 0 72px;
    }

    .comp-hero-inner {
        grid-template-columns: 1.1fr 1fr;
        gap: 48px;
    }
}
