/**
 * GenLibros — Identidad Imperial Eagles Bilingual School
 * Activar con: body.reader-body.reader-brand-imperial
 * Paleta derivada del escudo institucional (azul imperial, sol radiante, oro bronceado).
 */

body.reader-body.reader-brand-imperial {
    --ie-blue-deep: #0c2340;
    --ie-blue-deep-mid: #152a4a;
    --ie-blue-burst: #2d7fc4;
    --ie-blue-burst-soft: rgba(45, 127, 196, 0.22);
    --ie-gold: #b89432;
    --ie-gold-mid: #947a28;
    --ie-gold-dark: #5a4a1c;
    --ie-gold-light: #d4c896;
    --ie-silver: #e8eef3;
    --ie-silver-warm: #dce4ed;
    --ie-ink-muted: #5a6d82;
    --ie-white: #ffffff;
    --accent-color: #b89432;
    --reader-accent: var(--ie-gold);
    --reader-accent-mid: var(--ie-gold-mid);
    --reader-glow: rgba(184, 148, 50, 0.16);
    --reader-surface-glass: rgba(255, 255, 255, 0.97);
    --reader-font: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --reader-display: 'Cormorant Garamond', 'Literata', Georgia, 'Times New Roman', serif;
}

body.reader-body.reader-brand-imperial {
    background: linear-gradient(168deg, #f6f8fb 0%, var(--ie-silver) 42%, #d4dde8 100%);
    background-image:
        radial-gradient(rgba(12, 35, 64, 0.04) 1px, transparent 1px),
        linear-gradient(168deg, #f6f8fb 0%, var(--ie-silver) 42%, #d4dde8 100%);
    background-size: 22px 22px, auto;
    color: var(--ie-blue-deep);
}

body.reader-body.reader-brand-imperial .reader-landing::before {
    background-image: radial-gradient(rgba(12, 35, 64, 0.06) 1px, transparent 1px);
    background-size: 20px 20px;
    -webkit-mask-image: radial-gradient(ellipse 75% 75% at 50% 35%, black 15%, transparent 72%);
    mask-image: radial-gradient(ellipse 75% 75% at 50% 35%, black 15%, transparent 72%);
}

body.reader-body.reader-brand-imperial .reader-landing-inner {
    max-width: min(440px, 94vw);
}

body.reader-body.reader-brand-imperial .reader-landing-card {
    position: relative;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 55%, #f4f7fb 100%);
    border: 1px solid rgba(201, 162, 39, 0.45);
    border-radius: calc(var(--reader-radius-lg) + 4px);
    padding: 2.25rem 2rem 2rem;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.85) inset,
        0 1px 0 rgba(201, 162, 39, 0.35) inset,
        0 22px 56px rgba(12, 35, 64, 0.09),
        0 2px 8px rgba(12, 35, 64, 0.04);
    overflow: hidden;
}

body.reader-body.reader-brand-imperial .reader-landing-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--ie-blue-deep) 0%, var(--ie-blue-burst) 50%, var(--ie-gold) 100%);
    pointer-events: none;
}

body.reader-body.reader-brand-imperial .reader-landing-card--compact {
    padding: 1.5rem 1.35rem 1.35rem;
}

body.reader-body.reader-brand-imperial .reader-landing-info-chip {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    margin: 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(201, 162, 39, 0.4);
    border-radius: var(--reader-radius-md);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 1px 3px rgba(12, 35, 64, 0.06);
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.12s ease;
}

body.reader-body.reader-brand-imperial .reader-landing-info-chip:hover {
    border-color: rgba(45, 127, 196, 0.45);
    box-shadow: 0 4px 14px rgba(12, 35, 64, 0.08);
}

body.reader-body.reader-brand-imperial .reader-landing-info-chip:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--ie-blue-burst-soft);
}

body.reader-body.reader-brand-imperial .reader-landing-info-chip-mark {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid rgba(201, 162, 39, 0.35);
    background: #fff;
}

body.reader-body.reader-brand-imperial .reader-landing-info-chip-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

