/* ==========================================================================
   SpecSherpa — "Technical Precision" theme · LIGHT BUILD
   --------------------------------------------------------------------------
   Derived from Google Stitch's Technical Precision design system (see
   stitch_specsherpa_product_comparison_templates/technical_precision/DESIGN.md)
   and inverted from its dark canvas to a light one, per the operator's request
   ("remove the dark theme — light instead").

   Principles kept from the source system:
     · Tonal layering + 1px low-contrast structural borders, not soft shadows.
     · Disciplined angular geometry (2/4/6/8px radii — never pill shapes).
     · Three type roles: Space Grotesk (display), Hanken Grotesk (UI/body),
       JetBrains Mono (labels, metrics, tables, deltas).
     · Dense, gridline-led layout that maximises data-to-pixel ratio.

   HOW THIS FILE IS SCOPED
     Every rule hangs off `.tp-theme`, which is set on <html> by the theme
     preview layout. Nothing here can affect the classic layout, and this file
     is deliberately OUTSIDE the sources concatenated by scripts/build_assets.php
     (public/assets/css/*.css) so the live bundles and asset_bundle() freshness
     are untouched. Promotion path: move this file to public/assets/css/, add it
     to $cssSources, rebuild, and drop .tp-theme scoping → it becomes the site
     stylesheet. It restyles the SAME class names the current markup already
     uses (.device-card, .btn, .main-nav, …) so views need almost no rewrites.

   LIGHT PALETTE MAPPING (Stitch token → light build)
     surface           #0f131c → #ffffff   (cards, cells)
     surface-container #1c2028 → #f7fafc   (sunken strips)
     on-surface        #dfe2ee → #0c1524   (ink)
     outline-variant   #3b494c → #dbe4ee   (structural gridline)
     primary-container #00e5ff → #06b6d4   (fill; #00e5ff is illegible on white)
     primary           #c3f5ff → #0b7490   (interactive ink, AA on white)
     secondary         #4edea3 → #047857 / fill #10b981 (positive deltas)
     tertiary          #ffc681 → #b45309 / fill #f59e0b (caution)
   ========================================================================== */

/* ==========================================================================
   1 · TOKENS
   ========================================================================== */
.tp-theme {
    /* -- canvas & surfaces (tonal layering) -- */
    --tp-canvas: #eef2f7;
    --tp-canvas-glow: #f9fbfe;
    --tp-surface: #ffffff;
    --tp-surface-low: #f7fafc;
    --tp-surface-sunken: #e9eef5;
    --tp-surface-hover: #f1f6fb;
    --tp-cell-alt: #f8fbfe;

    /* -- ink -- */
    --tp-ink: #0c1524;
    --tp-ink-strong: #05090f;
    --tp-ink-variant: #41536b;
    --tp-ink-muted: #64748b;
    --tp-ink-faint: #8fa1b6;

    /* -- structure -- */
    --tp-line: #dbe4ee;
    --tp-line-soft: #e7eef6;
    --tp-line-strong: #b9c6d8;
    --tp-grid-line: rgba(11, 116, 144, .07);

    /* -- accents -- */
    --tp-primary: #0b7490;
    --tp-primary-deep: #075e75;
    --tp-primary-container: #06b6d4;
    --tp-primary-soft: #e2f7fb;
    --tp-on-primary-container: #00252c;
    --tp-secondary: #047857;
    --tp-secondary-container: #10b981;
    --tp-secondary-soft: #e4f8ee;
    --tp-tertiary: #b45309;
    --tp-tertiary-container: #f59e0b;
    --tp-tertiary-soft: #fdf1e0;
    --tp-danger: #b91c1c;
    --tp-danger-soft: #fdeceb;

    /* -- per-world accents (mirrors app/config/section_profiles.php) -- */
    --tp-world-accent: var(--tp-primary);
    --tp-world-soft: var(--tp-primary-soft);

    /* -- geometry -- */
    --tp-r-xs: 2px;
    --tp-r-sm: 4px;
    --tp-r-md: 6px;
    --tp-r-lg: 8px;

    /* -- elevation (tight, technical, never skeuomorphic) -- */
    --tp-shadow-card: 0 1px 0 0 rgba(12, 21, 36, .02);
    --tp-shadow-hover: 0 10px 24px -14px rgba(12, 21, 36, .30);
    --tp-shadow-overlay: 0 4px 16px -2px rgba(12, 21, 36, .20), 0 0 0 1px var(--tp-line-strong);
    --tp-focus: 0 0 0 3px rgba(6, 182, 212, .30);

    /* -- type -- */
    --tp-font-display: "Space Grotesk", "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
    --tp-font-body: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    --tp-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* -- metrics -- */
    --tp-container: 1400px;
    --tp-gutter: 1.5rem;
    --tp-header-h: 3.25rem;
    --tp-motion: .16s ease;
    --tp-z-header: 1000;
    --tp-z-overlay: 1100;
}

/* ==========================================================================
   2 · RESET (scoped — equivalent of main.css's global reset, for this scope)
   ========================================================================== */
.tp-theme * ,
.tp-theme *::before,
.tp-theme *::after { box-sizing: border-box; }

.tp-theme { background: var(--tp-canvas); }

.tp-theme h1, .tp-theme h2, .tp-theme h3, .tp-theme h4, .tp-theme h5, .tp-theme h6,
.tp-theme p, .tp-theme ul, .tp-theme ol, .tp-theme li, .tp-theme dl, .tp-theme dt,
.tp-theme dd, .tp-theme figure, .tp-theme blockquote, .tp-theme table,
.tp-theme fieldset, .tp-theme legend, .tp-theme form { margin: 0; padding: 0; }

.tp-theme ul, .tp-theme ol { list-style: none; }
.tp-theme table { border-collapse: collapse; border-spacing: 0; width: 100%; }
.tp-theme img, .tp-theme svg { max-width: 100%; height: auto; display: block; }
.tp-theme button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.tp-theme input, .tp-theme select, .tp-theme textarea { font: inherit; color: inherit; -webkit-appearance: none; appearance: none; }
.tp-theme a { color: var(--tp-primary); text-decoration: none; transition: color var(--tp-motion), border-color var(--tp-motion), background var(--tp-motion); }
.tp-theme a:hover { color: var(--tp-primary-deep); }
.tp-theme ::selection { background: var(--tp-primary-container); color: var(--tp-on-primary-container); }
.tp-theme :focus-visible { outline: 2px solid var(--tp-primary-container); outline-offset: 2px; }

.tp-theme body {
    margin: 0;
    color-scheme: light;
    font-family: var(--tp-font-body);
    font-size: 15px;
    line-height: 1.6;
    color: var(--tp-ink);
    background:
        radial-gradient(circle at 50% -200px, var(--tp-canvas-glow), transparent 620px),
        var(--tp-canvas);
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

/* ==========================================================================
   3 · TYPOGRAPHY ROLES
   ========================================================================== */
.tp-theme h1, .tp-theme h2, .tp-theme h3, .tp-theme h4 {
    font-family: var(--tp-font-display);
    color: var(--tp-ink-strong);
    line-height: 1.16;
    letter-spacing: -.015em;
}
.tp-theme h1 { font-size: 2.75rem; font-weight: 700; letter-spacing: -.02em; }
.tp-theme h2 { font-size: 1.625rem; font-weight: 600; }
.tp-theme h3 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; }
.tp-theme h4 { font-size: .9375rem; font-weight: 600; }

