/* ================================
   Qreon Theme (append after Tailwind v4)
   ================================ */

/* ---- CSS variables ---- */
:root {
    --primary: #f23f33;
    --primary-hover: #e42117;
    --text: #0f0f0f;
    --container-max: 72rem;
    /* 1152px */
    --picker-label-w: 140px;
    /* 画像ピッカーのラベル列の幅 */
}

/* ---- Base / Page frame ---- */
html {
    /* スクロールバー有無でセンタリングがズレないように */
    /* scrollbar-gutter: stable both-edges; */
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;

    background: #f6f7f9;
    color: var(--text);
}

main,
.site-main {
    /* Tailwindの .mx-auto .max-w-* .px-* などと共存 */
    flex: 1 0 auto;
}

/* ---- Containers / Cards ---- */
.container-lg {
    margin-inline: auto;
    max-width: var(--container-max);
    padding-inline: 1rem;
}

.section {
    margin: 2rem auto;
}

.card-head {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eef1f5;
}

.card-head .h1 {
    margin: 0;
}

.card-head .meta {
    margin-top: 4px;
}

.card-elev {
    background: #fff;
    border: 1px solid #e9ebef;
    border-radius: 16px;
    padding: 20px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, .04),
        0 20px 40px -30px rgba(0, 0, 0, .25);
    width: 100%;
}

/* ---- Typography / Inputs ---- */
.h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -.01em;
}

.meta {
    color: #667085;
}

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

.label {
    font-size: 12px;
    color: #667085;
}

.input,
select {
    width: 100%;
    border: 1px solid #e6e8ee;
    background: #fff;
    color: #0f0f0f;
    padding: .55rem .9rem;
    border-radius: 12px;
    line-height: 1.2;
}

.input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 28%, transparent);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .55rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 14px;
    transition: .15s ease;
    border: 1px solid transparent;
    text-decoration: none;
    /* a.btn の下線を消す */
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 6px 14px -10px var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 28%, transparent);
}

.btn-ghost {
    background: transparent;
    color: #0f0f0f;
}

.btn-ghost:hover {
    background: #f2f3f7;
}

/* 小さめボタン */
.btn.btn-sm {
    padding: .4rem .8rem;
    font-size: 13px;
}

/* ---- “青っぽい”情報ボタン（サイト内共通） ---- */
.btn-info {
    color: #1d4ed8;
    background: rgba(37, 99, 235, .06);
    border: 1px solid rgba(37, 99, 235, .50);
}

.btn-info:hover {
    background: rgba(37, 99, 235, .12);
    border-color: rgba(37, 99, 235, .60);
    color: #1e40af;
}

.btn-info:active {
    background: rgba(37, 99, 235, .16);
}

.btn-info:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .22);
}

/* disabled の見た目を統一 */
.btn:disabled,
.btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-ghost:disabled,
.btn-ghost[disabled] {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #9ca3af;
}

.btn-primary:disabled,
.btn-primary[disabled] {
    background: #f59a96;
    border-color: #f59a96;
}

.btn-info:disabled,
.btn-info[disabled] {
    background: rgba(37, 99, 235, .05);
    border-color: rgba(37, 99, 235, .35);
    color: #9fb4ee;
}

/* ---- Image Picker ---- */
.image-picker {
    background: #fff;
    border: 1px solid #e9ebef;
    border-radius: 14px;
    margin: 10px 0;
    overflow: hidden;
}

/* summary を3列+矢印にして左右を揃える */
.image-picker>.picker-head {
    cursor: pointer;
    display: grid;
    grid-template-columns: var(--picker-label-w) 1fr auto 14px;
    /* ラベル / 状態 / 解除 / ▸ */
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    font-weight: 600;
    color: #0f0f0f;
    background: linear-gradient(180deg, #fbfcff, #f6f8fb);
    border-bottom: 1px solid #eef1f5;
    list-style: none;
}

.image-picker[open]>.picker-head {
    background: #fff;
}

.image-picker>.picker-head::-webkit-details-marker {
    display: none;
}

.image-picker>.picker-head::after {
    content: "";
    width: 10px;
    height: 10px;
    margin-left: 8px;
    border-right: 2px solid #9aa0a6;
    border-bottom: 2px solid #9aa0a6;
    transform: rotate(-45deg);
    transition: .18s;
    justify-self: end;
}

.image-picker[open]>.picker-head::after {
    transform: rotate(45deg);
}

.image-picker>.picker-head>strong {
    justify-self: start;
    white-space: nowrap;
}

.image-picker>.picker-head .state {
    justify-self: center;
    font-size: 12px;
    font-weight: 500;
    color: #667085;
}

/* グリッド（サムネイル部） */
.image-picker .picker-grid {
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 10px;
    padding: 12px;
}

.image-picker .picker-grid::-webkit-scrollbar {
    width: 8px;
}

.image-picker .picker-grid::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 6px;
}

