/*-- -------------------------- -->
<---  Sweepstakes Casinos by State  -->
<--- -------------------------- -*/

/* Page-local tokens built on the global :root variables, matching the pattern
   used by how-it-works.css and app.css. Flat treatment throughout — solid
   fills and hairline borders, no coloured halos or gradients. */
#hero-states,
#states-body {
    --stBorder: #e7e5ec;
    --stSurface: #f7f6f9;
    --stSurfaceMuted: #f1eff4;
    --stMaxWidth: 52rem;
}

/*-- ---------- Hero ---------- -*/
@media only screen and (min-width: 0rem) {
    #hero-states {
        padding: clamp(7rem, 12vw, 10rem) 1rem clamp(2.5rem, 5vw, 3.5rem);
        border-bottom: 1px solid var(--stBorder);
        background: var(--stSurface);
    }

    #hero-states .cs-container {
        width: 100%;
        max-width: var(--stMaxWidth);
        margin: auto;
    }

    #hero-states .cs-content {
        text-align: left;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    #hero-states .cs-title {
        font-size: clamp(2rem, 5.5vw, 3rem);
        max-width: 20ch;
        margin-bottom: 1rem;
    }

    #hero-states .cs-text {
        margin-bottom: 1.5rem;
        max-width: 44rem;
    }

    /* Real figures pulled from the tracked data, not decoration. */
    .states-stats {
        list-style: none;
        margin: 0 0 1.25rem;
        padding: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem clamp(1.25rem, 4vw, 2.5rem);
    }

    .states-stats li {
        display: flex;
        flex-direction: column;
        line-height: 1.15;
    }

    .states-stats strong {
        font-size: clamp(1.5rem, 4vw, 2rem);
        font-weight: 900;
        letter-spacing: -0.02em;
        color: var(--primary);
    }

    .states-stats span {
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        opacity: 0.7;
        margin-top: 0.2rem;
    }

    .states-disclaimer {
        margin: 0;
        font-size: 0.8125rem;
        line-height: 1.6;
        opacity: 0.8;
        max-width: 44rem;
    }
}

