/* ===========================================================================
   aeisg-web — Design system
   Industrial / technical look for a commercial-vehicle parts catalogue.
   All colour + spacing tokens are CSS custom properties; dark mode included.
   =========================================================================== */

:root {
    /* Brand palette — steel blue + safety amber */
    --color-bg:          #f4f6f8;
    --color-surface:     #ffffff;
    --color-surface-2:   #eef1f5;
    --color-border:      #d9dee5;
    --color-text:        #1a2331;
    --color-text-muted:  #5c6b7a;
    --color-primary:     #14467a;   /* deep steel blue */
    --color-primary-600: #0f3a66;
    --color-primary-100: #e3edf7;
    --color-accent:      #f5a623;   /* safety amber */
    --color-accent-600:  #d98a08;
    --color-success:     #1f9d57;
    --color-danger:      #c0392b;

    /* Typography */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

    /* Spacing + shape */
    --radius:    8px;
    --radius-sm: 5px;
    --shadow:    0 1px 3px rgba(16,28,48,.08), 0 1px 2px rgba(16,28,48,.04);
    --shadow-md: 0 4px 16px rgba(16,28,48,.10);
    --container: 1200px;
    --header-h:  64px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg:         #0f1623;
        --color-surface:    #18212f;
        --color-surface-2:  #1f2a3a;
        --color-border:     #2c3849;
        --color-text:       #e7edf4;
        --color-text-muted: #93a1b5;
        --color-primary:    #4a90d9;
        --color-primary-600:#3d7cbf;
        --color-primary-100:#1b2c40;
        --color-accent:     #f5a623;
        --shadow:    0 1px 3px rgba(0,0,0,.4);
        --shadow-md: 0 4px 16px rgba(0,0,0,.5);
    }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { line-height: 1.2; color: var(--color-text); }

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

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; }

.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: -999px; top: 0; background: var(--color-primary);
    color: #fff; padding: .5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---- Header --------------------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}
.header-inner {
    display: flex; align-items: center; gap: 1.5rem;
    min-height: var(--header-h);
}
.site-logo {
    font-weight: 800; font-size: 1.4rem; letter-spacing: -.02em;
    color: var(--color-text); text-decoration: none; white-space: nowrap;
}
.logo-accent { color: var(--color-accent); }

.main-nav { flex: 1; }
.main-nav > ul {
    list-style: none; display: flex; gap: .25rem; margin: 0; padding: 0;
}
.main-nav a {
    display: block; padding: .5rem .85rem; border-radius: var(--radius-sm);
    color: var(--color-text); font-weight: 600; font-size: .95rem;
}
.main-nav a:hover { background: var(--color-surface-2); text-decoration: none; }
.main-nav a.active { color: var(--color-primary); background: var(--color-primary-100); }

.search-form { display: flex; align-items: center; position: relative; }
.search-form input {
    width: 260px; max-width: 40vw; padding: .55rem .8rem; padding-right: 2.4rem;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    background: var(--color-bg); color: var(--color-text); font-size: .92rem;
}
.search-form input:focus { outline: 2px solid var(--color-primary); border-color: var(--color-primary); }
.search-form button {
    position: absolute; right: .35rem; background: none; border: 0;
    color: var(--color-text-muted); cursor: pointer; padding: .35rem;
}

.nav-toggle { display: none; flex-direction: column; gap: 4px; background: none;
    border: 0; cursor: pointer; padding: .4rem; }
.nav-toggle span { width: 22px; height: 2px; background: var(--color-text); border-radius: 2px; }

.search-suggest {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 60; margin: .35rem 0 0;
    list-style: none; padding: .25rem; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-md);
    max-height: 60vh; overflow-y: auto;
}
.search-suggest a { display: block; padding: .5rem .65rem; border-radius: var(--radius-sm);
    color: var(--color-text); font-size: .9rem; }
.search-suggest a:hover { background: var(--color-surface-2); text-decoration: none; }

