/*
 * 回答者サイトの見た目。配色と寸法は仮のデザイン(登録フォーム)に合わせている。確定したデザインが出たら差し替える
 * ライトテーマのみ。質問の入力欄はenquete-form.cssが持ち、ここは画面の枠と部品だけを持つ
 * 画面の幅は767px以下をスマホ、それより広ければPCとして扱う
 */
:root {
    color-scheme: light;

    --canvas: #f0f0f0;
    --surface: #ffffff;
    --subtle: #f6f6f6;
    --inverse: #000000;
    --border: #dddddd;
    --strong: #000000;

    --text: #000000;
    --text-secondary: #666666;
    --text-muted: #666666;
    --text-inverse: #ffffff;
    --text-inverse-secondary: #9a9a9a;
    --error: #e5484d;
    --error-bg: #fff1f1;

    /* クッキーの同意と規約の画面は系列サイトの配色のまま使う */
    --primary: #3892f3;
    --band: #f5f5f5;
    --page-width: 640px;

    --card-width: 800px;
    --card-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    /* カードが上の帯に食い込む高さ */
    --overlap: 140px;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--canvas);
}

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--canvas);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

img {
    pointer-events: none;
}

a {
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--strong);
    outline-offset: 2px;
}

/* ---- hero ---- */

.hero {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 80px 24px 200px;
    color: var(--text-inverse);
    /* アンケートごとの色は/{code}/theme.cssが変数で渡す */
    background: var(--hero-background, var(--inverse));
    text-align: center;
    overflow: hidden;
}

.hero-eyebrow {
    position: relative;
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.24em;
    color: var(--hero-label-color, var(--text-inverse-secondary));
}

/* 題名は管理者が入力する。長い題名でも帯からはみ出さないよう折り返す */
.hero-title {
    position: relative;
    width: 100%;
    margin: 0;
    max-width: 960px;
    font-size: 56px;
    font-weight: 900;
    line-height: 1.2;
    color: var(--hero-title-color, var(--text-inverse));
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* 行を分けた題名は長いので小さくし、1行目を添え書きとしてさらに小さくする */
.hero-title.is-multiline {
    font-size: 32px;
}

.hero-title.is-multiline::first-line {
    font-size: 24px;
}

/* 規約などアンケートに紐づかない画面の題名 */
.hero-title.is-page {
    font-size: 40px;
}

/* 管理者が入力した改行をそのまま見せる */
.hero-lead {
    position: relative;
    margin: 0;
    max-width: 640px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-inverse-secondary);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* ---- page ---- */

.page {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: calc(var(--overlap) * -1);
    padding: 0 16px 96px;
    /* 帯の飾り文字より手前に出す */
    position: relative;
}

.card {
    width: 100%;
    max-width: var(--card-width);
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
}

.form-card {
    display: flex;
    flex-direction: column;
    gap: 56px;
    padding: 56px 64px 64px;
}

.form-card > .ef {
    width: 100%;
}

.required-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.required-note .ef-badge {
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-inverse);
    background: var(--strong);
    border-radius: 3px;
}

.form-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.6;
    color: var(--error);
    background: var(--error-bg);
    border-radius: 10px;
    white-space: pre-line;
}

.form-alert img {
    flex: none;
    width: 16px;
    height: 16px;
    margin-top: 2px;
}