.tp-theme p { color: var(--tp-ink-variant); }

/* Mono micro-label: uppercase technical tag (Stitch label-sm). */
.tp-theme .tp-label,
.tp-theme .tp-mono {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    line-height: 1.4;
}
.tp-theme .tp-label { color: var(--tp-ink-muted); }
.tp-theme .tp-num { font-family: var(--tp-font-mono); font-variant-numeric: tabular-nums; }
.tp-theme .tp-strong { color: var(--tp-ink-strong); font-weight: 700; }
.tp-theme .tp-accent { color: var(--tp-primary); }
.tp-theme .tp-positive { color: var(--tp-secondary); }
.tp-theme .tp-caution { color: var(--tp-tertiary); }

/* Live-status dot used in the telemetry ribbon. */
.tp-theme .tp-pulse {
    position: relative;
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: var(--tp-r-xs);
    background: var(--tp-secondary-container);
    flex: 0 0 auto;
}
.tp-theme .tp-pulse::after {
    content: "";
    position: absolute; inset: -3px;
    border: 1px solid var(--tp-secondary-container);
    border-radius: var(--tp-r-xs);
    opacity: .55;
    animation: tpPulse 1.9s ease-out infinite;
}
@keyframes tpPulse {
    0%   { transform: scale(.7); opacity: .6; }
    70%  { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .tp-theme .tp-pulse::after { animation: none; }
}

/* ==========================================================================
   4 · LAYOUT PRIMITIVES
   ========================================================================== */
.tp-theme .container {
    width: 100%;
    max-width: var(--tp-container);
    margin: 0 auto;
    padding: 0 var(--tp-gutter);
}
.tp-theme .row { display: flex; flex-wrap: wrap; margin: 0 -.5rem; }
.tp-theme .col, .tp-theme .col-2, .tp-theme .col-3, .tp-theme .col-4,
.tp-theme .col-6, .tp-theme .col-8, .tp-theme .col-9, .tp-theme .col-12 { padding: 0 .5rem; }
.tp-theme .col { flex: 1; }
.tp-theme .col-2 { flex: 0 0 16.666%; max-width: 16.666%; }
.tp-theme .col-3 { flex: 0 0 25%; max-width: 25%; }
.tp-theme .col-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.tp-theme .col-6 { flex: 0 0 50%; max-width: 50%; }
.tp-theme .col-8 { flex: 0 0 66.666%; max-width: 66.666%; }
.tp-theme .col-9 { flex: 0 0 75%; max-width: 75%; }
.tp-theme .col-12 { flex: 0 0 100%; max-width: 100%; }

.tp-theme .d-none { display: none; }
.tp-theme .d-block { display: block; }
.tp-theme .d-flex { display: flex; }
.tp-theme .d-inline-flex { display: inline-flex; }
.tp-theme .flex-column { flex-direction: column; }
.tp-theme .flex-wrap { flex-wrap: wrap; }
.tp-theme .align-items-center { align-items: center; }
.tp-theme .justify-content-between { justify-content: space-between; }
.tp-theme .justify-content-center { justify-content: center; }
.tp-theme .text-center { text-align: center; }
.tp-theme .text-right { text-align: right; }
.tp-theme .text-muted { color: var(--tp-ink-muted); }
.tp-theme .text-primary { color: var(--tp-primary); }
.tp-theme .mb-2 { margin-bottom: 1rem; }
.tp-theme .mb-3 { margin-bottom: 1.5rem; }
.tp-theme .mb-4 { margin-bottom: 2.75rem; }
.tp-theme .mt-2 { margin-top: 1rem; }

.tp-theme .site-content { display: block; padding: 0 0 3.5rem; }

/* ==========================================================================
   5 · BUTTONS & INTERACTIVE TRIGGERS (DESIGN.md §Components)
   Primary = solid cyan fill, dark mono text, 4px radius, micro-scale on hover.
   Secondary = transparent, 1px strong border, cyan mono text.
   ========================================================================== */
.tp-theme .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .625rem 1rem;
    font-family: var(--tp-font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    line-height: 1.2;
    border: 1px solid transparent;
    border-radius: var(--tp-r-sm);
    cursor: pointer;
    text-align: center;
    transition: background var(--tp-motion), border-color var(--tp-motion),
                color var(--tp-motion), transform var(--tp-motion), box-shadow var(--tp-motion);
}
.tp-theme .btn i { font-size: .9em; }

.tp-theme .btn-primary {
    background: var(--tp-primary-container);
    border-color: var(--tp-primary-container);
    color: var(--tp-on-primary-container);
}
.tp-theme .btn-primary:hover {
    background: #22c6de;
    border-color: #22c6de;
    color: var(--tp-on-primary-container);
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 6px 16px -8px rgba(6, 182, 212, .9);
}

.tp-theme .btn-outline,
.tp-theme .btn-secondary {
    background: transparent;
    border-color: var(--tp-line-strong);
    color: var(--tp-primary);
}
.tp-theme .btn-outline:hover,
.tp-theme .btn-secondary:hover {
    background: rgba(6, 182, 212, .08);
    border-color: var(--tp-primary-container);
    color: var(--tp-primary-deep);
}
.tp-theme .btn-secondary { border-color: var(--tp-primary-container); }

.tp-theme .btn-sm { padding: .4rem .7rem; font-size: 10px; }
.tp-theme .btn-lg { padding: .8rem 1.35rem; font-size: 12px; }
.tp-theme .btn-block { width: 100%; }

.tp-theme .btn-link,
.tp-theme .btn-text {
    background: none;
    border: 0;
    color: var(--tp-ink-muted);
    padding: .25rem .35rem;
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-decoration: none;
}
.tp-theme .btn-link:hover,
.tp-theme .btn-text:hover { color: var(--tp-primary); text-decoration: underline; }

/* Ghost/table action (DESIGN.md): borderless, muted, sharpens on row hover. */
.tp-theme .tp-ghost {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
}
.tp-theme .tp-ghost:hover { color: var(--tp-primary); }

/* ==========================================================================
   6 · PREVIEW STRIP (dev surface only — not part of the theme proper)
   ========================================================================== */
.tp-theme .tp-previewbar {
    background: #1d2636;
    color: #dbe4ee;
    border-bottom: 1px solid #334155;
}
.tp-theme .tp-previewbar__inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .65rem;
    padding-top: .4rem;
    padding-bottom: .4rem;
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.tp-theme .tp-previewbar__tag {
    background: var(--tp-tertiary-container);
    color: #2a1700;
    border-radius: var(--tp-r-xs);
    padding: .1rem .4rem;
    font-weight: 700;
}
.tp-theme .tp-previewbar__text { color: #9fb0c4; text-transform: none; letter-spacing: .02em; }
.tp-theme .tp-previewbar__link { margin-left: auto; color: #7ee7f7; }
.tp-theme .tp-previewbar__link:hover { color: #ffffff; }

/* ==========================================================================
   7 · SITE HEADER
   Utility bar → brand + live search → grouped navigation, all separated by
   1px structural rules. Hook classes are unchanged (.mobile-menu-toggle,
   .search-box, .logo, .lang-switcher, .main-nav, .nav-group, .compare-badge)
   so public/assets/js/main.js and compare.js keep working untouched.
   ========================================================================== */
.tp-theme .site-header {
    position: sticky;
    top: 0;
    z-index: var(--tp-z-header);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--tp-line);
}

.tp-theme .header-top {
    background: var(--tp-surface-low);
    border-bottom: 1px solid var(--tp-line-soft);
    color: var(--tp-ink-muted);
}
.tp-theme .tp-utilbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: .4rem 0;
}
.tp-theme .tp-utilbar__brand-line {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tp-ink-muted);
}
.tp-theme .tp-utilbar__right { display: inline-flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.tp-theme .tp-utilbar__stat {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
}
.tp-theme .tp-utilbar__stat strong { color: var(--tp-ink); font-weight: 700; }

.tp-theme .lang-switcher { display: inline-flex; align-items: center; gap: .15rem; }
.tp-theme .lang-switcher a {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--tp-ink-muted);
    padding: .15rem .4rem;
    border: 1px solid transparent;
    border-radius: var(--tp-r-xs);
}
.tp-theme .lang-switcher a:hover { color: var(--tp-primary); border-color: var(--tp-line); }
.tp-theme .lang-switcher a.active {
    background: var(--tp-primary-soft);
    border-color: var(--tp-primary-container);
    color: var(--tp-primary-deep);
    font-weight: 700;
}

.tp-theme .header-main { background: var(--tp-surface); }
.tp-theme .tp-headmain {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-top: .85rem;
    padding-bottom: .85rem;
}

.tp-theme .mobile-menu-toggle {
    display: none;
    width: 38px; height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-sm);
    color: var(--tp-ink-variant);
    font-size: 1rem;
    flex: 0 0 auto;
}
.tp-theme .mobile-menu-toggle:hover { border-color: var(--tp-primary-container); color: var(--tp-primary); }

