/* Hora dorada — papel cuadriculado de tkaed; los colores de la luz solo en cabecera y franja */

:root {
  --paper: #f2f6f3;
  --card: #ffffff;
  --ink: #112a3a;
  --pencil: #4d626e;
  --line: rgba(17, 42, 58, 0.14);
  --amber: #f2b632;
  --amber-soft: rgba(242, 182, 50, 0.32);
  --no: #a8324a;
  --l-noche: #16233f;
  --l-azul: #3b5ba5;
  --l-dorada: #f0a83a;
  --l-dia: #9fd0ee;
  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
}

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

a { color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }

main, .top, .foot { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 0; }
.brand { font-family: var(--serif); font-size: 1.1rem; text-decoration: none; }
.top nav { display: flex; gap: 1.25rem; font-size: 0.95rem; }
.top nav a { text-decoration: none; border-bottom: 2px solid transparent; }
.top nav a:hover { border-bottom-color: var(--amber); }

/* Intro */
.intro { padding: 0.6rem 0 1.2rem; max-width: 46rem; }
.intro h1 { font-size: clamp(1.85rem, 6vw, 3.2rem); margin-bottom: 0.5rem; }
.lede { font-size: 1.05rem; color: var(--pencil); max-width: 40rem; margin: 0; }

/* Tool card */
.tool {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 7px 7px 0 var(--amber);
  overflow: hidden;
  margin-bottom: 2rem;
}

