/*
Theme Name: KSY Essentials
Theme URI: https://ksy-essentials.com
Author: KSY Essentials LLC
Description: Custom theme for KSY Essentials — wholesale product sourcing.
Version: 1.0.0
Text Domain: ksy-essentials
*/

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
img, picture, svg { max-width: 100%; display: block; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

/* ============ TOKENS ============ */
:root {
  --bg: #FFFFFF;
  --surface: #F4F4F2;
  --ink: #152A3D;
  --accent: #E2572B;
  --accent-ink: #FFFFFF;
  --navy: #0E1F2E;
  --line: #D8D8D5;
  --muted: #7A7E82;
  --danger: #B3402A;

  --font: 'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 48px;
  --space-xl: 80px;
  --space-2xl: 120px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 10px rgba(18, 22, 31, 0.06);
  --shadow-md: 0 10px 30px rgba(18, 22, 31, 0.10);

  --container: 1200px;
  --header-h: 122px;
}

/* ============ FONTS (self-hosted) ============ */
@font-face { font-family: 'Poppins'; src: url('../assets/fonts/poppins-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('../assets/fonts/poppins-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('../assets/fonts/poppins-600.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('../assets/fonts/poppins-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('../assets/fonts/poppins-800.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }

/* ============ BASE ============ */
body {
  font-family: var(--font);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font); font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: clamp(2.1rem, 1.6rem + 2vw, 3.4rem); }
h2 { font-size: clamp(1.7rem, 1.4rem + 1.3vw, 2.5rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }
p { color: var(--ink); max-width: 65ch; }
p.lede { font-size: 1.125rem; color: var(--muted); max-width: 55ch; }
.muted { color: var(--muted); }
.eyebrow { display: inline-block; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: var(--space-xs); }

/* ============ LAYOUT ============ */
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--space-md); }
.section { padding-block: var(--space-2xl); }
.section--sm { padding-block: var(--space-lg); }
.section--alt { background: var(--surface); }
.section__head { max-width: 640px; margin-bottom: var(--space-lg); }
.section__head.center { max-width: 640px; margin-inline: auto; text-align: center; }
.grid { display: grid; gap: var(--space-md); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-xl); align-items: center; }

/* ============ BUTTONS ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 28px; border-radius: var(--radius-pill); font-weight: 600; font-size: 0.95rem; white-space: nowrap; border: 1.5px solid transparent; transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, opacity 150ms ease; }
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: #23293a; transform: translateY(-1px); }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: #0c5b49; transform: translateY(-1px); }
.btn--outline { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn--outline:hover { background: var(--ink); color: #fff; }
.btn--outline-light { background: transparent; border-color: rgba(255,255,255,0.5); color: #fff; }
.btn--outline-light:hover { background: #fff; color: var(--ink); border-color: #fff; }
.btn--sm { padding: 10px 20px; font-size: 0.85rem; }
.btn--block { width: 100%; }

/* ============ HEADER / NAV ============ */
.site-header { position: sticky; top: 0; z-index: 100; background: #ffffff; border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 var(--line), 0 4px 16px rgba(21,42,61,0.04); }
.nav { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: var(--space-lg); }
.site-logo { height: 84px; width: auto; display: block; flex-shrink: 0; }
.site-footer .site-logo { height: 88px; }
.nav__brand { display: flex; align-items: center; flex-shrink: 0; }
.nav__menu { display: flex; align-items: center; gap: var(--space-sm); list-style: none; margin: 0; padding: 0; }
.nav__menu a { font-weight: 600; font-size: 0.96rem; color: var(--ink); position: relative; padding: 10px 0; transition: color 150ms ease; letter-spacing: 0.005em; }
.nav__menu a:hover { color: var(--accent); }
.nav__menu a::after { content: ''; position: absolute; left: 0; bottom: 6px; width: 0; height: 2px; background: var(--accent); transition: width 200ms ease; }
.nav__menu a:hover::after { width: 100%; }
.nav__menu li.current-menu-item > a { color: var(--ink); }
.nav__menu li.current-menu-item > a::after { width: 100%; }
.nav__actions { display: flex; align-items: center; gap: var(--space-md); }
.nav__toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; padding: 8px; }
.nav__toggle span { width: 24px; height: 2px; background: var(--ink); display: block; transition: transform 200ms ease, opacity 200ms ease; }
.nav__toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle.is-open span:nth-child(2) { opacity: 0; }
.nav__toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ FOOTER ============ */
.site-footer { background: var(--bg); color: var(--ink); padding-block: var(--space-xl) var(--space-lg); border-top: 1px solid var(--line); }
.site-footer a { color: var(--ink); }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: var(--space-lg); padding-bottom: var(--space-lg); border-bottom: 1px solid var(--line); }
.footer__desc { color: var(--muted); margin-top: var(--space-sm); max-width: 34ch; }
.footer__heading { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--space-sm); }
.footer__list { display: flex; flex-direction: column; gap: 10px; }
.footer__list a { color: var(--ink); font-size: 0.93rem; transition: color 150ms ease; }
.footer__list a:hover { color: var(--accent); }
.footer__bottom { display: flex; align-items: center; justify-content: space-between; padding-top: var(--space-md); font-size: 0.85rem; color: var(--muted); flex-wrap: wrap; gap: 10px; }

