/* =========================================================
   神龍阿弥 占いの館 — 共通デザイン基盤
   index.html / member.html / mttop.html の全画面で読み込む。
   Tailwind CDN より先に読み込むこと（ユーティリティで上書き可能にするため）。
   ========================================================= */

:root {
    /* --- 面（背景・カード） --- */
    --c-night: #12173a;
    --c-night-deep: #0b0f19;
    --c-mystic: #1e1b4b;
    --c-plum: #501c7e;
    --c-wine: #86154c;

    /* --- アクセント --- */
    --c-gold: #c5a059;
    --c-gold-bright: #e3c583;
    --c-gold-deep: #8f7038;
    --c-pink: #fb7185;
    --c-purple: #818cf8;

    /* --- 文字 --- */
    --c-text: #f5f3ef;
    --c-text-muted: #b9bdcf;
    --c-text-faint: #7d829a;

    /* --- 罫線 --- */
    --line-soft: rgba(255, 255, 255, 0.08);
    --line: rgba(255, 255, 255, 0.14);
    --line-gold: rgba(197, 160, 89, 0.32);

    /* --- 角丸（4段階に統一） --- */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 20px;
    --r-full: 999px;

    /* --- 影（3段階に統一。多用しない） --- */
    --sh-1: 0 1px 2px rgba(0, 0, 0, .28);
    --sh-2: 0 8px 24px rgba(0, 0, 0, .34);
    --sh-3: 0 20px 56px rgba(0, 0, 0, .46);

    /* --- 動き --- */
    --ease: cubic-bezier(.22, .61, .36, 1);
    --dur: .28s;

    /* --- レイアウト --- */
    --nav-h: 64px;
    --ticker-h: 32px;
    --tap: 44px; /* 最小タップ領域 */
}

/* =========================================================
   ベース
   ========================================================= */
html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + var(--ticker-h) + 8px);
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: linear-gradient(180deg, #12173a 0%, #1a2254 30%, #312070 60%, #501c7e 85%, #86154c 100%);
    background-attachment: fixed;
    color: var(--c-text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.75;
}

/* iOS のセーフエリア（ノッチ・ホームインジケータ）を避ける */
body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.font-mincho { font-family: 'Zen Old Mincho', serif; }
.font-cinzel { font-family: 'Cinzel', serif; }

/* 見出しは和文明朝＋詰め気味。本文は仮名間隔を広めに取り可読性を確保 */
h1, h2, h3 {
    font-family: 'Zen Old Mincho', serif;
    line-height: 1.45;
    letter-spacing: .04em;
}

/* =========================================================
   フォーカス可視化（キーボード操作の必須要件）
   ========================================================= */
:focus-visible {
    outline: 2px solid var(--c-gold-bright);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* =========================================================
   タイポスケール（PC / スマホで自動追従）
   clamp により、375px〜1440px の間で滑らかに変化させる。
   ========================================================= */
.t-display { font-size: clamp(2rem, 1.35rem + 2.8vw, 3.5rem); line-height: 1.3; letter-spacing: .06em; }
.t-h1      { font-size: clamp(1.6rem, 1.2rem + 1.7vw, 2.5rem); line-height: 1.4; }
.t-h2      { font-size: clamp(1.3rem, 1.05rem + 1.1vw, 1.875rem); line-height: 1.45; }
.t-h3      { font-size: clamp(1.05rem, .95rem + .5vw, 1.25rem); line-height: 1.55; }
.t-body    { font-size: clamp(.9375rem, .9rem + .2vw, 1rem); line-height: 1.85; }
.t-sm      { font-size: .875rem; line-height: 1.7; }
.t-xs      { font-size: .75rem; line-height: 1.6; letter-spacing: .04em; }

/* セクション見出しの上に置く英字ラベル */
.t-eyebrow {
    font-family: 'Cinzel', serif;
    font-size: .6875rem;
    letter-spacing: .34em;
    text-transform: uppercase;
    color: var(--c-gold);
}

/* =========================================================
   レイアウト
   ========================================================= */
.l-container {
    width: 100%;
    max-width: 1120px;
    margin-inline: auto;
    padding-inline: clamp(1rem, .4rem + 2.5vw, 2rem);
}
.l-container-narrow { max-width: 768px; }

/* セクションの縦リズム。スマホでは詰め、PCでは広く取る */
.l-section { padding-block: clamp(3.5rem, 2rem + 7vw, 7rem); }
.l-section-sm { padding-block: clamp(2rem, 1.25rem + 3.5vw, 3.5rem); }

/* =========================================================
   面（カード・パネル）
   glass-panel は既存クラス名を維持しつつ、影と枠を統一トークンへ寄せる
   ========================================================= */
.glass-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, .055) 0%, rgba(255, 255, 255, .015) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--line);
    box-shadow: var(--sh-2);
}

