/* =============================================================
   ShoppingPH — Design System
   Variables · Reset · Typography · Base Utilities
   ============================================================= */

/* ── Google Fonts are enqueued via functions.php ──────────────
   Sora       → headings, brand text, CTAs
   Lexend     → body copy, UI labels, readable content
   ─────────────────────────────────────────────────────────── */

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  /* Brand */
  --sph-red:          #EE4D2D;
  --sph-red-dark:     #D73F24;
  --sph-red-deeper:   #B83320;
  --sph-red-light:    #FFF0ED;
  --sph-red-mist:     #FFF6F4;
  --sph-orange:       #FF7337;
  --sph-gold:         #FFBA00;
  --sph-gold-dark:    #E5A800;

  /* Neutrals */
  --sph-white:        #FFFFFF;
  --sph-gray-50:      #FAFAFA;
  --sph-gray-100:     #F5F5F5;
  --sph-gray-200:     #EEEEEE;
  --sph-gray-300:     #E0E0E0;
  --sph-gray-400:     #BDBDBD;
  --sph-gray-500:     #9E9E9E;
  --sph-gray-600:     #757575;
  --sph-gray-700:     #616161;
  --sph-gray-800:     #424242;
  --sph-gray-900:     #212121;

  /* Semantic */
  --sph-success:      #26A541;
  --sph-warning:      #FF9500;
  --sph-info:         #0085FF;
  --sph-danger:       #EE4D2D;

  /* Surfaces */
  --surface-base:     var(--sph-gray-100);
  --surface-card:     var(--sph-white);
  --surface-header:   var(--sph-white);
  --surface-footer:   #1A1A1A;

  /* Typography */
  --font-display:     'Sora', system-ui, sans-serif;
  --font-body:        'Lexend', system-ui, sans-serif;

  --text-xs:          0.6875rem;  /* 11px */
  --text-sm:          0.8125rem;  /* 13px */
  --text-base:        0.9375rem;  /* 15px */
  --text-md:          1rem;       /* 16px */
  --text-lg:          1.125rem;   /* 18px */
  --text-xl:          1.25rem;    /* 20px */
  --text-2xl:         1.5rem;     /* 24px */
  --text-3xl:         1.875rem;   /* 30px */
  --text-4xl:         2.25rem;    /* 36px */

  --weight-light:     300;
  --weight-normal:    400;
  --weight-medium:    500;
  --weight-semibold:  600;
  --weight-bold:      700;
  --weight-extrabold: 800;

  --leading-tight:    1.2;
  --leading-snug:     1.375;
  --leading-normal:   1.5;
  --leading-relaxed:  1.65;
  --leading-loose:    1.8;

  --tracking-tight:   -0.025em;
  --tracking-normal:  0em;
  --tracking-wide:    0.05em;
  --tracking-wider:   0.1em;

  /* Spacing scale (4px base) */
  --space-0:    0;
  --space-1:    0.25rem;   /* 4px */
  --space-2:    0.5rem;    /* 8px */
  --space-3:    0.75rem;   /* 12px */
  --space-4:    1rem;      /* 16px */
  --space-5:    1.25rem;   /* 20px */
  --space-6:    1.5rem;    /* 24px */
  --space-8:    2rem;      /* 32px */
  --space-10:   2.5rem;    /* 40px */
  --space-12:   3rem;      /* 48px */
  --space-16:   4rem;      /* 64px */
  --space-20:   5rem;      /* 80px */

  /* Borders */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-2xl: 24px;
  --radius-pill: 999px;

  --border-color:        var(--sph-gray-200);
  --border-color-focus:  var(--sph-red);

  /* Shadows */
  --shadow-xs:   0 1px 2px rgba(0,0,0,.06);
  --shadow-sm:   0 1px 4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:   0 8px 24px rgba(0,0,0,.1), 0 4px 8px rgba(0,0,0,.04);
  --shadow-xl:   0 16px 48px rgba(0,0,0,.12);
  --shadow-card: 0 2px 8px rgba(0,0,0,.08);
  --shadow-card-hover: 0 6px 20px rgba(0,0,0,.12);
  --shadow-header: 0 2px 8px rgba(0,0,0,.07);

  /* Transitions */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:     cubic-bezier(0, 0, 0.2, 1);
  --ease-in:      cubic-bezier(0.4, 0, 1, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);

  --duration-fast:   120ms;
  --duration-base:   200ms;
  --duration-slow:   350ms;

  /* Layout */
  --container-xs:  480px;
  --container-sm:  640px;
  --container-md:  768px;
  --container-lg:  1024px;
  --container-xl:  1280px;
  --container-2xl: 1440px;

  --header-height: 60px;
  --topbar-height: 36px;
  --catbar-height: 48px;
  --total-header:  calc(var(--header-height) + var(--catbar-height));

  /* Z-index scale */
  --z-base:    0;
  --z-raised:  1;
  --z-dropdown: 100;
  --z-sticky:  200;
  --z-header:  300;
  --z-overlay: 400;
  --z-modal:   500;
  --z-toast:   600;
}


