/* ============================================
   六祖坛经 / Platform Sutra — Shared Stylesheet
   yiqidao.com/tanjing/
   Matches site-wide design language
   ============================================ */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --ink-50: #f5f5f0;
    --ink-100: #e8e6e1;
    --ink-200: #d4d0c8;
    --ink-300: #b8b2a7;
    --ink-400: #9a9185;
    --ink-500: #7d7569;
    --ink-600: #5c554c;
    --ink-700: #3d3833;
    --ink-800: #2a2622;
    --ink-900: #1a1815;
    --cinnabar-400: #c45c48;
    --cinnabar-500: #a84838;
    --cinnabar-600: #8b3a2d;
    --gold-400: #c9a96e;
    --gold-500: #b8944f;
    --max-width: 1200px;
    --nav-height: 60px;
}

html { scroll-behavior: smooth; }

body {
    font-family: "Noto Sans SC", "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink-800);
    background: var(--ink-50);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--cinnabar-500); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--cinnabar-600); }

img { max-width: 100%; height: auto; display: block; }

/* ============ Top Navigation ============ */
.top-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: var(--ink-900); border-bottom: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.nav-inner {
    max-width: var(--max-width); margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem; height: var(--nav-height);
}
.nav-logo {
    font-size: 1.1rem; font-weight: 700; color: var(--gold-400);
    letter-spacing: 0.05em; white-space: nowrap;
}
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a {
    color: rgba(255,255,255,0.75); font-size: 0.85rem; letter-spacing: 0.05em;
    padding: 0.25rem 0; border-bottom: 2px solid transparent; transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
    color: #fff; border-bottom-color: var(--gold-400);
}
.lang-switch { display: flex; gap: 0.5rem; margin-left: 1.5rem; }
.lang-switch a {
    font-size: 0.75rem; color: rgba(255,255,255,0.5);
    padding: 0.2rem 0.5rem; border-radius: 4px; transition: all 0.2s;
}
.lang-switch a:hover, .lang-switch a.active {
    color: #fff; background: rgba(255,255,255,0.12);
}
.mobile-menu-btn {
    display: none; background: none; border: none; color: #fff;
    font-size: 1.5rem; cursor: pointer;
}

@media (max-width: 768px) {
    .nav-links, .lang-switch { display: none; }
    .nav-links.show {
        display: flex; flex-direction: column;
        position: absolute; top: var(--nav-height); left: 0; right: 0;
        background: var(--ink-900); padding: 1rem 1.5rem; gap: 0.75rem;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .nav-links.show + .lang-switch { display: flex; }
    .mobile-menu-btn { display: block; }
}

/* ============ Hero ============ */
.hero {
    position: relative; min-height: 90vh; display: flex; align-items: center;
    justify-content: center; text-align: center;
    background: linear-gradient(135deg, var(--ink-900) 0%, #2c2520 40%, var(--ink-800) 100%);
    padding: calc(var(--nav-height) + 2rem) 1.5rem 4rem;
    overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(168,72,56,0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 30%, rgba(201,169,110,0.06) 0%, transparent 50%);
}
.hero-content { position: relative; z-index: 1; max-width: 800px; }
.hero-subtitle {
    color: rgba(255,255,255,0.5); font-size: 0.85rem;
    letter-spacing: 0.3em; margin-bottom: 1.5rem;
}
.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 700;
    color: #fff; letter-spacing: 0.15em; margin-bottom: 0.5rem;
    text-shadow: 2px 2px 12px rgba(0,0,0,0.3);
}
.hero-romanization {
    color: var(--gold-400); font-size: 0.9rem;
    letter-spacing: 0.2em; margin-bottom: 1.5rem;
}
.hero-desc {
    color: rgba(255,255,255,0.6); font-size: 0.9rem; margin-bottom: 2rem;
}
.hero-quote {
    color: rgba(255,255,255,0.8); font-size: 1.05rem; line-height: 2;
    margin-bottom: 2.5rem; font-style: italic;
}
.hero-stats {
    display: flex; justify-content: center; gap: 2.5rem; flex-wrap: wrap;
}
.stat { text-align: center; }
.stat strong {
    display: block; font-size: 2rem; font-weight: 700; color: var(--gold-400);
}
.stat span { font-size: 0.8rem; color: rgba(255,255,255,0.5); letter-spacing: 0.1em; }

/* ============ Section Titles ============ */
.section-title {
    font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700;
    color: var(--ink-900); text-align: center;
    margin-bottom: 0.5rem; letter-spacing: 0.05em;
}
.section-subtitle {
    text-align: center; color: var(--ink-500); font-size: 0.9rem;
    max-width: 600px; margin: 0 auto 2.5rem;
}

/* ============ About Section ============ */
.about-section {
    max-width: var(--max-width); margin: 0 auto;
    padding: 4rem 1.5rem;
}
.about-grid {
    display: grid; grid-template-columns: 2fr 1fr; gap: 3rem;
    align-items: start;
}
.about-main h3 {
    font-size: 1.3rem; font-weight: 700; color: var(--ink-900);
    margin-bottom: 1rem; padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--cinnabar-500); display: inline-block;
}
.about-main p {
    color: var(--ink-600); margin-bottom: 1rem; line-height: 1.9;
}
.about-card {
    background: #fff; border-radius: 12px; padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid var(--ink-100);
}
.about-card h4 {
    font-size: 1rem; font-weight: 700; color: var(--cinnabar-500);
    margin-bottom: 1rem;
}
.about-card ul { list-style: none; }
.about-card li {
    padding: 0.5rem 0; border-bottom: 1px solid var(--ink-100);
    font-size: 0.85rem; color: var(--ink-600); line-height: 1.6;
}
.about-card li:last-child { border-bottom: none; }
.about-card li strong { color: var(--ink-800); }