/* 案内文。管理者が改行で段落を分けて書くので、改行と空行をそのまま見せる */
.form-lead {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.7;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.form-lead + .required-note {
    margin-top: -24px;
}

/* 警告と必須の案内は続けて並べる。カードの大きな間隔を間に挟まない */
.form-alert + .form-alert,
.form-alert + .required-note {
    margin-top: -36px;
}

/* ---- consent ---- */

.consent {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 同意が足りないときの案内は、チェック欄のすぐ下に寄せる */
.consent > .ef-error {
    margin-top: -10px;
}

/* 全てにチェックを入れたらform.jsが隠す。.ef-errorのdisplay指定がhidden属性に勝つので明示する */
.consent > .ef-error[hidden] {
    display: none;
}

/* ---- buttons ---- */

.actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.actions form {
    display: contents;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 360px;
    min-height: 60px;
    padding: 8px 24px;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-inverse);
    background: var(--strong);
    border: 1.5px solid var(--strong);
    border-radius: 30px;
    text-decoration: none;
    cursor: pointer;
}

.button.is-outline {
    color: var(--text);
    background: var(--surface);
}

.button img {
    flex: none;
    width: 20px;
    height: 20px;
}

/* ---- mail verification ---- */

/* Enterで押される既定のボタン。画面には出さないが、display:noneにすると既定のボタンとして扱われないので画面の外に置く */
.default-submit {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* 確認したメールアドレスは書き換えさせない。送れない欄に見えないよう、文字は薄くしない */
.ef-input[readonly] {
    color: var(--text);
    background-color: var(--surface);
    cursor: default;
}

/* ---- confirm ---- */

.confirm .ef-section {
    margin-top: 48px;
    padding-bottom: 16px;
}

.confirm .ef-section:first-child {
    margin-top: 0;
}

.confirm-row {
    display: flex;
    gap: 24px;
    margin: 0;
    padding: 18px 0;
    line-height: 1.6;
}

.confirm-row + .confirm-row {
    border-top: 1px solid var(--border);
}

.confirm-row dt {
    flex: none;
    width: 180px;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* 回答者が入力した改行をそのまま見せる */
.confirm-row dd {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 15px;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.confirm-empty {
    color: #aaaaaa;
}

.confirm-agreed {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

/* ---- message(完了・案内・エラー) ---- */

.message-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 640px;
    padding: 64px;
    text-align: center;
}

.message-icon {
    width: 72px;
    height: 72px;
}

.message-icon.is-small {
    width: 56px;
    height: 56px;
}

.message-heading {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

/* 管理者が入力した改行と、文言ファイルの改行をそのまま見せる */
.message-body {
    margin: 0;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.message-notice {
    width: 100%;
    margin: 0;
    padding: 20px;
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-secondary);
    background: var(--subtle);
    border-radius: 12px;
    text-align: left;
    overflow-wrap: anywhere;
}

.message-notice code {
    display: block;
    margin-top: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--text);
    user-select: all;
}

.message-card .button {
    margin-top: 4px;
}

/* ---- reCAPTCHA ---- */

/* Googleが右下に固定で出すバッジ。クッキーの同意バナーと重なるので消し、代わりに.recaptcha-noticeを出す */
.grecaptcha-badge {
    visibility: hidden;
}

.recaptcha-notice {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    text-align: center;
}

.recaptcha-notice a {
    color: inherit;
    text-decoration: underline;
}

/* ---- footer ---- */

.site-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 24px 48px;
    color: var(--text-inverse-secondary);
    background: var(--inverse);
}

.footer-menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0 16px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
}

/* 区切りの縦線は項目の間にだけ出す */
.footer-menu li + li::before {
    content: "|";
    margin-right: 16px;
    font-size: 13px;
}

.footer-menu a {
    color: inherit;
    text-decoration: none;
}

.footer-copyright {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.06em;
}

/* ---- スマホ ---- */

@media (max-width: 767px) {
    :root {
        --overlap: 80px;
    }

    .hero {
        gap: 12px;
        padding: 56px 24px 144px;
    }

    .hero-title {
        font-size: 36px;
    }

    .hero-title.is-multiline {
        font-size: 20px;
    }

    .hero-title.is-multiline::first-line {
        font-size: 16px;
    }

    .hero-title.is-page {
        font-size: 28px;
    }

    .page {
        padding-bottom: 64px;
    }

    .card {
        border-radius: 16px;
    }

    .form-card {
        gap: 44px;
        padding: 32px 24px;
    }

    .form-alert + .form-alert,
    .form-alert + .required-note {
        margin-top: -28px;
    }

    .form-lead + .required-note {
        margin-top: -12px;
    }

    .confirm .ef-section {
        margin-top: 44px;
    }

    /* 狭い画面では見出しと回答を縦に積む */
    .confirm-row {
        flex-direction: column;
        gap: 4px;
        padding: 16px 0;
    }

    .confirm-row dt {
        width: auto;
        font-size: 12px;
    }

    .button {
        max-width: none;
    }

    .message-card {
        padding: 40px 24px;
    }

    .message-heading {
        font-size: 22px;
    }
}

/* ---- cookie consent ----
 *系列サイト(cookie-policy.css)と同じ寸法と配色。配色は系列サイトに揃えてテーマでは変えない
 *開閉はスクリプトを使わず、設定画面は:target、説明はdetailsで開く
 */
#cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    /* 本文の列からはみ出さない */
    max-width: var(--page-width);
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 2000;
    padding: 16px;
    overflow-y: auto;
}

/* バナーがフッターや送信ボタンに被らないよう、出ている間だけ下に逃がす */
body:has(#cookie-consent-banner) {
    padding-bottom: 136px;
}

.cookie-banner-container {
    display: flex;
    flex-direction: column;
    gap: 13px;
    justify-content: center;
}

.cookie-text {
    font-size: 0.875rem;
    color: #000;
    text-align: center;
    margin: 0;
}

.cookie-link {
    text-decoration: underline;
    color: #000;
    font-size: 0.875rem;
}

.cookie-action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.cookie-buttons {
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

.cookie-button-outline,
.cookie-button-solid {
    display: inline-flex;
    align-items: center;
    padding: 4px 20px;
    height: 32px;
    border-radius: 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.25;
    font-weight: 400;
    margin: 0;
    text-decoration: none;
}

.cookie-button-outline {
    background: #fff;
    border: 1px solid #000;
    color: #000;
}

.cookie-button-solid {
    background: #000;
    border: 1px solid #000;
    color: #fff;
}

.cookie-button-link {
    background: none;
    border: none;
    padding: 0;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    text-decoration: underline;
    color: #000;
}

.cookie-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2100;
    justify-content: center;
    align-items: center;
}

.cookie-modal:target {
    display: flex;
}

/* 開いている間は背面をスクロールさせない */
html:has(#cookie-settings:target) {
    overflow: hidden;
}

.cookie-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
}