/* Sky header: changes with the current light in the chosen city */
.sky {
  padding: 0.9rem 1.1rem 1rem;
  border-bottom: 2px solid var(--ink);
  color: #fff;
  transition: background 0.6s;
}
.sky[data-phase="noche"]  { background: linear-gradient(180deg, #0c1528, var(--l-noche) 70%, #24345a); }
.sky[data-phase="azul"]   { background: linear-gradient(180deg, #1e3367, var(--l-azul) 65%, #7d8fc4); }
.sky[data-phase="dorada"] { background: linear-gradient(180deg, #8a6fa8, #e98d4b 55%, var(--l-dorada)); color: var(--ink); }
.sky[data-phase="dia"]    { background: linear-gradient(180deg, #5fa8dc, var(--l-dia) 70%, #d6ecf7); color: var(--ink); }
.sky p { margin: 0; }
.sky-where { font-size: 0.9rem; font-weight: 500; opacity: 0.9; }
.sky-phase { font-family: var(--serif); font-size: clamp(1.4rem, 4.5vw, 1.9rem); line-height: 1.2; }
.sky-next { font-size: 0.95rem; font-weight: 500; min-height: 1.5em; }

.tool-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding: 1.1rem; }
@media (min-width: 880px) {
  .tool-body { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 2.5rem; align-items: start; }
}

.field-label { display: block; font-weight: 700; margin: 0 0 0.5rem; }
.hint { font-size: 0.88rem; color: var(--pencil); margin: 0.4rem 0 0; }
.form-msg { margin: 0.6rem 0 0; font-size: 0.95rem; color: var(--no); font-weight: 500; }
.form-msg:empty { display: none; }

input[type="text"], input[type="date"] {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 4px; padding: 0.6rem 0.7rem; min-height: 46px;
}

/* City search */
.combo { position: relative; }
.city-list {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px);
  list-style: none; margin: 0; padding: 0.25rem 0;
  background: var(--card); border: 2px solid var(--ink); border-radius: 4px;
  box-shadow: 4px 4px 0 var(--amber); max-height: 320px; overflow-y: auto;
}
.city-list li { padding: 0.5rem 0.75rem; cursor: pointer; line-height: 1.3; }
.city-list li small { color: var(--pencil); }
.city-list li[aria-selected="true"], .city-list li:hover { background: var(--amber-soft); }
.city-list li.empty { cursor: default; color: var(--pencil); background: none; }

.btn-ghost {
  font: inherit; font-weight: 700; font-size: 0.95rem;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 4px; padding: 0.55rem 0.9rem; cursor: pointer; min-height: 44px;
}
.btn-ghost:hover { background: var(--amber-soft); }
#btn-geo { margin-top: 0.7rem; }

.date-field { margin-top: 1.2rem; }
.date-row { display: flex; gap: 0.4rem; align-items: stretch; }
.date-row input { flex: 1; min-width: 0; }
.btn-step {
  font: inherit; font-size: 1.4rem; line-height: 1; width: 46px; flex: none;
  background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 4px; cursor: pointer;
}
.btn-step:hover { background: var(--amber-soft); }
.btn-today { flex: none; }

/* More options */
.more { margin-top: 1rem; }
.more summary { cursor: pointer; font-weight: 500; font-size: 0.95rem; padding: 0.3rem 0; }
.range-label { display: block; font-size: 0.92rem; font-weight: 500; margin-top: 0.8rem; }
.more input[type="range"] { width: 100%; accent-color: var(--ink); margin: 0.4rem 0 0; }
.coords { border: 1px solid var(--line); border-radius: 4px; margin: 1rem 0 0; padding: 0.6rem 0.8rem 0.8rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.coords legend { font-size: 0.92rem; font-weight: 700; padding: 0 0.3rem; }
.coords label { font-size: 0.85rem; font-weight: 700; }
.coords input { margin-top: 0.2rem; }
.coords button { grid-column: 1 / -1; }

/* Result */
.res-title { font-size: 1.2rem; margin-bottom: 0.7rem; }
.strip-wrap { margin-bottom: 0.4rem; }
.strip {
  position: relative; height: 48px; border: 2px solid var(--ink); border-radius: 4px; overflow: hidden; background: var(--l-noche);
}
.strip .seg { position: absolute; top: 0; bottom: 0; }
.seg-noche { background: var(--l-noche); }
.seg-azul { background: var(--l-azul); }
.seg-dorada { background: var(--l-dorada); }
.seg-dia { background: var(--l-dia); }
.strip .now { position: absolute; top: -2px; bottom: -2px; width: 0; border-left: 3px solid var(--no); }
.strip .now::after {
  content: "ahora"; position: absolute; top: 2px; left: 3px; font-size: 0.7rem; font-weight: 700;
  background: var(--card); color: var(--no); padding: 0 0.25rem; border-radius: 2px;
}
.strip-scale { position: relative; height: 1.2rem; font-size: 0.75rem; color: var(--pencil); font-variant-numeric: tabular-nums; }
.strip-scale span { position: absolute; top: 0; transform: translateX(-50%); }
.strip-scale span:first-child { transform: none; }
.strip-scale span:last-child { transform: translateX(-100%); }

.legend { list-style: none; padding: 0; margin: 0.2rem 0 0.9rem; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.82rem; color: var(--pencil); }
.sw { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--ink); border-radius: 2px; margin-right: 0.35rem; vertical-align: -1px; }
.sw-noche { background: var(--l-noche); } .sw-azul { background: var(--l-azul); }
.sw-dorada { background: var(--l-dorada); } .sw-dia { background: var(--l-dia); }

.res-msg { background: var(--amber-soft); border-left: 4px solid var(--amber); padding: 0.5rem 0.7rem; font-weight: 500; }
.res-msg:empty { display: none; }

.halves { display: grid; gap: 1rem; }
@media (min-width: 520px) { .halves { grid-template-columns: 1fr 1fr; } }
.half h4 { margin: 0 0 0.3rem; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pencil); }
.half dl { margin: 0; }
.half dl > div { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.half dt { font-weight: 500; }
.half dt i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.4rem; border: 1px solid var(--ink); }
.half dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.half dd small { display: block; font-weight: 400; color: var(--pencil); font-size: 0.8rem; }

.tip { margin: 1rem 0 0; font-size: 0.95rem; }
.tip:empty { display: none; }
.actions { display: grid; grid-template-columns: 1fr auto; gap: 0.6rem; margin-top: 1rem; }
.btn-primary {
  font: inherit; font-weight: 700; font-size: 1.02rem; cursor: pointer;
  background: var(--ink); color: var(--paper);
  border: 2px solid var(--ink); border-radius: 4px; padding: 0.75rem 1rem; min-height: 46px;
}
.btn-primary:hover { background: #0b1d29; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

/* Week */
.week { padding: 0 1.1rem 1.1rem; }
.week h3 { margin: 0.4rem 0 0.6rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 700; font-size: 0.82rem; color: var(--pencil); }
tbody tr[aria-current="date"] { background: var(--amber-soft); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: rgba(242, 182, 50, 0.16); }

/* Ad slots (placeholders) */
.ad-slot {
  min-height: 90px; margin: 2rem 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: 4px;
  color: rgba(77, 98, 110, 0.55); font-size: 0.8rem;
}

/* Content sections */
.how, .seo, .faq { max-width: 46rem; margin: 3rem 0; }
.how h2, .faq h2 { margin-bottom: 1rem; }
.seo h2 { margin: 1.8rem 0 0.8rem; }
.seo h2:first-child { margin-top: 0; }
.steps { padding-left: 1.4rem; margin: 0; }
.steps li { margin-bottom: 0.8rem; padding-left: 0.3rem; }
.seo p { max-width: 42rem; }

.cities { margin: 2.5rem 0; }
.cities h2 { margin-bottom: 0.8rem; }
.cities ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.7rem; }
.cities a {
  display: inline-block; padding: 0.5rem 0.9rem; border: 2px solid var(--ink); border-radius: 8px;
  background: #fff; color: var(--ink); text-decoration: none; font-weight: 500;
  box-shadow: 3px 3px 0 var(--amber);
}
.cities a:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--amber); }
.cities a[aria-current="page"] { background: var(--amber); box-shadow: none; }

.faq summary { cursor: pointer; font-weight: 500; }
.faq details { border-top: 1px solid var(--line); padding: 0.8rem 0; }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq details p { margin: 0.6rem 0 0; color: var(--pencil); }

.foot { padding: 2rem 0 3rem; border-top: 2px solid var(--ink); color: var(--pencil); font-size: 0.9rem; }
.foot p { margin: 0; }
.noscript { background: var(--amber); padding: 1rem; text-align: center; margin: 0; }

@media (max-width: 420px) {
  .top nav a[href="#preguntas"] { display: none; }
  .actions { grid-template-columns: 1fr; }
  th, td { padding: 0.4rem 0.3rem; font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sky { transition: none; }
}

/* Escondido hasta que AdSense apruebe; entonces borrar esta regla y poner los bloques. */
.ad-slot { display: none !important; }
