/* ═══════════════════════════════════════════════════════════════════════════
   KAGDI JEWELLERS — Base Design System  (v2 — Polished)
   Tokens · Reset · Typography · Layout · Utilities · Animations
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  /* ── Palette ── */
  --ivory:          #FAFAF7;
  --cream:          #F5F3EE;
  --paper:          #EDE9E1;
  --parchment:      #E4DED3;
  --charcoal:       #1A1A18;
  --charcoal-80:    rgba(26, 26, 24, 0.80);
  --charcoal-60:    rgba(26, 26, 24, 0.60);
  --charcoal-40:    rgba(26, 26, 24, 0.40);
  --charcoal-15:    rgba(26, 26, 24, 0.15);
  --charcoal-08:    rgba(26, 26, 24, 0.08);
  --gold:           #B8972A;
  --gold-light:     #D4AF5A;
  --gold-pale:      #F0E6CA;
  --silver-mid:     #8A9099;
  --white:          #FFFFFF;
  --green-avail:    #2D8B5A;
  --wa-green:       #25D366;
  --wa-dark:        #128C7E;
  --error:          #B83232;

  /* Legacy aliases (keep existing markup working) */
  --color-ivory:        var(--ivory);
  --color-cream:        var(--cream);
  --color-paper:        var(--paper);
  --color-charcoal:     var(--charcoal);
  --color-charcoal-60:  var(--charcoal-60);
  --color-charcoal-30:  var(--charcoal-40);
  --color-charcoal-10:  var(--charcoal-08);
  --color-gold:         var(--gold);
  --color-gold-light:   var(--gold-light);
  --color-gold-pale:    var(--gold-pale);
  --color-silver:       var(--silver-mid);
  --color-silver-light: #C8CDD5;
  --color-silver-pale:  #EEEFF1;
  --color-white:        var(--white);
  --color-error:        var(--error);

  /* ── Typography ── */
  --font-serif: 'Cormorant Garamond', 'Georgia', 'Times New Roman', serif;
  --font-sans:  'Jost', 'Inter', system-ui, -apple-system, sans-serif;

  /* Type scale */
  --text-2xs:  0.625rem;    /* 10px */
  --text-xs:   0.6875rem;   /* 11px */
  --text-sm:   0.875rem;    /* 14px */
  --text-base: 1rem;        /* 16px */
  --text-md:   1.125rem;    /* 18px */
  --text-lg:   1.375rem;    /* 22px */
  --text-xl:   1.75rem;     /* 28px */
  --text-2xl:  2.25rem;     /* 36px */
  --text-3xl:  3rem;        /* 48px */
  --text-4xl:  4rem;        /* 64px */
  --text-5xl:  5.5rem;      /* 88px */

  /* ── Spacing (8-pt system) ── */
  --sp-1:   0.25rem;   /*  4px */
  --sp-2:   0.5rem;    /*  8px */
  --sp-3:   0.75rem;   /* 12px */
  --sp-4:   1rem;      /* 16px */
  --sp-5:   1.25rem;   /* 20px */
  --sp-6:   1.5rem;    /* 24px */
  --sp-8:   2rem;      /* 32px */
  --sp-10:  2.5rem;    /* 40px */
  --sp-12:  3rem;      /* 48px */
  --sp-16:  4rem;      /* 64px */
  --sp-20:  5rem;      /* 80px */
  --sp-24:  6rem;      /* 96px */
  --sp-32:  8rem;      /* 128px */
  --sp-40:  10rem;     /* 160px */
  --sp-48:  12rem;     /* 192px */

  /* Legacy space aliases */
  --space-1:  var(--sp-1);
  --space-2:  var(--sp-2);
  --space-3:  var(--sp-3);
  --space-4:  var(--sp-4);
  --space-5:  var(--sp-5);
  --space-6:  var(--sp-6);
  --space-8:  var(--sp-8);
  --space-10: var(--sp-10);
  --space-12: var(--sp-12);
  --space-16: var(--sp-16);
  --space-20: var(--sp-20);
  --space-24: var(--sp-24);
  --space-32: var(--sp-32);
  --space-40: var(--sp-40);

  /* ── Section rhythm ── */
  --section-y:       clamp(5rem, 9vw, 8rem);   /* 80 → 128px */
  --section-y-sm:    clamp(3rem, 5vw, 5rem);   /* 48 → 80px */
  --section-y-lg:    clamp(6rem, 11vw, 11rem);  /* 96 → 176px */

  /* ── Layout ── */
  --max-w:      1280px;
  --max-w-text: 680px;
  --gutter:     clamp(1.25rem, 4vw, 3rem);

  /* ── Borders ── */
  --border-thin:   1px solid var(--charcoal-08);
  --border-mid:    1px solid var(--charcoal-15);
  --border-gold:   1px solid var(--gold-light);

  /* ── Radius ── */
  --r-sm: 2px;
  --r:    4px;

  /* ── Transitions ── */
  --ease-out:   cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast:   150ms var(--ease-out);
  --t-base:   280ms var(--ease-out);
  --t-slow:   500ms var(--ease-out);
  --t-reveal: 720ms var(--ease-spring);

  /* ── Shadows ── */
  --shadow-xs: 0 1px 3px rgba(26,26,24,0.07);
  --shadow-sm: 0 2px 8px rgba(26,26,24,0.08);
  --shadow-md: 0 6px 24px rgba(26,26,24,0.12);
  --shadow-lg: 0 16px 56px rgba(26,26,24,0.15);
  --shadow-xl: 0 28px 88px rgba(26,26,24,0.20);

  /* Legacy shadow aliases */
  --shadow-sm: var(--shadow-sm);

  /* ── Nav ── */
  --nav-h: 76px;
  --nav-height: var(--nav-h); /* legacy alias */
}

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--charcoal);
  background-color: var(--ivory);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
