/* ---------- Marca ----------
   Manual de normas de Estancia Caleufu: Rich Gold #c8aa78 y Warm Black #140a0a como
   institucionales; verde #233223 y bordó #2d0000 de la paleta secundaria.
   Georgia para titulares, Roboto para web. El manual no admite otras familias.
   Todo el branding se cambia sólo en este bloque. */
:root {
  --gold: #c8aa78;
  --warm-black: #140a0a;
  --green: #233223;
  --burgundy: #2d0000;

  --bg: #f7f3ec;            /* Rich Gold al ~10% */
  --surface: #ffffff;
  --ink: var(--warm-black);
  --ink-soft: #675d59;
  --line: #e4dccd;
  --accent: var(--warm-black);
  --accent-ink: #ffffff;
  --accent-soft: #efe6d6;   /* Rich Gold al ~25% */
  --warn: #6b4a12;
  --warn-soft: #f4ead8;
  --ok: var(--green);
  --ok-soft: #e2e8e1;
  --danger: #8a1f17;
  --danger-soft: #f7e8e6;
  --font-display: Georgia, 'Times New Roman', serif;
  --font-body: Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --radius: 2px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Sin pinch-zoom ni doble toque: el zoom rompía el layout en el teléfono. */
html, body { touch-action: pan-x pan-y; overscroll-behavior-y: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--ink-soft); }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px max(16px, env(safe-area-inset-left));
  background: var(--warm-black);
  border-bottom: 2px solid var(--gold);
}
.brand img { display: block; height: 30px; width: auto; }
.topbar .link { color: #fff; text-decoration-color: var(--gold); min-height: 44px; }

main { max-width: 720px; margin: 0 auto; padding: 32px 16px 64px; }

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border: 1px solid var(--accent); border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-size: .875rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; cursor: pointer;
}
.btn:hover:not(:disabled) { background: #2b1e1b; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: transparent; color: var(--accent); border-color: var(--gold); }
.btn.secondary:hover:not(:disabled) { background: var(--accent-soft); }
.btn.block { width: 100%; }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 8px; text-decoration: underline; }

