/* ==========================================================================
   Cubiertas Pro — Redesign
   Design tokens + custom styles that go beyond Tailwind utilities
   (animations, marquee, custom cursors, grain, carousel, etc.)
   ========================================================================== */

/* Tokens de diseño: ver /tokens.css (Fase C). */

* { -webkit-tap-highlight-color: transparent; }

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

@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;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  cursor: default;
}

/* Tailwind's original steel token was too light for small supporting copy. */
.text-steel { color: var(--steel-text) !important; }

::selection { background: var(--copper); color: var(--white); }

/* Focus visibility — kept even though buttons have no border by default */
:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 3px;
}

a, button { cursor: pointer; }

/* ---------- Layout helpers not worth a Tailwind config entry ---------- */

.container-edge {
  padding-left: clamp(1.25rem, 5vw, 4rem);
  padding-right: clamp(1.25rem, 5vw, 4rem);
}

.text-balance { text-wrap: balance; }

/* ---------- Preloader ---------- */

#preloader {
  position: fixed; inset: 0; z-index: 999;
  background: var(--primary);
  display: none;
  transition: opacity 0.6s var(--ease-out), visibility 0.6s var(--ease-out);
}
#preloader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#preloader .mark { display: flex; flex-direction: column; align-items: center; gap: 1rem; font-weight: 800; letter-spacing: -0.02em; color: var(--paper); font-size: clamp(1.5rem, 5vw, 2.5rem); }
#preloader .mark .text-wrap { overflow: hidden; }
#preloader .mark span { display: inline-block; transform: translateY(110%); }
.preloader-icon { height: clamp(2rem, 6vw, 3rem); width: auto; opacity: 0; transform: translateY(12px); }

/* ---------- Site header ---------- */

.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  color: var(--white);
  transition: background-color 0.4s var(--ease-out), backdrop-filter 0.4s var(--ease-out), border-color .4s var(--ease-out), color 0.4s var(--ease-out);
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background-color: var(--paper-90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: var(--ink-line-soft);
  color: var(--ink);
}
/* Interior pages (no video hero): header stays solid and dark-on-light at
   all times, never the transparent white-text state reserved for home. */
.site-header.is-light {
  color: var(--ink);
  background-color: var(--paper-90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: var(--ink-line-soft);
}

.header-logo-dark { display: none; }
.header-logo-light { display: block; }
.site-header.is-scrolled .header-logo-dark,
.site-header.is-light .header-logo-dark { display: block; }
.site-header.is-scrolled .header-logo-light,
.site-header.is-light .header-logo-light { display: none; }
.site-header .nav-link {
  position: relative;
  color: currentColor;
}
.site-header .nav-link::after {
  content: '';
  position: absolute; left: 0; right: 100%; bottom: -4px; height: 2px;
  background: var(--copper);
  transition: right 0.35s var(--ease-out);
}
.site-header .nav-link.is-active::after { right: 0; }
.site-header .nav-link.is-active { color: var(--copper); }

/* ---------- Buttons — solid color blocks, no borders/gradients ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.9rem 1.7rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  transition: background-color 0.35s var(--ease-out), color 0.35s var(--ease-out), transform 0.35s var(--ease-out);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-copper { background: var(--copper); color: var(--white); }
.btn-ink { background: var(--primary); color: var(--paper); }

.btn-ghost-light { background: transparent; color: var(--white); }

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

/* ---------- Hero ---------- */

.hero { position: relative; height: 100svh; min-height: 620px; overflow: hidden; background: var(--deep); }
.hero-video-rail { position: absolute; inset: 0; }
.hero-video-rail video, .hero .hero-poster {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 1.2s var(--ease-in-out);
}
.hero-video-rail video.is-active { opacity: 1; }
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(0,20,26,0.55) 0%, rgba(0,20,26,0.35) 35%, rgba(0,20,26,0.75) 100%);
}
.hero-content { position: relative; z-index: 2; }
.hero [data-split-lines] .line { display: block; overflow: hidden; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.hero [data-split-lines] .line > span { display: block; }

.hero .scroll-cue {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  z-index: 3; color: var(--paper); opacity: 0.8;
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase;
}
.hero .scroll-cue .line { width: 1px; height: 2.5rem; background: linear-gradient(var(--paper), transparent); animation: scrollcue 2s var(--ease-in-out) infinite; }
@keyframes scrollcue { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 50.01% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ---------- Marquee ticker ---------- */

.marquee { overflow: hidden; white-space: nowrap; }
.marquee-track {
  display: inline-flex; width: max-content;
  animation: marquee 32s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.marquee-item { display: inline-flex; align-items: center; gap: 1.25rem; padding: 0 2rem; font-size: 0.95rem; }
.marquee-dot { width: 6px; height: 6px; border-radius: var(--radius-pill); background: var(--copper); }

/* ---------- Category bento ---------- */

.bento-tile {
  position: relative; overflow: hidden; border-radius: var(--radius-md);
  background: var(--primary); color: var(--paper);
}
.bento-tile img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.06);
  filter: saturate(0.9);
  transition: transform 1.1s var(--ease-out), filter 0.6s var(--ease-out);
}
.bento-tile::before {
  content: '';
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(0,22,28,0.15) 0%, rgba(0,22,28,0.85) 100%);
  transition: background 0.5s var(--ease-out);
}
.bento-tile .tile-content { position: relative; z-index: 2; }
.bento-tile .tile-arrow { transition: transform 0.4s var(--ease-out); }

