/* ============================================
   TheCrochetSuman — Design System
   Premium Handmade Crochet Brand
   ============================================ */

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

/* ============================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================ */
:root {
  /* Colors */
  --color-bg-primary: #FAF7F2;
  --color-bg-secondary: #F2ECE4;
  --color-accent-primary: #8EA98E;
  --color-accent-secondary: #C67B5D;
  --color-heading: #4F3A2D;
  --color-body: #444444;
  --color-border: #E8DED3;
  --color-card: #FFFFFF;
  --color-white: #FFFFFF;
  --color-black: #1A1A1A;
  --color-muted: #888888;
  --color-success: #5A8A5A;
  --color-error: #C0514E;
  --color-warning: #D4943A;

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Poppins', system-ui, sans-serif;

  /* Font Sizes - Fluid Scale */
  --fs-xs: clamp(0.7rem, 1.5vw, 0.75rem);
  --fs-sm: clamp(0.8rem, 1.8vw, 0.875rem);
  --fs-base: clamp(0.9rem, 2vw, 1rem);
  --fs-md: clamp(1rem, 2.5vw, 1.125rem);
  --fs-lg: clamp(1.1rem, 3vw, 1.25rem);
  --fs-xl: clamp(1.3rem, 4vw, 1.5rem);
  --fs-2xl: clamp(1.6rem, 5vw, 2rem);
  --fs-3xl: clamp(2rem, 6vw, 2.75rem);
  --fs-4xl: clamp(2.4rem, 7vw, 3.5rem);
  --fs-5xl: clamp(2.8rem, 9vw, 5rem);
  --fs-hero: clamp(3rem, 10vw, 6.5rem);

  /* Font Weights */
  --fw-light: 300;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;
  --space-40: 10rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 3px rgba(79, 58, 45, 0.06);
  --shadow-sm: 0 4px 12px rgba(79, 58, 45, 0.08);
  --shadow-md: 0 8px 24px rgba(79, 58, 45, 0.10);
  --shadow-lg: 0 16px 48px rgba(79, 58, 45, 0.12);
  --shadow-xl: 0 24px 64px rgba(79, 58, 45, 0.15);
  --shadow-card: 0 2px 20px rgba(79, 58, 45, 0.07);
  --shadow-card-hover: 0 12px 40px rgba(79, 58, 45, 0.14);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 600ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index Scale */
  --z-below: -1;
  --z-base: 0;
  --z-raised: 10;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
  --z-cursor: 999;

  /* Layout */
  --container-max: 1320px;
  --container-wide: 1440px;
  --container-narrow: 900px;
  --navbar-height: 80px;
  --navbar-height-scrolled: 64px;
}

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

html {
  font-size: 16px;
  scroll-behavior: auto; /* Lenis handles this */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: 1.7;
  color: var(--color-body);
  background-color: var(--color-bg-primary);
  overflow-x: hidden;
}

body.menu-open,
body.modal-open {
  overflow: hidden;
}

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

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

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  color: var(--color-heading);
  letter-spacing: -0.01em;
}

p {
  line-height: 1.75;
}

/* ============================================
   LAYOUT UTILITIES
   ============================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: clamp(1rem, 5vw, 3rem);
}

.container--wide {
  max-width: var(--container-wide);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding-block: clamp(4rem, 8vw, 8rem);
}

.section--sm {
  padding-block: clamp(2rem, 5vw, 4rem);
}

.section--lg {
  padding-block: clamp(5rem, 10vw, 10rem);
}

.section-header {
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-accent-secondary);
  margin-bottom: var(--space-4);
}

.section-label::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--color-accent-secondary);
}

.section-title {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-semibold);
  color: var(--color-heading);
  margin-bottom: var(--space-4);
}

.section-subtitle {
  font-size: var(--fs-md);
  color: var(--color-muted);
  font-weight: var(--fw-regular);
  max-width: 560px;
  line-height: 1.8;
}

/* Grid */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.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; }

/* ============================================
   TYPOGRAPHY UTILITIES
   ============================================ */
