/* ============ Fuentes (autoalojadas) ============ */
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-latin.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
}

/* ============ Identidad ============ */
:root {
  --red: #C8102E;        /* rojo PEX (cercano al de la bandera, con buen contraste sobre blanco) */
  --red-dark: #9E0C24;
  --ink: #17171B;
  --text: #46464F;
  --muted: #6E6E78;
  --line: #E9E5E0;
  --soft: #F8F6F3;
  --white: #FFFFFF;

  --head: "Montserrat", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 16px;
  --header-h: 68px;
  --gutter: 20px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--white); color: var(--text);
  font: 400 1rem/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--head); color: var(--ink); margin: 0; line-height: 1.12; letter-spacing: -0.02em; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: var(--gutter); }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ============ Botones ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 26px; border-radius: 999px; border: 2px solid transparent;
  font: 600 .95rem/1 var(--head); letter-spacing: 0; text-decoration: none; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn--sm { min-height: 40px; padding: 0 20px; font-size: .88rem; }
.btn--red { background: var(--red); color: #fff; }
.btn--red:hover { background: var(--red-dark); }
.btn--ghost { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn--ghost:hover { background: var(--ink); color: #fff; }
.btn--white { background: #fff; color: var(--red); }
.btn--white:hover { background: var(--soft); }
.btn.is-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }

/* ============ Encabezado ============ */
.header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(255,255,255,.92); backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header__in { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { border-radius: 50%; }
.brand__txt { display: flex; flex-direction: column; line-height: 1.1; }
.brand__txt strong { font: 800 1.15rem/1 var(--head); color: var(--ink); letter-spacing: -.01em; }
.brand__txt small { font-size: .72rem; color: var(--muted); margin-top: 3px; }

.nav { display: flex; align-items: center; gap: 28px; }
.nav a:not(.btn) {
  text-decoration: none; font-weight: 500; font-size: .95rem; color: var(--ink);
  padding: 6px 0; border-bottom: 2px solid transparent; transition: border-color .2s, color .2s;
}
.nav a:not(.btn):hover, .nav a.is-active { border-color: var(--red); color: var(--red); }

.header__tools { display: flex; align-items: center; gap: 10px; }
.lang {
  display: inline-flex; align-items: center; gap: 5px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer;
  font: 600 .78rem/1 var(--head); color: var(--muted);
}
.lang:hover { border-color: var(--ink); }
.lang [data-lang].on { color: var(--red); }

.burger { display: none; width: 42px; height: 42px; border: 0; background: transparent; cursor: pointer; padding: 0; position: relative; }
.burger span { position: absolute; left: 10px; right: 10px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .25s, opacity .2s, top .25s; }
.burger span:nth-child(1) { top: 14px; }
.burger span:nth-child(2) { top: 20px; }
.burger span:nth-child(3) { top: 26px; }
.burger[aria-expanded="true"] span:nth-child(1) { top: 20px; transform: rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { top: 20px; transform: rotate(-45deg); }

/* ============ Inicio ============ */
.hero { position: relative; overflow: hidden; background: linear-gradient(180deg, var(--soft), #fff 85%); }
.hero__in { display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: 40px; padding-block: clamp(48px, 9vw, 110px); }
.eyebrow { font: 600 .78rem/1 var(--head); letter-spacing: .14em; text-transform: uppercase; color: var(--red); margin-bottom: 18px; }
.hero h1 { font-size: clamp(2.1rem, 5.4vw, 3.9rem); font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--red); }
.lead { font-size: clamp(1.02rem, 1.6vw, 1.18rem); color: var(--text); max-width: 56ch; margin-top: 22px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.map { position: relative; width: 100%; aspect-ratio: 1000 / 400; }
.map__dots {
  position: absolute; inset: 0; background: #D8D2CA;
  -webkit-mask: url("../img/world-dots.svg") center / contain no-repeat;
          mask: url("../img/world-dots.svg") center / contain no-repeat;
}
.map__pin { position: absolute; left: 27.1%; top: 65.7%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 8px; }
.map__pin i { position: relative; width: 14px; height: 14px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px rgba(200,16,46,.18); }
.map__pin i::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--red); animation: ping 2.4s ease-out infinite; }
.map__pin b { position: absolute; left: 22px; top: -4px; font: 700 .72rem/1 var(--head); color: var(--red); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
@keyframes ping { 0% { transform: scale(.8); opacity: .9; } 100% { transform: scale(2.6); opacity: 0; } }

/* ============ Pilares ============ */
.pillars { padding-block: clamp(40px, 6vw, 72px); }
.kicker { font: 600 .78rem/1 var(--head); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 24px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 26px; transition: box-shadow .25s, transform .25s; }
.card:hover { box-shadow: 0 14px 34px -18px rgba(23,23,27,.25); transform: translateY(-2px); }
.ico { width: 34px; height: 34px; fill: none; stroke: var(--red); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 18px; }
.card h3 { font-size: 1.15rem; margin-bottom: 8px; }
.card p { font-size: .96rem; }

/* ============ Secciones ============ */
.section { padding-block: clamp(56px, 9vw, 112px); }
.head { max-width: 760px; margin-bottom: 44px; }
.head h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); font-weight: 800; }
.head .lead { margin-top: 18px; }
.sub { font-size: 1.25rem; margin: 56px 0 18px; }

.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.panel { background: var(--soft); border-radius: var(--radius); padding: 30px 30px 32px; border-top: 3px solid var(--red); }
.panel h3 { font-size: 1.2rem; margin-bottom: 10px; }

.values { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.values li { border-left: 2px solid var(--red); padding: 4px 0 4px 16px; }
.values strong { display: block; font: 700 1rem/1.2 var(--head); color: var(--ink); margin-bottom: 4px; }
.values span { font-size: .92rem; color: var(--muted); }

.law { margin: 56px 0 0; padding: 34px clamp(22px, 4vw, 44px); border-radius: var(--radius); background: var(--ink); color: #D9D9DF; }
.law__label { font: 600 .74rem/1 var(--head); letter-spacing: .14em; text-transform: uppercase; color: #FF8A9C; margin-bottom: 16px; }
.law blockquote { margin: 0; }
.law blockquote p { font: 600 clamp(1.15rem, 2.4vw, 1.6rem)/1.4 var(--head); color: #fff; letter-spacing: -.01em; }
.law__src { margin-top: 16px; font-size: .9rem; color: #B8B8C2; }
.law__note { margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.14); font-size: .98rem; }

.muted { color: var(--muted); }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 26px; }
.member { text-align: center; }
.member__photo {
  width: 100%; max-width: 180px; aspect-ratio: 1; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; background: var(--soft); border: 2px dashed #D8D2CA;
}
.member__photo svg { width: 44%; fill: none; stroke: #B9B2A8; stroke-width: 1.4; stroke-linecap: round; }
.member__photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.member h4 { font-size: 1rem; color: var(--muted); font-weight: 600; }
.member p { font-size: .88rem; color: var(--muted); }

/* ============ Contacto ============ */
.contact { background: var(--red); color: #fff; position: relative; overflow: hidden; }
.contact .wrap { position: relative; }
.contact .eyebrow { color: #FFD3DA; }
.contact h2, .contact h3 { color: #fff; }
.contact .lead { color: #FFE9EC; }
.cta-card { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.28); border-radius: var(--radius); padding: 30px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.cta-card h3 { font-size: 1.35rem; }
.cta-card p { color: #FFE9EC; }
.cta-card .btn { margin-top: 6px; }
.pending { font-size: .9rem; font-weight: 500; color: #fff !important; background: rgba(0,0,0,.18); padding: 6px 12px; border-radius: 8px; }
.mail { font-size: .95rem; margin-top: 4px; }
.mail a { font-weight: 600; color: #fff; text-underline-offset: 3px; }
.privacy { margin-top: 28px; max-width: 78ch; font-size: .84rem; color: #FFD3DA; }

/* ============ Pie ============ */
.footer { background: var(--ink); color: #B8B8C2; padding-block: 34px; font-size: .88rem; }
.footer__in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 28px; }
.brand--foot .brand__txt strong { color: #fff; }
.brand--foot .brand__txt small { color: #B8B8C2; }
.footer__site { font-weight: 500; color: #fff; }

/* ============ Adaptación a pantallas ============ */
@media (max-width: 900px) {
  .hero__in { grid-template-columns: 1fr; gap: 28px; }
  .hero__map { order: 2; }
  .grid3 { grid-template-columns: 1fr; }
  .values { grid-template-columns: repeat(2, 1fr); }
  .grid4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .burger { display: block; }
  .nav {
    position: fixed; inset: var(--header-h) 0 auto 0; flex-direction: column; align-items: stretch; gap: 0;
    background: #fff; border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 22px;
    transform: translateY(-8px); opacity: 0; visibility: hidden; transition: opacity .2s, transform .2s, visibility .2s;
  }
  .nav.open { transform: none; opacity: 1; visibility: visible; }
  .nav a:not(.btn) { padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
  .nav .nav__cta { margin-top: 18px; min-height: 48px; }
  .grid2 { grid-template-columns: 1fr; }
  .brand__txt small { display: none; }
}
@media (max-width: 480px) {
  .values { grid-template-columns: 1fr; }
  .actions .btn { flex: 1 1 100%; }
  .map__pin b { left: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============ Movimiento ============
   Todo lo animado es una mejora: el estado base (sin "js" o con "reducir movimiento")
   es el diseño final y completo. */
@keyframes rise { from { opacity: 0; transform: translateY(22px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes draw { from { background-size: 0 .05em; } }

/* Inicio: entrada escalonada y subrayado que se dibuja */
.hero__copy > * { animation: rise .85s cubic-bezier(.2,.7,.2,1) backwards; }
.hero__copy > :nth-child(1) { animation-delay: .05s; }
.hero__copy > :nth-child(2) { animation-delay: .17s; }
.hero__copy > :nth-child(3) { animation-delay: .32s; }
.hero__copy > :nth-child(4) { animation-delay: .46s; }
.hero__map { animation: fade 1.2s .25s ease backwards; }
.hero h1 em {
  background: linear-gradient(var(--red), var(--red)) no-repeat 0 100% / 100% .05em;
  padding-bottom: .06em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  animation: draw 1s 1.05s cubic-bezier(.6,0,.2,1) backwards;
}

/* Mapa: con JS se dibuja en lienzo (los puntos estáticos quedan como respaldo) */
.map__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.map--live .map__canvas { display: block; }
.map--live .map__dots { display: none; }
.map__pin i::before {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--red);
  animation: ping 2.4s 1.2s ease-out infinite;
}

/* Logo del encabezado: círculo rojo + globo animado + letras */
.logo { position: relative; display: block; width: 44px; height: 44px; border-radius: 50%; background: var(--red); overflow: hidden; flex: none; }
.logo__globe, .logo img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; }

/* Aparición al hacer scroll */
.js .reveal { opacity: 0; }
.js .reveal.in { opacity: 1; animation: rise .8s calc(var(--i, 0) * 90ms) cubic-bezier(.2,.7,.2,1) backwards; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; }
}

/* ============ El Perú en el mundo (scroll) ============ */

/* Barra de viaje: una ruta punteada bajo el encabezado y un avión que avanza con el scroll */
.journey { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; }
.journey::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, #D8D2CA 0 6px, transparent 6px 11px);
}
.journey__bar { position: absolute; inset: 0; background: var(--red); transform: scaleX(0); transform-origin: left; will-change: transform; }
.journey__plane {
  position: absolute; top: 50%; left: 0; width: 22px; height: 22px; padding: 3px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 6px rgba(23,23,27,.25); transform: translate(0, -50%); will-change: left, transform;
  fill: none; stroke: var(--red); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* Husos horarios */
.clocks { padding-block: clamp(40px, 6vw, 72px) 0; }
.clocks__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 24px; margin-bottom: 22px; }
.clocks__head .kicker { margin: 0; }
.clocks__head .muted { font-size: .92rem; }
.clocks__grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
.clock {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: start; row-gap: 2px;
  padding: 14px 12px 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px;
}
.clock__ico { grid-column: 2; grid-row: 1; width: 18px; height: 18px; color: #C9A227; }
.clock.is-night .clock__ico { color: #6B7A99; }
.clock__ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.clock__city { grid-column: 1; grid-row: 1; font: 700 .86rem/1.3 var(--head); color: var(--ink); white-space: nowrap; }
.clock__country { grid-column: 1 / -1; grid-row: 2; font-size: .76rem; color: var(--muted); }
.clock__time { grid-column: 1 / -1; grid-row: 3; margin-top: 8px; font: 800 1.55rem/1 var(--head); letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.clock__colon { font-style: normal; margin-inline: 1px; animation: blink 1s steps(1) infinite; }
.clock__diff { grid-column: 1 / -1; grid-row: 4; margin-top: 4px; font-size: .78rem; font-weight: 600; color: var(--red); }
.clock--home { background: var(--red); border-color: var(--red); }
.clock--home .clock__city, .clock--home .clock__time { color: #fff; }
.clock--home .clock__country { color: #FFD3DA; }
.clock--home .clock__diff { color: #fff; }
.clock--home .clock__ico { color: #FFE9A8; }
.clock--home.is-night .clock__ico { color: #fff; }
.clocks__note { margin-top: 14px; font-size: .82rem; }
@keyframes blink { 50% { opacity: .25; } }

/* Nosotros: mapa de fondo con parallax */
.about { position: relative; overflow: hidden; }
.about .wrap { position: relative; }
.about__bg {
  position: absolute; right: -14%; top: 4%; width: min(900px, 90%); aspect-ratio: 1000 / 400; background: #EFEAE3;
  -webkit-mask: url("../img/world-dots.svg") center / contain no-repeat; mask: url("../img/world-dots.svg") center / contain no-repeat;
  pointer-events: none; will-change: transform;
}

/* Contacto: las rutas regresan al Perú */
.contact .map--contact {
  position: absolute; right: -10%; bottom: -13%; width: min(860px, 88%); pointer-events: none;
}
.contact .map--contact .map__dots { background: rgba(255,255,255,.14); }

@media (max-width: 1100px) {
  .clocks__grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 600px) {
  .clocks__grid { grid-template-columns: repeat(2, 1fr); }
  .clock__time { font-size: 1.4rem; }
  .contact .map--contact { opacity: .7; }
}
