/* TLA Impact Frameworks — the edition's title block, intro and the card deck.
   The deck follows the PSHE Cards project: a horizontal, snap-scrolling row
   of tall cards with chevron controls and a counter above and below, an
   enlarge button that opens the card in a full-screen overlay, and a
   read-aloud button. Dark-mode surface overrides live in css/dark-theme.css. */

.impact-content {
    color: var(--tla-ink);
}

.impact-empty {
    text-align: center;
    color: var(--tla-muted, #5b6172);
    font-style: italic;
}

/* --- Title, strapline and the Previous Impact Frameworks dropdown --- */
.impact-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 2rem;
    max-width: 1100px;
    margin: 0 auto 1.5rem;
}

.impact-head-text {
    flex: 1 1 320px;
    min-width: 0;
}

.impact-title {
    margin: 0;
    font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -0.01em;
}

.impact-strapline {
    margin: 0.35rem 0 0;
    font-size: 1.1rem;
    font-style: italic;
    font-weight: 600;
    color: var(--tla-muted, #5b6172);
}

.impact-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.impact-previous-btn,
.impact-current-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-weight: 700;
    color: #1f2330;
    background: var(--tla-accent);
    border: 2px solid var(--tla-accent);
    border-radius: 10px;
    white-space: nowrap;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.impact-previous-btn:hover,
.impact-previous-btn:focus-visible,
.impact-previous-btn.show,
.impact-current-link:hover,
.impact-current-link:focus-visible {
    color: #000;
    background: var(--tla-accent-dark, #d9a800);
    border-color: var(--tla-accent-dark, #d9a800);
    transform: translateY(-2px);
}

.impact-previous-menu {
    border: 1px solid #3fc5bf;
    border-radius: 12px;
    padding: 0.4rem;
    box-shadow: rgba(0, 0, 0, 0.12) 0 10px 30px;
}

.impact-previous-menu .dropdown-item {
    border-radius: 8px;
    font-weight: 600;
}

.impact-previous-menu .dropdown-item:hover,
.impact-previous-menu .dropdown-item:focus-visible {
    background: var(--tla-accent);
    color: #1f2330;
}

.impact-archive-note {
    max-width: 1100px;
    margin: -0.5rem auto 1.5rem;
    color: var(--tla-muted, #5b6172);
    font-weight: 600;
}

/* --- Editable intro text block --- */
.impact-intro {
    max-width: none;
    margin: 0 var(--blurb-gutter) 2rem;
    padding: 1.5rem 2rem;
    background: #fff;
    border: 1px solid #3fc5bf;
    border-radius: 1rem;
    font-size: 1.05rem;
    line-height: 1.7;
}

.impact-intro :last-child {
    margin-bottom: 0;
}

.impact-intro img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

/* --- Deck controls --- */
.impact-deck-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 15px 0;
}

.impact-nav-btn {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    color: #1f2330;
    font-size: 18px;
    background: var(--tla-accent);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.impact-nav-btn:hover,
.impact-nav-btn:focus-visible {
    background: var(--tla-accent-dark, #d9a800);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.impact-nav-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.impact-nav-counter {
    min-width: 90px;
    padding: 8px 16px;
    text-align: center;
    font-weight: 700;
    color: #1f2330;
    background: #fff;
    border: 1px solid #3fc5bf;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* --- The card row --- */
.impact-card-row {
    display: flex;
    gap: 24px;
    width: 100%;
    /* Full width of the screen (the deck is outside the page container), with
       side padding so the first and last cards never touch the edges. */
    padding: 1rem clamp(1rem, 4vw, 4rem) 1.5rem;
    scroll-padding-inline: clamp(1rem, 4vw, 4rem);
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    outline: none;
}

.impact-card-row::-webkit-scrollbar {
    display: none;
}

.impact-card-row:focus-visible {
    box-shadow: 0 0 0 3px var(--tla-accent);
    border-radius: 1rem;
}

/* Cards scale with the viewport: about a third of the screen on a desktop,
   capped at the printed-card size, never narrower than a phone card. The
   type inside scales on the same curve (see the clamp() sizes below). */
.impact-card-item {
    flex: 0 0 auto;
    width: clamp(300px, 33vw, 460px);
    scroll-snap-align: center;
}

/* First and last cards can centre in the row on wide screens. */
.impact-card-item:first-child {
    margin-left: auto;
}

.impact-card-item:last-child {
    margin-right: auto;
}

/* --- One card --- */
.impact-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: clamp(480px, 51vw, 700px);
    max-height: 80vh;
    border: 3px solid #3fc5bf;
    border-radius: 1rem;
    background: #fff;
    color: #1f2330;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.impact-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.16);
}

/* Top of the card: one coloured block, in the card's own item colour, that
   holds the icon circle above the title. Icon and title share the background,
   as in the printed framework's column heads. */
.impact-card-top {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(0.9rem, 1.4vw, 1.25rem) 1.25rem 0;
    background: var(--impact-colour, #1b3452);
    color: #fff;
}

.impact-card-icon {
    flex: 0 0 auto;
    width: clamp(3.4rem, 4.4vw, 4.5rem);
    height: clamp(3.4rem, 4.4vw, 4.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    font-size: clamp(1.4rem, 1.9vw, 1.9rem);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.impact-card-icon img {
    width: 62%;
    height: 62%;
    object-fit: contain;
    display: block;
}

.impact-card-header {
    width: 100%;
    padding: 0.6rem 0 clamp(0.8rem, 1.2vw, 1rem);
    background: transparent;
    color: #fff;
    border-bottom: 0;
    border-radius: 0;
    text-align: center;
}

.impact-card-header h5 {
    font-size: clamp(1.05rem, 0.7rem + 0.5vw, 1.25rem);
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

/* Body: subtitle then descriptor for each sub-category. Scrolls inside the
   card when an edition's text runs longer than the card. */
.impact-card-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: clamp(0.9rem, 1.4vw, 1.25rem) clamp(0.9rem, 1.4vw, 1.25rem) 3.75rem;
    overflow-y: auto;
    scrollbar-width: thin;
}

.impact-card-subtitle {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0 0 0.4rem;
    font-size: clamp(0.9rem, 0.6rem + 0.42vw, 1.02rem);
    font-weight: 800;
    color: var(--impact-colour, #1b3452);
}

.impact-card-code {
    flex: 0 0 auto;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--impact-colour, #1b3452);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.impact-card-text {
    margin: 0 0 1.1rem;
    font-size: clamp(0.84rem, 0.56rem + 0.4vw, 0.95rem);
    line-height: 1.6;
    text-align: justify;
}

.impact-card-text:last-child {
    margin-bottom: 0;
}

.impact-card-text-empty {
    color: var(--tla-muted, #5b6172);
    font-style: italic;
    text-align: left;
}

/* Text scrolling under the corner buttons fades out behind them. */
.impact-card::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4rem;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, #fff 70%);
}

/* --- Corner buttons: enlarge (top right), read aloud and voice (bottom left) --- */
.impact-corner-btn {
    position: absolute;
    z-index: 5;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.impact-corner-btn:hover,
.impact-corner-btn:focus-visible {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.08);
}

.impact-expand-btn {
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.92);
    color: #1f2330;
}

.impact-expand-btn:hover,
.impact-expand-btn:focus-visible {
    background: #fff;
}

.impact-read-btn {
    bottom: 10px;
    left: 10px;
}

.impact-read-btn.is-reading {
    background: #198754;
    animation: impact-read-pulse 1.1s ease-in-out infinite;
}

@keyframes impact-read-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.6); }
    50% { box-shadow: 0 0 0 6px rgba(25, 135, 84, 0); }
}

.impact-voice-btn {
    bottom: 12px;
    left: 54px;
    width: 34px;
    height: 34px;
    font-size: 13px;
}

/* Academic year of the edition, bottom-right corner, in the card's colour. */
.impact-card-year {
    position: absolute;
    right: 12px;
    bottom: 14px;
    z-index: 5;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: var(--impact-colour, #1b3452);
    color: #fff;
    font-size: clamp(0.72rem, 0.5rem + 0.3vw, 0.82rem);
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.3;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    pointer-events: none;
}

/* Voice picker: a small menu above the read-aloud button. */
.impact-voice-menu {
    position: absolute;
    z-index: 20;
    left: 10px;
    bottom: 54px;
    width: 240px;
    max-width: calc(100% - 20px);
    max-height: 240px;
    overflow-y: auto;
    padding: 6px;
    background: #fff;
    color: #212529;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.impact-voice-label {
    padding: 4px 8px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6c757d;
}

.impact-voice-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 7px 8px;
    border: none;
    border-radius: 7px;
    background: transparent;
    text-align: left;
    font-size: 13px;
    color: #212529;
    cursor: pointer;
}

.impact-voice-item:hover {
    background: #f1f3f5;
}

.impact-voice-item.is-active {
    background: #fff6d1;
    font-weight: 700;
}

.impact-voice-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.impact-voice-tag {
    flex: 0 0 auto;
    font-size: 11px;
    color: #6c757d;
}

.impact-voice-empty {
    padding: 10px 8px;
    font-size: 13px;
    color: #6c757d;
}

/* --- Enlarge overlay --- */
.impact-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 90px 76px;
    background: rgba(0, 0, 0, 0.88);
}

/* Leaves room under the card for the counter pill. */
.impact-overlay .impact-card {
    width: min(760px, 100%);
    height: min(calc(100vh - 100px), 980px);
    max-height: none;
    transform: none;
}

.impact-overlay .impact-card-header h5 {
    font-size: 1.6rem;
}

.impact-overlay .impact-card-icon {
    width: 5.5rem;
    height: 5.5rem;
    font-size: 2.3rem;
}

.impact-overlay .impact-card-body {
    padding: 1.5rem 1.5rem 4rem;
}

.impact-overlay .impact-card-subtitle {
    font-size: 1.2rem;
}

.impact-overlay .impact-card-text {
    font-size: 1.12rem;
    line-height: 1.75;
}

.impact-overlay-close,
.impact-overlay-nav {
    position: fixed;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #1f2330;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.impact-overlay-close:hover,
.impact-overlay-nav:hover {
    transform: scale(1.08);
}

.impact-overlay-close {
    top: 18px;
    right: 22px;
    width: 46px;
    height: 46px;
    font-size: 20px;
}

.impact-overlay-nav {
    top: 50%;
    width: 56px;
    height: 56px;
    margin-top: -28px;
    font-size: 22px;
}

.impact-overlay-nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

.impact-overlay-prev {
    left: 18px;
}

.impact-overlay-next {
    right: 18px;
}

.impact-overlay-counter {
    position: fixed;
    z-index: 2100;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    padding: 8px 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.92);
    color: #1f2330;
    font-weight: 700;
}

@media (max-width: 767.98px) {
    .impact-card-row {
        padding-left: 1rem;
        padding-right: 1rem;
        scroll-padding-inline: 1rem;
    }

    .impact-card-item {
        width: 86vw;
    }

    .impact-card {
        height: 72vh;
    }

    .impact-overlay {
        padding: 70px 12px 60px;
    }

    .impact-overlay-nav {
        top: auto;
        bottom: 14px;
        width: 46px;
        height: 46px;
        margin-top: 0;
    }

    .impact-overlay-prev {
        left: 12px;
    }

    .impact-overlay-next {
        right: 12px;
    }

    .impact-overlay .impact-card {
        height: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .impact-card,
    .impact-nav-btn,
    .impact-corner-btn,
    .impact-previous-btn,
    .impact-current-link {
        transition: none;
    }

    .impact-card-row {
        scroll-behavior: auto;
    }

    .impact-read-btn.is-reading {
        animation: none;
    }
}