.tp-theme .logo {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    color: var(--tp-ink-strong);
    flex: 0 0 auto;
}
.tp-theme .logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: var(--tp-ink-strong);
    border: 2px solid var(--tp-primary-container);
    border-radius: var(--tp-r-lg);
    color: var(--tp-primary-container);
    font-size: .95rem;
}
.tp-theme .logo-text { display: inline-flex; flex-direction: column; line-height: 1; }
.tp-theme .logo-text strong {
    font-family: var(--tp-font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -.02em;
    text-transform: uppercase;
    color: var(--tp-ink-strong);
}
.tp-theme .logo-text strong span { color: var(--tp-primary); }
.tp-theme .logo-text em {
    font-family: var(--tp-font-mono);
    font-style: normal;
    font-size: 9px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
    margin-top: 3px;
}

.tp-theme .search-box { flex: 1 1 auto; max-width: 620px; margin-left: auto; }
.tp-theme .search-box form {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--tp-surface-low);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-lg);
    padding: .35rem .4rem .35rem .75rem;
    transition: border-color var(--tp-motion), background var(--tp-motion);
}
.tp-theme .search-box form:focus-within {
    border-color: var(--tp-primary-container);
    background: var(--tp-surface);
    box-shadow: var(--tp-focus);
}
.tp-theme .search-box__icon { color: var(--tp-ink-faint); font-size: .8rem; }
.tp-theme .search-box input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    font-family: var(--tp-font-mono);
    font-size: 12px;
    color: var(--tp-ink);
    padding: .35rem 0;
}
.tp-theme .search-box input::placeholder { color: var(--tp-ink-faint); }
.tp-theme .search-box input:focus { outline: 0; }
.tp-theme .search-box button {
    flex: 0 0 auto;
    background: var(--tp-primary-container);
    color: var(--tp-on-primary-container);
    border-radius: var(--tp-r-sm);
    padding: .45rem .8rem;
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.tp-theme .search-box button:hover { background: #22c6de; }

.tp-theme .main-nav { background: var(--tp-surface); border-top: 1px solid var(--tp-line-soft); }
.tp-theme .main-nav > .container > ul { display: flex; align-items: center; gap: 1.75rem; flex-wrap: wrap; }
.tp-theme .main-nav a,
.tp-theme .nav-group-toggle {
    display: block;
    padding: .7rem 0;
    font-family: var(--tp-font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--tp-ink-muted);
    position: relative;
}
.tp-theme .main-nav li > a:hover,
.tp-theme .main-nav li > a.active,
.tp-theme .nav-group-toggle:hover,
.tp-theme .nav-group.open > .nav-group-toggle,
.tp-theme .nav-group.has-active > .nav-group-toggle { color: var(--tp-primary); }
.tp-theme .main-nav li > a.active::after,
.tp-theme .nav-group.has-active > .nav-group-toggle::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -.5rem;
    height: 2px;
    background: var(--tp-primary-container);
}
.tp-theme .nav-group { position: relative; }
.tp-theme .nav-group-toggle { display: flex; align-items: center; gap: .45rem; }
.tp-theme .nav-group-icon { font-size: .85rem; color: var(--tp-ink-faint); }
.tp-theme .nav-group-toggle .fa-chevron-down { font-size: .55rem; transition: transform var(--tp-motion); }
.tp-theme .nav-group.open > .nav-group-toggle .fa-chevron-down { transform: rotate(180deg); }
.tp-theme .nav-submenu {
    position: absolute;
    top: calc(100% + .5rem);
    left: 0;
    min-width: 260px;
    padding: .4rem 0;
    background: var(--tp-surface);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-lg);
    box-shadow: var(--tp-shadow-overlay);
    display: none;
    z-index: 70;
}
.tp-theme .nav-group.open > .nav-submenu { display: block; }
@media (hover: hover) and (pointer: fine) {
    .tp-theme .main-nav .nav-group:hover > .nav-submenu,
    .tp-theme .main-nav .nav-group:focus-within > .nav-submenu { display: block; }
}
.tp-theme .nav-submenu a {
    display: block;
    padding: .5rem .9rem;
    text-transform: none;
    letter-spacing: .02em;
    font-family: var(--tp-font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--tp-ink-variant);
}
.tp-theme .nav-submenu a:hover,
.tp-theme .nav-submenu a.active { background: var(--tp-surface-hover); color: var(--tp-primary); }
.tp-theme .nav-submenu a.nav-submenu-category {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
    border-bottom: 1px solid var(--tp-line-soft);
    border-radius: 0;
    margin-bottom: .2rem;
    padding-bottom: .55rem;
}
.tp-theme .compare-badge {
    display: inline-block;
    min-width: 18px;
    padding: .05rem .3rem;
    margin-left: .35rem;
    background: var(--tp-secondary-container);
    color: #04281b;
    border-radius: var(--tp-r-xs);
    font-size: 10px;
    font-weight: 700;
    text-align: center;
}

