/* ============================================
   Layout · Secciones y estructuras
   ============================================ */

/* ----- Sección genérica ----- */
.section {
  padding-top: var(--space-11);
  padding-bottom: var(--space-11);
  position: relative;
  scroll-margin-top: 80px;
}

.section--tight {
  padding-top: var(--space-9);
  padding-bottom: var(--space-9);
}

.section--dark {
  background-color: var(--color-bg-dark);
  color: var(--color-text-inverse);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4 {
  color: var(--color-text-inverse);
}

.section--taupe {
  background-color: var(--color-bg-taupe);
  color: var(--color-text-on-taupe);
}

.section--slate {
  background-color: var(--color-bg-slate);
  color: var(--color-text-on-slate);
}

.section--slate h1,
.section--slate h2,
.section--slate h3,
.section--slate h4 {
  color: var(--color-text-on-slate);
}

.section--alt {
  background-color: var(--color-bg-alt);
}

@media (max-width: 768px) {
  .section {
    padding-top: var(--space-9);
    padding-bottom: var(--space-9);
  }
  .section--tight {
    padding-top: var(--space-7);
    padding-bottom: var(--space-7);
  }
}

/* ----- Header de sección ----- */
.section-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-9);
  max-width: 720px;
}

.section-header--centered {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.section-header__eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--track-widest);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.section-header__title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-light);
  line-height: var(--leading-tight);
}

.section-header__subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--color-text);
  font-weight: var(--weight-regular);
  margin-top: var(--space-2);
  letter-spacing: var(--track-tight);
}

@media (max-width: 768px) {
  .section-header {
    margin-bottom: var(--space-7);
  }
}

/* ============================================
   PORTADA · Hero
   ============================================ */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--color-bg);
  padding-top: var(--space-9);
  padding-bottom: var(--space-9);
  overflow: hidden;
}

/* ---------- INTRO · Logo persistente + palabras orbitan ---------- */

.hero__intro {
  position: absolute;
  inset: 0;
  z-index: 10;
  background-color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  /* Fade-out final cuando termina la última palabra */
  animation: heroIntroOut 1.2s var(--ease-in-out) 6.0s forwards;
}

.hero__intro-stage {
  position: relative;
  width: 100%;
  max-width: 900px;
  height: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 var(--gutter);
  gap: var(--space-8);
}

/* Logo: aparece y queda. Es el ancla de todo el motion. */
.hero__intro-logo {
  position: relative;
  width: 280px;
  height: 280px;
  opacity: 0;
  transform: scale(0.85);
  /* Solo entra. No sale. */
  animation: heroLogoIn 1.4s var(--ease-out) 0.3s forwards;
}

.hero__intro-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Línea sutil debajo del logo, aparece tras el logo */
.hero__intro-logo::after {
  content: '';
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 1px;
  background-color: var(--jch-charcoal);
  animation: heroLineGrow 0.8s var(--ease-out) 1.5s forwards;
}

@keyframes heroLineGrow {
  0% { width: 0; }
  100% { width: 60px; }
}

/* Contenedor de palabras — debajo del logo */
.hero__intro-words {
  position: relative;
  width: 100%;
  height: 1.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cada palabra: aparece debajo del logo, en secuencia */
.hero__intro-word {
  position: absolute;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6.5vw, 4.5rem);
  font-weight: var(--weight-light);
  line-height: 1.4;
  letter-spacing: var(--track-tight);
  color: var(--color-text);
  white-space: nowrap;
  opacity: 0;
  padding: 0.15em 0.05em 0.25em 0.05em;
  clip-path: inset(-0.3em 100% -0.3em 0);
}

/* Acto 1 — "Diseño." */
.hero__intro-word[data-word="1"] {
  animation:
    heroWordReveal 1.0s var(--ease-out) 2.2s forwards,
    heroWordHide 0.7s var(--ease-in-out) 3.3s forwards;
  font-style: normal;
}

/* Acto 2 — "Dirección." (palabra clave en italic) */
.hero__intro-word[data-word="2"] {
  animation:
    heroWordReveal 1.0s var(--ease-out) 3.6s forwards,
    heroWordHide 0.7s var(--ease-in-out) 4.7s forwards;
  font-style: italic;
  color: var(--jch-charcoal);
}

