/* ==========================================================================
   Unilli Nicaragua — Shared Brand System
   "Pista Nocturna" — navy-dark cinematic, red as signal geometry.
   Canon tokens: brand/guidelines.md · Direction: docs/design-direction.md
   ========================================================================== */

/* ---- Canon tokens (required verbatim block) ---- */
:root {
  --color-red: #e90101;
  --color-red-dark: #b80000;
  --color-red-tint: rgba(233,1,1,0.12);
  --color-navy: #110b51;
  --color-navy-dark: #0a0736;
  --color-navy-tint: rgba(17,11,81,0.08);
  --color-off-white: #F7F5F5;
  --shadow-card: 0 2px 8px rgba(17,11,81,0.06), 0 8px 32px rgba(17,11,81,0.04);
  --ease-out-sine: cubic-bezier(.61, 1, .88, 1);
  --ease-in-out: cubic-bezier(.25, 0.1, 0.25, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Layout tokens (design-direction.md §8, non-duplicate additions) ---- */
:root {
  --font-display-size: clamp(3rem, 1.6rem + 5vw, 6.5rem);
  --container-max: 1240px;
  --container-pad: 32px;
  --space-section: clamp(64px, 8vw, 140px);
  --space-section-lg: clamp(96px, 11vw, 200px);
  --gap-grid: 24px;
  --radius-card: 8px;
  --radius-btn: 6px;
  --radius-chip: 4px;
  --shadow-card-hover: 0 4px 12px rgba(17,11,81,0.10), 0 16px 48px rgba(17,11,81,0.08);
  --shadow-hard: 3px 3px 0 #110b51;
  --scrim: rgba(10,7,54,0.6);
  --z-base: 0;
  --z-raised: 10;
  --z-sticky: 20;
  --z-nav: 40;
  --z-menu: 100;
  --z-modal: 1000;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

/* Fixed nav offset for in-page anchors */
[id] { scroll-margin-top: 88px; }

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--color-navy);
  background: var(--color-off-white);
  overflow-x: hidden;
}

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

a { color: inherit; }

.page-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}
@media (max-width: 480px) {
  .container { padding: 0 20px; }
}

/* ---- Typography ---- */
.text-display {
  font-family: 'Anton SC', sans-serif;
  font-size: var(--font-display-size);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.text-h1 {
  font-family: 'Anton SC', sans-serif;
  font-size: clamp(2.5rem, 1.5rem + 3vw, 4.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.text-h2 {
  font-family: 'Anton SC', sans-serif;
  font-size: clamp(1.75rem, 1rem + 2vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.text-h3 {
  font-family: 'Anton SC', sans-serif;
  font-size: clamp(1.25rem, 0.75rem + 1.5vw, 2rem);
  line-height: 1.15;
  text-transform: uppercase;
}
.text-body {
  font-size: clamp(0.9375rem, 0.28vw + 0.87rem, 1.125rem);
  line-height: 1.7;
}
.text-small {
  font-size: clamp(0.8125rem, 0.2vw + 0.78rem, 0.9375rem);
  line-height: 1.6;
}
/* Spec-plate: workshop-data-plate utility voice (eyebrows, SKU lines, captions) */
.spec-plate {
  font: 600 0.8125rem 'DM Sans', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
/* Eyebrow: spec-plate label opened by a 24x3 solid red rule */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 600 0.8125rem 'DM Sans', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: '';
  width: 24px;
  height: 3px;
  background: var(--color-red);
  flex-shrink: 0;
}

/* Franja Roja — signature red block behind one headline word.
   Background is skewed via ::before; the text itself stays upright. */
.red-strip {
  position: relative;
  display: inline-block;
  color: #fff;
  padding: 0.06em 0.18em;
  isolation: isolate;
}
.red-strip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-red);
  transform: skewX(-6deg);
  transform-origin: left;
  z-index: -1;
}

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--color-red);
  color: #fff;
  border: 2px solid var(--color-red);
  border-radius: var(--radius-btn);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  /* Canon: background + transform only. */
  transition: background 0.25s var(--ease-in-out), transform 0.25s var(--ease-in-out);
}
.btn-primary:hover { background: var(--color-red-dark); border-color: var(--color-red-dark); transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:focus-visible { outline: 2px solid var(--color-red-dark); outline-offset: 3px; }

/* Secondary on dark (default) */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius-btn);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s var(--ease-in-out), transform 0.25s var(--ease-in-out), border-color 0.25s var(--ease-in-out), color 0.25s var(--ease-in-out);
}
.btn-outline:hover { border-color: #fff; transform: translateY(-2px); }
.btn-outline:active { transform: translateY(0); }
.btn-outline:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* Secondary on light surfaces */
.btn-outline-light {
  color: var(--color-navy);
  border-color: rgba(17,11,81,0.3);
}
.btn-outline-light:hover { border-color: var(--color-navy); background: transparent; }
.btn-outline-light:focus-visible { outline-color: var(--color-red-dark); }

/* Compact WhatsApp CTA (product cards): full-width, 44px, primary-red */
.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  padding: 0 16px;
  background: var(--color-red);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s var(--ease-in-out), transform 0.25s var(--ease-in-out);
}
.btn-whatsapp:hover { background: var(--color-red-dark); transform: translateY(-2px); }
.btn-whatsapp:active { transform: translateY(0); }
.btn-whatsapp:focus-visible { outline: 2px solid var(--color-red-dark); outline-offset: 3px; }

