/* ============================================
   barn78 — estilos
   ============================================ */

:root {
  --green: #00ff1a;
  --black: #000000;
  --bg: #000000;
  --header-h: 84px;
  --container: 1400px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--green);
  font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--green);
  color: #000;
  padding: 10px 16px;
  z-index: 999;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

a { color: inherit; text-decoration: none; }

/* ---------- Cabecera ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--black);
  border-bottom: 1px solid rgba(0,255,26,0.15);
}

.header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 32px;
  max-width: var(--container);
  margin: 0 auto;
}

.header__bar {
  display: block;
  background: var(--green);
  height: 38px;
  border-radius: 2px;
  transition: opacity .2s ease, transform .2s ease;
  flex: 0 0 auto;
}
.header__bar:hover { opacity: .8; }

.header__bar--left {
  width: 20%;
  max-width: 190px;
  min-width: 80px;
}

.header__bar--right {
  width: 150px;
}

.nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

.nav__list {
  list-style: none;
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
}

.nav__list a {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--green);
  text-transform: lowercase;
}
.nav__list a:hover { text-decoration: underline; }

.header__right {
  display: flex;
  align-items: center;
  gap: 22px;
  flex: 0 0 auto;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 26px;
  height: 26px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav__toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--green);
}

/* ---------- Portada ---------- */
.hero {
  padding: 64px 24px 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: var(--container);
  margin: 0 auto;
}

.hero__wordmark {
  width: min(46%, 560px);
  min-width: 220px;
  height: auto;
}

/* ---------- Carrusel ---------- */
.carousel-section {
  border-top: 1px solid var(--green);
  border-bottom: 1px solid var(--green);
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.carousel {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
  touch-action: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel.is-dragging { cursor: grabbing; }

.carousel__track {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  width: max-content;
}

.carousel__slide {
  position: relative;
  flex: 0 0 auto;
  width: 20vw;
  min-width: 220px;
  max-width: 340px;
  aspect-ratio: 1 / 0.82;
  border-left: 1px solid var(--green);
  cursor: zoom-in;
  overflow: hidden;
}
.carousel__slide:first-child { border-left: none; }

.carousel__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: clip-path .85s cubic-bezier(.16,1,.3,1), opacity .5s ease, transform .5s ease;
  user-select: none;
  -webkit-user-drag: none;
}
.carousel__slide.pixel-hidden img {
  opacity: 0;
  clip-path: inset(0 100% 0 0);
}
.carousel__slide:hover img { transform: scale(1.045); }

@media (prefers-reduced-motion: reduce) {
  .carousel__slide.pixel-hidden img {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transition: none;
  }
}

.carousel__cta {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  text-shadow: 0 0 6px rgba(0,0,0,.9);
  pointer-events: none;
}

.carousel__dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 26px 24px 48px;
}

.carousel__dots button {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(0,255,26,0.35);
  cursor: pointer;
  padding: 0;
}
.carousel__dots button[aria-selected="true"] {
  background: var(--green);
}

/* ---------- Gráfico decorativo escalonado ---------- */
.stairs-section {
  max-width: var(--container);
  margin: 0 auto;
  padding: 56px 24px 72px;
}

.stairs {
  position: relative;
  width: min(82%, 980px);
  aspect-ratio: 1054 / 313;
  margin-left: 0;
}

.stairs__block {
  position: absolute;
  background: var(--green);
}

/* Proporciones medidas sobre la referencia (incluye el bloque extra de la derecha) */
.stairs__block--a { left: 29.99%; width: 7.5%;  top: 0;      height: 58.2%; }
.stairs__block--b { left: 30%; width: 31.3%; top: 9.6%;   height: 15%;   }
.stairs__block--c { left: 0;      width: 30%;   top: 59.4%;  height: 15%; }
.stairs__block--d { left: 78%;  width: 22%; top: 83.1%;  height: 15%; }

/* ---------- Secciones de contenido ---------- */
.section {
  padding: 90px 24px;
  border-top: 1px solid rgba(0,255,26,0.15);
}
.section--alt { background: #050505; }

.section__inner {
  max-width: 760px;
  margin: 0 auto;
}

.section h2 {
  font-size: clamp(28px, 4vw, 42px);
  margin: 0 0 20px;
  color: var(--green);
}

.section p {
  color: #d7ffe0;
  line-height: 1.65;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 400;
  font-size: 16px;
}

.services-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 36px;
}
.services-list h3 {
  color: var(--green);
  margin: 0 0 8px;
  font-size: 20px;
}
.services-list p {
  margin: 0;
}

