/* HoraMundial.net — estilos. Sin dependencias externas. */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef2fa;
  --text: #1a2233;
  --muted: #586378;
  --border: #dbe2ee;
  --primary: #2f5bd3;
  --primary-hover: #2449b3;
  --primary-ink: #ffffff;
  --primary-soft: #e6edff;
  --accent: #f07c2b;
  --clock: #142152;
  --ok-bg: #e5f6ee; --ok-text: #11643f;
  --err-bg: #fdecec; --err-text: #a12a2a;
  --shadow: 0 1px 2px rgba(20, 33, 82, .06), 0 8px 24px rgba(20, 33, 82, .07);
  --radius: 18px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1420;
  --surface: #171e2c;
  --surface-2: #1f2839;
  --text: #e6ebf4;
  --muted: #9ca8bf;
  --border: #2b3549;
  --primary: #7f9cff;
  --primary-hover: #a3b8ff;
  --primary-ink: #0f1420;
  --primary-soft: #232f4f;
  --accent: #ffa261;
  --clock: #f2f5ff;
  --ok-bg: #14352a; --ok-text: #8fe0b8;
  --err-bg: #3d1c1f; --err-text: #ffb3b3;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}
/* Sin JavaScript: seguir la preferencia del sistema. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0f1420; --surface: #171e2c; --surface-2: #1f2839; --text: #e6ebf4; --muted: #9ca8bf;
    --border: #2b3549; --primary: #7f9cff; --primary-hover: #a3b8ff; --primary-ink: #0f1420;
    --primary-soft: #232f4f; --accent: #ffa261; --clock: #f2f5ff;
    --ok-bg: #14352a; --ok-text: #8fe0b8; --err-bg: #3d1c1f; --err-text: #ffb3b3;
  }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; width: 100%; }
img, svg { max-width: 100%; }
a { color: var(--primary); text-underline-offset: .18em; }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
small { color: var(--muted); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.visually-hidden {
  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; background: var(--primary); color: var(--primary-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 8px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font: inherit; font-weight: 600; line-height: 1.2;
  padding: .7em 1.2em; border-radius: 999px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text); cursor: pointer; text-decoration: none;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--primary-soft); color: var(--text); }
.btn--primary { background: var(--primary); color: var(--primary-ink); }
.btn--primary:hover { background: var(--primary-hover); color: var(--primary-ink); }
.btn--ghost { background: transparent; border-color: var(--border); }
.btn--small { font-size: .875rem; padding: .45em .9em; }

/* ---------------------------------------------------------------- cabecera */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 20; }
.site-header__row { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 1.2rem; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand__logo { width: 34px; height: 34px; color: var(--primary); flex: none; }
.brand__hand { stroke: var(--accent); }
.brand__name strong { color: var(--primary); font-weight: 800; }
.brand__tld { color: var(--muted); font-weight: 400; font-size: .85em; }
.site-header__tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.langs { position: relative; }
.langs summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); font-weight: 600; font-size: .9rem;
}
.langs summary::-webkit-details-marker { display: none; }
.langs summary svg { width: 18px; height: 18px; }
.langs__menu {
  position: absolute; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); min-width: 160px;
}
.langs__menu a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.langs__menu a:hover, .langs__menu a[aria-current] { background: var(--primary-soft); }
.langs__menu a[aria-current] { font-weight: 700; }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .9rem; font-weight: 600;
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------------------------------------------------------------- buscador */
.search { position: relative; flex: 1 1 280px; max-width: 460px; }
.search__icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search__input {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 10px 16px 10px 42px;
}
.search--inline { max-width: none; margin: 0 0 14px; }
.search--inline .search__input { padding-left: 16px; background: var(--surface); }
.search__input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search__list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  max-height: 360px; overflow-y: auto; z-index: 30;
}
.search__list li { padding: 9px 12px; border-radius: 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.search__list li[aria-selected="true"], .search__list li:hover { background: var(--primary-soft); }
.search__list .s-name { font-weight: 600; }
.search__list .s-meta { color: var(--muted); font-size: .875rem; text-align: right; }
.search__list .s-empty { color: var(--muted); cursor: default; }

/* ---------------------------------------------------------------- migas */
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 18px 0 0; padding: 0; font-size: .9rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin: 0 6px 0 2px; }
.breadcrumbs a { color: var(--muted); }

