/* =========================================================
   Candle Ltd — custom styles (Tailwind companion)
   Warm cream / espresso / gold Lemani-inspired theme
   ========================================================= */

:root {
  --cream: #f7f1e8;
  --sand: #efe4d3;
  --clay: #b98a5e;
  --bronze: #8a6a3b;
  --espresso: #3a2c20;
  --cocoa: #5c4632;
  --gold: #c9a227;
  --ember: #c2693a;
}

html { scroll-behavior: smooth; }
body { font-family: 'Jost', ui-sans-serif, system-ui, sans-serif; }
h1, h2, h3, .font-serif { font-family: 'Cormorant Garamond', Georgia, serif; }

/* logical font weights (Tailwind's font-700 etc. are custom, mirror here) */
.font-500 { font-weight: 500; }
.font-600 { font-weight: 600; }
.font-700 { font-weight: 700; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--bronze);
  margin-bottom: 0.9rem;
}
.section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--espresso);
}

/* ---------- Buttons ---------- */
.btn-primary, .btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.9rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  transition: all 0.3s ease;
  cursor: pointer;
}
.btn-primary {
  background: var(--espresso);
  color: var(--cream);
}
.btn-primary:hover { background: var(--bronze); transform: translateY(-2px); box-shadow: 0 12px 24px -12px rgba(58,44,32,.6); }
.btn-outline {
  border: 1.5px solid var(--bronze);
  color: var(--bronze);
  background: transparent;
}
.btn-outline:hover { background: var(--bronze); color: #fff; transform: translateY(-2px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ---------- Logo flame ---------- */
.logo-flame {
  width: 26px; height: 34px;
  background: radial-gradient(circle at 50% 70%, #ffd86b 0%, #f7971e 55%, var(--ember) 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  transform: rotate(-4deg);
  box-shadow: 0 0 18px -4px rgba(247,151,30,.7);
  flex-shrink: 0;
}

/* ---------- Hero ---------- */
.hero-bg {
  background:
    radial-gradient(60% 80% at 85% 20%, rgba(201,162,39,.14), transparent 60%),
    radial-gradient(50% 70% at 10% 90%, rgba(185,138,94,.18), transparent 60%),
    linear-gradient(180deg, #faf5ec 0%, var(--cream) 100%);
}
.hero-candle-card {
  width: min(340px, 80vw);
  aspect-ratio: 1 / 1.05;
  background: #fff;
  border-radius: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  box-shadow: 0 30px 60px -30px rgba(58,44,32,.35);
  border: 1px solid var(--sand);
  position: relative;
}
.hero-candle-card.small {
  position: absolute;
  width: 150px; height: 150px;
  padding: 1rem;
  bottom: -24px;
  inset-inline-end: -10px;
  background: var(--espresso);
}
.hero-candle-card.small .candle-svg { filter: brightness(1.25); }
.candle-svg { width: 100%; height: 100%; }

/* ---------- About visual ---------- */
.visual-card {
  background: #fff;
  border: 1px solid var(--sand);
  border-radius: 1.25rem;
  padding: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  min-height: 180px;
  box-shadow: 0 18px 40px -28px rgba(58,44,32,.5);
}
.feature-icon {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 12px;
  background: var(--sand);
  color: var(--bronze);
  display: flex; align-items: center; justify-content: center;
}
.feature-icon svg, .service-icon svg { width: 24px; height: 24px; }

/* ---------- Product filter & cards ---------- */
.filter-btn {
  padding: 0.55rem 1.35rem;
  border-radius: 999px;
  border: 1.5px solid var(--sand);
  background: #fff;
  color: var(--cocoa);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.25s ease;
  cursor: pointer;
}
.filter-btn:hover { border-color: var(--clay); color: var(--bronze); }
.filter-btn.active { background: var(--espresso); border-color: var(--espresso); color: var(--cream); }

.product-card {
  background: #fff;
  border-radius: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--sand);
  transition: transform .35s ease, box-shadow .35s ease;
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-6px); box-shadow: 0 28px 50px -30px rgba(58,44,32,.45); }
.product-card.is-hidden { display: none; }
.product-media {
  position: relative;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tone) 18%, #fff), #faf5ec);
  padding: 2rem;
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
}
.product-media .candle-svg { max-width: 75%; max-height: 100%; }
.product-badge {
  position: absolute;
  top: 12px; inset-inline-start: 12px;
  background: rgba(58,44,32,.85);
  color: var(--cream);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}
