/*
Theme Name: TH01 AV Monster Child
Author: Site Project
Description: AVモンスター（えーもん）専用のTH01 Simple Base子テーマ。
Version: 0.2.1
Requires at least: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: th01-avmonster-child
Template: th01-simple-base
*/

/* ---------------------------------------------------------
 * AV Monster design tokens
 * --------------------------------------------------------- */
body.avm-color-mode-strawberry {
    --th01-color-canvas: #fffafb;
    --th01-color-surface: #fff1f4;
    --th01-color-surface-strong: #ffe3e9;
    --th01-color-text: #2d2024;
    --th01-color-muted: #79666c;
    --th01-color-link: #b4234d;
    --th01-color-link-hover: #861938;
    --th01-color-border: #e8cbd3;
    --th01-color-focus: #f59e0b;
    --avm-accent: #b4234d;
    --avm-accent-hover: #861938;
    --avm-card-bg: #ffffff;
    --avm-tag-bg: #fff1f4;
    --avm-actress-bg: #ffe0ea;
    --avm-header-bg: rgba(255, 250, 251, .94);
    --avm-shadow: 0 12px 32px rgba(95, 30, 51, .10);
}

body.avm-color-mode-night {
    --th01-color-canvas: #151319;
    --th01-color-surface: #201d25;
    --th01-color-surface-strong: #2c2732;
    --th01-color-text: #f5eff7;
    --th01-color-muted: #b8acbd;
    --th01-color-link: #ff6f9a;
    --th01-color-link-hover: #ff9bb9;
    --th01-color-border: #413947;
    --th01-color-focus: #f8c14f;
    --avm-accent: #d84370;
    --avm-accent-hover: #ef628d;
    --avm-card-bg: #1d1a21;
    --avm-tag-bg: #2c2732;
    --avm-actress-bg: #4a2734;
    --avm-header-bg: rgba(21, 19, 25, .95);
    --avm-shadow: 0 14px 36px rgba(0, 0, 0, .30);
}

body.avm-color-mode-ocean {
    --th01-color-canvas: #f7fbff;
    --th01-color-surface: #edf6ff;
    --th01-color-surface-strong: #dceeff;
    --th01-color-text: #172536;
    --th01-color-muted: #607388;
    --th01-color-link: #1769aa;
    --th01-color-link-hover: #0f4d7d;
    --th01-color-border: #c7dcec;
    --avm-accent: #1769aa;
    --avm-accent-hover: #0f4d7d;
    --avm-card-bg: #ffffff;
    --avm-tag-bg: #edf6ff;
    --avm-actress-bg: #d9ecff;
    --avm-header-bg: rgba(247, 251, 255, .94);
    --avm-shadow: 0 12px 32px rgba(28, 82, 124, .11);
}

body.avm-color-mode-forest {
    --th01-color-canvas: #f8fcf8;
    --th01-color-surface: #eef7ef;
    --th01-color-surface-strong: #dceee0;
    --th01-color-text: #1f2d22;
    --th01-color-muted: #627466;
    --th01-color-link: #287a45;
    --th01-color-link-hover: #1c5932;
    --th01-color-border: #cbdccb;
    --avm-accent: #287a45;
    --avm-accent-hover: #1c5932;
    --avm-card-bg: #ffffff;
    --avm-tag-bg: #eef7ef;
    --avm-actress-bg: #dcefe1;
    --avm-header-bg: rgba(248, 252, 248, .94);
    --avm-shadow: 0 12px 32px rgba(34, 94, 52, .10);
}

body.avm-color-mode-violet {
    --th01-color-canvas: #fcf9ff;
    --th01-color-surface: #f5efff;
    --th01-color-surface-strong: #eadcff;
    --th01-color-text: #2a2135;
    --th01-color-muted: #746681;
    --th01-color-link: #7650a8;
    --th01-color-link-hover: #56377d;
    --th01-color-border: #ddcdea;
    --avm-accent: #7650a8;
    --avm-accent-hover: #56377d;
    --avm-card-bg: #ffffff;
    --avm-tag-bg: #f5efff;
    --avm-actress-bg: #eadcff;
    --avm-header-bg: rgba(252, 249, 255, .94);
    --avm-shadow: 0 12px 32px rgba(76, 45, 108, .10);
}

