/* =========================
   ハロウィンテーマ（Midnight Gothic）
   - <html> に .theme-halloween が付くとテーマ対象（判定は index.html <head> 内スクリプト）
   - 実際の見た目は段階クラス .hw-a 〜 .hw-h が順に付くことで1要素ずつ変化する
     a: 写真がモノクロに / b: 紫の夜色 / c: クモの巣・クモ / d: コウモリ
     e: HALLOWEEN NIGHT / f: カボチャ / g: ヘッダー / h: ページ全体
   - 動きを減らす設定の端末では全段階を一度に付与（index.html 側で制御）
   ========================= */

:root {
    --hw-bg: #121016;
    --hw-panel: #1c1822;
    --hw-panel-2: #241d2e;
    --hw-line: #3a2f48;
    --hw-text: #ece6f2;
    --hw-muted: #b3a6c4;
    --hw-gold: #d8b56a;
    --hw-gold-light: #f0d496;
    --hw-purple: #6b4a8e;
    --hw-red: #f0a0a5;
    --hw-font-display: "Cinzel", var(--font-serif);
    --hw-ease: cubic-bezier(.22, .8, .3, 1);
}

/* 装飾はテーマOFF時は出さない */
.hw-deco {
    display: none;
}

/* ---------- 変化を滑らかにするトランジション ---------- */
.theme-halloween body,
.theme-halloween header,
.theme-halloween footer,
.theme-halloween .news,
.theme-halloween .news-inner,
.theme-halloween .news_list_item,
.theme-halloween .news_list_date time,
.theme-halloween .news_item,
.theme-halloween .news_toggle_btn,
.theme-halloween .sub_ttl,
.theme-halloween .blank,
.theme-halloween .advertisement,
.theme-halloween .sponsor-title,
.theme-halloween .about-section,
.theme-halloween .about-section span,
.theme-halloween .about_us,
.theme-halloween .about_us h2,
.theme-halloween .about_us p,
.theme-halloween .company-video,
.theme-halloween .service,
.theme-halloween .service-inner,
.theme-halloween .service_text h2,
.theme-halloween .service_text p,
.theme-halloween .access,
.theme-halloween .access span,
.theme-halloween .access_main,
.theme-halloween .menu-list li a {
    transition:
        background-color 1.4s ease,
        color 1.4s ease,
        border-color 1.4s ease,
        box-shadow .3s ease,
        transform .3s ease;
}

.theme-halloween .slide-image {
    transition: filter 1.8s ease;
}

.theme-halloween .hero-text h1 {
    transition: letter-spacing 1.6s var(--hw-ease), text-shadow 1.6s ease, -webkit-text-stroke-color 1.6s ease;
}

/* ---------- a: 写真がモノクロに沈む ---------- */
.theme-halloween.hw-a .hero-section {
    background: #0a080d;
}

.theme-halloween.hw-a .slide-image {
    filter: grayscale(1) brightness(.45);
}

/* ---------- 装飾レイヤー（テーマ時は常に配置し、段階ごとに出現） ---------- */
.theme-halloween .hw-deco {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

/* b: 紫の夜色 */
.hw-deco__shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(48, 20, 72, .45) 0%, rgba(18, 16, 22, .8) 100%);
    opacity: 0;
    transition: opacity 1.6s ease;
}

.hw-b .hw-deco__shade {
    opacity: 1;
}

.theme-halloween.hw-b .hero-text h1 {
    -webkit-text-stroke-color: transparent;
    letter-spacing: .08em;
    text-shadow: 0 6px 24px rgba(0, 0, 0, .7);
}

/* c: クモの巣が広がり、クモが降りてくる */
.hw-deco__web {
    position: absolute;
    top: 0;
    left: 0;
    width: 260px;
    height: 260px;
    opacity: 0;
    transform: scale(.3);
    transform-origin: top left;
    transition: opacity 1.2s ease, transform 1.4s var(--hw-ease);
}

