/* Magic — 63 × 88 mm (630 × 880 px). */

.tpl-magic {
    --mtg-border: #0e0e0e;
    --mtg-info: #f2f2f2;
    --mtg-frame-1: #e98060;
    --mtg-frame-2: #a4331b;
    --mtg-bar-1: #f8e4d9;
    --mtg-bar-2: #d8a58f;
    --mtg-box: #f5e3d9;
    background: var(--mtg-border);
    font-family: 'Crimson Pro', Georgia, serif;
    color: #121212;
}

.mtg-border-white { --mtg-border: #f3f1ec; --mtg-info: #1a1a1a; }

.mtg-frame-W { --mtg-frame-1: #f1ebd8; --mtg-frame-2: #c7ba98; --mtg-bar-1: #fcfaf0; --mtg-bar-2: #ddd3b6; --mtg-box: #f8f4e6; }
.mtg-frame-U { --mtg-frame-1: #6f9fd0; --mtg-frame-2: #2a5487; --mtg-bar-1: #e3edf5; --mtg-bar-2: #a9c1d6; --mtg-box: #e3ebf2; }
.mtg-frame-B { --mtg-frame-1: #5b5450; --mtg-frame-2: #1d1a18; --mtg-bar-1: #ddd6d0; --mtg-bar-2: #a89c93; --mtg-box: #ddd6d0; }
.mtg-frame-R { --mtg-frame-1: #e98060; --mtg-frame-2: #a4331b; --mtg-bar-1: #f8e4d9; --mtg-bar-2: #d8a58f; --mtg-box: #f5e3d9; }
.mtg-frame-G { --mtg-frame-1: #6fae6b; --mtg-frame-2: #2c5e30; --mtg-bar-1: #e3ecdb; --mtg-bar-2: #aac39d; --mtg-box: #e1eada; }
.mtg-frame-M { --mtg-frame-1: #f0d78a; --mtg-frame-2: #b08b2f; --mtg-bar-1: #fbf2d4; --mtg-bar-2: #dcc58c; --mtg-box: #f7eed2; }
.mtg-frame-A { --mtg-frame-1: #c9c4bd; --mtg-frame-2: #7c766f; --mtg-bar-1: #efeeeb; --mtg-bar-2: #c6c1ba; --mtg-box: #ebe8e3; }
.mtg-frame-L { --mtg-frame-1: #b39f86; --mtg-frame-2: #6b563f; --mtg-bar-1: #f1eadf; --mtg-bar-2: #c9b8a2; --mtg-box: #eee5d9; }
.mtg-frame-C { --mtg-frame-1: #e3e3e3; --mtg-frame-2: #9a9a9a; --mtg-bar-1: #f7f7f7; --mtg-bar-2: #cfcfcf; --mtg-box: #f0f0f0; }

.mtg-border {
    position: absolute;
    inset: 0;
    background: var(--mtg-border);
}

.mtg-frame {
    position: absolute;
    left: 24px;
    top: 24px;
    right: 24px;
    bottom: 50px;
    border-radius: 12px 12px 20px 20px;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 40%, rgba(0, 0, 0, 0.2)),
        linear-gradient(180deg, var(--mtg-frame-1), var(--mtg-frame-2));
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.45), inset 0 0 0 4px rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

.mtg-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../../Data/Background/Base_PerlinNoise_001.png') center / 320px auto;
    mix-blend-mode: soft-light;
    opacity: 0.75;
}

/* ---- Barre nome e tipo ---- */

.mtg-bar {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px 0 18px;
    border-radius: 12px / 30px;
    background: linear-gradient(180deg, var(--mtg-bar-1), var(--mtg-bar-2));
    box-shadow:
        0 0 0 2px rgba(0, 0, 0, 0.6),
        inset 0 2px 0 rgba(255, 255, 255, 0.75),
        inset 0 -3px 0 rgba(0, 0, 0, 0.18),
        0 4px 5px rgba(0, 0, 0, 0.35);
}

.mtg-titlebar { left: 38px; right: 38px; top: 38px; height: 58px; }
.mtg-typebar { left: 38px; right: 38px; top: 502px; height: 54px; }

.mtg-name,
.mtg-type {
    flex: 1 1 auto;
    min-width: 0;
    font-family: 'Philosopher', Georgia, serif;
    font-weight: 700;
    line-height: 1;
    color: #111;
}

.mtg-name { font-size: 37px; }
.mtg-type { font-size: 31px; }

.mtg-cost {
    flex: none;
    display: flex;
    gap: 3px;
    font-size: 33px;
}

.mtg-cost .sym { vertical-align: 0; }

.mtg-set {
    --rarity: #1c1c1c;
    flex: none;
    display: inline-flex;
    font-size: 38px;
    color: var(--rarity);
}

.mtg-set path {
    stroke: #111;
    stroke-width: 7;
    stroke-linejoin: round;
    paint-order: stroke;
}

.mtg-set.is-common   { --rarity: #1c1c1c; }
.mtg-set.is-common path { stroke: #d9d9d9; }
.mtg-set.is-uncommon { --rarity: #c2ced6; }
.mtg-set.is-rare     { --rarity: #e1b64a; }
.mtg-set.is-mythic   { --rarity: #ec6a2c; }

/* ---- Illustrazione ---- */

.mtg-art-frame {
    position: absolute;
    left: 46px;
    top: 100px;
    width: 538px;
    height: 398px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.5), rgba(255, 255, 255, 0.25) 50%, rgba(0, 0, 0, 0.5));
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.7);
}

.mtg-art-frame::after {
    content: '';
    position: absolute;
    inset: 6px;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.55);
    pointer-events: none;
}

.mtg-art {
    left: 6px;
    top: 6px;
    width: 526px;
    height: 386px;
}

/* ---- Box testo ---- */

.mtg-textbox {
    position: absolute;
    left: 50px;
    right: 50px;
    top: 560px;
    height: 250px;
    padding: 12px 20px 16px;
    background:
        radial-gradient(120% 90% at 50% 40%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 70%),
        var(--mtg-box);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.55), inset 0 0 18px rgba(0, 0, 0, 0.12);
}

.mtg-textbox::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../../Data/Background/OldPaper_PerlinNoise_002.png') center / 260px auto;
    mix-blend-mode: multiply;
    opacity: 0.18;
    pointer-events: none;
}

.mtg-text {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: safe center;
    font-size: 29px;
    line-height: 1.17;
}

.mtg-rules p + p { margin-top: 0.3em; }
.mtg-rules .sym { font-size: 0.86em; margin: 0 0.03em; vertical-align: -0.1em; }
.mtg-rules .reminder { font-style: italic; }

.mtg-flavor {
    margin-top: 0.4em;
    font-style: italic;
}

/* Separatore sfumato: pseudo-elemento invece di border-image, che negli export viene riempito. */
.mtg-flavor::before {
    content: '';
    display: block;
    height: 1.5px;
    margin-bottom: 0.35em;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.45) 20%, rgba(0, 0, 0, 0.45) 80%, transparent);
}

/* ---- Forza / Costituzione ---- */

.mtg-pt {
    position: absolute;
    z-index: 3;
    right: 36px;
    top: 786px;
    width: 124px;
    height: 54px;
    display: grid;
    place-items: center;
    padding: 0 10px;
    border-radius: 10px / 24px;
    background: linear-gradient(180deg, var(--mtg-bar-1), var(--mtg-bar-2));
    box-shadow:
        0 0 0 2px rgba(0, 0, 0, 0.65),
        inset 0 2px 0 rgba(255, 255, 255, 0.75),
        inset 0 -3px 0 rgba(0, 0, 0, 0.18),
        0 3px 4px rgba(0, 0, 0, 0.35);
}

.mtg-pt > span {
    display: block;
    width: 100%;
    overflow: hidden;
    text-align: center;
    font-family: 'Philosopher', Georgia, serif;
    font-weight: 700;
    font-size: 38px;
    line-height: 1;
}

/* ---- Informazioni sul bordo ---- */

.mtg-info {
    position: absolute;
    left: 38px;
    right: 38px;
    top: 834px;
    height: 36px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    color: var(--mtg-info);
    font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
    font-weight: 500;
    font-size: 14.5px;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

.mtg-info-left {
    display: flex;
    flex-direction: column;
    white-space: nowrap;
}

.mtg-info-right {
    padding-top: 17px;
    text-align: right;
    white-space: nowrap;
}

.mtg-brush {
    display: inline-block;
    width: 13px;
    height: 13px;
    margin: 0 1px;
    vertical-align: -1px;
    fill: currentColor;
}
