/* ====== Hembrita o Varón — estilos ====== */

@font-face {
  font-family: 'Gotham';
  src: url('../fonts/Gotham-Medium.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #fbf7f9;
  --card: #ffffff;
  --ink: #2a2330;
  --muted: #6f6678;
  --line: #eadfe8;
  --girl: #e2477f;
  --boy: #2b7fd4;
  /* Variantes solo para TEXTO pequeño: las de arriba no llegan a 4.5:1. */
  --girl-ink: #cc205e;
  --boy-ink: #256eb8;
  --girl-soft: #fce7f0;
  --boy-soft: #e4f0fc;
  --grayzone: #82868e;
  --grayzone-soft: #f0f0f2;
  --good: #0e7e47;
  --good-soft: #e3f5ec;
  --warn: #986500;
  --warn-soft: #fdf3dd;
  --err: #c22f4d;
  --focus: #7c5cdb;
  --shadow: 0 8px 24px rgba(90, 40, 90, 0.08);
  /* Decorativo (sin texto encima). */
  --grad: linear-gradient(90deg, #f0619b, #4aa3ef);
  /* Con texto blanco encima: oscurecido hasta pasar AA. */
  --grad-strong: linear-gradient(90deg, #e5166a, #1278cf);
  /* Texto sobre las bandas de color de la línea de tiempo. */
  --on-band: #0e0d11;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17151a;
    --card: #221f27;
    --ink: #f3eef6;
    --muted: #a89fb2;
    --line: #37323e;
    --girl: #e75d92;
    --boy: #3f97e0;
    --girl-ink: #e96d9c;
    --boy-ink: #469be1;
    --girl-soft: #3a2530;
    --boy-soft: #20303f;
    --grayzone: #9094a0;
    --grayzone-soft: #2b2931;
    --good: #4cc38a;
    --good-soft: #1d3229;
    --warn: #e2b34c;
    --warn-soft: #35301f;
    --err: #d86079;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

/* El atributo hidden debe ganar a cualquier display de las clases. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Gotham', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

/* ---------- header ---------- */

.hero {
  position: relative;
  background: var(--card);
  text-align: center;
  padding: 26px 16px 18px;
  box-shadow: var(--shadow);
}

.hero-ribbon {
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--grad);
}

.logo {
  width: 150px;
  height: auto;
}

.tagline {
  margin: 6px auto 0;
  max-width: 420px;
  color: var(--muted);
  font-size: 0.95rem;
}

.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 18px;
  border: 1.5px solid var(--girl-ink);
  border-radius: 999px;
  color: var(--girl-ink);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  max-width: 100%;
}

.dl-btn:hover { background: var(--girl-soft); }

.dl-card {
  background: var(--boy-soft);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 16px 0 4px;
  font-size: 0.92rem;
}

.dl-card p { margin: 6px 0; }

.dl-title { font-weight: 700; }

.dl-card .dl-btn { margin-top: 8px; }

.dl-meta { color: var(--muted); font-size: 0.8rem; }

.lang-switch {
  position: absolute;
  top: 16px;
  right: 14px;
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg);
}

.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 11px;
  cursor: pointer;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--grad-strong);
  color: #fff;
}

/* ---------- layout ---------- */

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 14px 30px;
}

.card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1.02rem;
  margin: 0 0 14px;
}

.title-icon { width: 26px; height: 26px; object-fit: contain; }

.muted { color: var(--muted); font-size: 0.88rem; }

/* ---------- campos ---------- */

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .field-grid { grid-template-columns: 1fr; }
}

.field { display: block; position: relative; min-width: 0; }

/*
 * iOS no muestra ninguna pista en los campos de fecha vacíos y Chrome/Android
 * muestran "mm/dd/aaaa". Unificamos: mientras el campo esté vacío y sin foco
 * se ve solo nuestra pista; al enfocarlo reaparece la interfaz nativa.
 */
.field.date-field.is-empty::after {
  content: attr(data-ph);
  position: absolute;
  left: 14px;
  bottom: 13px;
  color: var(--muted);
  font-size: 0.92rem;
  pointer-events: none;
}

