/*
 * Mega Store Kenya — Apple-inspired polish layer.
 *
 * A refinement layer that layers Apple Human Interface Guidelines
 * principles on top of the existing marketplace + kenyan-storefronts
 * + per-shop themes. Everything downstream (Codex's editorial hero,
 * my commerce homepage, Ecommet's stock storefront themes) keeps
 * its character; this layer just fixes rhythm.
 *
 * Principles applied here:
 *   • 8pt spacing grid (--sp-1..12) for sections and inner spacing
 *   • Precise Inter type scale (SF Pro Text/Display feel) with tight
 *     tracking on display sizes (-.02em to -.035em)
 *   • Restrained depth: 2-layer soft shadows instead of blurry drop
 *     shadows; hairline borders (1px on #d2d2d7-adjacent tints)
 *   • Unified motion curve (cubic-bezier(.28, .11, .32, 1))
 *   • Consistent radius scale: 8 / 12 / 16 / 22px
 *   • Full mobile-first responsiveness — fluid type via clamp(),
 *     breakpoints at 768/1024/1200
 *
 * Loaded LAST across all storefronts + the marketplace homepage so it
 * wins the cascade. Only touches typography rhythm, spacing, depth
 * and motion — never colors (that stays each shop's identity).
 */

:root {
    /* ---------- 8pt spacing grid ---------- */
    --sp-0: 0;
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;
    --sp-7: 40px;
    --sp-8: 56px;
    --sp-9: 80px;
    --sp-10: 96px;
    --sp-11: 128px;
    --sp-12: 160px;

    /* ---------- Type scale (SF-Pro-feel with Inter) ---------- */
    --fs-caption: 12px;
    --fs-footnote: 13px;
    --fs-body: 15px;
    --fs-callout: 17px;
    --fs-title-4: 20px;
    --fs-title-3: 24px;
    --fs-title-2: 32px;
    --fs-title-1: 40px;
    --fs-display-3: 48px;
    --fs-display-2: 64px;
    --fs-display-1: 80px;

    /* ---------- Depth (Apple-style soft shadows) ---------- */
    --shadow-hairline: 0 0 0 1px rgba(0, 0, 0, 0.04);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.05), 0 2px 6px rgba(0, 0, 0, 0.04);
    --shadow-3: 0 12px 32px -8px rgba(0, 0, 0, 0.08), 0 4px 12px -4px rgba(0, 0, 0, 0.04);
    --shadow-hero: 0 24px 64px -20px rgba(0, 0, 0, 0.12), 0 8px 24px -8px rgba(0, 0, 0, 0.06);

    /* ---------- Radii ---------- */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 22px;
    --r-pill: 999px;

    /* ---------- Motion ---------- */
    --ease-out: cubic-bezier(0.28, 0.11, 0.32, 1);
    --ease-in-out: cubic-bezier(0.4, 0.0, 0.2, 1);
    --dur-fast: 180ms;
    --dur-med: 260ms;
    --dur-slow: 400ms;

    /* ---------- Apple-inspired neutral palette (guidance, not overrides) ---------- */
    --apple-ink: #1d1d1f;
    --apple-secondary: #6e6e73;
    --apple-tertiary: #86868b;
    --apple-line: #d2d2d7;
    --apple-line-soft: #e4e4e7;
    --apple-bg: #ffffff;
    --apple-bg-alt: #fbfbfd;
    --apple-bg-tint: #f5f5f7;
}