body.avm-color-mode-mono {
    --th01-color-canvas: #f7f7f7;
    --th01-color-surface: #eeeeee;
    --th01-color-surface-strong: #e0e0e0;
    --th01-color-text: #222222;
    --th01-color-muted: #6c6c6c;
    --th01-color-link: #333333;
    --th01-color-link-hover: #000000;
    --th01-color-border: #cccccc;
    --avm-accent: #333333;
    --avm-accent-hover: #000000;
    --avm-card-bg: #ffffff;
    --avm-tag-bg: #eeeeee;
    --avm-actress-bg: #dddddd;
    --avm-header-bg: rgba(247, 247, 247, .95);
    --avm-shadow: 0 12px 30px rgba(0, 0, 0, .09);
}

:root {
    --th01-wide-width: 1600px;
    --th01-content-width: 1100px;
    --th01-radius: 12px;
}

html,
body {
    min-height: 100%;
}

body {
    overflow-wrap: anywhere;
    background: var(--th01-color-surface);
}

.site {
    min-height: 100vh;
}

.site-header {
    border-color: var(--th01-color-border);
    background: var(--avm-header-bg);
    backdrop-filter: blur(10px);
}

.site-header.is-scrolled {
    box-shadow: var(--avm-shadow);
}

.site-title a,
.main-navigation a,
.footer-navigation a {
    text-decoration: none;
}

.site-title a {
    font-weight: 800;
    letter-spacing: .02em;
}

.site-content {
    padding-block: clamp(1rem, 2.5vw, 2rem) clamp(2rem, 4vw, 4rem);
}

.site-main {
    min-width: 0;
}

.entry-page {
    margin-bottom: 0;
}

.entry-page > .entry-header {
    margin-bottom: 1rem;
}

.entry-page > .entry-header .entry-title {
    font-size: clamp(1.65rem, 3vw, 2.4rem);
}

.entry-card,
.widget,
.comments-area {
    border-color: var(--th01-color-border);
    background: var(--avm-card-bg);
    box-shadow: var(--avm-shadow);
}

.site-footer {
    border-top: 1px solid var(--th01-color-border);
    background: var(--th01-color-canvas);
}

/* ---------------------------------------------------------
 * True full-width page / static front page
 * --------------------------------------------------------- */
.avm-full-width #content.site-content.site-container {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    max-width: none;
    padding-inline: clamp(10px, 1.6vw, 28px);
}

.avm-full-width #primary.site-main,
.avm-full-width .entry-page,
.avm-full-width .entry-content {
    width: 100%;
    max-width: none;
}

.avm-full-width .entry-content > .alignwide,
.avm-full-width .entry-content > .alignfull {
    width: 100%;
    max-width: none;
    margin-inline: 0;
    transform: none;
}

/* ---------------------------------------------------------
 * AVM01 search
 * --------------------------------------------------------- */
.avm01-search {
    width: 100%;
    max-width: none;
    margin: 0 auto;
}

.avm01-form {
    border: 1px solid var(--th01-color-border);
    border-radius: 16px;
    background: var(--avm-card-bg);
    box-shadow: var(--avm-shadow);
    padding: clamp(14px, 2vw, 22px);
}

.avm01-form label {
    color: var(--th01-color-text);
}

.avm01-form input,
.avm01-form select {
    border-color: var(--th01-color-border);
    background: var(--th01-color-canvas);
    color: var(--th01-color-text);
}

.avm01-form__searchline button,
.avm01-load-button {
    background: var(--avm-accent);
    border-color: var(--avm-accent);
    color: #fff;
}