/*-- ---------- Body ---------- -*/
@media only screen and (min-width: 0rem) {
    #states-body {
        padding: clamp(2.5rem, 6vw, 4rem) 1rem clamp(4rem, 9vw, 6.25rem);
    }

    #states-body .cs-container {
        width: 100%;
        max-width: var(--stMaxWidth);
        margin: auto;
        display: flex;
        flex-direction: column;
        gap: clamp(2rem, 5vw, 3rem);
    }

    /* ---- Methodology note ---- */
    .states-method {
        border: 1px solid var(--stBorder);
        border-left: 4px solid var(--primary);
        border-radius: 0.75rem;
        padding: clamp(1.25rem, 3vw, 1.75rem);
        background: var(--stSurface);
    }

    .states-method h2 {
        font-size: clamp(1.125rem, 2.6vw, 1.375rem);
        font-weight: 800;
        line-height: 1.25;
        margin: 0 0 0.75rem;
        color: var(--headerColor);
    }

    .states-method p {
        margin: 0 0 0.875rem;
        font-size: 0.9375rem;
        line-height: 1.65;
        color: var(--bodyTextColor);
    }

    .states-method strong { color: var(--headerColor); }

    .states-method__list {
        margin: 0 0 0.875rem;
        padding-left: 1.1rem;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .states-method__list li {
        font-size: 0.9375rem;
        line-height: 1.6;
        color: var(--bodyTextColor);
    }

    .states-method__verify {
        padding: 0.75rem 1rem;
        border-radius: 0.5rem;
        background: var(--stSurfaceMuted);
        font-weight: 600;
    }

    .states-method__stamp {
        margin: 0;
        font-size: 0.8125rem;
        opacity: 0.75;
    }

    /* ---- Jump nav ---- */
    .states-nav {
        background: var(--stSurface);
        border: 1px solid var(--stBorder);
        border-radius: 0.75rem;
        padding: 1.25rem 1.5rem;
    }

    .states-nav__label {
        display: block;
        font-size: var(--topperFontSize);
        text-transform: uppercase;
        letter-spacing: 0.1em;
        font-weight: 700;
        color: var(--primary);
        margin-bottom: 0.75rem;
    }

    .states-nav__list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
        gap: 0.4rem 1rem;
    }

    .states-nav__list a {
        font-size: 0.875rem;
        color: var(--bodyTextColor);
        text-decoration: none;
        border-bottom: 1px solid transparent;
        transition: color 0.2s, border-color 0.2s;
    }

    .states-nav__list a:hover,
    .states-nav__list a:focus-visible {
        color: var(--primary);
        border-bottom-color: var(--primary);
    }

    /* ---- State blocks ---- */
    .states-list {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .state-block {
        border: 1px solid var(--stBorder);
        border-radius: 0.75rem;
        padding: 1.25rem clamp(1rem, 3vw, 1.5rem);
        /* Clears the sticky header when jumped to from the nav above. */
        scroll-margin-top: 6rem;
    }

    .state-block__head {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        justify-content: space-between;
        gap: 0.5rem;
        margin-bottom: 0.875rem;
    }

    .state-block__head h2 {
        font-size: clamp(1.125rem, 2.6vw, 1.375rem);
        font-weight: 800;
        line-height: 1.25;
        margin: 0;
        color: var(--headerColor);
    }

    .state-block__badges {
        flex: none;
        display: flex;
        align-items: center;
        gap: 0.4rem;
    }

    .state-block__count {
        flex: none;
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        padding: 0.2rem 0.6rem;
        border-radius: 1rem;
        background: var(--stSurfaceMuted);
        color: var(--bodyTextColor);
    }

    /* ---- Restricted states ---- */
    /* Muted red, deliberately not alarming — this is information, not an error. */
    .state-block--restricted {
        border-left: 4px solid #dc2626;
    }

    .state-block__flag {
        flex: none;
        font-size: 0.75rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        padding: 0.2rem 0.6rem;
        border-radius: 1rem;
        background: #fee2e2;
        color: #b91c1c;
    }

    .state-block__restriction {
        margin: 0 0 0.875rem;
        padding: 0.75rem 1rem;
        border-radius: 0.5rem;
        background: #fef2f2;
        color: #7f1d1d;
        font-size: 0.875rem;
        line-height: 1.6;
    }

    .state-block__exception {
        margin: 0 0 0.625rem;
        font-size: 0.8125rem;
        line-height: 1.55;
        font-weight: 600;
        color: var(--bodyTextColor);
    }

    /* Badge marking a platform that doesn't use a sweepstakes model — the
       reason it can appear in a restricted state without contradiction. */
    .state-casino__label {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .state-casino__model {
        font-size: 0.625rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        padding: 0.12rem 0.4rem;
        border-radius: 0.75rem;
        background: var(--stSurfaceMuted);
        color: var(--bodyTextColor);
        white-space: nowrap;
    }

    .state-casinos {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
    }

    .state-casinos li {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        justify-content: space-between;
        gap: 0.25rem 0.75rem;
        padding: 0.5rem 0;
        border-top: 1px solid var(--stBorder);
    }

    .state-casinos li:first-child { border-top: none; }

    .state-casino__name {
        font-size: 0.9375rem;
        font-weight: 700;
        color: var(--primary);
        text-decoration: none;
    }

    .state-casino__name:hover,
    .state-casino__name:focus-visible { text-decoration: underline; }

    .state-casino__meta {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.8125rem;
    }

    .state-casino__bonus {
        color: var(--bodyTextColor);
        opacity: 0.85;
    }

    .state-casino__age {
        font-weight: 700;
        padding: 0.05rem 0.4rem;
        border-radius: 0.75rem;
        background: var(--stSurfaceMuted);
        color: var(--bodyTextColor);
    }

    .state-block__cta {
        margin: 0.875rem 0 0;
        font-size: 0.875rem;
    }

    .state-block__cta a {
        color: var(--primary);
        font-weight: 700;
        text-decoration: none;
    }

    .state-block__cta a:hover,
    .state-block__cta a:focus-visible { text-decoration: underline; }

    .state-block__empty {
        margin: 0;
        font-size: 0.875rem;
        line-height: 1.6;
        color: var(--bodyTextColor);
    }

    .state-block__empty a { color: var(--primary); font-weight: 700; }

    /* ---- FAQ ---- */
    .states-faq h2 {
        font-size: clamp(1.5rem, 3.4vw, 2rem);
        font-weight: 800;
        line-height: 1.25;
        margin: 0 0 1rem;
        color: var(--headerColor);
    }

    .states-faq__item {
        border: 1px solid var(--stBorder);
        border-radius: 0.75rem;
        margin-bottom: 0.75rem;
        overflow: hidden;
    }

    .states-faq__item summary {
        cursor: pointer;
        padding: 1rem 3rem 1rem 1.25rem;
        font-weight: 700;
        color: var(--headerColor);
        list-style: none;
        position: relative;
    }

    .states-faq__item summary::-webkit-details-marker { display: none; }

    .states-faq__item summary:after {
        content: '+';
        position: absolute;
        right: 1.25rem;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.5rem;
        font-weight: 400;
        color: var(--primary);
    }

    .states-faq__item[open] summary:after { content: '\2212'; }

    .states-faq__item summary:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: -2px;
    }

    .states-faq__item p {
        padding: 0 1.25rem 1.25rem;
        margin: 0;
        line-height: 1.65;
        color: var(--bodyTextColor);
    }

    .states-faq__item p a { color: var(--primary); font-weight: 600; }

    /* ---- Closing CTA ---- */
    .states-cta {
        /* Solid fill, matching the flat treatment on the homepage band. */
        background: var(--primaryDeep);
        border-radius: 1rem;
        padding: clamp(2rem, 5vw, 2.75rem) clamp(1.25rem, 4vw, 2.5rem);
        text-align: center;
    }

    .states-cta h2 {
        color: #fff;
        font-size: clamp(1.375rem, 3.2vw, 1.875rem);
        font-weight: 800;
        margin: 0 0 0.5rem;
    }

    .states-cta p {
        color: #fff;
        max-width: 34rem;
        margin: 0 auto 1.5rem;
        line-height: 1.6;
    }

    /* ID-free but explicitly re-stated for dark mode below, so the global
       `body.dark-mode a { color: white }` rule can't repaint it. */
    .states-cta__button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 1rem 1.75rem;
        font-size: 1rem;
        font-weight: 800;
        line-height: 1;
        text-decoration: none;
        background: #fff;
        color: var(--headerColor);
        border-radius: 0.6rem;
        transition: transform 0.2s;
    }

    .states-cta__button:hover,
    .states-cta__button:focus-visible { transform: translateY(-2px); }

    .states-cta__note {
        margin: 1.25rem 0 0;
        font-size: 0.8125rem;
        font-weight: 700;
        color: #fff;
    }
}