/* ---------------------------------------------------------------- herramienta */
.tool {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(18px, 4vw, 36px); margin: 18px 0 28px;
}
.tool__head { text-align: center; }
.tool__head h1 { margin-bottom: .25em; }
.tool__lead { color: var(--muted); margin: 0 auto 8px; max-width: 46rem; }
.tool__subtitle { margin-top: 28px; font-size: 1.2rem; }
.tool__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 24px; margin: 6px 0 22px; }
.tool__country { text-align: center; margin: 18px 0 0; }
.utc { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }

.bigclock { text-align: center; padding: 10px 0 6px; }
.bigclock__label { margin: 0; font-weight: 600; color: var(--muted); }
.bigclock__time {
  display: block; font-size: clamp(3.4rem, 15vw, 7.8rem); font-weight: 750; line-height: 1.05;
  color: var(--clock); font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin: 4px 0 6px;
}
.bigclock__time .ampm { font-size: .35em; font-weight: 600; margin-left: .2em; letter-spacing: 0; color: var(--muted); }
.bigclock__date { font-size: clamp(1.05rem, 3vw, 1.35rem); margin: 0; }
.bigclock__date::first-letter { text-transform: uppercase; }
.bigclock__zone { color: var(--muted); margin: 4px 0 0; }
.sync { font-size: .9rem; color: var(--muted); margin: 10px 0 0; }
.sync--warn { color: var(--accent); font-weight: 600; }

