/* TMRacing — portada taller (escala algo más compacta) */

:root {
  --ink: #12161c;
  --ink-soft: #3c4553;
  --brand: #0d1b2a;
  --accent: #d62828;
  --accent-deep: #9b1c1c;
  --off: #6b7280;
  --radius: 18px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Archivo Black", "Arial Black", sans-serif;
  --flow-card-shadow:
    0 8px 20px rgba(214, 40, 40, 0.12),
    0 16px 48px rgba(214, 40, 40, 0.08),
    0 24px 64px rgba(18, 22, 28, 0.1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 0.92rem;
  color: var(--ink);
  background: #ffffff;
}

.page-home-inner {
  width: min(1080px, calc(100% - 1.75rem));
  margin: 0 auto;
  padding: 0.75rem 0 2.25rem;
}

/* —— Cabecera —— */

.home-header {
  text-align: center;
  margin-bottom: 1.25rem;
  animation: rise 0.55s ease both;
}

.home-logo-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 0;
}

.home-logo {
  width: min(420px, 88vw);
  height: auto;
  max-height: 148px;
  object-fit: contain;
  display: block;
}

.home-intro {
  width: 100%;
  max-width: none;
  margin: 0.85rem 0 0;
  padding: 0.85rem 1.15rem 0.95rem;
  text-align: left;
  min-height: auto;
  animation: rise 0.6s ease 0.08s both;
}

.home-welcome {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: var(--ink);
  text-align: center;
}

.home-tm {
  color: #d62828;
}

.home-lede {
  margin: 0.55rem 0 0;
  max-width: none;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.5;
  text-align: left;
}

.home-lede + .home-lede {
  margin-top: 0.45rem;
}

/* —— Grid 2×2 —— */

.services-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
  align-items: stretch;
}

.flow-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 0.9rem 1rem 0.95rem;
  box-shadow: var(--flow-card-shadow);
  border: 1px solid rgba(214, 40, 40, 0.14);
  animation: rise 0.65s ease both;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.service-card:nth-child(1) { animation-delay: 0.05s; }
.service-card:nth-child(2) { animation-delay: 0.1s; }
.service-card:nth-child(3) { animation-delay: 0.15s; }
.service-card:nth-child(4) { animation-delay: 0.2s; }

.flow-card-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
  flex-shrink: 0;
}

.flow-step-num {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--display);
  font-size: 0.88rem;
  line-height: 1;
}

.flow-card-titles {
  flex: 1;
  min-width: 0;
}

.flow-card-titles h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.flow-card-sub {
  margin: 0.12rem 0 0;
  font-size: 0.76rem;
  color: var(--ink-soft);
  line-height: 1.3;
}

.service-media {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: auto;
  flex: 0 0 auto;
}

.service-video-slot {
  border-radius: 12px;
  overflow: hidden;
  background: #f7f4ee;
  border: 1px solid rgba(18, 22, 28, 0.06);
  aspect-ratio: 16 / 9;
  min-height: 120px;
  display: grid;
  place-items: center;
}

.service-video-slot video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0f1419;
}

.media-placeholder {
  margin: 0;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.service-blurb {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.45;
  flex: 1 1 auto;
}

.service-card--text-first .service-blurb {
  margin: 0 0 0.65rem;
}

.service-card--text-first .service-link-wrap {
  margin: -0.25rem 0 0.65rem;
}

.service-card--text-first .service-media {
  margin-top: auto;
}

.service-link-wrap {
  margin: 0.35rem 0 0;
}

.service-link {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: none;
}

.service-link:hover {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* —— Carrusel —— */

.carousel {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.carousel-viewport {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #f7f4ee;
  border: 1px solid rgba(18, 22, 28, 0.06);
  aspect-ratio: 16 / 10;
  height: auto;
  min-height: 0;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.35s ease;
  will-change: transform;
}

.carousel-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.carousel-btn {
  appearance: none;
  border: 1px solid rgba(214, 40, 40, 0.22);
  background: #fff;
  color: var(--accent);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  box-shadow:
    0 4px 12px rgba(214, 40, 40, 0.12),
    0 1px 4px rgba(18, 22, 28, 0.06);
  transition: transform 0.15s ease, background 0.15s ease;
}

.carousel-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #fff8f8;
}

.carousel-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.carousel-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  max-width: 12rem;
}

.carousel-dot {
  appearance: none;
  border: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  padding: 0;
  background: #d4d0c8;
  cursor: pointer;
}

.carousel-dot.is-active {
  background: var(--accent);
}

.carousel-controls[hidden],
.carousel:not(.is-ready) .carousel-controls {
  display: none;
}

.carousel.is-ready .carousel-controls {
  display: flex;
}

/* —— Pie —— */

.home-foot {
  margin-top: 1.5rem;
  text-align: center;
  animation: rise 0.7s ease 0.25s both;
}

.home-foot-text {
  margin: 0;
  font-size: 0.76rem;
  color: var(--off);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .services-grid {
    grid-template-columns: 1fr;
    max-width: 28rem;
    margin-inline: auto;
    gap: 1rem;
  }

  .page-home-inner {
    width: min(100% - 1.25rem, 1080px);
  }
}

@media (max-width: 520px) {
  .home-logo {
    max-height: 120px;
  }

  .flow-card {
    padding: 0.85rem 0.9rem 0.95rem;
  }

  .home-intro {
    padding: 0.75rem 0.9rem 0.85rem;
  }

  .flow-card-titles h2 {
    font-size: 0.98rem;
  }

  .home-welcome {
    font-size: 1.05rem;
  }

  .home-lede {
    font-size: 0.84rem;
  }
}
