/* =========================================================
   territoriorfaf — página "web en obras"
   ========================================================= */

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-hover: #1a1a1a;
  --line: #1e1e1e;
  --text: #ffffff;
  --muted: #c4c4c4;
  --dim: #8a8a8a;

  --green: #6ccf63;
  --green-rgb: 108 207 99;
  --blue: #1f6fe0;
  --blue-soft: #6aa5ff;
  --yellow: #e2b62a;
  --ink: #0a0a0a;

  --container: 920px;
  --gutter: 20px;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);

  --font-display: "Anton", Impact, "Arial Narrow Bold", sans-serif;
  --font-body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

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

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.caps {
  font-stretch: 125%;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .2em;
}

/* ---------- Franja de obras (arriba) ---------- */

.hazard {
  position: relative;
  z-index: 2;
  flex: none;
  height: 10px;
  overflow: hidden;
  transform-origin: top;
  animation: grow-y .6s var(--ease-out) both;
}

.hazard::before {
  content: "";
  position: absolute;
  inset: 0 0 0 -32px;
  background:
    linear-gradient(135deg,
      var(--green) 25%, transparent 25%,
      transparent 50%, var(--green) 50%,
      var(--green) 75%, transparent 75%)
    0 0 / 32px 32px;
  animation: conveyor 1.6s linear infinite;
}

/* ---------- Fondo: campo + brillo ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(55% 45% at 22% 58%, rgb(var(--green-rgb) / .07), transparent 70%),
    radial-gradient(45% 40% at 82% 56%, rgb(31 111 224 / .06), transparent 70%);
  animation: fade 2s ease .2s both;
}

.pitch {
  position: absolute;
  top: 52%;
  left: 50%;
  width: min(1400px, 160vw);
  height: auto;
  translate: -50% -50%;
  -webkit-mask-image: radial-gradient(ellipse 58% 62% at 50% 50%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 58% 62% at 50% 50%, #000 25%, transparent 78%);
}

.pitch > :not(.spot) {
  fill: none;
  stroke: rgb(255 255 255 / .06);
  stroke-width: 1.4;
  stroke-dasharray: 1;
  animation: draw 2.4s var(--ease-in-out) calc(.2s + var(--d, 0s)) both;
}

.pitch .spot {
  fill: rgb(255 255 255 / .08);
  animation: fade 1s ease 1.4s both;
}

.glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 640px;
  height: 640px;
  margin: -320px 0 0 -320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(var(--green-rgb) / .1), transparent 62%);
  opacity: 0;
  transition: opacity .8s ease;
  will-change: transform;
}

.glow.is-on {
  opacity: 1;
}

/* ---------- Cabecera ---------- */

.site-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
}

/* El logo se pinta dos veces con máscaras: el aro gira y el escudo queda fijo */
.logo {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
}

.logo img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.logo-ring {
  -webkit-mask-image: radial-gradient(circle closest-side, transparent 73.5%, #000 74%);
  mask-image: radial-gradient(circle closest-side, transparent 73.5%, #000 74%);
  animation:
    ring-in 1.2s var(--ease-out) .1s both,
    turn 18s linear 1.3s infinite;
}

.logo-crest {
  -webkit-mask-image: radial-gradient(circle closest-side, #000 73.5%, transparent 74%);
  mask-image: radial-gradient(circle closest-side, #000 73.5%, transparent 74%);
  transition: scale .5s var(--ease-back);
  animation: pop-in .7s var(--ease-back) .55s both;
}

.brand:hover .logo-crest {
  scale: 1.12;
}

.brand-text {
  display: block;
  animation: fade-right .8s var(--ease-out) .3s both;
}

.brand-name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.005em;
}

.brand-tag {
  display: block;
  margin-top: 2px;
  white-space: nowrap;
  font-size: 9.5px;
  letter-spacing: .18em;
  color: var(--green);
}

.season {
  flex: none;
  margin: 0;
  font-size: 9.5px;
  letter-spacing: .22em;
  color: var(--dim);
  text-align: right;
  white-space: nowrap;
  animation: fade-down .8s var(--ease-out) .4s both;
}

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

.hero {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-content: center;
  align-items: center;
  column-gap: clamp(40px, 9vw, 96px);
  row-gap: 56px;
  padding-block: clamp(40px, 8vh, 96px);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 10.5px;
  letter-spacing: .3em;
  color: var(--green);
}

.eyebrow-dot {
  --pulse: rgb(var(--green-rgb) / .6);
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--green);
  animation:
    pop .6s var(--ease-back) .35s both,
    beacon 1.8s ease-out 1.4s infinite;
}

.eyebrow-text {
  animation: track-in 1.1s var(--ease-out) .45s both;
}

.headline {
  margin: 18px 0 30px;
  font-family: var(--font-display);
  font-size: clamp(72px, 11.6vw, 116px);
  font-weight: 400;
  line-height: .92;
  letter-spacing: .005em;
  text-transform: uppercase;
}

.headline .row {
  display: block;
  white-space: nowrap;
}

.headline .ch {
  display: inline-block;
}

/* "WEB EN": las letras suben desde una máscara */
.row--rise {
  clip-path: inset(-.3em -.2em 0 -.2em);
}

.row--rise .ch {
  animation: rise .95s var(--ease-out) calc(.45s + var(--i) * .055s) both;
}

/* "OBRAS": las letras caen como ladrillos y rebotan (sin pisar la línea de arriba) */
.row--drop {
  clip-path: inset(0 -.2em -.3em -.2em);
  color: var(--green);
}

.row--drop .ch {
  animation: drop 1.1s linear calc(.85s + var(--i) * .09s) both;
}

.intro-done .row {
  clip-path: none;
}

.intro-done .headline .ch {
  animation: none;
}

.intro-done .headline .ch.is-hopping {
  animation: hop .6s var(--ease-out);
}

.lead {
  max-width: 30em;
  margin: 0 0 28px;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--muted);
  animation: blur-in 1s var(--ease-out) 1.1s both;
}

.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  overflow: hidden;
  background: var(--green);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .16em;
  text-decoration: none;
  translate: var(--mx, 0px) var(--my, 0px);
  transition:
    translate .4s var(--ease-out),
    scale .2s var(--ease-out),
    background-color .25s ease,
    box-shadow .35s ease;
  animation: fade-up .8s var(--ease-out) 1.3s both;
}

