/*
Theme Name:  Almanaque Hoy
Description: Tema de Almanaque Hoy: noticias con humor, clima, luna, efemérides y juegos.
Version:     0.1.0
Requires at least: 6.5
Requires PHP: 8.0
Author:      Almanaque Hoy
Text Domain: almanaquehoy
*/

/* ---------- Variables ---------- */
:root {
	--ah-ink: #1b2430;
	--ah-ink-soft: #4a5565;
	--ah-paper: #faf7f0;
	--ah-card: #ffffff;
	--ah-line: #e6e0d2;
	--ah-primary: #0f3d56;
	--ah-primary-2: #155a7d;
	--ah-sun: #f5b700;
	--ah-coral: #ff6b4a;
	--ah-radius: 14px;
	--ah-shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 6px 18px rgba(15, 61, 86, .07);
	--ah-max: 1200px;
	--ah-serif: Georgia, "Times New Roman", serif;
	--ah-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--ah-paper);
	color: var(--ah-ink);
	font: 17px/1.6 var(--ah-sans);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ah-primary-2); }
a:hover { color: var(--ah-coral); }
:focus-visible { outline: 3px solid var(--ah-sun); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--ah-serif); line-height: 1.2; margin: 0 0 .5em; color: var(--ah-ink); }
.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus {
	clip: auto; width: auto; height: auto; z-index: 1000; top: 8px; left: 8px;
	background: #fff; padding: 8px 12px; border-radius: 8px;
}
.ah-wrap { max-width: var(--ah-max); margin: 0 auto; padding: 0 16px; }

