/* Technical Precision: public page adaptations and legacy token bridge.
   Loaded after the approved theme; existing interaction geometry is retained. */
.tp-theme {
    --primary-color: var(--tp-primary); --primary-dark: var(--tp-primary-deep);
    --accent-color: var(--tp-secondary); --secondary-color: var(--tp-ink);
    --text-color: var(--tp-ink); --text-strong: var(--tp-ink-strong);
    --text-light: var(--tp-ink-muted); --border-color: var(--tp-line);
    --bg-light: var(--tp-surface-low); --bg-white: var(--tp-surface);
    --surface: var(--tp-surface); --surface-hover: var(--tp-surface-hover);
    --surface-sunken: var(--tp-surface-low); --surface-soft: var(--tp-primary-soft);
    --font-family: var(--tp-font-body); --border-radius: 4px;
    --border-radius-sm: 2px; --border-radius-lg: 8px; --border-radius-xl: 8px;
    --box-shadow: var(--tp-shadow-card); --box-shadow-sm: var(--tp-shadow-card);
    --box-shadow-lg: var(--tp-shadow-hover); --focus-ring: var(--tp-focus);
}
.tp-theme input[type="checkbox"], .tp-theme input[type="radio"], .tp-theme select { appearance: auto; accent-color: var(--tp-primary); }
.tp-theme .site-content { min-height: 60vh; }
.tp-theme .site-content > .container { padding-top: 1.5rem; }
.tp-theme .skip-link { position: absolute; inset-block-start: -100px; inset-inline-start: 1rem; z-index: 2000; background: white; padding: 1rem; }
.tp-theme .skip-link:focus { inset-block-start: 0; }
.tp-theme .btn { box-shadow: none; }
.tp-theme .btn:disabled { opacity: .55; cursor: not-allowed; }
.tp-theme .btn-compare-toggle[aria-pressed="true"] { background: var(--tp-secondary-soft); border-color: var(--tp-secondary); color: var(--tp-secondary); }
.tp-theme .category-hero { background: linear-gradient(120deg, #fff, var(--category-soft, #e2f7fb)); border-bottom: 1px solid var(--tp-line); margin-bottom: 2rem; }
.tp-theme .category-hero-content { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; padding: 1rem 0 2rem; }
.tp-theme .category-hero-copy h1 { font-size: clamp(1.75rem, 3vw, 2.75rem); margin-bottom: 1rem; }
.tp-theme .category-eyebrow, .tp-theme .category-hero-stats span, .tp-theme .roadmap-note { font: 11px var(--tp-font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--tp-ink-muted); }
.tp-theme .category-promise { font-size: 1.15rem; margin-bottom: .75rem; }
.tp-theme .category-description { max-width: 65ch; margin-bottom: 1rem; }
.tp-theme .category-hero-stats { display: grid; gap: 1px; background: var(--tp-line); border: 1px solid var(--tp-line); border-radius: 8px; overflow: hidden; }
.tp-theme .category-hero-stats > div { padding: 1rem; background: white; }
.tp-theme .category-hero-stats strong { display: block; color: var(--tp-primary); font: 700 1.5rem var(--tp-font-mono); }
.tp-theme .category-summary { grid-column: 1 / -1; }
.tp-theme .category-section-grid, .tp-theme .roadmap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: .75rem; }
.tp-theme .category-section-card, .tp-theme .roadmap-card { display: flex; gap: .8rem; align-items: center; padding: 1rem; background: white; border: 1px solid var(--tp-line); border-radius: 6px; box-shadow: none; }
.tp-theme .category-section-card { border-top: 2px solid var(--category-accent, var(--tp-primary)); }
.tp-theme .category-section-card:hover { background: var(--tp-surface-hover); border-color: var(--tp-primary); }
.tp-theme .category-section-arrow { margin-inline-start: auto; }
.tp-theme .category-section-icon, .tp-theme .roadmap-icon { background: var(--category-soft); padding: .5rem; border-radius: 4px; }
.tp-theme .roadmap-card { background: var(--tp-surface-low); }
.tp-theme .roadmap-card strong, .tp-theme .roadmap-card span { display: block; }
.tp-theme .roadmap-card span, .tp-theme .category-section-card .count { color: var(--tp-ink-muted); font-size: .8rem; }
.tp-theme .filter-form { border-radius: 6px; }
.tp-theme .chip { border-radius: 3px; background: var(--tp-primary-soft); border-color: var(--tp-line); color: var(--tp-primary); font: 11px var(--tp-font-mono); }
.tp-theme #filter-form .form-control { background: var(--tp-surface-low); }
.tp-theme .results-count { font: 12px var(--tp-font-mono); padding: .75rem 0; }
.tp-theme .content-box { box-shadow: none !important; border-radius: 8px !important; }

/* Detail sheets and comparison matrix. */
.tp-theme .device-detail-container { max-width: 1240px; }
.tp-theme .device-header-section { padding: 1.5rem; border-radius: 8px; box-shadow: none; }
.tp-theme .device-image-section { flex: 0 1 280px; min-width: 0; }
.tp-theme .device-image-section img { width: 100%; max-height: 350px; object-fit: contain; background: white; }
.tp-theme .device-info-section { min-width: 0; }
.tp-theme .quick-specs { border-radius: 4px; }
.tp-theme .quick-spec-item { font: 12px/1.6 var(--tp-font-mono); overflow-wrap: anywhere; }
.tp-theme .spec-group { margin: 0; border: 0; border-bottom: 1px solid var(--tp-line); border-radius: 0; }
.tp-theme .spec-group-header { font-size: 12px; text-align: start; }
.tp-theme .spec-group-header::after { content: none; }
.tp-theme .spec-group-content { display: block; padding: 0; }
.tp-theme .spec-group.collapsed .spec-group-content { display: none; }
.tp-theme .spec-group-content .spec-row { display: grid; grid-template-columns: minmax(140px, 25%) minmax(0, 1fr); gap: 1rem; padding: .7rem 1rem; }
.tp-theme .spec-key, .tp-theme .spec-val { width: auto; min-width: 0; overflow-wrap: anywhere; }
.tp-theme .spec-val { font: 13px/1.6 var(--tp-font-mono); }
.tp-theme .spec-val .spec-source { border-radius: 2px; font: 10px/1.6 var(--tp-font-mono); white-space: normal; }
.tp-theme .comparison-table-wrapper { border-radius: 6px; border: 1px solid var(--tp-line); }
.tp-theme .comparison-table .spec-row { display: table-row; }
.tp-theme .comparison-table th, .tp-theme .comparison-table td { border: 1px solid var(--tp-line); padding: .75rem; font: 12px/1.6 var(--tp-font-mono); }
.tp-theme .comparison-table th { background: white; color: var(--tp-ink); }
.tp-theme .comparison-table td { background: white; }
.tp-theme .comparison-table tr:nth-child(even) td { background: var(--tp-cell-alt); }
.tp-theme .comparison-table .group-header td { background: var(--tp-primary-soft); color: var(--tp-primary-deep); }
.tp-theme .comparison-table tr.spec-row.different td { background: #fff8e8; }
.tp-theme .comparison-table tr.spec-row.different td:first-child { background: #fff2d5; color: #795000; }
.tp-theme .comparison-table td:first-child, .tp-theme .comparison-table th:first-child { inset-inline-start: 0; left: auto; }
.tp-theme .compare-slot, .tp-theme .differences-summary, .tp-theme .compare-slot-search, .tp-theme .slot-suggestions { border-radius: 6px; border-width: 1px; }
.tp-theme .compare-slot { min-width: 0; background: var(--tp-surface); }
.tp-theme .compare-slot.filled { border-top: 3px solid var(--tp-primary-container); }
.tp-theme .compare-slot-name { font-family: var(--tp-font-display); }
.tp-theme .slot-btn { border: 1px solid var(--tp-line); border-radius: 4px; min-height: 36px; }
.tp-theme .slot-search-input { width: 100%; min-width: 0; }
.tp-theme .diff-toggle, .tp-theme .compare-slot-count { border-radius: 3px; }
.tp-theme .diff-spec, .tp-theme .diff-value { font-family: var(--tp-font-mono); }
.tp-theme .device-col-header img { margin-inline: auto; }
.tp-theme .empty-state { padding: 2rem; border: 1px solid var(--tp-line); background: white; border-radius: 8px; text-align: center; }
@media (max-width: 900px) {
    .tp-theme .main-nav > .container > ul { flex-direction: column; align-items: stretch; gap: 0; }
    .tp-theme .main-nav .nav-submenu { display: none; }
    .tp-theme .main-nav .nav-group.open > .nav-submenu { display: block; }
    .tp-theme .category-hero-content { grid-template-columns: minmax(0, 1fr); }
    .tp-theme .category-hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tp-theme .col-3, .tp-theme .col-4, .tp-theme .col-6, .tp-theme .col-8, .tp-theme .col-9 { flex-basis: 100%; max-width: 100%; }
    .tp-theme .row { row-gap: 1rem; }
}
@media (max-width: 600px) {
    .tp-theme h1 { font-size: 1.8rem; overflow-wrap: anywhere; }
    .tp-theme .device-header-section { padding: 1rem; gap: 1rem; }
    .tp-theme .device-image-section, .tp-theme .device-info-section { flex: 1 1 100%; }
    .tp-theme .spec-group-content .spec-row { grid-template-columns: minmax(0, 1fr); gap: .25rem; }
    .tp-theme .quick-specs { grid-template-columns: minmax(0, 1fr); }
    .tp-theme .filter-form { margin: 0; z-index: 1200; }
    .tp-theme .filter-overlay { z-index: 1190; }
    .tp-theme .compare-slots { grid-template-columns: minmax(0, 1fr); }
    .tp-theme .comparison-table td:first-child { min-width: 115px; max-width: 140px; }
    .tp-theme .world-grid, .tp-theme .device-grid { grid-template-columns: repeat(auto-fit, minmax(min(165px, 100%), 1fr)); }
    .tp-theme .tp-panel-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tp-theme .content-box { padding: 1.25rem !important; }
}
.tp-theme[dir="rtl"] .nav-submenu { left: auto; right: 0; }
.tp-theme[dir="rtl"] .tp-table th { text-align: right; }

/* Native, keyboard-accessible language menu; opens without JavaScript. */
.language-menu { position: relative; font-family: var(--font-family); }
.language-menu summary { display: flex; align-items: center; gap: .5rem; cursor: pointer; list-style: none; padding: .4rem .65rem; border: 1px solid var(--border-color); border-radius: 4px; }
.language-menu summary::-webkit-details-marker { display: none; }
.language-menu summary:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 3px; }
.language-menu__options { position: absolute; inset-inline-end: 0; top: 100%; z-index: 1000; min-width: 12rem; max-height: 65vh; overflow: auto; padding: .4rem; margin: .4rem 0 0; list-style: none; background: var(--surface, #fff); border: 1px solid var(--border-color); box-shadow: 0 8px 24px #0002; }
.language-menu__options a { display: block; padding: .55rem .8rem; color: var(--text-color); text-decoration: none; white-space: nowrap; }
.language-menu__options a:hover, .language-menu__options a:focus-visible, .language-menu__options a[aria-current] { background: var(--surface-sunken, #eef3f8); color: var(--primary-color); }

.language-menu summary::after { content: ""; width: .4rem; height: .4rem; margin-inline-start: .3rem; border-inline-end: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.language-menu[open] summary::after { transform: rotate(225deg); }
.tp-theme .world-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }

/* Section identity uses the approved theme's type, spacing and surfaces. */
.tp-theme .section-switcher { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .5rem; font-size: .8rem; }
.tp-theme .section-switcher > a { color: var(--tp-ink-muted); }
.tp-theme .section-menu { position: relative; }
.tp-theme .section-menu .language-menu__options { min-width: min(20rem, 85vw); }
.tp-theme .category-hero .hero-search { display: flex; gap: .5rem; margin: 1.5rem 0 1rem; max-width: 38rem; }
.tp-theme .category-hero .hero-search input { min-width: 0; width: 100%; padding: .8rem; border: 1px solid var(--tp-line); border-radius: 4px; }
.tp-theme .category-hero-visual { align-self: center; display: grid; gap: .75rem; text-align: center; color: var(--tp-ink); font-size: .85rem; }
.tp-theme .category-hero-visual img { width: 100%; height: 220px; object-fit: contain; mix-blend-mode: multiply; }
.tp-theme .section-search-pages { display: flex; gap: .75rem; margin-top: 1.5rem; }
@media (max-width: 600px) { .tp-theme .category-hero-visual img { height: 160px; } }
