/*
 * BreakFit — Base Styles
 * ============================================================
 * Depends on: css/design-tokens.css (must be loaded first)
 *
 * Google Fonts are imported below via CDN.
 *
 * IMPORTANT — Remix Icons CDN:
 *   Add the following <link> tag to the <head> of every HTML
 *   page BEFORE this stylesheet:
 *
 *   <link href="https://cdn.jsdelivr.net/npm/remixicon@4.3.0/fonts/remixicon.css"
 *         rel="stylesheet" crossorigin="anonymous">
 * ============================================================
 */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap');

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

ul,
ol {
  list-style: none;
}

/* ── Global / Body ────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Replaced elements ────────────────────────────────────── */
img,
video,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Links ────────────────────────────────────────────────── */
a {
  color: inherit;
  text-decoration: none;
}

/* ── Form element resets ──────────────────────────────────── */
button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

button {
  cursor: pointer;
}

textarea {
  resize: vertical;
}

/* ── Horizontal rule ─────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0;
}

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.2;
  color: var(--color-text-primary);
  font-weight: 700;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

@media (max-width: 768px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }
}

@media (max-width: 480px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
}

p {
  color: var(--color-text-secondary);
  line-height: 1.7;
}

/* ──────────────────────────────────────────────────────────── *
 *  LAYOUT UTILITIES                                            *
 * ──────────────────────────────────────────────────────────── */

/* Container — max-width 1280 px, centred, padded */
.container {
  width: 100%;
  max-width: var(--container-max); /* 1280px */
  margin-inline: auto;
  padding-inline: var(--space-6);
}

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

/* Section spacing helpers */
.section    { padding-block: var(--space-20); }
.section-sm { padding-block: var(--space-12); }

.section-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.section-label {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-4);
  color: var(--color-text-primary);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  max-width: 560px;
  margin-inline: auto;
}

/* ── Screen-reader / Accessibility ───────────────────────── */
/*
 * .sr-only  — visually hides an element while keeping it
 *             accessible to screen readers.
 * .visually-hidden — alias for .sr-only
 */
.sr-only,
.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;
}

/* ── Flex helpers ─────────────────────────────────────────── */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col     { display: flex; flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-end  { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ── Grid helpers ─────────────────────────────────────────── */
.grid         { display: grid; }
.grid-2       { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
.grid-3       { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.grid-4       { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-6); }
.grid-auto    { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-6); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
  .grid-auto { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-4); }
}

@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
}

@media (max-width: 360px) {
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }
}

/* ── Generic spacing helpers ──────────────────────────────── */
.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-8  { margin-top: var(--space-8); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-8  { margin-bottom: var(--space-8); }

/* ── Text helpers ─────────────────────────────────────────── */
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.font-heading  { font-family: var(--font-heading); }
.text-primary  { color: var(--color-primary); }
.text-muted    { color: var(--color-text-muted); }
.text-sm       { font-size: var(--text-sm); }
.font-bold     { font-weight: 700; }
.font-medium   { font-weight: 500; }

/* ──────────────────────────────────────────────────────────── *
 *  SCROLL ANIMATION                                            *
 *  Intersection Observer adds .animate-in when element enters  *
 *  the viewport (see js/utils.js → initScrollAnimations()).    *
 * ──────────────────────────────────────────────────────────── */

/* Initial (hidden) state — uses the design-token transition */
[data-animate] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-base), transform var(--transition-base);
}

/* Final (visible) state */
[data-animate].animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Directional variants */
[data-animate="fade-left"]  { transform: translateX(-30px); }
[data-animate="fade-right"] { transform: translateX(30px); }
[data-animate="zoom-in"]    { transform: scale(0.9); }
[data-animate="pop-in"]     { transform: scale(0.8); }

[data-animate="fade-left"].animate-in,
[data-animate="fade-right"].animate-in { transform: translateX(0); opacity: 1; }

[data-animate="zoom-in"].animate-in { transform: scale(1); opacity: 1; }

[data-animate="pop-in"].animate-in {
  opacity: 1;
  transform: scale(1);
  transition:
    opacity 0.5s var(--transition-spring),
    transform 0.5s var(--transition-spring);
}

/* Stagger delays */
[data-delay="100"] { transition-delay: 100ms !important; }
[data-delay="150"] { transition-delay: 150ms !important; }
[data-delay="200"] { transition-delay: 200ms !important; }
[data-delay="250"] { transition-delay: 250ms !important; }
[data-delay="300"] { transition-delay: 300ms !important; }
[data-delay="350"] { transition-delay: 350ms !important; }
[data-delay="400"] { transition-delay: 400ms !important; }
[data-delay="500"] { transition-delay: 500ms !important; }

/* ──────────────────────────────────────────────────────────── *
 *  BUTTONS                                                      *
 *  Base class: .btn                                             *
 *  Variants: .btn--primary  .btn--secondary  .btn--outline     *
 *  Aliases (non-BEM): .btn-primary etc. kept for compatibility  *
 * ──────────────────────────────────────────────────────────── */

/* Base */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background var(--transition-fast);
}

.btn:hover::after   { background: rgba(255, 255, 255, 0.10); }
.btn:active         { transform: scale(0.97); }

