/* =========================================================
   GRIMORIO DE ZENDIKAR
   ========================================================= */


/* =========================================================
   CABECERA
   ========================================================= */

.spellbook-hero {
    min-height: 270px;
}

.spellbook-hero .hero-content {
    min-height: 270px;
}

.spellbook-kicker {
    margin: 0 0 4px;
}

.spellbook-hero .guild-title h1 {
    font-size: clamp(3rem, 5vw, 5rem);
    line-height: 1;
}

.spellbook-notice {
    min-height: 210px;
    justify-content: flex-start;
}

.back-to-portal {
    position: relative;
    z-index: 2;

    display: inline-block;
    margin-top: 18px;

    color: var(--navy-700);

    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
}

.back-to-portal:hover {
    color: var(--gold-700);
    text-decoration: underline;
}


/* =========================================================
   CONTENIDO
   ========================================================= */

.spellbook-content {
    min-height: 600px;

    padding: 28px;

    background:
        radial-gradient(
            circle at top center,
            rgba(205, 224, 244, 0.20),
            transparent 34%
        ),
        linear-gradient(
            180deg,
            rgba(255, 253, 248, 0.99),
            rgba(246, 241, 231, 0.99)
        );
}


/* =========================================================
   ENCABEZADO DEL REGISTRO
   ========================================================= */

.spellbook-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 24px;

    margin-bottom: 22px;
    padding-bottom: 18px;

    border-bottom:
        1px solid rgba(173, 125, 49, 0.28);
}

.spellbook-eyebrow {
    display: block;

    margin-bottom: 3px;

    color: var(--gold-700);

    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.spellbook-heading h2 {
    margin: 0;

    color: var(--navy-900);

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size: 2rem;
    font-weight: 400;
}

.spellbook-heading p {
    margin-top: 4px;

    color: var(--text-soft);

    font-size: 0.82rem;
}

.spell-count {
    min-width: 150px;

    padding: 12px 16px;

    text-align: center;

    border:
        1px solid var(--border-gold);

    border-radius: 14px;

    background:
        rgba(255, 255, 255, 0.64);

    box-shadow:
        0 8px 20px
        rgba(18, 42, 72, 0.07);
}

.spell-count strong {
    display: block;

    color: var(--navy-900);

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size: 1.6rem;

    line-height: 1;
}

.spell-count span {
    display: block;

    margin-top: 4px;

    color: var(--text-soft);

    font-size: 0.66rem;
}


/* =========================================================
   BUSCADOR Y SELECTORES
   ========================================================= */

.spell-controls {
    display: grid;

    grid-template-columns:
        minmax(280px, 1fr)
        210px
        210px;

    gap: 16px;

    padding: 18px;

    border:
        1px solid var(--border-gold);

    border-radius:
        var(--radius-medium);

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.92),
            rgba(247, 241, 228, 0.92)
        );

    box-shadow:
        var(--shadow-soft);
}

.spell-search,
.spell-select-group {
    display: flex;
    flex-direction: column;

    gap: 6px;
}

.spell-controls label {
    color: var(--navy-900);

    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.05em;

    text-transform: uppercase;
}

.spell-controls input,
.spell-controls select {
    width: 100%;
    height: 42px;

    padding: 0 13px;

    color: var(--text-main);

    border:
        1px solid rgba(173, 125, 49, 0.36);

    border-radius: 10px;

    background:
        rgba(255, 253, 248, 0.96);

    font-family:
        "Lato",
        Arial,
        sans-serif;

    font-size: 0.79rem;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.spell-controls input:focus,
.spell-controls select:focus {
    border-color: var(--gold-500);

    box-shadow:
        0 0 0 3px
        rgba(201, 155, 70, 0.12);
}


/* =========================================================
   AFINIDADES
   ========================================================= */

.affinity-filters {
    display: flex;
    flex-wrap: wrap;

    gap: 9px;

    margin: 18px 0 22px;
}

.affinity-filter {
    min-width: 92px;
    height: 38px;

    padding: 0 16px;

    color: var(--navy-800);

    border:
        1px solid rgba(173, 125, 49, 0.38);

    border-radius: 10px;

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.96),
            rgba(244, 237, 222, 0.96)
        );

    cursor: pointer;

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size: 0.76rem;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.affinity-filter:hover {
    transform: translateY(-2px);

    border-color: var(--gold-500);
}