body.reader-body.reader-brand-imperial .reader-landing-info-chip-line1 {
    font-family: var(--reader-display);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    color: var(--ie-blue-deep);
}

body.reader-body.reader-brand-imperial .reader-landing-info-chip-line2 {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ie-blue-burst);
}

body.reader-body.reader-brand-imperial .reader-landing-info-chip-icon,
body.reader-body.reader-brand-imperial .reader-landing-info-chip-icon svg {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    color: var(--ie-blue-burst);
}

body.reader-body.reader-brand-imperial .reader-landing-info-chip-icon svg {
    stroke-width: 2.25;
}

body.reader-body.reader-brand-imperial .reader-landing-title--compact {
    margin-top: 1rem;
    font-size: clamp(1.28rem, 4vw, 1.62rem);
}

body.reader-body.reader-brand-imperial .reader-landing-lead--compact {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

body.reader-body.reader-brand-imperial .reader-landing-card--compact .reader-open-book-panel {
    margin-top: 1.1rem;
}

body.reader-body.reader-brand-imperial .reader-institutional-hero {
    margin: 0 0 1.25rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid rgba(201, 162, 39, 0.28);
}

body.reader-body.reader-brand-imperial .reader-institutional-logo {
    display: block;
    width: auto;
    max-width: min(260px, 72vw);
    max-height: clamp(132px, 22vh, 200px);
    height: auto;
    margin: 0 auto 0.5rem;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(12, 35, 64, 0.08));
}

body.reader-body.reader-brand-imperial .reader-institutional-school {
    margin: 0;
    font-family: var(--reader-display);
    font-size: clamp(0.95rem, 2.8vw, 1.15rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ie-blue-deep);
    line-height: 1.25;
}

body.reader-body.reader-brand-imperial .reader-institutional-values {
    margin: 0.35rem 0 0;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--ie-gold-dark);
}

body.reader-body.reader-brand-imperial .reader-landing-brand {
    font-family: var(--reader-display);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--ie-blue-burst);
    border-bottom-color: rgba(45, 127, 196, 0.35);
}

body.reader-body.reader-brand-imperial .reader-landing-brand .reader-institutional-partner {
    font-weight: 600;
    color: var(--ie-ink-muted);
    letter-spacing: 0.04em;
}

body.reader-body.reader-brand-imperial .reader-landing-title {
    font-family: var(--reader-display);
    font-weight: 700;
    font-size: clamp(1.45rem, 4.2vw, 1.85rem);
    letter-spacing: -0.02em;
    color: var(--ie-blue-deep);
    margin-top: 0.35rem;
}

body.reader-body.reader-brand-imperial .reader-landing-lead {
    color: var(--ie-ink-muted);
    font-size: 1.02rem;
    line-height: 1.65;
}

body.reader-body.reader-brand-imperial .reader-open-book-panel {
    margin-top: 1.35rem;
    padding: 1.1rem 1.15rem 1.15rem;
    border-radius: var(--reader-radius-md);
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(12, 35, 64, 0.08);
    box-shadow: 0 1px 2px rgba(12, 35, 64, 0.04);
}

body.reader-body.reader-brand-imperial .reader-name-panel:not([hidden]) {
    margin-top: 1.35rem;
    padding: 1.1rem 1.15rem 1.15rem;
    border-radius: var(--reader-radius-md);
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(12, 35, 64, 0.08);
    box-shadow: 0 1px 2px rgba(12, 35, 64, 0.04);
}

body.reader-body.reader-brand-imperial .reader-name-panel-label,
body.reader-body.reader-brand-imperial .reader-name-panel-title {
    color: var(--ie-blue-deep);
}

body.reader-body.reader-brand-imperial .reader-name-panel-hint {
    color: var(--ie-ink-muted);
}

body.reader-body.reader-brand-imperial .reader-name-panel-input {
    border: 2px solid rgba(12, 35, 64, 0.22);
    background: #fafbfc;
    color: var(--ie-blue-deep);
}

