/* ==========================================================================
   THINKSTV LED — header & mega navigation
   --------------------------------------------------------------------------
   Two kinds of token live here:

   1. Header tokens (--hdr-*) are fixed brand styling, set in this file.
   2. Mega menu tokens (--mega-*) are OVERWRITTEN AT RUNTIME by main.js from
      the API `style` object, which is what the CMS Style Settings tab edits.
      The values below are only fallbacks for when the API is unreachable.
   ========================================================================== */

:root {
    /* Header — fixed brand styling */
    --hdr-bg: #05070f;
    --hdr-text: #ffffff;
    --hdr-text-dim: rgba(255, 255, 255, 0.72);
    --hdr-accent: #0d6efd;
    --hdr-height: 84px;

    /* Mega menu — overwritten by the CMS */
    --mega-bg: #ffffff;
    --mega-preview-bg: #f5f8ff;
    --mega-text: #222222;
    --mega-hover-text: #0d6efd;
    --mega-active-text: #0d6efd;
    --mega-font-size: 16px;
    --mega-column-gap: 60px;
    --mega-width: 1400px;
    --mega-radius: 12px;

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --speed: 220ms;
}

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

body {
    margin: 0;
    font-family: "Inter", "Helvetica Neue", "PingFang SC", "Microsoft YaHei",
        system-ui, sans-serif;
    color: #1a1d29;
    background: #ffffff;
    -webkit-font-smoothing: antialiased;
}

body.is-menu-open {
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font: inherit;
    border: 0;
    background: none;
    cursor: pointer;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--hdr-accent);
    outline-offset: 3px;
    border-radius: 4px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ==========================================================================
   Header bar
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 900;
    background: var(--hdr-bg);
    color: var(--hdr-text);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    height: var(--hdr-height);
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 40px;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.brand__accent {
    color: var(--hdr-accent);
}

.brand__sub {
    display: block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.34em;
    color: var(--hdr-text-dim);
}

/* Primary navigation --------------------------------------------------- */

.primary-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.primary-nav__list {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 18px;
    height: var(--hdr-height);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hdr-text);
    transition: color var(--speed) var(--ease);
    white-space: nowrap;
}

.nav-link:hover,
.nav-item.is-open .nav-link {
    color: var(--hdr-accent);
}

.nav-link__chevron {
    width: 11px;
    height: 11px;
    transition: transform var(--speed) var(--ease);
}

.nav-item.is-open .nav-link__chevron {
    transform: rotate(180deg);
}

/* The blue underline that marks the open item */
.nav-item.has-mega .nav-link::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 0;
    height: 3px;
    background: var(--hdr-accent);
    transform: scaleX(0);
    transition: transform var(--speed) var(--ease);
}

.nav-item.is-open .nav-link::after {
    transform: scaleX(1);
}

/* Header right-hand controls ------------------------------------------- */

.header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-shrink: 0;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    padding: 13px 26px;
    border-radius: 999px;
    background: var(--hdr-accent);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background var(--speed) var(--ease);
}

.cta-button:hover {
    background: #0b5ed7;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--hdr-text);
    transition: background var(--speed) var(--ease);
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--hdr-text);
}

.lang-toggle__option {
    padding: 4px 2px;
    color: var(--hdr-text-dim);
    transition: color var(--speed) var(--ease);
}

.lang-toggle__option:hover {
    color: var(--hdr-text);
}

.lang-toggle__option.is-active {
    color: var(--hdr-accent);
}

.lang-toggle__divider {
    color: rgba(255, 255, 255, 0.3);
}

.menu-trigger {
    display: none;
    width: 44px;
    height: 44px;
    place-items: center;
}

/* ==========================================================================
   Mega menu panel
   ========================================================================== */

/* The panel is centred on the VIEWPORT, not on the nav item it belongs to.
   Anchoring it to the nav item pushes a 1400px panel off the left edge of the
   screen, because the Products link sits well left of centre. `fixed` works
   here because the header is sticky at top:0 and has no transformed ancestor.
   The panel stays a DOM child of the <li>, so mouseleave still behaves. */
.mega-panel {
    position: fixed;
    top: var(--hdr-height);
    left: 50%;
    z-index: 880;
    width: min(var(--mega-width), calc(100vw - 48px));
    transform: translate(-50%, -8px);
    background: var(--mega-bg);
    border-radius: var(--mega-radius);
    box-shadow: 0 24px 60px rgba(6, 12, 34, 0.16);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--speed) var(--ease),
        transform var(--speed) var(--ease), visibility 0s linear var(--speed);
}

.nav-item.is-open .mega-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 10px);
    transition-delay: 0s;
}

/* Bridges the visual gap between the header and the panel so the pointer
   never leaves the item while travelling down into the menu. */
.nav-item.has-mega.is-open::after {
    content: "";
    position: fixed;
    top: var(--hdr-height);
    left: 0;
    right: 0;
    height: 14px;
}

.mega-grid {
    display: grid;
    grid-template-columns: 300px 260px 1fr;
    gap: var(--mega-column-gap);
    padding: 28px;
}

.mega-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.mega-column--series {
    border-left: 1px solid rgba(16, 24, 48, 0.08);
    padding-left: calc(var(--mega-column-gap) / 2);
    margin-left: calc(var(--mega-column-gap) / -2);
}

/* Level 1 — categories -------------------------------------------------- */

.mega-category {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: var(--mega-font-size);
    font-weight: 600;
    color: var(--mega-text);
    text-align: left;
    transition: background var(--speed) var(--ease),
        color var(--speed) var(--ease);
}