.u-card {
    background: linear-gradient(160deg, rgba(255, 255, 255, .06) 0%, rgba(255, 255, 255, .02) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-2);
    transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
/* ホバーは「持ち上げ」を控えめに。マウス環境でのみ効かせる */
@media (hover: hover) {
    .u-card-interactive:hover {
        transform: translateY(-4px);
        border-color: var(--line-gold);
        box-shadow: var(--sh-3);
    }
}

/* 金の細い罫線。区切りとして装飾を最小限に */
.u-rule-gold {
    height: 1px;
    border: 0;
    background: linear-gradient(90deg, transparent, var(--line-gold) 50%, transparent);
}

/* =========================================================
   ボタン
   すべて最小タップ領域 44px を満たす。
   ========================================================= */
.u-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5em;
    min-height: var(--tap);
    padding: .75rem 1.75rem;
    border-radius: var(--r-full);
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1.4;
    text-align: center;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
                background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), filter var(--dur) var(--ease);
}
.u-btn:disabled,
.u-btn[aria-disabled="true"] {
    background: #4b5563;
    box-shadow: none;
    filter: none;
    cursor: not-allowed;
    opacity: .65;
    transform: none;
}
.u-btn:active:not(:disabled) { transform: scale(.97); }

/* 主要導線（予約する等）。1画面に1つを原則とする */
.u-btn-primary {
    background: linear-gradient(135deg, #be185d 0%, #f59e0b 100%);
    color: #fff;
    border: 0;
    box-shadow: 0 4px 18px rgba(190, 24, 93, .38);
}
@media (hover: hover) {
    .u-btn-primary:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(245, 158, 11, .5);
        filter: brightness(1.06);
    }
}

/* 副次導線 */
.u-btn-secondary {
    background: rgba(255, 255, 255, .04);
    color: var(--c-text);
    border: 1px solid var(--line-gold);
}
@media (hover: hover) {
    .u-btn-secondary:hover:not(:disabled) {
        background: rgba(197, 160, 89, .14);
        border-color: var(--c-gold);
    }
}

/* 補助導線（テキストのみ） */
.u-btn-ghost {
    background: transparent;
    color: var(--c-text-muted);
    border: 0;
    padding-inline: 1rem;
}
@media (hover: hover) {
    .u-btn-ghost:hover:not(:disabled) { color: var(--c-gold-bright); }
}

/* 既存の .btn-dawn は .u-btn-primary と同義。旧マークアップ互換のため残す。
   ギラつきを抑えるため、常時走っていた shimmer は削除した。 */
