/* ===== Variables ===== */
:root {
  --color-cream: #FAF7F2;
  --color-cream-dark: #F0EBE3;
  --color-terracotta: #B04E32; /* antes #C45C3E: 3,97:1 sobre crema; ahora 4,94:1 */
  --color-terracotta-dark: #8F3F27;
  --color-olive: #5C6B4A;
  --color-olive-light: #7A8B66;
  --color-brown: #3D2E24;
  --color-brown-light: #6B5A4E;
  --color-white: #FFFFFF;
  --color-whatsapp: #0F7A6E; /* antes #25D366: 1,98:1 con texto blanco; ahora 5,21:1 */
  --color-whatsapp-dark: #075E54;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;

  --shadow-sm: 0 2px 8px rgba(61, 46, 36, 0.08);
  --shadow-md: 0 4px 20px rgba(61, 46, 36, 0.12);
  --shadow-lg: 0 8px 32px rgba(61, 46, 36, 0.16);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --header-height: 72px;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  overflow-x: clip;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-brown);
  background-color: var(--color-cream);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body.nav-open {
  overflow: hidden;
}

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

a {
  color: var(--color-terracotta);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-terracotta-dark);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--color-brown);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--color-white);
}

picture {
  display: contents;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 1rem;
  z-index: 200;
  padding: 0.75rem 1rem;
  background: var(--color-brown);
  color: var(--color-white);
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transform: translateY(-110%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--color-white);
}

main:focus {
  outline: none;
}

ul {
  list-style: none;
}

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.section {
  padding: clamp(3rem, 8vw, 5rem) 0;
}

.section__header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 3rem;
}

.section__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--color-brown);
  margin-bottom: 0.75rem;
}

.section__subtitle {
  font-size: 1.1rem;
  color: var(--color-brown-light);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--whatsapp {
  background-color: var(--color-whatsapp);
  color: var(--color-white);
}

.btn--whatsapp:hover {
  background-color: var(--color-whatsapp-dark);
  color: var(--color-white);
}

.btn--lg {
  font-size: 1.1rem;
  padding: 1rem 2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.btn--sm {
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  min-height: 44px;
}

/* ===== Cards ===== */
.card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  border-bottom: 1px solid rgba(61, 46, 36, 0.08);
  transition: box-shadow 0.3s ease;
}

/* El fondo translúcido con blur va en un pseudo-elemento: si backdrop-filter estuviera
   en .header, el panel fijo del menú móvil quedaría recortado a la altura del header. */
.header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(250, 247, 242, 0.95);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.header--scrolled {
  box-shadow: var(--shadow-sm);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.header__logo {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 700;
  color: var(--color-brown);
  text-decoration: none;
  line-height: 1.2;
  max-width: calc(100% - 3rem);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.header__logo:hover {
  color: var(--color-terracotta);
}

.header__nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.header__link {
  font-weight: 500;
  color: var(--color-brown);
  text-decoration: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.header__link::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-terracotta);
  transition: width 0.25s ease;
}

.header__link:hover {
  color: var(--color-terracotta);
}

.header__link:hover::after {
  width: 100%;
}

.header__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  margin-right: -10px;
  flex-shrink: 0;
}

.header__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-brown);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.header__toggle--active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.header__toggle--active span:nth-child(2) {
  opacity: 0;
}

.header__toggle--active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== Hero ===== */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  padding-top: var(--header-height);
}

.hero__gallery {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.6rem;
  padding: 1rem;
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100dvh - var(--header-height));
}

.hero__img-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-height: 0;
  height: 100%;
  margin: 0;
}

.hero__img-wrap--main {
  grid-row: span 2;
  border-radius: var(--radius-lg);
}

.hero__img-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(61, 46, 36, 0.05) 0%,
    rgba(196, 92, 62, 0.12) 100%
  );
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.hero__img-wrap:hover::after {
  opacity: 0.6;
}

.hero__img {
  width: 100%;
  height: 100%;
  min-height: 140px;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s ease;
}

.hero__img-wrap:hover .hero__img {
  transform: scale(1.04);
}

