/*
Theme Name: Heilsumál
Theme URI: https://heilsumal.is
Author: Bent Marinósson
Description: Létt, sérsniðið þema fyrir Heilsumál — greinar, gestapennar og podcast. Engin síðusmiðja.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: heilsumal
*/

/* ---------- Grunnur ---------- */
:root {
	--hm-red: #e1262d;
	--hm-blue: #1e9ad6;
	--hm-ink: #14161a;
	--hm-text: #33363b;
	--hm-muted: #6c717a;
	--hm-line: #e8e6e1;
	--hm-soft: #f5f3ee;
	--hm-bg: #ffffff;
	--hm-dark: #14161a;
	--hm-radius: 16px;
	--hm-wide: 1320px;
	--hm-narrow: 1000px;
	--hm-font: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--hm-head: "Barlow Semi Condensed", "Arial Narrow", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

body {
	margin: 0;
	font-family: var(--hm-font);
	font-size: 18px;
	line-height: 1.65;
	color: var(--hm-text);
	background: var(--hm-bg);
}

img, video, iframe { max-width: 100%; height: auto; }

a { color: var(--hm-blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--hm-red); }

h1, h2, h3, h4 { color: var(--hm-ink); line-height: 1.15; margin: 1.6em 0 .5em; font-weight: 700; letter-spacing: -.015em; }
h1, h2, h3, h4, .hm-hero__title, .hm-card__title, .hm-episode__title { font-family: var(--hm-head); font-weight: 700; letter-spacing: -.005em; }
h1 { font-size: clamp(2.2rem, 4.4vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.05rem); }
h3 { font-size: 1.4rem; }

.hm-container { max-width: var(--hm-wide); margin: 0 auto; padding: 0 20px; }
.hm-narrow { max-width: var(--hm-narrow); margin: 0 auto; }

.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; padding: 8px 14px; background: #fff; color: var(--hm-ink);
}

/* ---------- Haus ---------- */
.hm-header {
	background: rgba(255,255,255,.88); color: var(--hm-ink); position: sticky; top: 0; z-index: 50;
	backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
	border-bottom: 1px solid var(--hm-line);
}
.admin-bar .hm-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .hm-header { top: 46px; } }

