/* ═══════════════════════════════════════════════════════════════
   ZAFIRA — BASE CSS
   Design tokens, reset, typography, animations, utilities
   Palette: Noir Editorial × Sahara Dusk hybrid
   Fonts: Cormorant Garamond (display) + Outfit (body)
═══════════════════════════════════════════════════════════════ */

/* ─── DESIGN TOKENS ─── */
:root {
  /* Colors */
  --clr-bg:          #0D0D0D;
  --clr-bg-2:        #141414;
  --clr-bg-3:        #1A1A1A;
  --clr-surface:     #1E1E1E;
  --clr-border:      rgba(255,255,255,0.08);
  --clr-border-2:    rgba(255,255,255,0.14);

  --clr-text:        #E8E4DF;
  --clr-text-2:      #A89F96;
  --clr-text-3:      #6B6460;

  --clr-accent:      #C9956B;
  --clr-accent-2:    #D4A574;
  --clr-accent-dark: #8B5E3C;

  --clr-gold:        #C9956B;
  --clr-cream:       #F5F0EB;
  --clr-white:       #FFFFFF;

  --clr-success:     #4CAF7D;
  --clr-warning:     #F5A623;
  --clr-error:       #E05252;
  --clr-info:        #5B9BD5;

  /* Typography */
  --font-display:    'Cormorant Garamond', Georgia, serif;
  --font-body:       'Outfit', system-ui, sans-serif;

  --text-xs:    0.75rem;    /* 12px */
  --text-sm:    0.875rem;   /* 14px */
  --text-base:  1rem;       /* 16px */
  --text-md:    1.125rem;   /* 18px */
  --text-lg:    1.25rem;    /* 20px */
  --text-xl:    1.5rem;     /* 24px */
  --text-2xl:   2rem;       /* 32px */
  --text-3xl:   2.5rem;     /* 40px */
  --text-4xl:   3.5rem;     /* 56px */
  --text-5xl:   5rem;       /* 80px */
  --text-6xl:   7rem;       /* 112px */

  --leading-tight:  1.1;
  --leading-snug:   1.3;
  --leading-normal: 1.6;
  --leading-loose:  1.8;

  --tracking-tight:  -0.03em;
  --tracking-normal: 0;
  --tracking-wide:   0.08em;
  --tracking-wider:  0.15em;
  --tracking-widest: 0.25em;

  /* 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;

  /* Layout */
  --max-w:        1440px;
  --max-w-narrow: 900px;
  --nav-h:        72px;
  --sidebar-w:    280px;

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

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.6);
  --shadow-xl:  0 24px 64px rgba(0,0,0,0.7);
  --shadow-glow: 0 0 40px rgba(201,149,107,0.15);

  /* Transitions */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:    150ms;
  --dur-base:    250ms;
  --dur-slow:    400ms;
  --dur-slower:  600ms;

  /* Z-index scale */
  --z-base:    1;
  --z-raised:  10;
  --z-overlay: 100;
  --z-drawer:  200;
  --z-modal:   300;
  --z-toast:   400;
  --z-cursor:  500;
  --z-loader:  600;
}

/* Light theme override */
.theme-light {
  --clr-bg:       #F5F0EB;
  --clr-bg-2:     #EDE8E3;
  --clr-bg-3:     #E5DFD9;
  --clr-surface:  #FFFFFF;
  --clr-border:   rgba(0,0,0,0.08);
  --clr-border-2: rgba(0,0,0,0.14);
  --clr-text:     #1A1A1A;
  --clr-text-2:   #5B5550;
  --clr-text-3:   #8B8480;
}

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: var(--leading-normal);
  color: var(--clr-text);
  background-color: var(--clr-bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: inherit;
}

ul, ol { list-style: none; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

/* ─── TYPOGRAPHY SCALE ─── */
.display-1 {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 8vw, var(--text-6xl));
  font-weight: 300;
  line-height: 1.0;
  letter-spacing: -0.04em;
}

.display-2 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, var(--text-5xl));
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.heading-1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, var(--text-4xl));
  font-weight: 400;
  line-height: 1.1;
}

