/* =========================================================================
   Visionary theme — modern base styles
   ライト/ダーク両対応。デザイントークン → 要素 → コンポーネントの順。
   ========================================================================= */

:root {
    /* palette (light) */
    --bg: #ffffff;
    --surface: #f8fafc;
    --surface-2: #f1f5f9;
    --fg: #0f172a;
    --muted: #64748b;
    --border: #e5e9f0;
    --accent: #4f46e5;
    --accent-2: #06b6d4;
    --accent-fg: #ffffff;
    --ring: rgba(79, 70, 229, .35);

    /* shape & depth */
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
    --shadow: 0 6px 24px -8px rgba(15, 23, 42, .18);
    --shadow-lg: 0 20px 50px -18px rgba(15, 23, 42, .30);

    /* layout */
    --max-width: 1120px;
    --gap: 1.5rem;
    --header-h: 66px;

    --font-sans: "Inter", system-ui, -apple-system, "Hiragino Kaku Gothic ProN",
                 "Hiragino Sans", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
    --grad: linear-gradient(120deg, var(--accent), var(--accent-2));
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1020;
        --surface: #111827;
        --surface-2: #151d2e;
        --fg: #e8ebf5;
        --muted: #94a3b8;
        --border: #232c40;
        --accent: #818cf8;
        --accent-2: #22d3ee;
        --ring: rgba(129, 140, 248, .35);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow: 0 8px 28px -10px rgba(0, 0, 0, .55);
        --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .65);
    }
}

/* --- reset-ish --- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    color: var(--fg);
    background: var(--bg);
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.75;
    letter-spacing: .01em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }
::selection { background: var(--accent); color: #fff; }

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-2); }

h1, h2, h3 { line-height: 1.25; letter-spacing: -.02em; font-weight: 700; }

:where(a, button, input, textarea, .nav-toggle):focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
    border-radius: 6px;
}

.container {
    width: 100%;
    max-width: var(--max-width);
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 2rem);
}

.screen-reader-text {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus {
    position: fixed; top: 8px; left: 8px; width: auto; height: auto;
    padding: 8px 12px; background: var(--bg); z-index: 1000; clip: auto;
    box-shadow: var(--shadow);
}

/* =========================================================================
   Header / Nav
   ========================================================================= */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.site-header__inner {
    display: flex; align-items: center; gap: var(--gap);
    min-height: var(--header-h);
}
.site-branding { margin-right: auto; }
.site-title {
    display: inline-block;
    font-weight: 800; font-size: clamp(1rem, 1.6vw, 1.2rem); line-height: 1.15;
    letter-spacing: -.01em;
    color: var(--fg);
    background: var(--grad); -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.site-title:hover { opacity: .9; }
.custom-logo { display: block; height: 36px; width: auto; }

/* アイコン＋社名（3行）併記 */
.site-brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; }
.site-brand__icon {
    box-sizing: border-box; width: 42px; height: 42px; display: block; flex: none;
    background: #fff; border-radius: 10px; padding: 4px; box-shadow: var(--shadow-sm);
}
.site-brand__name {
    display: flex; flex-direction: column; line-height: 1.02;
    font-weight: 800; font-size: .92rem; letter-spacing: .01em; color: var(--fg);
}
.site-brand:hover .site-brand__name { color: var(--accent); }
@media (max-width: 420px) {
    .site-brand__name { font-size: .82rem; }
    .site-brand__icon { width: 38px; height: 38px; }
}

.site-nav__menu {
    list-style: none; display: flex; flex-wrap: wrap; align-items: center;
    gap: .35rem; margin: 0; padding: 0;
}
.site-nav__menu a {
    display: inline-block; padding: .5rem .8rem; border-radius: 999px;
    color: var(--fg); font-size: .95rem; font-weight: 600;
    transition: background .15s ease, color .15s ease;
}
.site-nav__menu a:hover { background: var(--surface-2); color: var(--accent); }
.site-nav__menu .current-menu-item > a,
.site-nav__menu .current_page_item > a { color: var(--accent); background: var(--surface-2); }