.btn-dawn {
    background: linear-gradient(135deg, #be185d 0%, #f59e0b 100%);
    box-shadow: 0 4px 18px rgba(190, 24, 93, .38);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), filter var(--dur) var(--ease);
    position: relative;
    overflow: hidden;
    min-height: var(--tap);
}
@media (hover: hover) {
    .btn-dawn:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(245, 158, 11, .5);
        filter: brightness(1.06);
    }
}
.btn-dawn:active:not(:disabled) { transform: scale(.97); }
.btn-dawn:disabled { background: #4b5563; box-shadow: none; cursor: not-allowed; opacity: .65; }

/* =========================================================
   フォーム
   ========================================================= */
input, select, textarea {
    font-size: 16px !important; /* iOS Safari の自動ズーム防止 */
}

.u-field {
    width: 100%;
    min-height: var(--tap);
    background: rgba(0, 0, 0, .42);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: .75rem 1rem;
    color: var(--c-text);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.u-field::placeholder { color: var(--c-text-faint); }
.u-field:focus {
    outline: none;
    border-color: var(--c-gold);
    box-shadow: 0 0 0 3px rgba(197, 160, 89, .22);
    background: rgba(0, 0, 0, .55);
}
.u-field-label {
    display: block;
    margin-bottom: .5rem;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .12em;
    color: var(--c-gold);
}

select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23c5a059' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right .5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* =========================================================
   文字装飾（発光は「ここぞ」だけに絞る）
   ========================================================= */
.text-glow { text-shadow: 0 0 12px rgba(255, 255, 255, .45); }
.text-glow-gold { text-shadow: 0 0 14px rgba(197, 160, 89, .55); }
.text-shadow { text-shadow: 0 2px 8px rgba(0, 0, 0, .8); }

/* =========================================================
   スクロールバー
   ========================================================= */
.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: rgba(0, 0, 0, .3); border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .32); border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .5); }
.admin-theme .custom-scrollbar::-webkit-scrollbar-track { background: #1a202c; }
.admin-theme .custom-scrollbar::-webkit-scrollbar-thumb { background: #4a5568; }

/* 横スクロールする表・カード列は、はみ出しをこの中に閉じ込める */
.u-scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

/* スマホでカードを横送りする際のスナップ */
.u-snap-x {
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 1rem;
}
.u-snap-x > * { scroll-snap-align: start; }

/* =========================================================
   ナビゲーション
   ========================================================= */
.mobile-nav-enter {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height .4s var(--ease), opacity .28s var(--ease);
}
.mobile-nav-enter-active {
    max-height: 560px;
    opacity: 1;
}

/* =========================================================
   本文（コラム等）
   ========================================================= */
.prose h2, .prose h3 { font-family: 'Zen Old Mincho', serif; }
.prose p { margin-bottom: 1.5em; line-height: 1.9; color: var(--c-text-muted); }

/* =========================================================
   初期ローディング（魔法陣）
   index.html / member.html / mttop.html 共通
   ========================================================= */
#initial-loader {
    position: fixed;
    inset: 0;
    background-color: var(--c-night);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity .6s ease-out;
}
.mystic-magic-circle { width: 150px; height: 150px; position: relative; }
.draw-magic path, .draw-magic circle, .draw-magic polygon {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: draw 2.5s cubic-bezier(.25, 1, .5, 1) forwards;
}
.spin-slow { transform-origin: 50px 50px; animation: spin 20s linear infinite; animation-delay: 1.5s; }
.spin-reverse { transform-origin: 50px 50px; animation: spin-back 14s linear infinite; animation-delay: 1.5s; }
.spin-fast { transform-origin: 50px 50px; animation: spin 9s linear infinite; animation-delay: 1.5s; }
.pulse-center { transform-origin: 50px 50px; animation: breathe 3.5s ease-in-out infinite; }
.brand-text {
    color: var(--c-gold);
    margin-top: 36px;
    font-family: 'Cinzel', serif;
    letter-spacing: .4em;
    font-size: 13px;
    font-weight: 600;
    animation: text-pulse 2s ease-in-out infinite alternate;
    text-shadow: 0 0 10px rgba(197, 160, 89, .5);
}
.sub-loading-text {
    color: rgba(197, 160, 89, .4);
    margin-top: 8px;
    font-family: 'Cinzel', serif;
    letter-spacing: .6em;
    font-size: 8px;
    animation: text-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes spin-back { from { transform: rotate(360deg); } to { transform: rotate(0deg); } }
@keyframes breathe {
    0%, 100% { transform: scale(.95); opacity: .6; }
    50% { transform: scale(1.05); opacity: 1; filter: drop-shadow(0 0 10px rgba(197, 160, 89, .7)); }
}
@keyframes text-pulse { from { opacity: .4; } to { opacity: 1; } }

/* =========================================================
   アクセシビリティ：視覚的には隠すがスクリーンリーダーには読ませる
   ========================================================= */
.u-visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================================================
   動きを減らす設定への追従（OS 設定を尊重する）
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}