.hw-c .hw-deco__web {
    opacity: .7;
    transform: scale(1);
}

.hw-deco__spider {
    position: absolute;
    top: -160px;
    left: 180px;
    width: 20px;
    height: 150px;
    transition: top 1.6s var(--hw-ease) .3s;
}

.hw-c .hw-deco__spider {
    top: 0;
    animation: hwSpider 6s ease-in-out 2s infinite;
}

/* d: コウモリが右から飛来 */
.hw-deco__bat {
    position: absolute;
    opacity: 0;
    transition: right 1.6s var(--hw-ease), opacity .8s ease;
}

.hw-deco__bat--1 {
    top: 18%;
    right: -80px;
    width: 52px;
}

.hw-deco__bat--2 {
    top: 30%;
    right: -60px;
    width: 34px;
    transition-delay: .25s;
}

.hw-d .hw-deco__bat {
    opacity: 1;
    animation: hwBat 7s ease-in-out 1.6s infinite;
}

.hw-d .hw-deco__bat--1 {
    right: 18%;
}

.hw-d .hw-deco__bat--2 {
    right: 9%;
    animation-delay: -1.4s;
}

/* e: HALLOWEEN NIGHT */
.hw-deco__label {
    position: absolute;
    top: 14%;
    left: 0;
    right: 0;
    margin: 0;
    text-align: center;
    font-family: var(--hw-font-display);
    font-size: 20px;
    letter-spacing: 1em;
    color: var(--hw-gold);
    opacity: 0;
    transition: opacity 1.4s ease, letter-spacing 1.8s var(--hw-ease);
}

.hw-e .hw-deco__label {
    opacity: 1;
    letter-spacing: .4em;
}

/* f: カボチャがぽんっと出る */
.hw-deco__pumpkin {
    position: absolute;
    right: 6%;
    bottom: 6%;
    width: 110px;
    height: 96px;
    opacity: 0;
    transform: scale(0) rotate(-20deg);
    transform-origin: bottom center;
    transition: opacity .4s ease, transform .8s cubic-bezier(.34, 1.56, .64, 1);
}

.hw-f .hw-deco__pumpkin {
    opacity: 1;
    transform: scale(1) rotate(0);
}

@keyframes hwSpider {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(14px); }
}

@keyframes hwBat {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-14px, 8px); }
}

@media (prefers-reduced-motion: reduce) {
    .hw-deco__spider,
    .hw-deco__bat {
        animation: none !important;
    }
}

@media (max-width: 768px) {
    .hw-deco__label {
        top: 10%;
        font-size: 13px;
    }

    .hw-e .hw-deco__label {
        letter-spacing: .25em;
    }

    .hw-deco__web {
        width: 150px;
        height: 150px;
    }

    .hw-deco__spider {
        left: 110px;
        height: 100px;
    }

    .hw-deco__pumpkin {
        width: 64px;
        height: 56px;
    }

    .hw-deco__bat--1 {
        width: 34px;
    }

    .hw-deco__bat--2 {
        width: 24px;
    }
}

/* ---------- g: ヘッダー（ロゴが濃色のため明るい藤色） ---------- */
.theme-halloween.hw-g header {
    background-color: #ece6f2;
    border-bottom: 2px solid var(--hw-gold);
}

.theme-halloween.hw-g .menu-list li a,
.theme-halloween.hw-g .submenu li a {
    color: #1c1822;
}

.theme-halloween.hw-g .menu-list li a:hover,
.theme-halloween.hw-g .submenu li a:hover {
    color: var(--hw-purple);
}

.theme-halloween.hw-g .hamburger div {
    background-color: var(--hw-purple);
}

.theme-halloween.hw-g .submenu,
.theme-halloween.hw-g nav ul.active {
    background-color: #ece6f2;
}

/* ---------- h: ページ全体 ---------- */
.theme-halloween.hw-h body {
    background-color: var(--hw-bg);
    color: var(--hw-text);
}

.theme-halloween.hw-h a {
    color: var(--hw-text);
}