.mega-category:hover {
    color: var(--mega-hover-text);
    background: rgba(13, 110, 253, 0.05);
}

.mega-category.is-active {
    color: var(--mega-active-text);
    background: rgba(13, 110, 253, 0.09);
}

.mega-category__icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    opacity: 0.85;
}

.mega-category__label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mega-category__arrow {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.4;
    transition: transform var(--speed) var(--ease), opacity var(--speed) var(--ease);
}

.mega-category.is-active .mega-category__arrow {
    opacity: 1;
    transform: translateX(3px);
}

/* Level 2 — series ------------------------------------------------------ */

.mega-series {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: var(--mega-font-size);
    font-weight: 500;
    color: var(--mega-text);
    text-align: left;
    transition: background var(--speed) var(--ease),
        color var(--speed) var(--ease);
}

.mega-series:hover {
    color: var(--mega-hover-text);
    background: rgba(13, 110, 253, 0.05);
}

.mega-series.is-active {
    background: var(--mega-active-text);
    color: #ffffff;
    font-weight: 600;
}

.mega-series__label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mega-series__arrow {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--speed) var(--ease);
}

.mega-series.is-active .mega-series__arrow {
    opacity: 1;
}

/* Level 3 — preview panel ----------------------------------------------- */

.mega-preview {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    align-items: center;
    gap: 36px;
    padding: 34px;
    border-radius: var(--mega-radius);
    background: var(--mega-preview-bg);
    min-height: 340px;
}

.mega-preview__media {
    display: grid;
    align-items: center;
    justify-items: stretch;   /* NOT place-items:center - that collapses the
                                 placeholder to its content width */
    min-height: 220px;
}

.mega-preview__media img {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
}

.mega-preview__placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 10px;
    background: linear-gradient(135deg, #6a5bd6, #4aa3f0 45%, #46d6d0);
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mega-preview__title {
    margin: 0 0 14px;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--mega-active-text);
}

.mega-preview__description {
    margin: 0 0 26px;
    font-size: 16px;
    line-height: 1.6;
    color: #4a5163;
}

.mega-preview__button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 26px;
    border-radius: 8px;
    background: var(--mega-active-text);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    transition: transform var(--speed) var(--ease),
        background var(--speed) var(--ease);
}

.mega-preview__button:hover {
    background: #0b5ed7;
    transform: translateX(3px);
}

.mega-preview__empty {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    color: #79808f;
    font-size: 15px;
}

/* ==========================================================================
   Mobile navigation — full screen drawer
   ========================================================================== */

.mobile-nav {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    flex-direction: column;
    background: var(--hdr-bg);
    color: var(--hdr-text);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 300ms var(--ease), visibility 0s linear 300ms;
}

.mobile-nav.is-open {
    transform: translateX(0);
    visibility: visible;
    transition-delay: 0s;
}

.mobile-nav__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--hdr-height);
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.mobile-nav__body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px 40px;
    -webkit-overflow-scrolling: touch;
}

.mobile-nav__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 20px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 17px;
    font-weight: 600;
    color: var(--hdr-text);
    text-align: left;
}

.mobile-nav__link[aria-expanded="true"] {
    color: var(--hdr-accent);
}

.mobile-nav__link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform var(--speed) var(--ease);
}

.mobile-nav__link[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.mobile-nav__sub {
    display: none;
    padding: 6px 0 14px 16px;
}

.mobile-nav__sub.is-open {
    display: block;
}

.mobile-nav__category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 15px 4px;
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.86);
    text-align: left;
}

.mobile-nav__category[aria-expanded="true"] {
    color: var(--hdr-accent);
}

.mobile-nav__series {
    display: none;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.14);
    margin-bottom: 10px;
}

.mobile-nav__series.is-open {
    display: block;
}

.mobile-nav__series a {
    display: block;
    padding: 12px 4px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.66);
}

.mobile-nav__series a:hover {
    color: var(--hdr-accent);
}

.mobile-nav__footer {
    padding: 24px 20px 34px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}

/* ==========================================================================
   Page body — placeholder only, replaced in later stages
   ========================================================================== */

.hero {
    display: grid;
    place-items: center;
    min-height: 62vh;
    padding: 80px 40px;
    text-align: center;
    background: radial-gradient(ellipse at 50% 0%, #101a3a 0%, #05070f 68%);
    color: #ffffff;
}

.hero__eyebrow {
    margin: 0 0 18px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--hdr-accent);
}

.hero__title {
    margin: 0 0 20px;
    font-size: clamp(30px, 5vw, 54px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    max-width: 18ch;
}

.hero__text {
    margin: 0;
    font-size: 17px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.66);
    max-width: 56ch;
}

.status-bar {
    padding: 16px 40px;
    font-size: 13px;
    text-align: center;
    background: #fff4e5;
    color: #7a4b00;
    border-bottom: 1px solid #ffe0b2;
}

.status-bar[hidden] {
    display: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1200px) {
    .mega-grid {
        grid-template-columns: 260px 220px 1fr;
        gap: 32px;
    }

    .header-inner {
        padding: 0 24px;
        gap: 20px;
    }

    .nav-link {
        padding: 0 12px;
        font-size: 14px;
    }
}

@media (max-width: 1024px) {
    :root {
        --hdr-height: 68px;
    }

    .primary-nav,
    .header-actions .cta-button,
    .header-actions .icon-button {
        display: none;
    }

    .menu-trigger {
        display: grid;
    }

    .hero {
        min-height: 50vh;
        padding: 60px 24px;
    }
}

/* Respect the operating system's reduced-motion setting. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