.field.date-field.is-empty:focus-within::after { content: none; }

.date-field.is-empty input[type="date"] { color: transparent; }

.date-field.is-empty:focus-within input[type="date"],
.date-field.is-empty input[type="date"]:focus { color: var(--ink); }

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.field-icon { width: 18px; height: 18px; object-fit: contain; }

input[type="date"], input[type="number"], .select {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* Safari iOS: quitar estilos nativos que descolocan el texto y fijar altura. */
input[type="date"], input[type="number"] {
  -webkit-appearance: none;
  appearance: none;
  min-height: 46px;
}

input[type="date"] { text-align: left; }

input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  margin: 0;
}

input:focus-visible, .select:focus-visible, button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 2px 10px;
}

.tab {
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.tab-icon { width: 20px; height: 20px; object-fit: contain; border-radius: 5px; }

.tab.active {
  border-color: transparent;
  background: var(--grad-strong);
  color: #fff;
}

/* ---------- segmented ---------- */

.segmented {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.seg-option {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.92rem;
}

.seg-option:has(input:checked) {
  border-color: var(--girl);
  background: var(--girl-soft);
}

.seg-option input { accent-color: var(--girl); margin: 0; }

.mode-input { margin-bottom: 6px; }

/* ---------- botones ---------- */

.cta {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: var(--grad-strong);
  color: #fff;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 700;
  padding: 13px 18px;
  cursor: pointer;
  margin-top: 8px;
  transition: filter 0.15s ease, transform 0.05s ease;
}

.cta:hover { filter: brightness(1.06); }
.cta:active { transform: scale(0.99); }

.ghost-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  margin-top: 12px;
}

.form-error {
  color: var(--err);
  font-size: 0.88rem;
  margin: 10px 0 0;
}

/* ---------- resultado ---------- */

.result-card { text-align: center; }

.result-img { width: 210px; height: auto; margin: 4px auto 2px; }

.result-headline {
  font-size: 1.9rem;
  font-weight: 700;
  margin: 4px 0 8px;
}

.result-headline.girl { color: var(--girl); }
.result-headline.boy { color: var(--boy); }
.result-headline.uncertain { color: var(--muted); }

.chip {
  display: inline-block;
  font-size: 0.83rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 5px 13px;
  margin: 0 0 12px;
}

.chip.high { background: var(--good-soft); color: var(--good); }
.chip.medium { background: var(--warn-soft); color: var(--warn); }
.chip.low {
  background: var(--grayzone-soft);
  color: var(--ink);
  background-image: repeating-linear-gradient(45deg, rgba(130, 134, 142, 0.18) 0 5px, transparent 5px 10px);
}

.result-expl {
  text-align: left;
  font-size: 0.94rem;
  color: var(--ink);
}

.result-expl p { margin: 6px 0; }

.warn-box {
  text-align: left;
  background: var(--warn-soft);
  border-left: 4px solid var(--warn);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  margin-top: 10px;
}

/* esquema tipo documento */

.schema { margin-top: 14px; text-align: left; }

.schema summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--boy-ink);
}

.schema-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.schema-col {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.schema-col h4 {
  margin: 0;
  padding: 8px 10px;
  font-size: 0.84rem;
  color: var(--on-band);
  text-align: center;
}

.schema-col.mother h4 { background: var(--girl); }
.schema-col.father h4 { background: var(--boy); }

.schema-col ul { list-style: none; margin: 0; padding: 6px 0; }

.schema-col li {
  padding: 3px 10px;
  font-size: 0.88rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.schema-col li.hit {
  font-weight: 700;
  background: var(--girl-soft);
}

.schema-col.father li.hit { background: var(--boy-soft); }

.schema-note { font-size: 0.8rem; color: var(--muted); margin: 8px 0 0; }

/* ---------- planificador ---------- */

.select { margin-bottom: 4px; }

.timeline {
  position: relative;
  height: 64px;
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
  margin-top: 6px;
}

.band {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-band);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: inset 2px 0 0 var(--card), inset -2px 0 0 var(--card);
}

.band.girl { background: var(--girl); }
.band.boy { background: var(--boy); }
.band.uncertain { background: var(--grayzone); }

.gray-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  background: repeating-linear-gradient(45deg, rgba(24, 22, 28, 0.38) 0 6px, transparent 6px 12px);
  border-left: 1px solid rgba(24, 22, 28, 0.35);
  border-right: 1px solid rgba(24, 22, 28, 0.35);
}

