/* ============================================================
   article-template.css — Shared article page styles
   Headpage v2 · Warm paper theme · Playfair + Georgia + Caveat
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
    --article-bg: #efe7da;
    --article-bg-deep: #ddd1be;
    --article-paper: #211915;
    --article-paper-soft: rgba(33, 25, 21, 0.72);
    --article-ink: #17120f;
    --article-gold: #a14b2d;
    --article-rule: rgba(23, 18, 15, 0.12);
    --article-shell: min(1120px, calc(100vw - 48px));
    --article-seal: clamp(150px, 14vw, 200px);
    --article-reading-shadow: 0 0 10px rgba(255, 251, 245, 0.14);
}

/* ---------- Body / Base ---------- */
body.article-page {
    margin: 0;
    min-height: 100vh;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--article-ink);
    background:
        radial-gradient(circle at 10% 14%, rgba(161, 75, 45, 0.12), transparent 20%),
        radial-gradient(circle at 84% 10%, rgba(123, 91, 56, 0.08), transparent 18%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.54), transparent 26%),
        var(--article-bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.article-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.012), transparent),
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.018) 0,
            rgba(0, 0, 0, 0.018) 1px,
            transparent 1px,
            transparent 4px
        );
    pointer-events: none;
    mix-blend-mode: multiply;
    opacity: 0.18;
    z-index: 0;
}

/* ---------- Header (override from styles.css) ---------- */
body.article-page .header,
body.article-page .layout,
body.article-page .footer {
    position: relative;
    z-index: 1;
}

body.article-page .header {
    width: var(--article-shell);
    margin: 0 auto;
    padding: 26px 0 24px;
    background: transparent;
    border-bottom: 1px solid var(--article-rule);
}

body.article-page .header-inner {
    max-width: none;
    padding: 0;
    align-items: flex-start;
}

body.article-page .header-brand-link,
body.article-page .header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

body.article-page .observer-eye {
    width: 40px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 251, 245, 0.72);
    border: 1px solid rgba(161, 75, 45, 0.18);
    display: grid;
    place-items: center;
    transform: none;
}

body.article-page .observer-eye svg {
    width: 28px;
    height: 14px;
}

body.article-page .site-title {
    margin: 0;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 0.92rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--article-ink);
}

body.article-page .lang-switcher {
    display: flex;
    gap: 8px;
    align-items: center;
}

body.article-page .lang-switcher button {
    border: 1px solid rgba(161, 75, 45, 0.24);
    background: rgba(255, 251, 245, 0.72);
    color: rgba(33, 25, 21, 0.72);
    font-family: "Playfair Display", Georgia, serif;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.68rem;
    padding: 9px 11px;
}

body.article-page .lang-switcher button.active,
body.article-page .lang-switcher button[aria-pressed="true"] {
    background: rgba(161, 75, 45, 0.12);
    border-color: rgba(161, 75, 45, 0.44);
    color: var(--article-ink);
}

/* ---------- Layout ---------- */
body.article-page .layout {
    width: var(--article-shell);
    max-width: none;
    margin: 0 auto;
    padding: 26px 0 40px;
    display: block;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
    border: 0;
}

body.article-page .content {
    min-width: 0;
    max-width: 100%;
}

body.article-page .sidebar {
    display: none;
}

/* ---------- Article Hero ---------- */
.article-hero {
    padding: 0 0 32px;
    margin: 0 0 32px;
    border-bottom: 1px solid var(--article-rule);
}

.article-hero-meta {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
    font-family: "Playfair Display", Georgia, serif;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.7rem;
    color: var(--article-gold);
}

.article-section::after,
.article-date::after {
    content: "·";
    margin-left: 16px;
    color: rgba(23, 18, 15, 0.18);
}

.article-hero-title {
    margin: 0 0 20px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    line-height: 1.06;
    letter-spacing: -0.02em;
    color: var(--article-ink);
    text-wrap: balance;
}

/* ---------- Tegaki ---------- */
.article-tegaki {
    margin: 10px 0 0;
    max-width: min(900px, 100%);
}

.article-tegaki-renderer {
    position: relative;
    display: block;
    width: 100%;
    min-height: 0;
    font-family: "Caveat Local", "Segoe Print", cursive;
    font-size: clamp(1.5rem, 2.8vw, 2.4rem);
    font-weight: 700;
    line-height: 1.08;
    color: var(--article-gold);
}

.article-tegaki-renderer > span {
    display: block;
    width: 100%;
}

.article-tegaki-renderer [data-tegaki="root"] {
    display: block !important;
    width: 100%;
}

.article-tegaki-renderer canvas {
    width: 100% !important;
    height: auto !important;
}

.article-tegaki-fallback {
    display: block;
    color: var(--article-gold);
    transition: opacity 0.24s ease;
}

.article-tegaki-renderer.is-live .article-tegaki-fallback {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    inset: 0;
    filter: blur(0.8px);
}

/* ---------- Two-column Pretext body ---------- */
.article-body-stage {
    position: relative;
    height: 460px;
    overflow: hidden;
    margin-bottom: 20px;
}

.article-body-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
    height: 100%;
}

.article-body-left,
.article-body-right {
    position: relative;
    height: 100%;
}