.hm-header__inner { display: flex; align-items: center; gap: 24px; min-height: 72px; }
.hm-brand { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.hm-brand img { max-height: 44px; width: auto; display: block; }
.hm-brand__text { font-weight: 900; font-size: 1.5rem; letter-spacing: .02em; text-transform: uppercase; }
.hm-brand__text .a { color: var(--hm-red); }
.hm-brand__text .b { color: var(--hm-blue); }

.hm-nav { margin-left: auto; }
.hm-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.hm-nav a {
	display: block; padding: 8px 14px; color: var(--hm-ink); text-decoration: none;
	font-size: .95rem; font-weight: 600; border-radius: 999px;
}
.hm-nav a:hover, .hm-nav .current-menu-item > a { background: var(--hm-soft); color: var(--hm-red); }
.hm-nav .sub-menu { display: none; }

.hm-search-toggle, .hm-menu-toggle {
	background: none; border: 0; color: var(--hm-ink); cursor: pointer; padding: 8px; border-radius: 999px;
	display: inline-flex; align-items: center;
}
.hm-search-toggle:hover, .hm-menu-toggle:hover { background: var(--hm-soft); }
.hm-menu-toggle { display: none; }

.hm-searchbar { display: none; background: #fff; border-top: 1px solid var(--hm-line); padding: 14px 0; }
.hm-searchbar.is-open { display: block; }

.search-form { display: flex; gap: 8px; }
.search-form label { flex: 1; }
.search-field {
	width: 100%; padding: 11px 18px; font-size: 1rem; border-radius: 999px;
	border: 1px solid var(--hm-line); font-family: inherit;
}
.search-submit, .hm-button {
	display: inline-block; padding: 12px 22px; border: 0; border-radius: 999px;
	background: var(--hm-red); color: #fff; font-weight: 700; font-size: 1rem;
	cursor: pointer; text-decoration: none; font-family: inherit;
}
.search-submit:hover, .hm-button:hover { background: #b81c22; color: #fff; }
.hm-button--ghost { background: transparent; color: var(--hm-ink); border: 2px solid var(--hm-ink); }
.hm-button--ghost:hover { background: var(--hm-ink); color: #fff; }

@media (max-width: 860px) {
	.hm-menu-toggle { display: inline-flex; }
	.hm-nav {
		display: none; position: absolute; left: 0; right: 0; top: 100%;
		background: #fff; padding: 10px 20px 20px; border-bottom: 1px solid var(--hm-line);
	}
	.hm-nav.is-open { display: block; }
	.hm-nav ul { flex-direction: column; }
	.hm-header__inner { position: relative; }
	.hm-header__tools { margin-left: auto; display: flex; }
}

/* ---------- Spjöld (greinalistar) ---------- */
.hm-grid { display: grid; gap: 40px 32px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .hm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .hm-grid { grid-template-columns: 1fr; } }

.hm-card { display: flex; flex-direction: column; }
.hm-card__media {
	display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--hm-radius);
	background: var(--hm-soft);
}
.hm-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.hm-card:hover .hm-card__media img { transform: scale(1.03); }
.hm-card__media--empty { display: flex; align-items: center; justify-content: center; color: var(--hm-red); }
.hm-card__body { padding-top: 16px; }
.hm-card__media { border-radius: var(--hm-radius); }
.hm-card__title { font-size: 1.4rem; line-height: 1.12; margin: 6px 0 8px; }
.hm-card__title a { color: var(--hm-ink); text-decoration: none; }
.hm-card__title a:hover { color: var(--hm-red); }
.hm-card__excerpt { color: var(--hm-muted); font-size: .98rem; margin: 0; }
.hm-card__body { display: flex; flex-direction: column; flex: 1; align-items: flex-start; }
.hm-card__author {
	display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 14px;
	font-size: .85rem; color: var(--hm-muted);
}
.hm-card__author img { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.hm-card__author a { color: var(--hm-ink); font-weight: 600; text-decoration: none; }
.hm-card__author a:hover { color: var(--hm-red); }

/* Endalaus skrun */
.hm-loader { display: flex; justify-content: center; padding: 40px 0 10px; color: var(--hm-red); }
.hm-loader[hidden] { display: none; }
.hm-loader span {
	width: 10px; height: 10px; margin: 0 4px; border-radius: 50%; background: currentColor;
	animation: hm-pulse 1s infinite ease-in-out;
}
.hm-loader span:nth-child(2) { animation-delay: .15s; }
.hm-loader span:nth-child(3) { animation-delay: .3s; }
@keyframes hm-pulse { 0%, 80%, 100% { opacity: .2; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.hm-infinite--on .navigation.pagination { display: none; }

.hm-kicker {
	display: inline-block; padding: 4px 10px; border-radius: 999px; background: #fdecec; font-size: .72rem; font-weight: 800; letter-spacing: .08em;
	text-transform: uppercase; color: var(--hm-red); text-decoration: none;
}
.hm-meta { font-size: .88rem; color: var(--hm-muted); }
.hm-meta a { color: inherit; }

/* ---------- Forsíða ---------- */
.hm-hero { padding: 56px 0 24px; }
.hm-hero__grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 36px; align-items: center; }
.hm-hero__media { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 24px; background: var(--hm-soft); }
.hm-hero__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hm-hero__title { font-size: clamp(2.4rem, 4.8vw, 3.8rem); line-height: 1.02; margin: 12px 0 16px; }
.hm-hero__title a { color: var(--hm-ink); text-decoration: none; }
.hm-hero__title a:hover { color: var(--hm-red); }
.hm-hero__excerpt { color: var(--hm-muted); font-size: 1.08rem; }
@media (max-width: 860px) { .hm-hero__grid { grid-template-columns: 1fr; gap: 18px; } }

.hm-section { padding: 64px 0; }
.hm-section--soft { background: var(--hm-soft); }
.hm-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.hm-section__head h2 { margin: 0; }
.hm-section__head a { font-weight: 700; text-decoration: none; white-space: nowrap; }

.hm-topics { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 0; }
.hm-topics a {
	display: inline-block; padding: 8px 16px; border-radius: 999px; background: #fff;
	border: 1px solid var(--hm-line); color: var(--hm-ink); text-decoration: none; font-weight: 600;
}
.hm-topics a:hover { border-color: var(--hm-red); color: var(--hm-red); }
.hm-topics .count { color: var(--hm-muted); font-weight: 400; margin-left: 4px; }

.hm-cta {
	background: var(--hm-dark); color: #fff; border-radius: 24px; padding: 48px;
	display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.hm-cta h2 { color: #fff; margin: 0 0 6px; }
.hm-cta p { margin: 0; color: #cfcfcf; }

/* ---------- Podcast ---------- */
.hm-episodes { display: grid; gap: 20px; }
.hm-episode {
	display: grid; grid-template-columns: 96px 1fr; gap: 18px; align-items: start;
	background: #fff; border: 1px solid var(--hm-line); border-radius: var(--hm-radius); padding: 16px;
}
.hm-episode__art { width: 96px; height: 96px; border-radius: 8px; object-fit: cover; background: var(--hm-soft); }
.hm-episode__title { margin: 2px 0 6px; font-size: 1.3rem; }
.hm-episode__title a { color: var(--hm-ink); text-decoration: none; }
.hm-episode__desc { color: var(--hm-muted); font-size: .96rem; margin: 6px 0 10px; }
.hm-episode audio { width: 100%; height: 40px; }
@media (max-width: 560px) {
	.hm-episode { grid-template-columns: 64px 1fr; }
	.hm-episode__art { width: 64px; height: 64px; }
}
.hm-listen { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 30px; }

/* ---------- Stök grein ---------- */
.hm-article { padding: 40px 0 20px; }
.hm-article__head { text-align: left; }
.hm-article__title { margin: 10px 0 14px; }
.hm-article__media { margin: 28px auto 34px; max-width: 1000px; }
.hm-article__media img { width: 100%; border-radius: 24px; display: block; }

.hm-byline { display: flex; align-items: center; gap: 12px; }
.hm-byline img { border-radius: 50%; width: 44px; height: 44px; }

.entry-content { font-size: 1.1rem; }
.entry-content > * { max-width: var(--hm-narrow); margin-left: auto; margin-right: auto; }
.entry-content > .alignwide { max-width: 1200px; }
.entry-content > .alignfull { max-width: none; }
.entry-content p { margin: 0 auto 1.2em; }
.entry-content blockquote {
	border-left: 4px solid var(--hm-red); padding: 4px 0 4px 20px; font-family: var(--hm-font);
	font-size: 1.2rem; color: var(--hm-ink); font-style: italic;
}
.entry-content table { border-collapse: collapse; width: 100%; font-size: .98rem; }
.entry-content th, .entry-content td { border: 1px solid var(--hm-line); padding: 8px 10px; text-align: left; }
.entry-content iframe { display: block; margin: 0 auto 1.2em; }
.entry-content .wp-block-embed__wrapper iframe, .entry-content iframe[src*="youtube"], .entry-content iframe[src*="vimeo"] {
	aspect-ratio: 16 / 9; width: 100%; height: auto;
}
.entry-content img { border-radius: 6px; }

/* Klassískar myndastillingar (gamlar greinar) */
.alignleft { float: left; margin: .3em 1.4em 1em 0; }
.alignright { float: right; margin: .3em 0 1em 1.4em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.entry-content::after { content: ""; display: table; clear: both; }
.wp-caption { max-width: 100%; }
.wp-caption img { display: block; }
.wp-caption-text, figcaption { font-size: .88rem; color: var(--hm-muted); margin-top: 6px; text-align: center; }
@media (max-width: 600px) {
	.alignleft, .alignright { float: none; margin: 0 auto 1em; display: block; }
}

.hm-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 30px auto 0; }
.hm-tags a {
	font-size: .85rem; padding: 4px 12px; border-radius: 999px; background: var(--hm-soft);
	color: var(--hm-muted); text-decoration: none;
}
.hm-tags a:hover { color: var(--hm-red); }

.hm-authorbox {
	display: flex; gap: 20px; align-items: flex-start; margin: 40px auto; padding: 24px;
	background: var(--hm-soft); border-radius: var(--hm-radius);
}
.hm-authorbox img { border-radius: 50%; flex-shrink: 0; }
.hm-authorbox h3 { margin: 0 0 6px; font-size: 1.1rem; }
.hm-authorbox p { margin: 0 0 8px; font-size: .98rem; color: var(--hm-text); }

/* ---------- Skjalasöfn ---------- */
.hm-archive-head { padding: 44px 0 10px; }
.hm-archive-head h1 { margin: 6px 0 10px; }
.hm-archive-head .desc { color: var(--hm-muted); max-width: 680px; }
.hm-author-head { display: flex; gap: 24px; align-items: center; }
.hm-author-head img { border-radius: 50%; }

.navigation.pagination { margin: 48px 0 20px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.page-numbers {
	display: inline-block; min-width: 42px; padding: 8px 12px; text-align: center; border-radius: 8px;
	border: 1px solid var(--hm-line); text-decoration: none; color: var(--hm-ink);
}
.page-numbers.current { background: var(--hm-ink); color: #fff; border-color: var(--hm-ink); }

/* ---------- Form ---------- */
.hm-form { display: grid; gap: 16px; max-width: 640px; }
.hm-form label { display: block; font-weight: 700; font-size: .95rem; margin-bottom: 6px; color: var(--hm-ink); }
.hm-form input[type="text"], .hm-form input[type="email"], .hm-form select, .hm-form textarea {
	width: 100%; padding: 12px 14px; font-size: 1rem; font-family: inherit;
	border: 1px solid #cfcac2; border-radius: 8px; background: #fff;
}
.hm-form textarea { min-height: 170px; resize: vertical; }
.hm-form input:focus, .hm-form select:focus, .hm-form textarea:focus { outline: 2px solid var(--hm-blue); border-color: transparent; }
.hm-form__hp { position: absolute; left: -9999px; }
.hm-notice { padding: 14px 18px; border-radius: 8px; margin-bottom: 18px; }
.hm-notice--ok { background: #e7f6ec; color: #135c2c; }
.hm-notice--err { background: #fdeaea; color: #8a1c1c; }

/* ---------- Athugasemdir ---------- */
.hm-comments { margin: 40px auto; }
.hm-comments ol { list-style: none; padding: 0; }
.hm-comments .comment-body { padding: 16px 0; border-bottom: 1px solid var(--hm-line); }

/* ---------- Fótur ---------- */
.hm-footer { background: var(--hm-dark); color: #b9bcc2; margin-top: 60px; padding: 48px 0 30px; font-size: .95rem; }
.hm-footer a { color: #fff; text-decoration: none; }
.hm-footer a:hover { color: var(--hm-blue); }
.hm-footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.hm-footer h4 { color: #fff; margin: 0 0 12px; font-size: 1rem; }
.hm-footer ul { list-style: none; margin: 0; padding: 0; }
.hm-footer li { margin-bottom: 6px; }
.hm-footer__bottom { border-top: 1px solid #2a2d33; margin-top: 36px; padding-top: 18px; font-size: .85rem; }
@media (max-width: 760px) { .hm-footer__grid { grid-template-columns: 1fr; } }

/* ---------- 404 / tómt ---------- */
.hm-empty { padding: 80px 0; text-align: center; }
.hm-empty .search-form { max-width: 520px; margin: 24px auto 0; }

/* Lógó í dökkum fæti */
.hm-footer .hm-brand__text .a { color: #ff4a50; }
.hm-footer .hm-brand { margin-bottom: 12px; }
::selection { background: #fdd5d6; }

/* ---------- Vafrakökuborði ---------- */
.hm-consent {
	position: fixed; z-index: 100; left: 16px; right: 16px; bottom: 16px; max-width: 560px;
	margin-left: auto; background: #fff; color: var(--hm-text); border: 1px solid var(--hm-line);
	border-radius: 18px; padding: 20px 22px; box-shadow: 0 12px 40px rgba(20,22,26,.18);
	font-size: .95rem;
}
.hm-consent[hidden] { display: none; }
.hm-consent p { margin: 0 0 14px; }
.hm-consent__actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.hm-consent .hm-button { padding: 10px 20px; font-size: .95rem; }
@media (max-width: 560px) { .hm-consent__actions .hm-button { flex: 1; text-align: center; } }

/* Dagsetning neðst í grein */
.hm-dates { margin: 36px auto 0; font-size: .88rem; color: var(--hm-muted); }

/* ---------- Auglýsingar ---------- */
.hm-ad { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hm-ad__label {
	font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--hm-muted);
}
.hm-ad__link { display: block; line-height: 0; }
.hm-ad img { display: block; max-width: 100%; height: auto; border-radius: 0; }
.entry-content > .hm-ad { margin: 8px auto 40px; }
.hm-ad--grein img, .hm-ad--forsida img { width: 875px; }
.hm-ad--forsida { border-top: 1px solid var(--hm-line); border-bottom: 1px solid var(--hm-line); padding: 20px 20px 32px; }
.hm-ad--card { background: var(--hm-soft); border-radius: var(--hm-radius); padding: 14px 12px 22px; justify-content: flex-start; }
.hm-ad--card img { width: 310px; }
@media (max-width: 699px) {
	.hm-ad--grein img, .hm-ad--forsida img { width: 310px; }
	.entry-content > .hm-ad--grein { margin-left: -20px; margin-right: -20px; max-width: none; background: var(--hm-soft); padding: 16px 0 20px; }
}

/* ---------- Kjarnhiti (heilsumal.is/hitastig) ---------- */
.hm-temp__lead { font-size: 1.15rem; color: var(--hm-muted); margin: 0; }
.hm-temp__picker { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 36px; }
.hm-temp__picker a {
	padding: 10px 16px; border-radius: 999px; border: 1px solid var(--hm-line); background: #fff;
	color: var(--hm-ink); text-decoration: none; font-weight: 600; font-size: .98rem;
}
.hm-temp__picker a:hover, .hm-temp__picker a.is-active { border-color: var(--hm-red); color: var(--hm-red); background: #fdecec; }
.hm-temp__food {
	border: 1px solid var(--hm-line); border-radius: var(--hm-radius); padding: 22px 24px; margin-bottom: 18px;
	scroll-margin-top: 96px; transition: box-shadow .3s, border-color .3s;
}
.hm-temp__food:target, .hm-temp__food.is-active { border-color: var(--hm-red); box-shadow: 0 0 0 3px #fdecec; }
.hm-temp__food h2 { margin: 0 0 14px; font-size: 1.6rem; }
.hm-temp__food.is-safety { background: #fffaf0; }
.hm-temp__rows { list-style: none; margin: 0; padding: 0; }
.hm-temp__rows li { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--hm-line); }
.hm-temp__rows li:first-child { border-top: 0; }
.hm-temp__swatch { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; }
.hm-temp__name { flex: 1; font-weight: 600; color: var(--hm-ink); }
.hm-temp__name small { font-weight: 400; color: var(--hm-muted); margin-left: 4px; }
.hm-temp__deg { font-family: var(--hm-head); font-size: 1.6rem; color: var(--hm-ink); white-space: nowrap; }
.hm-temp__note { margin: 10px 0 0; color: var(--hm-muted); font-size: .98rem; }
.hm-temp__tips { margin-top: 40px; }
.hm-temp__tips ul { padding-left: 1.2em; }
.hm-temp__tips li { margin-bottom: 10px; }
.hm-temp__sources { font-size: .88rem; color: var(--hm-muted); margin-top: 24px; }
@media (max-width: 600px) { .hm-temp__food { padding: 18px 16px; } .hm-temp__deg { font-size: 1.35rem; } }