.tile {
    background: #fff;
    border: 1px solid #eef1f5;
    border-radius: 12px;
    padding: 6px;
    transition: .15s;
}

.tile:hover {
    box-shadow: 0 10px 22px -18px rgba(0, 0, 0, .35);
    transform: translateY(-1px);
}

.tile.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 28%, transparent);
}

.imgbox {
    width: 100%;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.imgbox img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.idx {
    display: block;
    text-align: center;
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

/* スマホ時：状態行を2段目へ回す */
@media (max-width: 640px) {
    .image-picker>.picker-head {
        grid-template-columns: 1fr auto 14px;
        row-gap: 6px;
    }

    .image-picker>.picker-head .state {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

/* ---- Header (no-shift, full-width) ---- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    border-bottom: 1px solid #eef1f5;
    -webkit-font-smoothing: antialiased;
    width: 100%;
    /* ← 100vw は使わない */
}

.hdr-wrap {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 10px 16px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    /* 左ロゴ / 中央ナビ / 右スペーサ */
    align-items: center;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: #0f0f0f;
    text-decoration: none;
    padding-block: .25rem;
    /* 行高さを安定 */
}

.hdr-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    justify-self: center;
}

/* 寸法は常に確保。stateで太字・border幅を変えない */
.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: .5rem .75rem;
    line-height: 1;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    text-decoration: none;
    font-weight: 600;
    color: #3b3b3b;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

/* 通常 hover：濃い文字色でコントラストUP（枠は1pxのまま） */
.nav-link:hover {
    color: #111;
    background: #f3f5f8;
    border-color: #e5e7eb;
}

/* active：色だけ変える（枠1pxのまま） */
.nav-link.is-active {
    color: #e2211c;
    background: rgba(226, 33, 28, .12);
    border-color: rgba(226, 33, 28, .25);
}

/* active + hover：赤ベタ + 白文字で強コントラスト */
.nav-link.is-active:hover {
    color: #fff;
    background: #e2211c;
    border-color: #e2211c;
}

/* アクセシビリティ */
.nav-link:visited {
    color: inherit;
}

.nav-link:focus-visible {
    outline: none;
    border-color: rgba(226, 33, 28, .5);
    box-shadow: 0 0 0 3px rgba(226, 33, 28, .2);
}

/* ---- Footer ---- */
.site-footer {
    flex-shrink: 0;
    border-top: 1px solid #eef1f5;
    background: #f8fafc;
    margin-top: 48px;
}

.ftr-wrap {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ftr-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.ftr-links a {
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
}

.ftr-links a:hover {
    color: #111827;
    text-decoration: underline;
}

.copy {
    color: #9aa0a6;
    font-size: 12px;
}

/* ---- 小さめだけど押しやすい“リンク風ボタン”（共通） ---- */
.clear-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13.5px;
    line-height: 1;
    color: #1d4ed8;
    background: rgba(37, 99, 235, .06);
    border: 1px solid rgba(37, 99, 235, .50);
    padding: 6px 10px;
    min-height: 32px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
    justify-self: end;
}

.clear-link:hover {
    background: rgba(37, 99, 235, .12);
    border-color: rgba(37, 99, 235, .60);
    color: #1e40af;
}

.clear-link:active {
    background: rgba(37, 99, 235, .16);
}

.clear-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .22);
}

.site-header {
    outline: 1px solid red;
}

/* 枠だけ見えるボタン */
.btn-outline {
    background: transparent;
    color: #0f0f0f;
    border: 1px solid #e5e7eb;
}

.btn-outline:hover {
    background: #f3f5f8;
    border-color: #d1d5db;
}

.btn-outline:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(226, 33, 28, .2);
}

/* もし無効化する場合の見た目 */
.btn-outline:disabled,
.btn-outline[disabled] {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #9ca3af;
    opacity: 1;
    /* うすくしすぎない */
    cursor: not-allowed;
}