.avm01-form__searchline button:hover,
.avm01-form__searchline button:focus-visible,
.avm01-load-button:hover,
.avm01-load-button:focus-visible {
    background: var(--avm-accent-hover);
    color: #fff;
}

.avm01-summary {
    color: var(--th01-color-muted);
    padding-inline: 2px;
}

.avm01-summary strong {
    color: var(--th01-color-text);
}

/* カード幅・高さはAVM01設定のCSS変数で固定。画像部分は常に4:3。 */
.avm01-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: clamp(12px, 1.5vw, 20px);
}

.avm01-item {
    width: min(100%, var(--avm01-card-width, 300px));
    height: var(--avm01-card-height, 460px);
    flex: 0 0 min(100%, var(--avm01-card-width, 300px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--th01-color-border);
    border-radius: 14px;
    background: var(--avm-card-bg);
    box-shadow: var(--avm-shadow);
    transition: transform 140ms ease, box-shadow 140ms ease;
}

.avm01-item:hover {
    transform: translateY(-2px);
}

.avm01-item__image {
    width: 100%;
    aspect-ratio: 4 / 3;
    flex: 0 0 auto;
    overflow: hidden;
    background: var(--th01-color-surface-strong);
}

.avm01-item__image a {
    display: block;
    width: 100%;
    height: 100%;
}

.avm01-item__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.avm01-item__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 8px 13px 10px;
}

.avm01-item__title {
    display: -webkit-box;
    min-height: 2.7em;
    max-height: 2.7em;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    margin: 0 0 4px;
    color: var(--th01-color-text);
    font-size: 1rem;
    line-height: 1.35;
}

.avm01-item__title a {
    color: inherit;
    text-decoration: none;
}

.avm01-item__title a:hover,
.avm01-item__title a:focus-visible {
    color: var(--th01-color-link);
}

/* 女優とタグは同じチップ領域にまとめ、最大3行だけ表示する。 */
.avm01-item__chips {
    height: 6.15em;
    overflow: hidden;
    margin: 0 0 2px;
    color: var(--th01-color-text);
    font-size: .76rem;
    line-height: 1.78;
    align-content: flex-start;
}

.avm01-item__chip {
    display: inline-block;
    border: 1px solid var(--th01-color-border);
    border-radius: 999px;
    padding: 2px 7px;
    margin: 0 4px 4px 0;
    line-height: 1.5;
    vertical-align: top;
}

.avm01-item__chip--tag {
    background: var(--avm-tag-bg);
}

.avm01-item__chip--actress {
    background: var(--avm-actress-bg);
    font-weight: 700;
}

.avm01-item__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    margin: 0 0 2px;
    color: var(--th01-color-muted);
    font-size: .8rem;
}

.avm01-item__actions {
    margin: 0 0 2px;
}

.avm01-item__fanza {
    display: inline;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--th01-color-link);
    text-align: left;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.avm01-item__fanza:hover,
.avm01-item__fanza:focus-visible {
    background: none;
    color: var(--th01-color-link-hover);
}

.avm01-empty,
.avm01-error {
    border: 1px solid var(--th01-color-border);
    background: var(--avm-card-bg);
    color: var(--th01-color-text);
}

.avm01-load-area {
    color: var(--th01-color-muted);
}

.avm01-load-button {
    border-radius: 999px;
    padding-inline: 1.4rem;
}

@media (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }
}

@media (max-width: 600px) {
    .avm-full-width #content.site-content.site-container {
        padding-inline: 10px;
    }

    .site-content {
        padding-top: .8rem;
    }

    .avm01-item {
        max-width: 100%;
    }
}