/* ---------- Base typography (only when not overridden) ---------- */
body {
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ---------- MARKETPLACE HOMEPAGE POLISH ---------- */

/* Fluid, precise display type on hero */
.ms-hero__copy .ms-hero__eyebrow,
.k-hero__badge {
    letter-spacing: 0.08em;
}

/* Refine the commerce hero title */
.k-hero__title {
    font-size: clamp(28px, 3vw + 8px, 44px);
    letter-spacing: -0.025em;
    line-height: 1.06;
    font-weight: 700;
}
.k-hero__sub {
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.78);
    letter-spacing: -0.005em;
}
.k-hero__price .now {
    font-size: clamp(32px, 3.5vw + 4px, 44px);
    letter-spacing: -0.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

/* Section heads across the homepage */
.k-sec__head h2 {
    font-size: clamp(22px, 1.6vw + 12px, 30px);
    letter-spacing: -0.02em;
    line-height: 1.15;
}
.k-sec__head .k-sec__meta a.more { font-weight: 600; }

/* Product cards: Apple-quiet depth + spring on hover */
.k-card,
.k-store,
.ms-product,
.store-card,
.mk-store .product-default {
    box-shadow: var(--shadow-1);
    transition:
        transform var(--dur-med) var(--ease-out),
        box-shadow var(--dur-med) var(--ease-out),
        border-color var(--dur-med) var(--ease-out);
}
.k-card:hover,
.k-store:hover,
.ms-product:hover,
.store-card:hover,
.mk-store .product-default:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-3);
    border-color: transparent;
}
.k-card__media,
.ms-product__media,
.store-cover,
.mk-store .product-default .product-img {
    background: var(--apple-bg-tint);
}
.k-card__title,
.ms-product__title {
    font-size: 14px;
    line-height: 1.4;
    letter-spacing: -0.005em;
    font-weight: 500;
}
.k-card__price .now,
.ms-product__price .now {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* Category tiles */
.k-cat,
.ms-cat-tile {
    border-radius: var(--r-md);
    transition: transform var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
}
.k-cat:hover,
.ms-cat-tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-2);
}

/* Buttons: unified motion curve, tighter shadow on primary */
.k-btn,
.btn-primary,
.button,
.ke-button {
    transition:
        background-color var(--dur-fast) var(--ease-out),
        transform var(--dur-fast) var(--ease-out),
        box-shadow var(--dur-fast) var(--ease-out);
    letter-spacing: -0.005em;
    font-weight: 600;
}
.k-btn:hover,
.btn-primary:hover,
.button:hover,
.ke-button:hover {
    transform: translateY(-1px);
}
.k-btn:active,
.button:active,
.ke-button:active {
    transform: translateY(0);
}

/* ---------- STOREFRONT (per-shop) POLISH — .mk-store namespace ---------- */

/* Cleaner type rhythm inside every storefront */
.mk-store h1, .mk-store h2, .mk-store h3, .mk-store h4 {
    letter-spacing: -0.02em;
    line-height: 1.15;
    font-weight: 600;
}
.mk-store .section-title h2,
.mk-store .section-title .title {
    font-size: clamp(22px, 1.8vw + 8px, 32px);
    letter-spacing: -0.025em;
    line-height: 1.12;
    font-weight: 600;
}
.mk-store .section-title p,
.mk-store .section-title .subtitle {
    font-size: 15px;
    line-height: 1.55;
    color: #58665c;
    letter-spacing: -0.005em;
    max-width: 640px;
    margin-inline: auto;
}

/* Standardize section rhythm across all storefronts */
.mk-store .section-padding,
.mk-store [class*="section-padding"] {
    padding-top: clamp(48px, 6vw, 96px) !important;
    padding-bottom: clamp(48px, 6vw, 96px) !important;
}

