:root {
  --blue: #0c4d77;
  --orange: #fc8414;
  --cream: #fffaef;
  --white: #fff;
  --line: #d9d9d9;
  --gutter: clamp(16px, 7.6vw, 131px);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-display: "Arial Black", "Inter", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--white); color: var(--blue); font-family: var(--font); overflow-x: hidden; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: 0; padding: 0; background: none; color: inherit; }
a { color: inherit; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.hero :focus-visible, .contact :focus-visible, .detail :focus-visible { outline-color: var(--white); }

/* Orange photo backgrounds */
.hero, .contact { position: relative; isolation: isolate; color: var(--white); background: var(--orange); overflow: hidden; }
.hero::before, .contact::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background-size: cover; filter: grayscale(1);
}
.hero::after, .contact::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--orange); opacity: .86; }
.hero::before { background-image: url("../img/hero.jpg"); background-position: center 62%; }
.contact::before { background-image: url("../img/contacto.jpg"); background-position: center 30%; }

/* Hero */
.hero__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 48px;
  max-width: 1728px; margin: 0 auto;
  padding: clamp(64px, 14vw, 240px) var(--gutter) clamp(64px, 12vw, 210px) clamp(16px, 9.3vw, 161px);
}
.hero__text { flex: 0 1 820px; min-width: 0; }
.hero h1 { font-size: clamp(38px, 4.5vw, 77px); line-height: 1.39; font-weight: 700; }
.hero h1 span { color: var(--blue); font-size: 1.36em; line-height: 1; }
.hero p { margin-top: 24px; max-width: 700px; font-size: clamp(17px, 1.74vw, 30px); line-height: 1.2; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 24px; margin-top: clamp(40px, 6vw, 104px); }
.hero__logo { flex: 0 0 auto; width: clamp(220px, 27vw, 468px); height: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 24px;
  min-height: clamp(56px, 6vw, 104px); padding: 0 clamp(28px, 4vw, 70px);
  border-radius: 14px; font-size: clamp(18px, 2.08vw, 36px); font-weight: 700; text-decoration: none;
  transition: transform .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn--blue { background: var(--blue); color: var(--white); }
.btn--white { position: relative; background: var(--white); color: var(--blue); padding-right: 0; }
.btn__icon {
  display: grid; place-items: center; flex: none; width: clamp(56px, 6vw, 104px); height: clamp(56px, 6vw, 104px);
  margin-left: clamp(0px, .8vw, 12px);
  background: var(--white); border: 4px solid var(--blue); border-radius: 14px;
}
.btn__icon svg { width: 58%; fill: none; stroke: var(--blue); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* Round buttons */
.round { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 50%; transition: transform .15s ease; }
.round:hover { transform: scale(1.08); }
.round svg { width: 28px; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.round--orange { background: var(--orange); }
.round--orange svg { stroke: var(--white); }
.round--white { background: var(--white); }
.round--white svg { stroke: var(--blue); }

/* Carousel */
.carousel {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  max-width: 1728px; margin: 0 auto; padding: clamp(56px, 10vw, 170px) clamp(16px, 7vw, 122px);
  overflow-x: clip;
}
.carousel__stage { position: relative; flex: 1; min-width: 0; height: clamp(400px, 41.5vw, 717px); touch-action: pan-y; }
.card {
  position: absolute; top: 50%; left: 50%;
  width: clamp(290px, 30vw, 517px); height: 100%; padding: 0;
  border-radius: 20px; overflow: hidden; background: var(--blue);
  transform: translate(-50%, -50%) translateX(calc(var(--pos) * var(--step))) scale(var(--scale));
  z-index: var(--z); opacity: var(--alpha);
  transition: transform .45s ease, opacity .45s ease;
  --step: clamp(82px, 15vw, 262px);
}
.card img { width: 100%; height: 100%; object-fit: cover; }
.card::after { content: ""; position: absolute; inset: 0; background: var(--blue); opacity: var(--tint); transition: opacity .45s ease; }
.card span {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 64px 24px 24px 44px; text-align: left;
  color: var(--white); font-size: clamp(16px, 1.27vw, 22px); font-weight: 600;
  background: linear-gradient(transparent, rgba(12, 77, 119, .85));
  opacity: var(--label); transition: opacity .3s ease;
}

/* Works */
.works { scroll-margin-top: 16px; }
.works__nav { max-width: 1728px; margin: 0 auto; padding: 0 clamp(16px, 7vw, 121px) 48px; }
.pills { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 40px; }
.pill {
  min-height: 48px; padding: 0 28px; border: 2px solid var(--blue); border-radius: 999px;
  font-size: 16px; font-weight: 700; color: var(--blue); background: var(--white);
}
.pill[aria-pressed="true"] { background: var(--blue); color: var(--white); }

.work-select {
  display: block; width: 100%; max-width: 480px; min-height: 52px; padding: 0 48px 0 16px;
  border: 1px solid var(--blue); border-radius: 14px; appearance: none; -webkit-appearance: none;
  font: 700 16px var(--font); color: var(--blue); cursor: pointer;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230c4d77' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 9 7 7 7-7'/%3E%3C/svg%3E") no-repeat right 14px center / 22px;
}
.work-select:focus, .work-select:focus-visible { outline: none; }

.detail { display: grid; grid-template-columns: 52.3fr 47.7fr; height: clamp(520px, 67vw, 1157px); }
.detail__media { position: relative; min-width: 0; overflow: hidden; background: var(--blue); }
.detail__media img { width: 100%; height: 100%; object-fit: cover; }
.detail__media::after { content: ""; position: absolute; inset: auto 0 0; height: 210px; background: linear-gradient(transparent, rgba(12, 77, 119, .8) 55%, rgba(12, 77, 119, .96)); pointer-events: none; }
.detail__controls { position: absolute; z-index: 1; left: 32px; right: 32px; bottom: 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.detail__controls[hidden] { display: none; }
.dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.dot { width: 24px; height: 24px; display: grid; place-items: center; }
.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--white); }
.dot[aria-current="true"]::before { background: var(--orange); }

.detail__info { position: relative; display: flex; align-items: center; min-width: 0; overflow: hidden; background: var(--blue); color: var(--white); }
.detail__roof { position: absolute; top: 0; right: 0; width: 100%; height: 100%; fill: none; stroke: var(--white); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
/* El título queda centrado a la altura de los puntos: 32px de margen + la mitad del botón de 52px */
.detail__copy { position: absolute; left: 0; right: 0; bottom: 58px; transform: translateY(50%); padding: 0 clamp(24px, 4.5vw, 78px); }
.detail__copy h2 { font-size: clamp(24px, 1.85vw, 32px); line-height: 1.2; font-weight: 700; }

/* Contact */
.contact__inner { max-width: 1728px; margin: 0 auto; padding: clamp(160px, 28vw, 480px) clamp(16px, 7.6vw, 131px) clamp(56px, 8vw, 140px); }
.contact h2 { font-family: var(--font-display); font-weight: 900; font-size: clamp(40px, 9.9vw, 171px); line-height: 1.41; text-transform: uppercase; }
.contact__links { display: flex; flex-wrap: wrap; gap: clamp(16px, 4vw, 96px); margin-top: clamp(32px, 4vw, 64px); }
.contact__links a {
  display: inline-flex; align-items: center; gap: 24px; min-height: 80px; padding: 0 32px; min-width: 0;
  border: 2px solid var(--white); border-radius: 18px; font-size: clamp(17px, 1.62vw, 28px); text-decoration: none; overflow-wrap: anywhere;
  transition: background .15s ease, color .15s ease;
}
.contact__links a:hover { background: var(--white); color: var(--blue); }
.contact__links svg { flex: none; width: 40px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }

/* Footer */
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 32px; padding: 24px var(--gutter); background: var(--blue); color: var(--white); font-size: 15px; }

/* Legal page */
.legal { max-width: 820px; margin: 0 auto; padding: 48px 16px 80px; line-height: 1.6; color: #16324a; }
.legal__logo { width: 120px; height: auto; margin-bottom: 32px; }
.legal h1 { color: var(--blue); font-size: 36px; line-height: 1.2; margin-bottom: 24px; }
.legal h2 { color: var(--blue); font-size: 24px; margin: 40px 0 12px; }
.legal p, .legal ul { margin: 0 0 14px; }

/* Phones and tablets */
@media (max-width: 820px) {
  .hero__inner { flex-direction: column-reverse; align-items: flex-start; gap: 32px; padding-top: 48px; }
  .hero__logo { width: 180px; }
  .hero__text { flex: none; }
  .carousel { padding-left: 8px; padding-right: 8px; }
  .carousel .round { position: absolute; z-index: 20; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; }
  .carousel__prev { left: 8px; }
  .carousel__next { right: 8px; }
  .card { width: min(68vw, 290px); --step: 16vw; }
  .work-select { max-width: none; min-height: 44px; font-size: 14px; }
  .works__nav { padding: 0 16px 24px; }
  .pills { flex-wrap: nowrap; gap: 8px; margin-bottom: 12px; }
  .pill { flex: 1 1 auto; min-height: 44px; padding: 0 12px; font-size: 14px; white-space: nowrap; }
  .detail { grid-template-columns: 1fr; height: auto; }
  .detail__media { height: 118vw; max-height: 720px; }
  .detail__media::after { height: 150px; }
  .detail__controls { left: 16px; right: 16px; bottom: 16px; }
  .detail__copy { position: relative; bottom: auto; transform: none; padding: 20px 16px 24px; }
  .detail__roof { display: none; }
  .contact h2 { font-size: 11.5vw; }
  .contact__links { flex-direction: column; align-items: stretch; }
  .contact__links a { padding: 0 16px; gap: 12px; font-size: 16px; overflow-wrap: normal; }
  .contact__links svg { width: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