/* ---------- Product cards ---------- */

.product-card { position: relative; }
.product-card .img-wrap { position: relative; overflow: hidden; background: var(--paper-2); border-radius: var(--radius-md); aspect-ratio: 4/5; }
.product-card .img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.8s var(--ease-out);
}
.product-card .quote-btn {
  position: absolute; left: 0.85rem; right: 0.85rem; bottom: 0.85rem;
  transform: translateY(120%); opacity: 0;
  transition: transform 0.4s var(--ease-out), opacity 0.4s var(--ease-out);
}
.cat-tag {
  position: absolute; top: 0.85rem; left: 0.85rem; z-index: 2;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--paper); color: var(--primary); padding: 0.3rem 0.6rem; border-radius: var(--radius-pill);
}

/* horizontal drag-scroll rail */
.rail { display: flex; gap: 1.25rem; overflow-x: auto; scroll-snap-type: x proximity; cursor: grab; scrollbar-width: none; touch-action: pan-y; }
.rail[data-rail-infinite] { scroll-snap-type: none; }
.rail::-webkit-scrollbar { display: none; }
.rail.is-dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.rail > * { scroll-snap-align: start; flex: 0 0 auto; }

/* ---------- Filter pills (catalog page) ---------- */

.filter-pill {
  padding: 0.55rem 1.1rem; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.03em;
  border-radius: var(--radius-pill); background: transparent; color: var(--steel);
  transition: background-color 0.3s var(--ease-out), color 0.3s var(--ease-out);
}
.filter-pill.is-active { background: var(--primary); color: var(--paper); }

/* ---------- Guided product selection ---------- */

.solution-finder {
  display: grid; gap: 2rem; padding: clamp(1.5rem, 4vw, 2.75rem);
  background: var(--paper-2); border-radius: var(--radius-md);
}
.solution-finder-form { display: grid; grid-template-columns: 1fr; gap: 1rem; align-items: end; }
.solution-finder label { display: grid; gap: 0.45rem; min-width: 0; color: var(--ink); font-size: 0.8125rem; font-weight: 700; }
.solution-finder label span { letter-spacing: 0.02em; }
.solution-finder em { color: var(--steel-text); font-style: normal; font-weight: 500; }
.solution-finder select, .solution-finder input { min-width: 0; width: 100%; border: 1px solid var(--ink-line); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); padding: 0.75rem; font: inherit; }
.solution-finder .btn { justify-content: center; min-height: 3rem; }

/* ---------- Quote handoff ---------- */

.quote-intro { border-inline-start: 2px solid var(--copper); padding-inline-start: 1rem; }
.form-status { min-height: 1.5rem; color: var(--primary); font-weight: 600; }
.form-status.is-error { color: var(--danger); }

/* ---------- Service mosaic ---------- */

.service-mosaic {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--white);
}
.service-mosaic-media {
  min-height: clamp(15rem, 24vw, 21rem);
  overflow: hidden;
  background: var(--paper-2);
}
.service-mosaic-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease-out);
}
.service-mosaic-copy {
  display: flex;
  min-height: clamp(17rem, 25vw, 22rem);
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 4vw, 3.5rem);
  background: var(--white);
}
.service-mosaic-icon {
  width: 3.6rem;
  height: 3.6rem;
  margin-bottom: 1.5rem;
  object-fit: contain;
}
.service-mosaic-copy h3 {
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}
.service-mosaic-copy p {
  max-width: 31ch;
  margin-top: 0.8rem;
  color: var(--steel-text);
  line-height: 1.7;
}
.service-mosaic-copy--accent { background: var(--paper-2); }