/* ============ HERO ============ */
.hero { padding-block: var(--space-xl) var(--space-2xl); overflow: hidden; }
.hero .split { grid-template-columns: 1.05fr 0.95fr; }
.hero__content h1 { margin-bottom: var(--space-sm); }
.hero__content p.lede { margin-bottom: var(--space-md); }
.hero__actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; margin-top: var(--space-md); }
.hero__visual { position: relative; aspect-ratio: 4/3.1; border-radius: var(--radius-lg); background: linear-gradient(155deg, var(--navy) 0%, var(--ink) 100%); overflow: hidden; }
.hero__visual-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 1px; padding: var(--space-md); }
.hero__visual:has(.hero__badge) .hero__visual-grid { bottom: 72px; }
.hero__visual-cell { border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius-sm); overflow: hidden; background: rgba(255,255,255,0.03); }
.hero__visual-cell img { width: 100%; height: 100%; object-fit: cover; opacity: 0.92; }
.hero__badge { position: absolute; inset: auto 0 0; min-height: 72px; display: flex; align-items: center; gap: 12px; background: var(--navy); border-top: 1px solid rgba(255,255,255,0.14); color: #fff; padding: 14px var(--space-md); font-size: 0.85rem; max-width: none; }
.hero__badge b { flex-shrink: 0; font-size: 1.6rem; line-height: 1; font-weight: 800; color: var(--accent); }

/* ============ CARDS ============ */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease; }
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: transparent; }

.category-card { display: flex; flex-direction: column; padding: 0; gap: 0; }
.category-card__img-wrap { position: relative; aspect-ratio: 4/3; overflow: hidden; }
.category-card__img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 450ms cubic-bezier(.2,.7,.3,1); }
.category-card:hover .category-card__img-wrap img { transform: scale(1.06); }
.category-card__icon { position: absolute; left: 16px; bottom: -22px; width: 52px; height: 52px; border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow-md); display: flex; align-items: center; justify-content: center; color: var(--accent); z-index: 2; }
.category-card__icon svg { width: 26px; height: 26px; }
.category-card__body { padding: var(--space-md); padding-top: calc(var(--space-md) + 14px); display: flex; flex-direction: column; gap: 8px; flex: 1; }
.category-card h3 { font-size: 1.05rem; }
.category-card p { font-size: 0.9rem; color: var(--muted); }
.category-card__link { margin-top: auto; font-size: 0.88rem; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 6px; transition: gap 150ms ease; }
.category-card:hover .category-card__link { gap: 10px; }

.feature-card { padding: var(--space-md); }
.feature-card__num { font-size: 0.8rem; font-weight: 700; color: var(--accent); letter-spacing: 0.06em; }
.feature-card h3 { margin-top: var(--space-xs); margin-bottom: 8px; }
.feature-card p { font-size: 0.92rem; color: var(--muted); }

.badge { display: inline-block; background: var(--surface); color: var(--accent); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 5px 12px; border-radius: var(--radius-pill); }