@media (max-width: 768px) {
    .about-grid { grid-template-columns: 1fr; }
}

/* ============ Concepts Grid ============ */
.concepts-section {
    max-width: var(--max-width); margin: 0 auto;
    padding: 4rem 1.5rem;
    background: linear-gradient(to bottom, var(--ink-50), #fff);
}
.concepts-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.25rem;
}
.concept-card {
    background: #fff; border-radius: 12px; padding: 1.5rem 1rem;
    text-align: center; border: 1px solid var(--ink-100);
    transition: all 0.3s; display: block; color: inherit;
}
.concept-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.1);
    border-color: var(--cinnabar-500); color: inherit;
}
.concept-icon {
    width: 48px; height: 48px; margin: 0 auto 0.75rem;
    background: linear-gradient(135deg, var(--cinnabar-500), var(--cinnabar-600));
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.2rem; font-weight: 700;
}
.concept-card h3 { font-size: 0.95rem; font-weight: 700; color: var(--ink-900); margin-bottom: 0.25rem; }
.concept-card p { font-size: 0.8rem; color: var(--ink-500); margin-bottom: 0.5rem; }
.concept-ref { font-size: 0.7rem; color: var(--ink-400); }

/* ============ Chapters Grid ============ */
.chapters-section {
    max-width: var(--max-width); margin: 0 auto;
    padding: 4rem 1.5rem;
}
.chapters-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.chapter-card {
    display: flex; align-items: flex-start; gap: 1rem;
    background: #fff; border-radius: 12px; padding: 1.25rem;
    border: 1px solid var(--ink-100); transition: all 0.3s;
    color: inherit;
}
.chapter-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-color: var(--cinnabar-500); color: inherit;
}
.chapter-num {
    flex-shrink: 0; width: 40px; height: 40px;
    background: var(--ink-100); border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; font-weight: 700; color: var(--ink-600);
}
.chapter-card:hover .chapter-num {
    background: var(--cinnabar-500); color: #fff;
}
.chapter-info h3 { font-size: 0.95rem; font-weight: 700; color: var(--ink-900); margin-bottom: 0.25rem; }
.chapter-info p { font-size: 0.8rem; color: var(--ink-500); line-height: 1.6; margin-bottom: 0.5rem; }
.chapter-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chapter-tags span {
    font-size: 0.65rem; padding: 0.15rem 0.5rem; border-radius: 999px;
    background: var(--ink-100); color: var(--ink-500);
}

