/* ── BASE — Typography, global elements, utilities ──────────────────────── */

body {
  font-family: var(--font-body);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-regular);
  line-height: 1.7;
  color: var(--color-text-secondary);
  background-color: var(--color-bg-white);
}

/* Entrance animations translate elements slightly off-canvas before they
   reveal; clip that overhang so it never creates horizontal scrolling.
   `clip` (unlike `hidden`) doesn't create a scroll container, so
   position: sticky keeps working. */
html, body {
  overflow-x: clip;
}

/* ── HEADINGS ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  line-height: 1.15;
}

h1 { font-size: var(--font-size-5xl); font-weight: var(--font-weight-extrabold); letter-spacing: -1px; line-height: 1.1; }
h2 { font-size: var(--font-size-3xl); letter-spacing: -0.5px; }
h3 { font-size: var(--font-size-2xl); letter-spacing: 0; }
h4 { font-size: var(--font-size-xl); font-weight: var(--font-weight-semibold); line-height: 1.35; }
h5 { font-size: 20px; font-weight: var(--font-weight-semibold); line-height: 1.4; }
h6 { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); line-height: 1.4; }

p {
  font-family: var(--font-body);
  font-size: var(--font-size-md);
  line-height: 1.7;
  color: var(--color-text-secondary);
}

/* ── HIGHLIGHT ── */
.text-highlight {
  color: var(--color-dark);
}

/* .page-hero has a dark navy background — keep highlight red there so it
   doesn't disappear against --color-dark */
.page-hero .text-highlight {
  color: var(--color-primary);
}

/* ── SECTION BADGE ── */
.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: var(--color-primary-light);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 16px;
}

.section-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: var(--color-primary);
  border-radius: 50%;
}

/* ── SECTION HEADING BLOCK ── */
.section-header {
  margin-bottom: 60px;
}

.section-header.centered {
  text-align: center;
}

.section-heading {
  font-family: var(--font-heading);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.section-desc {
  font-family: var(--font-body);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-secondary);
  line-height: 1.7;
  max-width: 600px;
}

.section-header.centered .section-desc {
  margin: 0 auto;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.2px;
  line-height: 1;
  height: 52px;
  padding: 0 32px;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background-color var(--transition-base), color var(--transition-base), border-color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
}

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

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

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

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

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

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

.btn-outline-white {
  background-color: transparent;
  color: var(--color-white);
  border-color: var(--color-white);
}

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

.btn-sm {
  height: 40px;
  padding: 0 20px;
  font-size: var(--font-size-sm);
}

.btn-lg {
  height: 60px;
  padding: 0 40px;
  font-size: var(--font-size-md);
}

/* ── ICON BUTTON (circle) ── */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-circle);
  border: 1.5px solid var(--color-border);
  background: var(--color-bg-white);
  color: var(--color-text-primary);
  transition: background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base);
  cursor: pointer;
  flex-shrink: 0;
}

.btn-icon:hover {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
  transform: scale(1.05);
}

.btn-icon-sm {
  width: 40px;
  height: 40px;
}

/* ── SCROLL PROGRESS BAR ── */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background-color: var(--color-primary);
  z-index: var(--z-toast);
  transition: width 0.1s linear;
}

/* ── BACK TO TOP ── */
#back-to-top {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-circle);
  background-color: var(--color-primary);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--transition-base), visibility var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
  box-shadow: var(--shadow-floating);
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover {
  background-color: var(--color-primary-dark);
  transform: translateY(-3px);
}

/* ── WHATSAPP FLOAT ── */
#whatsapp-btn {
  position: fixed;
  bottom: 32px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-circle);
  background-color: var(--color-primary);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  box-shadow: 0 4px 20px rgba(214, 45, 47, 0.4);
  transition: background-color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
  text-decoration: none;
  animation: whatsapp-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.9s backwards;
}

@keyframes whatsapp-enter {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

#whatsapp-btn:hover {
  background-color: var(--color-primary-dark);
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-primary);
}

#whatsapp-btn svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* Scroll animation classes are defined in the PREMIUM ANIMATIONS block below. */

/* ── PAGE HERO (inner pages) ── */
.page-hero {
  background-color: var(--color-dark);
  padding: 120px 0 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(214, 45, 47, 0.12) 0%, transparent 70%);
}

.page-hero-content {
  position: relative;
  z-index: 1;
}

/* Staggered entrance for inner-page heroes — mirrors the homepage's animated
   hero so page loads feel consistent. Timed to start as the page-transition
   curtain lifts. */
@media (prefers-reduced-motion: no-preference) {
  .page-hero-content > * {
    animation: pageHeroRise 0.7s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  }
  .page-hero-content > :nth-child(1) { animation-delay: 0.1s; }
  .page-hero-content > :nth-child(2) { animation-delay: 0.2s; }
  .page-hero-content > :nth-child(3) { animation-delay: 0.3s; }
  .page-hero-content > :nth-child(4) { animation-delay: 0.4s; }
  .page-hero-content > :nth-child(5) { animation-delay: 0.5s; }
}

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

.page-hero-heading {
  font-family: var(--font-heading);
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-white);
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.page-hero-desc {
  font-family: var(--font-body);
  font-size: var(--font-size-lg);
  color: rgba(255, 255, 255, 0.75);
  max-width: 560px;
  margin: 0 auto 24px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.6);
}