/* ============ PRODUCT CARD ============ */
ul.products { display: grid !important; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); list-style: none; padding: 0; margin: 0 !important; }
ul.products li.product { list-style: none; }
.product-card { display: flex; flex-direction: column; height: 100%; }
.product-card__img-wrap { aspect-ratio: 1/1; background: var(--surface); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.product-card__img-wrap img { width: 100%; height: 100%; object-fit: contain; transition: transform 350ms ease; }
.product-card:hover .product-card__img-wrap img { transform: scale(1.04); }
.product-card__body { padding: var(--space-sm); display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card__body .badge { align-self: flex-start; }
.product-card__body h3 { font-size: 1rem; font-weight: 700; }
.product-card__body h3 a { color: var(--ink); }
.product-card__body p { font-size: 0.87rem; color: var(--muted); margin-bottom: 4px; }
.product-card__body .btn { margin-top: auto; }

/* ============ PRODUCT SEARCH / FILTER BAR ============ */
.catalog-toolbar { display: flex; gap: var(--space-sm); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-lg); padding: var(--space-sm); background: var(--surface); border-radius: var(--radius-md); }
.catalog-toolbar__search { flex: 1; min-width: 220px; position: relative; }
.catalog-toolbar__search input { width: 100%; padding: 12px 16px 12px 40px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: #fff; }
.catalog-toolbar__search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.catalog-toolbar select { padding: 12px 16px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: #fff; }
.catalog-results-count { font-size: 0.88rem; color: var(--muted); margin-bottom: var(--space-sm); }

/* ============ PAGE HERO (secondary pages) ============ */
.page-hero { padding-block: var(--space-lg) var(--space-xl); background: var(--surface); border-bottom: 1px solid var(--line); }
.page-hero .breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: var(--space-sm); }
.page-hero .breadcrumb a { color: var(--muted); }
.page-hero .breadcrumb a:hover { color: var(--accent); }
.page-hero h1 { margin-bottom: 10px; }
.page-hero p.lede { margin: 0; }

/* ============ FORMS ============ */
.form-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-lg); }
.form__row { margin-bottom: var(--space-sm); }
.form__row--2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
.form__label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 6px; }
.form__label .req { color: var(--danger); }
.form__input, .form__textarea, .form__select { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; font-family: var(--font); font-size: 0.95rem; transition: border-color 150ms ease, box-shadow 150ms ease; }
.form__input:focus, .form__textarea:focus, .form__select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,107,87,0.12); }
.form__textarea { resize: vertical; min-height: 130px; }
.form__notice { padding: 14px 16px; border-radius: var(--radius-sm); font-size: 0.92rem; margin-bottom: var(--space-md); }
.form__notice--success { background: #E7F3EF; color: #0E6B57; border: 1px solid #BFE2D6; }
.form__notice--error { background: #FBEAE6; color: #B3402A; border: 1px solid #F0C9BF; }

/* ============ PRODUCT DETAIL ============ */
.product-detail { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: var(--space-xl); align-items: flex-start; }
.product-detail__gallery { position: sticky; top: calc(var(--header-h) + 24px); aspect-ratio: 1/1; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--bg); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.product-detail__gallery img { width: 100%; height: 100%; object-fit: contain; padding: var(--space-sm); }
.product-detail__info .badge { margin-bottom: var(--space-xs); }
.product-detail__info h1 { margin-bottom: 10px; }
.product-detail__sku { color: var(--muted); font-size: 0.85rem; margin-bottom: var(--space-sm); }
.product-detail__desc { margin-bottom: var(--space-md); }
.product-detail__cta { display: flex; gap: var(--space-sm); flex-wrap: wrap; margin: var(--space-md) 0; padding: var(--space-md); background: var(--surface); border-radius: var(--radius-md); align-items: center; justify-content: space-between; }
.product-detail__block { margin-top: var(--space-lg); padding-top: var(--space-lg); border-top: 1px solid var(--line); }
.product-detail__block h2 { font-size: 1.2rem; margin-bottom: var(--space-sm); }
.features-list { display: grid; gap: 10px; }
.features-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.95rem; }
.features-list li svg { flex-shrink: 0; width: 18px; height: 18px; color: var(--accent); margin-top: 2px; }
.specs-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.specs-table tr { border-bottom: 1px solid var(--line); }
.specs-table td { padding: 10px 0; }
.specs-table td:first-child { color: var(--muted); width: 40%; }
.specs-table td:last-child { font-weight: 600; }
.related-heading { margin-top: var(--space-2xl); margin-bottom: var(--space-md); }

/* ============ LEGAL PAGES ============ */
.legal-content { max-width: 780px; }
.legal-content h2 { margin-top: var(--space-lg); margin-bottom: var(--space-sm); font-size: 1.3rem; }
.legal-content p, .legal-content li { color: var(--muted); margin-bottom: var(--space-sm); }
.legal-content ul { padding-left: 1.2em; list-style: disc; }
.legal-content .updated { color: var(--muted); font-size: 0.88rem; margin-bottom: var(--space-lg); }

/* ============ PAGINATION ============ */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: var(--space-lg); }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--line); font-size: 0.9rem; font-weight: 600; }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination a:hover { border-color: var(--accent); color: var(--accent); }