/* ============ Philosophy Grid ============ */
.philosophy-section {
    max-width: var(--max-width); margin: 0 auto;
    padding: 4rem 1.5rem;
    background: linear-gradient(to bottom, #fff, var(--ink-50));
}
.philosophy-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}
.philosophy-card {
    background: #fff; border-radius: 12px; padding: 2rem 1.5rem;
    border: 1px solid var(--ink-100); transition: all 0.3s;
    display: block; color: inherit;
}
.philosophy-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.1);
    border-color: var(--gold-400); color: inherit;
}
.philosophy-icon {
    width: 56px; height: 56px; margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.5rem; font-weight: 700;
}
.philosophy-card h3 { font-size: 1.1rem; font-weight: 700; color: var(--ink-900); margin-bottom: 0.5rem; }
.philosophy-card p { font-size: 0.85rem; color: var(--ink-500); line-height: 1.7; margin-bottom: 1rem; }
.read-more { font-size: 0.8rem; color: var(--cinnabar-500); font-weight: 500; }

/* ============ Modern Grid ============ */
.modern-section {
    max-width: var(--max-width); margin: 0 auto;
    padding: 4rem 1.5rem;
}
.modern-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}
.modern-card {
    background: #fff; border-radius: 12px; padding: 2rem 1.5rem;
    border: 1px solid var(--ink-100); transition: all 0.3s;
    display: block; color: inherit;
}
.modern-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.1);
    border-color: var(--cinnabar-500); color: inherit;
}
.modern-icon { font-size: 2rem; margin-bottom: 1rem; }
.modern-card h3 { font-size: 1.1rem; font-weight: 700; color: var(--ink-900); margin-bottom: 0.5rem; }
.modern-card p { font-size: 0.85rem; color: var(--ink-500); line-height: 1.7; margin-bottom: 1rem; }
.read-more { font-size: 0.8rem; color: var(--cinnabar-500); font-weight: 500; }

/* ============ Quotes ============ */
.quotes-section {
    max-width: var(--max-width); margin: 0 auto;
    padding: 4rem 1.5rem;
    background: linear-gradient(to bottom, var(--ink-50), #fff);
}
.quotes-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}
.quote-card {
    background: #fff; border-radius: 12px; padding: 1.5rem;
    border-left: 3px solid var(--cinnabar-500);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.quote-card p {
    font-size: 0.95rem; color: var(--ink-700); line-height: 1.8;
    font-style: italic; margin-bottom: 0.75rem;
}
.quote-card cite {
    font-size: 0.8rem; color: var(--ink-400); font-style: normal;
}

/* ============ Related / Further Reading ============ */
.related-section {
    max-width: var(--max-width); margin: 0 auto;
    padding: 4rem 1.5rem;
}
.related-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}
.related-card {
    background: #fff; border-radius: 12px; padding: 1.5rem;
    border: 1px solid var(--ink-100); transition: all 0.3s;
    display: block; color: inherit;
}
.related-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08); color: inherit;
}
.related-icon {
    display: inline-flex; width: 36px; height: 36px;
    background: var(--ink-100); border-radius: 8px;
    align-items: center; justify-content: center;
    font-size: 1rem; margin-bottom: 0.75rem;
}
.related-card h3 { font-size: 0.95rem; font-weight: 700; color: var(--ink-900); margin-bottom: 0.25rem; }
.related-card p { font-size: 0.8rem; color: var(--ink-500); line-height: 1.6; }

