/* ============================================================
   YOISHIGURE — INDEX PAGE
   ============================================================ */

/* Zero-height anchor headings used as scroll targets in the song list */
.yoi-nav-anchor-only {
    margin: 0;
    padding: 0;
    height: 0;
    line-height: 0;
    font-size: 0;
    overflow: hidden;
    visibility: hidden;
}

/* Index page link colour override: blue instead of the default red accent */
body.page-yoishigure .trans > :where(p, details, h3, h4, blockquote, ul, ol, table, center) a:not(.icon):not(.headerlink) {
    color: #007bbb;
    text-decoration: none;
    transition:
        color 0.2s ease-out,
        background-position 0.2s ease-out;
    background-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 50%,
        #007bbb 50%
    );
    background-repeat: no-repeat;
    background-size: 100% calc(200% + 2px);
    background-position: 0 0;
}

body.page-yoishigure .trans > :where(p, details, h3, h4, blockquote, ul, ol, table, center) a:not(.icon):not(.headerlink):hover,
body.page-yoishigure .trans > :where(p, details, h3, h4, blockquote, ul, ol, table, center) a:not(.icon):not(.headerlink):focus,
body.page-yoishigure .trans > :where(p, details, h3, h4, blockquote, ul, ol, table, center) a.yoi-page-search-hit-meta.is-active:not(.icon):not(.headerlink) {
    background-position: 0 100%;
    color: #E9E6E2;
}

body.page-yoishigure .trans > :where(p, details, h3, h4, blockquote, ul, ol, table, center) a.yoi-page-search-hit-meta:not(.is-active):not(:hover):not(:focus):not(.icon):not(.headerlink) {
    background-position: 0 0;
    text-decoration: underline #007bbb 2px;
}

