/* ============================================================
   FRANJA Construcciones — Design System
   Corporativo moderno · naranja construcción + negro + concreto
   ============================================================ */

:root {
  /* Brand */
  --fj-orange: #F26A1F;        /* naranja construcción (del logo) */
  --fj-orange-deep: #D9551A;
  --fj-amber: #F5A623;         /* acento secundario del logo */
  --fj-black: #0A0A0B;         /* negro casi puro */
  --fj-ink: #17181A;           /* texto principal */
  --fj-graphite: #2A2C31;      /* gris oscuro estructural */

  /* Concrete scale — inspirado en concreto/hormigón */
  --fj-c-50:  #FAFAF7;
  --fj-c-100: #F3F2EC;
  --fj-c-200: #E7E5DC;
  --fj-c-300: #D4D1C4;
  --fj-c-400: #A8A59A;
  --fj-c-500: #7A7870;
  --fj-c-600: #555449;
  --fj-c-700: #3B3A34;

  /* Semantic */
  --fj-bg: var(--fj-c-50);
  --fj-surface: #FFFFFF;
  --fj-border: var(--fj-c-200);
  --fj-border-strong: var(--fj-c-300);
  --fj-text: var(--fj-ink);
  --fj-text-muted: var(--fj-c-600);
  --fj-text-dim: var(--fj-c-500);

  /* Type */
  --fj-sans: "Space Grotesk", "Helvetica Neue", system-ui, sans-serif;
  --fj-serif: "Instrument Serif", Georgia, serif;
  --fj-mono: "JetBrains Mono", ui-monospace, monospace;
  --fj-display: "Montserrat", "Helvetica Neue", system-ui, sans-serif;
  --fj-display-weight: 800;
  --fj-display-tracking: 0.02em;

  /* Panel de sección grande (Contacto) — distinto de las tarjetas */
  --fj-panel: #FFFFFF;

  /* Mapa (Contacto) — adaptable a tema */
  --fj-map-bg: #F3F2EC;
  --fj-map-road: #FFFFFF;
  --fj-map-block: #E7E5DC;
  --fj-map-line: rgba(10,10,11,0.07);
  --fj-map-text: #555449;

  /* Geometry */
  --fj-radius-sm: 4px;
  --fj-radius: 8px;
  --fj-radius-lg: 14px;
  --fj-max: 1400px;

  /* Motion */
  --fj-ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

/* ============================================================
   TEMA OSCURO — sistema de elevación cohesivo (no una simple
   inversión). 4 niveles: bandas profundas < base < tinte < tarjeta.
   ============================================================ */
[data-theme="dark"] {
  --fj-c-50:  #14161C;   /* dashboard body */
  --fj-c-100: #181B22;   /* tinte de sección */
  --fj-c-200: #2C3038;   /* border */
  --fj-c-300: #3A3F49;   /* border fuerte */
  --fj-c-400: #565C66;
  --fj-c-500: #7C818B;   /* texto dim */
  --fj-c-600: #A6AAB3;   /* texto muted */
  --fj-c-700: #D2D5DA;

  --fj-bg: #111318;       /* base de página */
  --fj-surface: #1E212A;  /* tarjetas (claramente elevadas) */
  --fj-panel: #14161C;    /* paneles de sección grandes */
  --fj-border: #2C3038;
  --fj-border-strong: #3A3F49;
  --fj-ink: #ECEDEF;
  --fj-text: #ECEDEF;
  --fj-text-muted: #A6AAB3;
  --fj-text-dim: #7C818B;

  --fj-map-bg: #14161C;
  --fj-map-road: #2C3038;
  --fj-map-block: #20242C;
  --fj-map-line: rgba(255,255,255,0.06);
  --fj-map-text: #7C818B;

  color-scheme: dark;
}

/* Las secciones "siempre oscuras" pasan a ser la CAPA MÁS PROFUNDA,
   con separadores hairline para crear ritmo entre bandas oscuras. */
[data-theme="dark"] .fj-section-dark { background: #0B0C0F; border-block: 1px solid var(--fj-border); }
[data-theme="dark"] .fj-footer { background: #0B0C0F; border-top: 1px solid var(--fj-border); }
[data-theme="dark"] .fj-hero { background: radial-gradient(140% 120% at 85% 0%, #181B22 0%, #0B0C0F 62%);
  border-bottom: 1px solid var(--fj-border); }

/* Edge cases que invierten mal con el remapeo de tokens */
[data-theme="dark"] .fj-nav { background: rgba(13,14,17,0.86); }
[data-theme="dark"] .fj-nav.scrolled { background: rgba(13,14,17,0.95); }
[data-theme="dark"] .fj-btn-ghost { color: var(--fj-text); border-color: var(--fj-border-strong); }
[data-theme="dark"] .fj-btn-ghost:hover { background: var(--fj-surface); color: var(--fj-text); border-color: var(--fj-c-400); }
[data-theme="dark"] .fj-btn-dark { background: var(--fj-surface); color: var(--fj-text); border: 1px solid var(--fj-border-strong); }
[data-theme="dark"] .fj-btn-dark:hover { background: var(--fj-c-200); }
[data-theme="dark"] .fj-ct-types button.on { background: var(--fj-orange); color: #fff; border-color: var(--fj-orange); }
[data-theme="dark"] .fj-btn-white { background: var(--fj-surface); color: var(--fj-text); }
/* La grilla técnica resalta un poco más sobre las bandas profundas */
[data-theme="dark"] .fj-tech-grid {
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.04) 1px, transparent 1px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--fj-sans);
  color: var(--fj-text);
  background: var(--fj-bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "ss02";
  line-height: 1.5;
  transition: background 300ms var(--fj-ease), color 300ms var(--fj-ease);
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font-family: inherit; }

/* ============================================================
   Accesibilidad (WCAG 2.1 AA) — focus visible, skip link, sr-only,
   prefers-reduced-motion, scroll padding
   ============================================================ */
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Focus visible — anillo naranja con contraste alto */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--fj-orange);
  outline-offset: 2px;
  border-radius: 4px;
}
.fj-section-dark :focus-visible {
  outline-color: var(--fj-amber);
}

/* Skip link — saltar al contenido principal */
.fj-skip {
  position: fixed; top: 8px; left: 8px; z-index: 1000;
  background: var(--fj-orange); color: white;
  padding: 12px 18px; border-radius: var(--fj-radius);
  font-size: 14px; font-weight: 600;
  transform: translateY(-200%); transition: transform 200ms var(--fj-ease);
}
.fj-skip:focus { transform: translateY(0); }

/* Screen-reader only */
.fj-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;
}

/* Utilities */
.fj-container { max-width: var(--fj-max); margin: 0 auto; padding: 0 32px; }
@media (max-width: 720px) { .fj-container { padding: 0 20px; } }

.fj-eyebrow {
  font-family: var(--fj-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fj-orange);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.fj-eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: var(--fj-orange);
}

.fj-h-display {
  font-family: var(--fj-sans);
  font-weight: 500;
  font-size: clamp(44px, 6.5vw, 96px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin: 0;
  text-wrap: balance;
}
.fj-h1 { font-weight: 500; font-size: clamp(36px, 4.5vw, 64px); line-height: 1.02; letter-spacing: -0.03em; margin: 0; text-wrap: balance; }
.fj-h2 { font-weight: 500; font-size: clamp(28px, 3.2vw, 44px); line-height: 1.05; letter-spacing: -0.025em; margin: 0; text-wrap: balance; }
.fj-h3 { font-weight: 500; font-size: 22px; line-height: 1.2; letter-spacing: -0.015em; margin: 0; }
.fj-italic { font-family: var(--fj-serif); font-style: italic; font-weight: 400; }

.fj-brand-display {
  font-family: var(--fj-display);
  font-weight: var(--fj-display-weight, 800);
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: var(--fj-display-tracking, 0.02em);
  color: var(--fj-text);
  display: inline-block;
  line-height: 0.95;
}

/* FRANJA — tratamiento de marca consistente en TODA mención inline.
   Aplicado vía <FB/> o renderBrand() de brand.jsx. */
.fj-brand {
  font-family: var(--fj-display);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-style: normal;
  color: inherit;
}

.fj-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: transform 160ms var(--fj-ease), background 160ms, color 160ms;
  white-space: nowrap;
}
.fj-btn svg { width: 16px; height: 16px; }
.fj-btn-primary { background: var(--fj-orange); color: white; }
.fj-btn-primary:hover { background: var(--fj-orange-deep); transform: translateY(-1px); }
.fj-btn-dark { background: var(--fj-black); color: white; }
.fj-btn-dark:hover { background: var(--fj-graphite); transform: translateY(-1px); }
.fj-btn-ghost { background: transparent; color: var(--fj-ink); border: 1px solid var(--fj-border-strong); }
.fj-btn-ghost:hover { background: var(--fj-ink); color: white; border-color: var(--fj-ink); }
.fj-btn-white { background: white; color: var(--fj-ink); }
.fj-btn-white:hover { background: var(--fj-c-100); }

.fj-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--fj-c-100);
  font-size: 12px;
  font-family: var(--fj-mono);
  color: var(--fj-text-muted);
  border: 1px solid var(--fj-border);
}
.fj-chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fj-orange); }

