/**
 * Chess Academy — Homepage
 *
 * Loaded only on the homepage (via $extraCss in HomeController) so the global
 * bundle every other page pays for stays lean. All values come from tokens.
 */

/* ══════════════════════════════════════════════════════════════
   SHARED SECTION FURNITURE
   ══════════════════════════════════════════════════════════════ */

.section__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}

.section__head--center {
    justify-content: center;
    text-align: center;
}

.section__eyebrow {
    display: block;
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-primary-500);
    margin-bottom: var(--space-2);
}

.section__title {
    font-size: var(--text-4xl);
    font-weight: var(--weight-extrabold);
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-tight);
    max-width: 20ch;
}

.section__head--center .section__title {
    max-width: 24ch;
    margin-inline: auto;
}

.section__lede {
    margin-top: var(--space-4);
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    max-width: 56ch;
    margin-inline: auto;
}

.section__link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-primary-500);
    text-decoration: none;
    padding-bottom: var(--space-1);
}

.section__link svg { width: 1rem; height: 1rem; transition: transform var(--duration-normal) var(--ease-out); }
.section__link:hover svg { transform: translateX(3px); }

/* Eyebrow pill */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text-secondary);
}

.eyebrow__dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: var(--radius-full);
    background: var(--color-success);
    box-shadow: 0 0 0 3px var(--color-success-bg);
    flex-shrink: 0;
}


/* ══════════════════════════════════════════════════════════════
   HERO
   ══════════════════════════════════════════════════════════════ */

.hero {
    position: relative;
    overflow: hidden;
    padding-block: var(--space-12) var(--space-10);
    background:
        radial-gradient(ellipse 80% 60% at 15% -10%, var(--color-primary-50) 0%, transparent 60%),
        linear-gradient(180deg, var(--color-surface-alt) 0%, var(--color-bg) 100%);
}

/* Soft brand glow behind the board, and a fine dot grid for texture. */
.hero__glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(var(--color-primary-300) 1px, transparent 1px);
    background-size: 26px 26px;
    opacity: 0.28;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 20%, black 10%, transparent 70%);
    mask-image: radial-gradient(ellipse 70% 60% at 70% 20%, black 10%, transparent 70%);
}

.hero__grid {
    position: relative;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    align-items: center;
    gap: var(--space-10);
}

.hero__title {
    margin-top: var(--space-5);
    font-size: var(--text-6xl);
    font-weight: var(--weight-extrabold);
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.hero__accent {
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero__subtitle {
    margin-top: var(--space-5);
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    max-width: 46ch;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

.hero__trust {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border-light);
    list-style: none;
}

.hero__trust li {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
}

.hero__trust svg {
    width: 0.95rem;
    height: 0.95rem;
    color: var(--color-success);
    flex-shrink: 0;
}


/* ══════════════════════════════════════════════════════════════
   BOARD CARD — the hero showcase
   ══════════════════════════════════════════════════════════════ */

.hero__showcase {
    position: relative;
    display: flex;
    justify-content: center;
}

/* Decorative stacked card behind the real one, for depth. */
.hero__showcase::before {
    content: '';
    position: absolute;
    inset: var(--space-5) calc(var(--space-2) * -1) calc(var(--space-5) * -1) var(--space-4);
    border-radius: var(--radius-2xl);
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-md);
    transform: rotate(2.5deg);
    z-index: 0;
}

.board-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 26rem;
    margin: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.board-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border-light);
}

.board-card__label {
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-primary-500);
}

.board-card__date {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
}

.board-card__board {
    aspect-ratio: 1;
    width: 100%;
    /* Squares are painted by chess-engine.js; this is the pre-render ground. */
    background: var(--color-surface-alt);
    border-radius: 0;
    border: none;
}

.board-card__foot {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border-light);
    background: var(--color-surface-alt);
    font-size: var(--text-sm);
}

.board-card__turn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: var(--weight-semibold);
}

.board-card__turn-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    flex-shrink: 0;
}
.board-card__turn-dot--white { background: hsl(0, 0%, 100%); }
.board-card__turn-dot--black { background: hsl(255, 20%, 15%); }

.board-card__rating {
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

.board-card__cta {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    margin-left: auto;
    font-weight: var(--weight-semibold);
    color: var(--color-primary-500);
    text-decoration: none;
    white-space: nowrap;
}

.board-card__cta svg { width: 1rem; height: 1rem; transition: transform var(--duration-normal) var(--ease-out); }
.board-card__cta:hover svg { transform: translateX(3px); }


/* ══════════════════════════════════════════════════════════════
   STAT BAND
   ══════════════════════════════════════════════════════════════ */

.statband {
    background: var(--color-surface);
    border-block: 1px solid var(--color-border-light);
    padding-block: var(--space-6);
}

.statband__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-5);
    margin: 0;
}

.statband__item {
    display: flex;
    flex-direction: column;
    text-align: center;
    padding-inline: var(--space-4);
    border-left: 1px solid var(--color-border-light);
}

.statband__item:first-child { border-left: none; }

.statband__item dt {
    order: 2;
    font-size: var(--text-xs);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-text-tertiary);
}

.statband__item dd {
    order: 1;
    margin: 0 0 var(--space-1);
    font-size: var(--text-3xl);
    font-weight: var(--weight-extrabold);
    letter-spacing: var(--tracking-tight);
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}


/* ══════════════════════════════════════════════════════════════
   THEME RAIL
   ══════════════════════════════════════════════════════════════ */

.themes { background: var(--color-bg); }

.theme-rail {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
}

