/*
 * Hand-authored fixes for bugs introduced by moving off WordPress/Divi.
 * Divi's real page appearance depended on: (a) per-post CSS cache files
 * (wp-content/et-cache/<id>/et-core-unified-*.css) that were never wired
 * into this static site, and (b) core theme JS that measured the header
 * on load and wrote inline pixel heights for the logo to size against.
 * Neither exists here, so a handful of things render broken without
 * these overrides. Loaded last (after generated-*.css) so it wins the
 * cascade without needing !important.
 */

* {
  box-sizing: border-box;
}
body {
  overflow-x: hidden;
}

/* --- Header logo ---
 * The logo's on-page size used to come from Divi's core JS measuring
 * #main-header and writing an inline pixel height for .logo_container,
 * which #logo then sized itself against as a percentage. With that JS
 * gone, the percentage heights resolve to nothing and the browser falls
 * back to the <img width="1000" height="222"> attributes, forcing the
 * whole header (and page) to ~1100px wide even on phones. Give it a
 * plain, fixed CSS size instead.
 */
.logo_container {
  height: auto;
  opacity: 1;
  display: block;
  padding: 16px 0 16px 30px;
}
#logo {
  height: 64px;
  width: auto;
  max-width: 100%;
  max-height: none;
}
@media (max-width: 767px) {
  .logo_container {
    padding: 14px 0 14px 16px;
  }
  #logo {
    height: 48px;
  }
}

/* --- Top nav ---
 * Divi positioned this nav with JS-computed offsets against the logo.
 * Lay it out with plain flexbox instead so it wraps cleanly at any width.
 */
#et-top-navigation {
  position: static;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 12px 24px;
}
#top-menu-nav {
  float: none;
}
#top-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  list-style: none;
}
/* .container held the logo and nav as two stacked block rows (the
 * height/offset JS this depended on is gone, see file header comment) —
 * lay them out side by side instead, wrapping to a second row only when
 * the viewport is too narrow for both. */
#main-header .container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}
#main-header {
  border-bottom: 1px solid #eee;
}

/* Divi's PHP-backed sitewide search and the JS-driven mobile hamburger
 * never had a backend or toggle script in this static rebuild — both are
 * inert, so hide rather than ship broken UI. */
#et_top_search,
#et_search_icon,
.et_search_outer,
#et_mobile_nav_menu {
  display: none !important;
}

/* --- Buttons ---
 * Divi's "dark layout" button preset (white text/border, transparent
 * background) is meant to sit on a colored section background that was
 * only ever supplied by the per-post CSS cache above — so these render
 * as invisible white-on-white. Give them real, on-brand styling.
 */
a.et_pb_button {
  display: inline-block;
  background-color: #ef5f00;
  border: 2px solid #ef5f00;
  color: #fff;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}
a.et_pb_button:hover {
  background-color: #111;
  border-color: #111;
  color: #fff;
}

/* --- .btn ---
 * Used by the newer, componentized parts of the site (AddToCartBar, the
 * cart/checkout form) — unlike .et_pb_button above, this class was never
 * actually defined anywhere, so "Add to cart" and "Pay with PayFast"
 * rendered as unstyled native buttons. Same brand color as .et_pb_button,
 * without Divi's fragile arrow-slide hover mechanics.
 */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: #ef5f00;
  border: 2px solid #ef5f00;
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}
.btn:hover {
  background-color: #111;
  border-color: #111;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  background-color: #ccc;
  border-color: #ccc;
  cursor: not-allowed;
  transform: none;
}
.btn:focus-visible {
  outline: 2px solid #ef5f00;
  outline-offset: 2px;
}

/* --- Storefront design tokens ---
 * Shared across the shopping surfaces (book/merch cards, buy boxes, cart)
 * so a color/radius/shadow tweak only has to happen in one place.
 */
:root {
  --rap-orange: #ef5f00;
  --rap-orange-dark: #c94e00;
  --rap-ink: #1f1f1f;
  --rap-muted: #6b6b6b;
  --rap-border: #e5e2dd;
  --rap-bg-subtle: #faf8f5;
  --rap-radius: 10px;
  --rap-radius-sm: 6px;
  --rap-shadow-sm: 0 2px 8px rgba(20, 15, 10, 0.06);
  --rap-shadow-md: 0 10px 28px rgba(20, 15, 10, 0.12);
}

/* --- Quantity stepper ---
 * Shared +/- input used by the book buy box, merch buy box, and cart line
 * items. Wired up client-side by RAPCart.wireQtyStepper() (public/js/cart.js)
 * so each page's own script doesn't have to duplicate the increment logic —
 * it only needs to react to the input's existing "change" event, same as
 * before this component existed.
 */
.qty-stepper {
  display: inline-flex;
  align-items: stretch;
  height: 40px;
  border: 1px solid #d9d5cf;
  border-radius: var(--rap-radius-sm);
  overflow: hidden;
  background: #fff;
}
.qty-stepper__btn {
  width: 34px;
  flex: 0 0 auto;
  border: none;
  background: #f4f2ef;
  color: var(--rap-ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.qty-stepper__btn:hover:not(:disabled) {
  background: #eae6e0;
}
.qty-stepper__btn:active:not(:disabled) {
  background: #ddd8d0;
}
.qty-stepper__btn:disabled {
  color: #c2beb7;
  cursor: not-allowed;
}
.qty-stepper__input {
  width: 44px;
  flex: 0 0 auto;
  border: none;
  border-left: 1px solid #e5e2dd;
  border-right: 1px solid #e5e2dd;
  text-align: center;
  font: inherit;
  font-weight: 600;
  color: var(--rap-ink);
  -moz-appearance: textfield;
}
.qty-stepper__input::-webkit-outer-spin-button,
.qty-stepper__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-stepper__input:focus-visible {
  outline: 2px solid var(--rap-orange);
  outline-offset: -2px;
}

/* --- Stock / status pills ---
 * Small labeled badges used wherever a product needs an at-a-glance status:
 * sale price, merch type, low/out-of-stock warnings.
 */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1.4;
}
/* `display: inline-flex` above ties with the UA [hidden] rule on
 * specificity, and author styles win ties — so a pill given the `hidden`
 * attribute (e.g. a stock-message badge that starts empty) needs this
 * restated explicitly, same as this file's other display:flex components. */
.pill[hidden] {
  display: none;
}
.pill--sale {
  background: var(--rap-orange);
  color: #fff;
}
.pill--type {
  background: #efece6;
  color: #555;
}
.pill--warn {
  background: #fdecea;
  color: #b3261e;
}
.pill--ok {
  background: #e8f5e9;
  color: #1e7d43;
}