.hero__img-wrap--main .hero__img {
  min-height: 100%;
}

.hero__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 2rem 3rem 1rem;
  min-width: 0;
}

.hero__eyebrow {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-olive);
  margin-bottom: 1rem;
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-brown);
  margin-bottom: 1.25rem;
}

.hero__subtitle {
  font-size: 1.15rem;
  color: var(--color-brown-light);
  margin-bottom: 2rem;
  max-width: 480px;
}

.hero__content .btn--lg {
  align-self: flex-start;
}

/* ===== Servicios ===== */
.servicios {
  background: var(--color-white);
}

.servicios__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.servicio-card {
  text-align: center;
}

.servicio-card__icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 1rem;
}

.servicio-card__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-brown);
  margin-bottom: 0.5rem;
}

.servicio-card__text {
  font-size: 0.95rem;
  color: var(--color-brown-light);
  line-height: 1.5;
}

/* ===== Menú ===== */
.menu {
  background: var(--color-cream-dark);
}

.menu__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.menu-card__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-terracotta);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--color-cream-dark);
}

.menu-card__list li {
  padding: 0.5rem 0;
  font-size: 0.95rem;
  color: var(--color-brown-light);
  border-bottom: 1px solid var(--color-cream);
}

.menu-card__list li:last-child {
  border-bottom: none;
}

.menu-card__list strong {
  color: var(--color-brown);
}

.menu__note {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--color-brown-light);
}

/* ===== Galería ===== */
.galeria {
  background: var(--color-white);
}

.galeria__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 220px;
  gap: 1rem;
}

.galeria__item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin: 0;
}

.galeria__item--wide {
  grid-column: span 2;
  grid-row: span 2;
}

.galeria__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s ease;
}

.galeria__item:hover img {
  transform: scale(1.06);
}

.galeria__item figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 1rem 0.85rem;
  background: linear-gradient(transparent, rgba(61, 46, 36, 0.75));
  color: var(--color-white);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ===== Contacto ===== */
.contacto__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: stretch;
}

.contacto-card__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-brown);
  margin-bottom: 1.5rem;
}

.contacto-card__list li {
  margin-bottom: 1.25rem;
}

.contacto-card__label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-olive);
  margin-bottom: 0.25rem;
}

.contacto-card__list a,
.contacto-card__list span {
  font-size: 1.05rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.contacto-card__list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.contacto-card__list .contacto-card__label {
  font-size: 0.8rem;
  font-weight: 600;
}

.contacto-card .btn {
  margin-top: 1.5rem;
  width: 100%;
}

.contacto__image {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.contacto__image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(92, 107, 74, 0.15) 0%,
    rgba(196, 92, 62, 0.2) 100%
  );
  pointer-events: none;
}

.contacto__image img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  object-position: center;
  transition: transform 0.6s ease;
}

.contacto__image:hover img {
  transform: scale(1.03);
}