.heading-2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, var(--text-3xl));
  font-weight: 400;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--clr-accent);
}

/* ─── LAYOUT UTILITIES ─── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--space-8);
}

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

.section-pad {
  padding: var(--space-24) 0;
}

@media (max-width: 768px) {
  .section-pad { padding: var(--space-16) 0; }
}

/* ─── CUSTOM CURSOR ─── */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
  transition: opacity var(--dur-base) var(--ease-out);
}

.cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--clr-accent);
  border-radius: 50%;
  transition: transform var(--dur-fast) var(--ease-out),
              background var(--dur-base) var(--ease-out);
}

.cursor-ring {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(201,149,107,0.5);
  border-radius: 50%;
  transition: transform 0.12s var(--ease-out),
              width var(--dur-base) var(--ease-spring),
              height var(--dur-base) var(--ease-spring),
              border-color var(--dur-base) var(--ease-out);
}

body.cursor-hover .cursor-ring {
  width: 56px;
  height: 56px;
  border-color: var(--clr-accent);
}

body.cursor-hover .cursor-dot {
  transform: translate(-50%, -50%) scale(0);
}

@media (hover: none) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* ─── LOADER ─── */
.loader {
  position: fixed;
  inset: 0;
  background: var(--clr-bg);
  z-index: var(--z-loader);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--dur-slow) var(--ease-out),
              visibility var(--dur-slow) var(--ease-out);
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
}

.loader__logo {
  width: 160px;
  animation: loaderPulse 1.5s ease-in-out infinite;
}

@keyframes loaderPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.loader__bar {
  width: 200px;
  height: 1px;
  background: var(--clr-border-2);
  overflow: hidden;
}

.loader__fill {
  height: 100%;
  background: var(--clr-accent);
  animation: loaderFill 1.8s var(--ease-out) forwards;
}

@keyframes loaderFill {
  from { width: 0; }
  to   { width: 100%; }
}

/* ─── SCROLL REVEAL ANIMATIONS ─── */
.reveal-up {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity var(--dur-slower) var(--ease-out),
              transform var(--dur-slower) var(--ease-out);
}

.reveal-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-up:nth-child(2) { transition-delay: 80ms; }
.reveal-up:nth-child(3) { transition-delay: 160ms; }
.reveal-up:nth-child(4) { transition-delay: 240ms; }

/* ─── SKELETON LOADING ─── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--clr-surface) 25%,
    var(--clr-bg-3) 50%,
    var(--clr-surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--clr-bg); }
::-webkit-scrollbar-thumb {
  background: var(--clr-border-2);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--clr-accent); }

/* ─── SELECTION ─── */
::selection {
  background: var(--clr-accent);
  color: var(--clr-bg);
}

/* ─── FOCUS VISIBLE ─── */
:focus-visible {
  outline: 2px solid var(--clr-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ─── GRAIN TEXTURE ─── */
.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: var(--z-overlay);
  opacity: 0.03;
  animation: grainShift 8s steps(10) infinite;
}

@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-5%, -10%); }
  20%  { transform: translate(-15%, 5%); }
  30%  { transform: translate(7%, -25%); }
  40%  { transform: translate(-5%, 25%); }
  50%  { transform: translate(-15%, 10%); }
  60%  { transform: translate(15%, 0%); }
  70%  { transform: translate(0%, 15%); }
  80%  { transform: translate(3%, 35%); }
  90%  { transform: translate(-10%, 10%); }
  100% { transform: translate(0, 0); }
}

/* ─── STAR RATING ─── */
.stars {
  display: flex;
  gap: 2px;
  align-items: center;
}

.star {
  font-size: var(--text-sm);
  color: var(--clr-text-3);
  line-height: 1;
}

.star.filled  { color: var(--clr-gold); }
.star.partial { color: var(--clr-gold); opacity: 0.5; }

/* ─── BADGE ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.05em;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.badge--new     { background: var(--clr-accent); color: var(--clr-bg); }
.badge--sale    { background: var(--clr-error); color: white; }
.badge--hot     { background: #FF6B2B; color: white; }
.badge--limited { background: var(--clr-surface); color: var(--clr-text); border: 1px solid var(--clr-border-2); }

/* ─── DIVIDER ─── */
.divider {
  width: 100%;
  height: 1px;
  background: var(--clr-border);
}