/* ---- Cards ---- */
.card {
  position: relative;
  background: #fff;
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-card);
  cursor: default;
  transition: transform 0.25s var(--ease-in-out);
}
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: var(--shadow-card-hover);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease-in-out);
}
.card:hover { transform: translateY(-4px); }
.card:hover::after { opacity: 1; }
.card:focus-visible { outline: 2px solid var(--color-red-dark); outline-offset: 3px; }

/* Dark-section variant: fill + hairline carry the depth, no drop shadow */
.card.card-dark {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: none;
}
.card.card-dark::after { content: none; }

/* ---- Chips (catalogue filters) ---- */
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid rgba(17,11,81,0.18);
  border-radius: var(--radius-chip);
  color: var(--color-navy);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.25s var(--ease-in-out), transform 0.25s var(--ease-in-out), background 0.25s var(--ease-in-out), color 0.25s var(--ease-in-out);
}
.chip:hover { border-color: var(--color-navy); transform: translateY(-1px); }
.chip:focus-visible { outline: 2px solid var(--color-red-dark); outline-offset: 2px; }
/* Pre-rendered hard-shadow plate (opacity crossfade only, never animated box-shadow) */
.chip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-navy);
  border-radius: inherit;
  transform: translate(3px, 3px);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.08s linear;
}
.chip.chip-selected {
  background: var(--color-red);
  border-color: var(--color-red);
  color: #fff;
}
.chip.chip-selected:hover { border-color: var(--color-red); }
.chip.chip-selected::after { opacity: 1; }
/* Press feedback for unselected chips (no plate behind them, so just cancel
   the hover lift instantly — kept in sync with the selected press timing). */
.chip:active { transform: translateY(0); transition: transform 0.08s linear; }
/* Mechanical press (selected only — the hard-shadow plate lives here):
   chip snaps to the plate's offset while the plate fades out, both 80ms
   linear so body + plate move in lockstep (motion row 11). */
.chip.chip-selected:active {
  transform: translate(3px, 3px);
  transition: transform 0.08s linear;
}
.chip.chip-selected:active::after { opacity: 0; }

/* ---- Seal (endorsement badge: Nereus/Endurix blocks + catalogue header) ---- */
.seal {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border: 1.5px solid var(--color-red);
  border-radius: 100px; color: var(--color-red);
  font: 700 0.75rem/1 'DM Sans', sans-serif;
  letter-spacing: 0.08em; text-transform: uppercase;
}
/* Dark-surface variant (Endurix band, catalogue header): red text on navy
   or navy-dark computes to 3.75:1 / 4.08:1 — below 4.5:1 AA for 12px text
   (design-direction.md §3: red-on-navy is "large text/graphics only, never
   body"). Border stays red (a graphic, ≥3:1 non-text contrast passes);
   text switches to white so the badge reads correctly on dark sections. */
.seal-on-dark { color: #fff; }

/* ---- Section rhythm helpers ---- */
.section-pad { padding: var(--space-section) 0; }
.section-pad-lg { padding: var(--space-section-lg) 0; }

/* ---- Scroll-triggered reveal ---- */
.anim {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.6s var(--ease-out-sine), transform 0.6s var(--ease-out-sine);
}
.anim.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- SVG grain overlay (4%) ---- */
.noise { position: relative; }
.noise::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 200px;
  pointer-events: none;
  z-index: 1;
}

/* ---- Skip link (keyboard a11y) ---- */
.skip-link {
  position: absolute;
  top: -48px;
  left: 12px;
  z-index: var(--z-modal);
  background: var(--color-red);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 0.875rem;
  text-decoration: none;
  transition: transform 0.25s var(--ease-in-out);
}
.skip-link:focus {
  top: 12px;
  transform: translateY(0);
}