.contact-btn {
  display: inline-block;
  margin-top: 18px;
  padding: 14px 26px;
  background: var(--green);
  color: #000;
  font-weight: 700;
  border-radius: 2px;
}
.contact-btn:hover { opacity: .85; }

/* ---------- Pie de página ---------- */
.footer {
  padding: 28px 24px;
  text-align: center;
  font-size: 12px;
  color: rgba(0,255,26,0.5);
  font-family: Arial, Helvetica, sans-serif;
}

/* ---------- Ventana emergente: restauración ---------- */
.restore-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.restore-modal.is-open { display: flex; }

.restore-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  opacity: 0;
  animation: restoreFadeIn .35s ease forwards;
}

.restore-modal__panel {
  position: relative;
  width: min(94%, 920px);
  max-height: 90vh;
  background: #050505;
  border: 1px solid var(--green);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  transform: scale(.9);
  opacity: 0;
  animation: restorePopIn .4s cubic-bezier(.16,1,.3,1) .05s forwards;
}

@keyframes restoreFadeIn {
  to { opacity: 1; }
}
@keyframes restorePopIn {
  to { transform: scale(1); opacity: 1; }
}

.restore-modal__label {
  margin: 0;
  color: var(--green);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.restore-modal__close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--green);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.restore-modal__close:hover { opacity: .8; }
.restore-modal__close:focus {
  outline: none;
}
.restore-modal__close:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.restore-modal__stage {
  position: relative;
  background: #000;
  border: 1px solid rgba(0,255,26,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  max-height: 60vh;
  overflow: hidden;
}

.restore-modal__img {
  max-width: 100%;
  max-height: 60vh;
  display: block;
  animation: restoreImgIn .4s ease;
}
@keyframes restoreImgIn {
  from { opacity: 0; transform: scale(1.02); }
  to   { opacity: 1; transform: scale(1); }
}

.restore-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.55);
  border: 1px solid var(--green);
  color: var(--green);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}
.restore-modal__nav:hover { background: rgba(0,255,26,0.15); }
.restore-modal__nav:focus { outline: none; }
.restore-modal__nav:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.restore-modal__nav--prev { left: 10px; }
.restore-modal__nav--next { right: 10px; }

.restore-modal__caption {
  margin: 0;
  color: #d7ffe0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

.restore-modal__thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.restore-modal__thumb {
  width: 64px;
  height: 44px;
  border: 1px solid rgba(0,255,26,0.35);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  padding: 0;
  opacity: .6;
  transition: opacity .2s ease, border-color .2s ease;
}
.restore-modal__thumb:hover { opacity: .85; }
.restore-modal__thumb[aria-selected="true"] {
  opacity: 1;
  border-color: var(--green);
}

@media (max-width: 720px) {
  .restore-modal { padding: 12px; }
  .restore-modal__panel { padding: 16px; gap: 10px; }
  .restore-modal__stage { min-height: 160px; }
  .restore-modal__nav { width: 32px; height: 32px; }
}

/* ============================================
   Tablet (pantallas medianas)
   ============================================ */
@media (max-width: 1024px) {
  .header__inner { padding: 0 20px; }
  .nav__list { gap: 18px; }
  .hero { padding: 48px 20px 32px; }
  .hero__wordmark { width: 52%; }
  .stairs { width: 90%; margin-left: 0; }
  .carousel-section { padding: 0 20px; }
}

/* ============================================
   Móvil
   ============================================ */
@media (max-width: 720px) {
  :root { --header-h: 64px; }

  .header__inner { padding: 0 16px; gap: 12px; }

  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--black);
    border-bottom: 1px solid var(--green);
    justify-content: flex-start;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .nav.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  .nav__list {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }
  .nav__list a {
    display: block;
    padding: 16px 20px;
    font-size: 15px;
    border-bottom: 1px solid rgba(0,255,26,0.12);
  }

  .nav__toggle { display: flex; }

  .header__bar--left { width: 40%; min-width: 70px; height: 30px; }
  .header__bar--right { display: none; }

  .hero { padding: 40px 16px 24px; }
  .hero__wordmark { width: 72%; }

  .carousel-section { padding: 0 16px; }
  .carousel__slide { width: 78%; min-width: 240px; }

  .stairs {
    width: 88%;
    margin-left: 2%;
    aspect-ratio: 870 / 372;
  }
  .stairs__block--a { left: 43.4%; width: 13.7%; top: 0;     height: 68%;   }
  .stairs__block--b { left: 43.4%; width: 56.6%; top: 10.8%; height: 18%;   }
  .stairs__block--c { left: 0;     width: 43.8%; top: 69.1%; height: 30.9%; }
  .stairs__block--d { display: none; }

  .section { padding: 64px 18px; }
}

