/* "The new cards at a glance" block at the top of each Magnificent Maestros tab, and the
   "On this tab" jump row under it. Shared by every page that has one; maestros-glance.js adds the
   card art, the profile links and the jump row. Colours come from the text around the block
   (currentColor), so it sits on dark and light pages alike; a page can set --mg-accent. */

.mg-glance {
    margin: 0 auto 2.5rem;
    padding: 1.1rem 1.1rem 1.2rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
    border-radius: 1rem;
    background: rgba(148, 163, 184, 0.06);
    background: color-mix(in srgb, currentColor 4%, transparent);
    text-align: left;
}
.mg-glance-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    margin: 0 0 0.85rem;
}
.mg-glance-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.3;
}
.mg-glance-count {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.75;
}

/* One tile per card: art on the left, name / type / one line on the right. */
.mg-glance-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    gap: 0.65rem;
    margin: 0;
    padding: 0;
}
.mg-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "name" "kind" "line";
    grid-template-rows: auto auto 1fr;
    column-gap: 0.8rem;
    align-items: start;
    min-width: 0;
    padding: 0.7rem 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
    border-radius: 0.75rem;
    background: rgba(148, 163, 184, 0.05);
    background: color-mix(in srgb, currentColor 4%, transparent);
}
/* The script adds an art slot to each tile (it isn't in the page's HTML), and with it the column. */
.mg-item.mg-with-art {
    grid-template-columns: 3.1rem minmax(0, 1fr);
    grid-template-areas: "art name" "art kind" "art line";
}
.mg-art {
    grid-area: art;
    display: block;
    width: 3.1rem;
    aspect-ratio: 59 / 86;
    overflow: hidden;
    border-radius: 0.3rem;
    background: rgba(148, 163, 184, 0.15);
    background: color-mix(in srgb, currentColor 10%, transparent);
}
.mg-art img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.mg-item dt {
    grid-area: name;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
}
.mg-item dt a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}
.mg-item dt a:hover {
    text-decoration-color: currentColor;
}
.mg-item dt a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 0.2rem;
}
.mg-item dd {
    margin: 0;
}
.mg-kind {
    grid-area: kind;
    margin-top: 0.15rem !important;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.72;
}
.mg-line {
    grid-area: line;
    margin-top: 0.35rem !important;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* A tab with one new card: a single wide "In short" tile. */
.mg-glance--single .mg-glance-list {
    grid-template-columns: 1fr;
}
.mg-glance--single .mg-item.mg-with-art {
    grid-template-columns: 3.6rem minmax(0, 1fr);
}
.mg-glance--single .mg-art {
    width: 3.6rem;
}
.mg-glance--single .mg-line {
    font-size: 0.95rem;
}

/* "On this tab" jump row, built from the tab's own section headings. */
.mg-toc {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin: 1rem 0 0;
    padding: 0.85rem 0 0;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);
    font-size: 0.8rem;
}
.mg-toc-label {
    margin-right: 0.2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.75;
}
.mg-toc a {
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
    border-radius: 999px;
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}
.mg-toc a:hover {
    border-color: var(--mg-accent, currentColor);
    background: color-mix(in srgb, currentColor 8%, transparent);
}
.mg-toc a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Jump targets land below the pinned tab bar instead of under it. */
[data-mg-target] {
    scroll-margin-top: 5rem;
}

@media (max-width: 639px) {
    .mg-glance {
        padding: 0.9rem 0.85rem 1rem;
        border-radius: 0.85rem;
    }
    .mg-toc-label {
        flex-basis: 100%;
    }
}

/* "Verdict" at the end of a Maestros tab: a headline, a short paragraph, then one row per new card
   with its tier and the tab's recommended copies. The tier is in the text; the coloured edge only
   repeats it. The section and its h2 use the page's own classes. */
.mg-verdict {
    max-width: 48rem;
    margin: 0 auto;
    text-align: left;
}
.mg-verdict-headline {
    margin: 0 0 0.6rem;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.4;
}
.mg-verdict-body {
    margin: 0 0 1rem;
    line-height: 1.7;
}
.mg-verdict-cards {
    display: grid;
    gap: 0.5rem;
    margin: 0;
}
.mg-vc {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name tier" "why why";
    gap: 0.2rem 0.75rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
    border-left: 4px solid var(--mg-vc, currentColor);
    border-radius: 0.6rem;
    background: rgba(148, 163, 184, 0.05);
    background: color-mix(in srgb, currentColor 4%, transparent);
}
.mg-vc[data-tier="must"] { --mg-vc: #22c55e; }
.mg-vc[data-tier="strong"] { --mg-vc: #3b82f6; }
.mg-vc[data-tier="situational"] { --mg-vc: #f59e0b; }
.mg-vc dt {
    grid-area: name;
    margin: 0;
    font-weight: 700;
    line-height: 1.35;
}
.mg-vc dd {
    margin: 0;
}
.mg-vc-tier {
    grid-area: tier;
    align-self: start;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}
.mg-vc-why {
    grid-area: why;
    font-size: 0.9rem;
    line-height: 1.55;
    opacity: 0.9;
}
.mg-verdict-note {
    margin: 0.85rem 0 0;
    font-size: 0.8rem;
    opacity: 0.75;
}
@media (max-width: 420px) {
    .mg-vc {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "name" "tier" "why";
    }
}

/* Comparison tables in these tabs (<table data-mg-stack>) stack on phones instead of scrolling
   sideways: one block per row, its first cell as the title, every other cell under a small label
   taken from its column header (maestros-glance.js copies the header into data-label). */
@media (max-width: 639px) {
    div:has(> table[data-mg-stack]) {
        overflow: visible;
    }
    table[data-mg-stack][data-mg-stack] {
        display: block;
        width: 100%;
        min-width: 0;
    }
    table[data-mg-stack][data-mg-stack] > thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
    table[data-mg-stack][data-mg-stack] > tbody {
        display: block;
    }
    table[data-mg-stack][data-mg-stack] > tbody > tr {
        display: block;
        padding: 0.8rem 0.9rem;
        border: 0;
        border-bottom: 1px solid rgba(148, 163, 184, 0.24);
        border-bottom: 1px solid color-mix(in srgb, currentColor 14%, transparent);
    }
    table[data-mg-stack][data-mg-stack] > tbody > tr:last-child {
        border-bottom: 0;
    }
    table[data-mg-stack][data-mg-stack] > tbody > tr > * {
        display: block;
        width: auto;
        min-width: 0;
        padding: 0;
        border: 0;
        text-align: left;
        white-space: normal;
    }
    table[data-mg-stack][data-mg-stack] > tbody > tr > :first-child {
        font-weight: 700;
    }
    table[data-mg-stack][data-mg-stack] > tbody > tr > :not(:first-child) {
        margin-top: 0.45rem;
    }
    /* Middle cells sit side by side, so short values ("Rank 10", "ATK 4000") share a line; long ones
       still wrap to the full width. The last cell, usually the explanation, gets its own line. */
    table[data-mg-stack][data-mg-stack] > tbody > tr > :not(:first-child):not(:last-child) {
        display: inline-block;
        max-width: 100%;
        margin-right: 1.25rem;
        vertical-align: top;
    }
    table[data-mg-stack][data-mg-stack] > tbody > tr > [data-label]:not(:first-child)::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.1rem;
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        opacity: 0.7;
    }
}

@media print {
    .mg-toc { display: none; }
}