/* Primary — brand dark green */
.btn--primary,
.btn-primary {
  background: linear-gradient(135deg, #1A5C33, #0D3D20);
  color: #fff;
  border-color: #1A5C33;
}

.btn--primary:hover,
.btn-primary:hover {
  background: linear-gradient(135deg, #0D3D20, #071f10);
  border-color: #0D3D20;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(26,92,51,0.3);
}

/* Secondary — golden amber */
.btn--secondary,
.btn-secondary {
  background: linear-gradient(135deg, #D4A853, #B8903A);
  color: #fff;
  border-color: #D4A853;
}

.btn--secondary:hover,
.btn-secondary:hover {
  background: linear-gradient(135deg, #B8903A, #9A7528);
  border-color: #B8903A;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(212,168,83,0.35);
}

/* Outline */
.btn--outline,
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn--outline:hover,
.btn-outline:hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-1px);
}

/* Outline on dark/image backgrounds */
.btn-outline-white {
  background: transparent;
  color: #fff;
  border-color: #fff;
}

.btn-outline-white:hover {
  background: #fff;
  color: var(--color-primary);
}

/* Ghost — minimal */
.btn-ghost {
  background: transparent;
  color: var(--color-text-primary);
  border-color: transparent;
  padding: 0.5rem 1rem;
}

.btn-ghost:hover { background: var(--color-bg-alt); }

/* Size modifiers */
.btn-sm { padding: 0.5rem 1.25rem; font-size: var(--text-xs); }
.btn-lg { padding: 1rem 2.5rem;   font-size: var(--text-base); }

/* Icon-only button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* ──────────────────────────────────────────────────────────── *
 *  FORM ELEMENTS                                               *
 * ──────────────────────────────────────────────────────────── */

/* Shared reset for text-like inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: var(--text-base);
  line-height: 1.5;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
  outline: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(139, 94, 60, 0.12);
}

/* Remove number spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
input[type="number"] { -moz-appearance: textfield; }

/* Select arrow */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B5C4E' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* Convenience wrapper classes */
.form-group  { margin-bottom: var(--space-5); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

/* .form-control applies design-token styling to any input/select/textarea */
.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: var(--text-base);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(139, 94, 60, 0.12);
}

.form-control.error,
.form-control[aria-invalid="true"] {
  border-color: var(--color-error);
}

.form-control.error:focus {
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.form-error {
  display: none;
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: var(--space-1);
}

.form-group.has-error .form-error { display: block; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ──────────────────────────────────────────────────────────── *
 *  MISC COMPONENTS                                             *
 * ──────────────────────────────────────────────────────────── */

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2em 0.65em;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-new        { background: var(--color-primary);   color: #fff; }
.badge-sale       { background: #E53E3E;                color: #fff; }
.badge-bestseller { background: var(--color-secondary); color: #fff; }
.badge-organic    { background: var(--color-accent);    color: #fff; }

/* Star ratings */
.star-rating {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.star-rating .star          { color: #E0E0E0; font-size: 14px; line-height: 1; }
.star-rating .star.full     { color: #F59E0B; }
.star-rating .star.half     { color: #F59E0B; }

.rating-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-left: var(--space-1);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--color-border);
  border: none;
  margin: var(--space-6) 0;
}

/* Overlay / modal backdrop */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Skeleton loading shimmer */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-border-light) 25%,
    var(--color-border) 50%,
    var(--color-border-light) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding: var(--space-4) 0;
}

.breadcrumb a            { color: var(--color-text-muted); transition: color var(--transition-fast); }
.breadcrumb a:hover      { color: var(--color-primary); }
.breadcrumb .sep         { color: var(--color-border); }
.breadcrumb .current     { color: var(--color-text-primary); font-weight: 500; }

/* Quantity selector */
.qty-selector {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--color-surface);
}

.qty-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--color-text-primary);
  transition: background var(--transition-fast);
}

.qty-btn:hover { background: var(--color-bg-alt); }

.qty-input {
  width: 48px;
  text-align: center;
  border: none;
  outline: none;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-primary);
  background: transparent;
  -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Price display */
.price-current  { font-size: var(--text-xl); font-weight: 700; color: var(--color-primary); }
.price-original { font-size: var(--text-sm); color: var(--color-text-muted); text-decoration: line-through; margin-left: var(--space-2); }
.price-discount { font-size: var(--text-sm); font-weight: 700; color: var(--color-success); margin-left: var(--space-2); }

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  gap: var(--space-1);
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  background: none;
  cursor: pointer;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
}

.tab-btn.active           { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-btn:hover:not(.active) { color: var(--color-text-primary); }

.tab-panel        { display: none; padding: var(--space-6) 0; }
.tab-panel.active { display: block; }

/* Page hero banner (non-home pages) */
.page-hero {
  background: linear-gradient(135deg, var(--color-bg-alt) 0%, var(--color-border-light) 100%);
  padding: var(--space-12) 0;
  border-bottom: 1px solid var(--color-border);
}

.page-hero h1 { font-size: var(--text-4xl); margin-bottom: var(--space-3); }
.page-hero p  { font-size: var(--text-lg); max-width: 560px; }

/* Empty state */
.empty-state      { text-align: center; padding: var(--space-20) var(--space-4); }
.empty-state-icon { font-size: 4rem; color: var(--color-border); margin-bottom: var(--space-6); }
.empty-state h3   { font-size: var(--text-2xl); margin-bottom: var(--space-3); }
.empty-state p    { margin-bottom: var(--space-8); }
