/*
Theme Name: Royals Emporium
Theme URI: https://example.com/royals-emporium
Author: Built for Royals Emporium
Description: A WhatsApp-ordering catalogue theme for clothing and footwear shops in Kenya. Products are filtered by gender and type, prices show in KSh, and every product has an "Order on WhatsApp" button that opens a chat with a pre-filled message. Includes stock counts, promotional discounts and a front-end form for adding, editing and removing products without touching the WordPress admin.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.6
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: royals-emporium
Tags: e-commerce, catalogue, whatsapp, responsive, custom-logo, custom-menu
*/

/* ==========================================================================
   1. Fonts (self-hosted — no external requests, faster on Kenyan mobile data)
   ========================================================================== */

@font-face {
  font-family: 'Fraunces';
  src: url('assets/fonts/fraunces-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('assets/fonts/fraunces-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Outfit';
  src: url('assets/fonts/outfit-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Outfit';
  src: url('assets/fonts/outfit-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Outfit';
  src: url('assets/fonts/outfit-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   2. Tokens
   ========================================================================== */

:root {
  --plum: #5C2748;
  --plum-deep: #3D1930;
  --plum-soft: #7C4165;
  --ink: #241522;
  --gold: #D9A441;
  --gold-deep: #A87A1E;
  --blush: #F7EAEF;
  --mist: #FCF8F9;
  --paper: #FFFFFF;
  --line: #EBDCE2;
  --muted: #7A6270;
  --wa: #25D366;
  --wa-deep: #128C7E;
  --sale: #C0392B;

  --sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;

  --wrap: 1180px;
  --gap: 1.25rem;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px -14px rgba(61, 25, 48, .38);
}

/* ==========================================================================
   3. Base
   ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--plum); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--plum-soft); }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 .5em;
  color: var(--plum-deep);
}

h1 { font-size: clamp(2rem, 5.5vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3.6vw, 2.15rem); }
h3 { font-size: clamp(1.15rem, 2.4vw, 1.45rem); }

p { margin: 0 0 1rem; max-width: 68ch; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 3px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.15rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--gold);
  color: var(--ink);
  padding: .7rem 1.1rem;
  z-index: 200;
  font-weight: 600;
}
.skip-link:focus { left: .5rem; top: .5rem; }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(1px,1px,1px,1px);
  white-space: nowrap;
}

/* ==========================================================================
   4. Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-family: var(--sans);
  font-size: .95rem;
  font-weight: 600;
  line-height: 1;
  padding: .82rem 1.25rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.btn--wa { background: var(--wa); color: #04331A; }
.btn--wa:hover, .btn--wa:focus { background: #1FBE5B; color: #04331A; }

.btn--plum { background: var(--plum); color: #fff; }
.btn--plum:hover, .btn--plum:focus { background: var(--plum-deep); color: #fff; }

.btn--ghost { background: transparent; color: var(--plum); border-color: var(--line); }
.btn--ghost:hover, .btn--ghost:focus { border-color: var(--plum); background: var(--blush); }

.btn--danger { background: transparent; color: var(--sale); border-color: #E8C4BF; }
.btn--danger:hover { background: #FBEDEB; }

.btn--block { width: 100%; }
.btn--sm { padding: .55rem .9rem; font-size: .85rem; }

.btn svg { width: 1.1em; height: 1.1em; flex: none; }

/* ==========================================================================
   5. Promo bar + header
   ========================================================================== */

.promobar {
  background: var(--gold);
  color: #2A1B05;
  font-size: .875rem;
  font-weight: 500;
  text-align: center;
  padding: .55rem 1rem;
}
.promobar a { color: #2A1B05; font-weight: 700; }

.masthead {
  background: var(--plum);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 60;
}

.masthead__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 72px;
  padding-block: .6rem;
}

.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; margin-right: auto; }
.brand img, .brand svg { height: 44px; width: auto; }
.brand__text { font-family: var(--display); font-weight: 700; font-size: 1.4rem; color: #fff; line-height: 1; }
.brand__sub { display: block; font-family: var(--sans); font-size: .62rem; letter-spacing: .28em; color: var(--gold); font-weight: 500; }

.nav { display: flex; align-items: center; gap: 1.35rem; }
.nav a { color: #F3E4EC; text-decoration: none; font-size: .95rem; font-weight: 500; }
.nav a:hover, .nav .current-menu-item > a { color: var(--gold); }

.masthead__actions { display: flex; align-items: center; gap: .6rem; }

.navtoggle {
  display: none;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.35);
  color: #fff;
  border-radius: 10px;
  padding: .5rem .7rem;
  cursor: pointer;
  font: inherit;
  font-size: .9rem;
}

@media (max-width: 860px) {
  .navtoggle { display: inline-flex; align-items: center; gap: .4rem; }
  .nav {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--plum-deep);
    padding: .5rem 1.15rem 1rem;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: .8rem 0; border-bottom: 1px solid rgba(255,255,255,.12); }
  .brand img, .brand svg { height: 38px; }
}

/* ==========================================================================
   6. Hero — the shop window
   ========================================================================== */

.hero {
  background: var(--blush);
  padding: clamp(2rem, 6vw, 3.75rem) 0 clamp(2.25rem, 6vw, 3.5rem);
  position: relative;
  overflow: hidden;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem);
}

.hero__kicker {
  font-size: .9rem;
  color: var(--plum-soft);
  font-weight: 500;
  margin-bottom: .6rem;
}

.hero h1 { margin-bottom: .55rem; }
.hero__lead { font-size: 1.08rem; color: #4A3542; max-width: 46ch; }

.hero__cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.4rem; }

.hero__window {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  align-items: end;
}
.hero__window figure { margin: 0; border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.hero__window img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.hero__window figure:nth-child(1) { transform: translateY(1.6rem); }
.hero__window figure:nth-child(3) { transform: translateY(.8rem); }

@media (max-width: 800px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__window { gap: .55rem; }
  .hero__window figure:nth-child(1),
  .hero__window figure:nth-child(3) { transform: none; }
}

/* ==========================================================================
   7. Filter bar
   ========================================================================== */

.filters {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding-block: .9rem;
  position: sticky;
  top: 72px;
  z-index: 50;
}
@media (max-width: 860px) { .filters { top: 64px; } }

.filters__row {
  display: flex;
  align-items: center;
  gap: .9rem;
  flex-wrap: wrap;
}

.chips {
  display: flex;
  gap: .45rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  flex: 1 1 auto;
  min-width: 0;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .95rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.chip:hover { border-color: var(--plum-soft); color: var(--plum); }
.chip.is-active { background: var(--plum); border-color: var(--plum); color: #fff; }
.chip.is-active .chip__count { color: rgba(255,255,255,.75); }
.chip__count { font-size: .78rem; color: var(--muted); }

.selectwrap { display: inline-flex; align-items: center; gap: .4rem; }
.selectwrap label { font-size: .85rem; color: var(--muted); }

select, input[type="text"], input[type="search"], input[type="number"], input[type="tel"], input[type="url"], textarea {
  font: inherit;
  font-size: .92rem;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: .55rem .75rem;
  max-width: 100%;
}
select:focus, input:focus, textarea:focus { border-color: var(--plum-soft); outline: none; box-shadow: 0 0 0 3px rgba(124,65,101,.14); }

.filters__reset { font-size: .85rem; color: var(--muted); }

/* ==========================================================================
   8. Product grid + card
   ========================================================================== */

.section { padding-block: clamp(2rem, 5vw, 3.25rem); }
.section--mist { background: var(--mist); }

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.section__head p { margin: 0; color: var(--muted); font-size: .95rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.card:hover, .card:focus-within { border-color: var(--plum-soft); box-shadow: var(--shadow); }

.card__media { position: relative; display: block; background: var(--blush); }
.card__media img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }

.card__flags { position: absolute; top: .6rem; left: .6rem; display: flex; flex-direction: column; gap: .35rem; align-items: flex-start; }

.flag {
  font-size: .72rem;
  font-weight: 700;
  padding: .28rem .55rem;
  border-radius: 6px;
  line-height: 1.25;
}
.flag--sale { background: var(--sale); color: #fff; }
.flag--new { background: var(--plum); color: #fff; }
.flag--out { background: #4B4B4B; color: #fff; }

.card__body { padding: .85rem .9rem 1rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }

.card__title {
  font-family: var(--sans);
  font-size: .98rem;
  font-weight: 500;
  line-height: 1.35;
  margin: 0;
  color: var(--ink);
}
.card__title a { color: inherit; text-decoration: none; }
.card__title a:hover { color: var(--plum); }

.card__meta { font-size: .8rem; color: var(--muted); margin: 0; }

.priceline { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; margin-top: auto; }

/* The swing tag — the one loud element on the page */
.tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: var(--gold);
  color: #2A1B05;
  font-weight: 700;
  font-size: .98rem;
  letter-spacing: -0.01em;
  padding: .34rem .7rem .34rem 1.35rem;
  clip-path: polygon(0.85rem 0, 100% 0, 100% 100%, 0.85rem 100%, 0 50%);
}
.tag::before {
  content: "";
  position: absolute;
  left: .66rem;
  top: 50%;
  transform: translateY(-50%);
  width: .32rem;
  height: .32rem;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
}
.tag--lg { font-size: 1.35rem; padding: .5rem 1rem .5rem 1.7rem; }
.tag--lg::before { left: .85rem; width: .4rem; height: .4rem; }

.was { font-size: .85rem; color: var(--muted); text-decoration: line-through; }
.save { font-size: .8rem; color: var(--sale); font-weight: 600; }

.stock { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: .35rem; }
.stock::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: var(--wa-deep); }
.stock--low { color: #B05A15; }
.stock--low::before { background: #E08A2B; }
.stock--out { color: #6B6B6B; }
.stock--out::before { background: #9A9A9A; }

.empty {
  text-align: center;
  padding: 3.5rem 1rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--mist);
}
.empty h3 { margin-bottom: .4rem; }
.empty p { margin-inline: auto; }

/* ==========================================================================
   9. Single product
   ========================================================================== */

.product {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
  padding-block: clamp(1.5rem, 4vw, 2.75rem);
}
@media (max-width: 860px) { .product { grid-template-columns: 1fr; } }

.gallery__main { border-radius: var(--radius); overflow: hidden; background: var(--blush); }
.gallery__main img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.gallery__thumbs { display: flex; gap: .5rem; margin-top: .55rem; flex-wrap: wrap; }
.gallery__thumbs button {
  padding: 0; border: 2px solid transparent; border-radius: var(--radius-sm);
  overflow: hidden; cursor: pointer; background: none; width: 72px;
}
.gallery__thumbs button[aria-current="true"] { border-color: var(--plum); }
.gallery__thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.product__panel { position: sticky; top: 100px; }
@media (max-width: 860px) { .product__panel { position: static; } }

.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .6rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--plum); text-decoration: underline; }

.product h1 { font-size: clamp(1.6rem, 3.6vw, 2.35rem); margin-bottom: .35rem; }

.termlist { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.termlist a {
  font-size: .8rem; padding: .25rem .65rem; border-radius: 999px;
  background: var(--blush); color: var(--plum); text-decoration: none;
}
.termlist a:hover { background: var(--plum); color: #fff; }

.product__price { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin: 1rem 0; }

.spec { width: 100%; border-collapse: collapse; margin: 1.25rem 0; font-size: .92rem; }
.spec th, .spec td { text-align: left; padding: .6rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec th { color: var(--muted); font-weight: 500; width: 38%; }

.orderbox {
  background: var(--blush);
  border-radius: var(--radius);
  padding: 1.15rem;
  margin-top: 1.25rem;
}
.orderbox p { font-size: .88rem; color: #4A3542; margin-bottom: .85rem; }

.stickybar { display: none; }
@media (max-width: 860px) {
  .stickybar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 70;
    background: var(--paper);
    border-top: 1px solid var(--line);
    padding: .65rem 1rem calc(.65rem + env(safe-area-inset-bottom));
    gap: .75rem;
    align-items: center;
    box-shadow: 0 -8px 24px -16px rgba(0,0,0,.4);
  }
  .stickybar .btn { flex: 1; }
  body.single-re_product { padding-bottom: 5rem; }
}

/* ==========================================================================
   10. Forms (front-end manage page)
   ========================================================================== */

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 3vw, 1.75rem);
  margin-bottom: 1.5rem;
}
.panel > h2 { margin-top: 0; }
.panel__hint { font-size: .88rem; color: var(--muted); margin-top: -.4rem; }

.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 680px) { .formgrid { grid-template-columns: 1fr; } }
.formgrid .col-span { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: .35rem; }
.field > label { font-size: .88rem; font-weight: 500; }
.field small { color: var(--muted); font-size: .8rem; }
.field input, .field select, .field textarea { width: 100%; }
.field textarea { min-height: 110px; resize: vertical; }

.checkline { display: flex; align-items: center; gap: .55rem; font-size: .92rem; }
.checkline input { width: 1.05rem; height: 1.05rem; accent-color: var(--plum); }

.notice {
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  font-size: .92rem;
  margin-bottom: 1.25rem;
  border-left: 4px solid;
}
.notice--ok { background: #ECF9F0; border-color: var(--wa-deep); color: #10502F; }
.notice--warn { background: #FDF3E7; border-color: #D8891F; color: #6B3E05; }
.notice--err { background: #FBEDEB; border-color: var(--sale); color: #7A211A; }

.stocktable { width: 100%; border-collapse: collapse; font-size: .92rem; }
.stocktable th, .stocktable td { padding: .7rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.stocktable th { font-size: .8rem; color: var(--muted); font-weight: 500; }
.stocktable img { width: 52px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); }
.stocktable .cell-actions { display: flex; gap: .4rem; justify-content: flex-end; }

@media (max-width: 720px) {
  .stocktable thead { display: none; }
  .stocktable tr { display: grid; grid-template-columns: 60px 1fr; gap: .25rem .75rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
  .stocktable td { border: 0; padding: 0; }
  .stocktable td:first-child { grid-row: span 4; }
  .stocktable .cell-actions { justify-content: flex-start; margin-top: .4rem; }
}

/* ==========================================================================
   11. Footer
   ========================================================================== */

.footer {
  background: var(--plum-deep);
  color: #E8D6E0;
  padding-block: 2.5rem 2rem;
  margin-top: 3rem;
}
.footer a { color: #F0E0E9; }
.footer__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1.75rem; }
.footer h3 { color: #fff; font-size: 1.05rem; font-family: var(--sans); font-weight: 600; margin-bottom: .6rem; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; font-size: .92rem; }
.footer__bottom { border-top: 1px solid rgba(255,255,255,.14); margin-top: 1.75rem; padding-top: 1.1rem; font-size: .85rem; color: #C9B2BF; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.wafloat {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 65;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--wa);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px -6px rgba(0,0,0,.35);
}
.wafloat svg { width: 28px; height: 28px; fill: #fff; }
body.single-re_product .wafloat { bottom: 5.25rem; }

/* ==========================================================================
   12. Editorial / page content
   ========================================================================== */

.entry { padding-block: clamp(1.75rem, 4vw, 2.75rem); }
.entry__content { max-width: 68ch; }
.entry__content h2 { margin-top: 2rem; }
.entry__content ul, .entry__content ol { padding-left: 1.2rem; }
.entry__content li { margin-bottom: .4rem; }

.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 2.25rem; flex-wrap: wrap; }
.pagination .page-numbers {
  min-width: 42px; padding: .5rem .75rem; text-align: center;
  border: 1.5px solid var(--line); border-radius: 10px;
  text-decoration: none; color: var(--ink); font-size: .92rem;
}
.pagination .page-numbers.current { background: var(--plum); border-color: var(--plum); color: #fff; }
.pagination .page-numbers:hover { border-color: var(--plum-soft); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
