/* ==========================================================================
   TERRITORIO.CSS — Gronert Company
   Página del territorio: hero, cifras, mapa geográfico del Alto Mayo,
   provincias y créditos. Todo el prefijo es `tr-` para no chocar con las
   clases del resto del sitio.
   ========================================================================== */

.territory-page {
  background: #15130f;
  --tr-ink: #15130f;
  --tr-cream: #f1e8d9;
  --tr-gold: #e2c174;
}

/* ==========================================================================
   1. HERO
   ========================================================================== */
.tr-hero {
  position: relative;
  isolation: isolate;
  min-height: 92svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: max(8rem, 130px) clamp(1.25rem, 6vw, 7rem) clamp(3.5rem, 8vh, 6rem);
  color: #fff;
  overflow: hidden;
}

.tr-hero-media { position: absolute; inset: 0; z-index: -2; }

.tr-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
}

.tr-hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(0deg, var(--tr-ink) 2%, rgba(21, 19, 15, 0.35) 45%, rgba(21, 19, 15, 0.55) 100%),
    linear-gradient(90deg, rgba(21, 19, 15, 0.72), rgba(21, 19, 15, 0.1) 68%);
}

.tr-kicker {
  margin: 0 0 1.15rem;
  color: var(--tr-gold);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.tr-hero-copy { width: min(820px, 100%); }

.tr-hero h1 {
  margin: 0 0 1.6rem;
  font-family: var(--font-serif);
  font-size: clamp(3.4rem, 8vw, 7.5rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.88;
}

.tr-hero-lede {
  max-width: 620px;
  margin: 0 0 2.4rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1.02rem, 1.6vw, 1.22rem);
  line-height: 1.62;
}

.tr-hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.5rem;
  min-width: 250px;
  padding: 1rem 1.3rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(15, 13, 10, 0.25);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.tr-hero-btn:hover,
.tr-hero-btn:focus-visible { background: #fff; color: var(--tr-ink); }
.tr-hero-btn:active { transform: translateY(1px) scale(0.985); }

/* ==========================================================================
   2. CIFRAS
   ========================================================================== */
.tr-facts {
  padding: clamp(3rem, 6vw, 5rem) clamp(1.25rem, 6vw, 7rem);
  background: var(--tr-ink);
  color: var(--tr-cream);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  text-align: center;
  border-bottom: 1px solid rgba(226, 193, 116, 0.14);
}

.tr-fact strong {
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 500;
  color: var(--tr-gold);
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}

.tr-dash { margin: 0 0.06em; }

.tr-fact span {
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: rgba(241, 232, 217, 0.62);
}

/* ==========================================================================
   3. MAPA
   ========================================================================== */
.tr-map-section {
  padding: clamp(4.5rem, 9vw, 7.5rem) clamp(1.25rem, 6vw, 7rem);
  background: var(--tr-ink);
  color: var(--tr-cream);
}

.tr-section-head {
  max-width: 660px;
  margin: 0 auto clamp(2.5rem, 5vw, 3.5rem);
  text-align: center;
}

.tr-section-head h2 {
  margin: 0 0 1rem;
  font-family: var(--font-serif);
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.tr-lede {
  margin: 0;
  color: rgba(241, 232, 217, 0.66);
  font-size: clamp(0.98rem, 1.5vw, 1.08rem);
  line-height: 1.62;
}

.tr-map-stage {
  position: relative;
  width: min(100%, 1120px);
  margin: 0 auto;
  border: 1px solid rgba(226, 193, 116, 0.18);
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(226, 193, 116, 0.05), transparent 60%);
  overflow: hidden;
}

.tr-map { display: block; width: 100%; height: auto; }

.tr-zones ellipse {
  fill: rgba(226, 193, 116, 0.05);
  stroke: rgba(226, 193, 116, 0.2);
  stroke-width: 1;
  stroke-dasharray: 5 6;
}

.tr-zone-labels text {
  fill: rgba(241, 232, 217, 0.32);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.tr-ref circle { fill: rgba(241, 232, 217, 0.34); }

.tr-ref text {
  fill: rgba(241, 232, 217, 0.42);
  font-family: var(--font-sans);
  font-size: 13px;
  dominant-baseline: middle;
}

/* ── Pines ─────────────────────────────────────────────────────────────── */
.tr-pin { cursor: pointer; }

.tr-pin-halo {
  fill: rgba(226, 193, 116, 0.16);
  transition: fill 0.25s ease, r 0.25s ease;
}

.tr-pin-dot {
  fill: var(--tr-gold);
  stroke: var(--tr-ink);
  stroke-width: 2;
  transition: r 0.25s ease;
}

.tr-pin text {
  fill: var(--tr-cream);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: var(--tr-ink);
  stroke-width: 3.5;
  stroke-linejoin: round;
  transition: fill 0.25s ease;
}

.tr-pin:hover .tr-pin-halo,
.tr-pin:focus-visible .tr-pin-halo,
.tr-pin.is-active .tr-pin-halo { fill: rgba(226, 193, 116, 0.32); }

.tr-pin:hover .tr-pin-dot,
.tr-pin:focus-visible .tr-pin-dot,
.tr-pin.is-active .tr-pin-dot { r: 9; }

.tr-pin:hover text,
.tr-pin.is-active text { fill: #fff; }

.tr-pin:focus { outline: none; }
.tr-pin:focus-visible .tr-pin-dot { stroke: #fff; }

.tr-map-hint {
  position: absolute;
  top: 1.1rem;
  left: 1.25rem;
  margin: 0;
  padding: 0.4rem 0.9rem;
  background: rgba(18, 15, 11, 0.6);
  border: 1px solid rgba(226, 193, 116, 0.22);
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: rgba(241, 232, 217, 0.72);
}

/* ── Ficha de información ──────────────────────────────────────────────── */
.tr-info {
  position: absolute;
  right: 1.25rem;
  bottom: 1.25rem;
  width: min(330px, calc(100% - 2.5rem));
  padding: 1.25rem 1.35rem 1.4rem;
  background: rgba(18, 15, 11, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(226, 193, 116, 0.3);
  border-radius: 18px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.48);
}

.tr-info-close {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  padding: 0.3rem 0.5rem;
  border: 0;
  background: none;
  color: rgba(241, 232, 217, 0.5);
  font-family: var(--font-sans);
  font-size: 0.66rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
}

.tr-info-close:hover,
.tr-info-close:focus-visible { color: var(--tr-cream); }

.tr-info-img {
  display: block;
  width: 100%;
  height: 120px;
  margin-bottom: 0.85rem;
  object-fit: cover;
  border-radius: 11px;
}

.tr-info-prov {
  display: block;
  margin-bottom: 0.2rem;
  color: rgba(226, 193, 116, 0.8);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tr-info-name {
  display: block;
  margin: 0 1.5rem 0.45rem 0;
  font-family: var(--font-serif);
  font-size: 1.32rem;
  font-weight: 500;
  color: #fff;
}

.tr-info-text {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: rgba(241, 232, 217, 0.78);
}

/* ==========================================================================
   4. PROVINCIAS
   ========================================================================== */
.tr-provinces {
  padding: clamp(4.5rem, 9vw, 7.5rem) clamp(1.25rem, 6vw, 7rem);
  background: #100e0b;
  color: var(--tr-cream);
}

.tr-prov {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  max-width: 1180px;
  margin: 0 auto clamp(3rem, 6vw, 5rem);
}

.tr-prov:last-child { margin-bottom: 0; }
.tr-prov.is-reversed .tr-prov-media { order: 2; }

.tr-prov-media {
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(226, 193, 116, 0.16);
}

.tr-prov-media img {
  display: block;
  width: 100%;
  height: clamp(280px, 34vw, 430px);
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.tr-prov:hover .tr-prov-media img { transform: scale(1.04); }

.tr-prov-index {
  display: block;
  margin-bottom: 0.6rem;
  color: rgba(226, 193, 116, 0.65);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.tr-prov-copy h3 {
  margin: 0 0 1rem;
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 4.5vw, 3.3rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}

.tr-prov-copy p {
  margin: 0 0 1.6rem;
  max-width: 460px;
  color: rgba(241, 232, 217, 0.68);
  font-size: 1rem;
  line-height: 1.65;
}

.tr-prov-districts {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.tr-prov-districts li {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(226, 193, 116, 0.28);
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--tr-cream);
}

.tr-prov-note {
  color: rgba(241, 232, 217, 0.45);
  font-weight: 400;
}

/* ==========================================================================
   5. CIERRE
   ========================================================================== */
.tr-closing {
  padding: clamp(5rem, 10vw, 8rem) clamp(1.25rem, 6vw, 7rem);
  background: #7d5b20;
  color: #fff6e8;
  text-align: center;
}

.tr-closing h2 {
  margin: 0 0 1.25rem;
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 500;
  letter-spacing: -0.045em;
}

.tr-closing p {
  max-width: 540px;
  margin: 0 auto 2.25rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.05rem;
  line-height: 1.6;
}

.tr-closing-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.tr-closing-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.75rem;
  border: 1px solid #fff6e8;
  border-radius: 999px;
  color: #fff6e8;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.tr-closing-btn:hover,
.tr-closing-btn:focus-visible { background: #fff6e8; color: #7d5b20; }

.tr-closing-btn.is-primary { background: #fff6e8; color: #7d5b20; }

.tr-closing-btn.is-primary:hover,
.tr-closing-btn.is-primary:focus-visible { background: transparent; color: #fff6e8; }

/* ==========================================================================
   6. CRÉDITOS
   ========================================================================== */
.tr-credits {
  padding: clamp(2rem, 4vw, 3rem) clamp(1.25rem, 6vw, 7rem);
  background: var(--tr-ink);
  color: rgba(241, 232, 217, 0.4);
  text-align: center;
}

.tr-credits-label {
  margin: 0 0 0.5rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(226, 193, 116, 0.55);
}

.tr-credits-text {
  max-width: 760px;
  margin: 0 auto;
  font-size: 0.74rem;
  line-height: 1.7;
}

.tr-credits-text a { color: rgba(226, 193, 116, 0.75); }

/* ==========================================================================
   7. RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
  .tr-prov { grid-template-columns: 1fr; }
  .tr-prov.is-reversed .tr-prov-media { order: 0; }
  .tr-facts { grid-template-columns: repeat(2, 1fr); gap: 2rem 1rem; }
}

@media (max-width: 640px) {
  .tr-hero { min-height: 88svh; }
  .tr-hero-btn { width: 100%; min-width: 0; }

  /* El mapa se lee mal por debajo de ~560px: las etiquetas de los pines se
     encabalgan. Se amplía el texto del SVG y la ficha pasa a ocupar el ancho
     completo, anclada abajo. */
  .tr-pin text { font-size: 21px; }
  .tr-zone-labels text { font-size: 19px; }
  .tr-ref text { font-size: 17px; }
  .tr-pin-dot { r: 9; }
  .tr-pin-halo { r: 20; }

  .tr-info {
    right: 0.75rem;
    left: 0.75rem;
    bottom: 0.75rem;
    width: auto;
  }

  .tr-info-img { height: 96px; }
  .tr-map-hint { font-size: 0.64rem; left: 0.75rem; top: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tr-hero-btn,
  .tr-closing-btn,
  .tr-prov-media img,
  .tr-pin-halo,
  .tr-pin-dot,
  .tr-pin text { transition: none; }
  .tr-prov:hover .tr-prov-media img { transform: none; }
}