.breadcrumb a {
  color: rgba(255, 255, 255, 0.6);
  transition: color var(--transition-fast);
}

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

.breadcrumb-sep {
  color: rgba(255, 255, 255, 0.3);
}

/* ── ANCHOR TARGETS — keep in-page targets clear of the fixed navbar ── */
[id] {
  scroll-margin-top: calc(var(--navbar-height) + 16px);
}

/* ── KEYBOARD FOCUS — visible focus ring on all interactive elements ── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Inputs already show a border/box-shadow focus state */
.form-input:focus-visible,
.form-textarea:focus-visible,
.footer-newsletter-input:focus-visible {
  outline: none;
}

/* ── UTILITY ── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.text-center  { text-align: center; }
.text-primary { color: var(--color-primary); }
.text-dark    { color: var(--color-dark); }
.text-muted   { color: var(--color-text-muted); }


/* ══════════════════════════════════════════════════════════════════════════
   PREMIUM ANIMATIONS
══════════════════════════════════════════════════════════════════════════ */

/* ── Masked text reveal ── */
.text-reveal-wrap {
  overflow: hidden;
  display: block;
}

.text-reveal {
  display: block;
  transform: translateY(105%);
  transition: transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}

.text-reveal.in-view {
  transform: translateY(0);
}

/* Stagger delays for multi-line headings */
.text-reveal:nth-child(2) { transition-delay: 0.08s; }
.text-reveal:nth-child(3) { transition-delay: 0.16s; }

/* ── Enhanced scroll-in animations ── */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.in-view {
  opacity: 1;
  transform: translateY(0);
}

.animate-from-left {
  opacity: 0;
  transform: translateX(-36px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-from-left.in-view {
  opacity: 1;
  transform: translateX(0);
}

.animate-from-right {
  opacity: 0;
  transform: translateX(36px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-from-right.in-view {
  opacity: 1;
  transform: translateX(0);
}

.animate-scale {
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-scale.in-view {
  opacity: 1;
  transform: scale(1);
}

/* ── Button click ripple (tactile feedback) ── */
.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.96) translateY(0) !important;
  transition: transform 0.1s ease, box-shadow 0.1s ease !important;
  box-shadow: 0 2px 8px rgba(214, 45, 47, 0.3) !important;
}

.btn-white:active,
.btn-outline-white:active {
  transform: scale(0.96) translateY(0) !important;
  transition: transform 0.1s ease !important;
}

/* ── Image float animation for about section ── */
@keyframes float-subtle {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-10px); }
}

.float-anim {
  animation: float-subtle 5s ease-in-out infinite;
}

.float-anim-delayed {
  animation: float-subtle 6s ease-in-out infinite;
  animation-delay: 1.5s;
}

/* ── Stagger product grid entrance ── */
.products-grid [data-stagger="products"]:nth-child(1) { transition-delay: 0ms; }
.products-grid [data-stagger="products"]:nth-child(2) { transition-delay: 80ms; }
.products-grid [data-stagger="products"]:nth-child(3) { transition-delay: 160ms; }
.products-grid [data-stagger="products"]:nth-child(4) { transition-delay: 240ms; }
.products-grid [data-stagger="products"]:nth-child(5) { transition-delay: 320ms; }
.products-grid [data-stagger="products"]:nth-child(6) { transition-delay: 400ms; }

/* ── Skip navigation (accessibility) ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.75rem 1.5rem;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0; }

/* ── Screen-reader only (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;
}

/* ── Respect reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .text-reveal,
  .animate-on-scroll,
  .animate-from-left,
  .animate-from-right,
  .animate-scale,
  .float-anim,
  .float-anim-delayed,
  #whatsapp-btn {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

/* ── Page transition curtain ──
   EXIT (leaving a page) is driven by js/animations.js on this element. It has
   plenty of time to be created before the user clicks anything, so building it
   in JS is fine here. */
#page-transition {
  position: fixed;
  inset: 0;
  background: var(--color-primary);
  transform: translateY(100%);
  z-index: 10000;
  pointer-events: none;
  will-change: transform;
}

/* ENTRY (arriving on a page) is deliberately NOT this element.
   #page-transition is created by deferred JS, which runs only after the
   document is parsed — so the browser painted the incoming page first and then
   had a full-screen panel dropped onto it and wiped away. That read as a second,
   glitchy transition on every tab change.

   Instead the entry curtain is a pseudo-element on <html>, switched on by the
   inline bootstrap script in <head> before first paint and animated purely in
   CSS. It therefore covers the page from the very first frame and cannot be
   delayed by script execution or a busy main thread. */
html.dp-entering::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--color-primary);
  z-index: 10000;
  pointer-events: none;
  will-change: transform;
  transform: translateY(0);
  animation: dp-curtain-lift 420ms cubic-bezier(0.76, 0, 0.24, 1) forwards;
}

@keyframes dp-curtain-lift {
  from { transform: translateY(0); }
  to   { transform: translateY(-100%); }
}

/* The animation is `forwards` and CSS-only, so it cannot get stuck even if
   every script on the page fails. Under reduced motion, skip it entirely. */
@media (prefers-reduced-motion: reduce) {
  html.dp-entering::before {
    animation: none;
    display: none;
  }
}