/* Product default: Apple-quiet card */
.mk-store .product-default {
    border-radius: var(--r-md);
    border-color: var(--apple-line-soft);
}
.mk-store .product-default .product-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: -0.005em;
}
.mk-store .product-default .price-box .product-price,
.mk-store .product-default .price {
    font-weight: 600;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.mk-store .product-default .old-price {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

/* Form fields: Apple-style inputs */
.mk-store .form-control,
.mk-store input:not([type=submit]):not([type=button]):not([type=checkbox]):not([type=radio]),
.mk-store textarea,
.mk-store select {
    border-radius: var(--r-sm);
    border-color: var(--apple-line);
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
    font-size: 14px;
    padding: 10px 14px;
    min-height: 40px;
    line-height: 1.4;
}
.mk-store .form-control:focus,
.mk-store input:focus,
.mk-store textarea:focus,
.mk-store select:focus {
    outline: 0;
    border-color: #153e32;
    box-shadow: 0 0 0 4px rgba(21, 62, 50, 0.12);
}

/* Buttons in storefront themes */
.mk-store .btn,
.mk-store button {
    border-radius: var(--r-sm);
    letter-spacing: -0.005em;
    font-weight: 600;
    min-height: 40px;
    padding: 10px 20px;
    transition:
        background-color var(--dur-fast) var(--ease-out),
        transform var(--dur-fast) var(--ease-out),
        box-shadow var(--dur-fast) var(--ease-out);
}
.mk-store .btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.mk-store .btn:active { transform: translateY(0); }

/* Category items */
.mk-store .category-item,
.mk-store .category-item2 {
    border-radius: var(--r-md);
    transition:
        transform var(--dur-med) var(--ease-out),
        box-shadow var(--dur-med) var(--ease-out);
}
.mk-store .category-item:hover,
.mk-store .category-item2:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-3);
}

/* Slider text sizing */
.mk-store .home-slider .slider-content h1 {
    font-size: clamp(30px, 3.5vw, 56px);
    line-height: 1.08;
    letter-spacing: -0.03em;
    font-weight: 600;
}

/* ---------- EDITORIAL HERO (ke-editorial) POLISH ---------- */

.ke-editorial {
    padding-top: clamp(24px, 4vw, 48px);
    padding-bottom: clamp(24px, 4vw, 48px);
}
.ke-hero-copy h1 {
    line-height: 1.05;
    letter-spacing: -0.03em;
}
.ke-hero-copy p {
    font-size: 15px;
    line-height: 1.7;
    letter-spacing: -0.005em;
    max-width: 400px;
}
.ke-kicker {
    font-size: 11px !important;
    letter-spacing: 0.14em !important;
    font-weight: 700;
}
.ke-button {
    border-radius: var(--r-sm) !important;
    letter-spacing: -0.005em;
    font-weight: 600;
    font-size: 13px !important;
    transition:
        background-color var(--dur-fast) var(--ease-out),
        transform var(--dur-fast) var(--ease-out),
        box-shadow var(--dur-fast) var(--ease-out) !important;
}
.ke-button:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.ke-tech-story {
    border-radius: var(--r-md);
    transition: transform var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out), border-color var(--dur-med) var(--ease-out);
}
.ke-tech-story:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-2);
}

/* ---------- HEADER + NAV RHYTHM ---------- */
.mk-store .header .header-top,
.mk-store .header .header-middle {
    letter-spacing: -0.005em;
}
.mk-store .header .navbar-nav .nav-link {
    font-weight: 500;
    letter-spacing: -0.005em;
    transition: color var(--dur-fast) var(--ease-out);
}

/* ---------- MOBILE-FIRST RESPONSIVENESS ---------- */

/* Small mobile (≤380px): compact everything */
@media (max-width: 380px) {
    .mk-store .section-title h2,
    .mk-store .section-title .title { font-size: 22px !important; }
    .mk-store .product-default .product-details { padding: 12px !important; }
    .mk-store .btn,
    .mk-store button,
    .k-btn { min-height: 44px; padding: 10px 16px; font-size: 13.5px; }
    .ke-hero-copy { padding: 28px 20px !important; }
    .ke-hero-copy h1 { font-size: 34px !important; letter-spacing: -.02em; }
    .ke-hero-copy p { font-size: 14px; }
    .ke-hero-copy .ke-button { padding: 12px 18px !important; font-size: 12px !important; }
    .ke-store-notes { padding: 12px 0 !important; }
    .ke-store-notes strong { font-size: 12px !important; }
    .ke-store-notes small { font-size: 10.5px !important; }
    .ke-store-notes i { font-size: 20px !important; }
}