/* mobile toggle */
.nav-toggle {
    display: none;
    width: 42px; height: 42px; padding: 0; border: 0; cursor: pointer;
    background: transparent; border-radius: 10px;
    flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.nav-toggle span {
    display: block; width: 22px; height: 2px; border-radius: 2px;
    background: var(--fg); transition: transform .25s ease, opacity .2s ease;
}
.site-header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.site-header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 820px) {
    .nav-toggle { display: inline-flex; }
    .site-nav {
        position: absolute; left: 0; right: 0; top: var(--header-h);
        background: var(--bg); border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        max-height: 0; overflow: hidden; transition: max-height .3s ease;
    }
    .site-header.nav-open .site-nav { max-height: 75vh; }
    .site-nav__menu { flex-direction: column; align-items: stretch; padding: .75rem; gap: .15rem; }
    .site-nav__menu a { padding: .7rem 1rem; border-radius: var(--radius-sm); }
}

.site-main { min-height: 60vh; }

/* HOME のマウス追従背景（canvas）。最背面に固定し、本文は前面に。 */
.hero-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.site-main, .site-footer { position: relative; z-index: 1; }

/* =========================================================================
   Hero / Sections (front page)
   ========================================================================= */
.hero {
    position: relative; padding-block: clamp(3rem, 8vw, 6rem) clamp(2rem, 4vw, 3rem);
    overflow: hidden;
}
.hero::before {
    content: ""; position: absolute; inset: -40% 0 auto -10%;
    height: 480px; z-index: -1; filter: blur(60px); opacity: .22;
    background: radial-gradient(60% 60% at 30% 30%, var(--accent), transparent 70%),
                radial-gradient(50% 50% at 80% 20%, var(--accent-2), transparent 70%);
}
.hero__mark {
    box-sizing: border-box; display: block; width: 92px; height: 92px;
    background: #fff; border-radius: 20px; padding: 11px;
    box-shadow: var(--shadow); margin-bottom: 1.25rem;
}
.hero__title {
    font-size: clamp(2.2rem, 6vw, 3.6rem); margin: 0 0 1rem; font-weight: 800;
    background: var(--grad); -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero__lead { color: var(--muted); font-size: clamp(1.05rem, 2.5vw, 1.3rem); margin: 0; max-width: 46ch; }

.section-title {
    font-size: clamp(1.4rem, 3vw, 1.9rem); margin-block: 2.5rem 1.25rem;
    display: inline-flex; align-items: center; gap: .6rem;
}
.section-title::before {
    content: ""; width: 26px; height: 4px; border-radius: 4px; background: var(--grad);
}

.about__body { color: var(--fg); }

/* SNS grid */
.social__grid {
    display: grid; gap: var(--gap);
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    margin-bottom: 3rem;
}
.social__col {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem;
}
.social__col h3 { margin: 0 0 .75rem; font-size: 1.05rem; }
.social__placeholder {
    color: var(--muted); font-size: .9rem;
    border: 1px dashed var(--border); border-radius: var(--radius-sm);
    padding: 1rem; margin: 0;
}
.social__col .twitter-timeline,
.social__col .fb-page, .social__col .fb-page span,
.social__col iframe { max-width: 100% !important; }

/* =========================================================================
   Buttons & cards (shared)
   ========================================================================= */
.button {
    display: inline-flex; align-items: center; gap: .5rem;
    margin-top: 1rem; padding: .7rem 1.4rem; border-radius: 999px;
    background: var(--grad); color: #fff !important; font-weight: 700;
    box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .2s ease, opacity .2s ease;
}
.button:hover { transform: translateY(-2px); box-shadow: var(--shadow); opacity: .96; }

.cards {
    display: grid; gap: var(--gap);
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    margin-block: 1.5rem;
}
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.4rem;
    transition: transform .18s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.card h2 { margin-top: 0; font-size: 1.15rem; }
.card__cases-lead { margin-bottom: .4rem; font-weight: 600; font-size: .95rem; }
.card__cases {
    margin: 0; padding-left: 1.1rem;
    font-size: .9rem; line-height: 1.6; color: var(--muted, inherit);
}
.card__cases li { margin-bottom: .2rem; }
.card__cases-note { margin-top: .6rem; font-size: .8rem; opacity: .7; }

/* =========================================================================
   Beyond the Pixel — 掲載のお申し込み（page-btp-submit）
   ========================================================================= */
.page__subtitle { margin: .35rem 0 0; color: var(--muted); font-size: 1rem; }
.btp-submit__note {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .8rem 1rem; font-size: .95rem;
}
.btp-submit__h2 { margin-top: 2.4rem; font-size: 1.35rem; }
.btp-submit__consent-lead { margin-bottom: .6rem; color: var(--muted); }

/* --- 費用プラン --- */
.btp-plans { align-items: start; }
.btp-plan { position: relative; }
.btp-plan h3 { margin: 0 0 .2rem; font-size: 1.15rem; }
.btp-plan__price { margin: 0 0 .7rem; font-size: 1.8rem; font-weight: 700; }
.btp-plan__tax { font-size: .85rem; font-weight: 400; color: var(--muted); margin-left: .2rem; }
.btp-plan__list { margin: 0; padding-left: 1.1rem; font-size: .92rem; line-height: 1.65; }
.btp-plan__list li { margin-bottom: .3rem; }
.btp-plan__caveat { list-style: none; margin-left: -1.1rem; color: var(--muted); font-size: .85rem; }
.btp-plan__badge {
    position: absolute; top: 1rem; right: 1rem;
    background: var(--grad); color: var(--accent-fg, #fff);
    font-size: .72rem; font-weight: 700; letter-spacing: .03em;
    padding: .18rem .55rem; border-radius: 999px;
}
.btp-plan__badge--soon { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.btp-plan--soon { opacity: .85; }
.btp-plan--soon:hover { transform: none; box-shadow: none; border-color: var(--border); }
.btp-plan__soon-note { margin: .8rem 0 0; font-size: .82rem; color: var(--muted); }

/* --- 掲載許諾同意書（スクロール枠） --- */
.btp-consent {
    max-height: 340px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.2rem 1.4rem;
    font-size: .9rem; line-height: 1.75;
}
.btp-consent__title { margin-top: 0; font-size: 1.1rem; }
.btp-consent h4 { margin: 1.1rem 0 .3rem; font-size: .98rem; }
.btp-consent ul { margin: .2rem 0; padding-left: 1.2rem; }
.btp-consent li { margin-bottom: .3rem; }
.btp-consent__rev { margin-top: 1.2rem; color: var(--muted); font-size: .82rem; }

/* --- お申し込みフォーム（CF7 + 同意ゲート） --- */
.btp-form { margin-top: .6rem; }
.btp-form p { margin: 0 0 1rem; }
.btp-form label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.btp-form .wpcf7-form-control-wrap { display: block; }
.btp-form input[type="text"],
.btp-form input[type="email"],
.btp-form input[type="url"],
.btp-form input[type="file"],
.btp-form textarea {
    width: 100%; padding: .65rem .75rem;
    background: var(--surface); color: var(--fg);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font: inherit; font-size: .95rem;
}
.btp-form textarea { min-height: 6rem; resize: vertical; }
.btp-form .wpcf7-list-item { display: block; font-weight: 400; margin: .2rem 0 .2rem 0; }
.btp-form .btp-help { display: block; font-weight: 400; font-size: .82rem; color: var(--muted); margin-top: .25rem; }
.btp-form input[type="submit"],
.btp-form .wpcf7-submit {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .75rem 1.6rem; border: none; cursor: pointer;
    background: var(--grad); color: var(--accent-fg, #fff);
    border-radius: 999px; font: inherit; font-weight: 600;
    box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .2s ease, opacity .2s ease;
}
.btp-form input[type="submit"]:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow); }
.btp-form input[type="submit"]:disabled { opacity: .5; cursor: not-allowed; }

/* 同意チェック前は入力欄グループを隠す（JS 有効時のみ。無効時は表示され CF7 が同意を必須検証） */
.btp-form.js-gate .btp-fields[hidden] { display: none; }
.btp-fields { margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px dashed var(--border); }
.btp-agree-gate { font-weight: 600; }

.btp-submit__after,
.btp-submit__pending { margin-top: 1rem; font-size: .9rem; color: var(--muted); }

/* --- 有料プランの PayPal 決済 --- */
.btp-paypal {
    margin-top: 1.6rem; padding: 1.4rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius);
}
.btp-paypal__title { margin: 0 0 .5rem; font-size: 1.15rem; }
.btp-paypal__lead { margin: 0 0 1rem; font-size: .95rem; line-height: 1.7; }
#btp-paypal-buttons { max-width: 340px; }
.btp-paypal__status {
    margin: 1rem 0 0; padding: .8rem 1rem; border-radius: var(--radius-sm);
    font-size: .92rem; line-height: 1.6;
}
.btp-paypal__status.is-success { background: var(--surface-2); border: 1px solid var(--border); }
.btp-paypal__status.is-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.btp-paypal__note { margin: 1rem 0 0; font-size: .82rem; color: var(--muted); }

/* BTP トップ（一覧）から申込ページへの導線 */
.btp-cta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
    justify-content: space-between;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem 1.4rem; margin-bottom: 1.8rem;
}
.btp-cta__text { font-size: .95rem; line-height: 1.6; max-width: 46ch; }
.btp-cta .button { flex: none; }

