/* ボーイ詳細ページ専用CSS。共通のヘッダー・ボタン・カードは style.css を使用する。 */

/* style.css の BOY DETAIL 区画から必要な基本指定を先に移す。 */
#detail .profile-grid {
    display: grid;
    gap: 12px;
}

#detail .profile-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

#detail .profile-grid-3,
#detail .profile-grid-stance {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#detail .profile-grid-1 {
    grid-template-columns: minmax(0, 1fr);
}

#detail .profile-item {
    padding: 12px 0;
    text-align: center;
}

#detail .profile-item .label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    letter-spacing: 1px;
    opacity: 0.6;
}

#detail .profile-item .value {
    display: block;
    font-size: 15px;
    font-weight: 700;
}

#detail .profile-comment {
    background: #fff;
    padding: 20px;
    border-radius: 15px;
    line-height: 2;
    border: var(--border-light, 1px solid rgba(0, 0, 0, 0.08));
}

#detail .profile-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

#detail .detail-gallery-grid img {
    border-radius: 12px;
}

/* 拡大画像のモーダルはギャラリー部品内に配置される。 */
#galleryModal.gallery-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    padding-top: 60px;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(0, 0, 0, 0.8);
}

#galleryModal .gallery-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

/* 元の可変サイズに戻す。黄色い枠や固定px上限は設けない。 */
#detail[hidden],
#detail-error[hidden] {
    display: none !important;
}

.boy-detail {
    padding: 16px clamp(12px, 3vw, 30px) 80px;
}

.detail-container {
    width: min(100%, 1100px);
    margin-inline: auto;
}

#detail {
    min-width: 0;
}

#detail > .section {
    padding: 0 !important;
    margin: 16px 0 0 !important;
}

#detail .detail-part {
    min-width: 0;
    box-sizing: border-box;
}

/* 写真とプロフィールは元の可変幅。高さの上限はJSで短い側に合わせる。 */
#detail .detail-top {
    display: grid !important;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr) !important;
    gap: clamp(10px, 2.5vw, 24px) !important;
    align-items: start !important;
}

#detail .detail-main-image {
    width: 100% !important;
    min-width: 0;
    margin: 0 !important;
    text-align: center;
}

#detail .detail-main-image img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    margin: 0 auto !important;
    border-radius: 12px;
}

#detail .profile-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px;
    width: 100% !important;
    min-width: 0;
    overflow-y: auto;
}

#detail .profile-content h1 {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 4px 0;
    text-align: center !important;
    font-size: clamp(18px, 3vw, 30px);
    line-height: 1.25 !important;
    overflow-wrap: anywhere;
}

#detail .profile-card,
#detail .content-card {
    margin: 0 !important;
    padding: clamp(6px, 1.5vw, 12px);
}

#detail .profile-grid.profile-grid-2,
#detail .profile-grid.profile-grid-3 {
    margin: 0 !important;
    gap: 0 !important;
}

#detail .profile-grid.profile-grid-2 .profile-item,
#detail .profile-grid.profile-grid-3 .profile-item {
    min-width: 0;
    width: 100% !important;
    padding: clamp(6px, 1.5vw, 12px) 3px !important;
}

#detail .profile-grid.profile-grid-2 .value,
#detail .profile-grid.profile-grid-3 .value {
    overflow-wrap: anywhere;
    font-size: clamp(12px, 1.5vw, 15px) !important;
}

#detail .profile-buttons {
    margin: 0 !important;
}

#detail .profile-buttons .main-btn {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px 6px;
    font-size: clamp(11px, 1.5vw, 15px);
}

/* スケジュールも画像による固定上限を廃止。 */
#detail .detail-schedule-section {
    width: min(100%, 720px);
    margin-inline: auto !important;
}

#detail .detail-schedule-section .section-header,
#detail .detail-schedule-section h2 {
    text-align: center;
}

#detail .detail-schedule-section h2,
#detail .detail-gallery-panel h2,
#detail .detail-intro-panel h2,
#detail .detail-comment-card h2 {
    margin: 0 0 8px;
    text-align: center;
    line-height: 1.25;
    font-size: clamp(18px, 2.5vw, 26px);
}