/* ── RESET ───────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--sph-gray-900);
  background-color: var(--surface-base);
  min-height: 100vh;
  /* Prevent any element (carousel, wide table, etc.) from pushing
     page width beyond the viewport and triggering horizontal scroll */
  overflow-x: hidden;
}

img, svg, video {
  display: block;
  max-width: 100%;
}

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

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font: inherit;
  border: 0;
  background: none;
}

button {
  cursor: pointer;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--sph-gray-900);
}

p {
  line-height: var(--leading-relaxed);
}

strong, b {
  font-weight: var(--weight-semibold);
}


/* ── TYPOGRAPHY SCALE ────────────────────────────────────────── */
.text-xs    { font-size: var(--text-xs); }
.text-sm    { font-size: var(--text-sm); }
.text-base  { font-size: var(--text-base); }
.text-md    { font-size: var(--text-md); }
.text-lg    { font-size: var(--text-lg); }
.text-xl    { font-size: var(--text-xl); }
.text-2xl   { font-size: var(--text-2xl); }
.text-3xl   { font-size: var(--text-3xl); }
.text-4xl   { font-size: var(--text-4xl); }

.font-display { font-family: var(--font-display); }
.font-body    { font-family: var(--font-body); }

.font-light     { font-weight: var(--weight-light); }
.font-normal    { font-weight: var(--weight-normal); }
.font-medium    { font-weight: var(--weight-medium); }
.font-semibold  { font-weight: var(--weight-semibold); }
.font-bold      { font-weight: var(--weight-bold); }
.font-extrabold { font-weight: var(--weight-extrabold); }

.text-primary   { color: var(--sph-red); }
.text-muted     { color: var(--sph-gray-500); }
.text-secondary { color: var(--sph-gray-600); }
.text-dark      { color: var(--sph-gray-900); }
.text-white     { color: var(--sph-white); }

.tracking-wide  { letter-spacing: var(--tracking-wide); }
.tracking-wider { letter-spacing: var(--tracking-wider); }
.uppercase      { text-transform: uppercase; }

/* Post content typography */
.entry-content {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-loose);
  color: var(--sph-gray-800);
}

.entry-content h2 {
  font-size: var(--text-2xl);
  margin: var(--space-8) 0 var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--sph-red-light);
}

.entry-content h3 {
  font-size: var(--text-xl);
  margin: var(--space-6) 0 var(--space-3);
}

.entry-content p {
  margin-bottom: var(--space-5);
}

.entry-content ul, .entry-content ol {
  list-style: revert;
  padding-left: var(--space-6);
  margin-bottom: var(--space-5);
}

.entry-content a {
  color: var(--sph-red);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
}

.entry-content table th,
.entry-content table td {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--sph-gray-200);
  text-align: left;
}

.entry-content table th {
  background: var(--sph-red-light);
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  color: var(--sph-red-dark);
}

.entry-content table tr:nth-child(even) td {
  background: var(--sph-gray-50);
}


/* ── LAYOUT UTILITIES ────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

@media (min-width: 768px) {
  .container { padding-inline: var(--space-6); }
}

@media (min-width: 1280px) {
  .container { padding-inline: var(--space-8); }
}

.container--wide  { max-width: var(--container-2xl); }
.container--narrow { max-width: var(--container-md); }

/* Grid */
.grid { display: grid; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Product card grids */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

@media (min-width: 480px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
  }
}

@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (min-width: 1280px) {
  .product-grid { grid-template-columns: repeat(6, 1fr); }
}

/* 2-col layout with sidebar */
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 1024px) {
  .layout-with-sidebar {
    grid-template-columns: 1fr 280px;
  }
}

/* Spacers */
.mt-4   { margin-top: var(--space-4); }
.mt-6   { margin-top: var(--space-6); }
.mt-8   { margin-top: var(--space-8); }
.mb-4   { margin-bottom: var(--space-4); }
.mb-6   { margin-bottom: var(--space-6); }
.py-4   { padding-block: var(--space-4); }
.py-6   { padding-block: var(--space-6); }
.py-8   { padding-block: var(--space-8); }
.py-12  { padding-block: var(--space-12); }

/* Display helpers */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 768px) {
  .hide-desktop { display: none !important; }
}

/* Truncation */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}


/* ── SCROLLBAR STYLING ───────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--sph-gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--sph-gray-400);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--sph-red);
}


/* ── FOCUS STYLES ────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--sph-red);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}


/* ── SELECTION ───────────────────────────────────────────────── */
::selection {
  background: var(--sph-red-light);
  color: var(--sph-red-dark);
}


/* ── PAGE TRANSITION ─────────────────────────────────────────── */
.page-wrapper {
  opacity: 1;
  transition: opacity var(--duration-slow) var(--ease-out);
}

.page-wrapper.is-loading {
  opacity: 0;
}


/* ── SITE MAIN ───────────────────────────────────────────────── */
#sph-main {
  padding-top: var(--space-6);
  padding-bottom: var(--space-12);
  min-height: 60vh;
}