/* Acto 3 — "Entrega." queda visible hasta fade-out */
.hero__intro-word[data-word="3"] {
  animation: heroWordReveal 1.0s var(--ease-out) 5.0s forwards;
  font-style: normal;
}

/* Keyframes */
@keyframes heroLogoIn {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes heroWordReveal {
  0% {
    opacity: 0;
    clip-path: inset(-0.3em 100% -0.3em 0);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    clip-path: inset(-0.3em 0 -0.3em 0);
  }
}

@keyframes heroWordHide {
  0% {
    opacity: 1;
    clip-path: inset(-0.3em 0 -0.3em 0);
  }
  100% {
    opacity: 0;
    clip-path: inset(-0.3em 0 -0.3em 100%);
  }
}

@keyframes heroIntroOut {
  0% {
    opacity: 1;
    visibility: visible;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}

/* Hero contenido principal — empieza oculto, aparece al final de la intro */
.hero__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: var(--container-max);
  margin: 0 auto;
  width: 100%;
  padding: 0 var(--gutter);
  opacity: 0;
  animation: heroContentIn 1.2s var(--ease-out) 6.2s forwards;
}

.hero__content > * {
  opacity: 0;
  transform: translateY(20px);
}

.hero__content > *:nth-child(1) { animation: heroContentItemIn 0.9s var(--ease-out) 6.4s forwards; }
.hero__content > *:nth-child(2) { animation: heroContentItemIn 0.9s var(--ease-out) 6.6s forwards; }
.hero__content > *:nth-child(3) { animation: heroContentItemIn 0.9s var(--ease-out) 6.8s forwards; }

@keyframes heroContentIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes heroContentItemIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Reduce motion: salta directo al estado final */
@media (prefers-reduced-motion: reduce) {
  .hero__intro {
    display: none;
  }
  .hero__content {
    opacity: 1;
    animation: none;
  }
  .hero__content > * {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* Mobile: ajustar tamaños */
@media (max-width: 768px) {
  .hero__intro-stage {
    height: 400px;
    gap: var(--space-6);
  }
  .hero__intro-logo {
    width: 200px;
    height: 200px;
  }
  .hero__intro-word {
    font-size: clamp(2rem, 11vw, 3.25rem);
  }
}

@media (max-width: 480px) {
  .hero__intro-stage {
    height: 340px;
    gap: var(--space-5);
  }
  .hero__intro-logo {
    width: 150px;
    height: 150px;
  }
}

.hero__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-9);
}

.hero__brand-mark {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-4);
}

.hero__brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hero__brand-name {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--track-widest);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: var(--weight-light);
  line-height: var(--leading-tight);
  letter-spacing: var(--track-tight);
  max-width: 18ch;
  margin-bottom: var(--space-6);
}

.hero__title-line {
  display: block;
}

.hero__title-line--italic {
  font-style: italic;
  color: var(--color-text-muted);
}

.hero__subtitle {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 56ch;
}

.hero__subtitle-line {
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  line-height: var(--leading-snug);
  color: var(--color-text);
}

.hero__subtitle-line--journey {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  font-weight: var(--weight-regular);
  color: var(--jch-charcoal);
  letter-spacing: var(--track-tight);
  margin-top: var(--space-1);
  margin-bottom: var(--space-2);
}

.hero__arrow {
  width: 40px;
  height: 12px;
  color: var(--jch-charcoal);
  flex-shrink: 0;
}

.hero__subtitle-line--muted {
  color: var(--color-text-muted);
  font-size: var(--text-base);
}

.hero__meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
  padding-top: var(--space-7);
  border-top: 1px solid var(--color-rule);
}