.theme-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    padding: var(--space-5);
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-xl);
    text-decoration: none;
    color: inherit;
    transition: transform var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-out),
                border-color var(--duration-normal) var(--ease-out);
}

.theme-tile:hover {
    transform: translateY(-3px);
    border-color: var(--color-primary-200);
    box-shadow: var(--shadow-lg);
}

.theme-tile__glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: var(--space-2);
    border-radius: var(--radius-md);
    background: var(--color-primary-50);
    color: var(--color-primary-600);
    font-size: 1.15rem;
    line-height: 1;
    transition: background var(--duration-normal) var(--ease-out),
                color var(--duration-normal) var(--ease-out);
}

.theme-tile:hover .theme-tile__glyph {
    background: var(--gradient-brand);
    color: var(--color-text-inverse);
}

.theme-tile__name {
    font-weight: var(--weight-semibold);
    line-height: var(--leading-snug);
}

.theme-tile__count {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
}


/* ══════════════════════════════════════════════════════════════
   HOW IT WORKS
   ══════════════════════════════════════════════════════════════ */

.how { background: var(--color-surface-alt); }

.steps {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
    list-style: none;
    counter-reset: step;
}

/* Connecting line behind the step markers (desktop only). */
.steps::before {
    content: '';
    position: absolute;
    top: 1.25rem;
    left: 16%;
    right: 16%;
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        var(--color-border) 0 6px,
        transparent 6px 12px
    );
    z-index: 0;
}

.step {
    position: relative;
    z-index: 1;
    text-align: center;
    padding-inline: var(--space-2);
}

.step__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    background: var(--gradient-brand);
    color: var(--color-text-inverse);
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    box-shadow: var(--shadow-primary);
    /* Sits on the dashed connector, so it needs its own ground. */
    outline: 6px solid var(--color-surface-alt);
}

.step__icon {
    display: block;
    margin: var(--space-5) auto var(--space-3);
    color: var(--color-primary-500);
}

.step__icon svg { width: 1.75rem; height: 1.75rem; }

.step__title {
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    margin-bottom: var(--space-2);
}

.step__text {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    max-width: 34ch;
    margin-inline: auto;
}


/* ══════════════════════════════════════════════════════════════
   FEATURE BENTO
   ══════════════════════════════════════════════════════════════ */

.features { background: var(--color-bg); }

.bento {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

.bento__cell {
    padding: var(--space-6);
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-xl);
    transition: transform var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-out),
                border-color var(--duration-normal) var(--ease-out);
}

.bento__cell:hover {
    transform: translateY(-3px);
    border-color: var(--color-primary-200);
    box-shadow: var(--shadow-lg);
}

.bento__cell--wide { grid-column: span 2; }

.bento__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--color-primary-50);
    color: var(--color-primary-600);
}

.bento__icon svg { width: 1.35rem; height: 1.35rem; }

.bento__title {
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    margin-bottom: var(--space-2);
}

.bento__text {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    margin: 0;
}


/* ══════════════════════════════════════════════════════════════
   CLOSING CTA
   ══════════════════════════════════════════════════════════════ */

.cta {
    position: relative;
    overflow: hidden;
    padding-block: var(--space-12);
    background: var(--gradient-ink);
}

.cta::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 55% 70% at 50% 0%, hsla(252, 80%, 62%, 0.35) 0%, transparent 70%);
    pointer-events: none;
}

.cta__inner {
    position: relative;
    text-align: center;
    max-width: 44rem;
    margin-inline: auto;
}

.cta__title {
    font-size: var(--text-4xl);
    font-weight: var(--weight-extrabold);
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-tight);
    color: hsl(0, 0%, 100%);
}

.cta__text {
    margin-top: var(--space-4);
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
    color: hsla(0, 0%, 100%, 0.75);
}

.cta__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-6);
}


/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 1023px) {
    .hero__grid {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .hero__copy { text-align: center; }
    .hero__subtitle { margin-inline: auto; }
    .hero__actions, .hero__trust { justify-content: center; }
    .hero__title { font-size: var(--text-5xl); }

    /* The rotated backing card reads as a mistake once the board is centred. */
    .hero__showcase::before { display: none; }

    .theme-rail { grid-template-columns: repeat(2, 1fr); }
    .bento { grid-template-columns: repeat(2, 1fr); }
    .bento__cell--wide { grid-column: span 2; }

    .section__title { max-width: none; }
}

@media (max-width: 767px) {
    .hero { padding-block: var(--space-8); }
    .hero__title { font-size: var(--text-4xl); }
    .hero__subtitle { font-size: var(--text-base); }

    .section__head {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }
    .section__head--center { align-items: center; }
    .section__title { font-size: var(--text-3xl); }

    .statband__grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-5) 0; }
    .statband__item:nth-child(odd) { border-left: none; }
    .statband__item dd { font-size: var(--text-2xl); }

    .steps { grid-template-columns: 1fr; gap: var(--space-8); }
    .steps::before { display: none; }

    .bento { grid-template-columns: 1fr; }
    .bento__cell--wide { grid-column: span 1; }

    .cta { padding-block: var(--space-8); }
    .cta__title { font-size: var(--text-3xl); }
}

@media (max-width: 480px) {
    .theme-rail { grid-template-columns: 1fr; }
}


/* ══════════════════════════════════════════════════════════════
   MOTION PREFERENCES
   ══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .theme-tile, .bento__cell, .board-card__cta svg, .section__link svg {
        transition: none;
    }
    .theme-tile:hover, .bento__cell:hover { transform: none; }
}
