/* ==========================================================================
   chem.5l5l.net — 元素周期表百科
   设计基调：国际化科学参考站（参考 PubChem / periodic-table.io / Wikipedia）
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
    --bg:            #f6f8fa;
    --bg-elev:       #ffffff;
    --bg-subtle:     #eef1f5;
    --border:        #dfe4ea;
    --border-strong: #c6cdd6;
    --text:          #1c2430;
    --text-muted:    #4f5b68;
    --text-faint:    #5f6b7a;
    --brand:         #1a6fd4;
    --brand-dark:    #14549f;
    --brand-soft:    #e8f1fd;
    --focus:         #1a6fd4;
    --shadow-sm:     0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
    --shadow-md:     0 4px 12px rgba(16,24,40,.08);
    --shadow-lg:     0 12px 32px rgba(16,24,40,.12);
    --radius:        10px;
    --radius-sm:     6px;
    --radius-lg:     16px;
    --header-h:      64px;
    --wrap:          1240px;

    /* 元素分类色（WCAG AA 达标：白字底色对比度 ≥4.5） */
    --cat-alkali-metal:           #c0392b;
    --cat-alkaline-earth-metal:  #e67e22;
    --cat-transition-metal:      #b8860b;
    --cat-post-transition-metal: #7f8c8d;
    --cat-metalloid:             #16a085;
    --cat-nonmetal:              #27ae60;
    --cat-halogen:               #2980b9;
    --cat-noble-gas:             #8e44ad;
    --cat-lanthanide:            #16a085;
    --cat-actinide:              #c0392b;
    --cat-other:                 #95a5a6;
}

/* ---------- 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; left: -9999px; top: 0; z-index: 200;
    background: var(--brand); color: #fff; padding: 12px 20px;
    border-radius: 0 0 var(--radius) 0; font-weight: 600;
}
.skip-link:focus { left: 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(26,111,212,.10), transparent 62%),
        linear-gradient(180deg, #fff, var(--bg));
    border-bottom: 1px solid var(--border);
}
.hero h1 {
    margin-bottom: .35em;
    background: linear-gradient(120deg, #1c2430 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. Periodic table grid ---------- */
.pt-hint {
    color: var(--text-faint); font-size: .82rem; margin: -.2em 0 .6em;
    display: none;
}