.divider--accent {
  width: 40px;
  height: 1px;
  background: var(--clr-accent);
}

/* ─── VISUALLY HIDDEN ─── */
.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;
}

/* ─── TICKER / MARQUEE ─── */
.ticker {
  overflow: hidden;
  background: var(--clr-accent);
  padding: var(--space-3) 0;
  white-space: nowrap;
}

.ticker__track {
  display: inline-flex;
  gap: var(--space-6);
  animation: tickerScroll 30s linear infinite;
}

.ticker__track span {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--clr-bg);
}

.ticker__dot {
  opacity: 0.5;
}

@keyframes tickerScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ─── TOAST ─── */
.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);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border-2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  min-width: 280px;
  max-width: 380px;
  animation: toastIn var(--dur-slow) var(--ease-spring) forwards;
}

.toast.removing {
  animation: toastOut var(--dur-base) var(--ease-in-out) forwards;
}

.toast__icon { font-size: var(--text-lg); flex-shrink: 0; }
.toast__text { font-size: var(--text-sm); flex: 1; }
.toast__close { opacity: 0.5; cursor: pointer; flex-shrink: 0; }
.toast__close:hover { opacity: 1; }

.toast--success { border-left: 3px solid var(--clr-success); }
.toast--error   { border-left: 3px solid var(--clr-error); }
.toast--warning { border-left: 3px solid var(--clr-warning); }
.toast--info    { border-left: 3px solid var(--clr-info); }

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

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

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

.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--clr-text-2);
  letter-spacing: 0.03em;
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--clr-bg-3);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  color: var(--clr-text);
  font-size: var(--text-base);
  transition: border-color var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
  outline: none;
}

.form-input:focus {
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px rgba(201,149,107,0.12);
}

.form-input::placeholder { color: var(--clr-text-3); }

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

.form-error {
  font-size: var(--text-xs);
  color: var(--clr-error);
}

/* ─── ACCORDION ─── */
.accordion__item {
  border-bottom: 1px solid var(--clr-border);
}

.accordion__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--clr-text);
  cursor: pointer;
  transition: color var(--dur-base);
}

.accordion__trigger::after {
  content: '+';
  font-size: var(--text-lg);
  font-weight: 300;
  transition: transform var(--dur-base) var(--ease-out);
}

.accordion__item.open .accordion__trigger::after {
  transform: rotate(45deg);
}

.accordion__content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--dur-slow) var(--ease-out),
              padding var(--dur-slow) var(--ease-out);
}

.accordion__item.open .accordion__content {
  max-height: 400px;
  padding-bottom: var(--space-4);
}

.accordion__content p {
  font-size: var(--text-sm);
  color: var(--clr-text-2);
  line-height: var(--leading-loose);
}

/* ─── MODAL OVERLAY ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) var(--ease-out),
              visibility var(--dur-base) var(--ease-out);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--clr-bg-2);
  border: 1px solid var(--clr-border-2);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(20px);
  transition: transform var(--dur-slow) var(--ease-spring);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--clr-text-2);
  transition: color var(--dur-base), background var(--dur-base);
}

.modal__close:hover {
  color: var(--clr-text);
  background: var(--clr-surface);
}

.modal__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  margin-bottom: var(--space-6);
}

/* ─── DRAWER OVERLAY ─── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: var(--z-drawer);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) var(--ease-out),
              visibility var(--dur-base) var(--ease-out);
}

.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ─── PAGE TRANSITIONS ─── */
.page {
  display: none;
  min-height: calc(100vh - var(--nav-h));
}

.page--active {
  display: block;
  animation: pageFadeIn var(--dur-slow) var(--ease-out);
}

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── RESPONSIVE HELPERS ─── */
@media (max-width: 1024px) {
  :root { --nav-h: 64px; }
}

@media (max-width: 768px) {
  :root {
    --nav-h: 60px;
    --text-5xl: 3.5rem;
    --text-6xl: 4.5rem;
  }
}