@media (min-width: 48rem) {
  .service-mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 64rem) {
  .service-mosaic { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .service-mosaic-media,
  .service-mosaic-copy { min-height: clamp(18rem, 25vw, 23.5rem); }
}

/* ---------- Home trust cards ---------- */

.home-trust-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.home-trust-card {
  display: flex;
  min-height: 12.5rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
  border: 1px solid rgba(11,14,16,0.15);
  border-radius: var(--radius-lg);
  background: var(--paper);
}
.home-trust-card .icon {
  flex: none; width: 2rem; height: 2rem;
  margin-bottom: 1rem;
  color: var(--copper);
  font-size: 2rem;
}
.home-trust-card h2 { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.015em; }
.home-trust-card p { margin-top: 0.4rem; color: var(--steel-text); line-height: 1.55; }
@media (min-width: 40rem) {
  .home-trust-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 64rem) {
  .home-trust-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Home services feature ---------- */

.home-services-teaser-inner {
  display: grid;
  grid-template-columns: 1fr;
}
.home-services-teaser-copy {
  display: flex;
  min-height: 31rem;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(5rem, 9vw, 8rem) clamp(1.25rem, 5vw, 4rem);
}
.home-services-teaser-media {
  min-height: 21rem;
  margin: 0;
  overflow: hidden;
}
.home-services-teaser-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (min-width: 48rem) {
  .home-services-teaser-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-services-teaser-copy { min-height: 42rem; padding-right: clamp(2rem, 7vw, 8rem); }
  .home-services-teaser-media { min-height: 42rem; }
}

/* ---------- Four-step service process ---------- */

.service-process {
  color: var(--paper);
  background: var(--deep);
}
.service-process-inner {
  max-width: 90rem;
  margin: 0 auto;
  padding-top: clamp(5rem, 9vw, 8rem);
  padding-bottom: clamp(5rem, 9vw, 8rem);
}
.service-process-heading {
  max-width: 44rem;
  margin: 0 auto clamp(5.5rem, 9vw, 7rem);
  text-align: center;
}
.service-process-heading h2 {
  font-size: clamp(2rem, 4.2vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.04;
  text-wrap: balance;
}
.service-process-steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4.5rem;
  max-width: 80rem;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.service-process-step {
  position: relative;
  display: flex;
  min-height: 17rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5.5rem 2rem 2.5rem;
  text-align: center;
  border-radius: var(--radius-lg);
  background: rgba(3, 17, 21, 0.95);
  box-shadow: 0 1rem 2.5rem rgba(0,0,0,0.18);
}
.service-process-number {
  position: absolute;
  top: 1.2rem;
  left: 1.35rem;
  color: rgba(246,245,241,0.12);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}
.service-process-icon {
  position: absolute;
  top: -3rem;
  left: 50%;
  display: grid;
  width: 6rem;
  height: 6rem;
  place-items: center;
  border-radius: 50%;
  background: var(--copper);
  transform: translateX(-50%);
}
.service-process-icon img { width: 2.8rem; height: 2.8rem; filter: brightness(0) invert(1); }
.service-process-step h3 { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; }
.service-process-step p { max-width: 23ch; margin: 0.95rem auto 0; color: rgba(246,245,241,0.72); line-height: 1.65; }
@media (min-width: 48rem) {
  .service-process-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5.5rem 2rem; }
}
@media (min-width: 72rem) {
  .service-process-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2rem; }
}

/* ---------- Page hero band (green, interior pages) ---------- */

.page-hero-band { background: var(--primary); color: var(--white); }
.page-hero-band p { color: rgba(255,255,255,0.75); }

/* ---------- Floating WhatsApp button ---------- */

.whatsapp-fab {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 80;
  width: 3.5rem; height: 3.5rem; border-radius: var(--radius-pill);
  background: #25D366; color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

/* ---------- Footer ---------- */

.footer-cta { background: var(--primary); color: var(--paper); }
/* Redundant on the contact page itself — it's already the quote form.
   Servicios ends with its own catalogue CTA, so it goes directly to the footer. */
body[data-page="contacto"] .footer-cta,
body[data-page="servicios"] .footer-cta,
body[data-page="catalogo"] .footer-cta { display: none; }
.footer-cta { display: grid; grid-template-columns: 1fr; }
.footer-cta-copy { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: clamp(3rem, 8vw, 6rem) clamp(1.25rem, 5vw, 4rem); order: 2; }
.footer-cta-photo { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; order: 1; }
@media (min-width: 48rem) {
  .footer-cta { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .footer-cta-photo { order: 1; }
  .footer-cta-copy { order: 2; }
}
.footer-cta .btn-copper:hover { background: var(--white); color: var(--primary); }

/* ---------- Misc reveal utility used by GSAP ---------- */

.js-reveal { opacity: 0; }
.js-split-line { overflow: hidden; }

/* Big outline number — used only where sequence carries real meaning
   (the 4-step process in servicios.html). Filled + stroked so it reads
   on both light and dark surfaces instead of vanishing. */
.ghost-num {
  font-weight: 800;
  color: rgba(11,14,16,0.14);
  -webkit-text-stroke: 1px rgba(11,14,16,0.22);
}
.ghost-num-dark {
  font-weight: 800;
  color: rgba(246,245,241,0.16);
  -webkit-text-stroke: 1px rgba(246,245,241,0.4);
}

/* Small non-numeric marker for lists where order isn't the point */
.stat-mark { display: block; width: 2rem; height: 2px; background: var(--copper); margin-bottom: 1rem; }

/* Custom checkbox-free radio look for contact form */
.field {
  border-bottom: 1px solid var(--ink-line);
  background: transparent;
  transition: border-color 0.3s var(--ease-out);
}
.field:focus { border-color: var(--copper); }
.field::placeholder { color: #5c6063; opacity: 1; }
select.field { color: var(--ink); }

html[data-reduce-motion="true"] .marquee-track { animation-play-state: paused; }
html[data-reduce-motion="true"] .hero .scroll-cue { display: none; }
html[data-reduce-motion="true"] .hero-video-rail video:not(.is-active) { display: none; }

@media (min-width: 48rem) {
  .solution-finder-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 64rem) {
  .solution-finder-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .solution-finder .btn { width: fit-content; }
}

@media (max-width: 767px) {
  .hero { min-height: 560px; }
  .solution-finder .btn { width: 100%; }
}

/* ---------- Mobile menu panel ---------- */

.mobile-menu-panel {
  position: fixed; inset: 0; z-index: 90;
  background: var(--primary); color: var(--paper);
  transform: translateY(-100%);
  transition: transform 0.3s var(--ease-out);
}
.mobile-menu-panel.is-open { transform: translateY(0); }
.mobile-link { font-size: 2rem; font-weight: 700; padding: 0.4rem 0; display: block; }
.mobile-link::after { display: none; }

.header-burger span:first-child { transition: transform 0.3s var(--ease-out), opacity 0.3s; }
.header-burger span:last-child { transition: transform 0.3s var(--ease-out); }
[aria-expanded="true"].header-burger span:first-child { transform: translateY(3.5px) rotate(45deg); }
[aria-expanded="true"].header-burger span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

@media (hover: hover) and (pointer: fine) {
  .site-header .nav-link:hover::after { right: 0; }
  .btn-copper:hover { background: var(--primary); color: var(--white); }
  .home-services-teaser .btn-copper:hover { background: var(--white); color: var(--primary); }
  .btn-ink:hover { background: var(--copper); color: var(--white); }
  .btn-ghost-light:hover { background: var(--white); color: var(--primary); }
  .btn-paper:hover { background: var(--copper); color: var(--white); }
  .bento-tile:hover img { transform: scale(1.14); filter: saturate(1.05); }
  .bento-tile:hover::before { background: linear-gradient(180deg, rgba(193,101,43,0.25) 0%, rgba(0,22,28,0.9) 100%); }
  .bento-tile:hover .tile-arrow { transform: translate(4px, -4px); }
  .product-card:hover .img-wrap img { transform: scale(1.08); }
  .product-card:hover .quote-btn { transform: translateY(0); opacity: 1; }
  .filter-pill:hover { color: var(--primary); }
  .service-mosaic-media:hover img { transform: scale(1.04); }
  .whatsapp-fab:hover { transform: scale(1.08); box-shadow: 0 8px 26px rgba(0,0,0,0.3); }
}

@media (hover: none), (pointer: coarse) {
  .product-card .quote-btn { transform: translateY(0); opacity: 1; }
}

/* ---------- Inline icons (replace Font Awesome) ---------- */
.btn-icon { width: 0.95em; height: 0.95em; flex: none; }
.whatsapp-fab .icon { width: 1.75rem; height: 1.75rem; }

/* ---------- Featured rail: fade hints that more cards follow ---------- */
[data-rail-wrap] { position: relative; }
[data-rail-wrap]::after {
  content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: clamp(2rem, 8vw, 6rem);
  background: linear-gradient(90deg, rgba(246,245,241,0), var(--paper)); pointer-events: none;
}