/* ==========================================================================
   8 · HERO: telemetry ribbon + headline + live search console + panel
   The Stitch hub opens with an eyebrow metadata ribbon, an oversized headline
   and a right-hand telemetry panel over a laboratory grid mesh. Light build:
   cyan/emerald wash on white with 1px gridlines at 44px.
   ========================================================================== */
.tp-theme .hero-section.home-hero {
    position: relative;
    overflow: hidden;
    padding: 3rem 0 3.25rem;
    margin-bottom: 2.5rem;
    color: var(--tp-ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(6, 182, 212, .12), transparent 44%),
        radial-gradient(circle at 88% 4%, rgba(16, 185, 129, .09), transparent 46%),
        linear-gradient(180deg, #ffffff 0%, #f7fbfe 100%);
    border-bottom: 1px solid var(--tp-line);
}
.tp-theme .hero-section.home-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .55;
    background-image:
        linear-gradient(to right, var(--tp-grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--tp-grid-line) 1px, transparent 1px);
    background-size: 44px 44px;
}
.tp-theme .hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
    gap: 2.5rem;
    align-items: start;
}

/* Eyebrow metadata ribbon (DESIGN.md: "ENGINE TELEMETRY" strip). */
.tp-theme .tp-ribbon {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .6rem;
    padding: .3rem .65rem;
    margin-bottom: 1.15rem;
    background: var(--tp-surface);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-sm);
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.tp-theme .tp-ribbon__live {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--tp-primary);
    font-weight: 700;
}
.tp-theme .tp-ribbon__sep { color: var(--tp-line-strong); }
.tp-theme .tp-ribbon__meta { color: var(--tp-ink-muted); }
.tp-theme .tp-ribbon__meta strong { color: var(--tp-ink-strong); font-weight: 700; }

.tp-theme .hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--tp-primary);
    margin-bottom: .85rem;
}
.tp-theme .hero-kicker-dot {
    width: 6px; height: 6px;
    border-radius: var(--tp-r-xs);
    background: var(--tp-primary-container);
    flex: 0 0 auto;
}
.tp-theme .hero-section h1 {
    font-size: 2.9rem;
    line-height: 1.08;
    max-width: 20ch;
    margin-bottom: 1rem;
    color: var(--tp-ink-strong);
}
.tp-theme .hero-section p {
    font-size: 1.0625rem;
    line-height: 1.62;
    max-width: 58ch;
    color: var(--tp-ink-variant);
    margin-bottom: 1.5rem;
}

/* Hero search: monospace live-lookup console. */
.tp-theme .hero-search {
    display: flex;
    align-items: stretch;
    gap: .5rem;
    max-width: 560px;
    margin-bottom: 1.35rem;
}
.tp-theme .hero-search input {
    flex: 1 1 auto;
    min-width: 0;
    padding: .8rem 1rem;
    font-family: var(--tp-font-mono);
    font-size: 13px;
    color: var(--tp-ink);
    background: var(--tp-surface);
    border: 1px solid var(--tp-line-strong);
    border-radius: var(--tp-r-sm);
    box-shadow: var(--tp-shadow-card);
}
.tp-theme .hero-search input::placeholder { color: var(--tp-ink-faint); }
.tp-theme .hero-search input:focus {
    outline: none;
    border-color: var(--tp-primary-container);
    box-shadow: var(--tp-focus);
}
.tp-theme .hero-search button { flex: 0 0 auto; }

.tp-theme .hero-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: 1.5rem; }

/* Metric cells (no pills: hard-edged stat blocks with a cyan left rail). */
.tp-theme .hero-metrics { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: .25rem; }
.tp-theme .metric-pill {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-width: 132px;
    padding: .55rem .8rem;
    background: var(--tp-surface);
    border: 1px solid var(--tp-line);
    border-left: 2px solid var(--tp-primary-container);
    border-radius: var(--tp-r-sm);
}
.tp-theme .metric-pill .metric-value {
    font-family: var(--tp-font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--tp-ink-strong);
    font-variant-numeric: tabular-nums;
}
.tp-theme .metric-pill .metric-label {
    font-family: var(--tp-font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tp-ink-muted);
}

/* ==========================================================================
   9 · HERO TELEMETRY PANEL (replaces the old decorative orbit graphic)
   A bordered instrument panel: category breadcrumb header strip, a world list
   with real counts, then a footer stat row. Every number is live site data —
   nothing here is decorative filler.
   ========================================================================== */
.tp-theme .home-hero-panel {
    background: var(--tp-surface);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-lg);
    overflow: hidden;
    box-shadow: var(--tp-shadow-card);
}
.tp-theme .hero-panel-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .85rem;
    background: var(--tp-surface-low);
    border-bottom: 1px solid var(--tp-line);
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tp-ink-muted);
}
.tp-theme .tp-world-list { border-bottom: 1px solid var(--tp-line); }
.tp-theme .tp-world-list li {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .85rem;
    border-top: 1px solid var(--tp-line-soft);
}
.tp-theme .tp-world-list li:first-child { border-top: 0; }
.tp-theme .tp-world-list__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    flex: 0 0 auto;
    background: var(--tp-primary-soft);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-sm);
    color: var(--tp-primary);
    font-size: .72rem;
}
.tp-theme .tp-world-list__name {
    flex: 1 1 auto;
    font-size: .84rem;
    font-weight: 600;
    color: var(--tp-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tp-theme .tp-world-list__meta {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    color: var(--tp-ink-faint);
    flex: 0 0 auto;
}
.tp-theme .tp-panel-stats { display: grid; grid-template-columns: repeat(3, 1fr); }
.tp-theme .tp-panel-stats > div {
    padding: .6rem .8rem;
    border-left: 1px solid var(--tp-line-soft);
}
.tp-theme .tp-panel-stats > div:first-child { border-left: 0; }
.tp-theme .tp-panel-stats .tp-stat-value {
    display: block;
    font-family: var(--tp-font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--tp-ink-strong);
    font-variant-numeric: tabular-nums;
}
.tp-theme .tp-panel-stats .tp-stat-label {
    display: block;
    font-family: var(--tp-font-mono);
    font-size: 9px;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--tp-ink-muted);
}
.tp-theme .hero-panel-footer {
    padding: .55rem .85rem;
    background: var(--tp-surface-low);
    border-top: 1px solid var(--tp-line);
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--tp-ink-muted);
}
.tp-theme .hero-panel-footer strong { color: var(--tp-primary); font-weight: 700; }
.tp-theme .hero-panel-footer span { color: var(--tp-line-strong); }

/* ==========================================================================
   10 · SECTION HEADERS
   ========================================================================== */
.tp-theme .section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .7rem;
    margin: 0 0 1.15rem;
    border-bottom: 1px solid var(--tp-line);
}
.tp-theme .section-header h2 { font-size: 1.5rem; }
.tp-theme .section-header > a {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--tp-primary);
    white-space: nowrap;
}
.tp-theme .section-header > a i { font-size: .7em; margin-left: .3rem; }
.tp-theme .section-eyebrow {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
    margin-bottom: .35rem;
}
.tp-theme .tp-section-meta {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
    white-space: nowrap;
}
.tp-theme .home-section-intro { max-width: 70ch; margin: -.35rem 0 1.25rem; font-size: .95rem; }