/* ============ MISC ============ */
.empty-state { text-align: center; padding: var(--space-2xl) var(--space-md); color: var(--muted); }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 500ms ease, transform 500ms ease; }
html.js .reveal.is-visible, html:not(.js) .reveal { opacity: 1; transform: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  :root { --space-2xl: 90px; --space-xl: 60px; }
  .grid--4 { grid-template-columns: repeat(3, 1fr); }
  ul.products { grid-template-columns: repeat(3, 1fr); }
  .footer__grid { grid-template-columns: 1.2fr 1fr 1fr; }
  .footer__grid .footer__col--suppliers { display: none; }
}
@media (max-width: 860px) {
  :root { --header-h: 88px; }
  .site-logo { height: 56px; }
  .nav__menu, .nav__actions .btn--accent, .nav__actions .btn--outline { display: none; }
  .nav__toggle { display: flex; }
  .nav.is-open .nav__menu { display: flex; position: fixed; inset: 68px 0 0 0; background: #fff; flex-direction: column; align-items: flex-start; padding: var(--space-md); gap: var(--space-sm); overflow-y: auto; z-index: 90; }
  .nav.is-open .nav__menu a { font-size: 1.1rem; }
  .hero .split, .split { grid-template-columns: 1fr; }
  .hero__visual { order: -1; aspect-ratio: 16/10; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
  ul.products { grid-template-columns: repeat(2, 1fr); }
  .footer__grid { grid-template-columns: 1fr 1fr; gap: var(--space-md); }
  .product-detail { grid-template-columns: 1fr; gap: var(--space-lg); }
  .product-detail__gallery { position: static; }
  .form__row--2col { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  ul.products { grid-template-columns: repeat(2, 1fr); gap: var(--space-xs); }
  .section { padding-block: var(--space-xl); }
  .footer__grid { grid-template-columns: 1fr; }
  .footer__bottom { flex-direction: column; align-items: flex-start; }
  .product-detail__cta { flex-direction: column; align-items: stretch; }
  .hero__badge { min-height: 64px; padding-inline: var(--space-sm); }
}

/* ============ NAV DROPDOWN (Categories) ============ */
.nav__menu li.menu-item-has-children { position: relative; }
.nav__menu li.menu-item-has-children > a { display: inline-flex; align-items: center; gap: 5px; }
.nav__menu li.menu-item-has-children > a::before { content: ''; order: 2; display: inline-block; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translate(-1px, -1px); }
.nav__menu .sub-menu { list-style: none; margin: 0; padding: 0; }
@media (min-width: 861px) {
  .nav__menu .sub-menu { position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-md); min-width: 220px; padding: 8px; opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity 160ms ease, transform 160ms ease, visibility 160ms; }
  .nav__menu li.menu-item-has-children:hover .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav__menu .sub-menu a { display: block; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 0.9rem; }
  .nav__menu .sub-menu a:hover { background: var(--surface); color: var(--accent); }
  .nav__menu .sub-menu a::after { display: none; }
}
@media (max-width: 860px) {
  .nav__menu .sub-menu { padding-left: var(--space-sm); border-left: 2px solid var(--line); margin: 8px 0 8px 4px; display: flex; flex-direction: column; gap: 10px; }
}

/* Mobile hero refinement */
@media (max-width: 860px) {
  .hero { padding-block: 40px 72px; }
  .hero .split { gap: 36px; }
  .hero__visual {
    order: initial;
    aspect-ratio: 6 / 5;
    border-radius: 22px;
    box-shadow: var(--shadow-sm);
  }
  .hero__visual-grid {
    gap: 4px;
    padding: 18px;
  }
  .hero__visual:has(.hero__badge) .hero__visual-grid { bottom: 84px; }
  .hero__visual-cell {
    background: #fff;
    border-color: rgba(255,255,255,0.28);
  }
  .hero__visual-cell img {
    object-fit: contain;
    padding: 4px;
    opacity: 1;
  }
  .hero__badge {
    min-height: 84px;
    padding: 16px 22px;
    font-size: 0.95rem;
    line-height: 1.45;
  }
}

@media (max-width: 560px) {
  .hero { padding-block: 32px 56px; }
  .hero .split { gap: 28px; }
  .hero__visual {
    aspect-ratio: 1 / 1;
    border-radius: 20px;
  }
  .hero__visual-grid {
    gap: 3px;
    padding: 14px;
  }
  .hero__visual:has(.hero__badge) .hero__visual-grid { bottom: 88px; }
  .hero__badge {
    min-height: 88px;
    padding: 15px 20px;
    gap: 14px;
    font-size: 0.94rem;
  }
  .hero__badge b { font-size: 1.9rem; }
}