.font-heading { font-family: var(--font-heading); }
.font-body { font-family: var(--font-body); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.italic { font-style: italic; }

.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-base { font-size: var(--fs-base); }
.text-lg { font-size: var(--fs-lg); }
.text-xl { font-size: var(--fs-xl); }
.text-2xl { font-size: var(--fs-2xl); }

.text-heading { color: var(--color-heading); }
.text-body { color: var(--color-body); }
.text-muted { color: var(--color-muted); }
.text-accent { color: var(--color-accent-primary); }
.text-accent-2 { color: var(--color-accent-secondary); }

.fw-light { font-weight: var(--fw-light); }
.fw-regular { font-weight: var(--fw-regular); }
.fw-medium { font-weight: var(--fw-medium); }
.fw-semibold { font-weight: var(--fw-semibold); }
.fw-bold { font-weight: var(--fw-bold); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 14px 32px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  white-space: nowrap;
  border: 2px solid transparent;
  text-decoration: none;
}

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

.btn:hover::after { opacity: 1; }

.btn-primary {
  background: var(--color-heading);
  color: var(--color-white);
  border-color: var(--color-heading);
}

.btn-primary:hover {
  background: var(--color-accent-secondary);
  border-color: var(--color-accent-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: transparent;
  color: var(--color-heading);
  border-color: var(--color-heading);
}

.btn-secondary:hover {
  background: var(--color-heading);
  color: var(--color-white);
  transform: translateY(-2px);
}

.btn-accent {
  background: var(--color-accent-secondary);
  color: var(--color-white);
  border-color: var(--color-accent-secondary);
}

.btn-accent:hover {
  background: #b56b4d;
  border-color: #b56b4d;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: transparent;
  color: var(--color-body);
  border-color: var(--color-border);
}

.btn-ghost:hover {
  border-color: var(--color-heading);
  color: var(--color-heading);
}

.btn-sm {
  padding: 10px 22px;
  font-size: var(--fs-xs);
}

.btn-lg {
  padding: 18px 44px;
  font-size: var(--fs-base);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-border);
  color: var(--color-body);
  transition: all var(--transition-base);
}

.btn-icon:hover {
  border-color: var(--color-heading);
  color: var(--color-heading);
  background: var(--color-bg-secondary);
}

/* Ripple effect */
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: scale(0);
  animation: ripple-anim 0.6s linear;
  pointer-events: none;
}

@keyframes ripple-anim {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-heading);
  letter-spacing: 0.02em;
}

.form-control {
  width: 100%;
  padding: 14px 18px;
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-body);
  font-size: var(--fs-base);
  transition: all var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 3px rgba(142, 169, 142, 0.15);
}

.form-control::placeholder {
  color: var(--color-muted);
  opacity: 0.7;
}

textarea.form-control {
  resize: vertical;
  min-height: 140px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 42px;
}

/* ============================================
   BADGE / TAGS
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
}

.badge-accent {
  background: rgba(142, 169, 142, 0.15);
  color: var(--color-accent-primary);
}

.badge-warm {
  background: rgba(198, 123, 93, 0.12);
  color: var(--color-accent-secondary);
}

.badge-new {
  background: var(--color-accent-primary);
  color: var(--color-white);
}

.badge-sale {
  background: var(--color-accent-secondary);
  color: var(--color-white);
}

/* ============================================
   BREADCRUMB
   ============================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--color-muted);
  margin-bottom: var(--space-8);
}

.breadcrumb a {
  color: var(--color-muted);
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--color-accent-secondary);
}

.breadcrumb-sep {
  color: var(--color-border);
}

/* ============================================
   DIVIDER
   ============================================ */
.divider {
  height: 1px;
  background: var(--color-border);
  border: none;
  margin-block: var(--space-8);
}

.divider-ornament {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-block: var(--space-12);
}

.divider-ornament::before,
.divider-ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.divider-ornament span {
  font-size: var(--fs-lg);
  color: var(--color-border);
}

/* ============================================
   ASPECT RATIOS
   ============================================ */
.aspect-square { aspect-ratio: 1 / 1; }
.aspect-portrait { aspect-ratio: 3 / 4; }
.aspect-landscape { aspect-ratio: 4 / 3; }
.aspect-wide { aspect-ratio: 16 / 9; }
.aspect-hero { aspect-ratio: 21 / 9; }

/* ============================================
   OVERFLOW HELPERS
   ============================================ */
.overflow-hidden { overflow: hidden; }

/* ============================================
   IMAGE STYLES
   ============================================ */
.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ============================================
   STAR RATING
   ============================================ */
.star-rating {
  display: flex;
  align-items: center;
  gap: 2px;
}

.star-rating .star {
  color: #D4943A;
  font-size: var(--fs-sm);
}

.star-rating .star-empty {
  color: var(--color-border);
  font-size: var(--fs-sm);
}

.rating-text {
  font-size: var(--fs-xs);
  color: var(--color-muted);
  margin-left: var(--space-2);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  background: var(--color-heading);
  color: var(--color-white);
  border-radius: var(--radius-lg);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  max-width: 320px;
}

.toast.toast-success { background: var(--color-success); }
.toast.toast-error { background: var(--color-error); }
.toast.toast-warning { background: var(--color-warning); }

.toast.hide {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg-primary); }
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-accent-primary); }

/* ============================================
   SELECTION
   ============================================ */
::selection {
  background: rgba(142, 169, 142, 0.3);
  color: var(--color-heading);
}

/* ============================================
   VISIBILITY UTILITIES
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   BACKGROUND UTILITIES
   ============================================ */
.bg-primary { background-color: var(--color-bg-primary); }
.bg-secondary { background-color: var(--color-bg-secondary); }
.bg-card { background-color: var(--color-card); }
.bg-heading { background-color: var(--color-heading); }
.bg-accent { background-color: var(--color-accent-primary); }

/* ============================================
   MARGIN / PADDING UTILITIES
   ============================================ */
.mt-auto { margin-top: auto; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 992px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .section-title { font-size: var(--fs-3xl); }
}

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

@media (max-width: 576px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section-title { font-size: var(--fs-2xl); }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .navbar, .footer, .cart-sidebar, .cursor { display: none !important; }
  body { background: white; color: black; }
}
