/* ==========================================================================
   Optilux · Consulta de pedidos
   Colores de marca: cambia las variables de :root.
   ========================================================================== */

/* Nunito Sans (OFL, ver /fonts/OFL.txt): sustituto libre de Museo Sans.
   Para usar Museo Sans real, carga el kit de Adobe Fonts (ver README):
   la familia "museo-sans" ya va primero en --font. */
@font-face {
  font-family: "Nunito Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/nunito-sans-500.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/nunito-sans-700.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito Sans";
  font-style: normal;
  font-weight: 800 900;
  font-display: swap;
  src: url("/fonts/nunito-sans-900.woff2") format("woff2");
}

:root {
  --brand: #AD0024;          /* rojo del logo oficial (7.5:1 sobre blanco) */
  --brand-strong: #85001B;   /* hover / texto sobre fondo claro de marca */
  --brand-soft: #FBE8EC;     /* fondos suaves de marca */
  --brand-ring: rgba(173, 0, 36, 0.24);

  --bg: #FAF7F5;             /* fondo cálido, no blanco puro */
  --surface: #FFFFFF;
  --text: #231C1E;
  --text-muted: #62575B;     /* 6.4:1 sobre --surface */
  --line: #E9E1DE;
  --line-strong: #CFC4C0;

  --future: #6E6468;         /* etapas futuras: gris con contraste AA */
  --future-dot: #D9D0CD;
  --success: #1E7A4C;
  --success-strong: #155C39;
  --success-soft: #E6F4EC;
  --info: #2F4E66;           /* notas informativas: azul pizarra suave */
  --info-soft: #EDF3F8;
  --danger: #A3122F;
  --danger-soft: #FDECEF;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(35, 28, 30, 0.04), 0 6px 20px rgba(35, 28, 30, 0.06);
  --font: "museo-sans", "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}

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

h1, h2, h3 { line-height: 1.2; margin: 0; }

h1 {
  font-size: clamp(1.5rem, 1.1rem + 2vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 8px; top: -60px;
  padding: 10px 14px;
  background: var(--text); color: #fff;
  border-radius: var(--radius-sm);
  z-index: 10;
}
.skip-link:focus { top: 8px; }

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

/* ---------- Header / footer ---------- */

.site-header {
  background: var(--brand);
  padding: 14px 0;
  padding-top: calc(14px + env(safe-area-inset-top));
}
.site-header .wrap { display: flex; align-items: center; }
.brand { display: inline-flex; border-radius: 6px; }
.brand:focus-visible { outline-color: #fff; outline-offset: 4px; }
.logo { width: 124px; height: auto; }

main { flex: 1; padding-top: 24px; padding-bottom: 40px; }

.site-footer {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 20px 0 calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.site-footer p { margin: 0; }
.site-footer .disclaimer {
  max-width: 60ch;
  margin-bottom: 10px;
  line-height: 1.5;
}

/* ---------- ¿Cómo funciona? ---------- */

.about { margin-top: 28px; }
.about h2 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 12px;
}
.about-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.about-list li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: start;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.about-list strong { color: var(--text); font-weight: 700; }
.about-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 900;
  font-size: 0.9rem;
}
.about-privacy {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ---------- Tarjetas ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.lead {
  color: var(--text-muted);
  margin: 8px 0 20px;
  font-size: 1.02rem;
}

/* ---------- Pestañas ---------- */

.form-card { overflow: hidden; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 6px;
  background: #F3EEEC;
  border-bottom: 1px solid var(--line);
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 8px;
  min-height: 48px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--brand-strong);
  box-shadow: 0 1px 3px rgba(35, 28, 30, 0.12);
}

/* ---------- Formulario ---------- */

form { padding: 20px 18px 22px; }

.field { margin-bottom: 16px; }

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

input, select {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1.05rem;         /* ≥16px evita el zoom automático en iOS */
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
select {
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%2362575B' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
input::placeholder { color: #968B8F; }
input:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring);
}
input[aria-invalid="true"], select[aria-invalid="true"] {
  border-color: var(--danger);
}

.help {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: -4px 0 12px;
}
.help em { font-style: normal; font-weight: 700; color: var(--text); }

.ejemplo {
  margin: 0 0 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
}
.ejemplo summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
  color: var(--brand-strong);
  list-style-position: inside;
}
.ejemplo summary:hover { text-decoration: underline; }
.ejemplo img { padding: 0 12px 12px; margin: 0 auto; }

.captcha { margin: 4px 0 16px; min-height: 65px; }

.alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 600;
  font-size: 0.95rem;
}

/* ---------- Botones ---------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 700;
  font-size: 1.02rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  width: 100%;
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-strong); }
.btn-primary[aria-busy="true"] { cursor: progress; opacity: .85; }
.btn-primary[aria-busy="true"]::before {
  content: "";
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.btn-ghost {
  background: transparent;
  color: var(--brand-strong);
  border-color: var(--line-strong);
  min-height: 44px;
  padding: 8px 14px;
  font-size: 0.92rem;
}
.btn-ghost:hover { border-color: var(--brand); background: var(--brand-soft); }


@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Resultado ---------- */

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.result-head h1:focus { outline: none; }
.result-head .btn-ghost { flex-shrink: 0; }

.notice {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #FFF6E5;
  color: #6B4A00;
  font-size: 0.92rem;
}

.result-list { display: grid; gap: 16px; }

.result-foot { margin-top: 24px; }


/* ---------- Tarjeta de pedido ---------- */

.order { padding: 18px 18px 16px; }

.order-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.order-kicker {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.order-num {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.order-badge {
  margin: 2px 0 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}
.order[data-etapa="4"] .order-badge { background: var(--success-soft); color: var(--success); }
.order[data-etapa="5"] .order-badge { background: #EFEBEA; color: var(--text-muted); }

.order-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin: 14px 0 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.order-meta div:first-child { grid-column: 1 / -1; }
.order-meta dt {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.order-meta dd {
  margin: 1px 0 0;
  font-weight: 600;
}

.order-msg {
  margin: 14px 0 4px;
  font-size: 0.98rem;
}
.msg-title { display: block; }
.msg-text { display: block; }

/* Etapa 4: "¡Tus lentes te esperan!" destacado */
.order[data-etapa="4"] .order-msg {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--success-soft);
  color: var(--success-strong);
}
.order[data-etapa="4"] .msg-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}
.order[data-etapa="4"] .step.is-current .step-label { color: var(--success-strong); }
.order[data-etapa="4"] .step.is-current .step-dot {
  border-color: var(--success);
  box-shadow: 0 0 0 5px rgba(30, 122, 76, 0.22);
}
.order[data-etapa="4"] .step.is-current .step-dot::after { background: var(--success); }

/* Nota informativa: tono suave, nunca de error */
.note {
  display: block;
  position: relative;
  padding: 10px 12px 10px 36px;
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  color: var(--info);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
}
.note::before {
  content: "i";
  position: absolute;
  left: 11px;
  top: 10px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--info);
  color: var(--info-soft);
  font: 700 0.72rem/17px Georgia, "Times New Roman", serif;
  font-style: italic;
  text-align: center;
}
.step-note { margin-top: 8px; }
.order-note { display: none; margin: 18px 0 0; }

.order-updated {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- Línea de tiempo (vertical en celular) ---------- */

.timeline {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  --dot: 28px;
}

.step {
  position: relative;
  display: grid;
  grid-template-columns: var(--dot) 1fr;
  gap: 14px;
  padding-bottom: 20px;
}
.step:last-child { padding-bottom: 0; }

/* Conector entre etapas */
.step::before {
  content: "";
  position: absolute;
  left: calc(var(--dot) / 2 - 1.5px);
  top: var(--dot);
  bottom: 0;
  width: 3px;
  background: var(--future-dot);
}
.step:last-child::before { display: none; }
.step.is-done::before { background: var(--brand); }

.step-dot {
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 3px solid var(--future-dot);
  position: relative;
  z-index: 1;
}

.step.is-done .step-dot {
  background: var(--brand);
  border-color: var(--brand);
}
.step.is-done .step-dot::after {
  content: "";
  width: 10px; height: 6px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: translateY(-1px) rotate(-45deg);
}

.step.is-current .step-dot {
  border-color: var(--brand);
  box-shadow: 0 0 0 5px var(--brand-ring);
}
.step.is-current .step-dot::after {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--brand);
}
/* La última etapa alcanzada (Entregado) se ve completa */
.step.is-current.is-final .step-dot { background: var(--brand); }
.step.is-current.is-final .step-dot::after {
  width: 10px; height: 6px; border-radius: 0; background: none;
  border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
  transform: translateY(-1px) rotate(-45deg);
}

.step-text { padding-top: 2px; min-width: 0; }
.step-label { display: block; font-weight: 600; }
.step-date { display: block; font-size: 0.85rem; color: var(--text-muted); }

.step.is-current .step-label { color: var(--brand-strong); font-weight: 800; }
.step.is-future .step-label { color: var(--future); font-weight: 500; }

@media (prefers-reduced-motion: no-preference) {
  .step.is-current:not(.is-final) .step-dot { animation: pulse 2.4s ease-in-out infinite; }
  @keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 5px var(--brand-ring); }
    50% { box-shadow: 0 0 0 9px rgba(173, 0, 36, 0.10); }
  }
}