body.page-yoishigure .yoi-float-nav a:not(.icon) { --link-hover-accent: #007bbb; }

/* Lyric subpages — blue link accent in tategaki content.
   --link-hover-accent must be on the <a> itself (not a container ancestor) because
   tcolor.ejs declares it directly on a:not(.icon), so ancestor inheritance loses
   the cascade. Higher specificity here overrides that declaration. */
body.page-yoishigure-sub .tategaki-content a:not(.icon):not(.headerlink):not(.color-link) {
    --link-hover-accent: #007bbb;
    color: #007bbb;
    text-decoration: none;
}

body.page-yoishigure-sub .tategaki-content a:not(.icon):not(.headerlink):not(.color-link):hover,
body.page-yoishigure-sub .tategaki-content a:not(.icon):not(.headerlink):not(.color-link):focus {
    color: #E9E6E2;
}

/* Search hit highlights on the index page */
body.page-yoishigure mark.yoi-page-search-hit {
    background: color-mix(in srgb, #007bbb 24%, #fff 76%);
    color: inherit;
    border-radius: 2px;
    padding: 0 0.08em;
}

body.page-yoishigure mark.yoi-page-search-hit.is-active {
    background: #007bbb;
    color: #e9e6e2;
}

html.darkmode body.page-yoishigure mark.yoi-page-search-hit {
    background: color-mix(in srgb, #007bbb 38%, #19191a 62%);
}

html.darkmode body.page-yoishigure mark.yoi-page-search-hit.is-active {
    background: #007bbb;
    color: #e9e6e2;
}


/* ============================================================
   YOISHIGURE — FLOAT NAV (desktop sidebar / mobile bottom sheet)
   ============================================================ */

/* Desktop: right-side collapsed rail expands leftward */
.yoi-float-nav {
    --yoi-nav-rail-width: 5.2rem;
    --yoi-nav-open-width: min(32rem, calc(100vw - 1.2rem));
    position: fixed;
    top: 6.7rem;
    right: 0;
    z-index: 24;
    width: var(--yoi-nav-rail-width);
    max-width: calc(100vw - 0.8rem);
    max-height: calc(100vh - 8.2rem);
    overflow: hidden;
    border-radius: 8px 0 0 8px;
    background: #EBE6E2DE;
    box-shadow: 0 6px 12px 8px rgba(0, 123, 187, 0.12);
    backdrop-filter: blur(8px) saturate(56%);
    line-height: 1.35;
    opacity: 1;
    display: grid;
    grid-template-columns: var(--yoi-nav-rail-width) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    transition:
        width 0.2s ease-in,
        max-height 0.2s ease-in,
        opacity 0.2s ease-in,
        box-shadow 0.2s ease-in;
}

@media (min-width: 551px) {
    .yoi-float-nav.yoi--booting {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: none !important;
    }
}

.yoi-float-nav.yoi--desktop-open {
    width: var(--yoi-nav-open-width);
    max-height: calc(100vh - 8.2rem);
}

@media (min-width: 551px) {
    .yoi-float-nav.yoi--desktop-collapsed,
    .yoi-float-nav:not(.yoi--desktop-open) {
        max-height: 10.5em;
        border-radius: 8px 0 0 8px;
        box-shadow: 2px 3px 4px 4px rgba(0, 123, 187, 0.16);
    }
}

.yoi-float-nav__bar {
    grid-column: 1;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 5rem;
    padding: 2rem 1rem 0 1rem;
}

.yoi-float-nav__title {
    margin: 0;
    opacity: 0.72;
}

.yoi-float-nav__mobile-toggle-title {
    display: none;
    margin: 0;
}

.yoi-float-nav__desktop-toggle {
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font: inherit;
    line-height: inherit;
    transition: color 0.2s ease-in;
}

.yoi-float-nav.yoi--desktop-open .yoi-float-nav__desktop-toggle {
    color: #007bbb;
}

.yoi-float-nav__search {
    grid-column: 2;
    grid-row: 1;
    margin: 1.2rem 1.25rem 0.82rem 1rem;
    opacity: 0;
    visibility: hidden;
    transform: translateX(0.8rem);
    pointer-events: none;
    transition:
        opacity 0.2s ease-in,
        transform 0.2s ease-in;
}

.yoi-float-nav__search-input {
    width: 100%;
    margin: 0;
    height: 3.3rem;
    padding: 0.33rem 0.87rem;
    font-family: "iA Writer Quattro V", "HYQiHei-50S", FZYouHei_GBK, "IBM Plex Sans SC", "Source Han Sans TC", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.56rem;
    line-height: 1.25;
    border-radius: 4px;
    border: 0;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.yoi-float-nav__search-input:focus {
    border-color: #007bbb;
}

.yoi-float-nav__search-meta {
    margin-top: 0.42rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.yoi-float-nav__search-count {
    margin-right: auto;
    font-family: "Berkeley Mono", "HYQiHei-50S", FZYouHei_GBK, "IBM Plex Sans SC", "Source Han Sans TC", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.3rem;
    opacity: 0.87;
}

.yoi-float-nav__search-btn {
    margin: 0;
    min-width: 2.6rem;
    height: 2.5rem;
    padding: 0 0.45rem;
    border: 0;
    border-radius: 4px;
    background: transparent;
    line-height: 1;
    font-size: 1.35rem;
    cursor: pointer;
}

.yoi-float-nav__search-btn:disabled {
    cursor: default;
    opacity: 0.33;
}

.yoi-float-nav__theme {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.25;
    font-size: 2.33rem;
}

.yoi-float-nav__theme-btn {
    cursor: pointer;
    user-select: none;
    display: inline-block;
    height: auto;
    margin: 0;
    padding: 0;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    letter-spacing: normal;
    text-transform: none;
    border: 0;
    background: transparent;
    color: inherit;
    line-height: 1;
}

.yoi-float-nav__theme-btn.hidden {
    display: none;
}

.yoi-float-nav__list {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
    min-height: 0;
    padding: 0 1.25rem 1.2rem 1rem;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateX(0.8rem);
    pointer-events: none;
    transition:
        opacity 0.2s ease-in,
        transform 0.2s ease-in;
}

.yoi-float-nav.yoi--desktop-open .yoi-float-nav__search,
.yoi-float-nav.yoi--desktop-open .yoi-float-nav__list {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

.yoi-float-nav__h {
    margin: 0;
    color: rgba(17, 17, 17, 0.56);
}

.yoi-float-nav__h.is-active {
    color: rgba(0, 123, 187, 0.96);
}

.yoi-float-nav__h + .yoi-float-nav__h3 {
    margin-top: 0.7rem;
}

.yoi-float-nav__h4 {
    margin-left: 0.65rem;
    margin-top: 0.22rem;
}

.yoi-float-nav__h a {
    display: inline-block;
    white-space: nowrap;
    padding: 0.25rem 0.25rem;
    border-radius: 2px;
    color: inherit;
    text-decoration: none;
    font-weight: bolder;
    transition:
        color 0.2s ease-in,
        background-position 0.2s ease-in;
    background-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 50%,
        var(--link-hover-accent, #e2001a) 50%
    );
    background-repeat: no-repeat;
    background-size: 100% calc(200% + 2px);
    background-position: 0 0;
}

.yoi-float-nav__h a:hover,
.yoi-float-nav__h a:focus {
    background-position: 0 100%;
    color: #E9E6E2;
}

.yoi-float-nav__empty {
    margin: 0.2rem 0 0;
}

/* Toggle buttons: hidden on desktop, shown in mobile bottom sheet */
.yoi-float-nav__list-toggle,
.yoi-float-nav__search-toggle {
    display: none;
}

/* Dark mode overrides for float nav */
html.darkmode .yoi-float-nav {
    background: #19191ADE;
    box-shadow: 0 6px 12px 8px rgba(0, 123, 187, 0.12);
    backdrop-filter: blur(8px) saturate(67%);
}

html.darkmode .yoi-float-nav__bar {
    border-right-color: color-mix(in srgb, rgb(151, 154, 156) 28%, transparent);
}

html.darkmode .yoi-float-nav__h {
    color: color-mix(in srgb, rgb(151, 154, 156) 56%, transparent);
}

html.darkmode .yoi-float-nav__h.is-active {
    color: color-mix(in srgb, rgb(0, 123, 187) 72%, transparent);
}

html.darkmode .yoi-float-nav__search-input {
    background: color-mix(in srgb, #19191a 76%, transparent);
    border-color: color-mix(in srgb, rgb(151, 154, 156) 28%, transparent);
}

/* Mobile: nav collapses into a bottom sheet with a persistent bar strip */
@media (max-width: 550px) {
    /* Repositioned as a full-width bottom sheet anchored to the screen edge */
    .yoi-float-nav,
    .yoi-float-nav.yoi--desktop-open,
    .yoi-float-nav.yoi--desktop-collapsed {
        top: unset;
        right: unset;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        max-height: unset;
        box-sizing: border-box;
        border-radius: 8px 8px 0 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        line-height: 1;
        transition: none;
    }

    /* Bar strip: always visible, pinned to the bottom of the flex column */
    .yoi-float-nav__bar {
        order: 3;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 0.4rem;
        padding: 0 1.2rem;
        height: 4.4rem;
        flex-shrink: 0;
        margin-bottom: 0;
        border-right: 0;
    }

    .yoi-float-nav__desktop-toggle {
        display: none;
    }

    .yoi-float-nav__mobile-toggle-title {
        display: block;
    }

    .yoi-float-nav__theme {
        font-size: 2.4rem;
        padding: 1em;
    }

    /* Show toggle buttons on mobile */
    .yoi-float-nav__list-toggle,
    .yoi-float-nav__search-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        margin: 0;
        padding: 0 0.8rem;
        height: 4.4rem;
        border: 0;
        border-radius: 4px;
        background: transparent;
        cursor: pointer;
        font: inherit;
        color: inherit;
        line-height: inherit;
        transition: color 0.2s ease-in;
    }

    /* Active state for open panel toggles */
    .yoi-float-nav.yoi--list-open .yoi-float-nav__list-toggle,
    .yoi-float-nav.yoi--search-open .yoi-float-nav__search-toggle {
        color: #007bbb;
    }

    /* Panels: collapsed by default, animate open above the bar */
    .yoi-float-nav__search,
    .yoi-float-nav__list {
        order: 1;
        grid-column: auto;
        grid-row: auto;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transform: none;
        pointer-events: none;
        padding: 0 1.4rem;
        margin: 0;
        transition:
            max-height 0.3s ease,
            opacity 0.2s ease;
    }

    .yoi-float-nav__list {
        order: 2;
    }

    .yoi-float-nav.yoi--list-open .yoi-float-nav__list,
    .yoi-float-nav.yoi--search-open .yoi-float-nav__search {
        max-height: 60vh;
        overflow-y: auto;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        padding: 1.2rem 1.4rem;
        transition:
            max-height 0.3s ease,
            opacity 0.2s ease;
    }
}


/* ============================================================
   YOISHIGURE — EMBED MODAL
   ============================================================ */

.yoi-embed-modal[hidden] {
    display: none;
}

.yoi-embed-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.6vh 1rem;
    box-sizing: border-box;
}

.yoi-embed-modal__backdrop {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(12px) saturate(87%);
    -webkit-backdrop-filter: blur(12px) saturate(87%);
    opacity: 0;
    transition: opacity 0.2s ease-in;
}

.yoi-embed-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    max-width: 96vw;
    max-height: calc(100vh - 6vh);
    margin: 0;
    padding: 0.7rem;
    border-radius: 10px;
    background: #EBE6E2F5;
    box-shadow: 0 12px 24px 12px rgba(0, 123, 187, 0.12);
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 0.2s ease-in,
        transform 0.2s ease-in;
}

.yoi-embed-modal__toolbar {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.8rem;
}

.yoi-embed-modal__close {
    cursor: pointer;
    user-select: none;
    margin: 0;
    padding: 0.08rem 0.4rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 2.2rem;
    line-height: 1;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    height: auto;
}

.yoi-embed-modal__frame {
    border: 0;
    border-radius: 8px;
    width: 1px;
    height: 1px;
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 0.2s ease-in,
        transform 0.2s ease-in;
    background: transparent;
}

/* Visible state: fade in backdrop and dialog */
.yoi-embed-modal.is-visible .yoi-embed-modal__backdrop {
    opacity: 1;
}

.yoi-embed-modal.is-visible .yoi-embed-modal__dialog {
    opacity: 1;
    transform: translateY(0);
}

.yoi-embed-modal.is-visible .yoi-embed-modal__frame {
    transform: translateY(0);
}

html.darkmode .yoi-embed-modal__dialog {
    background: #19191ADE;
}

/* Suppress link transition while embed is opening to avoid visual flash */
html.yoi-embed-open .tategaki-content a:not(.icon),
html.yoi-embed-opening .tategaki-content a:not(.icon),
.tategaki-content a.yoi-embed-opening-link:not(.icon) {
    transition: none !important;
}
