/* Whiteyun interaction layer: custom controls, calmer motion, and long-reading mobile scale. */
:root {
    --wy-ease: cubic-bezier(.2, .78, .22, 1);
    --wy-ease-spring: cubic-bezier(.2, .9, .25, 1.08);
}

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: wy-page-out .14s ease both; }
::view-transition-new(root) { animation: wy-page-in .28s var(--wy-ease) both; }

body:not(.reader-page) .site-main,
body.m-site:not(.m-reader-page) .m-main { animation: wy-content-enter .32s var(--wy-ease); }

@keyframes wy-page-out { to { opacity: .72; transform: translateY(-2px); } }
@keyframes wy-page-in { from { opacity: .35; transform: translateY(5px); } }
@keyframes wy-content-enter { from { opacity: .45; transform: translateY(7px); } }
@keyframes wy-select-enter { from { opacity: 0; transform: translateY(-6px) scale(.985); } }

/* The real select remains form-valid and submission-compatible; the visible control is fully styled. */
.wy-select {
    position: relative;
    min-width: 0;
    display: inline-block;
    color: inherit;
    vertical-align: middle;
}
.wy-native-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
.wy-select-trigger {
    width: 100%;
    min-width: 116px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 13px;
    border: 1px solid #d9d9d9;
    border-radius: 5px;
    color: #242424;
    background: #fff;
    box-shadow: 0 1px 0 rgba(0,0,0,.02);
    font-size: .9rem;
    text-align: left;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.wy-select-trigger:hover { border-color: #b9b9b9; background: #fffdfd; }
.wy-select-trigger:focus-visible,
.wy-select.is-open .wy-select-trigger { border-color: #e5353e; outline: 0; box-shadow: 0 0 0 3px rgba(229,53,62,.12); }
.wy-select-trigger.is-placeholder { color: #767676; }
.wy-select-trigger i { flex: 0 0 auto; color: #777; font-size: 18px; transition: transform .2s var(--wy-ease); }
.wy-select.is-open .wy-select-trigger i { transform: rotate(180deg); }
.wy-select-menu {
    position: absolute;
    z-index: 180;
    top: calc(100% + 7px);
    right: 0;
    left: 0;
    min-width: max(100%, 210px);
    max-height: min(320px, 48vh);
    padding: 6px;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    background: rgba(255,255,255,.985);
    box-shadow: 0 12px 35px rgba(25,25,25,.15);
    backdrop-filter: blur(16px);
    animation: wy-select-enter .2s var(--wy-ease) both;
}
.wy-select.opens-up .wy-select-menu { top: auto; bottom: calc(100% + 7px); transform-origin: bottom; }
.wy-select-option {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 8px 11px;
    border: 0;
    border-radius: 5px;
    color: #353535;
    background: transparent;
    font-size: .88rem;
    text-align: left;
    transition: color .14s ease, background-color .14s ease, transform .14s ease;
}
.wy-select-option:hover,
.wy-select-option:focus-visible { outline: 0; color: #bd242d; background: #fff1f2; }
.wy-select-option:active { transform: scale(.985); }
.wy-select-option.is-selected { color: #bd242d; background: #fff1f2; font-weight: 700; }
.wy-select-option.is-selected::after { content: "\ea5b"; margin-left: auto; font-family: remixicon; font-size: 18px; }
.wy-select-option:disabled { opacity: .42; cursor: not-allowed; }
.field > .wy-select,
.m-rating-form > .wy-select,
.m-review-composer label > .wy-select,
.m-category-select > .wy-select { width: 100%; }
.rating-form > div > .wy-select { flex: 1 1 auto; }

/* Edition switch: a single calm segmented control, labelled by creator rather than production jargon. */
.m-site .m-edition-switch {
    position: relative;
    isolation: isolate;
    min-width: 148px;
    height: 44px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: center;
    padding: 3px;
    overflow: hidden;
    border: 1px solid #ededed;
    border-radius: 10px;
    background: #f3f3f3;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.025);
}
.m-site .m-edition-switch::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(25,25,25,.09);
    transform: translateX(0);
    transition: transform .26s var(--wy-ease);
}
.m-site .m-edition-switch[data-active="human_web"]::before { transform: translateX(100%); }
.m-site .m-edition-switch a,
.m-site .m-edition-switch a:first-child,
.m-site .m-edition-switch a:last-child {
    position: relative;
    z-index: 1;
    min-width: 0;
    min-height: 38px;
    display: grid;
    place-items: center;
    padding: 0 9px;
    border-radius: 7px;
    color: #737373;
    background: transparent;
    box-shadow: none;
    font-size: 14px;
    font-weight: 650;
    text-align: center;
}
.m-site .m-edition-switch a[aria-current="page"] { color: #d72f38; }

/* Mobile scale is tuned for reading and touch, not dashboard density. */
@media (max-width: 680px) {
    body.m-site:not(.m-reader-page) { font-size: 16px; }
    .m-site .m-topbar { min-height: 56px; padding-inline: 16px; }
    .m-site .m-brand strong { font-size: 22px; }
    .m-site .m-brand span { font-size: 11px; }
    .m-site .m-search-toggle { min-width: 44px; min-height: 44px; }
    .m-site .m-search-toggle i { font-size: 25px; }
    .m-site .m-home-search input { font-size: 15px; }
    .m-site .m-home-search button { min-width: 72px; font-size: 14px; }
    .m-site .m-quick-nav strong { font-size: 13px; }
    .m-site .m-quick-nav small { font-size: 10px; }
    .m-site .m-promo-strip { min-height: 76px; }
    .m-site .m-promo-strip strong { font-size: 14px; }
    .m-site .m-promo-strip small { font-size: 10px; }
    .m-site .m-promo-strip em { min-height: 38px; padding-inline: 14px; font-size: 13px; }
    .m-site .m-section-head h2 { font-size: 22px; }
    .m-site .m-section-head > a { min-height: 36px; display: inline-flex; align-items: center; font-size: 13px; }
    .m-site .m-cover-shelf strong { min-height: 36px; font-size: 13px; line-height: 18px; }
    .m-site .m-cover-shelf span { font-size: 11px; }
    .m-site .m-secondary-nav a { min-height: 82px; }
    .m-site .m-secondary-nav > a > i { font-size: 25px; }
    .m-site .m-secondary-nav strong { font-size: 12px; }
    .m-site .m-page-head { padding: 20px 17px 17px; }
    .m-site .m-page-head h1 { font-size: 25px; line-height: 1.25; }
    .m-site .m-page-head > p { font-size: 13px; line-height: 1.65; }
    .m-site .m-filter-chips span,
    .m-site .m-ranking-tabs a,
    .m-site .m-zone-tabs a { min-height: 42px; display: inline-flex; align-items: center; font-size: 13px; }
    .m-site .m-category-select > span { font-size: 13px; }
    .m-site .m-library-filters > button { min-height: 44px; font-size: 14px; }
    .m-site .m-book-row { min-height: 116px; }
    .m-site .m-book-row h2,
    .m-site .m-ranking-list h2 { font-size: 17px; }
    .m-site .m-book-row p,
    .m-site .m-ranking-list p { font-size: 13px; line-height: 1.55; }
    .m-site .m-book-row small,
    .m-site .m-ranking-list small { font-size: 11px; }
    .m-site .m-backbar { min-height: 50px; padding-inline: 15px; }
    .m-site .m-backbar a,
    .m-site .m-backbar strong,
    .m-site .m-backbar > span { min-height: 44px; display: inline-flex; align-items: center; font-size: 14px; }
    .m-site .m-book-hero { padding-top: 20px; }
    .m-site .m-detail-copy h1 { font-size: 25px; }
    .m-site .m-detail-copy > p { font-size: 13px; line-height: 1.55; }
    .m-site .m-book-stats dt { font-size: 20px; }
    .m-site .m-book-stats dd { font-size: 11px; }
    .m-site .m-book-tabs a { min-height: 48px; font-size: 14px; }
    .m-site .m-detail-section { padding: 19px 17px; }
    .m-site .m-detail-section .m-section-head h2 { font-size: 20px; }
    .m-site .m-section-head small { font-size: 11px; }
    .m-site .m-prose-summary { font-size: 16px; line-height: 1.85; }
    .m-site .m-book-actions > a,
    .m-site .m-book-actions > span,
    .m-site .m-book-actions button,
    .m-site .m-inline-button { min-height: 46px; font-size: 14px; }
    .m-site .m-rating-form label,
    .m-site .m-review-composer label { font-size: 13px; }
    .m-site .m-rating-form button,
    .m-site .m-review-composer button { min-height: 46px; font-size: 14px; }
    .m-site .m-catalog-card { padding-bottom: 8px; }
    .m-site .m-catalog-card .m-section-head > a { gap: 2px; color: #646464; }
    .m-site .m-catalog-preview { border-top: 0; counter-reset: none; }
    .m-site .m-catalog-preview li { border-color: #eeeeee; }
    .m-site .m-catalog-preview a {
        min-height: 68px;
        display: grid;
        grid-template-columns: 32px minmax(0, 1fr) 18px;
        align-items: center;
        gap: 10px;
        padding: 10px 0;
    }
    .m-site .m-catalog-index,
    .m-site .m-volume-index {
        color: #b6b6b6;
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 12px;
        font-variant-numeric: tabular-nums;
        letter-spacing: .04em;
    }
    .m-site .m-catalog-copy,
    .m-site .m-volume-copy { min-width: 0; display: grid; gap: 5px; }
    .m-site .m-catalog-copy strong {
        overflow: hidden;
        color: #222;
        font-size: 15px;
        font-weight: 620;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .m-site .m-catalog-copy small { color: #8a8a8a; font-size: 11px; }
    .m-site .m-catalog-preview a > i { color: #b6b6b6; font-size: 18px; }
    .m-site .m-catalog-head { padding-top: 24px; }
    .m-site .m-catalog-head > small { margin-bottom: 7px; color: #e5353e; font-size: 11px; font-weight: 750; letter-spacing: .09em; }
    .m-site .m-catalog-head .m-inline-button { width: fit-content; gap: 6px; margin-top: 16px; padding-inline: 18px; }
    .m-site .m-volume-list { margin-top: 10px; padding-inline: 17px; }
    .m-site .m-volume-list > section > header { min-height: 50px; padding: 12px 0 8px; }
    .m-site .m-volume-list h2 { font-size: 17px; }
    .m-site .m-volume-list header span { font-size: 12px; }
    .m-site .m-volume-list li a {
        min-height: 68px;
        grid-template-columns: 32px minmax(0, 1fr) 24px;
        gap: 10px;
    }
    .m-site .m-volume-list li a > span:first-child { display: block; }
    .m-site .m-volume-list li strong { font-size: 15px; font-weight: 580; }
    .m-site .m-volume-list li small { display: block; color: #8a8a8a; font-size: 11px; }
    .m-site .m-volume-state { display: grid; place-items: center; color: #aaa; font-size: 18px; }
    .m-site .m-dock { height: calc(64px + env(safe-area-inset-bottom)); }
    .m-site .m-dock a { grid-template-rows: 28px 16px; gap: 2px; font-size: 12px; }
    .m-site .m-dock a i { font-size: 25px; }
    .m-site:not(.m-reader-page):not(.m-book-page):not(.m-catalog-page) .m-main { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
    .m-site .wy-select { width: 100%; }
    .m-site .wy-select-trigger { min-height: 46px; border-radius: 9px; font-size: 14px; }
    .m-site .wy-select-menu { min-width: 100%; max-height: min(340px, 52vh); border-radius: 12px; }
    .m-site .wy-select-option { min-height: 46px; font-size: 14px; }
}

@media (max-width: 374px) {
    .m-site .m-edition-switch { min-width: 132px; }
    .m-site .m-edition-switch a,
    .m-site .m-edition-switch a:last-child { display: grid; padding-inline: 5px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root),
    .site-main,
    .m-main,
    .wy-select-menu { animation: none !important; }
}