.cta::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / .55), transparent);
  transform: translateX(-150%) skewX(-20deg);
  pointer-events: none;
  animation: shine 4.5s ease-in-out 2.4s infinite;
}

.cta:hover {
  background: #80df77;
  box-shadow: 0 12px 32px -12px rgb(var(--green-rgb) / .7);
}

.cta:active {
  scale: .97;
}

.cta-arrow {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: square;
  transition: translate .4s var(--ease-out);
}

.cta:hover .cta-arrow {
  translate: 4px 0;
}

/* ---------- Calendario semanal ---------- */

.schedule {
  --sd: .7s; /* retardo base de la sección */
}

/* En móvil la sección queda bajo el pliegue: se anima al hacer scroll */
.schedule.is-deferred {
  --sd: .05s;
}

.is-waiting,
.is-waiting *,
.is-waiting *::before,
.is-waiting *::after {
  animation-play-state: paused !important;
}

.schedule-title {
  position: relative;
  margin: 0 0 12px;
  padding-bottom: 10px;
  clip-path: inset(-.3em -.2em 0 -.2em);
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 38px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: .005em;
  text-transform: uppercase;
}

.schedule-title-text {
  display: block;
  animation: rise-title .9s var(--ease-out) var(--sd) both;
}

.schedule-title::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--green);
  transform-origin: left;
  animation: grow-x 1s var(--ease-in-out) calc(var(--sd) + .2s) both;
}

.days {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.day {
  --c: var(--green);
  --on-c: var(--ink);
  --label: var(--green);

  position: relative;
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  min-height: 68px;
  overflow: hidden;
  background: var(--surface);
  transition: background-color .3s ease, translate .45s var(--ease-out), box-shadow .3s ease;
  animation: slide-in .9s var(--ease-out) calc(var(--sd) + .35s + var(--i) * .12s) both;
}

.day:hover {
  background: var(--surface-hover);
  translate: -5px 0;
}

.day--blue {
  --c: var(--blue);
  --on-c: #fff;
  --label: var(--blue-soft);
}

.day--yellow {
  --c: var(--yellow);
  --label: var(--yellow);
}

.day-tag {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 10px 14px;
  overflow: hidden;
  background: var(--c);
  color: var(--on-c);
  animation: wipe .8s var(--ease-in-out) calc(var(--sd) + .5s + var(--i) * .12s) both;
}

/* Rayas de obra que aparecen al pasar el ratón */
.day-tag::after {
  content: "";
  position: absolute;
  inset: 0 0 0 -24px;
  background:
    linear-gradient(135deg,
      rgb(0 0 0 / .13) 25%, transparent 25%,
      transparent 50%, rgb(0 0 0 / .13) 50%,
      rgb(0 0 0 / .13) 75%, transparent 75%)
    0 0 / 24px 24px;
  opacity: 0;
  transition: opacity .3s ease;
  animation: conveyor-sm 1s linear infinite paused;
}

.day:hover .day-tag::after {
  opacity: 1;
  animation-play-state: running;
}

.day-meta,
.day-name {
  position: relative;
  z-index: 1;
}

.day-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.day-num {
  font-size: 8.5px;
  letter-spacing: .18em;
}

.day-name {
  display: block;
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  text-transform: uppercase;
  animation: rise-sm .7s var(--ease-out) calc(var(--sd) + .75s + var(--i) * .12s) both;
}

.day-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 10px 18px;
}

.day-body > * {
  animation: fade-left .7s var(--ease-out) calc(var(--sd) + .8s + var(--i) * .12s) both;
}

.day-label {
  font-size: 9px;
  color: var(--label);
}

