/* ═══════════════════════════════════════════════════════════════
   SITE HEADER (header.php): banner + main menu, used by every page.
   Self-contained (mh-*, px sizes, explicit resets) so it renders the same
   on the old Bootstrap pages (myheroui.css) and the new cd-* pages.
     >= 1024px   one row of links + dropdown menus
     <  1024px   a "Menu" bar that opens a panel of tiles + accordions
   ═══════════════════════════════════════════════════════════════ */

.mh-hdr {
    --mh-bg: #171a22;
    --mh-bg2: #1f2330;
    --mh-line: rgba(255, 255, 255, 0.1);
    --mh-text: #e9edf6;
    --mh-dim: #a3adc2;
    --mh-gold: #ffd553;
    --mh-green: #57dd5c;
    position: relative;
    z-index: 1030;
    margin: 0 0 4px;
    color: var(--mh-text);
    font-family: F0T, 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.25;
    text-align: left;
}
.mh-hdr.mh-jp { font-family: F0T, 'Outfit', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo', 'Noto Sans JP', sans-serif; }
.mh-hdr *, .mh-hdr *::before, .mh-hdr *::after { box-sizing: border-box; }
.mh-hdr ul { margin: 0; padding: 0; list-style: none; }
.mh-hdr p { margin: 0; }
.mh-hdr a { color: var(--mh-text); text-decoration: none !important; }
.mh-hdr a:hover { color: #fff; }
.mh-hdr a:focus-visible, .mh-hdr summary:focus-visible, .mh-hdr button:focus-visible {
    outline: 2px solid var(--mh-gold);
    outline-offset: 2px;
}
.mh-ic { display: block; flex: none; width: 16px; height: 16px; object-fit: contain; }

/* ── Banner (unchanged look: full width, 150px, cropped to the centre) ── */
.mh-banner { display: block; line-height: 0; }
.mh-banner img { display: block; width: 100%; height: 150px; object-fit: cover; }

/* ── Bar ───────────────────────────────────────────────────────── */
.mh-nav {
    position: relative;
    background: linear-gradient(180deg, var(--mh-bg2) 0%, var(--mh-bg) 100%);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
}
.mh-nav::after {   /* the site's green / gold / red accent line */
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, #57dd5c, #ffd553 50%, #e8413c);
    opacity: 0.8;
    pointer-events: none;
}
.mh-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 1920px;
    min-height: 54px;
    margin: 0 auto;
    padding: 8px 12px 10px;
}

/* ── Phone / tablet: Menu button, current section, language ─────── */
.mh-burger {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 0 14px 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--mh-text);
    font: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.mh-burger:hover, .mh-nav.is-open .mh-burger { border-color: rgba(255, 213, 83, 0.55); background: rgba(255, 255, 255, 0.09); }
.mh-burger-ic { position: relative; display: block; width: 18px; height: 14px; }
.mh-burger-ic span {
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.2s, opacity 0.2s, top 0.2s;
}
.mh-burger-ic span:nth-child(1) { top: 0; }
.mh-burger-ic span:nth-child(2) { top: 6px; }
.mh-burger-ic span:nth-child(3) { top: 12px; }
.mh-nav.is-open .mh-burger-ic span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.mh-nav.is-open .mh-burger-ic span:nth-child(2) { opacity: 0; }
.mh-nav.is-open .mh-burger-ic span:nth-child(3) { top: 6px; transform: rotate(-45deg); }
.mh-here {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--mh-gold);
    font-size: 16px;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.mh-quick {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--mh-dim) !important;
    font-size: 13px;
}
.mh-quick:hover { background: rgba(255, 255, 255, 0.11); color: #fff !important; }

/* The panel: a drop-down sheet over the page (JS) / plain block (no JS). */
.mh-menu { display: none; }
.mh-hdr:not(.mh-js) .mh-burger { display: none; }
.mh-hdr:not(.mh-js) .mh-bar { flex-wrap: wrap; }
.mh-hdr:not(.mh-js) .mh-menu { display: block; flex-basis: 100%; }
.mh-nav.is-open .mh-menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: block;
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px 12px 16px;
    border-bottom: 1px solid var(--mh-line);
    background: #151820;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.55);
}
.mh-main { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 480px) { .mh-main { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 700px) { .mh-main { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.mh-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--mh-text) !important;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mh-link:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.16); color: #fff !important; }
.mh-link.is-here { border-color: rgba(87, 221, 92, 0.55); background: rgba(87, 221, 92, 0.13); color: #fff !important; }
.mh-lbl { min-width: 0; overflow-wrap: anywhere; }
.mh-main .mh-link { white-space: normal; }   /* panel tiles: a long label wraps instead of being cut */

/* Menus become accordions in the panel. */
.mh-hdr .mh-extra { display: grid; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--mh-line); }
.mh-dd summary { list-style: none; }
.mh-dd summary::-webkit-details-marker { display: none; }
.mh-dd summary .mh-lbl { flex: 1; }
.mh-caret { width: 14px; height: 14px; flex: none; margin-left: auto; opacity: 0.75; transition: transform 0.2s; }
.mh-dd details[open] > summary .mh-caret { transform: rotate(180deg); }
.mh-dd details[open] > summary { border-color: rgba(255, 213, 83, 0.4); }
.mh-pop { padding: 8px 4px 4px 10px; }
.mh-pop ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 8px; }
.mh-pop a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--mh-text) !important;
    font-size: 14px;
}
.mh-pop a:hover { background: rgba(255, 255, 255, 0.08); }
.mh-pop a.is-here { color: var(--mh-gold) !important; }
.mh-pop a.is-here::after { content: "✓"; margin-left: auto; }
.mh-pop-h {
    margin: 10px 0 2px !important;
    padding: 0 10px;
    color: var(--mh-dim);
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.mh-pop-h:first-child { margin-top: 2px !important; }

/* ── Desktop: one row (>= 1180px; keep in sync with the matchMedia in header.php) ── */
.mh-q-short { display: none; }
@media (min-width: 1180px) {
    .mh-burger, .mh-here { display: none; }
    .mh-bar { justify-content: center; gap: 8px; min-height: 0; padding: 6px 16px 8px; }
    .mh-menu,
    .mh-hdr:not(.mh-js) .mh-menu {
        position: static;
        display: flex;
        flex-basis: auto;
        align-items: center;
        justify-content: center;
        gap: 6px;
        max-height: none;
        overflow: visible;
        padding: 0;
        border: 0;
        background: none;
        box-shadow: none;
    }
    .mh-hdr:not(.mh-js) .mh-bar { flex-wrap: nowrap; }
    .mh-quick { order: 3; min-height: 32px; margin-left: 2px; }
    .mh-main { display: flex; gap: 2px; }
    .mh-main .mh-link { white-space: nowrap; }
    .mh-link {
        gap: 7px;
        min-height: 38px;
        padding: 7px 10px;
        border-color: transparent;
        background: none;
    }
    .mh-link:hover { border-color: transparent; }
    .mh-link.is-here { border-color: transparent; background: rgba(255, 255, 255, 0.06); }
    .mh-link.is-here::after {   /* gold underline for the current section */
        content: "";
        position: absolute;
        right: 10px;
        bottom: 2px;
        left: 10px;
        height: 2px;
        border-radius: 2px;
        background: var(--mh-gold);
    }
    .mh-main .mh-ic { display: none; }          /* the link icons come back from 1720px */
    .mh-hdr .mh-extra { display: flex; gap: 2px; margin: 0; padding: 0 0 0 8px; border-top: 0; border-left: 1px solid var(--mh-line); }
    .mh-dd { position: relative; }
    .mh-dd details[open] > summary { border-color: transparent; background: rgba(255, 255, 255, 0.09); }
    .mh-caret { width: 12px; height: 12px; margin-left: 0; }
    .mh-pop {
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        min-width: 240px;
        max-height: calc(100vh - 140px);
        overflow-y: auto;
        padding: 6px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 12px;
        background: #1b1f29;
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
    }
    .mh-pop ul { display: block; }
    .mh-pop a { min-height: 36px; white-space: nowrap; }
    .mh-dd-tierlist .mh-pop { right: auto; left: 0; }
}
/* 1180-1519px: the menus show their icon only (name in the tooltip) and the switch says EN / JP. */
@media (min-width: 1180px) and (max-width: 1519.98px) {
    .mh-extra .mh-lbl {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
    .mh-extra .mh-link { gap: 4px; padding: 7px 8px; }
    .mh-extra .mh-ic { width: 18px; height: 18px; }
    .mh-q-full { display: none; }
    .mh-q-short { display: inline; }
    .mh-main .mh-link { padding: 7px 9px; }
    .mh-main .mh-link.is-here::after { right: 9px; left: 9px; }
}
@media (min-width: 1720px) {
    .mh-main .mh-ic { display: block; }
}

@media (prefers-reduced-motion: reduce) {
    .mh-hdr * { transition: none !important; }
}
