/* ============================================
   VALFOS S.A. — Design System
   style.css · v1.0
   ============================================ */

/* --- Custom Properties --- */
:root {
  /* Surfaces */
  --bg: #111111;
  --bg-surface: #1a1a1a;
  --bg-elevated: #2a2a2a;
  --bg-light: #ffffff;
  --bg-neutral: #FEF3F4; /* rgba(228,5,25,0.05) sobre blanco — tinte exacto del logo Valfos */
  --bg-dark: #111111;
  --bg-dark-alt: #0d0d0d;

  /* Text hierarchy */
  --text: #f5f5f5;
  --text-secondary: #b0b0b0;
  --text-muted: #777777;
  --text-inverse: #111111;
  --text-on-light: #1a1a1a;
  --text-on-light-secondary: #4a4a4a;
  --text-on-light-muted: #888888;

  /* Brand — rojo exacto del logo Valfos (sampled: RGB 228,5,25) */
  --primary: #E40519;
  --primary-hover: #C00415;
  --primary-subtle: rgba(228, 5, 25, 0.15);
  --secondary: #2a2a2a;
  --accent: #FF3040;

  /* Semantic */
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;

  /* Borders */
  --border: rgba(255, 255, 255, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-on-light: rgba(0, 0, 0, 0.1);
  --border-on-light-subtle: rgba(0, 0, 0, 0.05);

  /* Typography scale (ratio 1.25) */
  --font-display: 'Montserrat', sans-serif;
  --font-body: 'Lato', sans-serif;
  --text-xs: 0.694rem;
  --text-sm: 0.833rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.563rem;
  --text-2xl: 1.953rem;
  --text-3xl: 2.441rem;
  --text-4xl: 3.052rem;
  --text-5xl: 3.815rem;
  --text-6xl: 4.768rem;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Layout */
  --container: 1200px;
  --header-h: 72px;

  /* Transitions */
  --dur-instant: 100ms;
  --dur-fast: 200ms;
  --dur-normal: 300ms;
  --dur-slow: 500ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset --- */
*,
*::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: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.15;
  overflow-wrap: break-word;
}

p { max-width: 70ch; overflow-wrap: break-word; }

/* --- Accessibility --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  z-index: 9999;
  text-decoration: none;
}
.skip-link:focus { top: 0; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section { position: relative; }

.section--light {
  background: var(--bg-light);
  color: var(--text-on-light);
}
.section--light h2,
.section--light h3 { color: var(--text-on-light); }
.section--light p,
.section--light li { color: var(--text-on-light-secondary); }

.section--neutral {
  background: var(--bg-light);
  color: var(--text-on-light);
}
.section--neutral h2,
.section--neutral h3 { color: var(--text-on-light); }
.section--neutral p,
.section--neutral li { color: var(--text-on-light-secondary); }

.section--dark {
  background: var(--bg-dark);
  color: var(--text);
}
.section--dark h2,
.section--dark h3 { color: var(--text); }
.section--dark p,
.section--dark li { color: var(--text-secondary); }

/* --- Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--space-md) 0;
  transition: background var(--dur-normal) var(--ease-out),
              padding var(--dur-normal) var(--ease-out),
              box-shadow var(--dur-normal) var(--ease-out);
}

.site-header.scrolled {
  background: rgba(17, 17, 17, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: var(--space-sm) 0;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}

.site-header.scrolled .site-logo img { height: 60px; width: auto; display: block; }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.site-logo span { color: var(--primary); }
.site-logo img { height: 100px; width: auto; display: block; }

/* --- Navigation --- */
.main-nav { display: none; }

.nav-list {
  display: flex;
  gap: var(--space-xl);
  align-items: center;
}

.nav-list a {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
  transition: color var(--dur-fast) var(--ease-out);
  position: relative;
  padding: var(--space-xs) 0;
}

.nav-list a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width var(--dur-normal) var(--ease-out);
}

.nav-list a:hover,
.nav-list a.active { color: var(--text); }

.nav-list a:hover::after,
.nav-list a.active::after { width: 100%; }

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 28px;
  padding: 8px 4px;
  min-height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform var(--dur-fast) var(--ease-out),
              opacity var(--dur-fast) var(--ease-out);
}

.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); }

/* Mobile nav */
@media (max-width: 767px) {
  .main-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-surface);
    padding: var(--space-4xl) var(--space-xl);
    transition: right var(--dur-normal) var(--ease-out);
    z-index: 999;
    border-left: 1px solid var(--border);
  }
  .main-nav.active { right: 0; display: flex; }
  .nav-list {
    flex-direction: column;
    gap: var(--space-lg);
    align-items: flex-start;
  }
  .nav-list a { font-size: var(--text-base); }
  .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
  }
  .nav-overlay.active { display: block; }
}

@media (min-width: 768px) {
  .main-nav { display: flex !important; }
  .hamburger { display: none; }
  .nav-overlay { display: none !important; }
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  min-height: 48px;
  min-width: 44px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 0;
  transition: background var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
}

.btn i { width: 18px; height: 18px; flex-shrink: 0; }

.btn--primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn--secondary {
  background: transparent;
  border-color: var(--text);
  color: var(--text);
}
.btn--secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn--on-light {
  background: transparent;
  border-color: var(--text-on-light);
  color: var(--text-on-light);
}
.btn--on-light:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* --- WhatsApp Float --- */
.whatsapp-float {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  width: 56px;
  height: 56px;
  background: #25d366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 900;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
  transition: transform var(--dur-fast) var(--ease-spring),
              box-shadow var(--dur-fast) var(--ease-out);
}
.whatsapp-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5);
}
.whatsapp-float svg { width: 28px; height: 28px; }

/* --- Reveal Animations --- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 400ms ease, transform 400ms var(--ease-out);
}
.reveal.revealed { opacity: 1; transform: translateY(0); }

.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 400ms ease, transform 400ms var(--ease-out);
}
.reveal-left.revealed { opacity: 1; transform: translateX(0); }

.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 400ms ease, transform 400ms var(--ease-out);
}
.reveal-right.revealed { opacity: 1; transform: translateX(0); }

.reveal-group .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-group .reveal:nth-child(2) { transition-delay: 80ms; }
.reveal-group .reveal:nth-child(3) { transition-delay: 160ms; }
.reveal-group .reveal:nth-child(4) { transition-delay: 240ms; }

/* --- Footer --- */
.site-footer {
  background: var(--bg-dark-alt);
  color: var(--text-secondary);
  padding: var(--space-3xl) 0 var(--space-lg);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.footer-brand { max-width: 320px; }
.footer-brand .site-logo { display: inline-block; margin-bottom: var(--space-md); }
.footer-brand p { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.6; }

.footer-heading {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: var(--space-md);
}

.footer-links li { margin-bottom: var(--space-sm); }
.footer-links a {
  font-size: var(--text-sm);
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease-out);
}
.footer-links a:hover { color: var(--primary); }

.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  line-height: 1.5;
}
.footer-contact-item i {
  color: var(--primary);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: var(--space-lg);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
}

@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}

/* --- Accessibility: Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* --- Accessibility: High Contrast --- */
@media (prefers-contrast: more) {
  :root {
    --text: #ffffff;
    --text-secondary: #e0e0e0;
    --border: #ffffff;
  }
}