/* ============ Footer ============ */
.site-footer {
    background: var(--ink-900); color: #fff; padding: 3rem 0 0;
}
.footer-inner { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }
.footer-main {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem; padding-bottom: 2rem;
}
.footer-brand h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; }
.footer-brand p { font-size: 0.8rem; color: var(--ink-300); line-height: 1.7; }
.footer-nav h4 {
    font-size: 0.85rem; font-weight: 700; color: var(--gold-400);
    margin-bottom: 0.75rem;
}
.footer-nav ul { list-style: none; }
.footer-nav li { margin-bottom: 0.4rem; }
.footer-nav a { color: var(--ink-300); font-size: 0.8rem; transition: color 0.2s; }
.footer-nav a:hover { color: #fff; }
.footer-bottom {
    border-top: 1px solid var(--ink-700); padding: 1.5rem 0;
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 0.5rem;
    font-size: 0.75rem; color: var(--ink-400);
}

@media (max-width: 768px) {
    .footer-main { grid-template-columns: 1fr 1fr; }
    .footer-bottom { flex-direction: column; text-align: center; }
}

/* ============ Content Page Styles ============ */
.content-section {
    max-width: 800px; margin: 0 auto;
    padding: 4rem 1.5rem;
}
.content-section h2 {
    font-size: 1.8rem; font-weight: 700; color: var(--ink-900);
    margin-bottom: 1rem; padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--cinnabar-500);
}
.content-section h3 {
    font-size: 1.3rem; font-weight: 700; color: var(--ink-800);
    margin: 2rem 0 0.75rem;
}
.content-section p {
    color: var(--ink-600); line-height: 1.9; margin-bottom: 1rem;
}
.content-section blockquote {
    border-left: 3px solid var(--cinnabar-500);
    padding: 1rem 1.5rem; margin: 1.5rem 0;
    background: #fff; border-radius: 0 8px 8px 0;
    font-style: italic; color: var(--ink-700);
}
.content-section ul, .content-section ol {
    padding-left: 1.5rem; margin-bottom: 1rem;
    color: var(--ink-600);
}
.content-section li { margin-bottom: 0.5rem; line-height: 1.7; }
.content-section .back-link {
    display: inline-block; margin-bottom: 2rem;
    font-size: 0.85rem; color: var(--cinnabar-500);
}

/* ============ Breadcrumb ============ */
.breadcrumb {
    max-width: var(--max-width); margin: 0 auto;
    padding: calc(var(--nav-height) + 1rem) 1.5rem 0;
    font-size: 0.8rem; color: var(--ink-400);
}
.breadcrumb a { color: var(--ink-400); }
.breadcrumb a:hover { color: var(--cinnabar-500); }
.breadcrumb span { margin: 0 0.3rem; }

/* ============ Page Header ============ */
.page-header {
    background: linear-gradient(135deg, var(--ink-900) 0%, var(--ink-800) 100%);
    padding: calc(var(--nav-height) + 3rem) 1.5rem 3rem;
    text-align: center;
}
.page-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 700;
    color: #fff; letter-spacing: 0.1em; margin-bottom: 0.5rem;
}
.page-header p {
    color: rgba(255,255,255,0.6); font-size: 0.9rem;
    max-width: 600px; margin: 0 auto;
}

/* ============ Table of Contents (sticky sidebar) ============ */
@media (min-width: 1024px) {
    .with-toc {
        display: grid; grid-template-columns: 1fr 220px; gap: 2rem;
        max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem;
    }
    .toc-sidebar {
        position: sticky; top: calc(var(--nav-height) + 2rem);
        align-self: start; padding: 1.5rem 0;
    }
    .toc-sidebar h4 {
        font-size: 0.8rem; font-weight: 700; color: var(--ink-400);
        text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.75rem;
    }
    .toc-sidebar ul { list-style: none; }
    .toc-sidebar li { margin-bottom: 0.4rem; }
    .toc-sidebar a {
        font-size: 0.8rem; color: var(--ink-500); display: block;
        padding: 0.2rem 0; border-left: 2px solid transparent;
        padding-left: 0.75rem; transition: all 0.2s;
    }
    .toc-sidebar a:hover, .toc-sidebar a.active {
        color: var(--cinnabar-500); border-left-color: var(--cinnabar-500);
    }
}

/* ============ Animations ============ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.hero-content { animation: fadeIn 1.2s ease-out; }
.chapter-card, .concept-card, .philosophy-card, .modern-card, .quote-card, .related-card {
    animation: slideUp 0.6s ease-out both;
}
.chapter-card:nth-child(2) { animation-delay: 0.05s; }
.chapter-card:nth-child(3) { animation-delay: 0.1s; }
.chapter-card:nth-child(4) { animation-delay: 0.15s; }
.chapter-card:nth-child(5) { animation-delay: 0.2s; }
.chapter-card:nth-child(6) { animation-delay: 0.25s; }
.chapter-card:nth-child(7) { animation-delay: 0.3s; }
.chapter-card:nth-child(8) { animation-delay: 0.35s; }
.chapter-card:nth-child(9) { animation-delay: 0.4s; }
.chapter-card:nth-child(10) { animation-delay: 0.45s; }