/* Search pagination: 100 items per normal page */
.avm01-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 14px;
    margin: 22px 0 8px;
}
.avm01-pagination__pages { display:flex; flex-wrap:wrap; justify-content:center; gap:6px; }
.avm01-pagination a,
.avm01-pagination__current {
    display:inline-flex; min-width:34px; min-height:34px; align-items:center; justify-content:center;
    padding:5px 9px; border:1px solid var(--th01-color-border); border-radius:8px;
    background:var(--avm-card-bg); color:var(--th01-color-link); text-decoration:none;
}
.avm01-pagination a:hover,
.avm01-pagination a:focus-visible { border-color:var(--avm-accent); color:var(--avm-accent-hover); }
.avm01-pagination__current { border-color:var(--avm-accent); background:var(--avm-accent); color:#fff; font-weight:700; }
.avm01-pagination__prev,
.avm01-pagination__next { min-width:auto !important; }


/* ---------------------------------------------------------
 * E-mon candidate controls
 * --------------------------------------------------------- */
.avm01-candidate-control {
    margin-top: auto;
    padding-top: 6px;
}

.avm01-candidate-button,
.avm01-candidate-login {
    display: flex;
    width: 100%;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border: 1px solid var(--avm-accent);
    border-radius: 8px;
    background: var(--avm-accent);
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.avm01-candidate-button:hover,
.avm01-candidate-button:focus-visible,
.avm01-candidate-login:hover,
.avm01-candidate-login:focus-visible {
    border-color: var(--avm-accent-hover);
    background: var(--avm-accent-hover);
    color: #fff;
}

.avm01-candidate-button.is-added,
.avm01-candidate-button:disabled {
    border-color: var(--th01-color-border);
    background: var(--th01-color-surface);
    color: var(--th01-color-muted);
    cursor: default;
}

.avm01-candidate-button--remove {
    border-color: #b32d2e;
    background: transparent;
    color: #b32d2e;
}

.avm01-candidate-button--remove:hover,
.avm01-candidate-button--remove:focus-visible {
    border-color: #b32d2e;
    background: #b32d2e;
    color: #fff;
}

.avm01-candidate-button.is-busy {
    opacity: .7;
}

.avm01-candidates {
    width: 100%;
    max-width: none;
}

.avm01-candidates__header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 14px;
}

.avm01-candidates__header h2 {
    margin: 0;
}

.avm01-candidate-items {
    margin-bottom: 18px;
}


/* ---------------------------------------------------------
 * E-mon candidate page / 10 slots
 * --------------------------------------------------------- */
.avm01-candidates__header {
    align-items: flex-end;
}

.avm01-candidates__header > div:first-child {
    min-width: 0;
}

.avm01-candidates__lead {
    margin: 5px 0 0;
    color: var(--th01-color-muted);
    font-size: .9rem;
}

.avm01-candidates__status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.15;
}

.avm01-candidates__status strong {
    color: var(--th01-color-text);
    font-size: 1.15rem;
}

.avm01-candidates__status span {
    margin-top: 3px;
    color: var(--th01-color-muted);
    font-size: .75rem;
}

.avm01-candidates__toolbar:empty {
    display: none;
}

.avm01-candidates__toolbar {
    margin: 0 0 14px;
}

.avm01-candidate-slots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: clamp(12px, 1.5vw, 20px);
}

.avm01-candidate-slot {
    width: min(100%, var(--avm01-card-width, 300px));
    height: var(--avm01-card-height, 460px);
    flex: 0 0 min(100%, var(--avm01-card-width, 300px));
}

.avm01-candidate-slot > .avm01-item {
    width: 100%;
    height: 100%;
    max-width: none;
}

.avm01-candidate-slot__empty {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 7px;
    border: 2px dashed var(--th01-color-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--th01-color-surface) 72%, transparent);
    color: var(--th01-color-muted);
}

.avm01-candidate-slot__number {
    position: absolute;
    top: 10px;
    left: 12px;
    font-size: .75rem;
    font-weight: 700;
    opacity: .75;
}

.avm01-candidate-slot__empty-label {
    font-weight: 700;
}

.avm01-candidates__empty-note {
    margin: 14px 0 0;
    color: var(--th01-color-muted);
    font-size: .9rem;
    text-align: center;
}

@media (max-width: 520px) {
    .avm01-candidates__header {
        align-items: flex-start;
    }

    .avm01-candidates__status {
        align-items: flex-start;
    }
}