.theme-halloween.hw-h .sub_ttl,
.theme-halloween.hw-h .blank {
    font-family: var(--hw-font-display);
    color: var(--hw-gold);
    letter-spacing: .2em;
}

/* NEWS */
.theme-halloween.hw-h .news {
    background-color: var(--hw-bg);
}

.theme-halloween.hw-h .news-inner {
    background-color: var(--hw-panel);
    border: 1px solid var(--hw-line);
    box-shadow: none;
}

.theme-halloween.hw-h .news_list_item {
    border-bottom: 1px solid var(--hw-line);
}

.theme-halloween.hw-h .news_list_item:first-child {
    border-top: 1px solid var(--hw-line);
}

.theme-halloween.hw-h .news_list_date time {
    color: var(--hw-muted);
}

/* ラベル：インライン指定の背景色より優先して枠線スタイルに */
.theme-halloween.hw-h .news_item {
    background: transparent !important;
    color: var(--hw-gold) !important;
    border: 1px solid var(--hw-gold);
    border-radius: 0 !important;
}

.theme-halloween.hw-h .news_list_item:first-child .news_item {
    color: var(--hw-red) !important;
    border-color: var(--hw-red);
}

/* 本文中リンク（インラインの赤・青は暗い背景で読みにくいため上書き） */
.theme-halloween.hw-h .news_list_item a {
    color: var(--hw-gold) !important;
}

.theme-halloween.hw-h .news_list_item:first-child a {
    color: var(--hw-red) !important;
}

.theme-halloween.hw-h .news_toggle_btn {
    color: var(--hw-gold);
    background: transparent;
    border-color: var(--hw-gold);
}

.theme-halloween.hw-h .news_toggle_btn:hover {
    color: var(--hw-bg);
    background: var(--hw-gold);
}