.settings { display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: center; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .95rem; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__ui { width: 40px; height: 22px; border-radius: 999px; background: var(--border); position: relative; transition: background-color .15s; flex: none; }
.switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + .switch__ui { background: var(--primary); }
.switch input:checked + .switch__ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__ui { outline: 3px solid var(--primary); outline-offset: 2px; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 0; }
.facts__item { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.facts__item--wide { grid-column: 1 / -1; }
.facts__item--you { background: var(--primary-soft); }
.facts dt { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.facts dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.facts dd small { font-weight: 400; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.zones { width: 100%; border-collapse: collapse; font-size: .95rem; }
.zones th, .zones td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.zones thead th { background: var(--surface-2); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.zones tbody tr:last-child th, .zones tbody tr:last-child td { border-bottom: 0; }
.zones tbody th { font-weight: 600; }
.zones__time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------------------------------------------------------- relojes de ciudades */
.worldclocks { margin-top: 28px; }
.worldclocks__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.worldclocks__head h2 { margin: 0; }
.worldclocks__actions { display: flex; gap: 8px; }
.clocks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.clock {
  position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "place time" "place meta";
  align-items: center; gap: 0 10px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
}
.tool .clock { background: var(--surface-2); border-color: transparent; }
.clock__place { grid-area: place; min-width: 0; }
.clock__name { display: block; font-weight: 700; color: var(--text); text-decoration: none; overflow-wrap: break-word; hyphens: auto; }
.clock__name:hover { color: var(--primary); text-decoration: underline; }
.clock__country { display: block; font-size: .85rem; color: var(--muted); }
.clock__time { grid-area: time; font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; color: var(--clock); }
.clock__time .ampm { font-size: .6em; color: var(--muted); margin-left: .15em; }
.clock__meta { grid-area: meta; font-size: .8rem; color: var(--muted); text-align: right; max-width: 9.5rem; justify-self: end; line-height: 1.3; }
.clocks--editable .clock { padding-right: 38px; }
.clock__remove {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: transparent; color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.clock__remove:hover { background: var(--err-bg); color: var(--err-text); }

/* ---------------------------------------------------------------- secciones */
.section { margin: 0 0 36px; }
.section--narrow { max-width: 780px; margin-left: auto; margin-right: auto; padding-top: 18px; }
.prose { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(18px, 4vw, 36px); }
.prose h2 { margin-top: 1.4em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 1.2em 0 .3em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .45em; }
.steps { counter-reset: step; list-style: none; padding-left: 0 !important; }
.steps li { counter-increment: step; position: relative; padding-left: 2.6em; margin-bottom: .9em; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: .05em; width: 1.8em; height: 1.8em; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; display: grid; place-items: center; font-size: .9em;
}
.lead { font-size: 1.1rem; color: var(--muted); }

.continent { border-top: 1px solid var(--border); }
.continent:last-of-type { border-bottom: 1px solid var(--border); }
.continent summary { cursor: pointer; padding: 12px 0; list-style: none; display: flex; align-items: center; }
.continent summary::-webkit-details-marker { display: none; }
.continent summary::before { content: "+"; width: 1.6em; font-weight: 700; color: var(--primary); font-size: 1.2rem; }
.continent[open] summary::before { content: "−"; }
.continent summary h3 { margin: 0; display: inline; font-size: 1.1rem; }
.continent__count { font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.country-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 16px; }
.country-list a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.country-list a:hover { background: var(--surface); color: var(--primary); }
.country-list small { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------------------------------------------------------- FAQ */
.faq__item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; }
.faq__item summary { cursor: pointer; list-style: none; padding: 14px 48px 14px 18px; position: relative; }
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; color: var(--primary); font-weight: 600; }
.faq__item[open] summary::after { content: "−"; }
.faq__q { margin: 0; font-size: 1.02rem; }
.faq__a { padding: 0 18px 4px; color: var(--text); }

/* ---------------------------------------------------------------- compartir */
.share { margin-top: 26px; text-align: center; }
.share__title { font-weight: 600; margin-bottom: 10px; }
.share__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.share__btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px;
  font: inherit; font-size: .9rem; font-weight: 600; text-decoration: none; color: #fff; border: 0; cursor: pointer;
}
.share__btn svg { width: 18px; height: 18px; flex: none; }
.share__btn:hover { color: #fff; filter: brightness(1.08); }
.share__btn--facebook { background: #1668d8; }
.share__btn--whatsapp { background: #0d7a3e; }
.share__btn--x { background: #111; }
.share__btn--telegram { background: #156fa6; }
.share__btn--copy { background: var(--surface-2); color: var(--text); }
.share__btn--copy:hover { color: var(--text); }
:root[data-theme="dark"] .share__btn--x { background: #f2f2f2; color: #111; }

/* ---------------------------------------------------------------- formularios */
.form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(18px, 4vw, 32px); }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field input[type="text"], .field input[type="email"], .field textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field [aria-invalid="true"] { border-color: var(--err-text); }
.field__error { color: var(--err-text); font-size: .9rem; margin: 6px 0 0; }
.field__hint { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
.field--check { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: start; }
.field--check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--primary); }
.field--check label { font-weight: 400; margin: 0; }
.field--check .field__error { grid-column: 1 / -1; }
.field--hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__legal { font-size: .82rem; color: var(--muted); }
.captcha__box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.captcha__img { border-radius: var(--radius-sm); border: 1px solid var(--border); background: #fff; }
.captcha input { max-width: 240px; text-transform: uppercase; letter-spacing: .2em; }
.notice { border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 18px; font-weight: 500; }
.notice p { margin: 0; }
.notice--ok { background: var(--ok-bg); color: var(--ok-text); }
.notice--error { background: var(--err-bg); color: var(--err-text); }
.contact-alt { margin-top: 22px; color: var(--muted); }
.email-img { display: block; height: auto; }
.email-img--inline { display: inline-block; vertical-align: middle; width: 200px; }
:root[data-theme="dark"] .email-img { filter: invert(1) hue-rotate(180deg) brightness(1.1); }
.legal__updated { color: var(--muted); font-size: .9rem; }

.error-page { text-align: center; padding: 48px 0; }
.error-page__code { font-size: 5rem; font-weight: 800; color: var(--primary); margin: 0; line-height: 1; }

/* ---------------------------------------------------------------- anuncios */
.ad { margin: 0 auto 28px; text-align: center; max-width: 100%; overflow: hidden; }
.ad--reserve { min-height: 120px; }
.ad--after_tool.ad--reserve, .ad--in_content.ad--reserve, .ad--before_faq.ad--reserve { min-height: 280px; }
.ad--top { margin-top: 16px; }

/* ---------------------------------------------------------------- pie */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 32px 0 24px; margin-top: 12px; font-size: .92rem; }
.site-footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.site-footer__brand { font-weight: 800; font-size: 1.1rem; margin-bottom: 8px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--text); }
.site-footer a[aria-current] { font-weight: 700; color: var(--primary); }
.disclaimer { color: var(--muted); font-size: .85rem; }
.site-footer__copy { color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); margin: 22px 0 0; padding-top: 16px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 760px) {
  .site-header__row { gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .theme-toggle__text { display: none; }
  .site-footer__grid { grid-template-columns: 1fr; }
  .form__row { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .brand { font-size: 1.05rem; }
  .brand__logo { width: 30px; height: 30px; }
  .clocks { grid-template-columns: 1fr; }
  .share__btn span { display: none; }
  .share__btn { padding: 11px; }
  .share__btn--copy span { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
@media print {
  .site-header, .site-footer, .share, .ad, .settings, .worldclocks__actions { display: none !important; }
  body { background: #fff; color: #000; }
}