.affinity-filter.active {
    color: #f6d995;

    border-color: var(--gold-500);

    background:
        linear-gradient(
            180deg,
            var(--navy-700),
            var(--navy-950)
        );
}

.affinity-white:not(.active) {
    box-shadow:
        inset 4px 0 0 #d3d0bd;
}

.affinity-blue:not(.active) {
    box-shadow:
        inset 4px 0 0 #3a8fd6;
}

.affinity-black:not(.active) {
    box-shadow:
        inset 4px 0 0 #2f2a3c;
}

.affinity-red:not(.active) {
    box-shadow:
        inset 4px 0 0 #c54738;
}

.affinity-green:not(.active) {
    box-shadow:
        inset 4px 0 0 #429358;
}


/* =========================================================
   LISTADO
   ========================================================= */

.spell-list {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 16px;
}


/* =========================================================
   TARJETA DE MAGIA
   ========================================================= */

.spell-result-card {
    --spell-affinity-color:
        var(--gold-500);

    position: relative;

    min-height: 155px;

    display: grid;

    grid-template-columns:
        86px
        minmax(0, 1fr)
        42px;

    align-items: center;

    gap: 16px;

    padding: 17px 18px;

    overflow: hidden;

    border:
        1px solid var(--border-gold);

    border-radius:
        var(--radius-medium);

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.97),
            rgba(247, 241, 228, 0.97)
        );

    box-shadow:
        var(--shadow-soft);

    cursor: pointer;

    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease,
        border-color 0.22s ease;
}

.spell-result-card::before {
    content: "";

    position: absolute;

    inset: 7px;

    pointer-events: none;

    border:
        1px solid rgba(201, 155, 70, 0.14);

    border-radius: 12px;
}

.spell-result-card::after {
    content: "";

    position: absolute;

    top: 0;
    left: 0;
    bottom: 0;

    width: 5px;

    background:
        var(--spell-affinity-color);
}

.spell-result-card:hover,
.spell-result-card:focus-visible {
    transform:
        translateY(-4px);

    border-color:
        var(--spell-affinity-color);

    box-shadow:
        0 14px 30px
        rgba(10, 29, 50, 0.16);

    outline: none;
}


/* Símbolo */

.spell-result-symbol {
    position: relative;
    z-index: 1;

    width: 78px;
    height: 78px;

    display: grid;
    place-items: center;

    border:
        1px solid var(--spell-affinity-color);

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(255, 255, 255, 0.94),
            rgba(228, 224, 210, 0.68)
        );

    box-shadow:
        inset 0 0 0 5px
        rgba(255, 255, 255, 0.43),
        0 7px 15px
        rgba(12, 29, 50, 0.12);
}

.spell-result-symbol span {
    color:
        var(--spell-affinity-color);

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size: 2.2rem;
}


/* Contenido */

.spell-result-body {
    position: relative;
    z-index: 1;

    min-width: 0;
}

.spell-result-affinity {
    display: inline-flex;

    color:
        var(--spell-affinity-color);

    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;

    text-transform: uppercase;
}

.spell-result-title {
    margin: 2px 0 0;

    color: var(--navy-900);

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size: 1.2rem;
    font-weight: 400;

    line-height: 1.25;
}

.spell-result-meta {
    display: flex;
    flex-wrap: wrap;

    gap: 7px;

    margin-top: 8px;
}

.spell-result-meta span {
    display: inline-flex;
    align-items: center;

    padding: 4px 8px;

    color: var(--navy-700);

    border:
        1px solid rgba(20, 55, 91, 0.12);

    border-radius: 999px;

    background:
        rgba(45, 91, 139, 0.07);

    font-size: 0.62rem;
    font-weight: 600;
}

.spell-result-effect {
    display: -webkit-box;

    margin-top: 9px;

    overflow: hidden;

    color: var(--text-soft);

    font-size: 0.7rem;

    line-height: 1.45;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    line-clamp: 2;
}

.spell-result-action {
    position: relative;
    z-index: 1;

    width: 40px;
    height: 40px;

    display: grid;
    place-items: center;

    color: var(--gold-300);

    border:
        1px solid var(--gold-600);

    border-radius: 10px;

    background:
        linear-gradient(
            180deg,
            var(--navy-700),
            var(--navy-950)
        );
}