.pt-scroll {
    overflow-x: auto; overflow-y: hidden;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.pt-scroll::-webkit-scrollbar { height: 10px; }
.pt-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
.pt-scroll::-webkit-scrollbar-track { background: var(--bg-subtle); border-radius: 6px; }

.pt-wrap { display: flex; gap: 6px; min-width: 940px; }

.pt-axis { display: grid; gap: 4px; }
.pt-axis-top {
    grid-template-columns: repeat(18, 1fr);
    margin-bottom: 6px; margin-inline-start: 26px;
}
.pt-axis-top span {
    text-align: center; font-size: .72rem; color: var(--text-faint);
    font-variant-numeric: tabular-nums; font-weight: 600;
}
.pt-axis-left {
    grid-template-rows: repeat(7, 1fr) 1fr 1fr;
    flex: 0 0 22px; width: 22px; gap: 4px;
}
.pt-axis-left span {
    display: grid; place-items: center; font-size: .72rem;
    color: var(--text-faint); font-weight: 600; min-height: 44px;
}

.pt-grid {
    display: grid;
    grid-template-columns: repeat(18, minmax(0, 1fr));
    grid-template-rows: repeat(7, auto) auto auto;
    gap: 4px;
    flex: 1;
}

.pt-cell, .pt-ph {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 66px; padding: 4px 2px;
    border-radius: var(--radius-sm);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-top: 3px solid var(--el-color, var(--border-strong));
    text-align: center;
    overflow: hidden;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.pt-cell:hover, .pt-cell:focus-visible {
    text-decoration: none; color: inherit;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--el-color, var(--brand));
    z-index: 2;
}
.pt-n {
    font-size: .7rem; color: var(--text-faint); font-weight: 600;
    line-height: 1.1; font-variant-numeric: tabular-nums;
}
.pt-s {
    font-size: 1.05rem; font-weight: 700; line-height: 1.15;
    color: var(--el-text, var(--text));
    margin: 1px 0;
}
.pt-name {
    /* 允许两行：Rutherfordium / Darmstadtium 这类长名在桌面端
       被截成 "Rutherfor…" 很难看。国际主流周期表站点同样采用两行名。 */
    font-size: .66rem; color: var(--text-muted); line-height: 1.08;
    max-width: 100%; overflow: hidden; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.pt-ph {
    border: 1px dashed var(--border-strong);
    background: repeating-linear-gradient(45deg, #f2f4f7, #f2f4f7 6px, #e9edf2 6px, #e9edf2 12px);
    color: var(--text-faint); font-size: .6rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .02em; padding: 2px;
}

/* 分类着色 */
.pt-cell.cat-alkali-metal,           .element-card.cat-alkali-metal           { --el-color: var(--cat-alkali-metal); }
.pt-cell.cat-alkaline-earth-metal,  .element-card.cat-alkaline-earth-metal  { --el-color: var(--cat-alkaline-earth-metal); }
.pt-cell.cat-transition-metal,      .element-card.cat-transition-metal      { --el-color: var(--cat-transition-metal); }
.pt-cell.cat-post-transition-metal, .element-card.cat-post-transition-metal { --el-color: var(--cat-post-transition-metal); }
.pt-cell.cat-metalloid,             .element-card.cat-metalloid             { --el-color: var(--cat-metalloid); }
.pt-cell.cat-nonmetal,              .element-card.cat-nonmetal              { --el-color: var(--cat-nonmetal); }
.pt-cell.cat-halogen,               .element-card.cat-halogen               { --el-color: var(--cat-halogen); }
.pt-cell.cat-noble-gas,             .element-card.cat-noble-gas             { --el-color: var(--cat-noble-gas); }
.pt-cell.cat-lanthanide,            .element-card.cat-lanthanide            { --el-color: var(--cat-lanthanide); }
.pt-cell.cat-actinide,              .element-card.cat-actinide              { --el-color: var(--cat-actinide); }
.pt-cell.cat-other,                 .element-card.cat-other                 { --el-color: var(--cat-other); }

.pt-legend {
    list-style: none; display: flex; flex-wrap: wrap; gap: 8px 16px;
    padding: 0; margin: 18px 0 0;
}
.pt-legend li {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: .85rem; color: var(--text-muted);
}
.pt-legend em { font-style: normal; color: var(--text-faint); font-size: .78rem; }
.lg-swatch {
    width: 13px; height: 13px; border-radius: 3px; display: inline-block;
    background: var(--el-color, var(--cat-other));
}
.lg-swatch.cat-alkali-metal           { background: var(--cat-alkali-metal); }
.lg-swatch.cat-alkaline-earth-metal  { background: var(--cat-alkaline-earth-metal); }
.lg-swatch.cat-transition-metal      { background: var(--cat-transition-metal); }
.lg-swatch.cat-post-transition-metal { background: var(--cat-post-transition-metal); }
.lg-swatch.cat-metalloid             { background: var(--cat-metalloid); }
.lg-swatch.cat-nonmetal              { background: var(--cat-nonmetal); }
.lg-swatch.cat-halogen               { background: var(--cat-halogen); }
.lg-swatch.cat-noble-gas             { background: var(--cat-noble-gas); }
.lg-swatch.cat-lanthanide            { background: var(--cat-lanthanide); }
.lg-swatch.cat-actinide              { background: var(--cat-actinide); }

/* ---------- 7. Chips ---------- */
.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); }

/* ---------- 8. Element cards ---------- */
.elements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.elements-grid-full { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.elements-grid-inline { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }

.element-card {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto;
    gap: 0 8px; align-items: center;
    padding: 10px 12px; border-radius: var(--radius);
    background: var(--bg-elev); border: 1px solid var(--border);
    border-inline-start: 4px solid var(--el-color, var(--cat-other));
    box-shadow: var(--shadow-sm);
    transition: transform .12s ease, box-shadow .12s ease;
    min-height: 68px;
}
.element-card:hover {
    text-decoration: none; color: inherit;
    transform: translateY(-2px); box-shadow: var(--shadow-md);
}
.el-number {
    grid-row: 1; font-size: .68rem; color: var(--text-faint);
    font-weight: 600; align-self: end; font-variant-numeric: tabular-nums;
}
.el-symbol {
    grid-row: 1 / span 2; font-size: 1.4rem; font-weight: 700;
    color: var(--el-text, var(--text)); line-height: 1; align-self: center;
}
.el-name {
    grid-row: 2; font-size: .88rem; font-weight: 600; color: var(--text);
    overflow: hidden; line-height: 1.2; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.el-mass {
    grid-row: 3; font-size: .7rem; color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

.view-all-wrap { margin-top: 18px; }

/* ---------- 9. 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); }

/* ---------- 10. Element detail page ---------- */
.el-detail { padding-top: 20px; }

.el-hero {
    display: flex; gap: 26px; align-items: center; flex-wrap: wrap;
    padding: 26px; border-radius: var(--radius-lg);
    background: var(--bg-elev); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
}
.el-hero::before {
    content: ''; position: absolute; inset-inline-start: 0; inset-block: 0;
    width: 5px; background: var(--el-color, var(--brand));
}
.el-hero-cell {
    flex: 0 0 auto; width: 128px; height: 128px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-radius: var(--radius); background: var(--el-text, var(--brand));
    color: #fff; box-shadow: var(--shadow-md); text-align: center;
}
.el-hero-n { font-size: .9rem; opacity: .9; font-weight: 600; }
.el-hero-s { font-size: 2.6rem; font-weight: 700; line-height: 1.05; letter-spacing: -.02em; }
.el-hero-name { font-size: .95rem; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.el-hero-en { font-size: .75rem; opacity: .9; }

.el-hero-info { flex: 1 1 320px; min-width: 0; }
.el-hero-info h1 { margin-bottom: .2em; }
.sym-inline { color: var(--text-faint); font-weight: 500; font-size: .6em; }
.el-hero-sub { color: var(--text-muted); margin-bottom: 1em; }

.el-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;
    /* 容器底色用 bg-elev 而不是 border：17 项在 5 列下必然留空位，
       旧写法会让空位露出分隔色变成一块灰砖，看着像数据缺失。 */
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
/* 外扩 shadow 正好落在 1px gap 上，相邻格子的描边重合成 1px 线 */
.prop { background: var(--bg-elev); padding: 12px 14px; min-width: 0;
    box-shadow: 0 0 0 1px var(--border); }
.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;
}
.prop dd.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; font-weight: 500; }

/* ---------- 11. FAQ ---------- */
.faq-list { display: grid; gap: 8px; }
.faq-item {
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.faq-item summary {
    padding: 14px 16px; font-weight: 600; font-size: .95rem; cursor: pointer;
    list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 48px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: '+'; font-size: 1.25rem; color: var(--brand); font-weight: 400; line-height: 1;
}
.faq-item[open] summary::after { content: '−'; }
.faq-item p { margin: 0; padding: 0 16px 16px; color: var(--text-muted); font-size: .93rem; }

/* ---------- 12. 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; }

/* ---------- 13. 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); }

/* ---------- 14. 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; }

/* ---------- 15. 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); }

/* ---------- 16. 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; }

/* ---------- 17. RTL ---------- */
[dir="rtl"] .el-hero::before { inset-inline-start: auto; inset-inline-end: 0; }
[dir="rtl"] .el-pager .btn:first-child { order: 2; }

/* ---------- 18. 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; }
    .pt-hint { display: block; }
    .el-hero-cell { width: 96px; height: 96px; }
    .el-hero-s { font-size: 2rem; }
}

@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; }
    .el-hero { padding: 18px; gap: 16px; }
    .el-hero-cell { width: 84px; height: 84px; }
    .el-hero-s { font-size: 1.7rem; }
    .el-hero-name { font-size: .8rem; }
    .el-hero-en { display: none; }
    .prop-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .elements-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
    .elements-grid-inline { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
    .el-symbol { font-size: 1.15rem; }
    .el-name { font-size: .8rem; }
    body.consent-open { padding-bottom: 96px; }
.consent-inner { flex-direction: column; align-items: stretch; }
    .consent-actions .btn { flex: 1; }
}

@media (max-width: 380px) {
    .elements-grid, .elements-grid-full, .elements-grid-inline {
        grid-template-columns: repeat(auto-fill, minmax(88px, 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, .el-pager { display: none !important; }
    body { background: #fff; }
}