/* FAR-Pad / CTA */
.theme-halloween.hw-h .farpad-promo {
    background: linear-gradient(135deg, #241d2e 0%, #301448 100%);
}

.theme-halloween.hw-h .farpad-badge,
.theme-halloween.hw-h .farpad-cta {
    background: var(--hw-gold);
    color: #121016;
}

.theme-halloween.hw-h .farpad-cta:hover {
    background: var(--hw-gold-light);
}

.theme-halloween.hw-h .farpad-catch,
.theme-halloween.hw-h .cta-band-brand {
    color: var(--hw-gold);
}

.theme-halloween.hw-h .cta-band {
    background:
        linear-gradient(135deg, rgba(48, 20, 72, .92) 0%, rgba(18, 16, 22, .88) 100%),
        url('/img/hptop_01.jpg') center / cover no-repeat;
}

.theme-halloween.hw-h .btn-primary {
    background-color: var(--hw-gold);
    color: #121016;
}

.theme-halloween.hw-h .btn-primary:hover {
    background-color: var(--hw-gold-light);
    color: #121016;
}

/* 応援団体 */
.theme-halloween.hw-h .advertisement {
    background-color: var(--hw-panel-2);
}

.theme-halloween.hw-h .sponsor-title {
    color: var(--hw-text);
}

/* ご挨拶 */
.theme-halloween.hw-h .about-section {
    background-color: var(--hw-bg);
}

.theme-halloween.hw-h .about-section span {
    color: var(--hw-muted);
}

.theme-halloween.hw-h .about_us {
    background: var(--hw-panel);
    border-top-color: var(--hw-gold);
    box-shadow: none;
}

.theme-halloween.hw-h .about_us h2 {
    color: var(--hw-text);
}

.theme-halloween.hw-h .about_us p {
    color: var(--hw-muted);
}

/* 動画 */
.theme-halloween.hw-h .company-video {
    background-color: var(--hw-panel-2);
}

.theme-halloween.hw-h .company-video-inner span {
    color: var(--hw-muted);
}

/* サービス */
.theme-halloween.hw-h .service,
.theme-halloween.hw-h .service-inner {
    background-color: var(--hw-bg);
}

.theme-halloween.hw-h .service-item {
    background-color: var(--hw-panel);
    box-shadow: none;
    border-top-color: var(--hw-gold);
}

.theme-halloween.hw-h .service_text h2 {
    color: var(--hw-text);
}

.theme-halloween.hw-h .service_text p {
    color: var(--hw-muted);
}

/* アクセス */
.theme-halloween.hw-h .access {
    background-color: var(--hw-panel-2);
}

.theme-halloween.hw-h .access span {
    color: var(--hw-muted);
}

.theme-halloween.hw-h .access_main {
    background-color: var(--hw-panel);
    box-shadow: none;
    border: 1px solid var(--hw-line);
}

/* フッター */
.theme-halloween.hw-h footer {
    --footer-bg: #0a080d;
    --text-main: var(--hw-text);
    --btn-grad-start: #6b4a8e;
    --btn-grad-end: #3e2a56;
    --btn-glow: rgba(216, 181, 106, .45);
}

/* ロゴは濃色文字のため明るい台座を敷く */
.theme-halloween.hw-h .footer_logo {
    background: #ece6f2;
    border-radius: 6px;
    padding: 8px 12px;
    box-sizing: border-box;
}

.theme-halloween.hw-h .reserved {
    border-top-color: var(--hw-line);
}

/* ハロウィン誘導モーダル */
.theme-halloween.hw-h .hw-modal__panel {
    background: var(--hw-panel);
    color: var(--hw-text);
    border: 1px solid var(--hw-gold);
}

.theme-halloween.hw-h .hw-ribbon {
    background: var(--hw-gold);
    color: #121016;
}

.theme-halloween.hw-h .hw-title {
    color: var(--hw-text);
    font-family: var(--font-serif);
}

.theme-halloween.hw-h .hw-sub {
    color: var(--hw-muted);
}

.theme-halloween.hw-h .hw-badge {
    background: var(--hw-panel-2);
    color: var(--hw-text);
    box-shadow: none;
}

.theme-halloween.hw-h .hw-btn--play {
    background: var(--hw-gold);
    color: #121016 !important;
}

.theme-halloween.hw-h .hw-btn--play:visited {
    color: #121016 !important;
}

.theme-halloween.hw-h .hw-btn--later,
.theme-halloween.hw-h .hw-btn--hide {
    background: var(--hw-panel-2);
    color: var(--hw-text);
    border: 1px solid var(--hw-line);
}

.theme-halloween.hw-h .hw-close {
    color: var(--hw-text);
}

/* =========================
   カード演出（ホバー／タップで生き物が出てくる）
   - JSが各カードに .hw-card と生き物の要素を差し込む
   - 出し方は毎回ランダム：top=上辺の裏からクモ / side=右辺の裏からコウモリ / drop=上から糸でクモ
   ========================= */
.hw-peek,
.hw-drop {
    display: none;
}

.theme-halloween.hw-h main {
    overflow-x: clip;
    /* 右端カードの演出で横スクロールが出ないように */
}

.theme-halloween.hw-h .hw-card {
    position: relative;
}

/* 画像ズームの切り抜きはカードではなく画像側で行い、カード外へ生き物を出せるようにする */
.theme-halloween.hw-h .service-item.hw-card {
    overflow: visible;
}

.theme-halloween.hw-h .service-item.hw-card .service_img {
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
}

.theme-halloween.hw-h .hw-peek,
.theme-halloween.hw-h .hw-drop {
    display: block;
    position: absolute;
    pointer-events: none;
    z-index: 3;
}

/* top：上辺の裏からクモが顔を出してササッと走る */
.hw-peek--top {
    bottom: 100%;
    right: 16px;
    width: 140px;
    height: 34px;
    overflow: hidden;
}

.hw-peek--top .hw-spider {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 36px;
    transform: translate(0, 110%);
    transition: transform .3s ease;
}

.hw-card--top .hw-peek--top .hw-spider {
    animation: hwPeekTop 1s var(--hw-ease) forwards;
}

@keyframes hwPeekTop {
    0% { transform: translate(0, 110%); }
    30% { transform: translate(0, 18%); }
    45% { transform: translate(0, 18%); }
    75% { transform: translate(-80px, 18%); }
    100% { transform: translate(-64px, 18%); }
}

/* side：右辺の裏からコウモリが飛び出す */
.hw-peek--side {
    left: 100%;
    top: 20px;
    width: 52px;
    height: 44px;
    overflow: hidden;
}

.hw-peek--side .hw-bat {
    position: absolute;
    left: 0;
    top: 8px;
    width: 44px;
    transform: translateX(-110%);
    transition: transform .3s ease;
}

.hw-card--side .hw-peek--side .hw-bat {
    animation: hwPeekSide .8s var(--hw-ease) forwards, hwFlap .18s ease-in-out .8s 6 alternate;
}

@keyframes hwPeekSide {
    0% { transform: translateX(-110%) rotate(0); }
    60% { transform: translateX(12%) rotate(-12deg); }
    100% { transform: translateX(4%) rotate(-6deg); }
}

@keyframes hwFlap {
    from { transform: translateX(4%) rotate(-6deg) scaleY(1); }
    to { transform: translateX(4%) rotate(-6deg) scaleY(.6); }
}

/* drop：上から糸を垂らしてクモが降りてくる */
.hw-drop {
    left: 22%;
    top: -70px;
    width: 30px;
    height: 130px;
}

.hw-drop__thread {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: var(--hw-muted);
    transform: scaleY(0);
    transform-origin: top center;
    transition: transform .5s ease;
}

.hw-drop .hw-spider {
    position: absolute;
    left: -6px;
    bottom: -18px;
    width: 42px;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .6));
    opacity: 0;
    transform: translateY(-130px);
    transition: transform .3s ease, opacity .2s ease;
}

