/* ═══════════════════════════════════════════════════
   Ecuador 1438 — Responsive layout
   Mobile-first, then desktop override at ≥ 900 px
   ═══════════════════════════════════════════════════ */

:root {
  color-scheme: dark;
  --navy: #1a2a3a;
  --card: #2d3748;
  --muted: #a0aec0;
  --blue: #38bdf8;
  --red: #f05252;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--navy);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-width: 0;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body { background: var(--navy); }

/* ───────── MOBILE LAYOUT (default) ───────── */

.page {
  width: 100%;
  height: 100dvh;
  padding: 6px 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}

.intro {
  width: 100%;
  text-align: center;
  flex-shrink: 0;
}

.intro .address {
  margin: 0;
  color: var(--blue);
  font-size: clamp(1.1rem, 4.5vw, 1.6rem);
  font-weight: 800;
  line-height: 1.15;
}

.intro .subtitle {
  max-width: 30rem;
  margin: 2px auto 0;
  color: var(--muted);
  font-size: clamp(0.7rem, 2.6vw, 0.85rem);
  line-height: 1.2;
}

/* The visual-panel grows to fill remaining height */
.visual-panel {
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
}

/* House: fills available height, aspect-ratio controls width */
.house {
  position: relative;
  flex: 0 0 auto;
  aspect-ratio: 1570 / 2097;
  width: auto;
  height: calc(100% - 90px);
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  border: 2px solid rgb(255 255 255 / 16%);
  border-radius: 1.25rem;
  background: var(--card);
  box-shadow: 0 10px 25px rgb(0 0 0 / 28%);
}

.house img {
  display: block;
  width: 100%;
  height: 100%;
}

/* ───────── DOOR HOTSPOT OVERLAYS ───────── */

.door {
  --door-color: var(--blue);
  position: absolute;
  display: grid;
  place-items: center;
  color: #fff;
  text-decoration: none;
  outline: 0;
  border-radius: 4px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  animation: door-pulse 2.4s ease-in-out infinite;
}

/* Coordinates proportional to the 1570 × 2097 photo */
.door-one { left: 48.3%; top: 78%; width: 10%; height: 21%; --door-color: var(--blue); }
.door-two { left: 81.7%; top: 74%; width: 13%; height: 21.5%; --door-color: var(--red); animation-delay: .35s; }

.door::before {
  content: "↓";
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  z-index: 1;
  color: var(--door-color);
  font-size: clamp(2rem, 7vw, 4rem);
  font-weight: 900;
  -webkit-text-stroke: 1.5px var(--door-color);
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 2px 5px rgb(0 0 0 / 75%);
  transform: translate(-50%, -5px);
  animation: arrow-guide 2.4s ease-in-out infinite;
}

.door-two::before { animation-delay: 0s; }

.door::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid color-mix(in srgb, var(--door-color) 85%, white);
  border-radius: 4px;
  background: color-mix(in srgb, var(--door-color) 12%, transparent);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 30%), 0 0 14px var(--door-color);
  opacity: .63;
  pointer-events: none;
}

.door span {
  position: relative;
  z-index: 1;
  padding: .25rem .45rem;
  border-radius: 999px;
  background: rgb(26 42 58 / 88%);
  box-shadow: 0 2px 6px rgb(0 0 0 / 35%);
  font-size: clamp(.55rem, 1.4vw, .75rem);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  opacity: 0;
  transition: opacity 180ms ease;
  white-space: nowrap;
}

.door:focus-visible { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--door-color); }
.door:focus-visible span, .door:active span { opacity: 1; }
.door:active { animation-play-state: paused; transform: scale(.98); }

/* ───────── BUTTONS ───────── */

/* Mobile: 2-column grid below image, pushed to the bottom */
.door-buttons {
  width: 100%;
  max-width: 480px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex-shrink: 0;
}

.door-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  border-radius: 0.85rem;
  box-shadow: 0 4px 10px rgb(0 0 0 / 24%);
  font-size: clamp(.7rem, 2.6vw, .88rem);
  font-weight: 700;
  letter-spacing: .02em;
  text-decoration: none;
  text-transform: uppercase;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
  border: none;
  cursor: pointer;
}

.button-one { background: var(--blue); color: var(--navy); }
.button-two { background: var(--red); color: #fff; }

.button-timbre {
  background: rgb(255 255 255 / 6%);
  box-shadow: 0 2px 8px rgb(0 0 0 / 20%);
}

.button-timbre:disabled, .button-timbre.timbre-disabled, .button-timbre.timbre-locked {
  opacity: 0.55;
  filter: grayscale(0.5);
  cursor: pointer !important;
  pointer-events: auto !important;
}

.button-timbre.timbre-disabled:hover, .button-timbre.timbre-locked:hover {
  opacity: 0.75;
  filter: grayscale(0.2);
  box-shadow: 0 4px 12px rgb(0 0 0 / 25%) !important;
}


.button-timbre-one {
  border: 1.5px solid var(--blue);
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 12%, transparent);
}

.button-timbre-two {
  border: 1.5px solid var(--red);
  color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, transparent);
}

.button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.button:active { transform: translateY(1px) scale(.98); filter: brightness(.88); box-shadow: 0 1px 4px rgb(0 0 0 / 30%); }

.bell-icon {
  font-size: 1rem;
  line-height: 1;
}