#detail #shift-grid-inner {
    display: flex !important;
    flex-wrap: nowrap !important;
    width: 100%;
    max-width: 100%;
    gap: 0 !important;
    overflow-x: auto;
    box-sizing: border-box;
    padding: 10px;
    margin: 0 auto !important;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: #fff;
}

#detail .detail-shift-day {
    display: block;
    width: 100px;
    min-width: 100px;
    flex: 0 0 100px;
    text-align: center;
    text-decoration: none;
    color: inherit;
}

#detail .detail-shift-date {
    padding: 10px 4px;
    font-weight: bold;
    font-size: 13px;
    background: #fafafa;
    border-bottom: 1px solid #ddd;
}

#detail .detail-shift-body {
    padding: 15px 4px;
    font-size: 13px;
    line-height: 1.6;
    color: #111;
}

#detail .detail-shift-muted .detail-shift-date,
#detail .detail-shift-muted .detail-shift-body {
    color: #aaa;
}

#detail .detail-shift-badge {
    margin-top: 10px;
    padding: 4px 2px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 4px;
    color: #555;
    background: #eee;
}

/* ギャラリーと自己紹介は元の可変幅。長い文章だけ枠内でスクロール。 */
#detail .detail-two-column {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: start !important;
    gap: clamp(10px, 2vw, 16px) !important;
    margin-top: 0 !important;
}

#detail .detail-gallery-panel,
#detail .detail-intro-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: auto !important;
    order: initial !important;
    min-width: 0;
}

#detail .detail-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none !important;
    width: 100%;
    height: auto !important;
    gap: 8px;
    margin: 0 auto;
}

#detail .detail-gallery-grid .gallery-thumb {
    display: block;
    width: 100%;
    height: auto !important;
    aspect-ratio: 3 / 4 !important;
    object-fit: cover;
}

#detail .detail-intro-panel {
    overflow-y: auto;
}

#detail .detail-intro-card {
    display: block;
    height: auto !important;
    padding: 8px !important;
    background: #fff !important;
    border-radius: 12px;
}

#detail .profile-grid.profile-grid-1 {
    margin: 0 !important;
}

#detail .profile-grid.profile-grid-1 .profile-item {
    padding: 8px 10px !important;
}

/* コメントは全幅に戻し、固定高を設けない。 */
#detail .detail-comment-card {
    width: 100%;
    height: auto;
    margin: 0;
    padding: 14px 18px;
    background: #fff;
}

#detail .detail-comment-text {
    min-height: 48px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* モーダル画像は3:4のまま画面内に収める。 */
#galleryModal .gallery-modal-content {
    display: block;
    width: min(90vw, 60vh);
    max-width: none !important;
    max-height: none !important;
    height: auto !important;
    aspect-ratio: 3 / 4 !important;
    object-fit: cover;
    margin: auto;
}

#galleryModal .gallery-close {
    background: transparent;
    border: 0;
    line-height: 1;
}

@media screen and (max-width: 420px) {
    #detail .detail-top,
    #detail .detail-two-column {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

/* Current detail layout shared with the test page. */
#detail .detail-top {
    align-items: stretch !important;
    grid-template-rows: auto minmax(0, 1fr);
}

#detail .detail-top > .detail-name-row {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    margin: 0;
}

#detail .detail-top > .detail-main-image {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
}

#detail .detail-top > .profile-content {
    grid-column: 2;
    grid-row: 2;
    height: 100%;
    min-height: 0;
    max-height: none !important;
    overflow: hidden;
}

#detail .detail-name-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    width: 100%;
}

#detail .detail-name-row #detail-name {
    width: auto;
    margin: 0;
    text-align: center;
}

#detail .detail-name-meta {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 12px;
    font-size: 16px;
    font-weight: 600;
}

#detail .detail-name-meta-item {
    white-space: nowrap;
}

#detail .detail-name-meta .value {
    display: inline;
    font-size: inherit !important;
    font-weight: inherit;
}