.cookie-modal__content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: calc(100% - 64px);
    max-width: 320px;
    max-height: 70vh;
    margin: 0;
    overflow: hidden;
    background: #fff;
    color: #171717;
    border-radius: 16px;
}

.cookie-modal__header {
    position: relative;
    flex-shrink: 0;
    padding: 16px 20px;
    text-align: center;
}

.cookie-modal__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #171717;
}

.cookie-modal__close {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    display: flex;
    fill: #0000008a;
}

.cookie-modal__body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 24px 24px;
    font-size: 0.75rem;
    line-height: 1.4;
}

.cookie-modal__body > p {
    margin: 0;
}

.cookie-modal__divider {
    height: 0.8px;
    background-color: #000;
    border: none;
    margin: 16px 0;
}

.cookie-modal-accordion {
    position: relative;
    padding: 4px 0;
}

.cookie-modal-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    /* 説明を開く矢印の分だけ右を空ける */
    padding-right: 32px;
    cursor: pointer;
}

.cookie-modal-accordion-label {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
}

/* 矢印だけをsummaryにする。チェック欄までsummaryに入れると、チェックで説明も開閉してしまう */
.cookie-modal-accordion summary {
    position: absolute;
    top: 4px;
    right: 0;
    display: flex;
    list-style: none;
    fill: #0000008a;
    cursor: pointer;
}

.cookie-modal-accordion summary::-webkit-details-marker {
    display: none;
}

.cookie-modal-accordion details[open] summary {
    transform: scaleY(-1);
}

.cookie-modal-accordion-content {
    margin: 0;
    padding-top: 16px;
    font-size: 0.75rem;
}

.cookie-modal input[type="checkbox"].custom-checkbox {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin: 0;
    border: 2px solid #000;
    background: #fff center / 12px 12px no-repeat;
    cursor: pointer;
}

/*
 *「すべて同意」に付いている間は各欄も付いて見せる。送信を受けたサーバが全項目に広げるので見た目と結果は一致する
 *個別の欄は外せないように押せなくする
 */
.cookie-modal input[type="checkbox"].custom-checkbox:checked,
.cookie-modal:has(input[name="agreeAll"]:checked) .cookie-modal-accordion .custom-checkbox {
    background-color: #000;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
}

.cookie-modal:has(input[name="agreeAll"]:checked) .cookie-modal-accordion .custom-checkbox {
    pointer-events: none;
}

.cookie-modal input[type="checkbox"].custom-checkbox:disabled {
    cursor: default;
}

.cookie-modal__footer {
    display: flex;
    flex-shrink: 0;
    height: 48px;
}

.cookie-modal-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.cookie-modal-btn-cancel {
    background-color: rgba(0, 0, 0, 0.1);
    color: #171717;
}

.cookie-modal-btn-confirm {
    background-color: rgba(0, 0, 0, 0.9);
    color: #fff;
}

/* ---- terms, privacy, cookie policy ---- */

/* 寸法は系列サイトの規約画面に揃える。節の中は見出しと段落を詰めて並べる */
.policy {
    display: flex;
    flex-direction: column;
    gap: 20px;
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: 0.35px;
    overflow-wrap: anywhere;
}

.policy h2 {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 600;
}

.policy p {
    margin: 0;
}

.policy ul {
    margin: 0;
    padding-left: 1.2em;
}

.policy li + li {
    margin-top: 4px;
}

/* 項番を本文に「(1)」と書いているので記号は付けない */
.policy .policy-items {
    padding-left: 0;
    list-style: none;
}

.policy .policy-items li + li {
    margin-top: 0;
}

.policy a {
    color: var(--primary);
    text-decoration: underline;
}

/* 本文のリンクの色と下線がボタンに掛からないよう、ボタンでは打ち消す */
.policy .button {
    color: var(--text);
    text-decoration: none;
}

/* クッキー設定を開き直す入口。本文の読み物の締めなので、主の操作より控えめにする */
.policy-settings {
    align-self: center;
    max-width: 240px;
    min-height: 48px;
    margin-top: 16px;
    font-size: 14px;
    border-width: 1px;
    border-color: #c4c4c4;
    transition: border-color 0.15s, background-color 0.15s;
}

.policy-settings:hover {
    border-color: var(--strong);
    background: var(--subtle);
}

.policy-signature {
    font-weight: 600;
}

.policy-table-wrap {
    overflow-x: auto;
}

/* 本文の長いURL用の折り返しが効くと、クッキー名が途中で割れて列が詰まる */
.policy-table {
    overflow-wrap: normal;
    min-width: 640px;
    border-collapse: collapse;
    font-size: 12px;
    line-height: 18px;
}

.policy-table th,
.policy-table td {
    padding: 8px;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.policy-table th {
    background: var(--band);
    font-weight: 600;
    white-space: nowrap;
}

.policy-note,
.policy-updated {
    font-size: 12px;
    color: var(--text-muted);
}

.policy-updated {
    text-align: right;
}

/* 規約の画面はカードの中に本文を並べる */
.card.policy {
    padding: 56px 64px 64px;
}

@media (max-width: 767px) {
    .card.policy {
        padding: 32px 24px;
    }
}
