/*
 * 求人詳細（resources/views/client/jobdetail.blade.php）の部品。共通の部品は base.css。
 * 部品の名前と、写真・ロゴ・特徴タグが無いときの見え方は docs/design/applicant-redesign/01-job-pages.md。
 */

/* ページ内リンク（#reservation など）の行き先が、固定したヘッダーの下に隠れないようにする */
.ap-jd [id] {
    scroll-margin-top: 76px;
}

/* ---- 上の写真（is-broken は img の onerror が付ける。読めない写真は区画ごと隠す） ---- */
.ap-jd-hero {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: var(--brand-tint);
}

@supports not (aspect-ratio: 1 / 1) {
    .ap-jd-hero {
        height: 62.5vw;
    }
}

.ap-jd-hero.is-broken {
    display: none;
}

.ap-jd-hero__img {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* PC で写真の全体を見せるときの背景（同じ写真をぼかして敷く）。スマホでは使わない */
.ap-jd-hero__backdrop {
    display: none;
}

.ap-jd-hero__count {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    text-decoration: none;
}

.ap-page a.ap-jd-hero__count,
.ap-page a.ap-jd-hero__count:hover {
    color: #ffffff;
    text-decoration: none;
}

.ap-jd-hero__count .ap-icon {
    width: 15px;
    height: 15px;
}

/* ---- 帯（職種名・会社名・雇用形態・特徴・要点） ---- */
.ap-jd-band {
    padding: 18px 0 20px;
}

/* 写真が無い・読めないときは帯が最初の面になるので、上を広く取る */
.ap-jd-band--lead,
.ap-jd-hero.is-broken + .ap-jd-band {
    padding-top: 28px;
}

/* 職種名が空でも 1 行分の高さを取り、会社名を左上の飾りの円（半径 80px）より下に保つ */
.ap-jd-title {
    min-height: 1.4em;
    margin: 10px 0 6px;
    color: #ffffff;
    font-size: 24px;
    font-weight: 900;
    line-height: 1.4;
    letter-spacing: 0.02em;
    /* 日本語は文節で折り返す（対応していないブラウザは従来どおり文字の間で折り返す） */
    word-break: auto-phrase;
    text-wrap: balance;
}

.ap-jd-company {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
}

.ap-jd-company .ap-icon {
    width: 16px;
    height: 16px;
    color: var(--brand-marker);
}

.ap-jd-head__facts {
    margin-top: 16px;
}

/* ---- スマホで帯のすぐ下に出す電話・応募ボタン（PC は右のカードに出す） ---- */
/* 電話番号の列は 50 文字までの文字列なので、長い値でも応募ボタンを押しつぶさないよう幅を割合で決める */
.ap-jd-cta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 8px;
    padding-top: 16px;
}

.ap-jd-cta .ap-btn--tel {
    padding-inline: 10px;
    overflow-wrap: anywhere;
}

.ap-jd-cta--apply-only {
    grid-template-columns: 1fr;
}

/* ---- 本文と右のカード ---- */
.ap-jd-layout {
    display: block;
}

.ap-jd-aside {
    display: none;
}

.ap-jd-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0 0;
}

.ap-jd-gallery > li {
    overflow: hidden;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    background: var(--brand-tint);
}

.ap-jd-gallery > li.is-broken {
    display: none;
}

.ap-jd-gallery a {
    display: block;
    height: 100%;
}

.ap-jd-gallery img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 募集要項（項目名の下に値。PC は左右） */
.ap-dl {
    display: flex;
    flex-direction: column;
    margin: 0;
}

.ap-dl > div {
    display: grid;
    gap: 4px;
    padding: 12px 0;
    border-top: 1px solid #eef0ec;
}

.ap-dl > div:first-child {
    padding-top: 0;
    border-top: 0;
}

.ap-dl > div:last-child {
    padding-bottom: 0;
}

.ap-dl dt {
    color: var(--brand-ink-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.ap-dl dd {
    margin: 0;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.ap-dl dd a {
    color: var(--brand-deep);
    font-weight: 700;
}

/* 採用担当者から */
.ap-jd-msg {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    background: var(--brand-tint);
    color: var(--brand-ink);
}

.ap-jd-msg__avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand-marker);
    color: var(--brand-ink);
}

.ap-jd-map {
    width: 100%;
    margin-top: 14px;
}

/* ---- WEB 応募のフォーム（項目名・送信先・入力チェックは旧画面と同じ。入力チェックの表示は bootstrap-validator が
   .form-group に .has-error を付け、.help-block.with-errors に文言を入れる） ---- */
.ap-jd-apply__card {
    padding: 18px;
}

.ap-jd-apply__lead {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--brand-tint);
    color: var(--brand-ink);
    font-size: 13px;
    font-weight: 700;
}

.ap-jd-apply__lead .ap-icon {
    color: var(--brand-deep);
}

.ap-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ap-form__two {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.ap-form__three {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
}

.ap-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

.ap-field__label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: #2a2d27;
    font-size: 13px;
    font-weight: 700;
}