/* ===== Footer ===== */
.footer {
  background: var(--color-brown);
  color: var(--color-cream);
  padding: 2rem 0;
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer__copy {
  font-size: 0.9rem;
  opacity: 0.85;
}

/* ===== WhatsApp Float ===== */
.whatsapp-float {
  position: fixed;
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  right: max(1rem, env(safe-area-inset-right, 0px));
  z-index: 90;
  width: 56px;
  height: 56px;
  background: var(--color-whatsapp);
  color: var(--color-white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.whatsapp-float:hover {
  background: var(--color-whatsapp-dark);
  color: var(--color-white);
  transform: scale(1.08);
}

/* ===== Responsive ===== */

/* Tablet landscape / small desktop */
@media (max-width: 1200px) {
  .header__nav {
    gap: 1.25rem;
  }

  .header__link {
    font-size: 0.95rem;
  }

  .hero__content {
    padding: 2rem 1.5rem 2rem 0.75rem;
  }

  .galeria__grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(200px, 22vw);
  }
}

/* Tablet portrait */
@media (max-width: 1024px) {
  :root {
    --header-height: 64px;
  }

  .header__toggle {
    display: flex;
    z-index: 110;
  }

  .header__nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-cream);
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem;
    gap: 0.25rem;
    border-bottom: 1px solid rgba(61, 46, 36, 0.1);
    box-shadow: var(--shadow-md);
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0s linear 0.3s;
    overflow-y: auto;
  }

  .header__nav--open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0s;
  }

  .header__link {
    font-size: 1.1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(61, 46, 36, 0.08);
  }

  .header__link::after {
    display: none;
  }

  .header__cta {
    width: 100%;
    margin-top: 1rem;
    padding: 0.85rem 1rem;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero__gallery {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: minmax(220px, 42vw) repeat(2, minmax(110px, 20vw));
    min-height: auto;
    padding: 0.75rem 1.25rem 0;
    gap: 0.5rem;
  }

  .hero__img-wrap--main {
    grid-column: 1 / -1;
    grid-row: 1;
    height: auto;
  }

  .hero__img-wrap--main .hero__img {
    min-height: 220px;
    max-height: none;
  }

  .hero__img {
    min-height: 110px;
  }

  .hero__content {
    padding: 1.75rem 1.25rem 2.5rem;
    text-align: center;
    align-items: center;
  }

  .hero__content .btn--lg {
    align-self: center;
  }

  .hero__subtitle {
    max-width: 100%;
  }

  .hero__title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
  }

  .servicios__grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .galeria__grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(180px, 28vw);
  }

  .galeria__item--wide {
    grid-column: span 2;
    grid-row: span 1;
  }

  .contacto__grid {
    grid-template-columns: 1fr;
  }

  .contacto__image {
    order: -1;
  }

  .contacto__image img {
    min-height: 220px;
    max-height: 50vw;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .section__header {
    margin-bottom: 2rem;
  }

  .section__subtitle {
    font-size: 1rem;
  }

  .card {
    padding: 1.25rem;
  }

  .servicios__grid,
  .menu__grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .hero__gallery {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: minmax(200px, 50vw) repeat(2, minmax(100px, 24vw));
  }

  .hero__img-wrap--main {
    grid-column: 1 / -1;
  }

  .hero__img-wrap--main .hero__img {
    min-height: 200px;
    max-height: none;
  }

  .hero__img {
    min-height: 100px;
  }

  .btn--lg {
    width: 100%;
    max-width: 320px;
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
  }

  .galeria__grid {
    grid-auto-rows: minmax(200px, 45vw);
  }

  .footer {
    padding: 1.5rem 0 5rem;
  }

  .footer__inner {
    flex-direction: column;
    text-align: center;
  }

  .footer__copy {
    font-size: 0.85rem;
  }
}

/* Tablet (560px–1024px): galería del hero en 4 columnas para que el título quede más arriba */
@media (min-width: 560px) and (max-width: 1024px) {
  .hero__gallery {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, minmax(130px, 21vw));
  }

  .hero__img-wrap--main {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
  }

  .hero__img-wrap--main .hero__img,
  .hero__img {
    min-height: 0;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  :root {
    --header-height: 60px;
  }

  .header__inner {
    gap: 0.75rem;
  }

  .hero__gallery {
    grid-template-rows: minmax(180px, 55vw) repeat(2, 90px);
    gap: 0.4rem;
  }

  .hero__img-wrap--main .hero__img {
    min-height: 180px;
  }

  .hero__img {
    min-height: 90px;
  }

  .hero__eyebrow {
    font-size: 0.8rem;
  }

  .hero__subtitle {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }

  .galeria__grid {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(200px, 55vw);
  }

  .galeria__item--wide {
    grid-column: span 1;
    grid-row: span 1;
  }

  .contacto-card__list a,
  .contacto-card__list span {
    font-size: 0.95rem;
  }

  .whatsapp-float {
    width: 52px;
    height: 52px;
  }

  .whatsapp-float svg {
    width: 24px;
    height: 24px;
  }
}

/* Very small screens */
@media (max-width: 360px) {
  .header__logo {
    font-size: 0.95rem;
  }

  .hero__title {
    font-size: 1.6rem;
  }

  .btn {
    font-size: 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
