/* ==========================================================================
   Interakt Ghost Theme
   © Interakt.jp. All rights reserved.
   ========================================================================== */

/* 1. Tokens
   -------------------------------------------------------------------------- */
:root {
    --accent: var(--ghost-accent-color, #1f5eff);
    --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);

    --bg: #ffffff;
    --bg-soft: #f6f7f9;
    --surface: #ffffff;
    --text: #0f172a;
    --text-2: #475569;
    --text-3: #64748b;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --code-bg: #f1f5f9;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
    --shadow-lg: 0 2px 4px rgba(15, 23, 42, .04), 0 20px 48px rgba(15, 23, 42, .10);

    --font-sans: var(--gh-font-body, "Inter", "Noto Sans JP"), "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-heading: var(--gh-font-heading, var(--font-sans));
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --radius: 14px;
    --radius-sm: 8px;
    --container: 1200px;
    --gutter: clamp(16px, 4vw, 32px);
    --header-h: 68px;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

[data-theme="dark"] {
    --bg: #0b0f17;
    --bg-soft: #111723;
    --surface: #131a27;
    --text: #e8edf5;
    --text-2: #a9b4c6;
    --text-3: #8391a7;
    --border: #1f2837;
    --border-strong: #2c384b;
    --code-bg: #161e2c;
    --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 20px 48px rgba(0, 0, 0, .4);
    color-scheme: dark;
}

/* 2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    transition: background-color .2s, color .2s;
}

img, video, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-family: var(--font-heading); line-height: 1.3; letter-spacing: -.01em; font-weight: 700; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.site { display: flex; flex-direction: column; min-height: 100vh; }
.site-main { flex: 1 0 auto; }

.container {
    width: 100%;
    max-width: calc(var(--container) + var(--gutter) * 2);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.skip-link {
    position: absolute; left: 16px; top: -48px; z-index: 100;
    padding: 8px 14px; border-radius: var(--radius-sm);
    background: var(--accent); color: #fff; font-weight: 600;
}
.skip-link:focus { top: 12px; }

.muted { color: var(--text-3); font-weight: 500; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; flex: none; }
.eyebrow {
    margin-bottom: 12px;
    color: var(--accent);
    font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}

/* 3. Buttons / labels
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 18px;
    border: 1px solid transparent; border-radius: 999px;
    font-size: 14px; font-weight: 600; white-space: nowrap;
    transition: background-color .2s, border-color .2s, color .2s, transform .2s var(--ease);
}
.btn:active { transform: scale(.98); }
.btn-sm { height: 36px; padding: 0 14px; }
.btn-lg { height: 48px; padding: 0 26px; font-size: 15px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.btn-outline { border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--text); }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
    color: var(--text-2);
    transition: background-color .2s, color .2s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }

.tag-label {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent);
    font-size: 12px; font-weight: 600; letter-spacing: .02em;
    transition: background-color .2s;
}
.tag-label:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.featured-label { color: var(--text-3); font-size: 12px; font-weight: 600; }
.lock-label { color: var(--text-3); }
.lock-label .icon { width: 15px; height: 15px; }

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 16px;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); color: var(--text-2);
    font-size: 14px; font-weight: 500;
    transition: border-color .2s, color .2s, background-color .2s;
}
.pill:hover { border-color: var(--text); color: var(--text); }
.pill.is-active { background: var(--text); border-color: var(--text); color: var(--bg); }
.pill-count { color: var(--text-3); font-size: 12px; }

.avatar {
    display: inline-flex; flex: none; align-items: center; justify-content: center;
    width: 28px; height: 28px; overflow: hidden; border-radius: 50%;
    background: var(--bg-soft); color: var(--text-3);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .icon { width: 60%; height: 60%; }
.avatar-lg { width: 44px; height: 44px; border: 2px solid var(--bg); }
.avatar-xl { width: 64px; height: 64px; }
.avatar-xxl { width: 96px; height: 96px; margin-bottom: 20px; }

.spinner {
    display: none; width: 16px; height: 16px;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.is-loading .spinner, .loading .spinner { display: inline-block; }

/* 4. Header
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }

.header-inner { display: flex; align-items: center; gap: 32px; height: var(--header-h); }

.site-logo { display: inline-flex; align-items: center; flex: none; }
.site-logo img { width: auto; max-height: 36px; }
.site-logo-text { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.site-logo .logo-dark { display: none; }
[data-theme="dark"] .site-logo:has(.logo-dark) .logo-light { display: none; }
[data-theme="dark"] .site-logo .logo-dark { display: block; }

.site-nav { flex: 1; }
.site-nav .nav { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; }
.site-nav .nav a {
    display: block; padding: 8px 12px; border-radius: var(--radius-sm);
    color: var(--text-2); font-size: 15px; font-weight: 500;
    transition: color .2s, background-color .2s;
}
.site-nav .nav a:hover { color: var(--text); background: var(--bg-soft); }
.site-nav .is-current a { color: var(--text); font-weight: 600; }
.site-nav-members { display: none; }

.header-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.header-members { display: flex; align-items: center; gap: 12px; margin-left: 8px; }
.header-signin { color: var(--text-2); font-size: 14px; font-weight: 600; }
.header-signin:hover { color: var(--text); }

.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.menu-toggle { display: none; }
.burger { position: relative; width: 18px; height: 12px; }
.burger span {
    position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px;
    background: currentColor; transition: transform .25s var(--ease), top .25s var(--ease);
}
.burger span:first-child { top: 1px; }
.burger span:last-child { top: 9px; }
.menu-open .burger span:first-child { top: 5px; transform: rotate(45deg); }
.menu-open .burger span:last-child { top: 5px; transform: rotate(-45deg); }

@media (max-width: 860px) {
    .menu-toggle { display: inline-flex; }
    .header-members { display: none; }
    .site-nav {
        position: fixed; inset: var(--header-h) 0 0 0; z-index: 40;
        display: flex; flex-direction: column; gap: 24px;
        padding: 24px var(--gutter);
        background: var(--bg);
        opacity: 0; visibility: hidden; transform: translateY(-8px);
        transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
        overflow-y: auto;
    }
    .menu-open .site-nav { opacity: 1; visibility: visible; transform: none; }
    .menu-open { overflow: hidden; }
    .site-nav .nav { flex-direction: column; align-items: stretch; gap: 0; }
    .site-nav .nav a { padding: 14px 0; border-bottom: 1px solid var(--border); border-radius: 0; font-size: 18px; }
    .site-nav .nav a:hover { background: none; }
    .site-nav-members { display: flex; gap: 12px; }
    .site-nav-members .btn { flex: 1; height: 46px; }
}

.reading-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: 3px; pointer-events: none; }
.reading-progress span { display: block; height: 100%; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; }

/* 5. Home intro & archive headers
   -------------------------------------------------------------------------- */
.hero {
    position: relative; isolation: isolate; overflow: hidden;
    padding: clamp(64px, 10vw, 128px) 0 clamp(44px, 6vw, 72px);
}
.hero-inner { position: relative; }
.hero--center { text-align: center; }
.hero--center .hero-inner { display: flex; flex-direction: column; align-items: center; }
.hero--center .home-title, .hero--center .home-description { margin-inline: auto; }
.hero--center .topic-pills { justify-content: center; }

/* Animated background */
.hero-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.hero-bg::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40%;
    background: linear-gradient(to bottom, transparent, var(--bg));
}
.blob {
    position: absolute; border-radius: 50%;
    filter: blur(80px); opacity: .26;
    will-change: transform;
    animation: blob-float 20s ease-in-out infinite alternate;
}
.blob-1 { top: -220px; left: 5%; width: 560px; height: 560px; background: var(--accent); }
.blob-2 {
    top: -140px; right: 2%; width: 460px; height: 460px;
    background: color-mix(in srgb, var(--accent) 45%, #7c3aed);
    animation-duration: 24s; animation-delay: -8s;
}
.blob-3 {
    top: 40%; left: 38%; width: 380px; height: 380px;
    background: color-mix(in srgb, var(--accent) 45%, #06b6d4);
    opacity: .22; animation-duration: 28s; animation-delay: -14s;
}
[data-theme="dark"] .blob { opacity: .24; }
[data-theme="dark"] .blob-3 { opacity: .16; }
@keyframes blob-float {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    50%  { transform: translate3d(70px, 50px, 0) scale(1.12); }
    100% { transform: translate3d(-50px, 20px, 0) scale(.94); }
}

.hero-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(to right, color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px),
        linear-gradient(to bottom, color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 0%, #000 25%, transparent 75%);
    mask-image: radial-gradient(ellipse 75% 70% at 50% 0%, #000 25%, transparent 75%);
    animation: grid-pan 40s linear infinite;
}
@keyframes grid-pan { to { background-position: 56px 56px; } }

/* Hero content */
.hero-badge {
    display: inline-flex; align-items: center; gap: 10px;
    margin-bottom: 28px; padding: 6px 16px 6px 12px;
    border: 1px solid var(--border); border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    color: var(--text-2); font-size: 13px; font-weight: 600; letter-spacing: .02em;
}
.hero-badge-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent);
    animation: badge-pulse 2.4s ease-out infinite;
}
@keyframes badge-pulse { 70%, 100% { box-shadow: 0 0 0 8px transparent; } }

.home-title {
    max-width: 900px;
    font-size: clamp(36px, 6.4vw, 72px); font-weight: 800; line-height: 1.06; letter-spacing: -.035em;
    text-wrap: balance;
}
.text-gradient {
    background: linear-gradient(110deg,
        var(--accent) 0%,
        color-mix(in srgb, var(--accent) 50%, #7c3aed) 35%,
        color-mix(in srgb, var(--accent) 55%, #06b6d4) 65%,
        var(--accent) 100%);
    background-size: 220% auto;
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    animation: text-shine 9s linear infinite;
}
@keyframes text-shine { to { background-position: 220% center; } }

.home-description {
    max-width: 620px; margin-top: 22px;
    color: var(--text-2); font-size: clamp(17px, 1.8vw, 20px); line-height: 1.6;
    text-wrap: pretty;
}

.hero-subscribe {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    width: 100%; max-width: 460px; margin-top: 36px; padding: 6px;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); box-shadow: var(--shadow);
    transition: border-color .2s, box-shadow .2s;
}
.hero-subscribe:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.hero-subscribe-input {
    flex: 1 1 160px; min-width: 0; height: 44px; padding: 0 16px;
    border: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px;
}
.hero-subscribe-input:focus { outline: none; }
.hero-subscribe .btn { height: 44px; padding: 0 22px; }
.hero-subscribe .form-message { padding: 4px 16px 6px; text-align: left; }
.hero-subscribe.success .form-success { display: block; color: #16a34a; }
.hero-subscribe.error .form-error { display: block; color: #dc2626; }
.hero-subscribe.loading .btn-label { opacity: .6; }

.topic-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 36px; }
.hero .pill { background: color-mix(in srgb, var(--surface) 75%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.hero .pill.is-active { background: var(--text); }

@media (max-width: 640px) {
    .blob-1 { width: 360px; height: 360px; }
    .blob-2 { width: 300px; height: 300px; }
    .blob-3 { display: none; }
    .hero-subscribe { border-radius: var(--radius); }
    .hero-subscribe .btn { flex: 1 1 100%; }
}

.archive-header { padding: clamp(56px, 8vw, 104px) 0 clamp(32px, 4vw, 48px); border-bottom: 1px solid var(--border); margin-bottom: clamp(32px, 4vw, 48px); }
.archive-header .blob { opacity: .2; }
[data-theme="dark"] .archive-header .blob { opacity: .16; }
.archive-header--author { text-align: center; }
.archive-header--author .container { display: flex; flex-direction: column; align-items: center; }
.archive-title { font-size: clamp(32px, 5vw, 52px); font-weight: 800; letter-spacing: -.03em; }
.archive-description { max-width: 640px; margin-top: 14px; color: var(--text-2); font-size: 18px; }
.archive-header--author .archive-description { margin-inline: auto; }
.archive-count { margin-top: 14px; color: var(--text-3); font-size: 14px; font-weight: 500; }
.author-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; margin-top: 16px; color: var(--text-3); font-size: 14px; font-weight: 500; }
.author-links a:hover { color: var(--accent); }

.section-title { margin-bottom: 28px; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }

/* 6. Post feed & cards
   -------------------------------------------------------------------------- */
.feed-section { padding-bottom: clamp(56px, 8vw, 96px); }
.home-template .feed-section, .paged .feed-section { padding-top: 8px; }
.paged .feed-section { padding-top: 48px; }

.post-feed {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(32px, 4vw, 48px) clamp(20px, 3vw, 32px);
}

.post-card { position: relative; display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.post-card-media {
    position: relative; display: block; overflow: hidden;
    aspect-ratio: 16 / 10; border-radius: var(--radius);
    background: var(--bg-soft);
}
.post-card-media img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .6s var(--ease);
}
.post-card:hover .post-card-media img { transform: scale(1.04); }

.post-card-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.post-card-top { display: flex; align-items: center; gap: 10px; min-height: 24px; }

.post-card-title { font-size: 20px; font-weight: 700; line-height: 1.4; letter-spacing: -.015em; }
.post-card-title a {
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0 1.5px; background-position: 0 100%; background-repeat: no-repeat;
    transition: background-size .35s var(--ease);
}
.post-card:hover .post-card-title a { background-size: 100% 1.5px; }

.post-card-excerpt {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
    color: var(--text-2); font-size: 15px; line-height: 1.7;
}

.post-card-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-top: 4px; color: var(--text-3); font-size: 13px; font-weight: 500;
}
.post-card-author { color: var(--text); font-weight: 600; }
.post-card-author:hover { color: var(--accent); }

.post-card.no-image .post-card-body {
    height: 100%; padding: 24px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-soft);
}
.post-card.no-image .post-card-meta { margin-top: auto; padding-top: 12px; }

/* Hero (lead) card */
.post-card--hero {
    grid-column: 1 / -1;
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: center; gap: clamp(24px, 4vw, 56px);
    padding-bottom: clamp(32px, 4vw, 48px);
    border-bottom: 1px solid var(--border);
}
.post-card--hero .post-card-media { aspect-ratio: 16 / 10; border-radius: calc(var(--radius) + 4px); }
.post-card--hero .post-card-body { gap: 14px; }
.post-card--hero .post-card-title { font-size: clamp(26px, 3.2vw, 40px); font-weight: 800; line-height: 1.22; letter-spacing: -.025em; }
.post-card--hero .post-card-excerpt { font-size: 17px; -webkit-line-clamp: 4; }
.post-card--hero .post-card-meta { font-size: 14px; }
.post-card--hero.no-image { display: flex; }
.post-card--hero.no-image .post-card-body { padding: clamp(28px, 5vw, 56px); }

@media (max-width: 1024px) {
    .post-feed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .post-card--hero { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .post-feed { grid-template-columns: 1fr; }
    .post-card-title { font-size: 19px; }
}

.load-more { display: flex; justify-content: center; margin-top: clamp(48px, 6vw, 72px); }
.load-more .btn.is-loading .load-more-label { opacity: .6; }

/* 7. Article
   -------------------------------------------------------------------------- */
.gh-canvas {
    display: grid;
    grid-template-columns:
        [full-start] minmax(var(--gutter), auto)
        [wide-start] minmax(auto, 220px)
        [main-start] min(720px, calc(100% - var(--gutter) * 2))
        [main-end] minmax(auto, 220px)
        [wide-end] minmax(var(--gutter), auto)
        [full-end];
}
.gh-canvas > * { grid-column: main-start / main-end; }
.kg-width-wide { grid-column: wide-start / wide-end; }
.kg-width-full { grid-column: full-start / full-end; }
.kg-width-full img { width: 100%; }

.article-header { padding-top: clamp(40px, 6vw, 72px); }
.article-top { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.article-title { font-size: clamp(30px, 4.6vw, 48px); font-weight: 800; line-height: 1.2; letter-spacing: -.03em; }
.article-excerpt { margin-top: 18px; color: var(--text-2); font-size: clamp(18px, 2vw, 21px); line-height: 1.6; }

.article-byline { display: flex; align-items: center; gap: 14px; margin-top: 28px; }
.byline-avatars { display: flex; }
.byline-avatars .avatar + .avatar { margin-left: -12px; }
.byline-names { font-size: 15px; font-weight: 600; }
.byline-names a:hover { color: var(--accent); }
.byline-date { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 14px; }

.article-image { margin: clamp(32px, 5vw, 48px) 0 0; }
.article-image img { width: 100%; border-radius: var(--radius); }
.article-image figcaption, .gh-content figcaption {
    margin-top: 12px; color: var(--text-3); font-size: 14px; line-height: 1.5; text-align: center;
}
.article-header--page { padding-bottom: 8px; }

/* Content */
.gh-content {
    padding-top: clamp(36px, 5vw, 56px);
    font-size: 18px; line-height: 1.85;
    word-break: break-word;
}
.gh-content > * + * { margin-top: 1.4em; }
.gh-content > [id] { margin-top: 2em; }
.gh-content > h2 { margin-top: 2.2em; font-size: 1.6em; letter-spacing: -.02em; }
.gh-content > h3 { margin-top: 1.9em; font-size: 1.3em; }
.gh-content > h4 { margin-top: 1.7em; font-size: 1.1em; }
.gh-content > h2 + *, .gh-content > h3 + *, .gh-content > h4 + * { margin-top: .7em; }
.gh-content a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.gh-content a:hover { text-decoration-thickness: 2px; }
.gh-content strong { font-weight: 700; }
.gh-content ul, .gh-content ol { padding-left: 1.4em; }
.gh-content li + li { margin-top: .5em; }
.gh-content li::marker { color: var(--text-3); }
.gh-content hr { width: 100%; height: 1px; margin: 3em 0; border: 0; background: var(--border); }
.gh-content blockquote:not([class]) {
    margin: 1.8em 0; padding: 4px 0 4px 1.2em;
    border-left: 3px solid var(--accent);
    color: var(--text); font-size: 1.1em; font-style: italic;
}
.gh-content blockquote.kg-blockquote-alt {
    padding: 0 1.5em; color: var(--text-2); font-size: 1.4em; font-style: italic; text-align: center;
}
.gh-content :not(pre) > code {
    padding: .15em .4em; border-radius: 6px;
    background: var(--code-bg); font-family: var(--font-mono); font-size: .86em;
}
.gh-content pre {
    overflow-x: auto; padding: 20px 24px; border-radius: var(--radius-sm);
    background: #0f172a; color: #e2e8f0;
    font-family: var(--font-mono); font-size: 15px; line-height: 1.6;
}
[data-theme="dark"] .gh-content pre { background: #070a10; border: 1px solid var(--border); }
.gh-content table {
    display: block; width: 100%; overflow-x: auto; border-collapse: collapse;
    font-size: 15px; line-height: 1.6;
}
.gh-content th, .gh-content td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.gh-content th { background: var(--bg-soft); font-weight: 600; }
.gh-content figure { margin-left: 0; margin-right: 0; }
.gh-content img { border-radius: var(--radius-sm); }
.gh-content .kg-width-full img { border-radius: 0; }
.gh-content .kg-image-card, .gh-content .kg-gallery-card, .gh-content .kg-embed-card,
.gh-content .kg-video-card, .gh-content .kg-bookmark-card { margin-top: 2em; margin-bottom: .5em; }
.gh-content .kg-embed-card > * { margin: 0 auto; }
.gh-content .kg-bookmark-container { border-color: var(--border) !important; border-radius: var(--radius-sm) !important; text-decoration: none; }
.gh-content .kg-bookmark-title { color: var(--text); }
.gh-content .kg-callout-card { border-radius: var(--radius-sm); }

/* Article footer */
.article-footer { padding-top: 48px; }
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.article-tags .pill { height: 32px; font-size: 13px; }

.share {
    display: flex; align-items: center; gap: 8px;
    margin-top: 32px; padding: 20px 0;
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.share-label { margin-right: auto; color: var(--text-3); font-size: 14px; font-weight: 600; }
.share-btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 50%;
    color: var(--text-2); transition: color .2s, border-color .2s, background-color .2s;
}
.share-btn:hover { border-color: var(--text); color: var(--text); }
.share-btn .icon { width: 17px; height: 17px; }
.copy-toast {
    position: absolute; bottom: calc(100% + 8px); right: 0;
    padding: 4px 10px; border-radius: 6px; background: var(--text); color: var(--bg);
    font-size: 12px; font-weight: 600; white-space: nowrap;
    opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity .2s, transform .2s;
}
.share-btn.is-copied .copy-toast { opacity: 1; transform: none; }

.author-box { display: flex; align-items: flex-start; gap: 18px; margin-top: 32px; }
.author-box-label { color: var(--text-3); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.author-box-name { margin-top: 2px; font-size: 19px; }
.author-box-name a:hover { color: var(--accent); }
.author-box-bio { margin-top: 6px; color: var(--text-2); font-size: 15px; }

.article-comments { padding-top: 56px; }

/* Subscribe CTA */
.subscribe-cta {
    margin-top: 56px; padding: clamp(28px, 5vw, 44px);
    border-radius: calc(var(--radius) + 4px);
    background:
        radial-gradient(120% 120% at 100% 0%, var(--accent-soft), transparent 60%),
        var(--bg-soft);
    border: 1px solid var(--border);
    text-align: center;
}
.subscribe-title { font-size: clamp(22px, 3vw, 28px); font-weight: 800; letter-spacing: -.02em; }
.subscribe-text { max-width: 460px; margin: 10px auto 0; color: var(--text-2); }
.subscribe-form { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 460px; margin: 24px auto 0; }
.subscribe-input {
    flex: 1 1 220px; height: 48px; padding: 0 18px;
    border: 1px solid var(--border-strong); border-radius: 999px;
    background: var(--surface); color: var(--text); font: inherit; font-size: 15px;
}
.subscribe-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.subscribe-form .btn { height: 48px; padding: 0 24px; }
.form-message { display: none; flex-basis: 100%; font-size: 14px; }
.subscribe-form.success .form-success { display: block; color: #16a34a; }
.subscribe-form.error .form-error { display: block; color: #dc2626; }
.subscribe-form.loading .btn-label { opacity: .6; }

/* Related */
.related { padding: clamp(56px, 8vw, 96px) 0; margin-top: clamp(56px, 8vw, 96px); background: var(--bg-soft); border-top: 1px solid var(--border); }
.related .post-card.no-image .post-card-body { background: var(--surface); }

/* 8. Error page
   -------------------------------------------------------------------------- */
.error-page { padding: clamp(80px, 14vw, 160px) 0; text-align: center; }
.error-code {
    font-size: clamp(80px, 16vw, 160px); font-weight: 800; line-height: 1; letter-spacing: -.05em;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 40%, var(--text)));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.error-title { margin-top: 16px; font-size: clamp(24px, 3.5vw, 34px); }
.error-text { max-width: 480px; margin: 12px auto 32px; color: var(--text-2); }

/* 9. Footer
   -------------------------------------------------------------------------- */
.site-footer { padding: clamp(48px, 7vw, 72px) 0 28px; border-top: 1px solid var(--border); background: var(--bg); }
.related + .site-footer, .site-main:has(> .related:last-child) + .site-footer { border-top: 0; }

.footer-top { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
.footer-tagline { max-width: 360px; margin-top: 16px; color: var(--text-2); font-size: 15px; }
.footer-social { display: flex; gap: 6px; margin-top: 20px; margin-left: -10px; }
.footer-social a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 50%; color: var(--text-3);
    transition: color .2s, background-color .2s;
}
.footer-social a:hover { color: var(--text); background: var(--bg-soft); }
.footer-social .icon { width: 18px; height: 18px; }

.footer-heading { margin-bottom: 14px; color: var(--text-3); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.footer-links, .footer-col .nav { margin: 0; padding: 0; list-style: none; }
.footer-links li + li, .footer-col .nav li + li { margin-top: 8px; }
.footer-links a, .footer-col .nav a { color: var(--text-2); font-size: 15px; transition: color .2s; }
.footer-links a:hover, .footer-col .nav a:hover { color: var(--accent); }

.footer-bottom {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border);
    color: var(--text-3); font-size: 14px;
}
.copyright a { color: var(--text); font-weight: 600; }
.copyright a:hover, .back-to-top:hover { color: var(--accent); }

@media (max-width: 760px) {
    .footer-top { grid-template-columns: 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }
}

/* 10. Japanese typography tweaks
   -------------------------------------------------------------------------- */
:lang(ja) body, html[lang^="ja"] body { line-height: 1.8; }
:lang(ja) .gh-content, html[lang^="ja"] .gh-content { font-size: 17px; line-height: 2; letter-spacing: .02em; }
html[lang^="ja"] .post-card-title, html[lang^="ja"] .article-title { letter-spacing: 0; }
html[lang^="ja"] .gh-content blockquote:not([class]) { font-style: normal; }

/* 11. Motion preferences
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* 12. Print
   -------------------------------------------------------------------------- */
@media print {
    .site-header, .site-footer, .share, .related, .subscribe-cta, .reading-progress, .article-comments { display: none !important; }
    .gh-content a { color: inherit; }
}