/* ───────── TIMBRE MODAL / POPUP ───────── */

.timbre-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 16, 26, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms ease;
  padding: 16px;
}

.timbre-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.timbre-modal-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 36px;
  border-radius: 1.5rem;
  background: var(--card);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  transform: scale(0.85);
  transition: transform 220ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
  max-width: 280px;
  width: 100%;
}

.timbre-modal.active .timbre-modal-card {
  transform: scale(1);
}

.timbre-modal-card.door-1 {
  border: 2px solid var(--blue);
  background: linear-gradient(145deg, #1e293b, #0f172a);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 25px rgba(56, 189, 248, 0.3);
}

.timbre-modal-card.door-2 {
  border: 2px solid var(--red);
  background: linear-gradient(145deg, #2d191e, #1a0f12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 25px rgba(240, 82, 82, 0.3);
}

.timbre-bell-icon {
  font-size: 3.2rem;
  line-height: 1;
  display: inline-block;
  transform-origin: top center;
}

.timbre-modal.active .timbre-bell-icon {
  animation: bell-ring 0.55s ease-in-out infinite alternate;
}

.timbre-modal-card.door-1 .timbre-modal-text { color: #e0f2fe; }
.timbre-modal-card.door-2 .timbre-modal-text { color: #ffe4e6; }

.timbre-modal-text {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
}

/* Modal Aviso Límite Timbre */
.timbre-limit-card {
  max-width: 250px;
  width: 85%;
  padding: 14px 18px;
  border-radius: 1.25rem;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 1.5px solid #f59e0b;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55), 0 0 20px rgba(245, 158, 11, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  cursor: pointer;
}

.timbre-limit-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.timbre-limit-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  flex-shrink: 0;
}

.timbre-limit-icon svg {
  width: 15px;
  height: 15px;
  stroke: #fbbf24;
}

.timbre-limit-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #fbbf24;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.timbre-limit-text {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: #e2e8f0;
  line-height: 1.35;
}


/* ───────── KEYFRAMES ───────── */

@keyframes bell-ring {
  0% { transform: rotate(-24deg); }
  100% { transform: rotate(24deg); }
}

@keyframes door-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.09); }
}

@keyframes arrow-guide {
  0% { opacity: 0; transform: translate(-50%, -20px); }
  18% { opacity: .96; }
  46% { opacity: .96; transform: translate(-50%, 12px); }
  57% { opacity: .96; transform: translate(-50%, 4px); }
  70%, 100% { opacity: 0; transform: translate(-50%, 10px); }
}

/* ───────── HOVER EFFECTS (pointer devices) ───────── */

@media (hover: hover) and (pointer: fine) {
  .door:hover { z-index: 2; cursor: pointer; animation-play-state: paused; transform: scale(1.04); }
  .door:hover::after { opacity: .92; background: color-mix(in srgb, var(--door-color) 22%, transparent); }
  .door:hover span { opacity: 1; }
  .button-one:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 6px 14px rgb(0 0 0 / 32%); }
  .button-two:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 6px 14px rgb(0 0 0 / 32%); }
  .button-timbre-one:hover { background: var(--blue); color: var(--navy); transform: translateY(-2px); box-shadow: 0 6px 14px rgb(0 0 0 / 32%); }
  .button-timbre-two:hover { background: var(--red); color: #fff; transform: translateY(-2px); box-shadow: 0 6px 14px rgb(0 0 0 / 32%); }
}

/* ═══════════════════════════════════════════════════
   DESKTOP LAYOUT  (≥ 900 px)
   ─────────────────────────────────────────────────
   3-column grid:
     col 1  → intro text (center) + blue buttons (bottom)
     col 2  → house image (fills almost all vertical space)
     col 3  → red buttons (bottom)

   .visual-panel and .door-buttons use display:contents
   so their children participate directly in the page grid.
   ═══════════════════════════════════════════════════ */

@media (min-width: 900px) {
  .page {
    padding: 20px 32px;
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
    grid-template-rows: 1fr;
    gap: 28px;
    align-items: stretch;
  }

  /* Intro: left column, vertically centered */
  .intro {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    text-align: center;
  }

  .intro .address {
    font-size: clamp(1.8rem, 2.8vw, 3rem);
  }

  .intro .subtitle {
    font-size: clamp(0.88rem, 1.2vw, 1.05rem);
    margin-top: 10px;
  }

  /* Flatten visual-panel into the page grid */
  .visual-panel {
    display: contents;
  }

  /* House: center column, stretch to fill all vertical space */
  .house {
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
    justify-self: center;
    flex: none;
    height: 100%;
    width: auto;
    max-width: none;
    border-radius: 1.5rem;
  }

  /* Flatten door-buttons so each group sits in its own column */
  .door-buttons {
    display: contents;
  }

  /* Blue group: bottom of left column */
  .door-group-one {
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    justify-self: center;
    min-width: 150px;
    max-width: 210px;
  }

  /* Red group: bottom of right column */
  .door-group-two {
    grid-column: 3;
    grid-row: 1;
    align-self: end;
    justify-self: center;
    min-width: 150px;
    max-width: 210px;
  }

  .button {
    font-size: clamp(.82rem, 1vw, .95rem);
    min-height: 48px;
    padding: 10px 18px;
  }
}

/* ───────── REDUCED MOTION ───────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