#detail .detail-profile-note {
    display: flex;
    flex: 0 0 100%;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    width: 100%;
    padding: 7px 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    background: #fff;
    text-align: center;
    font-size: 15px;
    line-height: 1.4;
    white-space: nowrap;
}

#detail .detail-profile-note[hidden] {
    display: none !important;
}

#detail .detail-profile-note-title {
    flex: 0 0 auto;
    font-weight: 700;
    white-space: nowrap;
}

#detail .detail-profile-note-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#detail .detail-profile-summary-card {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: clamp(6px, 1.5vw, 12px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
}

#detail .detail-profile-summary-card > .profile-card {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}

#detail .detail-profile-summary-card > .profile-card + .profile-card {
    margin-top: 6px !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
}

#detail .detail-appeal-card {
    margin-top: 8px;
    padding: 10px 4px 2px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

#detail .detail-appeal-title {
    margin: 0 0 8px;
    text-align: center;
    font-size: clamp(18px, 2.5vw, 26px);
}

#detail .detail-appeal-text {
    overflow-wrap: anywhere;
    font-size: 15px;
    line-height: 1.8;
}

#detail .detail-appeal-paragraph {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px;
    margin: 0 0 10px;
}

#detail .detail-profile-buttons--single #detail-reserve {
    grid-column: 1 / -1;
}

#detail .profile-content > .profile-buttons {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    flex: 0 0 auto;
    margin-top: auto !important;
}

#detail .profile-content > .profile-buttons > .main-btn {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#detail .detail-x-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    text-decoration: none;
}

#detail .detail-cta-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    line-height: 1.2;
    white-space: pre-line;
}

#detail .detail-cta-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.9em;
}

#detail .detail-shift-week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 8px;
}

#detail .detail-shift-week-nav button {
    width: 36px;
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #111;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

#detail .detail-shift-week-label {
    font-size: 13px;
    font-weight: 700;
}

#detail #shift-grid-inner {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 0 !important;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    box-sizing: border-box;
}

#detail .detail-shift-day {
    display: flex;
    flex: 0 0 100px;
    flex-direction: column;
    width: 100px;
    min-width: 100px;
    overflow: hidden;
    border: 1px solid #e5e7eb !important;
    border-right: 0 !important;
    border-radius: 6px;
}

#detail .detail-shift-day:last-child {
    border-right: 1px solid #e5e7eb !important;
}

#detail .detail-shift-date.saturday {
    color: #2563eb;
}

#detail .detail-shift-date.holiday {
    color: #dc2626;
}

#detail .detail-shift-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

#detail .detail-shift-body.detail-shift-rest {
    display: flex;
    flex: 1;
    min-height: 90px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    padding: 15px 4px;
    background: #e5e7eb;
    color: #dc2626;
    font-weight: 700;
    text-align: center;
}

#detail .detail-shift-badge {
    order: 0;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0;
}

#detail .detail-shift-time {
    display: flex;
    order: 1;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
}

#detail .detail-shift-comment {
    order: 2;
    width: 100%;
    box-sizing: border-box;
    color: #555;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

#detail .detail-intro-panel {
    min-height: 0;
    overflow: hidden !important;
}

#detail .detail-intro-card {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

@media screen and (max-width: 767px) {
    #detail .profile-content > .profile-buttons {
        grid-template-columns: minmax(0, 1fr);
    }

    #detail .profile-content > .profile-buttons > .main-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 64px;
        min-height: 64px;
        padding: 6px 10px;
        box-sizing: border-box;
    }
}

@media screen and (max-width: 420px) {
    #detail .detail-top {
        grid-template-rows: auto auto auto;
    }

    #detail .detail-top > .detail-name-row,
    #detail .detail-top > .detail-main-image,
    #detail .detail-top > .profile-content {
        grid-column: 1;
    }

    #detail .detail-top > .detail-name-row {
        grid-row: 1;
    }

    #detail .detail-top > .detail-main-image {
        grid-row: 2;
    }

    #detail .detail-top > .profile-content {
        grid-row: 3;
        height: auto;
        max-height: none !important;
        overflow: visible;
    }

    #detail .detail-profile-summary-card {
        flex: initial;
        overflow: visible;
    }
}
