/* ==========================================================================
   Design tokens
   Brand colors come from design.md; surface/text tokens switch per theme
   (data-theme on <html>, set before first paint by the inline script).
   ========================================================================== */
:root {
  color-scheme: light;

  --color-gold: #D4AF37;
  --color-gold-hover: #B8952B;
  --color-whatsapp: #25D366;
  --color-whatsapp-hover: #1EBE5D;
  --color-on-accent: #1A1A1A;
  --color-cream: #F5F1E8;
  --text-light: #F5F1E8;

  --bg-primary: #FFFFFF;
  --bg-secondary: #FAF8F4;
  --bg-elevated: #FFFFFF;
  --bg-dark: #141414;
  --surface-glass: rgba(255, 255, 255, 0.9);
  --header-bg: rgba(255, 255, 255, 0.92);
  --border-subtle: rgba(26, 26, 26, 0.08);
  --border-gold: rgba(212, 175, 55, 0.25);
  --border-input: rgba(26, 26, 26, 0.14);
  --text-heading: #1A1A1A;
  --text-body: #555555;
  --text-muted: #6F6F6F;
  /* Darker gold for small text on light backgrounds (#D4AF37 on white is only ~2:1) */
  --color-gold-text: #8C6D1A;
  --color-error: #B42318;
  --glow-gold: rgba(212, 175, 55, 0.2);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.04);
  --shadow-raised: 0 20px 50px rgba(0, 0, 0, 0.12);

  --font-display: 'Cormorant Garamond', 'Cormorant', Georgia, 'Times New Roman', serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --radius-lg: 16px;
  --container-width: 1200px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --header-h: 80px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg-primary: #0E0D0B;
  --bg-secondary: #15130F;
  --bg-elevated: #1B1915;
  --bg-dark: #080706;
  --surface-glass: rgba(27, 25, 21, 0.82);
  --header-bg: rgba(14, 13, 11, 0.88);
  --border-subtle: rgba(245, 241, 232, 0.08);
  --border-gold: rgba(212, 175, 55, 0.22);
  --border-input: rgba(245, 241, 232, 0.16);
  --text-heading: #F5F1E8;
  --text-body: #B9B3A6;
  --text-muted: #8E887C;
  --color-gold-text: #D4AF37;
  --color-error: #F97066;
  --glow-gold: rgba(212, 175, 55, 0.14);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-raised: 0 20px 50px rgba(0, 0, 0, 0.5);
}

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

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

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-body);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  /* clip (not hidden) so position: sticky keeps working */
  overflow-x: clip;
}

img,
picture,
canvas {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text-heading);
}

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

.container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

[id] {
  scroll-margin-top: var(--header-h);
}

/* ==========================================================================
   Sections & headings
   ========================================================================== */
.section {
  padding-block: clamp(4.5rem, 9vw, 8rem);
}

.section--alt {
  background: var(--bg-secondary);
}

.section-head {
  max-width: 680px;
  margin: 0 auto clamp(2.5rem, 5vw, 4rem);
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--color-gold-text);
}

.eyebrow::before {
  content: "";
  width: 36px;
  height: 1px;
  background: var(--color-gold);
}

.section-title {
  font-size: clamp(2.4rem, 1.6rem + 3vw, 3.75rem);
  font-weight: 500;
  line-height: 1.05;
}

.accent {
  font-style: italic;
  color: var(--color-gold-text);
}

/* ==========================================================================
   Icons (SVG sprite in index.html)
   ========================================================================== */
.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-badge {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 20px;
  background: rgba(212, 175, 55, 0.14);
  color: var(--color-gold-text);
}

/* ==========================================================================
   Reveal on scroll (js/reveal.js adds .reveal-ready to <html>)
   ========================================================================== */
.reveal-up,
.reveal-left,
.reveal-scale {
  transition:
    opacity 0.8s var(--ease-out-expo),
    transform 0.8s var(--ease-out-expo);
  transition-delay: calc(var(--stagger, 0) * 0.12s);
}

.reveal-ready .reveal-up {
  opacity: 0;
  transform: translateY(40px);
}

.reveal-ready .reveal-left {
  opacity: 0;
  transform: translateX(-40px);
}

.reveal-ready .reveal-scale {
  opacity: 0;
  transform: scale(0.92);
}

.reveal-ready .revealed {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   Glass card
   ========================================================================== */
.glass {
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-gold);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
}

/* ==========================================================================
   Buttons (light sweep on hover)
   ========================================================================== */
.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.875rem 1.75rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: clamp(0.88rem, 0.84rem + 0.2vw, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  cursor: pointer;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.3s var(--ease-out-expo);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.7s var(--ease-out-expo);
}

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

/* Dark text keeps WCAG AA contrast on both green and gold (white on #25D366 is only ~2:1). */
.btn--whatsapp {
  background: var(--color-whatsapp);
  color: var(--color-on-accent);
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.24);
}

.btn--outline-gold {
  background: transparent;
  color: var(--text-heading);
  border-color: var(--color-gold);
}

/* For use on dark imagery (hero) */
.btn--ghost-light {
  background: rgba(245, 241, 232, 0.06);
  color: var(--color-cream);
  border-color: rgba(245, 241, 232, 0.4);
}

@media (hover: hover) {
  .btn:hover {
    transform: translateY(-2px);
  }

  .btn:hover::before {
    transform: translateX(100%);
  }

  .btn--whatsapp:hover {
    background: var(--color-whatsapp-hover);
    box-shadow: 0 12px 28px rgba(37, 211, 102, 0.32);
  }

  .btn--outline-gold:hover {
    background: var(--color-gold);
    border-color: var(--color-gold);
    color: var(--color-on-accent);
    box-shadow: 0 12px 28px var(--glow-gold);
  }

  .btn--ghost-light:hover {
    background: rgba(212, 175, 55, 0.14);
    border-color: var(--color-gold);
  }
}

/* ==========================================================================
   Floating WhatsApp button
   ========================================================================== */
.whatsapp-float {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 90;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--color-whatsapp);
  color: var(--color-on-accent);
  font-size: 28px;
  box-shadow:
    0 10px 30px rgba(37, 211, 102, 0.4),
    0 2px 10px rgba(0, 0, 0, 0.18);
  transition:
    transform 0.3s var(--ease-out-expo),
    box-shadow 0.3s ease,
    background-color 0.3s ease;
}

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

@media (hover: hover) {
  .whatsapp-float:hover {
    background: var(--color-whatsapp-hover);
    box-shadow:
      0 14px 34px rgba(37, 211, 102, 0.45),
      0 2px 10px rgba(0, 0, 0, 0.18);
    transform: translateY(-3px) scale(1.05);
  }
}

.whatsapp-float__ping {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  background: var(--color-whatsapp);
  opacity: 0.55;
  animation: whatsappPing 2.4s ease-out infinite;
}

@keyframes whatsappPing {
  0% {
    opacity: 0.45;
    transform: scale(1);
  }
  70% {
    opacity: 0;
    transform: scale(1.6);
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

@media (max-width: 480px) {
  .whatsapp-float {
    width: 52px;
    height: 52px;
    font-size: 25px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-float__ping {
    display: none;
  }
}

/* ==========================================================================
   Theme switch cross-fade (js/theme.js adds the class for ~400ms)
   ========================================================================== */
.theme-switching,
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
  transition:
    background-color 0.35s ease,
    border-color 0.35s ease,
    color 0.35s ease !important;
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