/* =========================================================================
   Blog (list / card / single)
   ========================================================================= */
.post-list { padding-block: 2rem 3rem; }
.post-list__title { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.post-list__grid {
    display: grid; gap: var(--gap);
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    margin-block: 1.5rem 2.5rem;
}
.post-card {
    display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: transform .18s ease, box-shadow .2s ease;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.post-card__thumb { display: block; aspect-ratio: 16/9; overflow: hidden; }
.post-card__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.post-card:hover .post-card__thumb img { transform: scale(1.05); }
.post-card__title { font-size: 1.12rem; margin: .9rem 1.1rem .25rem; }
.post-card__title a { color: var(--fg); }
.post-card__title a:hover { color: var(--accent); }
.post-card__meta { color: var(--muted); font-size: .82rem; margin: 0 1.1rem; }
.post-card__excerpt { padding: .5rem 1.1rem 1.2rem; color: var(--muted); font-size: .95rem; }

/* ※ .page / .post-single は WordPress の body_class とも一致するため、
   本文記事だけに効くよう .container 付きに限定する（body 全体に max-width が
   かからないように）。 */
.coming-soon {
    text-align: center; padding: clamp(3rem, 10vw, 6rem) 1rem;
    border: 1px dashed var(--border); border-radius: var(--radius);
    background: var(--surface); margin-block: 1.5rem 3rem;
}
.coming-soon__title {
    font-size: clamp(1.5rem, 5vw, 2.2rem); font-weight: 800; margin: 0 0 .5rem;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.coming-soon__note { color: var(--muted); margin: 0; }

/* --- Beyond the Pixel 免責事項（展開表示） --- */
.disclaimer {
    margin-block: 2rem 3rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); overflow: hidden;
}
.disclaimer__summary {
    cursor: pointer; list-style: none;
    padding: 1rem 1.25rem; font-weight: 700; color: var(--fg);
    display: flex; align-items: center; gap: .6rem;
    transition: background .15s ease;
}
.disclaimer__summary::-webkit-details-marker { display: none; }
.disclaimer__summary::before {
    content: "＋"; color: var(--accent); font-weight: 800; line-height: 1;
    transition: transform .2s ease;
}
.disclaimer[open] .disclaimer__summary::before { content: "－"; }
.disclaimer__summary:hover { background: var(--surface-2); }
.disclaimer__summary:focus-visible { outline: 3px solid var(--ring); outline-offset: -3px; }
.disclaimer__body {
    padding: .5rem 1.25rem 1.5rem; border-top: 1px solid var(--border);
    color: var(--fg); font-size: .95rem; line-height: 1.85;
}
.disclaimer__heading { font-size: 1.15rem; margin: 1rem 0 .5rem; }
.disclaimer__body h3 { font-size: 1rem; margin: 1.4rem 0 .4rem; color: var(--accent); }
.disclaimer__body p { margin: .5rem 0; }
.disclaimer__list { margin: .5rem 0; padding-left: 1.2rem; }
.disclaimer__list li { margin-bottom: .5rem; }

.page.container { padding-block: 2.5rem 3.5rem; max-width: 800px; }
.post-single__title, .page__title { font-size: clamp(1.8rem, 4.5vw, 2.6rem); margin-bottom: .4rem; }
.post-single__meta { color: var(--muted); }
.post-single__thumb img { width: 100%; border-radius: var(--radius); margin-block: 1.25rem; }
.post-single__content, .page__content { font-size: 1.05rem; }
.post-single__content > p, .page__content > p { margin-block: 1rem; }
.post-tags { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin-top: 1.5rem; }
.post-tags li a {
    font-size: .8rem; padding: .25rem .7rem; border-radius: 999px;
    background: var(--surface-2); color: var(--muted);
}

/* pages content */
.page__content .lead { font-size: 1.15rem; color: var(--muted); margin-bottom: 1.5rem; }
.page__content h2 { margin-block: 2.25rem .5rem; font-size: 1.4rem; }
.page__content ul { padding-left: 1.25rem; }
.page__content li { margin-block: .35rem; }

.info-table { width: 100%; border-collapse: collapse; margin-block: 1rem; }
.info-table th, .info-table td {
    text-align: left; vertical-align: top; padding: .7rem .85rem;
    border-bottom: 1px solid var(--border);
}
.info-table th { width: 8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.policy-date { margin-top: 2rem; color: var(--muted); font-size: .9rem; }
.info-table .note { margin: .5rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.6; }

/* Contact Form 7 */
.wpcf7-form p { margin-block: .9rem; }
.wpcf7-form label { display: block; font-weight: 600; }
.wpcf7-form input[type="text"], .wpcf7-form input[type="email"],
.wpcf7-form input[type="tel"], .wpcf7-form input[type="url"],
.wpcf7-form textarea, .wpcf7-form select {
    width: 100%; padding: .6rem .7rem; margin-top: .35rem;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--fg); font: inherit;
}
.wpcf7-form input:focus-visible, .wpcf7-form textarea:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; }
.wpcf7-submit {
    border: 0; border-radius: 999px; background: var(--grad); color: #fff;
    font-weight: 700; padding: .7rem 1.6rem; cursor: pointer; box-shadow: var(--shadow-sm);
}
.wpcf7-submit:hover { opacity: .95; }

/* pagination */
.pagination .nav-links, .navigation .nav-links {
    display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin-top: 1.5rem;
}
.pagination a, .pagination span, .navigation a, .navigation span {
    display: inline-flex; min-width: 42px; height: 42px; align-items: center; justify-content: center;
    padding: 0 .6rem; border-radius: 10px; border: 1px solid var(--border);
    color: var(--fg); font-weight: 600;
}
.pagination .current { background: var(--grad); color: #fff; border-color: transparent; }
.pagination a:hover { border-color: var(--accent); color: var(--accent); }

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer { border-top: 1px solid var(--border); margin-top: 4rem; background: var(--surface); }
.site-footer__inner { padding-block: 2.5rem; }
.footer-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.25rem; }
.footer-brand__icon {
    box-sizing: border-box; width: 40px; height: 40px; flex: none;
    background: #fff; border-radius: 9px; padding: 4px; box-shadow: var(--shadow-sm);
}
.footer-brand__name { font-weight: 800; color: var(--fg); }
.footer-nav__menu {
    list-style: none; display: flex; flex-wrap: wrap; gap: 1.1rem; padding: 0; margin: 0 0 1rem;
}
.footer-nav__menu a { font-size: .9rem; color: var(--muted); }
.footer-nav__menu a:hover { color: var(--accent); }
.site-footer__copy { color: var(--muted); font-size: .85rem; margin: 0; }

/* =========================================================================
   AI widget
   ========================================================================= */
.vai { position: fixed; right: 20px; bottom: 20px; z-index: 9999; }
.vai__toggle {
    border: 0; cursor: pointer; border-radius: 999px;
    background: var(--grad); color: #fff; font-weight: 700;
    padding: .75rem 1.2rem; font-size: .95rem; box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .2s ease;
}
.vai__toggle:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.vai__panel {
    position: absolute; right: 0; bottom: 60px;
    width: min(370px, calc(100vw - 40px));
    height: min(540px, calc(100vh - 120px));
    display: flex; flex-direction: column;
    background: var(--bg); color: var(--fg);
    border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.vai__panel[hidden] { display: none; }
.vai__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .85rem 1.1rem; font-weight: 700;
    background: var(--grad); color: #fff;
}
.vai__close { border: 0; background: transparent; font-size: 1.5rem; line-height: 1; cursor: pointer; color: #fff; }
.vai__log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.vai__msg {
    max-width: 86%; padding: .6rem .85rem; border-radius: 14px;
    font-size: .93rem; white-space: pre-wrap; word-break: break-word;
}
.vai__msg--user { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 4px; }
.vai__msg--bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.vai__msg--error { background: rgba(220, 38, 38, .14); color: #dc2626; }
.vai__form { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--border); }
.vai__input {
    flex: 1; resize: none; border: 1px solid var(--border); border-radius: 10px;
    padding: .55rem .7rem; font: inherit; background: var(--surface); color: var(--fg);
}
.vai__input:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; }
.vai__send { border: 0; border-radius: 10px; background: var(--grad); color: #fff; padding: 0 1.1rem; cursor: pointer; font-weight: 700; }
.vai__send:disabled { opacity: .6; cursor: default; }

/* ================================================================
   単一記事レイアウト（本文 + サイドバー）
   ================================================================ */
.single-wrap {
    padding-block: 2.5rem 3.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 2.5rem;
    align-items: start;
}
.single-main { min-width: 0; }
.single-main .post-single { max-width: 760px; }
.single-sidebar { position: sticky; top: calc(var(--header-h) + 1rem); }
.sidebar-inner { display: flex; flex-direction: column; gap: 1.5rem; }

@media (max-width: 900px) {
    .single-wrap { grid-template-columns: 1fr; gap: 1.5rem; }
    .single-sidebar { position: static; }
    .single-main .post-single { max-width: none; }
}

/* --- ランキングウィジェット --- */
.widget--ranking {
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); padding: 1.1rem 1.15rem 1.25rem;
}
.widget--ranking .widget-title {
    font-size: 1rem; margin: 0 0 .85rem; padding-bottom: .6rem;
    border-bottom: 2px solid var(--border);
}
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.rank-item__link { display: grid; grid-template-columns: 1.4rem 56px 1fr; gap: .6rem; align-items: center; color: var(--fg); }
.rank-item__link:hover .rank-item__title { color: var(--accent); }
.rank-item__num {
    font-weight: 800; font-size: 1.05rem; text-align: center;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.rank-item:nth-child(n+4) .rank-item__num { color: var(--muted); background: none; -webkit-text-fill-color: currentColor; }
.rank-item__thumb { width: 56px; height: 42px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.rank-item__thumb-img { width: 100%; height: 100%; object-fit: cover; }
.rank-item__title { display: block; font-size: .85rem; font-weight: 600; line-height: 1.4; }
.rank-item__count { display: block; font-size: .72rem; color: var(--muted); margin-top: .15rem; }

/* ================================================================
   [btp_media] 論文リンク + YouTube 解説動画カード
   ================================================================ */
.btp-media {
    margin-block: 1.8rem; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm);
}
.btp-media__head {
    padding: .7rem 1rem; font-weight: 700; font-size: .9rem;
    background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.btp-media__body { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.btp-media__video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.btp-media__video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.btp-media__paper {
    display: flex; align-items: center; gap: .75rem;
    padding: .8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg); color: var(--fg);
}
.btp-media__paper:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.btp-media__paper-icon { font-size: 1.3rem; line-height: 1; }
.btp-media__paper-label { display: block; font-weight: 700; font-size: .92rem; }
.btp-media__paper-url { display: block; font-size: .78rem; color: var(--muted); word-break: break-all; }

/* ================================================================
   Amazon アフィリエイト商品カード（パイプラインが本文に静的HTMLで出力）
   ================================================================ */
.btp-amazon {
    margin-block: 1.8rem; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); overflow: hidden;
}
.btp-amazon__head {
    padding: .55rem 1rem; font-size: .8rem; font-weight: 700; color: var(--muted);
    background: var(--surface-2); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: .4rem;
}
.btp-amazon__items { display: flex; flex-direction: column; }
.btp-amazon__item {
    display: grid; grid-template-columns: 96px 1fr; gap: 1rem; align-items: center;
    padding: 1rem; color: var(--fg);
}
.btp-amazon__item + .btp-amazon__item { border-top: 1px solid var(--border); }
.btp-amazon__thumb { width: 96px; height: 96px; display: flex; align-items: center; justify-content: center; }
.btp-amazon__thumb img { max-width: 100%; max-height: 96px; object-fit: contain; }
.btp-amazon__title { font-size: .92rem; font-weight: 600; line-height: 1.5; margin: 0 0 .5rem; }
.btp-amazon__cta {
    display: inline-block; padding: .4rem .9rem; border-radius: 999px; font-size: .82rem; font-weight: 700;
    background: linear-gradient(120deg, #ff9900, #ff7a00); color: #1a1200;
}
.btp-amazon__cta:hover { color: #1a1200; filter: brightness(1.05); }
.btp-amazon__note { padding: .5rem 1rem .7rem; font-size: .72rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