/* ---- Nav ---- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: var(--z-nav);
  padding: 20px 0;
  background: transparent;
  border-bottom: 1px solid transparent;
  backdrop-filter: none;
  /* Motion row 5: background-color + hairline (border-color) only — padding
     switches instantly, it is a layout property and never sanctioned to animate. */
  transition: background 0.25s var(--ease-in-out), border-color 0.25s var(--ease-in-out);
}
.nav-scrolled {
  background: rgba(10,7,54,0.92);
  border-bottom-color: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 0;
}
.nav-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav-logo { display: inline-flex; text-decoration: none; }
.nav-logo-wrap {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
}
.nav-logo-wrap img { height: 40px; width: auto; }

.nav-links-desktop {
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-link {
  position: relative;
  color: #fff;
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-bottom: 4px;
  transition: color 0.25s var(--ease-in-out);
}
.nav-link:hover { color: #fff; text-decoration: underline; text-decoration-color: var(--color-red); text-underline-offset: 4px; }
.nav-link:active { color: #fff; text-decoration: underline; text-decoration-color: var(--color-red-dark); text-underline-offset: 4px; }
.nav-link:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.nav-link.active { border-bottom: 3px solid var(--color-red); }

.nav-cta {
  padding: 10px 24px;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius-btn);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s var(--ease-in-out), transform 0.25s var(--ease-in-out), border-color 0.25s var(--ease-in-out);
}
.nav-cta:hover { background: var(--color-red); border-color: var(--color-red); transform: translateY(-2px); }
.nav-cta:active { transform: translateY(0); }
.nav-cta:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  transition: transform 0.08s linear;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s var(--ease-in-out), opacity 0.3s var(--ease-in-out), background 0.25s var(--ease-in-out);
}
.hamburger:hover span { background: var(--color-red); }
.hamburger:active { transform: scale(0.92); }
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.hamburger:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Mobile menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: var(--z-menu);
  background: var(--color-navy-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  /* visibility (not just opacity/pointer-events) keeps its links out of the
     Tab order while closed — found via keyboard walkthrough: opacity+pointer-
     events alone leaves them focusable-but-invisible at any viewport width,
     since this panel stays in the DOM even on desktop. Delayed on the way
     out so it still fades per motion row 12; instant on the way in. */
  visibility: hidden;
  transition: opacity 0.3s var(--ease-out-sine), transform 0.3s var(--ease-out-sine), visibility 0s linear 0.3s;
}
.mobile-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition: opacity 0.3s var(--ease-out-sine), transform 0.3s var(--ease-out-sine), visibility 0s linear 0s;
}
.mobile-menu a {
  color: #fff;
  text-decoration: none;
  font-family: 'Anton SC', sans-serif;
  font-size: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  transition: color 0.2s var(--ease-in-out);
}
.mobile-menu a:hover { color: var(--color-red); }
.mobile-menu a:active { color: var(--color-red-dark); }
.mobile-menu a:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .nav-links-desktop { display: none; }
}

/* ---- Footer ---- */
.site-footer {
  background: var(--color-navy-dark);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 64px 0 24px;
  color: rgba(255,255,255,0.6);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
}
.footer-logo { height: 40px; width: auto; border-radius: 4px; margin-bottom: 16px; }
.footer-desc { color: rgba(255,255,255,0.78); max-width: 320px; }
.footer-heading {
  font-family: 'Anton SC', sans-serif;
  color: #fff;
  font-size: 0.9375rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-link {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s var(--ease-in-out);
  width: fit-content;
}
.footer-link:hover { color: #fff; }
.footer-link:active { color: #fff; text-decoration: underline; text-decoration-color: var(--color-red); text-underline-offset: 4px; }
.footer-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.footer-social { display: flex; gap: 12px; margin-top: 4px; }
.footer-social-link { color: rgba(255,255,255,0.6); transition: color 0.2s var(--ease-in-out); }
.footer-social-link:hover { color: var(--color-red); }
.footer-social-link:active { color: var(--color-red-dark); }
.footer-social-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.footer-slogan {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  padding-left: 28px;
  position: relative;
  margin-bottom: 24px;
}
.footer-slogan::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 3px;
  background: var(--color-red);
}
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 20px;
  text-align: center;
}
.footer-copy { color: rgba(255,255,255,0.3); font-size: 0.75rem; }

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

  .anim {
    transition: opacity 0.15s linear !important;
    transform: none !important;
  }
  .anim.visible { opacity: 1; transform: none; }

  .card:hover,
  .btn-primary:hover,
  .btn-outline:hover,
  .btn-whatsapp:hover,
  .nav-cta:hover,
  .chip:hover,
  .chip:active,
  .hamburger:active {
    transform: none !important;
  }

  /* Mobile menu + hamburger: state (open/closed, burger/X) still applies
     instantly — only the animated transition between states is removed. */
  .mobile-menu,
  .hamburger,
  .hamburger span {
    transition: none !important;
  }

  /* Any keyframe animation (hero load-ins, scroll cue, etc.) resolves to its
     end state instantly instead of playing — elements render visible. */
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