/* ---- Hero ----------------------------------------------------------------- */
.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-600) 100%);
    color: #fff; padding: 3.5rem 0 3rem; text-align: center;
}
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 0 0 .75rem; color: #fff; }
.hero-sub { font-size: 1.1rem; max-width: 42rem; margin: 0 auto 1.75rem; color: #cdddf0; }
.hero-sub strong { color: #fff; }
.hero-search { display: flex; max-width: 36rem; margin: 0 auto; gap: .5rem; }
.hero-search input {
    flex: 1; padding: .85rem 1rem; border: 0; border-radius: var(--radius);
    font-size: 1rem; background: #fff; color: var(--color-text);
}
.hero-search button {
    padding: .85rem 1.5rem; border: 0; border-radius: var(--radius);
    background: var(--color-accent); color: #1a2331; font-weight: 700; cursor: pointer;
}
.hero-search button:hover { background: var(--color-accent-600); }
.hero-stats { display: flex; justify-content: center; gap: 2.5rem; margin-top: 2rem; }
.hero-stats .stat-num { display: block; font-size: 1.6rem; font-weight: 800; }
.hero-stats .stat-label { font-size: .85rem; color: #cdddf0; text-transform: uppercase; letter-spacing: .05em; }

/* ---- Sections ------------------------------------------------------------- */
.section { padding: 3rem 0; }
.section-alt { background: var(--color-surface-2); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.5rem; }
.section-head h2 { font-size: 1.5rem; margin: 0; }
.link-more { font-weight: 600; font-size: .95rem; }

.page-head { padding: 1.75rem 0 1rem; }
.page-head h1 { font-size: 1.8rem; margin: 0 0 .25rem; }
.result-count { color: var(--color-text-muted); margin: 0; font-size: .95rem; }

/* ---- Brand grid ----------------------------------------------------------- */
.brand-grid {
    display: grid; gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.brand-card {
    display: flex; flex-direction: column; gap: .25rem;
    padding: 1.25rem; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius);
    box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s;
}
.brand-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; }
.brand-name { font-weight: 700; font-size: 1.05rem; color: var(--color-text); }
.brand-count { font-size: .85rem; color: var(--color-text-muted); }

/* ---- Product grid --------------------------------------------------------- */
.product-grid {
    display: grid; gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.product-card {
    display: flex; flex-direction: column;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    transition: transform .12s, box-shadow .12s;
}
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; }
.product-thumb {
    aspect-ratio: 4 / 3; background: var(--color-surface-2);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: contain; }
.product-thumb-placeholder { font-size: 2.5rem; color: var(--color-border); }
.product-thumb-placeholder.large { font-size: 6rem; aspect-ratio: 1; width: 100%; }
.product-meta { padding: .75rem .85rem; display: flex; flex-direction: column; gap: .2rem; }
.product-sku { font-family: var(--font-mono); font-size: .78rem; color: var(--color-accent-600); font-weight: 600; }
.product-name { font-size: .92rem; font-weight: 600; color: var(--color-text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- Filter bar ----------------------------------------------------------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end;
    padding: 1rem; background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); margin-bottom: 1.5rem; }
.filter-bar label { display: flex; flex-direction: column; gap: .25rem;
    font-size: .8rem; font-weight: 600; color: var(--color-text-muted); }
.filter-bar select { padding: .5rem .6rem; border: 1px solid var(--color-border);
    border-radius: var(--radius-sm); background: var(--color-bg); color: var(--color-text); min-width: 180px; }
.filter-clear { align-self: center; font-size: .9rem; color: var(--color-danger); }

/* ---- Product detail ------------------------------------------------------- */
.product-detail { padding: 2rem 0 3rem; }
.product-layout { display: grid; grid-template-columns: minmax(0, 420px) 1fr; gap: 2.5rem; }
.product-gallery .product-hero-img {
    width: 100%; background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); object-fit: contain; aspect-ratio: 1;
}
.thumb-strip { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.thumb-strip img { width: 64px; height: 64px; object-fit: contain;
    border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); }

.product-info h1 { font-size: 1.6rem; margin: .35rem 0 .5rem; }
.product-brand-tag {
    display: inline-block; font-size: .8rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--color-primary); background: var(--color-primary-100);
    padding: .25rem .6rem; border-radius: 999px; margin-right: .4rem;
}
.product-sku-line { font-family: var(--font-mono); color: var(--color-text-muted); margin: 0 0 1rem; }
.product-price { font-size: 1.5rem; font-weight: 800; color: var(--color-text); margin-bottom: 1rem; }
.btn-enquire {
    display: inline-block; background: var(--color-accent); color: #1a2331;
    font-weight: 700; padding: .75rem 1.5rem; border-radius: var(--radius);
    margin-bottom: 1.5rem;
}
.btn-enquire:hover { background: var(--color-accent-600); text-decoration: none; }

