/* ==========================================================================
   heritage.5l5l.net — UNESCO 世界遗产百科
   设计基调：国际化文化参考站（石材/文化棕色调，参考 UNESCO/大英博物馆风格）
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
    --bg:            #f7f4ee;
    --bg-elev:       #ffffff;
    --bg-subtle:     #efe9df;
    --border:        #e2daca;
    --border-strong: #c9bda6;
    --text:          #2b2320;
    --text-muted:    #57493f;
    --text-faint:    #6f6257;
    --brand:         #7c4a23;
    --brand-dark:    #5f3618;
    --brand-soft:    #f3e9dc;
    --focus:         #7c4a23;
    --shadow-sm:     0 1px 2px rgba(60,40,20,.06), 0 1px 3px rgba(60,40,20,.08);
    --shadow-md:     0 4px 12px rgba(60,40,20,.08);
    --shadow-lg:     0 12px 32px rgba(60,40,20,.12);
    --radius:        10px;
    --radius-sm:     6px;
    --radius-lg:     16px;
    --header-h:      64px;
    --wrap:          1240px;

    /* 分类色（WCAG AA 达标） */
    --cat-cultural:  #7c4a23;
    --cat-natural:   #2f6b3c;
    --cat-mixed:     #8a6d1a;
    --cat-other:     #6f6257;
}