.article-body-left {
    padding-right: 28px;
}

.article-body-right {
    padding-left: 28px;
}

.article-dropcap {
    position: absolute;
    top: 2px;
    left: 0;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(4rem, 6vw, 5.6rem);
    line-height: 0.88;
    color: var(--article-gold);
    pointer-events: none;
    user-select: none;
    text-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.article-body-text {
    position: relative;
    width: 100%;
    height: 100%;
    font-size: clamp(0.98rem, 1.04vw, 1.08rem);
    line-height: 1.82;
    letter-spacing: 0.01em;
    color: var(--article-paper);
    pointer-events: none;
    user-select: none;
}

.article-glyph {
    position: absolute;
    left: 0;
    top: 0;
    display: inline-block;
    opacity: 0;
    transform: translate3d(0, 0, 0);
    text-shadow: 0 0 14px rgba(4, 15, 15, 0.18);
}

/* ---------- Decorative Seal ---------- */
.article-seal {
    position: absolute;
    width: var(--article-seal);
    height: var(--article-seal);
    border-radius: 50%;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.14), transparent 26%),
        linear-gradient(135deg, rgba(82, 30, 22, 0.96), rgba(130, 60, 38, 0.96));
    border: 1.8px solid rgba(161, 75, 45, 0.42);
    box-shadow:
        0 18px 40px rgba(61, 30, 22, 0.12),
        inset 0 0 0 9px rgba(239, 227, 207, 0.08);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.article-seal::before {
    content: "";
    position: absolute;
    inset: -16%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(161, 75, 45, 0.16), transparent 58%);
    animation: articleSealGlow 5.2s ease-in-out infinite;
    z-index: 0;
}

@keyframes articleSealGlow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.article-seal-inner {
    position: relative;
    z-index: 1;
    text-align: center;
}

.article-seal-kicker,
.article-seal-tail {
    display: block;
    font-family: "Playfair Display", Georgia, serif;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.56rem;
    color: rgba(239, 227, 207, 0.66);
}

.article-seal-title {
    display: block;
    margin: 8px 0 6px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(1.1rem, 1.6vw, 1.5rem);
    line-height: 1.02;
    color: var(--article-ink);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ---------- Mobile body fallback ---------- */
.article-mobile-body {
    display: none;
}

/* ---------- Article Content ---------- */
.article-content {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 0 40px;
    line-height: 1.78;
    font-size: clamp(1rem, 1.05vw, 1.12rem);
    color: var(--article-ink);
}

.article-content h2 {
    margin: 3rem 0 1.2rem;
    padding-top: 2rem;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--article-ink);
    position: relative;
}

.article-content h2:first-of-type {
    margin-top: 1.5rem;
    padding-top: 0;
}

.article-content h3 {
    margin: 2.2rem 0 1rem;
    padding-top: 1.5rem;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--article-ink);
}

.article-content p {
    margin: 0 0 1.2rem;
}

.article-content a {
    color: var(--article-gold);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.article-content a:hover {
    border-bottom-color: var(--article-gold);
}

.article-content blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    border-left: 3px solid var(--article-gold);
    background: rgba(161, 75, 45, 0.04);
    font-style: italic;
    color: var(--article-paper-soft);
}

.article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2rem auto;
}

.article-content .article-figure {
    text-align: center;
    margin: 2.5rem auto;
    max-width: 400px;
}

.article-content .article-figure img {
    width: 100%;
    height: auto;
    border: 1px solid rgba(23, 18, 15, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    margin: 0 auto;
}

.article-content .article-figure figcaption {
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--article-paper-soft);
    margin-top: 0.75rem;
    text-align: center;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
    font-style: normal;
}

.article-content .section-divider {
    text-align: center;
    margin: 2.5rem 0;
    color: rgba(161, 75, 45, 0.4);
    font-size: 1.4rem;
    letter-spacing: 0.5em;
}

/* ---------- Scroll-reveal ---------- */
[data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.19, 1, 0.22, 1),
                transform 0.7s cubic-bezier(0.19, 1, 0.22, 1);
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Footer ---------- */
.article-footer {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 0 48px;
    border-top: 1px solid var(--article-rule);
}

.article-footer a {
    font-family: "Playfair Display", Georgia, serif;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    color: var(--article-gold);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.article-footer a:hover {
    opacity: 0.7;
}

/* ---------- Site footer override ---------- */
body.article-page .footer {
    background: transparent;
    border-top: 1px solid var(--article-rule);
}

/* ---------- Mobile Responsive (≤ 900px) ---------- */
@media (max-width: 900px) {
    body.article-page .layout {
        padding: 20px 0 32px;
    }

    .article-hero-title {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }

    .article-body-stage {
        display: none;
    }

    .article-mobile-body {
        display: block;
        max-width: 720px;
        margin: 0 auto 24px;
        line-height: 1.78;
        font-size: 1rem;
        color: var(--article-ink);
    }

    .article-mobile-body p {
        margin: 0 0 1.2rem;
    }

    .article-content {
        padding: 0 0 32px;
    }

    .article-seal {
        display: none;
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    [data-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .article-seal::before {
        animation: none;
    }
}