.product-body { padding: 1.35rem 1.4rem 1.6rem; display: flex; flex-direction: column; flex: 1; }
.product-cat {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--clay);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.burn-tag {
  font-size: 0.72rem;
  background: var(--sand);
  color: var(--cocoa);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- Cases ---------- */
.case-card {
  background: #fff;
  border-radius: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--sand);
  transition: transform .35s ease, box-shadow .35s ease;
}
.case-card:hover { transform: translateY(-6px); box-shadow: 0 28px 50px -30px rgba(58,44,32,.45); }
.case-thumb {
  background: linear-gradient(150deg, #f3e8d7, #e6d5bd);
  padding: 2rem;
  aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
}
.case-thumb .candle-svg { max-width: 55%; max-height: 100%; }
.case-body { padding: 1.35rem 1.4rem 1.6rem; }
.case-cat {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--clay);
  font-weight: 600;
}
.case-link {
  display: inline-block;
  margin-top: 0.8rem;
  color: var(--bronze);
  font-weight: 500;
  font-size: 0.9rem;
}
.case-link:hover { color: var(--ember); }

/* ---------- Services (dark) ---------- */
.service-card {
  position: relative;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 1.25rem;
  padding: 2rem 1.8rem;
  transition: background .3s ease, transform .3s ease;
  overflow: hidden;
}
.service-card:hover { background: rgba(201,162,39,.12); transform: translateY(-5px); }
.service-no {
  position: absolute;
  top: 14px; inset-inline-end: 18px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.6rem;
  font-weight: 700;
  color: rgba(255,255,255,.08);
}
.service-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: rgba(201,162,39,.15);
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Contact & form ---------- */
.contact-row { display: flex; gap: 1rem; align-items: flex-start; }
.contact-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold);
  margin-top: 6px; flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(201,162,39,.18);
}
.shadow-card { box-shadow: 0 30px 60px -34px rgba(58,44,32,.35); }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cocoa);
  margin-bottom: 0.45rem;
}
.form-input {
  width: 100%;
  background: var(--cream);
  border: 1.5px solid var(--sand);
  border-radius: 0.85rem;
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  color: var(--espresso);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.form-input:focus { outline: none; border-color: var(--clay); box-shadow: 0 0 0 3px rgba(185,138,94,.18); }
.form-input.invalid { border-color: #c0392b; background: #fdf3f2; }
.form-error { color: #c0392b; font-size: 0.78rem; margin-top: 0.35rem; min-height: 0; }
#form-status.success { background: #eef7ee; color: #2e7d32; border: 1px solid #bfe3bf; }
#form-status.error   { background: #fdf3f2; color: #c0392b; border: 1px solid #f0c4bf; }

/* ---------- Back to top ---------- */
.back-top {
  position: fixed;
  bottom: 26px; inset-inline-end: 26px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--espresso);
  color: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  opacity: 0; visibility: hidden;
  transform: translateY(12px);
  transition: all .3s ease;
  z-index: 40;
  box-shadow: 0 12px 26px -10px rgba(58,44,32,.6);
}
.back-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-top:hover { background: var(--bronze); }

/* ---------- Header scrolled state ---------- */
/* Solid (near-opaque) background instead of backdrop-blur: avoids per-frame
   backdrop re-rasterisation during scroll, which was the main jank source. */
.site-header {
  background: rgba(247, 241, 232, 0.97);
  transition: box-shadow 0.25s ease;
}
#site-header.header-scrolled { box-shadow: 0 10px 30px -20px rgba(58,44,32,.4); }
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0; inset-inline-start: 0;
  width: 0; height: 2px;
  background: var(--gold);
  transition: width .3s ease;
}
.nav-link:hover::after { width: 100%; }

/* ---------- Scroll performance ----------
   NOTE: content-visibility was intentionally avoided — with anchor links like
   #products it can leave the target section unpainted (blank) on entry.
   Jank is instead fixed by removing backdrop-filter, rAF-throttling the scroll
   handler, caching DOM nodes and eliminating forced reflows on filter clicks.
   Cards create their own compositor layer on demand during the hover transform. */

/* Smooth anchor scroll with a fixed offset so sections clear the sticky header. */
section[id], #message { scroll-margin-top: 88px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- RTL adjustments ---------- */
[dir="rtl"] .candle-svg { transform: scaleX(-1); }
[dir="rtl"] .logo-flame { transform: rotate(4deg); }
[dir="rtl"] .section-title, [dir="rtl"] .font-serif { letter-spacing: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .hero-candle-card.small { width: 110px; height: 110px; bottom: -16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .wow { animation-duration: 0.01ms !important; }
}
