/* =========================================================
   DABEST LINK - the school paper flipbook (dabest-link.php)
   =========================================================
   Loaded through $page_stylesheets in dabest-link.php.
   Sections: toolbar, reading stage, controls, scroll mode,
   section chips, about box, small screens.
   ========================================================= */

.dabest-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.dabest-issue-title {
    margin: 0;
    font-size: clamp(1.15rem, 2.6vw, 1.5rem);
    line-height: 1.25;
}

.dabest-issue-title small {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.15rem;
}

/* Flipbook / Scroll switch */
.dabest-switch {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: #e8edf4;
}

.dabest-switch button {
    border: 0;
    background: transparent;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    min-height: 36px;
}

.dabest-switch button[aria-pressed="true"] {
    background: var(--bnhs-navy);
    color: #fff;
}

/* The reading stage */
.dabest-stage {
    position: relative;
    border-radius: 16px;
    padding: clamp(10px, 2.6vw, 28px) clamp(8px, 2.6vw, 28px) 0.75rem;
    background: radial-gradient(120% 90% at 50% 0%, #f1f4f8 0%, #e3e8ef 55%, #d6dde7 100%);
    border: 1px solid #cfd7e2;
    box-shadow: 0 10px 28px rgba(11, 42, 74, 0.1);
    color: var(--bnhs-navy);
}

.dabest-stage:fullscreen,
.dabest-stage.is-expanded {
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px 12px 8px;
}

/* Full screen on phones that cannot do real full screen: cover the whole window */
.dabest-stage.is-expanded {
    position: fixed;
    inset: 0;
    z-index: 2000;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.dabest-stage:fullscreen .dabest-hint,
.dabest-stage.is-expanded .dabest-hint {
    display: none;
}

html.dabest-lock {
    overflow: hidden;
}

.dabest-book-wrap {
    position: relative;
    width: 100%;
}


#dabestBook {
    width: 100%;
    margin: 0 auto;
    touch-action: pan-y;
    transition: transform 0.45s ease;
}

.dabest-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.dabest-loading span {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px solid rgba(11, 42, 74, 0.15);
    border-top-color: var(--bnhs-gold);
    animation: dabest-spin 0.8s linear infinite;
}

.dabest-stage.is-ready .dabest-loading {
    opacity: 0;
}

@keyframes dabest-spin {
    to { transform: rotate(360deg); }
}

/* Controls under the book */
.dabest-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 0.85rem;
}

.dabest-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #c3ccd9;
    background: #fff;
    color: var(--bnhs-navy);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.dabest-btn:hover:not(:disabled) {
    background: #fff8e8;
    border-color: var(--bnhs-gold);
}

.dabest-btn:focus-visible,
.dabest-switch button:focus-visible,
.dabest-chip:focus-visible {
    outline: 3px solid var(--bnhs-gold);
    outline-offset: 2px;
}

.dabest-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.dabest-status {
    min-width: 9.5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #c3ccd9;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.dabest-hint {
    margin: 0.6rem 0 0;
    text-align: center;
    font-size: 0.78rem;
    color: #64748b;
}

/* Scroll (plain pages) mode */
.dabest-scroll {
    margin: 0 auto;
    max-width: 860px;
}

/* With JavaScript the plain page list only shows in "Scroll" mode */
.dabest-stage.is-js:not(.is-scroll) .dabest-scroll {
    display: none;
}

.dabest-stage:not(.is-js) .dabest-book-wrap {
    display: none;
}

.dabest-scroll figure {
    margin: 0 0 1rem;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(11, 42, 74, 0.2);
}

.dabest-scroll img {
    display: block;
    width: 100%;
    height: auto;
}

.dabest-stage.is-scroll .dabest-book-wrap,
.dabest-stage.is-scroll .dabest-controls,
.dabest-stage.is-scroll .dabest-hint {
    display: none;
}

/* Section chips */
.dabest-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.1rem;
}

.dabest-chips-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
    margin-right: 0.25rem;
}

.dabest-chip {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: var(--bnhs-navy);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    min-height: 36px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dabest-chip:hover {
    border-color: var(--bnhs-gold);
    background: #fff8e8;
}

.dabest-chip small {
    color: #64748b;
    font-weight: 500;
    margin-left: 0.2rem;
}

.dabest-about {
    border-left: 4px solid var(--bnhs-gold);
    background: var(--bnhs-bg-light);
    border-radius: 0 10px 10px 0;
    padding: 1.1rem 1.25rem;
}

@media (max-width: 575.98px) {
    .dabest-toolbar-row .btn {
        flex: 1 1 auto;
    }

    .dabest-status {
        min-width: 0;
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dabest-loading span {
        animation-duration: 2s;
    }
}