/* ---------- Barra superior ---------- */
.ah-topbar { background: var(--ah-primary); color: #dfeaf1; font-size: 14px; }
.ah-topbar .ah-wrap { display: flex; gap: 16px; align-items: center; justify-content: space-between; min-height: 36px; flex-wrap: wrap; }
.ah-topbar a { color: #fff; text-decoration: none; }


/* ---------- Cabecera ---------- */
.ah-header { background: var(--ah-card); border-bottom: 1px solid var(--ah-line); position: sticky; top: 0; z-index: 50; }
.ah-header__row { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.ah-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ah-ink); margin-right: auto; }
.ah-logo__sun { width: 38px; height: 38px; flex: none; }
.ah-logo__name { font-family: var(--ah-serif); font-weight: 700; font-size: 26px; letter-spacing: -.5px; line-height: 1; }
.ah-logo__name b { color: var(--ah-coral); }
.ah-logo__tag { display: block; font-family: var(--ah-sans); font-size: 12px; color: var(--ah-ink-soft); font-weight: 400; letter-spacing: 0; margin-top: 3px; }

.ah-search { display: flex; }
.ah-search input[type="search"] {
	border: 1px solid var(--ah-line); border-radius: 999px 0 0 999px; padding: 8px 14px; font: inherit; font-size: 15px; width: 200px; background: var(--ah-paper);
}
.ah-search button { border: 0; border-radius: 0 999px 999px 0; padding: 0 14px; background: var(--ah-primary); color: #fff; cursor: pointer; font-size: 15px; }

.ah-menu-toggle { display: none; border: 1px solid var(--ah-line); background: #fff; border-radius: 10px; padding: 8px 12px; font: inherit; cursor: pointer; }

.ah-nav { border-top: 1px solid var(--ah-line); }
.ah-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.ah-nav a {
	display: block; padding: 10px 12px; text-decoration: none; color: var(--ah-ink); font-weight: 600; font-size: 15px; white-space: nowrap; border-bottom: 3px solid transparent;
}
.ah-nav a:hover, .ah-nav .current-menu-item > a, .ah-nav .current-menu-parent > a { border-bottom-color: var(--ah-sun); color: var(--ah-primary); }

/* ---------- Almanaque del día ---------- */
.ah-almanac { padding: 20px 0 8px; }
.ah-almanac__grid { display: grid; grid-template-columns: 1.3fr 1fr 1.4fr; gap: 16px; }
.ah-panel { background: var(--ah-card); border-radius: var(--ah-radius); box-shadow: var(--ah-shadow); padding: 18px; position: relative; }
.ah-panel__title { font-family: var(--ah-sans); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ah-ink-soft); margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ah-panel__title a { font-size: 13px; text-transform: none; letter-spacing: 0; }
.ah-panel--weather { background: linear-gradient(135deg, #0f3d56, #1f7aa6); color: #fff; }
.ah-panel--weather .ah-panel__title { color: #cfe3ee; }
.ah-panel--weather .ah-panel__title a { color: #fff; }
.ah-city-select { font: inherit; font-size: 14px; border-radius: 8px; border: 0; padding: 4px 8px; background: rgba(255, 255, 255, .15); color: #fff; }
.ah-city-select option { color: var(--ah-ink); }
.ah-weather__now { display: flex; align-items: center; gap: 14px; }
.ah-weather__emoji { font-size: 54px; line-height: 1; }
.ah-weather__temp { font-size: 46px; font-weight: 700; line-height: 1; }
.ah-weather__label { font-size: 16px; opacity: .9; }
.ah-weather__joke { margin: 12px 0 10px; font-style: italic; color: #fff8dc; }
.ah-weather__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: #dbeaf2; }
.ah-weather__city[hidden] { display: none; }

.ah-moon { display: flex; gap: 14px; align-items: center; }
.ah-moon__emoji { font-size: 58px; line-height: 1; }
.ah-moon__name { font-family: var(--ah-serif); font-size: 22px; font-weight: 700; }
.ah-moon__meta { font-size: 14px; color: var(--ah-ink-soft); }
.ah-moon__joke { font-style: italic; margin: 12px 0 0; color: var(--ah-ink-soft); }
.ah-sun-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--ah-line); font-size: 14px; }

.ah-efem { list-style: none; margin: 0; padding: 0; }
.ah-efem li { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--ah-line); font-size: 15px; line-height: 1.4; }
.ah-efem li:last-child { border-bottom: 0; }
.ah-efem__year { font-weight: 700; color: var(--ah-coral); font-variant-numeric: tabular-nums; }
.ah-efem a { color: inherit; text-decoration: none; }
.ah-efem a:hover { text-decoration: underline; }
.ah-credit { font-size: 12px; color: var(--ah-ink-soft); margin: 8px 0 0; }
.ah-panel--weather .ah-credit, .ah-panel--weather .ah-credit a { color: #bcd6e4; }

/* ---------- Secciones ---------- */
.ah-section { padding: 22px 0; }
.ah-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--ah-ink); margin-bottom: 16px; }
.ah-section__head h2 { font-size: 26px; margin: 0 0 6px; }
.ah-section__head a { font-weight: 600; font-size: 15px; text-decoration: none; }

.ah-lead { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
.ah-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.ah-grid--4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Tarjetas ---------- */
.ah-card { background: var(--ah-card); border-radius: var(--ah-radius); box-shadow: var(--ah-shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s ease; }
.ah-card:hover { transform: translateY(-2px); }
.ah-card__media { aspect-ratio: 16 / 9; background: var(--ah-cat, var(--ah-primary)); position: relative; overflow: hidden; display: block; }
.ah-card__media img { width: 100%; height: 100%; object-fit: cover; }
.ah-card__placeholder { position: absolute; inset: 0; display: grid; place-items: center; font-size: 46px; background: linear-gradient(135deg, var(--ah-cat, var(--ah-primary)), rgba(0, 0, 0, .25)); }
.ah-card__body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.ah-card__title { font-size: 19px; margin: 0; }
.ah-card__title a { color: var(--ah-ink); text-decoration: none; }
.ah-card__title a:hover { color: var(--ah-primary-2); }
.ah-card__excerpt { color: var(--ah-ink-soft); font-size: 15px; margin: 0; }
.ah-card__meta { font-size: 13px; color: var(--ah-ink-soft); margin-top: auto; }
.ah-card--big .ah-card__title { font-size: 30px; }
.ah-card--big .ah-card__placeholder { font-size: 96px; }
.ah-card--big .ah-card__excerpt { font-size: 17px; }

.ah-list { display: flex; flex-direction: column; gap: 12px; }
.ah-row { display: grid; grid-template-columns: 120px 1fr; gap: 12px; background: var(--ah-card); border-radius: var(--ah-radius); box-shadow: var(--ah-shadow); overflow: hidden; }
.ah-row .ah-card__media { aspect-ratio: auto; height: 100%; min-height: 86px; }
.ah-row .ah-card__body { padding: 10px 12px 10px 0; }
.ah-row .ah-card__title { font-size: 16px; }

.ah-badge {
	display: inline-block; font: 700 11px/1 var(--ah-sans); letter-spacing: .06em; text-transform: uppercase;
	color: #fff; background: var(--ah-cat, var(--ah-primary)); padding: 5px 8px; border-radius: 6px; text-decoration: none; align-self: flex-start;
}
a.ah-badge:hover { color: #fff; filter: brightness(1.1); }

/* ---------- Juego del día ---------- */
.ah-gotd { display: grid; grid-template-columns: 1.2fr 1fr; background: linear-gradient(135deg, #2b1055, #7597de); color: #fff; border-radius: var(--ah-radius); overflow: hidden; box-shadow: var(--ah-shadow); }
.ah-gotd__media img { width: 100%; height: 100%; object-fit: cover; }
.ah-gotd__body { padding: 24px; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.ah-gotd__body h3 { color: #fff; font-size: 30px; margin: 0; }
.ah-gotd__kicker { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: #ffe08a; font-weight: 700; }
.ah-btn {
	display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
	background: var(--ah-sun); color: #1b2430; font-weight: 700; text-decoration: none; padding: 12px 20px; border-radius: 999px; border: 0; cursor: pointer; font-size: 17px;
}
.ah-btn:hover { background: #ffc933; color: #1b2430; }
.ah-btn--ghost { background: transparent; color: #fff; border: 2px solid rgba(255, 255, 255, .6); }
.ah-btn--ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* ---------- Contenido (nota, página) ---------- */
.ah-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; padding: 24px 0 40px; align-items: start; }
.ah-almanac__grid > *, .ah-lead > *, .ah-grid > *, .ah-layout > * { min-width: 0; }
.ah-article { background: var(--ah-card); border-radius: var(--ah-radius); box-shadow: var(--ah-shadow); padding: 28px clamp(18px, 4vw, 44px) 36px; }
.ah-article__title { font-size: clamp(28px, 4vw, 42px); margin: 10px 0 10px; }
.ah-article__dek { font-size: 20px; color: var(--ah-ink-soft); margin: 0 0 16px; font-family: var(--ah-serif); }
.ah-article__meta { font-size: 14px; color: var(--ah-ink-soft); display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.ah-article__figure { margin: 0 calc(-1 * clamp(18px, 4vw, 44px)) 20px; }
.ah-article__figure img { width: 100%; }
.ah-article__figure figcaption { font-size: 13px; color: var(--ah-ink-soft); padding: 6px clamp(18px, 4vw, 44px) 0; }
.ah-content { font-size: 18px; line-height: 1.75; }
.ah-content > * { max-width: 72ch; }
.ah-content h2 { font-size: 26px; margin-top: 1.6em; }
.ah-content h3 { font-size: 21px; margin-top: 1.4em; }
.ah-content blockquote { border-left: 4px solid var(--ah-sun); margin: 1.4em 0; padding: 4px 0 4px 18px; color: var(--ah-ink-soft); font-style: italic; }
.ah-content img { border-radius: 10px; }
.ah-content iframe { max-width: 100%; }

.ah-sources { margin-top: 28px; padding: 16px 18px; border-radius: 12px; background: #f3f7fa; border: 1px solid #dbe7ef; font-size: 15px; }
.ah-sources strong { display: block; margin-bottom: 6px; }
.ah-sources ul { margin: 0; padding-left: 18px; }
.ah-sources p { margin: 8px 0 0; color: var(--ah-ink-soft); font-size: 14px; }

.ah-share { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.ah-share a { font-size: 14px; font-weight: 600; text-decoration: none; padding: 8px 14px; border-radius: 999px; background: var(--ah-paper); border: 1px solid var(--ah-line); color: var(--ah-ink); }
.ah-share a:hover { background: var(--ah-sun); }

.ah-sidebar { display: flex; flex-direction: column; gap: 20px; }
.ah-sidebar .ah-panel h3 { font-size: 18px; }
.ah-sidebar .ah-list { gap: 0; }
.ah-sidebar .ah-row { grid-template-columns: 72px 1fr; box-shadow: none; border-radius: 0; border-bottom: 1px dashed var(--ah-line); padding: 10px 0; }
.ah-sidebar .ah-row:last-child { border-bottom: 0; }
.ah-sidebar .ah-row .ah-card__media { min-height: 0; height: 56px; border-radius: 8px; }
.ah-sidebar .ah-row .ah-card__placeholder { font-size: 26px; }
.ah-sidebar .ah-row .ah-card__body { padding: 0; gap: 2px; }
.ah-sidebar .ah-row .ah-card__title { font: 600 15px/1.3 var(--ah-sans); }
.ah-sidebar .ah-row:hover { transform: none; }

/* ---------- Archivo / búsqueda ---------- */
.ah-archive-head { padding: 26px 0 6px; }
.ah-archive-head h1 { font-size: 36px; margin: 0; }
.ah-archive-head p { color: var(--ah-ink-soft); margin: 4px 0 0; }
.ah-pagination { margin: 28px 0 10px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ah-pagination .page-numbers { padding: 8px 14px; border-radius: 10px; background: var(--ah-card); box-shadow: var(--ah-shadow); text-decoration: none; color: var(--ah-ink); }
.ah-pagination .current { background: var(--ah-primary); color: #fff; }
.ah-empty { background: var(--ah-card); border-radius: var(--ah-radius); padding: 30px; text-align: center; box-shadow: var(--ah-shadow); }

/* ---------- Juegos ---------- */
.ah-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 20px; }
.ah-chips a { padding: 6px 12px; border-radius: 999px; background: var(--ah-card); border: 1px solid var(--ah-line); text-decoration: none; color: var(--ah-ink); font-size: 14px; font-weight: 600; }
.ah-chips a:hover, .ah-chips a.is-active { background: var(--ah-primary); color: #fff; border-color: var(--ah-primary); }
.ah-game-card .ah-card__media { aspect-ratio: 4 / 3; }
.ah-game-card .ah-card__title { font-size: 16px; }
.ah-game-frame { position: relative; width: 100%; background: #111; border-radius: 12px; overflow: hidden; }
.ah-game-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ah-game-frame__cover { position: absolute; inset: 0; display: grid; place-items: center; background-size: cover; background-position: center; }
.ah-game-frame__cover::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.ah-game-frame__cover .ah-btn { position: relative; align-self: center; font-size: 20px; padding: 14px 28px; }
.ah-game-tools { display: flex; gap: 10px; justify-content: flex-end; margin: 10px 0 18px; }
.ah-game-tools button { font: inherit; font-size: 14px; border: 1px solid var(--ah-line); background: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.ah-tag { display: inline-block; font-size: 13px; background: #eef6ea; color: #2f6b1f; border-radius: 6px; padding: 3px 8px; }

/* ---------- Clima (página completa) ---------- */
.ah-city-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 22px; }
.ah-city-nav a { padding: 6px 12px; border-radius: 999px; background: var(--ah-card); border: 1px solid var(--ah-line); text-decoration: none; color: var(--ah-ink); font-size: 14px; font-weight: 600; }
.ah-city-nav a:hover { background: var(--ah-primary); color: #fff; }
.ah-city-block { background: var(--ah-card); border-radius: var(--ah-radius); box-shadow: var(--ah-shadow); padding: 20px; margin-bottom: 18px; scroll-margin-top: 120px; }
.ah-city-block__head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.ah-city-block h2 { font-size: 26px; margin: 0; }
.ah-city-block__now { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.ah-city-block__now span:first-child { font-size: 38px; }
.ah-forecast { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 14px; }
.ah-forecast__day { text-align: center; background: var(--ah-paper); border-radius: 10px; padding: 10px 4px; font-size: 14px; }
.ah-forecast__day b { display: block; text-transform: capitalize; }
.ah-forecast__emoji { font-size: 28px; display: block; margin: 4px 0; }
.ah-forecast__rain { color: var(--ah-primary-2); font-size: 13px; }

/* ---------- Publicidad ---------- */
.ah-ad { margin: 18px auto; text-align: center; overflow: hidden; }
.ah-ad__label { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #9aa3ad; margin-bottom: 4px; }
.ah-ad--preview { border: 2px dashed #c9c1ad; border-radius: 12px; color: #8a8270; padding: 22px; font-size: 14px; background: repeating-linear-gradient(45deg, #fbf8f1, #fbf8f1 10px, #f5f0e4 10px, #f5f0e4 20px); }

/* ---------- Pie ---------- */
.ah-footer { background: var(--ah-ink); color: #c5cdd6; margin-top: 30px; padding: 34px 0 20px; font-size: 15px; }
.ah-footer a { color: #fff; text-decoration: none; }
.ah-footer a:hover { color: var(--ah-sun); }
.ah-footer__grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 28px; }
.ah-footer h3 { color: #fff; font-size: 18px; }
.ah-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ah-footer__bottom { border-top: 1px solid #36404c; margin-top: 26px; padding-top: 16px; font-size: 13px; color: #95a1ae; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.ah-almanac__grid { grid-template-columns: 1fr 1fr; }
	.ah-almanac__grid > :last-child { grid-column: 1 / -1; }
	.ah-grid--4 { grid-template-columns: repeat(3, 1fr); }
	.ah-layout { grid-template-columns: 1fr; }
	.ah-forecast { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 760px) {
	body { font-size: 16px; }
	.ah-search { display: none; }
	.ah-search.is-open { display: flex; position: absolute; left: 16px; right: 16px; top: 64px; }
	.ah-search.is-open input[type="search"] { width: 100%; }
	.ah-menu-toggle { display: inline-block; padding: 8px 10px; }
	.ah-header__row { gap: 8px; position: relative; }
	.ah-logo__sun { width: 32px; height: 32px; }
	.ah-nav { display: none; }
	.ah-nav.is-open { display: block; }
	.ah-nav ul { flex-direction: column; }
	.ah-almanac__grid, .ah-lead, .ah-grid, .ah-gotd, .ah-footer__grid { grid-template-columns: 1fr; }
	.ah-grid--4 { grid-template-columns: repeat(2, 1fr); }
	.ah-card--big .ah-card__title { font-size: 24px; }
	.ah-forecast { grid-template-columns: repeat(3, 1fr); }
	.ah-logo__name { font-size: 22px; }
	.ah-logo__tag { display: none; }
	.ah-topbar__extra { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}
