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

/* ===== Variables ===== */
:root {
    --page-bg: #f7f7f5;
    --surface: #ffffff;
    --text: #1a1a1a;
    --text-muted: #888;
    --border: #e8e8e6;
    --border-light: #f0f0ee;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --radius: 6px;
    --radius-lg: 10px;
    --content-width: 1080px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --mono: 'SF Mono', 'Menlo', 'Consolas', monospace;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* ===== Typography ===== */
body {
    font-family: var(--font);
    background: var(--page-bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.container { max-width: var(--content-width); margin: 0 auto; padding: 0 1.5rem; }
.page-header { padding: 2rem 0 1.5rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.page-header h1 { margin-bottom: 0.25rem; }
.page-header .subtitle { color: var(--text-muted); font-size: 0.9rem; }

/* ===== Header/navigation ===== */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    align-items: center;
    height: 52px;
    gap: 1.5rem;
}

.logo {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.logo:hover { text-decoration: none; color: var(--accent); }

.site-header nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}

.nav-link:hover { color: var(--text); background: var(--page-bg); text-decoration: none; }
.nav-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.nav-search {
    display: none;
}

@media (min-width: 640px) {
    .nav-search {
        display: block;
        margin-left: 0.5rem;
    }
    .nav-search input {
        width: 180px;
        padding: 0.3rem 0.7rem;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        font-size: 0.85rem;
        font-family: var(--font);
        background: var(--page-bg);
        color: var(--text);
        transition: border-color 0.15s, box-shadow 0.15s;
    }
    .nav-search input:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
    }
    .nav-search input::placeholder { color: var(--text-muted); }
}

/* ===== Search ===== */
.hero {
    text-align: center;
    padding: 5rem 0 3rem;
}

.hero-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 1rem;
}

.hero h1 {
    font-size: 2rem;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
}

.hero-sub {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 440px;
    margin: 0 auto 2.5rem;
    line-height: 1.5;
}

.hero-search {
    max-width: 520px;
    margin: 0 auto 1.25rem;
}

.hero-search input {
    width: 100%;
    padding: 0.85rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-family: var(--font);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.hero-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), 0 1px 3px rgba(0,0,0,0.04);
}

.hero-search input::placeholder { color: #aaa; }

.hero-search button {
    display: none;
}

.hero-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.hero-hint a { font-weight: 500; }

/* ===== Homepage browse section ===== */
.browse-section {
    padding: 2rem 0 3rem;
}

.browse-section h2 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.browse-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 0.5rem 0.55rem;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: border-color 0.15s, box-shadow 0.15s;
    text-align: center;
}

.browse-card:hover {
    border-color: var(--accent);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    text-decoration: none;
}

.browse-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.browse-card .count { color: var(--text-muted); font-size: 0.75rem; font-weight: 400; }

/* ===== Cards/lists ===== */
.alpha-group-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    padding: 1rem 0 0.5rem;
    border-top: 1px solid var(--border);
}

.alpha-group-label:first-child { border-top: none; padding-top: 0; }

.brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
}

.brand-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0.5rem 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: border-color 0.15s, box-shadow 0.15s;
    text-align: center;
}

.brand-card:hover {
    border-color: var(--accent);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    text-decoration: none;
}

.brand-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brand-card .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-card .count, .browse-card .count { display: none; }

/* ===== Brand detail: product list ===== */
.brand-header {
    padding: 2rem 0 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.brand-header h1 { margin-bottom: 0.25rem; }
.brand-header .subtitle { color: var(--text-muted); font-size: 0.9rem; }

.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.5rem;
}

.model-card {
    display: block;
    padding: 0.65rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-card:hover {
    border-color: var(--accent);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    text-decoration: none;
}

.model-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Search results ===== */
.search-hero {
    text-align: center;
    padding: 2.5rem 0 2rem;
}

.search-hero h1 { margin-bottom: 1rem; }

.search-result-count {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.search-results { list-style: none; }

.search-result-item {
    display: block;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
    color: var(--text);
    transition: background 0.1s;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { text-decoration: none; }
.search-result-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius); }

.search-result-brand {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 0.1rem;
}

.search-result-name {
    font-size: 0.95rem;
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.3;
}

.empty-state h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 320px;
    margin: 0 auto;
}

/* ===== Product ===== */
.breadcrumb {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

.breadcrumb .sep { margin: 0 0.35rem; opacity: 0.4; }

.product-page { padding: 0.5rem 0 3rem; }

.product-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.product-eyebrow a { color: var(--accent); }

.product-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    background: var(--page-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.meta-item {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.meta-item strong {
    color: var(--text);
    font-weight: 500;
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.1rem;
}

.meta-item a { font-weight: 500; color: var(--accent); }

.product-section {
    margin-top: 2.5rem;
}

.product-section h2 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.product-section .section-body {
    padding: 1.25rem 0;
    min-height: 60px;
}

.product-section .section-body p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Status tags ===== */
.status-unverified { background: #fef9ec; color: #92640e; border-color: #f0e0b0; }
.status-verified { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.status-rejected { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* ===== Brand logos ===== */
.brand-logo {
    display: block;
    height: 28px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    margin-bottom: 0.3rem;
}

.browse-card .brand-logo,
.brand-card .brand-logo {
    height: 24px;
    margin: 0 auto 0.25rem;
}

.brand-logo-large {
    height: 48px;
    margin-bottom: 0.75rem;
}

.brand-card.has-logo .name,
.browse-card.has-logo .name {
    display: none;
}

.brand-card.no-logo .brand-logo,
.browse-card.no-logo .brand-logo {
    display: none;
}

.brand-header.no-logo .brand-logo-large {
    display: none;
}

@media (max-width: 767px) {
    .brand-logo-large { height: 36px; }
}

/* ===== Utilities ===== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ===== Footer ===== */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ===== Responsive ===== */
@media (max-width: 767px) {
    .hero { padding: 3rem 0 2rem; }
    .hero h1 { font-size: 1.5rem; }
    .hero-sub { font-size: 0.95rem; }
    .brand-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .model-grid { grid-template-columns: 1fr; }
    .product-title { font-size: 1.35rem; }
}

@media (max-width: 374px) {
    .container { padding: 0 1rem; }
    .hero h1 { font-size: 1.35rem; }
    .browse-grid { grid-template-columns: repeat(2, 1fr); }
    .brand-grid { grid-template-columns: repeat(2, 1fr); }
}
