/*
Theme Name: Toftegaard Media
Theme URI: https://www.toftegaard.io/
Author: Gunnar Toftegaard
Description: Redaksjonelt blokktema for Toftegaard Media – journalistikk om humanitær- og sikkerhetspolitikk, natur og kultur. Rolige typografiske linjer, god lesbarhet og full støtte for nettstedsredigering.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.0
Version: 1.0.8
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: toftegaard-media
Tags: blog, news, one-column, three-columns, full-site-editing, block-patterns, custom-colors, editor-style, featured-images, translation-ready
*/

/* Det meste av stilen ligger i theme.json. Her ligger bare det theme.json ikke kan uttrykke. */

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

::selection { background: var(--wp--preset--color--accent); color: var(--wp--preset--color--base); }

:where(a, button, input, summary):focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 3px;
	border-radius: 2px;
}

/* Header */
.tm-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--wp--preset--color--base) 92%, transparent);
	backdrop-filter: saturate(1.4) blur(10px);
	-webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.admin-bar .tm-header { top: var(--wp-admin--admin-bar--height, 32px); }
.tm-wordmark a { text-decoration: none; }
.tm-wordmark .tm-wordmark__sub {
	font-family: var(--wp--preset--font-family--sans);
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent);
	margin-left: 0.5em;
	vertical-align: 0.35em;
}

/* Søkeknapp i headeren: diskret ikon i stedet for fylt sirkel */
.tm-header .wp-block-search__button {
	background: transparent;
	color: var(--wp--preset--color--contrast);
	border: 1px solid transparent;
	border-radius: 999px;
	padding: 0.45rem;
	transition: border-color 0.2s, color 0.2s;
}
.tm-header .wp-block-search__button:hover {
	background: transparent;
	color: var(--wp--preset--color--accent);
	border-color: var(--wp--preset--color--line);
}
.tm-header .wp-block-search__button svg { width: 22px; height: 22px; fill: currentColor; }

/* Kort og bilder */
.tm-card .wp-block-post-excerpt__excerpt { margin: 0; }
.tm-card .wp-block-post-excerpt__more-text:empty { display: none; }
.tm-card .wp-block-post-featured-image { overflow: hidden; }
.tm-card .wp-block-post-featured-image img {
	transition: transform 0.6s cubic-bezier(.2,.7,.2,1);
}
.tm-card:hover .wp-block-post-featured-image img { transform: scale(1.035); }
.tm-card .wp-block-post-title a { background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size 0.35s ease; }
.tm-card:hover .wp-block-post-title a { background-size: 100% 1px; }

/* Kategori-«kicker» */
.tm-kicker,
.tm-kicker a {
	font-family: var(--wp--preset--font-family--sans);
	font-size: 0.72rem !important;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent);
	text-decoration: none;
}
.tm-kicker .wp-block-post-terms__separator { color: var(--wp--preset--color--muted); }

/* Emne-chips */
.tm-topics .wp-block-categories-list,
.tm-topics ul {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}
.tm-topics li a {
	display: inline-block;
	padding: 0.55rem 1.05rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 999px;
	font-family: var(--wp--preset--font-family--sans);
	font-size: 0.9rem;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
	transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.tm-topics li a:hover { background: var(--wp--preset--color--contrast); border-color: var(--wp--preset--color--contrast); color: var(--wp--preset--color--base); }

/* Artikkel */
.tm-article .wp-block-post-content > p:first-of-type::first-letter {
	float: left;
	font-family: var(--wp--preset--font-family--serif);
	font-size: 4.2em;
	line-height: 0.82;
	font-weight: 500;
	padding: 0.06em 0.1em 0 0;
	color: var(--wp--preset--color--accent);
}
.tm-article .wp-block-post-content :where(figure) { margin-block: 2.5rem; }
.tm-article .wp-block-post-content figcaption,
.wp-element-caption {
	font-family: var(--wp--preset--font-family--sans);
	font-size: 0.82rem;
	color: var(--wp--preset--color--muted);
	text-align: left;
}

/* Lange URL-er skal ikke sprenge mobiloppsettet */
.wp-block-post-content { overflow-wrap: break-word; }
.wp-block-post-content a { overflow-wrap: anywhere; }
.wp-block-post-content :where(iframe, embed, video) { max-width: 100%; }

/* Gamle Newsair-artikler har noen ganger tomme avsnitt; skjul dem */
.tm-article .wp-block-post-content > p:empty { display: none; }

/* Lesefremdrift */
.tm-progress {
	position: fixed;
	inset: 0 0 auto 0;
	height: 3px;
	background: var(--wp--preset--color--accent);
	transform-origin: 0 50%;
	transform: scaleX(0);
	z-index: 100;
	pointer-events: none;
}
@supports (animation-timeline: scroll()) {
	.tm-progress { animation: tm-progress linear both; animation-timeline: scroll(root); }
	@keyframes tm-progress { to { transform: scaleX(1); } }
}
.admin-bar .tm-progress { top: var(--wp-admin--admin-bar--height, 32px); }

/* Footer */
.tm-footer .tm-wordmark__sub { color: #F0A78F; }
.tm-footer a { text-decoration: none; }
.tm-footer a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.tm-footer .wp-block-navigation { gap: 0.4rem 1.4rem; }

/* Sidenummerering */
.wp-block-query-pagination-numbers .page-numbers {
	display: inline-grid;
	place-items: center;
	min-width: 2.4rem;
	height: 2.4rem;
	border-radius: 999px;
}
.wp-block-query-pagination-numbers .page-numbers.current {
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
}

/* Bilder på faste sider er ofte portretter: beskjær fra bunnen, så hodet ikke kuttes. */
.tm-page-image img { object-position: 50% 0%; }

/* Skjult for øyet, men lest av skjermlesere og søkemotorer (brukes til forsidens H1). */
.screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
	height: 1px; margin: -1px; overflow: hidden; padding: 0;
	position: absolute !important; width: 1px; word-wrap: normal !important;
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
	html { scroll-behavior: auto; }
}
