/**
 * Meridian layout: page shell, the framework's 12-column row grid, the chrome
 * bands (promo strip, header, footer) and the mobile navigation drawer.
 *
 * Warm cream canvas, white surfaces, hairline borders, rounded panels and
 * pill buttons. All values come from the token layer.
 */

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

html {
    -webkit-text-size-adjust: 100%;
}

/* Clean cream canvas, both schemes. No texture. */
body {
    margin: 0;
    background-color: var(--ec-bg);
    color: var(--ec-fg);
    font-family: var(--ec-font-body);
    font-size: 1rem;
    line-height: 1.5;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
}

img,
svg,
video {
    max-width: 100%;
    height: auto;
}

/* Page shell: boxed via --ec-cw (100% when full width) */
.ts-container {
    max-width: var(--ec-cw);
    margin-inline: auto;
    padding-inline: var(--ec-gut);
}

/* Framework rows: a real 12-column grid */
.ts-row {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--ec-grid-gap);
    align-items: start;
}

.ts-row + .ts-row {
    margin-top: var(--ec-sect-y);
}

.ts-span-1 { grid-column: span 1; }
.ts-span-2 { grid-column: span 2; }
.ts-span-3 { grid-column: span 3; }
.ts-span-4 { grid-column: span 4; }
.ts-span-5 { grid-column: span 5; }
.ts-span-6 { grid-column: span 6; }
.ts-span-7 { grid-column: span 7; }
.ts-span-8 { grid-column: span 8; }
.ts-span-9 { grid-column: span 9; }
.ts-span-10 { grid-column: span 10; }
.ts-span-11 { grid-column: span 11; }
.ts-span-12 { grid-column: span 12; }

/*
 * Responsive collapse rule (SPEC, Layout): below the md breakpoint every
 * column stacks full width. Per-breakpoint spans are a Studio app
 * feature and will refine this.
 */
@media (max-width: 767.98px) {
    .ts-col {
        grid-column: 1 / -1;
    }

    .ts-row + .ts-row {
        margin-top: calc(var(--ec-sect-y) / 2);
    }
}

/* Page shell between the chrome bands */
.ts-shell {
    padding-block: calc(var(--ec-sect-y) / 2) var(--ec-sect-y);
    min-height: 45vh;
}

/* Promo strip: warm accent band with an uppercase micro-label. The accent
   band reads correctly in both schemes, so no dark override is needed. */
.ts-topbar {
    background: var(--ec-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ts-topbar__inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    min-height: 2rem;
    padding-block: 9px;
}

.ts-topbar__text {
    margin: 0;
    text-align: center;
}

.ts-topbar__side {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ts-topbar__side--end {
    justify-content: flex-end;
}

.ts-topbar a {
    color: inherit;
    text-decoration: none;
}

.ts-social-links {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.ts-social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid color-mix(in srgb, currentColor 45%, transparent);
    border-radius: 999px;
    color: inherit;
    opacity: 0.9;
    transition: opacity var(--ec-dur-1) var(--ec-ease), border-color var(--ec-dur-1) var(--ec-ease);
}

.ts-social:hover {
    opacity: 1;
    border-color: currentColor;
}

.ts-social svg {
    width: 13px;
    height: 13px;
}

.ts-lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.ts-lang {
    padding: 0.15rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 999px;
    color: inherit;
    opacity: 0.75;
    text-decoration: none;
    transition: opacity var(--ec-dur-1) var(--ec-ease), border-color var(--ec-dur-1) var(--ec-ease);
}

.ts-lang:hover {
    opacity: 1;
}

.ts-lang.is-active {
    opacity: 1;
    border-color: color-mix(in srgb, currentColor 55%, transparent);
}

@media (max-width: 639.98px) {
    .ts-topbar__inner {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 0.35rem;
        padding-block: 7px;
    }

    .ts-topbar__side {
        justify-content: center;
    }
}

/* Header band: translucent cream over content, hairline underline */
.ts-header {
    background: color-mix(in oklab, var(--ec-bg) 86%, transparent);
    border-bottom: 1px solid var(--ec-border);
}

.ts-header.is-sticky {
    position: sticky;
    top: 0;
    z-index: 950;
}

/* The blur lives on a pseudo-element: backdrop-filter on the header itself
   would make it the containing block for the fixed off-canvas nav panel,
   trapping the drawer inside the 68px header box. */
.ts-header.is-sticky::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.ts-header__inner {
    display: flex;
    align-items: center;
    gap: 2.25rem;
    min-height: 68px;
    position: relative;
}

.ts-brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--ec-fg);
}

.ts-brand__text {
    font-family: var(--ec-font-display);
    font-weight: 700;
    font-size: clamp(1.3rem, 1.15rem + 0.6vw, 1.4375rem);
    letter-spacing: -0.03em;
    line-height: 1;
    white-space: nowrap;
}

/* The warm full stop, Meridian's signature */
.ts-brand__text::after {
    content: ".";
    color: var(--ec-accent);
}

.ts-brand__logo {
    max-height: 2.5rem;
    width: auto;
}