/*-- ---------- Dark mode ---------- -*/
@media only screen and (min-width: 0rem) {
    body.dark-mode #hero-states,
    body.dark-mode #states-body {
        --stBorder: #2a2830;
        --stSurface: #16151a;
        --stSurfaceMuted: #1d1c22;
    }

    body.dark-mode #hero-states {
        background: #16151a;
        border-bottom-color: #2a2830;
    }

    body.dark-mode #hero-states .cs-title,
    body.dark-mode #hero-states .cs-text,
    body.dark-mode .states-disclaimer,
    body.dark-mode .state-block__head h2,
    body.dark-mode .states-faq h2,
    body.dark-mode .states-faq__item summary,
    body.dark-mode .states-method h2,
    body.dark-mode .states-method p,
    body.dark-mode .states-method strong,
    body.dark-mode .states-method__list li {
        color: var(--bodyTextColorWhite);
    }

    body.dark-mode .states-stats strong { color: var(--blackjackGold); }
    body.dark-mode .states-stats span { color: var(--bodyTextColorWhite); }

    body.dark-mode .states-nav__list a,
    body.dark-mode .state-casino__bonus,
    body.dark-mode .state-casino__age,
    body.dark-mode .state-block__count,
    body.dark-mode .state-block__empty,
    body.dark-mode .state-block__exception,
    body.dark-mode .state-casino__model,
    body.dark-mode .states-faq__item p {
        color: var(--bodyTextColorWhite);
    }

    body.dark-mode .state-block__flag {
        background: rgba(220, 38, 38, 0.18);
        color: #fca5a5;
    }

    body.dark-mode .state-block__restriction {
        background: rgba(220, 38, 38, 0.12);
        color: #fca5a5;
    }

    body.dark-mode .states-nav__list a:hover,
    body.dark-mode .state-casino__name,
    body.dark-mode .state-block__cta a,
    body.dark-mode .state-block__empty a,
    body.dark-mode .states-faq__item p a,
    body.dark-mode .states-faq__item summary:after {
        color: var(--blackjackGold);
    }

    /* The CTA band keeps its solid brand fill in both themes, so its button
       must not inherit the global dark-mode link colour (white-on-white). */
    body.dark-mode .states-cta h2,
    body.dark-mode .states-cta p,
    body.dark-mode .states-cta__note { color: #fff; }
    body.dark-mode .states-cta__button { color: var(--headerColor); }
}

@media (prefers-reduced-motion: reduce) {
    .states-cta__button { transition: none; }
    .states-cta__button:hover,
    .states-cta__button:focus-visible { transform: none; }
}