img { object-fit: cover; object-position: center; }
input, button, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── Typography ─────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--charcoal);
}

h1 { font-size: clamp(2.6rem, 5.5vw, 5rem); }
h2 { font-size: clamp(1.9rem, 3.5vw, 3rem); }
h3 { font-size: clamp(1.3rem, 2vw, 1.875rem); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

p {
  line-height: 1.8;
  color: var(--charcoal-60);
  max-width: 65ch;
}

strong { font-weight: 600; color: var(--charcoal); }

/* ── Layout Utilities ───────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow  { max-width: 880px; }
.container--text    { max-width: var(--max-w-text); }

/* Section spacing — premium breathing room */
.section    { padding-block: var(--section-y); }
.section--sm { padding-block: var(--section-y-sm); }
.section--lg { padding-block: var(--section-y-lg); }

/* ── Section Heading component ──────────────────────────────────────────── */
.section-heading {
  margin-bottom: clamp(var(--sp-10), 4vw, var(--sp-20));
}

.section-heading--center {
  text-align: center;
}

.section-heading--center p,
.section-heading--center .divider {
  margin-inline: auto;
}

/* internal rhythm */
.section-heading .label   { display: block; margin-bottom: var(--sp-4); }
.section-heading h2       { margin-top: 0; margin-bottom: var(--sp-5); }
.section-heading .divider { margin-block: var(--sp-6); }
.section-heading p        { margin-top: 0; max-width: 580px; }

/* ── Divider ────────────────────────────────────────────────────────────── */
.divider {
  width: 52px;
  height: 1px;
  background: var(--gold);
  display: block;
}

.divider--center { margin-inline: auto; }

/* ── Label / Eyebrow ────────────────────────────────────────────────────── */
.label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ── Overlay ────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,24,0.55);
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.overlay.active { opacity: 1; pointer-events: all; }

/* ── Scroll Reveal ──────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--t-reveal), transform var(--t-reveal);
  will-change: opacity, transform;
}

.reveal.visible { opacity: 1; transform: none; }

.reveal--left  { transform: translateX(-36px); }
.reveal--right { transform: translateX(36px); }
.reveal--left.visible,
.reveal--right.visible { transform: none; }
.reveal--scale  { transform: scale(0.95) translateY(16px); }
.reveal--scale.visible { transform: none; }

/* Stagger delays */
.reveal--d1 { transition-delay:  80ms; }
.reveal--d2 { transition-delay: 160ms; }
.reveal--d3 { transition-delay: 240ms; }
.reveal--d4 { transition-delay: 320ms; }
.reveal--d5 { transition-delay: 400ms; }

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

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

/* ── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--sp-8);
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--charcoal);
  color: var(--cream);
  padding: var(--sp-4) var(--sp-8);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity var(--t-base), transform var(--t-base);
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