label.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 500; font-size: .875rem; margin-bottom: 6px; }
.field .req { color: var(--danger); margin-left: 2px; }
.field small { display: block; color: var(--ink-soft); font-size: .875rem; margin-top: 4px; }
input[type=text], input[type=password], input[type=search], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit;
}
textarea { min-height: 88px; resize: vertical; }
/* En iPhone las fechas y horas traen un ancho mínimo propio que desborda la columna y
   empuja la página a "escritorio": se las obliga a respetar el ancho del contenedor. */
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; height: 46px; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; }
.grid > *, .field { min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
/* Foco visible con teclado en todo lo tocable; dorado sobre los fondos oscuros. */
:focus-visible { outline: 2px solid var(--warm-black); outline-offset: 2px; }
.hero :focus-visible, .topbar :focus-visible, body.on-login .login > :not(.card) :focus-visible { outline-color: var(--gold); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field.invalid small.error { color: var(--danger); }

label.check {
  display: flex; gap: 12px; align-items: center;
  min-height: 44px; margin-bottom: 8px; cursor: pointer;
}
label.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.error-box { background: var(--danger-soft); color: var(--danger); padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; }

/* ---------- Login ----------
   Foto panorámica de la estancia a pantalla completa, con un velo Warm Black para que el texto
   se lea, y todo centrado: imagotipo en negativo, saludo y formulario. */
body.on-login {
  background: var(--warm-black) url('/img/login-hero.jpg') 68% center / cover no-repeat fixed;
  min-height: 100dvh;
}
body.on-login::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(20, 10, 10, .55) 0%, rgba(20, 10, 10, .35) 45%, rgba(20, 10, 10, .75) 100%);
}
@media (max-width: 759px) {
  body.on-login { background-image: url('/img/login-hero-mobile.jpg'); background-position: center 40%; }
}
@media (min-width: 760px) and (max-width: 1023px) and (orientation: portrait) {
  body.on-login { background-image: url('/img/login-hero-mobile.jpg'); background-position: center 40%; }
}
@media (hover: none), (max-width: 759px) { body.on-login { background-attachment: scroll; } }
body.on-login .topbar { display: none; }
body.on-login main { position: relative; max-width: none; min-height: 100dvh; display: grid; place-items: start center; padding: max(32px, 10vh) 16px 32px; }
.login { width: 100%; max-width: 420px; margin: 0 auto; text-align: center; }
.login-logo { display: block; width: min(280px, 72%); height: auto; margin: 0 auto 28px; }
.login h1 { color: #fff; font-size: 1.8rem; margin-bottom: 8px; }
.login .intro { color: #efe7dc; margin: 0 auto 24px; max-width: 34ch; }
.login .card { padding: 28px; border: 0; border-top: 3px solid var(--gold); text-align: left; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.login-help { color: #e6ddd2; font-size: .875rem; margin: 18px 0 0; }
.login-help a { display: inline-block; padding-block: 13px; margin-block: -13px; color: #fff; text-decoration-color: var(--gold); }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.trip-card { margin: 24px 0; border-top: 3px solid var(--gold); }
.trip-card .eyebrow { font-size: .875rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.dates div { border-top: 1px solid var(--line); padding-top: 12px; }
.dates dt { font-size: .875rem; color: var(--ink-soft); }
.dates dd { margin: 4px 0 0; font-family: var(--font-display); font-size: 1.15rem; }

.guests { list-style: none; margin: 0; padding: 4px 24px; }
.guest {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.guest:last-child { border-bottom: 0; }
.guest .who { min-width: 0; }
.guest .name { font-weight: 500; overflow-wrap: anywhere; }
.guest .btn { flex: none; min-width: 116px; }
.pill { display: inline-block; font-size: .875rem; font-weight: 500; padding: 2px 10px; border-radius: var(--radius); margin-top: 4px; }
.pill.not_started { background: #eee8e3; color: var(--ink-soft); }
.pill.in_progress { background: var(--accent-soft); color: var(--warn); }
.pill.completed { background: var(--ok-soft); color: var(--ok); }
.tag { font-size: .875rem; color: var(--ink-soft); font-weight: 400; white-space: nowrap; }
.tag::before { content: " · "; }

/* Avisos dentro de la tarjeta del viaje y del formulario. */
.trip-card .notice { margin: 16px 0 20px; }
.notice.permit strong { font-weight: 600; }

/* ---------- Formulario (modal) ---------- */
.modal-backdrop {
  position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); background: rgba(20, 10, 10, .6);
  display: flex; align-items: flex-start; justify-content: center; z-index: 10;
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
}
.modal {
  background: var(--bg); width: 100%; max-width: 760px;
  height: var(--vvh, 100dvh); display: flex; flex-direction: column;
}
@media (min-width: 760px) and (min-height: 601px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { height: min(calc(var(--vvh, 100dvh) - 48px), 900px); border-radius: var(--radius); overflow: hidden; }
}
.modal-head { padding: 16px; background: var(--surface); border-bottom: 1px solid var(--line); border-top: 3px solid var(--gold); }
.modal-head .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 1.25rem; }
.close { font-size: 1.6rem; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--ink-soft); min-width: 44px; min-height: 44px; }
.save-state { font-size: .875rem; color: var(--ink-soft); min-height: 21px; }
.save-state.error { color: var(--danger); }

.stepper { display: flex; gap: 6px; margin-top: 12px; }
.stepper { margin-top: 4px; }
.stepper button {
  position: relative; flex: 1; height: 44px; border: 0; padding: 0;
  background: none; cursor: pointer;
}
.stepper button::before {
  content: ""; position: absolute; left: 0; right: 0; top: 19px; height: 6px; border-radius: 3px; background: var(--line);
}
.stepper button.done::before { background: var(--gold); }
.stepper button.visited::before { background: #d8c7a6; }
.stepper button.current::before { background: var(--warm-black); }
.step-label { font-size: .875rem; font-weight: 500; color: var(--ink); }
.modal-body h3 { font-size: 1.5rem; }
.req-legend { font-size: .875rem; color: var(--ink-soft); margin: -8px 0 16px; }
@media (max-height: 600px) {
  .modal-head { padding-top: 8px; padding-bottom: 8px; }
  .modal-head h2 { font-size: 1.1rem; }
  .stepper button { height: 32px; }
  .stepper button::before { top: 13px; }
  .save-state { display: none; }
  .modal-body { padding-top: 12px; }
}

.modal-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 20px 16px; }
.notice { background: var(--accent-soft); color: var(--ink); border-left: 3px solid var(--gold); border-radius: var(--radius); padding: 12px 14px; font-size: .9rem; margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: 1fr; column-gap: 16px; }
@media (min-width: 600px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .grid .wide, .grid .check, .grid .textarea { grid-column: 1 / -1; }
}
.modal-foot {
  display: flex; justify-content: flex-end; gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.modal-foot { flex-wrap: wrap; }
.modal-foot .btn { flex: 1; }
#missing-note { margin: 8px 0 0; }
@media (min-width: 600px) { .modal-foot .btn { flex: 0 0 auto; min-width: 140px; } }
@media (max-height: 600px) { .modal-foot { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); } }

/* Sí/no y elección múltiple: botones grandes, cómodos en el teléfono. */
fieldset.field { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
fieldset.field legend { font-weight: 500; font-size: .875rem; margin-bottom: 8px; padding: 0; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-weight: 500;
}
.choice input:checked + span { background: var(--warm-black); border-color: var(--warm-black); color: #fff; }
.choice input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.grid .choices { grid-column: 1 / -1; }
.choices .other-input { margin-top: 10px; }

.done-view { text-align: center; padding: 40px 8px; }
.done-view h2 { font-size: 1.8rem; }
.done-view h2::after { content: ""; display: block; width: 48px; height: 2px; background: var(--gold); margin: 14px auto 0; }
.loading { color: var(--ink-soft); padding: 40px 0; text-align: center; }

/* ---------- Header y pantalla del viaje (v1.4) ----------
   Como estanciacaleufu.com: header transparente sobre una foto a sangre, imagotipo completo,
   títulos en Georgia y botón de borde dorado. Mobile primero. */
.topbar { gap: 16px; padding-inline: max(16px, calc((100% - 1088px) / 2)); }
.brand { display: block; line-height: 0; }
.topbar .brand img { width: 112px; height: auto; }
.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 4px;
  background: transparent; color: #fff; border: 0; border-bottom: 1px solid transparent; border-radius: 0;
  font: inherit; font-size: .875rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; cursor: pointer;
}
.btn-outline:hover { color: var(--gold); }
@media (min-width: 1024px) { .topbar .brand img { width: 150px; } }

/* Con el hero, el header flota transparente sobre la foto. */
body.has-hero .topbar { position: absolute; inset: 0 0 auto 0; z-index: 5; background: transparent; border-bottom: 0; padding-top: max(16px, env(safe-area-inset-top)); }
body.has-hero main { padding-top: 0; }

.hero {
  position: relative; padding: 116px max(16px, calc((100% - 1088px) / 2)) 32px;
  color: #fff; background: var(--warm-black) url('/img/login-hero-1200.jpg') 70% center / cover no-repeat;
}
@media (min-width: 760px) { .hero { background-image: url('/img/login-hero.jpg'); padding-top: 136px; padding-bottom: 44px; } }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 10, 10, .78) 0%, rgba(20, 10, 10, .6) 50%, rgba(20, 10, 10, .86) 100%); }
.hero-loading { min-height: 398px; }
@media (min-width: 760px) { .hero-loading { min-height: 422px; } }
.hero-inner { position: relative; max-width: 640px; }
.hero h1 { color: #fff; font-size: clamp(2rem, 7vw, 3rem); line-height: 1.1; margin: 0 0 12px; }
.hero-lead { color: #f3ece2; font-size: 1.05rem; line-height: 1.55; font-weight: 400; max-width: 52ch; margin: 0 0 28px; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
/* Cuenta regresiva como en las apps de viaje: número grande y qué significa al lado, en caja
   normal y sin marco; un filete dorado la separa de la bajada. El número va en Roboto Light:
   los números de Georgia son de estilo antiguo (el 7 o el 9 bajan de la línea). */
.countdown { display: flex; align-items: center; gap: 16px; max-width: 420px; padding-top: 18px; border-top: 1px solid rgba(200, 170, 120, .55); }
.cd-value { font-family: var(--font-body); font-weight: 300; font-size: 3.25rem; line-height: 1; color: #fff; font-variant-numeric: lining-nums tabular-nums; }
.cd-text { display: grid; gap: 4px; min-width: 0; }
.cd-unit { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.2; color: #fff; }
.cd-line { font-size: .875rem; color: var(--gold); }

/* Bloques debajo del hero: celular = viaje, huéspedes, contacto; escritorio = dos columnas. */
.trip-layout { display: grid; gap: 20px; margin-top: 24px; }
.trip-block { display: grid; gap: 20px; grid-template-areas: "trip" "guests"; }
.trip-block + .trip-block { border-top: 1px solid var(--line); padding-top: 24px; }
.trip-block .trip-card { grid-area: trip; margin: 0; }
.trip-block .guests-panel { grid-area: guests; }
.guests-panel h2 small { font-family: inherit; font-size: .95rem; font-weight: 400; color: var(--ink-soft); }
.trip-card h2, .contact-card h2, .guests-panel h2 { font-size: 1.45rem; margin: 6px 0 10px; }
.card .eyebrow { font-size: .875rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.guests-panel .notice { margin: 0 0 14px; }
.guests-panel > .muted { margin-bottom: 14px; }
.progress { margin: 4px 0 18px; }
.progress-row { font-size: .95rem; margin-bottom: 8px; }
.progress .meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress .meter i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.trip-card .btn { width: 100%; }
@media (min-width: 760px) { body.has-hero main { max-width: 1120px; padding-inline: 16px; } }
@media (min-width: 1024px) {
  body:not(.on-login) main { max-width: 1120px; }
  /* Viaje y huéspedes lado a lado, a la misma altura; el contacto abajo, a todo el ancho y en cuatro columnas. */
  .trip-layout { gap: 32px; margin-top: 32px; }
  .trip-block { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-areas: "trip guests"; gap: 24px 32px; align-items: stretch; }
  .trip-block + .trip-block { padding-top: 32px; }
  .trip-block .guests-panel { display: flex; flex-direction: column; }
  .trip-block .guests-panel .guests { flex: 1; }
  .contact-card { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 0 32px; align-items: center; }
  .contact-card .contact-list { grid-row: 1 / span 3; grid-column: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; margin: 0; }
  .contact-card .contact-list li:nth-child(2) a { border-top: 0; }
}

.contact-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.contact-list a { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 6px 0; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.contact-list li:first-child a { border-top: 0; }
.contact-list a:hover span { text-decoration: underline; text-decoration-color: var(--gold); }
.contact-list svg { width: 22px; height: 22px; flex: none; fill: none; stroke: #8a6d3b; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.contact-list span { display: grid; font-weight: 500; }
.contact-list small { font-size: .875rem; font-weight: 400; color: var(--ink-soft); }

/* Opciones largas (seguro de viaje): una debajo de otra, como renglones. */
.choice-row.vertical { flex-direction: column; }
.choice-row.vertical .choice span { display: block; text-align: left; line-height: 1.4; padding-block: 12px; }

/* Firma del deslinde */
.signature { display: grid; gap: 12px; }
.signature > span { font-weight: 500; }
.doc-links { display: grid; gap: 6px; margin: 0; }
.doc-links a { color: var(--ink); text-decoration-color: var(--gold); text-underline-offset: 3px; }
.sig-pad { position: relative; height: 170px; border: 1px dashed var(--ink-soft); border-radius: 2px; background: #fff; }
.sig-pad canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sig-hint { position: absolute; left: 16px; bottom: 12px; color: var(--ink-soft); font-size: .875rem; pointer-events: none; }
.sig-actions { display: flex; justify-content: flex-end; margin-top: -6px; }
.signature .link { background: none; border: 0; padding: 6px 0; color: var(--ink-soft); text-decoration: underline; cursor: pointer; font: inherit; min-height: 44px; }
.signature .btn { justify-self: start; }
.signed-ok { margin: 0; color: #2e6b3a; font-weight: 500; }
.muted.small { font-size: .9rem; margin: 0; }

/* Página de los documentos (/release/) */
.doc-page main.doc { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
.doc h1 { font-size: 1.6rem; margin: 28px 0 14px; }
.doc h2 { font-size: 1.15rem; margin: 22px 0 10px; }
.doc p, .doc li { font-size: .95rem; line-height: 1.6; }
.doc-cert, .doc-policy { font-weight: 500; }