.spec-table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; }
.spec-table th, .spec-table td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--color-border); vertical-align: top; }
.spec-table th { width: 180px; color: var(--color-text-muted); font-weight: 600; font-size: .9rem; }
.oe-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.oe-chip { font-family: var(--font-mono); font-size: .78rem; background: var(--color-surface-2);
    border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: .15rem .45rem; }

.product-description { margin-top: 1.5rem; }
.product-description h2 { font-size: 1.2rem; margin-bottom: .5rem; }

/* ---- Prose (CMS pages) ---------------------------------------------------- */
.page-cms { padding: 2rem 0 3rem; }
.prose { max-width: 760px; }
.prose h1 { font-size: 2rem; margin-bottom: 1rem; }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem 1.25rem; }

/* ---- Pagination ----------------------------------------------------------- */
.pagination { margin: 2rem 0 1rem; }
.pagination ul { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: 0; justify-content: center; }
.pagination a { display: block; padding: .5rem .8rem; border: 1px solid var(--color-border);
    border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text); font-weight: 600; }
.pagination a:hover { background: var(--color-surface-2); text-decoration: none; }
.pagination .active a { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pagination .ellipsis { padding: .5rem .4rem; color: var(--color-text-muted); }

/* ---- Misc ----------------------------------------------------------------- */
.empty-state { padding: 3rem 1rem; text-align: center; color: var(--color-text-muted); }
.error-page { text-align: center; padding: 4rem 0; }
.error-page h1 { font-size: 4rem; color: var(--color-primary); margin: 0; }
mark { background: var(--color-accent); color: #1a2331; padding: 0 .1em; }

/* ---- Breadcrumb ----------------------------------------------------------- */
.breadcrumb { background: var(--color-surface-2); border-bottom: 1px solid var(--color-border); font-size: .85rem; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: .6rem 0; }
.breadcrumb li:not(:last-child)::after { content: "›"; margin-left: .5rem; color: var(--color-text-muted); }
.breadcrumb span[aria-current] { color: var(--color-text-muted); }

/* ---- Footer --------------------------------------------------------------- */
.site-footer { background: var(--color-surface); border-top: 1px solid var(--color-border); margin-top: 3rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 2rem; padding: 2.5rem 1.25rem; }
.footer-brand { max-width: 18rem; }
.footer-brand p { color: var(--color-text-muted); font-size: .9rem; }
.footer-nav { display: flex; gap: 3rem; flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: .5rem; }
.footer-col a { color: var(--color-text-muted); font-size: .9rem; }
.footer-bottom { border-top: 1px solid var(--color-border); }
.footer-bottom p { text-align: center; color: var(--color-text-muted); font-size: .85rem; padding: 1rem 0; margin: 0; }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 860px) {
    .main-nav { position: fixed; inset: var(--header-h) 0 auto 0; background: var(--color-surface);
        border-bottom: 1px solid var(--color-border); padding: 1rem 1.25rem; display: none; box-shadow: var(--shadow-md); }
    .main-nav.open { display: block; }
    .main-nav > ul { flex-direction: column; }
    .nav-toggle { display: flex; }
    .search-form input { width: 160px; }
    .product-layout { grid-template-columns: 1fr; }
    .hero-stats { gap: 1.5rem; }
}