.fj-section { padding: 120px 0; position: relative; z-index: 1; }
/* Capa opaca que cubre la imagen cinema al hacer scroll (sticky reveal) */
.fj-after-cinema { position: relative; z-index: 1; background: var(--fj-bg); }
/* Sección que va SOBRE la imagen del hero (segunda sección): velo translúcido + texto claro */
.fj-on-image { position: relative; z-index: 1; background: linear-gradient(180deg, rgba(10,10,11,0.55) 0%, rgba(10,10,11,0.78) 100%); }
.fj-on-image .fj-h-display { color: #FFFFFF; }
.fj-on-image .fj-lede { color: rgba(255,255,255,0.86); }
/* Heimdall — acento de producto (distinto del naranja de FRANJA) */
.fj-heimdall { color: #5AD1FF; font-weight: 700; }
@media (max-width: 720px) { .fj-section { padding: 72px 0; } }
.fj-section-dark { background: var(--fj-black); color: white; }
.fj-section-dark .fj-eyebrow { color: var(--fj-amber); }
.fj-section-dark .fj-eyebrow::before { background: var(--fj-amber); }

/* Grain/noise overlay for hero */
.fj-grain {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='240' height='240' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* Technical grid lines */
.fj-tech-grid {
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.04) 1px, transparent 1px);
  background-size: 64px 64px;
}
.fj-section-dark .fj-tech-grid {
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
}

/* Reveal animation — solo transform; el contenido NUNCA queda oculto
   aunque el navegador pause las animaciones (iframe sin foco, etc.) */
@keyframes fj-rise {
  from { transform: translateY(18px); }
  to   { transform: translateY(0); }
}
.fj-rise { animation: fj-rise 700ms var(--fj-ease) both; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--fj-c-300); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--fj-c-400); }

/* Placeholder image treatment — instead of real photos we render stylized concrete cards */
.fj-photo {
  position: relative;
  overflow: hidden;
  border-radius: var(--fj-radius);
  background: linear-gradient(135deg, #2A2C31 0%, #1A1B1D 100%);
  color: rgba(255,255,255,0.35);
  display: flex;
  align-items: flex-end;
  font-family: var(--fj-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.fj-photo::before {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(135deg, transparent 40%, rgba(242,106,31,0.12) 100%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0 2px, transparent 2px 8px);
}
.fj-photo::after {
  content: "";
  position: absolute;
  top: 20px; right: 20px;
  width: 10px; height: 10px;
  background: var(--fj-orange);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(242,106,31,0.2);
}
.fj-photo-label {
  position: relative;
  z-index: 1;
  padding: 16px 20px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: rgba(255,255,255,0.6);
}
.fj-photo-label .idx {
  font-family: var(--fj-mono);
  color: var(--fj-orange);
}