/* ---------- 2. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Noto Sans", "Noto Sans SC", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

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

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.6rem); }
h2 { font-size: clamp(1.25rem, 1.1rem + .8vw, 1.6rem); }
h3 { font-size: 1.08rem; }
p  { margin: 0 0 1em; }

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-radius: 4px;
}

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
    z-index: 200;
}
.skip-link:focus {
    position: fixed; left: 0; top: 0; width: auto; height: auto;
    padding: 12px 20px; margin: 0; overflow: visible; clip: auto;
    background: var(--brand); color: #fff; font-weight: 600;
    z-index: 200; border-radius: 0 0 var(--radius) 0;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---------- 3. Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255,255,255,.92);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

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

.brand {
    display: inline-flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 1.05rem; color: var(--text);
    white-space: nowrap; flex-shrink: 0;
}
.brand:hover { text-decoration: none; color: var(--text); }

.brand-mark {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px; border-radius: 8px;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    color: #fff; font-size: .82rem; font-weight: 700; letter-spacing: -.02em;
}

.nav-links { display: flex; gap: 4px; margin-inline-start: 4px; }
.nav-links a {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 36px; min-width: 36px; padding: 0 10px;
    border-radius: var(--radius-sm); color: var(--text-muted);
    font-size: .92rem; font-weight: 500; white-space: nowrap;
}
.nav-links a:hover { background: var(--bg-subtle); color: var(--text); text-decoration: none; }

.search-box { margin-inline-start: auto; display: flex; gap: 6px; }
.search-box input {
    width: 190px; min-height: 38px; padding: 0 12px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--bg-elev); color: var(--text); font-size: .92rem;
    font-family: inherit;
}
.search-box input:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}
.search-box button {
    min-height: 38px; min-width: 44px; padding: 0 14px;
    border: 0; border-radius: var(--radius-sm);
    background: var(--brand); color: #fff; font-size: .9rem; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.search-box button:hover { background: var(--brand-dark); }

.lang-switch select {
    min-height: 38px; max-width: 150px; padding: 0 8px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--bg-elev); color: var(--text);
    font-size: .88rem; font-family: inherit; cursor: pointer;
}

/* ---------- 4. Hero ---------- */
.hero {
    padding: clamp(36px, 6vw, 72px) 0 clamp(20px, 3vw, 32px);
    text-align: center;
    background:
        radial-gradient(1200px 380px at 50% -12%, rgba(124,74,35,.10), transparent 62%),
        linear-gradient(180deg, #fff, var(--bg));
    border-bottom: 1px solid var(--border);
}
.hero h1 {
    margin-bottom: .35em;
    background: linear-gradient(120deg, #2b2320 30%, var(--brand-dark));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: var(--brand-dark);
}
.hero > p {
    max-width: 720px; margin: 0 auto 1.5rem;
    color: var(--text-muted); font-size: clamp(.98rem, .94rem + .25vw, 1.1rem);
}

.hero-stats { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.stat {
    display: inline-flex; align-items: baseline; gap: 8px;
    padding: 10px 20px; border-radius: 999px;
    background: var(--bg-elev); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.stat strong { font-size: 1.3rem; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.stat span { color: var(--text-muted); font-size: .88rem; }

/* ---------- 5. Section ---------- */
main.wrap { padding-bottom: 48px; }

.section { padding: clamp(28px, 4vw, 48px) 0 0; }
.section > h2 {
    margin-bottom: .6em; padding-bottom: .4em;
    border-bottom: 2px solid var(--border);
}
.section h3 { margin: 1.2em 0 .6em; color: var(--text-muted); font-size: .95rem; text-transform: uppercase; letter-spacing: .05em; }

.lead { color: var(--text-muted); font-size: 1.02rem; }

.crumbs {
    padding: 16px 0 4px; font-size: .87rem; color: var(--text-faint);
    display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
}
.crumbs a {
    color: var(--text-muted);
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; min-height: 32px; padding: 0 4px;
}
.crumbs a:hover { color: var(--brand); }

/* ---------- 6. Chips & country cloud ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 34px; padding: 0 14px; border-radius: 999px;
    background: var(--bg-elev); border: 1px solid var(--border);
    color: var(--text); font-size: .87rem; font-weight: 500;
    box-shadow: var(--shadow-sm);
}
.chip:hover { border-color: var(--brand); color: var(--brand-dark); text-decoration: none; }
.chip em { font-style: normal; color: var(--text-faint); font-size: .78rem; }
.chip-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-active em { color: rgba(255,255,255,.8); }

.country-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.country-chip {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 32px; min-width: 44px; padding: 0 10px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--bg-elev); color: var(--text-muted);
    font-size: .8rem; font-weight: 600; letter-spacing: .03em;
    font-variant-numeric: tabular-nums;
}
.country-chip:hover { border-color: var(--brand); color: var(--brand-dark); text-decoration: none; }
.country-chip-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- 7. Site cards ---------- */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.sites-grid-full { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.site-card {
    display: flex; flex-direction: column;
    border-radius: var(--radius);
    background: var(--bg-elev); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .12s ease, box-shadow .12s ease;
}
.site-card:hover {
    text-decoration: none; color: inherit;
    transform: translateY(-2px); box-shadow: var(--shadow-md);
}
.site-thumb {
    width: 100%; height: 150px; object-fit: cover;
    background: var(--bg-subtle);
}
.site-card-body { padding: 12px 14px 14px; }
.site-card-body h3 {
    margin: 0 0 .4em; font-size: .98rem; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-meta {
    margin: 0; font-size: .78rem; color: var(--text-faint);
    display: flex; flex-wrap: wrap; gap: 4px 10px;
}

.view-all-wrap { margin-top: 18px; }

/* ---------- 8b. Pager ---------- */
.pager {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; margin-top: 28px; flex-wrap: wrap;
}
.pager-info {
    font-size: .92rem; font-weight: 600; color: var(--text-muted);
    font-variant-numeric: tabular-nums; min-height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- 8. Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 40px; min-width: 40px; padding: 0 18px;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    background: var(--brand); color: #fff; font-size: .92rem; font-weight: 600;
    font-family: inherit; cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--brand-dark); color: #fff; text-decoration: none; }
.btn-ghost {
    background: var(--bg-elev); color: var(--text); border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text); border-color: var(--brand); }

/* ---------- 9. Site detail page ---------- */
.site-detail { padding-top: 20px; }

.site-hero {
    display: flex; gap: 26px; align-items: flex-start; flex-wrap: wrap;
    padding: 26px; border-radius: var(--radius-lg);
    background: var(--bg-elev); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.site-hero-img {
    flex: 0 1 360px; min-width: 0;
    border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow-md);
}
.site-hero-img img { width: 100%; height: 230px; object-fit: cover; }
.site-hero-img-placeholder {
    width: 100%; height: 230px; display: grid; place-items: center;
    background: var(--bg-subtle); color: var(--text-faint);
    font-size: .9rem; font-weight: 600;
}
.site-hero-info { flex: 1 1 320px; min-width: 0; }
.site-hero-info h1 { margin-bottom: .2em; }
.site-hero-en { color: var(--text-faint); font-size: .9rem; margin-bottom: .4em; }
.site-hero-sub { color: var(--text-muted); margin-bottom: 1em; }

.site-pager { display: flex; gap: 8px; flex-wrap: wrap; }

.prop-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1px; margin: 0; padding: 0;
    background: var(--border); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.prop { background: var(--bg-elev); padding: 12px 14px; min-width: 0; }
.prop dt {
    font-size: .74rem; color: var(--text-faint); font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px;
}
.prop dd {
    margin: 0; font-size: .96rem; font-weight: 600; color: var(--text);
    font-variant-numeric: tabular-nums; word-break: break-word;
}

.site-desc { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.site-desc p { margin: 0 0 .8em; color: var(--text-muted); }
.site-desc .desc-en { font-size: .88rem; color: var(--text-faint); }

/* ---------- 10. Legal pages ---------- */
.legal { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(20px, 4vw, 40px); margin: 20px 0 0; box-shadow: var(--shadow-sm); }
.legal-block { margin-top: 26px; }
.legal-block h2 { font-size: 1.12rem; border-bottom: 1px solid var(--border); padding-bottom: .35em; }
.legal-block p, .legal-block li { color: var(--text-muted); font-size: .93rem; }
.legal-links { padding-inline-start: 20px; }
.legal-links li { margin-bottom: 6px; }
.legal-updated { font-size: .82rem; color: var(--text-faint); }

.error-page { text-align: center; padding-top: 80px; }
.error-page h1 { font-size: 4rem; color: var(--border-strong); margin-bottom: .1em; }

/* ---------- 11. Search ---------- */
.search-box-page { margin: 18px 0 24px; max-width: 560px; }
.search-box-page input { width: 100%; min-height: 44px; }
.search-box-page button { min-height: 44px; }
.count-badge {
    display: inline-block; padding: 5px 12px; border-radius: 999px;
    background: var(--brand-soft); color: var(--brand-dark);
    font-size: .84rem; font-weight: 600; margin-bottom: 16px;
}
.empty { color: var(--text-muted); }

/* ---------- 12. Ads ---------- */
.ad-slot {
    margin: 28px 0; padding: 0; min-height: 0;
    display: block; text-align: center;
}
.ad-label {
    font-size: .75rem; color: var(--text-faint); text-transform: uppercase;
    letter-spacing: .08em; margin: 0 0 4px; text-align: center;
}
.ad-slot ins { display: block; width: 100%; }
.ad-in-article { margin: 30px 0; }
.ad-bottom { margin-top: 40px; }

/* 广告未填充时保留占位高度，避免 CLS（塌陷型广告位） */
.ad-slot ins { min-height: 0; }

/* ---------- 13. Consent banner ---------- */
.consent-banner {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 300;
    background: var(--bg-elev); border-top: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}
body.consent-open { padding-bottom: 96px; }
.consent-inner {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding-top: 14px; padding-bottom: 14px;
}
.consent-text { flex: 1 1 320px; margin: 0; font-size: .88rem; color: var(--text-muted); }
.consent-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-accept { background: var(--brand); }
.btn-reject { background: transparent; color: var(--text-muted); border-color: var(--border-strong); }
.btn-reject:hover { background: var(--bg-subtle); color: var(--text); }

/* ---------- 14. Footer ---------- */
.site-footer {
    margin-top: 56px; padding: 32px 0;
    background: var(--bg-elev); border-top: 1px solid var(--border);
    color: var(--text-muted); font-size: .88rem;
}
.site-footer p { margin: 0 0 .5em; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 0; }
.footer-links a {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 34px; min-width: 34px; padding: 0 6px; color: var(--text-muted);
}
.footer-links a:hover { color: var(--brand); text-decoration: none; }
.copy { color: var(--text-faint); font-size: .82rem; }
.attribution { color: var(--text-faint); font-size: .8rem; }

/* ---------- 15. RTL ---------- */
[dir="rtl"] .site-hero { text-align: right; }

/* ---------- 16. Responsive ---------- */
@media (max-width: 1080px) {
    .search-box input { width: 150px; }
    .nav-links a { padding: 0 8px; font-size: .88rem; }
}

@media (max-width: 860px) {
    .header-inner { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
    .nav-links { order: 3; width: 100%; overflow-x: auto; }
    .search-box { margin-inline-start: auto; order: 2; }
    .lang-switch { order: 2; }
    .site-hero-img { flex-basis: 100%; }
}

@media (max-width: 640px) {
    body { font-size: 15px; }
    .wrap { padding: 0 14px; }
    .site-header { position: static; }
    .search-box { order: 4; width: 100%; margin-inline-start: 0; }
    .search-box input { width: 100%; }
    .nav-links { order: 3; }
    .site-hero { padding: 18px; gap: 16px; }
    .prop-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .sites-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .sites-grid-full { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .site-thumb { height: 110px; }
    .consent-inner { flex-direction: column; align-items: stretch; }
    .consent-actions .btn { flex: 1; }
}

@media (max-width: 380px) {
    .sites-grid, .sites-grid-full { grid-template-columns: 1fr 1fr; }
    .prop-grid { grid-template-columns: 1fr 1fr; }
}

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

@media print {
    .site-header, .site-footer, .ad-slot, .consent-banner, .site-pager { display: none !important; }
    body { background: #fff; }
}
/* hero actions */
.hero-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* ---------- P1-P3 内容增厚样式 ---------- */

/* 徽章 */
.site-badges {
    display: flex;
    gap: 8px;
    margin: 12px 0 16px 0;
    flex-wrap: wrap;
}
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    line-height: 24px;
}
.badge-danger {
    background: #fee;
    color: #c0392b;
    border: 1px solid #e74c3c;
}
.badge-region {
    background: #e8f0fe;
    color: #1a56db;
    border: 1px solid #4a90e2;
}
.badge-transnational {
    background: #e6f7f4;
    color: #0f766e;
    border: 1px solid #14b8a6;
}

/* criteria 标签 */
.criteria-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}
.criteria-tag {
    display: inline-block;
    padding: 6px 14px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-family: monospace;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}
.criteria-note {
    font-size: 13px;
    color: #6c757d;
    margin-top: 8px;
}

/* 地图容器 */
.map-container {
    width: 100%;
    height: 600px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}
.map-popup-content {
    min-width: 200px;
}
.map-popup-content h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
}
.map-popup-content p {
    margin: 0;
    color: #6c757d;
}

/* 统计页 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.stat-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 32px 20px;
    text-align: center;
}
.stat-card strong {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: #1a56db;
}
.stat-card span {
    font-size: 14px;
    color: #6c757d;
}

/* 年代统计 */
.era-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.era-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
    padding: 16px 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
}
.era-stat strong {
    font-size: 28px;
    font-weight: 700;
    color: #1a56db;
}
.era-stat span {
    font-size: 13px;
    color: #6c757d;
}

/* Top 国家 */
.top-countries {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 区域 lead */
.lead {
    font-size: 16px;
    color: #495057;
    margin: 8px 0 24px 0;
}

/* 响应式 */
@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .map-container {
        height: 400px;
    }
    .era-stats {
        gap: 8px;
    }
    .era-stat {
        min-width: 100px;
        padding: 12px 14px;
    }
}