/* Mobile (≤600px): stack, reduce padding */
@media (max-width: 600px) {
    .mk-store .row { --bs-gutter-x: 16px; }
    .mk-store .container,
    .mk-store .container-fluid { padding-inline: 16px; }
    .mk-store .section-title { text-align: center; }
    .mk-store .product-default .product-title { font-size: 13.5px; }
    .mk-store .product-default .price-box .product-price { font-size: 15px; }
    /* Ensure minimum tap target size (44px per Apple HIG) */
    .mk-store .header a,
    .mk-store .header button,
    .mk-store .btn { min-height: 44px; display: inline-flex; align-items: center; }
    /* Product grid: 2-column on phone */
    .mk-store .products-slider .swiper-slide,
    .mk-store .products .col-6 { min-width: 0; }
    /* Editorial hero mobile — reduce excess height & tighten */
    .ke-hero-copy { padding: 32px 22px !important; }
    .ke-hero-copy h1 { font-size: 40px; letter-spacing: -0.025em; margin-bottom: 18px; }
    .ke-hero-copy p { font-size: 14.5px; line-height: 1.65; }
    .ke-editorial-electronics .ke-hero-copy h1 { font-size: 34px !important; }
    .ke-photo-caption { font-size: 10px; padding: 6px 8px; }
}

/* Tablet (601-900px) */
@media (min-width: 601px) and (max-width: 900px) {
    .mk-store .section-padding { padding-block: 56px !important; }
    .mk-store .product-default { border-radius: var(--r-md); }
    .ke-hero-copy h1 { font-size: clamp(40px, 5vw, 52px); }
    .ke-editorial-electronics .ke-editorial-grid { gap: 16px; }
}

/* Desktop small (901-1199px) */
@media (min-width: 901px) and (max-width: 1199px) {
    .mk-store .section-padding { padding-block: 72px !important; }
    .ke-hero-copy { padding: 52px 5%; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
    .k-card:hover, .k-store:hover, .ms-product:hover, .store-card:hover,
    .mk-store .product-default:hover, .k-cat:hover, .ms-cat-tile:hover,
    .ke-tech-story:hover, .k-btn:hover, .ke-button:hover, .mk-store .btn:hover {
        transform: none;
    }
}

/* ---------- FOOTER: refine per-shop footer (still Codex's dark green) ---------- */
.mk-store .footer-widget h3 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.005em;
    margin-bottom: 20px;
}
.mk-store .footer-widget .footer-links a {
    font-size: 13.5px;
    line-height: 1.7;
    letter-spacing: -0.005em;
    transition: color var(--dur-fast) var(--ease-out), padding-left var(--dur-fast) var(--ease-out);
}
.mk-store .footer-widget .footer-links li:not(:has(i)) a:hover {
    color: #d5ee87;
    padding-left: 4px;
}
.mk-store .footer-widget-address span,
.mk-store .footer-widget-address li {
    display: block;
    line-height: 1.6;
    letter-spacing: -0.005em;
    font-size: 13.5px;
}
.mk-store .footer-widget-number a,
.mk-store .footer-widget-email a {
    letter-spacing: -0.005em;
    font-variant-numeric: tabular-nums;
    font-size: 13.5px;
}
.mk-store .copy-right-content {
    font-size: 12.5px;
    letter-spacing: -0.005em;
    opacity: 0.85;
    padding: 16px 0;
}
.mk-store .copy-right-content a {
    color: #d5ee87;
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease-out);
}
.mk-store .copy-right-content a:hover { color: #fff; }
.mk-store .social-link a {
    display: inline-grid;
    place-items: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #d5ee87;
    margin-right: 8px;
    transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.mk-store .social-link a:hover {
    background: rgba(213, 238, 135, 0.16);
    transform: translateY(-2px);
}
.mk-store .newsletter-form .input-group {
    border-radius: var(--r-pill);
    box-shadow: var(--shadow-1);
    padding: 4px;
    background: #fff;
}
.mk-store .newsletter-form .form-control {
    border: 0 !important;
    background: transparent;
    padding: 8px 14px;
    min-height: 40px;
    font-size: 14px;
}
.mk-store .newsletter-form .btn {
    border-radius: var(--r-pill) !important;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.005em;
}