/* ==========================================================================
   11 · DEVICE WORLDS (sector cards)
   Bordered sector tiles with a 2px per-world accent rail across the top, an
   index number in mono and a hairline-separated footer row of counts.
   ========================================================================== */
.tp-theme .world-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
    gap: .75rem;
}
.tp-theme .world-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    padding: .95rem 1rem 1rem;
    background: var(--tp-surface);
    border: 1px solid var(--tp-line);
    border-top: 2px solid var(--tp-world-accent);
    border-radius: var(--tp-r-lg);
    box-shadow: var(--tp-shadow-card);
    color: var(--tp-ink);
    transition: border-color var(--tp-motion), transform var(--tp-motion), box-shadow var(--tp-motion);
}
.tp-theme .world-card:hover {
    transform: translateY(-2px);
    border-color: var(--tp-line-strong);
    box-shadow: var(--tp-shadow-hover);
    color: var(--tp-ink);
}
.tp-theme .world-card--mobile-wearable-tech { --tp-world-accent: #c94f49; --tp-world-soft: #fff1ee; }
.tp-theme .world-card--computing-connected-home { --tp-world-accent: #2563eb; --tp-world-soft: #eef5ff; }
.tp-theme .world-card--entertainment-imaging { --tp-world-accent: #7c3aed; --tp-world-soft: #f4efff; }
.tp-theme .world-card--electric-mobility { --tp-world-accent: #0f766e; --tp-world-soft: #eafaf7; }
.tp-theme .world-card--energy-power { --tp-world-accent: #a75c08; --tp-world-soft: #fff7e8; }
.tp-theme .world-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tp-theme .world-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    background: var(--tp-world-soft, var(--tp-primary-soft));
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-sm);
    color: var(--tp-world-accent, var(--tp-primary));
    font-size: .8rem;
}
.tp-theme .world-index {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    color: var(--tp-ink-faint);
}
.tp-theme .world-card h3 { font-size: 1rem; margin-top: .1rem; }
.tp-theme .world-card p {
    font-size: .84rem;
    line-height: 1.5;
    color: var(--tp-ink-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tp-theme .world-meta {
    margin-top: auto;
    padding-top: .6rem;
    border-top: 1px solid var(--tp-line-soft);
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
}
.tp-theme .world-meta strong { color: var(--tp-ink-strong); font-weight: 700; }
.tp-theme .world-meta span { color: var(--tp-line-strong); }
.tp-theme .world-arrow { color: var(--tp-ink-faint); font-size: .7rem; }
.tp-theme .world-card:hover .world-arrow { color: var(--tp-world-accent, var(--tp-primary)); }

/* ==========================================================================
   12 · TOOL STRIP (three guarantees, hairline-separated)
   ========================================================================== */
.tp-theme .home-tool-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    background: var(--tp-surface);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-lg);
    overflow: hidden;
}
.tp-theme .tool-strip-card {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: 1rem 1.15rem;
    border-left: 1px solid var(--tp-line-soft);
}
.tp-theme .tool-strip-card:first-child { border-left: 0; }
.tp-theme .tool-strip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    flex: 0 0 auto;
    background: var(--tp-surface-low);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-sm);
    color: var(--tp-primary);
    font-size: .8rem;
}
.tp-theme .tool-strip-card strong {
    display: block;
    font-family: var(--tp-font-display);
    font-size: .92rem;
    font-weight: 600;
    color: var(--tp-ink-strong);
}
.tp-theme .tool-strip-card span {
    display: block;
    font-size: .82rem;
    color: var(--tp-ink-muted);
    line-height: 1.45;
}

/* ==========================================================================
   13 · DEVICE GRID + CARD
   Restyles the classes already emitted by
   app/views/partials/device_card.php, so the card component needs no rewrite.
   Card header strip (brand + type) is separated from the body by a 1px rule,
   per DESIGN.md §Cards & Spec Panels.
   ========================================================================== */
.tp-theme .device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
    gap: .75rem;
    margin-bottom: 2.5rem;
}
.tp-theme .device-card {
    display: flex;
    flex-direction: column;
    background: var(--tp-surface);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-lg);
    padding: 0;
    overflow: hidden;
    box-shadow: var(--tp-shadow-card);
    transition: border-color var(--tp-motion), transform var(--tp-motion), box-shadow var(--tp-motion);
}
.tp-theme .device-card:hover {
    transform: translateY(-2px);
    border-color: var(--tp-line-strong);
    box-shadow: var(--tp-shadow-hover);
}
.tp-theme .device-card .device-card-image {
    display: block;
    background:
        linear-gradient(to right, var(--tp-grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--tp-grid-line) 1px, transparent 1px);
    background-size: 22px 22px;
    background-color: var(--tp-surface-low);
    border-bottom: 1px solid var(--tp-line);
    padding: .75rem;
}
.tp-theme .device-card .device-card-image img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    margin: 0;
    background: transparent;
    border-radius: 0;
}
.tp-theme .device-card .device-card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: .8rem .85rem .9rem;
}
.tp-theme .device-card .brand {
    font-family: var(--tp-font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
    margin-bottom: .3rem;
}
.tp-theme .device-card h3,
.tp-theme .device-card .device-card-title {
    font-family: var(--tp-font-display);
    font-size: .98rem;
    font-weight: 600;
    line-height: 1.28;
    letter-spacing: -.01em;
    margin-bottom: .5rem;
    color: var(--tp-ink-strong);
}
.tp-theme .device-card h3 a { color: inherit; }
.tp-theme .device-card h3 a:hover { color: var(--tp-primary); }
.tp-theme .device-card .specs {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
}
.tp-theme .device-card .device-card-price {
    font-family: var(--tp-font-mono);
    font-size: .95rem;
    font-weight: 700;
    color: var(--tp-ink-strong);
    font-variant-numeric: tabular-nums;
    margin-bottom: .5rem;
}
.tp-theme .device-card .device-card-facts {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-bottom: .65rem;
}
.tp-theme .device-card .fact-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .16rem .42rem;
    background: var(--tp-surface-low);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-xs);
    font-family: var(--tp-font-mono);
    font-size: 10px;
    color: var(--tp-ink-variant);
    white-space: nowrap;
}
.tp-theme .device-card .fact-chip i { color: var(--tp-primary); font-size: .75em; }
.tp-theme .device-card .btn-compare-toggle { margin-top: auto; width: 100%; }
.tp-theme .device-card .btn-compare-toggle.btn-primary {
    background: var(--tp-primary-soft);
    border-color: var(--tp-primary-container);
    color: var(--tp-primary-deep);
}
.tp-theme .device-card .btn-compare-toggle.btn-primary:hover { background: rgba(6, 182, 212, .18); }