/* =========================================================
   COLORES
   ========================================================= */

.spell-affinity-white {
    --spell-affinity-color: #aaa58c;
}

.spell-affinity-blue {
    --spell-affinity-color: #348bd2;
}

.spell-affinity-black {
    --spell-affinity-color: #302c3d;
}

.spell-affinity-red {
    --spell-affinity-color: #c34538;
}

.spell-affinity-green {
    --spell-affinity-color: #3c9152;
}

.spell-affinity-neutral {
    --spell-affinity-color: #b4883e;
}


/* =========================================================
   SIN RESULTADOS
   ========================================================= */

.spell-empty {
    padding: 54px 20px;

    text-align: center;
}

.spell-empty img {
    width: 155px;
    height: 135px;

    object-fit: contain;

    opacity: 0.68;
}

.spell-empty h3 {
    color: var(--navy-900);

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-weight: 400;
}

.spell-empty p {
    color: var(--text-soft);
}


/* =========================================================
   MODAL DE FICHA
   ========================================================= */

.spell-modal {
    position: fixed;

    inset: 0;

    z-index: 10000;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 28px;
}

.spell-modal.open {
    display: flex;
}

.spell-modal-backdrop {
    position: absolute;

    inset: 0;

    background:
        rgba(3, 13, 25, 0.77);

    backdrop-filter:
        blur(4px);
}

.spell-modal-card {
    position: relative;
    z-index: 1;

    width:
        min(920px, 96vw);

    max-height: 90vh;

    overflow-y: auto;

    padding:
        42px 46px;

    border:
        1px solid
        rgba(173, 125, 49, 0.56);

    border-radius: 18px;

    background:
        linear-gradient(
            rgba(255, 251, 240, 0.92),
            rgba(242, 233, 211, 0.95)
        ),
        url("/assets/textures/paper_texture.png")
        center / cover no-repeat;

    box-shadow:
        0 28px 70px
        rgba(0, 0, 0, 0.46);
}

.spell-modal-card::before {
    content: "";

    position: absolute;

    inset: 12px;

    pointer-events: none;

    border:
        1px solid
        rgba(140, 100, 39, 0.27);

    border-radius: 12px;
}

.spell-modal-close {
    position: absolute;

    z-index: 4;

    top: 15px;
    right: 17px;

    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    color: var(--gold-300);

    border:
        1px solid var(--gold-600);

    border-radius: 50%;

    background:
        var(--navy-900);

    cursor: pointer;

    font-size: 1.35rem;
}


/* =========================================================
   FICHA
   ========================================================= */

.spell-sheet {
    --spell-affinity-color:
        var(--gold-500);

    position: relative;

    z-index: 2;
}

.spell-sheet-header {
    display: grid;

    grid-template-columns:
        130px
        minmax(0, 1fr);

    align-items: center;

    gap: 22px;

    padding-bottom: 20px;

    border-bottom:
        1px solid
        rgba(140, 100, 39, 0.28);
}

.spell-sheet-symbol {
    width: 122px;
    height: 122px;

    display: grid;
    place-items: center;

    border:
        2px solid
        var(--spell-affinity-color);

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(255, 255, 255, 0.92),
            rgba(219, 211, 191, 0.68)
        );

    box-shadow:
        inset 0 0 0 7px
        rgba(255, 255, 255, 0.38),
        0 9px 20px
        rgba(14, 31, 52, 0.14);
}

.spell-sheet-symbol span {
    color:
        var(--spell-affinity-color);

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size: 3.2rem;
}

.spell-sheet-affinity {
    color:
        var(--spell-affinity-color);

    font-size: 0.74rem;
    font-weight: 700;

    letter-spacing: 0.11em;

    text-transform: uppercase;
}

.spell-sheet-title {
    margin: 3px 0 0;

    color: var(--navy-900);

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size:
        clamp(1.8rem, 4vw, 2.75rem);

    font-weight: 400;

    line-height: 1.08;
}

.spell-sheet-rarity {
    display: inline-flex;

    margin-top: 12px;

    padding: 5px 12px;

    color: var(--navy-800);

    border:
        1px solid
        rgba(173, 125, 49, 0.30);

    border-radius: 999px;

    background:
        rgba(255, 255, 255, 0.38);

    font-size: 0.68rem;
    font-weight: 700;
}


/* Campos */

.spell-sheet-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 13px;

    margin-top: 22px;
}