@media (prefers-color-scheme: dark) {
  .gray-overlay {
    background: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.5) 0 6px, transparent 6px 12px);
  }
}

.change-tick {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--ink);
  opacity: 0.55;
}

.timeline-axis {
  position: relative;
  height: 22px;
  margin-bottom: 12px;
}

.axis-label {
  position: absolute;
  top: 3px;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.axis-label.edge-left { transform: none; }
.axis-label.edge-right { transform: translateX(-100%); }

/* leyenda */

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 0;
  margin: 0 0 6px;
  font-size: 0.84rem;
  color: var(--muted);
}

.legend li { display: flex; align-items: center; gap: 6px; }

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
}

.swatch.girl { background: var(--girl); }
.swatch.boy { background: var(--boy); }
.swatch.grayzone {
  background: repeating-linear-gradient(45deg, rgba(130, 134, 142, 0.85) 0 4px, transparent 4px 8px);
  border: 1px solid var(--grayzone);
}

.windows-title { font-size: 0.98rem; margin: 16px 0 2px; }
.windows-note { font-size: 0.8rem; color: var(--muted); margin: 0 0 10px; }

.windows { display: grid; gap: 10px; }

.window-group {
  border-radius: 14px;
  padding: 12px 14px;
}

.window-group.girl { background: var(--girl-soft); }
.window-group.boy { background: var(--boy-soft); }

.window-group h4 {
  margin: 0 0 6px;
  font-size: 0.9rem;
}

.window-group.girl h4 { color: var(--girl-ink); }
.window-group.boy h4 { color: var(--boy-ink); }

.window-group ul { margin: 0; padding-left: 18px; font-size: 0.92rem; }
.window-group li { margin: 3px 0; }
.window-group .duration { color: var(--muted); font-size: 0.82rem; }

/* ---------- historial ---------- */

.history-list { list-style: none; margin: 12px 0 0; padding: 0; }

.history-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 10px 2px;
  font-size: 0.9rem;
}

.history-list li:last-child { border-bottom: 0; }

.h-badge {
  font-size: 1.15rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.h-badge.girl { background: var(--girl-soft); }
.h-badge.boy { background: var(--boy-soft); }
.h-badge.uncertain { background: var(--grayzone-soft); }

.h-main { flex: 1; min-width: 0; }
.h-sub { color: var(--muted); font-size: 0.8rem; }

.h-del {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}

.h-del img { width: 18px; height: 18px; }
.h-del:hover { background: var(--grayzone-soft); }

/* ---------- método ---------- */

.steps { padding-left: 20px; }
.steps li { margin: 8px 0; }

.disclaimer {
  background: var(--warn-soft);
  border-left: 4px solid var(--warn);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 0.92rem;
}

.disclaimer-title { font-weight: 700; margin: 0 0 4px; }
.disclaimer p { margin: 0; }

.credit { font-size: 0.9rem; color: var(--muted); margin: 8px 0 0; }

.credit a { color: var(--boy-ink); }

.social { display: flex; gap: 14px; margin-top: 14px; }

.social img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 10px;
}

/* ---------- footer / tooltip ---------- */

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 4px 16px 34px;
}

footer p { margin: 4px 0; }

.version { opacity: 0.7; }

.tooltip {
  position: fixed;
  z-index: 50;
  max-width: 260px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.8rem;
  padding: 7px 10px;
  border-radius: 8px;
  pointer-events: none;
  box-shadow: var(--shadow);
}