body.reader-body.reader-brand-imperial .reader-name-panel-input:focus {
    outline: none;
    border-color: var(--ie-blue-burst);
    box-shadow: 0 0 0 3px var(--ie-blue-burst-soft);
}

/**
 * Botones primarios: gradiente oro/bronce discreto y sombras neutras (armonía con el azul imperial).
 */
body.reader-body.reader-brand-imperial .reader-landing-card .btn.btn-primary,
body.reader-body.reader-brand-imperial .reader-about-dialog .btn.btn-primary {
    background: linear-gradient(180deg, #ebe5d8 0%, #cbb87a 50%, #9e852f 100%) !important;
    color: var(--ie-blue-deep) !important;
    border: 1px solid rgba(52, 44, 20, 0.42) !important;
    padding: 0.85rem 1.35rem !important;
    border-radius: var(--reader-radius-md) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.38),
        0 1px 2px rgba(12, 35, 64, 0.06),
        0 2px 10px rgba(12, 35, 64, 0.07) !important;
    transform: none !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
}

body.reader-body.reader-brand-imperial .reader-landing-card .btn.btn-primary:hover,
body.reader-body.reader-brand-imperial .reader-about-dialog .btn.btn-primary:hover {
    background: linear-gradient(180deg, #f2ebd9 0%, #d5c38c 50%, #b09238 100%) !important;
    filter: none !important;
    transform: translateY(-1px) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        0 2px 4px rgba(12, 35, 64, 0.08),
        0 6px 16px rgba(12, 35, 64, 0.1) !important;
}

body.reader-body.reader-brand-imperial .reader-landing-card .btn.btn-primary:focus-visible,
body.reader-body.reader-brand-imperial .reader-about-dialog .btn.btn-primary:focus-visible {
    outline: none !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.38),
        0 1px 2px rgba(12, 35, 64, 0.06),
        0 0 0 3px var(--ie-blue-burst-soft) !important;
}

body.reader-body.reader-brand-imperial .reader-landing-card .btn-outline:hover {
    background: rgba(45, 127, 196, 0.08);
    border-color: rgba(45, 127, 196, 0.45);
}

body.reader-body.reader-brand-imperial .reader-landing-cta,
body.reader-body.reader-brand-imperial .reader-name-panel .btn-primary {
    min-height: 48px;
    justify-content: center;
    width: 100%;
}

body.reader-body.reader-brand-imperial .btn-outline {
    border-color: rgba(12, 35, 64, 0.35);
    color: var(--ie-blue-deep);
}

body.reader-body.reader-brand-imperial .reader-institutional-motto {
    margin: 1.75rem 0 0;
    padding-top: 1.1rem;
    border-top: 1px solid rgba(12, 35, 64, 0.08);
    font-family: var(--reader-display);
    font-size: 1rem;
    font-style: italic;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--ie-blue-deep);
    opacity: 0.95;
}

body.reader-body.reader-brand-imperial .reader-adaptive-hint-box {
    margin-top: 1.35rem;
    border: none;
    background: transparent;
}

body.reader-body.reader-brand-imperial .reader-adaptive-hint-inner {
    padding: 1rem 1.1rem !important;
    border-radius: var(--reader-radius-md) !important;
    background: linear-gradient(165deg, #f8fafc 0%, #f1f5f9 100%) !important;
    border: 1px solid rgba(45, 127, 196, 0.22) !important;
    box-shadow: 0 1px 3px rgba(12, 35, 64, 0.05);
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
    color: var(--ie-blue-deep) !important;
}

body.reader-body.reader-brand-imperial .reader-adaptive-hint-inner strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ie-blue-burst) !important;
}

/* ——— Vista de lectura (read.html) ——— */