.hw-card--drop .hw-drop__thread {
    transform: scaleY(1);
}

.hw-card--drop .hw-drop .hw-spider {
    opacity: 1;
    animation: hwDrop 1.4s cubic-bezier(.34, 1.4, .64, 1) forwards;
}

@keyframes hwDrop {
    0% { transform: translateY(-130px); }
    55% { transform: translateY(6px); }
    75% { transform: translateY(-6px); }
    100% { transform: translateY(0); }
}

/* クモの脚をカサカサ動かす */
.hw-spider__legs {
    transform-origin: center;
}

.hw-card--top .hw-spider__legs,
.hw-card--drop .hw-spider__legs {
    animation: hwLegs .12s linear 8 alternate;
}

@keyframes hwLegs {
    from { transform: scaleX(1); }
    to { transform: scaleX(.85); }
}

@media (prefers-reduced-motion: reduce) {
    .hw-peek,
    .hw-drop {
        display: none !important;
    }
}

/* =========================
   通常表示に戻す／ハロウィン表示にする ボタン
   ========================= */
.hw-toggle {
    display: none;
}

.theme-halloween .hw-toggle {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 9500;
    /* モーダル(11000)より下 */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 999px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--color-primary);
    background: #ffffff;
    color: var(--color-primary);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    transition: background-color 1s ease, color 1s ease, border-color 1s ease, transform .2s ease;
}

.theme-halloween.hw-h .hw-toggle {
    border-color: var(--hw-gold);
    background: var(--hw-panel);
    color: var(--hw-gold);
}

.theme-halloween .hw-toggle:hover {
    transform: translateY(-2px);
}

.theme-halloween .hw-toggle:focus-visible {
    outline: 3px solid var(--hw-gold);
    outline-offset: 3px;
}

.hw-toggle svg {
    width: 18px;
    height: 18px;
    flex: none;
}

@media (max-width: 560px) {
    .theme-halloween .hw-toggle {
        left: 12px;
        bottom: 12px;
        padding: 8px 14px;
        font-size: 13px;
    }
}