.ts-header__nav {
    flex: 1;
    min-width: 0;
}

.ts-header__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

/* Header actions (search, account, cart, scheme toggle): soft square buttons */
.ts-action {
    appearance: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 40px;
    height: 40px;
    padding-inline: 0.5rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ec-fg);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--ec-dur-1) var(--ec-ease), color var(--ec-dur-1) var(--ec-ease);
}

.ts-action:hover {
    background: var(--ec-surface-2);
    color: var(--ec-fg);
}

/* Count circle pinned to the cart action's top-right, per the design */
.ts-action__badge {
    position: absolute;
    top: 2px;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--ec-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

/* The explicit display above would otherwise defeat the hidden attribute
   the ec-bridge toggles on the badge. */
.ts-action__badge[hidden] {
    display: none;
}

/* Header variants. Centered = single-row 3-column grid, brand in the middle.
   ChromeRenderer emits brand, nav, actions in that DOM order. */
.ts-header--centered .ts-header__inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "nav brand actions";
    align-items: center;
}

.ts-header--centered .ts-brand {
    grid-area: brand;
    justify-self: center;
}

.ts-header--centered .ts-header__nav {
    grid-area: nav;
    justify-self: start;
    flex: none;
}

.ts-header--centered .ts-header__actions {
    grid-area: actions;
    justify-self: end;
    margin-left: 0;
}

.ts-header--minimal .ts-header__inner {
    justify-content: space-between;
}

/* Navigation: styles Joomla's menu module output */
.ts-header__nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.625rem;
}

.ts-header__nav li {
    position: relative;
}

.ts-header__nav a,
.ts-header__nav .nav-header,
.ts-header__nav .separator {
    display: inline-flex;
    align-items: center;
    padding: 6px 0;
    color: var(--ec-fg);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--ec-dur-1) var(--ec-ease);
}

.ts-header__nav a:hover {
    color: var(--ec-accent);
}

.ts-header__nav li.active > a,
.ts-header__nav li.current > a {
    color: var(--ec-accent);
    font-weight: 600;
}

/* Desktop dropdowns for nested menu levels: rounded surface cards */
.ts-header__nav li ul {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 960;
    min-width: 13rem;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px;
    background: var(--ec-surface);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius);
    box-shadow: var(--ec-shadow);
}

.ts-header__nav li:hover > ul,
.ts-header__nav li:focus-within > ul {
    display: flex;
}

.ts-header__nav li ul a {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 500;
}

.ts-header__nav li ul a:hover {
    background: var(--ec-surface-2);
    color: var(--ec-fg);
}

.ts-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ec-fg);
    cursor: pointer;
    transition: background var(--ec-dur-1) var(--ec-ease);
}

.ts-nav-toggle:hover {
    background: var(--ec-surface-2);
}

/* Mobile: hamburger + slide-in navigation drawer */
@media (max-width: 899.98px) {
    .ts-nav-toggle {
        display: inline-flex;
    }

    .ts-header__nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 990;
        width: min(20rem, 85vw);
        padding: 4.5rem 1.5rem 1.5rem;
        background: var(--ec-surface);
        border-left: 1px solid var(--ec-border);
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform var(--ec-dur-3) var(--ec-ease);
    }

    body.ts-nav-open .ts-header__nav {
        transform: none;
    }

    /* Below the sticky header's 950: the nav panel lives inside the header's
       stacking context, so a higher backdrop would paint over the open panel. */
    body.ts-nav-open::after {
        content: '';
        position: fixed;
        inset: 0;
        z-index: 940;
        background: rgba(15, 12, 8, 0.5);
    }

    body.ts-nav-open {
        overflow: hidden;
    }

    .ts-header__nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .ts-header__nav a {
        width: 100%;
        padding: 12px 10px;
        border-radius: 10px;
        font-size: 1rem;
    }

    .ts-header__nav a:hover {
        background: var(--ec-surface-2);
    }

    .ts-header__nav li ul {
        display: block;
        position: static;
        min-width: 0;
        padding: 0 0 0 0.75rem;
        border: none;
        box-shadow: none;
        background: none;
    }

    /* The nav is off-canvas here, so the grid collapses to brand + actions */
    .ts-header--centered .ts-header__inner {
        grid-template-columns: auto 1fr;
        grid-template-areas: "brand actions";
    }

    .ts-header--centered .ts-brand {
        justify-self: start;
    }
}

/* Tight phones: the action row must never push the nav toggle off screen */
@media (max-width: 639.98px) {
    .ts-header__inner {
        gap: 0.75rem;
        min-height: 60px;
    }

    .ts-header__actions {
        gap: 0.125rem;
    }

    .ts-action {
        min-width: 36px;
        height: 36px;
    }
}

/* Footer band: raised cream surface with a hairline top rule in both
   schemes (surface-2 derives from the tokens, so no dark override). */
.ts-footer {
    background: var(--ec-surface-2);
    color: var(--ec-fg);
    border-top: 1px solid var(--ec-border);
    padding-block: calc(var(--ec-sect-y) / 1.25) 1.75rem;
}