.hero__meta-item {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--track-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

@media (max-width: 768px) {
  .hero__meta {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  .hero__brand {
    margin-bottom: var(--space-7);
  }
}

/* ============================================
   SERVICIOS
   ============================================ */

.services-intro {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: var(--weight-regular);
  font-size: var(--text-xl);
  line-height: var(--leading-snug);
  color: var(--color-text);
  max-width: 56ch;
  margin-bottom: var(--space-9);
  letter-spacing: var(--track-tight);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--color-rule);
}

.service {
  padding: var(--space-7) var(--space-6) var(--space-7) 0;
  border-right: 1px solid var(--color-rule);
  position: relative;
  display: grid;
  /* 4 filas con altura fija: header / título / tagline / contenido / footer */
  grid-template-rows:
    [header] auto
    [title] auto
    [tagline] auto
    [body] 1fr
    [footer] auto;
  gap: var(--space-3);
}

.service:last-child {
  border-right: none;
  padding-right: 0;
}

.service:not(:first-child) {
  padding-left: var(--space-6);
}

.service--featured::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--jch-charcoal);
}

/* Header del servicio: número + (opcional) badge en línea */
.service__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 32px;
  margin-bottom: var(--space-3);
}

.service__index {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--track-widest);
  color: var(--color-text-muted);
}

.service__badge {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--track-wider);
  text-transform: uppercase;
  color: var(--jch-charcoal);
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--jch-charcoal);
}

/* Título: altura mínima fija para que las 3 columnas se alineen */
.service__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-light);
  line-height: var(--leading-tight);
  letter-spacing: var(--track-tight);
  /* Altura mínima para alinear los 3 títulos visualmente, aunque "Diseño + Dirección de Proyecto" sea más largo */
  min-height: 2.4em;
  display: flex;
  align-items: flex-start;
}

.service__tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  font-weight: var(--weight-regular);
  color: var(--jch-charcoal);
  letter-spacing: var(--track-tight);
  margin-bottom: var(--space-2);
}

.service__description {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text);
}

.service__description + .service__description {
  margin-top: var(--space-3);
}

.service__description strong {
  font-weight: var(--weight-medium);
  color: var(--jch-charcoal);
}

.service__for {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  color: var(--color-text);
  border-left: 2px solid var(--jch-charcoal);
  padding-left: var(--space-4);
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
  line-height: var(--leading-snug);
  align-self: end;
  margin-top: var(--space-5);
}

@media (max-width: 1024px) {
  .services-grid {
    grid-template-columns: 1fr;
    border-top: 1px solid var(--color-rule);
  }
  .service {
    border-right: none;
    border-bottom: 1px solid var(--color-rule);
    padding: var(--space-6) 0;
    grid-template-rows: auto auto auto auto auto;
  }
  .service:not(:first-child) {
    padding-left: 0;
  }
  .service:last-child {
    border-bottom: none;
  }
  .service__title {
    min-height: 0;
  }
  .service__for {
    margin-top: var(--space-4);
  }
}

/* ============================================
   PORTFOLIO · Lista de casos
   ============================================ */

.portfolio-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--color-rule);
}

/* ============================================
   CTA
   ============================================ */

.cta {
  padding: var(--space-11) 0;
  text-align: center;
}

.cta__title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-light);
  line-height: var(--leading-tight);
  letter-spacing: var(--track-tight);
  margin-bottom: var(--space-7);
  max-width: 18ch;
  margin-left: auto;
  margin-right: auto;
}

.cta__title--italic-accent {
  font-style: italic;
}

.cta__buttons {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .cta {
    padding: var(--space-9) 0;
  }
  .cta__buttons {
    flex-direction: column;
    align-items: stretch;
    max-width: 360px;
    margin: 0 auto;
  }
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
  padding: var(--space-9) 0 var(--space-7);
  background-color: var(--color-bg-dark);
  color: var(--color-text-inverse);
}

.footer__inner {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-8);
  align-items: start;
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer__logo {
  width: 56px;
  height: 56px;
}

.footer__name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-light);
  letter-spacing: var(--track-tight);
  color: var(--color-text-inverse);
}

.footer__contacts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

.footer__contact-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--track-widest);
  text-transform: uppercase;
  color: var(--jch-taupe-light);
  margin-bottom: var(--space-2);
}

.footer__contact-value {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-inverse);
}

.footer__contact-value:hover {
  opacity: 0.7;
}

.footer__bottom {
  margin-top: var(--space-9);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-rule-inverse);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: var(--track-wide);
  color: var(--jch-taupe-light);
}

@media (max-width: 768px) {
  .footer__inner {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  .footer__contacts {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  .footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
}