/* ---------- Sin resultados ---------- */

.empty { padding: 22px 18px; }
.empty h2 { font-size: 1.2rem; }
.empty p { margin: 8px 0 0; color: var(--text-muted); }
.empty h3 { font-size: 1rem; margin: 20px 0 10px; }

.contacts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.contacts li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.contact-name { display: block; font-weight: 700; margin-bottom: 6px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 8px; }
.contact-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}
.contact-links a:hover { border-color: var(--brand); color: var(--brand-strong); }
.contact-links a.wa { border-color: #1E7A4C; color: #17603C; }
.contact-links a.wa:hover { background: var(--success-soft); }

/* ==========================================================================
   Escritorio
   ========================================================================== */

@media (min-width: 720px) {
  .site-header { padding-top: 18px; padding-bottom: 18px; }
  .about-list { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .about-list li { grid-template-columns: 1fr; gap: 8px; }
  .logo { width: 150px; }
  main { padding-top: 28px; }

  form { padding: 26px 28px 28px; }
  .btn-primary { width: auto; min-width: 200px; }
  .result-foot .btn-primary { width: auto; }

  .order { padding: 24px 26px 20px; }
  .order-meta { grid-template-columns: repeat(3, 1fr); }
  .order-meta div:first-child { grid-column: auto; }

  /* Línea de tiempo horizontal */
  .timeline {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    margin-top: 22px;
  }
  .step {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 10px;
    padding: 0 4px;
  }
  .step::before {
    left: calc(50% + var(--dot) / 2);
    right: calc(-50% + var(--dot) / 2);
    top: calc(var(--dot) / 2 - 1.5px);
    bottom: auto;
    width: auto;
    height: 3px;
  }
  .step-label { font-size: 0.92rem; }
  .step-date { font-size: 0.8rem; }

  /* La nota no cabe en una columna estrecha: va debajo de la línea de tiempo */
  .step-note { display: none; }
  .order-note { display: block; }
}