/* ============================================
   Animación de entrada (móvil y tablet, vertical u horizontal)
   ============================================ */
.intro-mobile {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.intro-mobile.is-active { display: flex; }
.intro-mobile.is-leaving {
  animation: introFadeOut .5s ease forwards;
}

/* "Lienzo" con las proporciones de un móvil (408:850) por defecto,
   centrado y acotado por ancho Y alto a la vez, para que no se
   estire. En pantallas de tablet se ensancha (ver media queries
   más abajo). */
.intro-mobile__canvas {
  position: relative;
  width: min(90vw, 460px, calc(90vh * 0.48));
  aspect-ratio: 408 / 850;
}

/* Tablet en vertical: más ancho que un móvil, no tan estrecho */
@media (min-width: 700px) and (orientation: portrait) {
  .intro-mobile__canvas {
    width: min(80vw, 680px, calc(80vh * 0.66));
    aspect-ratio: 2 / 3;
  }
}

/* Tablet en horizontal: mucho más espacio a lo ancho que a lo alto */
@media (min-width: 700px) and (orientation: landscape) {
  .intro-mobile__canvas {
    width: min(70vw, 780px, calc(80vh * 1.05));
    aspect-ratio: 21 / 20;
  }
}

.intro-mobile__bar,
.intro-mobile__block {
  position: absolute;
  background: var(--green);
  opacity: 0;
}

.intro-mobile__bar--top {
  left: 69.1%; width: 11%; top: 2%; height: 16.1%;
  transform: scaleY(0);
  transform-origin: top;
  animation: introGrowY .5s cubic-bezier(.16,1,.3,1) .1s forwards;
}
.intro-mobile__bar--menu {
  left: 5.4%; width: 44.6%; top: 26.9%; height: 7.8%;
  transform: scaleX(0);
  transform-origin: left;
  animation: introGrowX .45s cubic-bezier(.16,1,.3,1) .55s forwards;
}
.intro-mobile__logo {
  position: absolute;
  left: 65.4%; width: 19.4%; top: 26.5%; height: auto;
  opacity: 0;
  transform: scale(.6);
  animation: introPop .45s cubic-bezier(.16,1,.3,1) .8s forwards;
}
.intro-mobile__block--1 {
  left: 5.4%; width: 25.2%; top: 52.5%; height: 6.7%;
  transform: scaleX(0);
  transform-origin: left;
  animation: introGrowX .35s cubic-bezier(.16,1,.3,1) 1.1s forwards;
}
.intro-mobile__block--2 {
  left: 30.9%; width: 17.2%; top: 59.2%; height: 1.5%;
  transform: scaleX(0);
  transform-origin: left;
  animation: introGrowX .3s cubic-bezier(.16,1,.3,1) 1.3s forwards;
}
.intro-mobile__block--3 {
  left: 68.1%; width: 14.7%; top: 55.4%; height: 41.5%;
  transform: scaleY(0);
  transform-origin: bottom;
  animation: introGrowY .5s cubic-bezier(.16,1,.3,1) 1.45s forwards;
}

@keyframes introGrowY {
  from { opacity: 0; transform: scaleY(0); }
  to   { opacity: 1; transform: scaleY(1); }
}
@keyframes introGrowX {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 1; transform: scaleX(1); }
}
@keyframes introPop {
  from { opacity: 0; transform: scale(.6); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes introFadeOut {
  to { opacity: 0; visibility: hidden; }
}

body.intro-lock {
  overflow: hidden;
  height: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .intro-mobile { display: none !important; }
}