/* ==========================================================================
   14 · CATALOGUE LEDGER (data matrix)
   Straight from DESIGN.md §Data Comparison Matrix: alternating row fill, 1px
   gridlines on every cell, spec labels fixed on the left axis, monospaced
   values with tabular figures. Wrapped in a focusable scroller so the table
   stays keyboard- and touch-scrollable on narrow viewports.
   ========================================================================== */
.tp-theme .tp-ledger {
    background: var(--tp-surface);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-lg);
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: var(--tp-shadow-card);
}
.tp-theme .tp-table { min-width: 820px; font-size: .84rem; }
.tp-theme .tp-table caption {
    caption-side: top;
    text-align: left;
    padding: .55rem .9rem;
    background: var(--tp-surface-low);
    border-bottom: 1px solid var(--tp-line);
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tp-ink-muted);
}
.tp-theme .tp-table thead th {
    background: var(--tp-surface-low);
    border-bottom: 1px solid var(--tp-line);
    padding: .5rem .9rem;
    text-align: left;
    font-family: var(--tp-font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
    white-space: nowrap;
}
.tp-theme .tp-table tbody td {
    padding: .6rem .9rem;
    border-top: 1px solid var(--tp-line-soft);
    vertical-align: middle;
    color: var(--tp-ink-variant);
}
.tp-theme .tp-table tbody tr:nth-child(even) { background: var(--tp-cell-alt); }
.tp-theme .tp-table tbody tr:hover { background: var(--tp-surface-hover); }
.tp-theme .tp-table .tp-table__model {
    display: block;
    font-family: var(--tp-font-display);
    font-size: .9rem;
    font-weight: 600;
    color: var(--tp-ink-strong);
    line-height: 1.3;
}
.tp-theme .tp-table .tp-table__model:hover { color: var(--tp-primary); }
.tp-theme .tp-table .tp-table__sub {
    display: block;
    font-family: var(--tp-font-mono);
    font-size: 9px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
    margin-top: .15rem;
}
.tp-theme .tp-table .tp-table__brand {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--tp-ink-muted);
}
.tp-theme .tp-table .tp-table__facts {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    max-width: 460px;
}
.tp-theme .tp-table .tp-table__action { text-align: right; white-space: nowrap; }
.tp-theme .tp-table .tp-table__action .tp-ghost { margin-left: .6rem; }
.tp-theme .tp-table .tp-empty { color: var(--tp-ink-faint); }

/* ==========================================================================
   15 · MANUFACTURER INDEX (brand grid)
   ========================================================================== */
.tp-theme .brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: .6rem;
    margin-bottom: 2.5rem;
}
.tp-theme .brand-card {
    display: block;
    padding: .75rem .85rem;
    background: var(--tp-surface);
    border: 1px solid var(--tp-line);
    border-left: 2px solid var(--tp-line-strong);
    border-radius: var(--tp-r-sm);
    color: var(--tp-ink);
    transition: border-color var(--tp-motion), background var(--tp-motion);
}
.tp-theme .brand-card:hover {
    border-color: var(--tp-primary-container);
    border-left-color: var(--tp-primary-container);
    background: var(--tp-surface-hover);
    color: var(--tp-ink);
}
.tp-theme .brand-card h3 {
    font-family: var(--tp-font-display);
    font-size: .92rem;
    font-weight: 600;
    margin-bottom: .15rem;
}
.tp-theme .brand-card .count {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   16 · CROSS-REFERENCE PAIRS (popular comparisons)
   Hard-edged rows, not pills: mono label, model names, view count on the right.
   ========================================================================== */
.tp-theme .popular-comparisons .tp-pair-list {
    display: grid;
    gap: .45rem;
    margin: 0;
}
.tp-theme .tp-pair {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .65rem .9rem;
    background: var(--tp-surface);
    border: 1px solid var(--tp-line);
    border-left: 2px solid var(--tp-line-strong);
    border-radius: var(--tp-r-sm);
    color: var(--tp-ink);
    transition: border-color var(--tp-motion), background var(--tp-motion);
}
.tp-theme .tp-pair:hover {
    border-color: var(--tp-line-strong);
    border-left-color: var(--tp-primary-container);
    background: var(--tp-surface-hover);
    color: var(--tp-ink);
}
.tp-theme .tp-pair__tag {
    flex: 0 0 auto;
    font-family: var(--tp-font-mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--tp-primary);
}
.tp-theme .tp-pair__title {
    flex: 1 1 auto;
    font-family: var(--tp-font-display);
    font-size: .92rem;
    font-weight: 600;
    color: var(--tp-ink-strong);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tp-theme .tp-pair__meta {
    flex: 0 0 auto;
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    color: var(--tp-ink-faint);
}

/* ==========================================================================
   17 · FOOTER
   Multi-column technical index: mono column headings, hairline separators,
   status line at the bottom. Language links come from SUPPORTED_LANGS.
   ========================================================================== */
.tp-theme .site-footer {
    margin-top: 3rem;
    background: var(--tp-surface);
    border-top: 1px solid var(--tp-line);
    color: var(--tp-ink-variant);
}
.tp-theme .site-footer .footer-main { padding: 2.5rem 0 2rem; }
.tp-theme .tp-footer__grid {
    display: grid;
    grid-template-columns: minmax(240px, 1.4fr) repeat(3, minmax(150px, 1fr));
    gap: 2rem;
}
.tp-theme .tp-footer__brand .logo { margin-bottom: .75rem; }
.tp-theme .tp-footer__tagline {
    font-size: .85rem;
    line-height: 1.55;
    color: var(--tp-ink-muted);
    max-width: 40ch;
    margin-bottom: .9rem;
}
.tp-theme .tp-footer__badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.tp-theme .tp-footer__badges li {
    padding: .2rem .45rem;
    background: var(--tp-surface-low);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-xs);
    font-family: var(--tp-font-mono);
    font-size: 9px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
}
.tp-theme .tp-footer__col h4 {
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--tp-ink-strong);
    padding-bottom: .5rem;
    margin-bottom: .6rem;
    border-bottom: 1px solid var(--tp-line);
}
.tp-theme .footer-links { display: grid; gap: .35rem; }
.tp-theme .footer-links a {
    font-size: .84rem;
    color: var(--tp-ink-muted);
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
.tp-theme .footer-links a:hover { color: var(--tp-primary); }
.tp-theme .footer-bottom {
    background: var(--tp-surface-low);
    border-top: 1px solid var(--tp-line);
    padding: .85rem 0;
}
.tp-theme .tp-footer__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.tp-theme .tp-footer__bottom p { font-size: .8rem; color: var(--tp-ink-faint); }
.tp-theme .tp-footer__build {
    font-family: var(--tp-font-mono);
    font-size: 9px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
}

/* ==========================================================================
   18 · OVERLAYS: compare dock, toasts, scroll-to-top, consent, ad slot
   (Every class/state toggled by public/assets/js/*.js is covered here.)
   ========================================================================== */
.tp-theme .compare-sidebar {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: var(--tp-z-overlay);
    width: 340px;
    max-width: calc(100vw - 2rem);
    background: var(--tp-surface);
    border: 1px solid var(--tp-line-strong);
    border-radius: var(--tp-r-lg);
    box-shadow: var(--tp-shadow-overlay);
    overflow: hidden;
    display: none;
}
.tp-theme .compare-sidebar.open { animation: tpDockIn .18s ease-out; }
@keyframes tpDockIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.tp-theme .compare-sidebar-content { padding: .85rem; }
.tp-theme .compare-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding-bottom: .6rem;
    margin-bottom: .6rem;
    border-bottom: 1px solid var(--tp-line);
}
.tp-theme .compare-title {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tp-ink-strong);
}
.tp-theme .compare-items { display: grid; gap: .4rem; max-height: 220px; overflow-y: auto; margin-bottom: .7rem; }
.tp-theme .compare-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .4rem .5rem;
    background: var(--tp-surface-low);
    border: 1px solid var(--tp-line-soft);
    border-radius: var(--tp-r-sm);
}
.tp-theme .compare-item img {
    width: 40px; height: 40px;
    object-fit: contain;
    flex: 0 0 auto;
    background: var(--tp-surface);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-xs);
}
.tp-theme .compare-item-name {
    flex: 1 1 auto;
    font-size: .82rem;
    font-weight: 600;
    color: var(--tp-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tp-theme .remove-item {
    flex: 0 0 auto;
    color: var(--tp-ink-faint);
    font-size: 1.05rem;
    line-height: 1;
    padding: .1rem .3rem;
    border-radius: var(--tp-r-xs);
}
.tp-theme .remove-item:hover { color: var(--tp-danger); background: var(--tp-danger-soft); }
.tp-theme .compare-actions .btn { width: 100%; }
.tp-theme .compare-actions .disabled { opacity: .5; pointer-events: none; }

.tp-theme .toast-container {
    position: fixed;
    left: 1.5rem;
    bottom: 1.5rem;
    z-index: calc(var(--tp-z-overlay) + 1);
    display: grid;
    gap: .5rem;
}
.tp-theme .toast {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .85rem;
    background: var(--tp-ink-strong);
    color: #f1f5f9;
    border-left: 3px solid var(--tp-primary-container);
    border-radius: var(--tp-r-sm);
    box-shadow: 0 12px 28px -12px rgba(5, 9, 15, .6);
    font-family: var(--tp-font-mono);
    font-size: 11px;
    animation: tpToastIn .22s ease-out;
}
@keyframes tpToastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tp-theme #scroll-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 5.5rem;
    z-index: 990;
    width: 40px; height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--tp-surface);
    border: 1px solid var(--tp-line-strong);
    border-radius: var(--tp-r-sm);
    color: var(--tp-primary);
    box-shadow: var(--tp-shadow-hover);
}
.tp-theme #scroll-to-top:hover { border-color: var(--tp-primary-container); }