body.reader-body.reader-brand-imperial .reader-app {
    background: linear-gradient(180deg, #eef2f7 0%, #e4eaf1 100%);
}

body.reader-body.reader-brand-imperial .reader-toolbar {
    background: transparent !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

body.reader-body.reader-brand-imperial .reader-toolbar-institutional-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 0.5rem;
    padding: 2px;
    border-radius: 8px;
    border: 2px solid rgba(201, 162, 39, 0.65);
    background: rgba(255, 255, 255, 0.08);
}

body.reader-body.reader-brand-imperial .reader-toolbar-institutional-mark img {
    display: block;
    width: 40px;
    height: 40px;
    object-fit: contain;
}

body.reader-body.reader-brand-imperial .reader-toolbar-title {
    color: #f1f5f9;
    font-family: var(--reader-display);
    font-weight: 600;
}

body.reader-body.reader-brand-imperial .reader-toolbar-student-label {
    color: rgba(232, 214, 138, 0.85);
}

body.reader-body.reader-brand-imperial .reader-toolbar-student {
    color: #fff;
}

body.reader-body.reader-brand-imperial .reader-toolbar .btn-sm.btn-outline,
body.reader-body.reader-brand-imperial .reader-toolbar a.btn-sm.btn-outline {
    border-color: rgba(232, 214, 138, 0.55);
    color: #f8fafc;
}

body.reader-body.reader-brand-imperial .reader-toolbar .btn-sm.btn-outline:hover,
body.reader-body.reader-brand-imperial .reader-toolbar a.btn-sm.btn-outline:hover {
    border-color: var(--ie-gold-light);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

body.reader-body.reader-brand-imperial .reader-toolbar .btn-icon {
    color: #e2e8f0;
}

body.reader-body.reader-brand-imperial .reader-toolbar .btn-icon:hover {
    color: var(--ie-gold-light);
    background: rgba(255, 255, 255, 0.08);
}

body.reader-body.reader-brand-imperial .reader-page-indicator {
    color: #f1f5f9;
}

body.reader-body.reader-brand-imperial .reader-progress-ring__track {
    stroke: rgba(255, 255, 255, 0.2);
}

body.reader-body.reader-brand-imperial .reader-progress-ring__fill {
    stroke: var(--ie-gold);
}

body.reader-body.reader-brand-imperial .reader-read-error {
    background: var(--ie-silver);
}

body.reader-body.reader-brand-imperial .reader-read-error-inner {
    background: #fff;
    border: 2px solid rgba(201, 162, 39, 0.55);
    border-radius: var(--reader-radius-lg);
    box-shadow: 0 16px 40px rgba(12, 35, 64, 0.1);
}

body.reader-body.reader-brand-imperial .reader-read-error-title {
    font-family: var(--reader-display);
    color: var(--ie-blue-deep);
}

body.reader-body.reader-brand-imperial .reader-read-error-text {
    color: var(--ie-ink-muted);
}

/* Tarjetas de página del libro: borde oro sutil */
body.reader-body.reader-brand-imperial.genlibros-reader .reader-pages-stack .canvas-page {
    box-shadow:
        0 0 0 2px rgba(201, 162, 39, 0.45),
        0 12px 36px rgba(12, 35, 64, 0.12);
}

body.reader-body.reader-brand-imperial .reader-assignment-banner {
    border-color: rgba(201, 162, 39, 0.5);
    background: rgba(45, 127, 196, 0.12);
    color: var(--ie-blue-deep);
}

/* Diálogo información (lector) */
body.reader-body.reader-brand-imperial .reader-about-dialog {
    max-width: min(420px, 92vw);
    padding: 0;
    border: none;
    border-radius: var(--reader-radius-lg);
    box-shadow: 0 24px 60px rgba(12, 35, 64, 0.35);
}

body.reader-body.reader-brand-imperial .reader-info-dialog {
    max-width: min(540px, 94vw);
}

body.reader-body.reader-brand-imperial .reader-about-dialog::backdrop {
    background: rgba(12, 35, 64, 0.45);
}

body.reader-body.reader-brand-imperial .reader-about-dialog-inner {
    padding: 1.75rem 1.5rem;
    text-align: center;
    background: #fff;
    border: 2px solid rgba(201, 162, 39, 0.55);
    border-radius: var(--reader-radius-lg);
}

body.reader-body.reader-brand-imperial .reader-info-dialog-inner {
    max-height: min(88vh, 800px);
    overflow-y: auto;
    overflow-x: hidden;
    text-align: left;
    -webkit-overflow-scrolling: touch;
}

body.reader-body.reader-brand-imperial .reader-info-dialog-top {
    text-align: center;
    padding-bottom: 1rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid rgba(12, 35, 64, 0.1);
}

body.reader-body.reader-brand-imperial .reader-info-dialog-top img {
    display: block;
    margin: 0 auto 0.75rem;
}

body.reader-body.reader-brand-imperial .reader-info-dialog-inner .reader-info-dialog-school {
    margin: 0 0 0.35rem;
    font-family: var(--reader-display);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ie-blue-deep);
    line-height: 1.25;
}

body.reader-body.reader-brand-imperial .reader-info-dialog-body {
    padding: 0 0.15rem;
}

body.reader-body.reader-brand-imperial .reader-info-dialog-h2 {
    font-family: var(--reader-display);
    font-size: 1.25rem;
    color: var(--ie-blue-deep);
    margin: 0 0 0.65rem;
}

body.reader-body.reader-brand-imperial .reader-info-dialog-h3 {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ie-blue-burst);
    margin: 1.15rem 0 0.4rem;
}

