/* =============================================
   base.css — リセット・CSS変数・共通スタイル
   ============================================= */

/* --- CSS カスタムプロパティ（テーマ変数） --- */
:root {
    --bg:           #111111;
    --bg-card:      #1e1e1e;
    --bg-surface:   #252525;
    --border:       #3a3a3a;   /* 旧: #333333 — カード境界を少し見やすく */
    --border-light: #505050;   /* 旧: #444444 */

    --text:         #e2e2e2;
    --text-muted:   #a0a0a0;   /* 旧: #888888 — WCAG AA コントラスト比 6:1以上に改善 */
    --text-strong:  #ffffff;

    --accent:       #e91e8c;
    --accent-dark:  #c2176f;
    --accent-light: #ff4db8;

    --badge-new:    #ff5722;
    --badge-sale:   #4caf50;

    --radius-sm:    6px;
    --radius-md:    10px;
    --radius-lg:    16px;

    --shadow:       0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-lg:    0 4px 20px rgba(0, 0, 0, 0.7);

    --transition:   0.2s ease;

    --header-h:     52px;
    --max-width:    1080px;
}

/* --- リセット --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
                 "Noto Sans JP", "Yu Gothic", sans-serif;
    line-height: 1.6;
    min-height: 100dvh;
    overflow-x: hidden;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: var(--accent-light);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent);
}

ul, ol {
    list-style: none;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

/* --- キーボードフォーカス（アクセシビリティ・Lighthouse 対策） --- */
:focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 2px;
    border-radius: 3px;
}

/* --- スクロールバー（Webkit） --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

/* --- ユーティリティ --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-muted   { color: var(--text-muted); }
.text-accent  { color: var(--accent-light); }
.text-strong  { color: var(--text-strong); font-weight: 700; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }

.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }

/* --- バッジ --- */
.badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.4;
}

.badge--new  { background: var(--badge-new);  color: #fff; }
.badge--sale { background: var(--badge-sale); color: #fff; }
.badge--genre {
    background: rgba(233, 30, 140, 0.25);  /* 旧: 0.15 — 背景を濃くして白文字と対比 */
    color: #ffffff;                          /* 旧: accent-light — ピンク on ピンクを解消 */
    border: 1px solid rgba(233, 30, 140, 0.5);
}

/* --- ボタン --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
    transition: background var(--transition), transform var(--transition), opacity var(--transition);
    min-height: 44px;
    cursor: pointer;
    border: none;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn--primary {
    background: var(--accent);
    color: #fff;
}
.btn--primary:hover { background: var(--accent-dark); color: #fff; }

.btn--ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-light);
}
.btn--ghost:hover { background: var(--bg-surface); color: var(--text); }

.btn--block { width: 100%; }

/* --- ローディングスピナー --- */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- 空ステート --- */
.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state__icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}
.empty-state__text {
    font-size: 0.95rem;
}