.ap-req,
.ap-opt {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* 白文字 5.13:1 */
.ap-req {
    background: #c2412f;
    color: #ffffff;
}

.ap-opt {
    background: #ffffff;
    color: #4f554b;
    box-shadow: inset 0 0 0 1px #8c9188;
}

/* 文字の大きさは 16px（iPhone で入力欄を押したときに画面が拡大しないように）。枠は白地に 3.22:1（入力欄の境目の基準 3:1） */
.ap-input {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1.5px solid #8c9188;
    border-radius: 10px;
    background: #ffffff;
    color: #2a2d27;
    font: inherit;
    font-size: 16px;
    line-height: 1.5;
}

textarea.ap-input {
    min-height: 96px;
    resize: vertical;
}

.ap-input:focus {
    outline: none;
    border-color: var(--brand-deep);
    box-shadow: 0 0 0 3px var(--brand-marker);
}

.ap-input::placeholder {
    color: #6b7067;
}

.has-error .ap-input {
    border-color: #c2412f;
}

.ap-field .help-block {
    margin: 0;
    color: #b3261e;
    font-size: 12px;
    font-weight: 700;
}

.ap-field .help-block ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ap-field .help-block:empty {
    display: none;
}

.ap-form__agree {
    margin: 4px 0 0;
    color: #4f554b;
    font-size: 12px;
    text-align: center;
}

.ap-form__agree a {
    color: var(--brand-ink);
    font-weight: 700;
}

.ap-form__submit {
    width: 100%;
    min-height: 54px;
    font-size: 16px;
}

/* メールアドレスの確認を待つ間（二重送信の止め。disabled 属性） */
.ap-form__submit:disabled {
    opacity: 0.7;
    cursor: progress;
}

/* bootstrap-validator は入力が足りない間、送信ボタンに .disabled を付ける。押すと足りない欄を案内する作りなので、
   見た目は変えない（入力の前から薄いと、押せないように見える） */

/* ---- 確認・完了の画面（<dialog>） ---- */
.ap-dialog {
    width: min(92vw, 420px);
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: #ffffff;
    color: #2a2d27;
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.45);
}

.ap-dialog:not([open]) {
    display: none;
}

/* <dialog> を知らないブラウザでも画面の中央に出す（showModal が無いときは open 属性だけを付ける） */
.ap-dialog[open] {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    height: fit-content;
    margin: auto;
}

.ap-dialog::backdrop {
    background: rgba(20, 22, 18, 0.55);
}

.ap-dialog__inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 22px 20px 18px;
}

.ap-dialog__title {
    margin: 0;
    color: var(--brand-ink);
    font-size: 18px;
    font-weight: 900;
    line-height: 1.5;
}

.ap-dialog__body {
    font-size: 15px;
    line-height: 1.8;
}

.ap-dialog__note {
    margin: 4px 0 0;
    color: #4f554b;
    font-size: 13px;
}

.ap-dialog__actions {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 8px;
    margin-top: 4px;
}

.ap-dialog--done .ap-dialog__inner {
    align-items: center;
    text-align: center;
}

.ap-dialog--done .ap-dialog__actions {
    align-self: stretch;
}

.ap-dialog__mark {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand-tint);
    color: var(--brand-deep);
}

.ap-dialog__mark .ap-icon {
    width: 28px;
    height: 28px;
    stroke-width: 2.4;
}

@media (min-width: 768px) {
    .ap-jd-hero {
        aspect-ratio: auto;
        height: 360px;
    }

    .ap-jd-hero__backdrop {
        position: absolute;
        top: -24px;
        right: -24px;
        bottom: -24px;
        left: -24px;
        display: block;
        width: calc(100% + 48px);
        height: calc(100% + 48px);
        object-fit: cover;
        filter: blur(24px) brightness(0.92);
    }

    .ap-jd-hero__img {
        object-fit: contain;
    }

    .ap-jd-band {
        padding: 30px 0 28px;
    }

    .ap-jd-band--lead,
    .ap-jd-hero.is-broken + .ap-jd-band {
        padding: 44px 0 36px;
    }

    .ap-jd-head {
        display: grid;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
        column-gap: 32px;
        align-items: end;
    }

    .ap-jd-head__facts {
        margin-top: 0;
    }

    .ap-jd-title {
        font-size: 30px;
    }

    .ap-jd-cta {
        display: none;
    }

    .ap-jd-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        gap: 28px;
        align-items: start;
    }

    .ap-jd-aside {
        position: sticky;
        top: 88px;
        display: block;
        margin-top: 26px;
    }

    .ap-jd-aside .ap-card {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .ap-jd-aside__title {
        margin: 0;
        color: var(--brand-ink);
        font-size: 17px;
        font-weight: 900;
        line-height: 1.5;
        word-break: auto-phrase;
    }

    .ap-dl > div {
        grid-template-columns: 160px 1fr;
        gap: 16px;
    }

    .ap-jd-map {
        width: auto;
    }

    .ap-jd-apply__card {
        padding: 24px;
    }

    .ap-form__two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ap-form__submit {
        width: auto;
        min-width: 320px;
        align-self: center;
    }
}