.spell-sheet-field {
    padding: 12px 14px;

    border:
        1px solid
        rgba(140, 100, 39, 0.20);

    border-radius: 10px;

    background:
        rgba(255, 255, 255, 0.28);
}

.spell-sheet-field strong {
    display: block;

    color: var(--gold-700);

    font-size: 0.61rem;
    font-weight: 700;

    letter-spacing: 0.07em;

    text-transform: uppercase;
}

.spell-sheet-field span {
    display: block;

    margin-top: 3px;

    color: var(--text-main);

    font-size: 0.78rem;

    line-height: 1.45;
}


/* Efecto */

.spell-sheet-section {
    margin-top: 22px;

    padding: 17px 18px;

    border-left:
        4px solid
        var(--spell-affinity-color);

    background:
        rgba(255, 255, 255, 0.25);
}

.spell-sheet-section h3 {
    margin: 0;

    color: var(--navy-900);

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size: 1rem;
    font-weight: 400;

    letter-spacing: 0.04em;

    text-transform: uppercase;
}

.spell-sheet-section p {
    margin-top: 7px;

    color: #453e33;

    font-size: 0.81rem;

    line-height: 1.75;
}


/* =========================================================
   DOCUMENTO DEL GRIMORIO
   ========================================================= */

.spell-scroll-access {
    margin-top: 16px;

    padding: 18px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;

    border:
        1px solid
        rgba(140, 100, 39, 0.22);

    border-radius: 12px;

    background:
        rgba(255, 255, 255, 0.28);
}

.spell-scroll-info {
    display: flex;
    flex-direction: column;

    gap: 3px;
}

.spell-scroll-label {
    color: var(--gold-700);

    font-size: 0.62rem;
    font-weight: 700;

    letter-spacing: 0.07em;

    text-transform: uppercase;
}

.spell-scroll-info strong {
    color: var(--navy-900);

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size: 0.84rem;
    font-weight: 400;
}


/* =========================================================
   APRENDER MAGIA
   ========================================================= */

.spell-learn-access {
    margin-top: 14px;

    padding: 18px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;

    border:
        1px solid
        rgba(140, 100, 39, 0.22);

    border-radius: 12px;

    background:
        rgba(255, 255, 255, 0.28);
}

.spell-learn-info {
    display: flex;
    flex-direction: column;

    gap: 4px;
}

.spell-learn-label {
    color: var(--gold-700);

    font-size: 0.62rem;
    font-weight: 700;

    letter-spacing: 0.07em;

    text-transform: uppercase;
}

.spell-learn-info strong {
    color: var(--navy-900);

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size: 0.84rem;

    font-weight: 400;
}


/* Botones comunes */