body.reader-body.reader-brand-imperial .reader-info-dialog-inner .reader-info-dialog-ipad {
    margin-top: 0.35rem;
    margin-bottom: 0.15rem;
}

body.reader-body.reader-brand-imperial .reader-info-dialog-inner .reader-about-motto {
    margin-bottom: 0 !important;
}

body.reader-body.reader-brand-imperial .reader-info-dialog-inner > .btn.btn-primary {
    width: 100%;
    margin-top: 1.25rem;
}

body.reader-body.reader-brand-imperial .reader-about-dialog-inner img {
    max-width: 220px;
    width: 100%;
    height: auto;
    margin-bottom: 1rem;
}

body.reader-body.reader-brand-imperial .reader-about-dialog-inner h2 {
    font-family: var(--reader-display);
    font-size: 1.35rem;
    color: var(--ie-blue-deep);
    margin: 0 0 0.5rem;
}

body.reader-body.reader-brand-imperial .reader-about-dialog-inner p {
    color: var(--ie-ink-muted);
    line-height: 1.55;
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
}

body.reader-body.reader-brand-imperial .reader-about-values {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--ie-gold-dark);
    margin: 0.5rem 0 !important;
}

body.reader-body.reader-brand-imperial .reader-about-motto {
    font-family: var(--reader-display);
    font-style: italic;
    color: var(--ie-blue-deep) !important;
    margin-bottom: 1.25rem !important;
}

@media (max-width: 1099px) {
    body.reader-body.reader-brand-imperial .reader-toolbar-institutional-mark {
        margin-bottom: 0.25rem;
    }
}

/* Tarjeta de Portada — Fallback mínimo: solo si el preset no inyectó estilos inline */
.book-cover-branding:not([style]) {
    position: relative;
    margin: 1.5rem auto;
    width: 88%;
    max-width: 600px;
    text-align: left;
    padding: 2.2rem 2rem;
    background: rgba(255, 255, 255, 0.98);
    border-left: 8px solid #0f172a;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    box-sizing: border-box;
}

.book-cover-branding:not([style]) #titulo-libro,
.book-cover-branding:not([style]) h2 {
    margin: 0 0 0.5rem 0;
    font-size: 2.4rem;
    font-family: 'Literata', 'Cormorant Garamond', serif;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.book-cover-branding:not([style]) p {
    margin: 0.5rem 0;
    font-family: 'Outfit', 'Source Sans 3', sans-serif;
}

.book-cover-branding:not([style]) p:first-child {
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #475569;
    font-weight: 700;
    margin-bottom: 1rem;
}

.book-cover-branding:not([style]) p:last-child {
    font-size: 0.95rem;
    color: #64748b;
    margin-top: 1rem;
}
