/*
Theme Name: ic-lk
Author: Amila Upathissa
Author URI: https://amila.info
Description: Custom Elementor & WooCommerce–ready theme for IC.lk — Laptop Spare Parts & Accessories.
Version: 1.1.0
Requires at least: 6.5
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ic-lk
Tags: e-commerce, custom-menu, translation-ready
*/

/* ==========================================================================
   Design tokens — ported from prototype/src/styles/global.css.
   Keep this the single source of truth; mirror changes into Elementor's
   Site Settings > Design System (Global Colors / Global Fonts) by hand.
   ========================================================================== */
:root {
  /* Brand colors — blue drawn from the Imaka Technologies logo,
     red accent nodding to SVP Tech */
  --color-brand: #1690fa;
  --color-primary: #0973c9;
  --color-primary-dark: #075a9e;
  --color-primary-soft: #e8f4fe;
  --color-accent: #d92d20;
  --color-accent-dark: #b42318;
  --color-accent-soft: #fee4e2;

  /* Semantic */
  --color-success: #15803d;
  --color-success-soft: #dcfce7;
  --color-warning: #b45309;
  --color-warning-soft: #fef3c7;

  /* Neutrals */
  --color-ink: #0f172a;
  --color-ink-2: #16283f;
  --color-text: #1e293b;
  --color-text-muted: #5b6b81;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-surface: #ffffff;
  --color-bg: #f4f6f9;

  /* Typography */
  --font-heading: 'Lexend', system-ui, sans-serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;

  /* Shape & elevation */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06);
  --shadow: 0 4px 12px rgb(15 23 42 / 0.08);
  --shadow-lg: 0 12px 32px rgb(15 23 42 / 0.14);

  /* Layout */
  --container: 1240px;
  --header-height: 72px;

  /* Sticky offset for anything that pins below the header — the archive's
     filter sidebar and the cart/checkout summary cards.

     Not derivable from --header-height (72px): that is the main bar's
     min-height, while the header element is the utility strip + main bar +
     category nav together (~161px), and all three are Elementor controls the
     client can toggle. So assets/js/widget-site-header.js measures the
     rendered header and publishes --iclk-header-height — the real number while
     the header is pinned (position:sticky on the Elementor header-location
     wrapper), and 0 when it isn't (Sticky control off, or no JS — the right
     fallback either way, since an unpinned header scrolls off with the page). */
  --iclk-header-height: 0px;
  --iclk-sticky-top: calc(var(--iclk-header-height) + 24px);

  /* Motion */
  --transition: 200ms ease;
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-ink);
  line-height: 1.25;
  margin: 0 0 0.5em;
}

p {
  margin: 0 0 1em;
}

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

a:hover {
  color: var(--color-primary-dark);
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-brand) 55%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--color-primary-soft);
}

/* --------------------------------------------------------------------------
   Layout utilities used by the fallback header/footer templates
   -------------------------------------------------------------------------- */

/* Full-bleed bands (.iclk-page-hero--bleed) break out to the viewport edge with
   the `calc(50% - 50vw)` margin / `calc(50vw - 50%)` padding trick. `50vw`
   counts the vertical scrollbar's width but the container's `50%` does not, so
   on any inner page that has both a page hero *and* a scrollbar the band
   overshoots by ~the scrollbar width and raised a stray horizontal scrollbar —
   on every page except the home page (no scrollbar) and the product page (no
   hero). Clip the overshoot at the page wrapper. `overflow: clip` (not hidden)
   is not a scroll container, so the sticky header and sticky sidebars are
   unaffected; the cart drawer sits outside .site entirely. */
.site {
  overflow-x: clip;
}

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}

/* Cap the Elementor "Single Product" Theme Builder document (post 222) to the
   prototype's regular width. Its top-level e-flexbox containers render
   edge-to-edge — Elementor v4 containers have no Boxed/Full-Width control, and
   the .container page-template workaround (template-regular-width.php) can't be
   used here: setting a document page_template makes Elementor Pro's
   Locations_Manager skip its own single-location override entirely (it only
   overrides when the document's page_template is empty), so the Theme Builder
   product template would stop rendering at all. Capping the top-level
   containers in CSS instead leaves the location override intact and keeps every
   inner widget client-editable in Elementor.
   Scoped to DIRECT children so nested containers still fill their parent.

   Elementor's frontend.min.css already sets
   `:is(.elementor-section-wrap,[data-elementor-id]) > .e-con { max-width:
   min(100%, var(--width)) }` at specificity (0,2,0) — equal to a plain
   `.elementor-location-single > .e-con`, so this rule doubles up the wrapper's
   `.elementor` + `.elementor-location-single` classes to reach (0,3,0) and win.
   It also feeds `--width` (the var Elementor's own max-width reads) so the cap
   holds even if that rule is the one that resolves. */
.elementor.elementor-location-single > .e-con {
  /* min(100%, …) not a flat 1240px: a flat cap would force 1240px even on a
     375px viewport, overflowing (and getting clipped by .site's overflow-x:
     clip). This mirrors Elementor's own `max-width: min(100%, var(--width))`
     so the container shrinks below 1240px on narrow screens. */
  max-width: min(100%, var(--container));
  margin-inline: auto;
  padding-inline: 20px;
}

.visually-hidden {
  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 */
.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 1001;
  padding: 10px 16px;
  background: var(--color-ink);
  color: #fff;
  border-radius: var(--radius-sm);
  transition: top var(--transition);
}

.skip-link:focus {
  top: 12px;
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