.day-text {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

/* Tarjeta del día de hoy (la marca main.js) */
.day.is-today {
  box-shadow: inset 0 0 0 1px rgb(var(--green-rgb) / .35);
}

.day-today {
  --pulse: var(--c);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px 2px 4px;
  background: var(--on-c);
  color: var(--c);
  font-size: 8px;
  letter-spacing: .16em;
  animation: pop-in .5s var(--ease-back) calc(var(--sd) + 1.3s) both;
}

.day-today::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: beacon 1.6s ease-out calc(var(--sd) + 1.8s) infinite;
}

/* ---------- Pie ---------- */

.site-footer {
  position: relative;
  z-index: 1;
  flex: none;
}

.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
  transform-origin: left;
  animation: grow-x 1.4s var(--ease-in-out) 1.3s both;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  padding-block: 18px calc(18px + env(safe-area-inset-bottom));
  font-size: 11.5px;
  color: var(--dim);
  animation: fade 1s ease 1.6s both;
}

.site-footer p {
  margin: 0;
}

.footer-link {
  padding-bottom: 2px;
  color: var(--green);
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .4s var(--ease-out);
}

.footer-link:hover {
  background-size: 100% 1px;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding-block: 32px 56px;
  }

  .headline {
    font-size: clamp(64px, 24vw, 116px);
  }
}

@media (max-width: 480px) {
  .season span {
    display: block;
  }

  .brand-tag {
    letter-spacing: .12em;
  }

  .lead {
    font-size: 15px;
  }

  .day {
    grid-template-columns: 116px minmax(0, 1fr);
  }

  .day-name {
    font-size: 22px;
  }

  .day-body {
    padding-inline: 14px;
  }

  .day-text {
    font-size: 14px;
  }
}

@media (max-width: 359px) {
  .season {
    display: none;
  }
}

/* ---------- Estado inicial ---------- */

/* Con JS, todo espera congelado en su primer fotograma hasta que cargan las fuentes */
.js:not(.is-ready) *,
.js:not(.is-ready) *::before,
.js:not(.is-ready) *::after {
  animation-play-state: paused !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* ---------- Keyframes ---------- */

@keyframes fade {
  from { opacity: 0; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
}

@keyframes fade-down {
  from { opacity: 0; transform: translateY(-12px); }
}

@keyframes fade-right {
  from { opacity: 0; transform: translateX(-12px); }
}

@keyframes fade-left {
  from { opacity: 0; transform: translateX(14px); }
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(44px); }
}

@keyframes blur-in {
  from { opacity: 0; filter: blur(8px); transform: translateY(8px); }
}

@keyframes track-in {
  from { opacity: 0; letter-spacing: .9em; }
}

@keyframes pop {
  from { opacity: 0; transform: scale(.3) rotate(-90deg); }
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(.5); }
}

@keyframes rise {
  from { transform: translateY(105%); }
}

@keyframes rise-title {
  from { transform: translateY(110%); }
}

@keyframes rise-sm {
  from { opacity: 0; transform: translateY(70%); }
}

@keyframes drop {
  0% {
    opacity: 0;
    transform: translateY(-115%) rotate(var(--r, 0deg));
    animation-timing-function: cubic-bezier(.55, 0, .9, .45);
  }
  12% {
    opacity: 1;
  }
  48% {
    transform: translateY(0) rotate(0deg);
    animation-timing-function: cubic-bezier(.1, .55, .45, 1);
  }
  64% {
    transform: translateY(-9%) rotate(calc(var(--r, 0deg) * -.25));
    animation-timing-function: cubic-bezier(.55, 0, .9, .45);
  }
  78% {
    transform: translateY(0) rotate(0deg);
    animation-timing-function: cubic-bezier(.1, .55, .45, 1);
  }
  88% {
    transform: translateY(-2.5%);
    animation-timing-function: cubic-bezier(.55, 0, .9, .45);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes hop {
  0%, 100% { transform: none; }
  30% { transform: translateY(-16%) rotate(-5deg); }
  60% { transform: translateY(3%) rotate(2deg); }
  80% { transform: translateY(-3%); }
}

@keyframes wipe {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes grow-x {
  from { transform: scaleX(0); }
}

@keyframes grow-y {
  from { transform: scaleY(0); }
}

@keyframes draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes ring-in {
  from { opacity: 0; transform: rotate(-200deg) scale(.6); }
}

@keyframes turn {
  to { rotate: 360deg; }
}

@keyframes conveyor {
  to { transform: translateX(32px); }
}

@keyframes conveyor-sm {
  to { transform: translateX(24px); }
}

@keyframes beacon {
  0% { box-shadow: 0 0 0 0 var(--pulse, rgb(var(--green-rgb) / .6)); }
  80%, 100% { box-shadow: 0 0 0 8px transparent; }
}

@keyframes shine {
  0% { transform: translateX(-150%) skewX(-20deg); }
  30%, 100% { transform: translateX(350%) skewX(-20deg); }
}