.spell-scroll-button,
.spell-learn-button {
    min-width: 205px;

    padding: 11px 20px;

    color: #f6d995;

    border:
        1px solid var(--gold-600);

    border-radius: 10px;

    background:
        linear-gradient(
            180deg,
            var(--navy-700),
            var(--navy-950)
        );

    cursor: pointer;

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size: 0.76rem;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.spell-scroll-button:hover,
.spell-learn-button:hover {
    transform:
        translateY(-2px);

    box-shadow:
        0 8px 18px
        rgba(6, 24, 45, 0.22);
}


/* =========================================================
   PIE DE LA FICHA
   ========================================================= */

.spell-sheet-footer {
    display: flex;

    align-items: center;
    justify-content: flex-end;

    gap: 12px;

    margin-top: 27px;
    padding-top: 17px;

    border-top:
        1px solid
        rgba(140, 100, 39, 0.24);
}

.spell-sheet-guild-seal {
    width: 72px;
    height: 72px;

    object-fit: contain;
}

.spell-sheet-footer p {
    max-width: 230px;

    color: var(--text-soft);

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size: 0.72rem;

    line-height: 1.45;

    text-align: right;
}


/* =========================================================
   VISOR DE PERGAMINO
   ========================================================= */

.scroll-viewer {
    position: fixed;

    inset: 0;

    z-index: 20000;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 24px;
}

.scroll-viewer.open {
    display: flex;
}

.scroll-viewer-backdrop {
    position: absolute;

    inset: 0;

    background:
        rgba(2, 10, 20, 0.92);

    backdrop-filter:
        blur(5px);
}

.scroll-viewer-window {
    position: relative;

    z-index: 1;

    width:
        min(1200px, 96vw);

    height:
        94vh;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    border:
        1px solid
        rgba(201, 155, 70, 0.58);

    border-radius: 16px;

    background:
        #16191d;

    box-shadow:
        0 30px 90px
        rgba(0, 0, 0, 0.62);
}

.scroll-viewer-toolbar {
    height: 54px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 10px;

    flex-shrink: 0;

    padding: 8px 62px 8px 18px;

    border-bottom:
        1px solid
        rgba(201, 155, 70, 0.25);

    background:
        #091c34;
}

.scroll-viewer-toolbar button {
    min-width: 38px;
    height: 34px;

    padding: 0 12px;

    color: #f6d995;

    border:
        1px solid
        rgba(201, 155, 70, 0.52);

    border-radius: 7px;

    background:
        #102f54;

    cursor: pointer;

    font-family:
        "Marcellus",
        Georgia,
        serif;
}

.scroll-viewer-toolbar span {
    min-width: 52px;

    color: #f6d995;

    text-align: center;

    font-size: 0.72rem;
}

.scroll-viewer-content {
    width: 100%;
    height: 100%;

    overflow: auto;

    display: block;

    padding: 26px;

    text-align: center;
}

.scroll-viewer-image {
    display: inline-block;

    width: auto;
    max-width: none;

    height: auto;

    vertical-align: top;

    transform-origin:
        top center;

    transition:
        width 0.15s ease;
}

.scroll-viewer-close {
    position: absolute;

    z-index: 5;

    top: 9px;
    right: 14px;

    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    color: #f6d995;

    border:
        1px solid var(--gold-600);

    border-radius: 50%;

    background:
        var(--navy-950);

    cursor: pointer;

    font-size: 1.4rem;
}

.scroll-viewer-error {
    max-width: 500px;

    margin:
        100px auto;

    padding: 30px;

    color: #f5e9cf;

    text-align: center;
}

.scroll-viewer-error h3 {
    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size: 1.35rem;
}


/* =========================================================
   FOOTER
   ========================================================= */

.spellbook-footer {
    grid-template-columns:
        auto 1fr;
}

.spell-footer-link {
    color: var(--gold-300);

    font-family:
        "Marcellus",
        Georgia,
        serif;

    font-size: 0.76rem;

    text-decoration: none;
}

.spell-footer-link:hover {
    color: white;
}

.spellbook-footer p {
    text-align: center;

    font-size: 0.68rem;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 980px) {

    .spell-controls {
        grid-template-columns:
            1fr 1fr;
    }

    .spell-search {
        grid-column:
            1 / -1;
    }

    .spell-list {
        grid-template-columns:
            1fr;
    }

}


/* =========================================================
   MÓVIL
   ========================================================= */

@media (max-width: 720px) {

    .spellbook-content {
        padding: 18px;
    }

    .spellbook-heading {
        align-items: flex-start;

        flex-direction: column;
    }

    .spell-count {
        width: 100%;
    }

    .spell-controls {
        grid-template-columns:
            1fr;
    }

    .spell-search {
        grid-column: auto;
    }

    .affinity-filter {
        flex:
            1 1 90px;
    }

    .spell-result-card {
        grid-template-columns:
            70px
            minmax(0, 1fr);
    }

    .spell-result-symbol {
        width: 65px;
        height: 65px;
    }

    .spell-result-symbol span {
        font-size: 1.7rem;
    }

    .spell-result-action {
        display: none;
    }

    .spell-modal {
        padding: 10px;
    }

    .spell-modal-card {
        padding:
            36px 22px;
    }

    .spell-sheet-header {
        grid-template-columns:
            1fr;

        text-align: center;
    }

    .spell-sheet-symbol {
        margin:
            0 auto;
    }

    .spell-sheet-grid {
        grid-template-columns:
            1fr;
    }

    .spell-scroll-access,
    .spell-learn-access {
        flex-direction: column;
        align-items: stretch;
    }

    .spell-scroll-button,
    .spell-learn-button {
        width: 100%;
    }

    .spell-sheet-footer {
        justify-content: center;
    }

    .scroll-viewer {
        padding: 7px;
    }

    .scroll-viewer-window {
        width: 100%;
        height: 97vh;
    }

    .scroll-viewer-content {
        padding: 10px;
    }

}