.ts-footer a {
    color: var(--ec-fg-2);
    text-decoration: none;
    transition: color var(--ec-dur-1) var(--ec-ease);
}

.ts-footer a:hover {
    color: var(--ec-accent);
}

.ts-footer__cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: calc(var(--ec-grid-gap) * 2);
    margin-bottom: 2.5rem;
}

/* Column headings as uppercase micro-labels */
.ts-footer h5,
.ts-footer .ts-module__title {
    margin: 0 0 1rem;
    font-family: var(--ec-font-body);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ec-fg-2);
}

.ts-footer ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.625rem;
}

.ts-footer,
.ts-footer p,
.ts-footer li {
    font-size: 0.875rem;
}

.ts-footer p {
    color: var(--ec-fg-2);
    line-height: 1.7;
}

.ts-footer__copy {
    margin: 2.25rem 0 0;
    padding-top: 1.375rem;
    border-top: 1px solid var(--ec-border);
    font-family: var(--ec-font-body);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ec-fg-2);
}

/* Accessibility: skip link */
.ts-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: 0.75rem 1.25rem;
    border-radius: 0 0 var(--ec-radius) 0;
    background: var(--ec-accent);
    color: var(--ec-accent-fg);
}

.ts-skip-link:focus {
    left: 0;
}

/* --- TS rich footer (brand block + columns + bottom bar) --- */
.ts-footer .ts-footer__cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 2rem 2.5rem;
    margin-bottom: 2.75rem;
}
.ts-footer .ts-footer__col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}
.ts-footer .ts-footer__col h5 {
    margin: 0 0 0.95rem;
    font-family: var(--ec-font-mono, inherit);
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ec-accent);
}
.ts-footer .ts-footer__col a,
.ts-footer .ts-footer__brand a {
    text-decoration: none;
}
.ts-footer__brand {
    display: grid;
    align-content: start;
    gap: 0.9rem;
    max-width: 24rem;
}
.ts-footer__brand .ts-brand,
.ts-footer__brand .ts-brand__text {
    font-size: 1.15rem;
}
.ts-footer__blurb {
    margin: 0;
    max-width: 34ch;
    line-height: 1.65;
    opacity: 0.85;
}
.ts-footer__brand .ts-social-links {
    margin-top: 0.15rem;
}
.ts-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.85rem 1.75rem;
    margin-top: 2.5rem;
    padding-top: 1.35rem;
    border-top: 1px solid var(--ec-border);
}
.ts-footer__bottom .ts-footer__copy {
    margin: 0;
    padding: 0;
    border: 0;
}
.ts-footer .ts-footer__legal {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-family: var(--ec-font-mono, inherit);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.75;
}
.ts-footer .ts-footer__legal a {
    text-decoration: none;
}

/* --- Megamenu skin --- */
/* Meridian: warm editorial. The full-width panel stays flush against the
   header (top:100% from the skeleton); the container variant becomes a
   14px-radius card. Single-class selectors win over the skeleton by order. */
.ts-mega[data-width="container"] {
    border-radius: 14px;
}

.ts-mega-toggle {
    border-radius: 999px;
}

.ts-mega-toggle:hover {
    background: var(--ec-surface-2);
    color: var(--ec-accent);
}

.ts-mega__title {
    font-family: var(--ec-font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    color: var(--ec-fg);
}

.ts-mega__links a {
    border-radius: 10px;
    color: var(--ec-fg-2);
}

.ts-mega__links a:hover {
    background: var(--ec-surface-2);
    color: var(--ec-fg);
}

.ts-mega__badge {
    border-radius: 999px;
    background: var(--ec-accent-soft);
    color: var(--ec-accent);
    text-transform: none;
    letter-spacing: 0.02em;
}

.ts-mega__group {
    color: var(--ec-fg-2);
    letter-spacing: 0.1em;
}

.ts-mega__cat,
.ts-mega__prod {
    border-radius: 12px;
}

.ts-mega__cat:hover,
.ts-mega__prod:hover {
    background: var(--ec-surface-2);
}

.ts-mega__cat-img,
.ts-mega__cat-ph,
.ts-mega__prod-img,
.ts-mega__prod-ph {
    border-radius: 10px;
}

.ts-mega__cat-ph,
.ts-mega__prod-ph {
    background: var(--ec-accent-soft);
    color: var(--ec-accent);
    font-family: var(--ec-font-display);
    font-weight: var(--ec-disp-weight);
}

.ts-mega__prod-price {
    color: var(--ec-accent);
    font-weight: 600;
}

.ts-mega__banner {
    border-radius: 14px;
}

.ts-mega__banner-eyebrow {
    letter-spacing: 0.14em;
    opacity: 0.9;
}

.ts-mega__banner-title {
    font-family: var(--ec-font-display);
    font-weight: var(--ec-disp-weight);
    font-size: 21px;
}

/* --- Footer payments --- */
.ts-footer__pay {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ts-footer__pay li {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid var(--ec-border);
    padding: 4px 10px;
    border-radius: 8px;
    color: var(--ec-fg-2);
}
