/*
 * SmileLab Download Manager - 公開画面
 * v0.1.3-beta
 *
 * 設計方針:
 * - スマイルラボ既存ダウンロードページの、サンプルBOXを基準に、白背景・オレンジのアクセント・薄い罫線・アウトラインボタンを基調にする。
 * - PCは2列、奇数件の最後の1件は中央、スマホは1列。
 * - TCDテーマの本文タイポグラフィを極力上書きせず、資料BOXと操作部分だけを整える。
 */

.sldm-download-page,
.sldm-download-page * {
    box-sizing: border-box;
}

.sldm-download-page {
    width: 100%;
}

.sldm-category {
    margin: 0 0 64px;
}

.sldm-category-title {
    margin-bottom: 14px;
}

.sldm-category-description {
    margin-bottom: 28px;
}

.sldm-category-description > :first-child,
.sldm-description > :first-child {
    margin-top: 0;
}

.sldm-category-description > :last-child,
.sldm-description > :last-child {
    margin-bottom: 0;
}

/*
 * PC: 2列。
 * 1件だけ、または奇数件で最後の1件だけ残る場合は中央に配置する。
 */
.sldm-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    align-items: stretch;
}

.sldm-items > .sldm-download-box:nth-child(odd):last-child {
    grid-column: 1 / -1;
    width: calc((100% - 24px) / 2);
    justify-self: center;
}

.sldm-download-box {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    padding: 28px 26px 24px;
    border: 1px solid var(--sldm-card-border, #e6e6e6);
    border-top: 5px solid var(--sldm-accent, #ff8a00);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.025);
    overflow: hidden;
}

.sldm-download-content {
    min-width: 0;
}

.sldm-title-line {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.sldm-title-line h3 {
    flex: 1 1 220px;
    min-width: 0;
    margin: 0;
    line-height: 1.55;
}

.sldm-file-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 30px;
    padding: 5px 12px;
    border: 0;
    border-radius: 999px;
    background: var(--sldm-badge-bg, #f1f1f1);
    color: #555;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .05em;
    line-height: 1.2;
}

.sldm-description {
    margin-bottom: 15px;
}

.sldm-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 14px;
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.6;
    opacity: .72;
}

.sldm-meta span + span::before {
    content: "·";
    margin-right: 14px;
    opacity: .55;
}

.sldm-lock-label {
    white-space: nowrap;
}

/* ボタンをカード下端にそろえる */
.sldm-download-action {
    width: 100%;
    margin-top: auto;
    padding-top: 22px;
}

.sldm-download-button,
.sldm-password-submit {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 52px;
    margin: 0;
    padding: 13px 18px;
    border: 1px solid var(--sldm-accent, #ff8a00);
    border-radius: 0;
    background: #fff;
    color: var(--sldm-accent, #ff8a00) !important;
    font: inherit;
    font-weight: 600;
    line-height: 1.4 !important;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, transform .2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.sldm-download-button::after,
.sldm-password-submit::after {
    content: "↓";
    flex: 0 0 auto;
    margin-left: 14px;
    font-size: 1.15em;
    line-height: 1;
}

.sldm-download-button:hover,
.sldm-password-submit:hover {
    background: var(--sldm-accent, #ff8a00);
    color: #fff !important;
}

.sldm-download-button:active,
.sldm-password-submit:active {
    transform: translateY(1px);
}

.sldm-download-button:focus-visible,
.sldm-password-submit:focus-visible,
.sldm-password-form input:focus-visible {
    outline: 3px solid rgba(0, 0, 0, .22);
    outline-offset: 3px;
}

.sldm-password-form {
    margin-top: 10px;
    padding: 14px;
    border: 1px solid var(--sldm-card-border, #e6e6e6);
    background: var(--sldm-accent-soft, #fff4e8);
}

.sldm-password-form[hidden] {
    display: none !important;
}

.sldm-password-form label,
.sldm-password-form label span {
    display: block;
}

.sldm-password-form label span {
    margin-bottom: 7px;
    font-size: 12px;
    font-weight: 600;
}

.sldm-password-form input {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid rgba(0, 0, 0, .20);
    border-radius: 0;
    background: #fff;
    font: inherit;
    letter-spacing: .16em;
}

.sldm-password-submit {
    min-height: 44px;
}

.sldm-empty {
    padding: 24px;
    border: 1px solid rgba(0, 0, 0, .10);
    background: rgba(0, 0, 0, .025);
}

/* 小さめPC / タブレット */
@media (max-width: 960px) {
    .sldm-items {
        gap: 18px;
    }

    .sldm-items > .sldm-download-box:nth-child(odd):last-child {
        width: calc((100% - 18px) / 2);
    }

    .sldm-download-box {
        padding: 22px 20px 21px;
    }
}

/* スマホ: 必ず1列 */
@media (max-width: 767px) {
    .sldm-category {
        margin-bottom: 48px;
    }

    .sldm-category-description {
        margin-bottom: 22px;
    }

    .sldm-items {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .sldm-items > .sldm-download-box:nth-child(odd):last-child {
        grid-column: auto;
        width: 100%;
        justify-self: stretch;
    }

    .sldm-download-box {
        padding: 20px 18px;
    }

    .sldm-title-line h3 {
        flex-basis: 180px;
    }

    .sldm-download-action {
        padding-top: 18px;
    }
}


/* v0.1.3β: 公開画面のバージョン・更新日 */
.sldm-version-stamp {
    display: flex;
    justify-content: flex-end;
    margin: 12px 0 0;
}

.sldm-version-stamp span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 11px;
    border-radius: 7px;
    background: #f2f2f2;
    color: #666;
    font-size: 12px;
    line-height: 1.4;
}

.sldm-version-stamp b {
    color: #999;
    font-weight: 400;
}

@media (max-width: 767px) {
    .sldm-version-stamp {
        justify-content: center;
        margin-top: 16px;
    }
}