.tp-theme .ad-slot { min-height: 1px; margin: 1.5rem auto; text-align: center; }
.tp-theme .ad-slot[data-ad-required="0"] { display: none; }

.tp-theme .consent-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: calc(var(--tp-z-overlay) + 2);
    background: var(--tp-ink-strong);
    color: #f1f5f9;
    border-top: 1px solid #334155;
    padding: .9rem 0;
}
.tp-theme .consent-banner__inner,
.tp-theme .consent-banner__actions,
.tp-theme .consent-banner__manage {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    max-width: var(--tp-container);
    margin: 0 auto;
    padding: 0 var(--tp-gutter);
}
.tp-theme .consent-banner__body { flex: 1 1 100%; }
.tp-theme .consent-banner__title { font-family: var(--tp-font-display); font-weight: 700; margin-bottom: .2rem; }
.tp-theme .consent-banner__text { color: #9fb0c4; font-size: .84rem; }
.tp-theme .consent-banner__manage { flex: 1 1 100%; border-top: 1px solid #334155; padding-top: .7rem; }
.tp-theme .consent-cat { display: inline-flex; align-items: center; gap: .4rem; font-size: .84rem; color: #cbd5e1; }
.tp-theme .consent-banner .btn-link { color: #7ee7f7; }

/* ==========================================================================
   19 · SHARED COMPONENTS (kept promotable beyond the front page)
   Cards, badges, forms, alerts, pagination, breadcrumb and the detail-page
   spec accordion, restyled so a staged rollout does not need view rewrites.
   ========================================================================== */
.tp-theme .card {
    background: var(--tp-surface);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-lg);
    overflow: hidden;
    box-shadow: var(--tp-shadow-card);
}
.tp-theme .card-img { width: 100%; height: 200px; object-fit: contain; padding: 1rem; background: var(--tp-surface-low); border-bottom: 1px solid var(--tp-line); }
.tp-theme .card-body { padding: 1rem; }
.tp-theme .card-title { font-family: var(--tp-font-display); font-size: 1.05rem; font-weight: 600; color: var(--tp-ink-strong); margin-bottom: .35rem; }
.tp-theme .card-text { font-size: .875rem; color: var(--tp-ink-muted); margin-bottom: .5rem; }
.tp-theme .card-footer { padding: .75rem 1rem; background: var(--tp-surface-low); border-top: 1px solid var(--tp-line); }

.tp-theme .badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .45rem;
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-xs);
    font-family: var(--tp-font-mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    line-height: 1.4;
    background: var(--tp-surface-low);
    color: var(--tp-ink-muted);
}
.tp-theme .badge-primary, .tp-theme .badge-active { background: var(--tp-primary-soft); border-color: #a8e6f2; color: var(--tp-primary-deep); }
.tp-theme .badge-success { background: var(--tp-secondary-soft); border-color: #a7e8c8; color: var(--tp-secondary); }
.tp-theme .badge-secondary, .tp-theme .badge-discontinued { background: var(--tp-surface-sunken); color: var(--tp-ink-muted); }
.tp-theme .badge-upcoming { background: var(--tp-tertiary-soft); border-color: #f3d5a5; color: var(--tp-tertiary); }

.tp-theme .form-control {
    display: block;
    width: 100%;
    padding: .55rem .7rem;
    font-size: .875rem;
    color: var(--tp-ink);
    background: var(--tp-surface);
    border: 1px solid var(--tp-line-strong);
    border-radius: var(--tp-r-sm);
}
.tp-theme .form-control:focus { outline: none; border-color: var(--tp-primary-container); box-shadow: var(--tp-focus); }
.tp-theme .form-group { margin-bottom: 1rem; }
.tp-theme .form-label, .tp-theme .form-group label {
    display: block;
    margin-bottom: .25rem;
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--tp-ink-muted);
}
.tp-theme .form-check { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.tp-theme .form-check-input { margin: 0; }

.tp-theme .alert { padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid var(--tp-line); border-left: 3px solid var(--tp-line-strong); border-radius: var(--tp-r-sm); background: var(--tp-surface); }
.tp-theme .alert-success { border-left-color: var(--tp-secondary-container); background: var(--tp-secondary-soft); color: #04402c; }
.tp-theme .alert-danger { border-left-color: var(--tp-danger); background: var(--tp-danger-soft); color: #7f1d1d; }

.tp-theme .pagination { display: flex; flex-wrap: wrap; gap: .25rem; margin: 1.25rem 0; }
.tp-theme .pagination a, .tp-theme .pagination span {
    display: block;
    padding: .4rem .65rem;
    background: var(--tp-surface);
    border: 1px solid var(--tp-line);
    border-radius: var(--tp-r-sm);
    font-family: var(--tp-font-mono);
    font-size: 11px;
    color: var(--tp-ink-variant);
}
.tp-theme .pagination a:hover, .tp-theme .pagination .active {
    background: var(--tp-primary-container);
    border-color: var(--tp-primary-container);
    color: var(--tp-on-primary-container);
}

.tp-theme .breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: .9rem 0;
    margin-bottom: 1rem;
    font-family: var(--tp-font-mono);
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--tp-ink-faint);
}
.tp-theme .breadcrumb-item + .breadcrumb-item::before { content: "/"; padding: 0 .5rem; color: var(--tp-line-strong); }

.tp-theme .spec-group { background: var(--tp-surface); border: 1px solid var(--tp-line); border-radius: var(--tp-r-lg); margin-bottom: .6rem; overflow: hidden; }
.tp-theme .spec-group-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem .95rem;
    background: var(--tp-surface-low);
    font-family: var(--tp-font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tp-ink-strong);
    text-align: left;
}
.tp-theme .spec-group-content { padding: .25rem .95rem .85rem; }
.tp-theme .spec-group.collapsed .spec-group-content { display: none; }

/* ==========================================================================
   20 · RESPONSIVE (Stitch layout model: 12-col ≥1280, 8-col 768–1279, 4-col <768)
   ========================================================================== */
@media (max-width: 1200px) {
    .tp-theme { --tp-gutter: 1.25rem; }
    .tp-theme .hero-section h1 { font-size: 2.5rem; }
    .tp-theme .tp-footer__grid { grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(130px, 1fr)); gap: 1.5rem; }
    .tp-theme .world-grid { grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); }
}

@media (max-width: 1080px) {
    .tp-theme .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
    .tp-theme .home-hero-panel { max-width: 560px; }
    .tp-theme .home-tool-strip { grid-template-columns: minmax(0, 1fr); }
    .tp-theme .tool-strip-card { border-left: 0; border-top: 1px solid var(--tp-line-soft); }
    .tp-theme .tool-strip-card:first-child { border-top: 0; }
    .tp-theme .tp-footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .tp-theme .tp-headmain { flex-wrap: wrap; gap: .75rem; }
    .tp-theme .mobile-menu-toggle { display: inline-flex; }
    .tp-theme .search-box { flex: 1 1 100%; max-width: none; margin-left: 0; order: 3; }
    .tp-theme .main-nav { display: none; }
    .tp-theme .main-nav.active { display: block; }
    .tp-theme .main-nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: .5rem 0; }
    .tp-theme .main-nav li > a, .tp-theme .nav-group-toggle { padding: .6rem 0; }
    .tp-theme .main-nav li > a.active::after,
    .tp-theme .nav-group.has-active > .nav-group-toggle::after { display: none; }
    .tp-theme .main-nav .nav-group:hover > .nav-submenu,
    .tp-theme .main-nav .nav-group:focus-within > .nav-submenu { display: none; }
    .tp-theme .main-nav .nav-group.open > .nav-submenu { display: block; }
    .tp-theme .nav-submenu {
        position: static;
        min-width: 0;
        margin: .25rem 0 .5rem;
        box-shadow: none;
        background: var(--tp-surface-low);
    }
    .tp-theme .tp-utilbar__stat { display: none; }
    .tp-theme .tp-previewbar__link { margin-left: 0; }
}

@media (max-width: 720px) {
    .tp-theme { --tp-gutter: 1rem; }
    .tp-theme .hero-section.home-hero { padding: 2rem 0 2.25rem; }
    .tp-theme .hero-section h1 { font-size: 1.9rem; }
    .tp-theme .hero-section p { font-size: 1rem; }
    .tp-theme .hero-search { flex-direction: column; }
    .tp-theme .hero-search button { min-height: 44px; }
    .tp-theme .hero-metrics { gap: .5rem; }
    .tp-theme .metric-pill { flex: 1 1 calc(50% - .5rem); min-width: 0; }
    .tp-theme .section-header { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .tp-theme .world-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
    .tp-theme .device-grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: .6rem; }
    .tp-theme .device-card .device-card-image img { height: 118px; }
    .tp-theme .brand-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .tp-theme .tp-table { min-width: 680px; }
    .tp-theme .tp-pair { flex-wrap: wrap; }
    .tp-theme .tp-pair__title { white-space: normal; }
    .tp-theme .tp-footer__grid { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
    .tp-theme .compare-sidebar { right: .75rem; left: .75rem; bottom: .75rem; width: auto; }
    .tp-theme .toast-container { left: .75rem; right: .75rem; }
    .tp-theme .btn { min-height: 40px; }
}

/* RTL: the theme is laid out with flex/grid so it mirrors automatically — only
   the left-edge accent rails need flipping. */
.tp-theme[dir="rtl"] .metric-pill {
    border-left: 1px solid var(--tp-line);
    border-right: 2px solid var(--tp-primary-container);
}
.tp-theme[dir="rtl"] .brand-card,
.tp-theme[dir="rtl"] .tp-pair {
    border-left: 1px solid var(--tp-line);
    border-right: 2px solid var(--tp-line-strong);
}

/* Preview-only accessibility and layout refinements. */
.tp-theme [hidden] { display: none !important; }
.tp-theme { --tp-ink-faint: #52657b; }
.tp-theme .main-nav .nav-submenu { top: 100%; }
.tp-theme .tp-table .fact-chip { padding: .2rem .4rem; background: var(--tp-surface-low); border: 1px solid var(--tp-line); border-radius: 2px; font: 11px var(--tp-font-mono); }
.tp-theme .device-card .fact-chip { white-space: normal; overflow-wrap: anywhere; }
.tp-theme .device-card, .tp-theme .hero-copy { min-width: 0; }
.tp-theme .lang-switcher { flex-wrap: wrap; }
.tp-theme .consent-cat input { appearance: auto; }
.tp-theme .tp-previewbar { background: #e2f7fb; color: #075e75; border-color: #b9c6d8; }
.tp-theme .tp-previewbar__text, .tp-theme .tp-previewbar__link { color: #075e75; }
.tp-theme .tp-previewbar__link:hover { color: #0c1524; }
@media (prefers-reduced-motion: reduce) {
    .tp-theme *, .tp-theme *::after { animation: none !important; transition: none !important; }
}

/* --------------------------------------------------------------------------
   End of Technical Precision (light build).

   Promotion checklist if this becomes the site stylesheet:
     1. move to public/assets/css/theme-precision.css
     2. add it to $cssSources in scripts/build_assets.php
     3. drop the `.tp-theme ` prefix (or keep .tp-theme on <html> permanently)
     4. remove [data-theme="dark"] blocks + #theme-toggle from the layouts and
        public/assets/js/main.js — dark mode is intentionally dropped here
     5. php scripts/build_assets.php && php scripts/verify_http.php
   -------------------------------------------------------------------------- */