/* ---------------------------------------------------------
 * Candidate random picker
 * --------------------------------------------------------- */
.avm01-candidates__random {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.avm01-candidates__random-button {
    min-height: 38px;
    padding: 7px 14px;
    border: 1px solid var(--avm-accent);
    border-radius: 8px;
    background: var(--avm-accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.avm01-candidates__random-button:hover,
.avm01-candidates__random-button:focus-visible {
    border-color: var(--avm-accent-hover);
    background: var(--avm-accent-hover);
    color: #fff;
}

.avm01-candidates__random-button.is-busy {
    opacity: .65;
    cursor: wait;
}

.avm01-candidates__random-help,
.avm01-candidates__random-message {
    color: var(--th01-color-muted);
}

.avm01-candidates__random-help {
    font-size: .86rem;
}

.avm01-candidates__random-message {
    flex: 0 0 100%;
    min-height: 1.2em;
    font-size: .82rem;
}


.avm01-candidates__random-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.avm01-candidates__random-button--danger {
    border-color: #b32d2e;
    background: transparent;
    color: #b32d2e;
}

.avm01-candidates__random-button--danger:hover,
.avm01-candidates__random-button--danger:focus-visible {
    border-color: #b32d2e;
    background: #b32d2e;
    color: #fff;
}


/* ---------------------------------------------------------
 * Candidate selection (phase 6-4)
 * --------------------------------------------------------- */
.avm01-item__image {
    position: relative;
}

.avm01-item.is-selected {
    box-shadow: 0 0 0 3px var(--avm-accent), var(--avm-shadow);
}

.avm01-selection-badge {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--avm-accent);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}

.avm01-selection-badge[hidden] {
    display: none !important;
}

.avm01-candidate-control__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
}

.avm01-candidate-button--select.is-selected {
    border-color: var(--avm-accent);
    background: var(--avm-accent);
    color: #fff;
}

.avm01-selection-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--th01-color-border);
    border-radius: 10px;
    background: var(--th01-color-surface);
}

.avm01-selection-summary.is-ready {
    border-color: var(--avm-accent);
    background: var(--th01-color-surface-strong);
}

.avm01-selection-summary span {
    color: var(--th01-color-muted);
    font-size: .86rem;
}

.avm01-candidates__status {
    flex-direction: row;
    gap: 14px;
}

.avm01-candidates__status-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.avm01-candidates__status-block small {
    margin-top: 3px;
    color: var(--th01-color-muted);
    font-size: .72rem;
    font-weight: 400;
}

@media (max-width: 520px) {
    .avm01-candidates__status {
        gap: 10px;
    }

    .avm01-candidates__status-block {
        align-items: flex-start;
    }

    .avm01-candidate-control__row {
        grid-template-columns: 1fr 1fr;
    }
}


/* ---------------------------------------------------------
 * Candidate delete controls
 * --------------------------------------------------------- */
.avm01-candidate-slot {
    position: relative;
}

.avm01-candidate-delete-check {
    position: absolute;
    z-index: 4;
    top: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 7px;
    border: 1px solid var(--th01-color-border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--avm-card-bg) 92%, transparent);
    color: var(--th01-color-text);
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

.avm01-candidate-delete-check input {
    margin: 0;
}

.avm01-candidates__delete-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.avm01-candidates__delete-button {
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid #b32d2e;
    border-radius: 8px;
    background: var(--avm-card-bg);
    color: #b32d2e;
    font-weight: 700;
    cursor: pointer;
}

.avm01-candidates__delete-button:hover,
.avm01-candidates__delete-button:focus-visible,
.avm01-candidates__delete-button--danger {
    background: #b32d2e;
    color: #fff;
}

.avm01-candidates__delete-button:disabled {
    border-color: var(--th01-color-border);
    background: var(--th01-color-surface);
    color: var(--th01-color-muted);
    cursor: default;
}

.avm01-candidates__delete-button.is-busy {
    opacity: .65;
    cursor: wait;
}
