/**
 * Blokkstiler for nyhetsartikler.
 *
 * Samme fil lastes både på nettstedet og inne i Gutenberg-editoren, slik at
 * redaktøren ser artikkelen omtrent slik den blir publisert.
 *
 * Rotselektoren finnes derfor i to varianter: `.acroboat-article` er wrapperen
 * rundt innholdet på nettstedet, `.editor-styles-wrapper` er editorens lerret.
 *
 * --ab-*-variablene kommer fra Beaver Builders globale CSS og finnes bare på
 * nettstedet. Fallback-verdiene er de samme fargene, slik at editoren viser
 * riktig design uten dem.
 */

:is(.acroboat-article, .editor-styles-wrapper) {
	--article-text: var(--ab-dark-purple, #1d192e);
	--article-heading: var(--ab-purple, #2d285d);
	--article-muted: var(--ab-light-purple, #8a879a);
	--article-accent: var(--ab-orange, #eb9a37);
	--article-surface: var(--ab-beige-passer, #f3ebe1);
	--article-border: var(--ab-off-white, #e7e2da);

	/* Knappene henter verdiene sine fra Beaver Builders globale knappestiler,
	   slik at de følger med om knappene endres der. */
	--article-button-color: var(--ab-button-color, #1d192e);
	--article-button-background: var(--ab-button-background, #eb9a37);
	--article-button-hover-background: var(--ab-button-hover-background, #ffa93d);

	--article-font-body: "DM Sans", sans-serif;
	--article-font-heading: "utile-narrow", "Space Grotesk", sans-serif;

	/* 18px på mobil, 20px fra ca. 1200px – samme skala som resten av nettstedet. */
	--article-font-size: clamp(1.125rem, 1rem + 0.4vw, 1.25rem);
	--article-radius: 0.5rem;

	color: var(--article-text);
	font-family: var(--article-font-body);
	font-size: var(--article-font-size);
	font-weight: 400;
	line-height: 1.6;
}

.acroboat-article > :first-child {
	margin-block-start: 0;
}

/* ─── Overskrifter ─────────────────────────────────────────────────────────── */

:is(.acroboat-article, .editor-styles-wrapper) :is(h1, h2, h3, h4, h5, h6) {
	color: var(--article-heading);
	font-family: var(--article-font-heading);
	font-weight: 700;
	letter-spacing: -0.01em;
	text-wrap: balance;
}

:is(.acroboat-article, .editor-styles-wrapper) h1 {
	font-size: clamp(2.25rem, 1.7rem + 2.2vw, 3.25rem);
	line-height: 1.1;
	letter-spacing: -0.02em;
	margin-block: 0 1.5rem;
}

:is(.acroboat-article, .editor-styles-wrapper) h2 {
	font-size: clamp(1.75rem, 1.45rem + 1.2vw, 2.25rem);
	line-height: 1.15;
	margin-block: 3rem 1rem;
}

:is(.acroboat-article, .editor-styles-wrapper) h3 {
	font-size: clamp(1.5rem, 1.35rem + 0.6vw, 1.75rem);
	line-height: 1.2;
	margin-block: 2.5rem 0.75rem;
}

:is(.acroboat-article, .editor-styles-wrapper) h4 {
	font-size: clamp(1.25rem, 1.15rem + 0.45vw, 1.5rem);
	line-height: 1.25;
	margin-block: 2rem 0.75rem;
}

/* utile-narrow er smal, så H5 og H6 må ligge over brødtekststørrelsen
   for fortsatt å lese som overskrifter. */
:is(.acroboat-article, .editor-styles-wrapper) h5 {
	font-size: 1.375rem;
	line-height: 1.3;
	margin-block: 2rem 0.5rem;
}

:is(.acroboat-article, .editor-styles-wrapper) h6 {
	font-size: 1.25rem;
	line-height: 1.4;
	margin-block: 2rem 0.5rem;
}

/* ─── Brødtekst og lenker ──────────────────────────────────────────────────── */

:is(.acroboat-article, .editor-styles-wrapper) p {
	margin-block: 0 1.5rem;
}

:is(.acroboat-article, .editor-styles-wrapper) strong {
	font-weight: 700;
}

:is(.acroboat-article, .editor-styles-wrapper) a {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: var(--article-accent);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.2em;
	transition: color 0.15s ease-in-out;
}

:is(.acroboat-article, .editor-styles-wrapper) a:where(:hover, :focus-visible) {
	color: var(--article-accent);
}

/* ─── Lister ───────────────────────────────────────────────────────────────── */

:is(.acroboat-article, .editor-styles-wrapper) :is(ul, ol) {
	margin-block: 0 1.5rem;
	padding-inline-start: 1.5rem;
}

:is(.acroboat-article, .editor-styles-wrapper) li {
	margin-block: 0.5rem;
	padding-inline-start: 0.25rem;
}

:is(.acroboat-article, .editor-styles-wrapper) li::marker {
	color: var(--article-accent);
	font-weight: 700;
}

:is(.acroboat-article, .editor-styles-wrapper) li > :is(ul, ol) {
	margin-block: 0.5rem 0;
}

/* ─── Sitat ────────────────────────────────────────────────────────────────── */

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-quote {
	border-inline-start: 3px solid var(--article-accent);
	margin-block: 2.5rem;
	padding-inline-start: 1.5rem;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-quote p {
	color: var(--article-heading);
	font-family: var(--article-font-heading);
	font-size: clamp(1.375rem, 1.25rem + 0.5vw, 1.625rem);
	font-weight: 400;
	line-height: 1.3;
}

:is(.acroboat-article, .editor-styles-wrapper) cite {
	color: var(--article-muted);
	display: block;
	font-family: var(--article-font-body);
	font-size: 0.9375rem;
	font-style: normal;
	font-weight: 500;
	letter-spacing: 0.04em;
	margin-block-start: 1rem;
	text-transform: uppercase;
}

/* ─── Uthevet sitat ────────────────────────────────────────────────────────── */

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-pullquote {
	border-block: 1px solid var(--article-border);
	margin-block: 3rem;
	padding-block: 2.5rem;
	text-align: center;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-pullquote blockquote {
	border: 0;
	margin: 0;
	padding: 0;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-pullquote p {
	color: var(--article-heading);
	font-family: var(--article-font-heading);
	font-size: clamp(1.625rem, 1.4rem + 1vw, 2rem);
	font-weight: 700;
	letter-spacing: -0.01em;
	line-height: 1.2;
	margin-block-end: 0;
}

/* ─── Bilde og galleri ─────────────────────────────────────────────────────── */

:is(.acroboat-article, .editor-styles-wrapper) :is(.wp-block-image, .wp-block-gallery) {
	margin-block: 2.5rem;
}

:is(.acroboat-article, .editor-styles-wrapper) :is(.wp-block-image, .wp-block-gallery) img {
	border-radius: var(--article-radius);
	height: auto;
	max-width: 100%;
}

:is(.acroboat-article, .editor-styles-wrapper) figcaption {
	color: var(--article-muted);
	font-size: 0.875rem;
	line-height: 1.45;
	margin-block: 0.75rem 0;
	text-align: start;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-image .alignleft {
	margin-inline: 0 2rem;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-image .alignright {
	margin-inline: 2rem 0;
}

/* ─── Tabell ───────────────────────────────────────────────────────────────── */

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-table {
	margin-block: 2.5rem;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-table table {
	border-collapse: collapse;
	font-size: 1rem;
	width: 100%;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-table :is(th, td) {
	border: 0;
	border-block-end: 1px solid var(--article-border);
	padding: 0.875rem 1rem;
	text-align: start;
	vertical-align: top;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-table th {
	color: var(--article-heading);
	font-family: var(--article-font-heading);
	font-size: 1.0625rem;
	font-weight: 700;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background-color: var(--article-surface);
}

/* ─── Skillelinje ──────────────────────────────────────────────────────────── */

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-separator {
	border: 0;
	border-block-start: 2px solid var(--article-accent);
	margin-block: 3rem;
	opacity: 1;
}

/* Samme :not()-kjede som kjernen bruker for bredden, ellers vinner kjernens
   100px over denne regelen. */
:is(.acroboat-article, .editor-styles-wrapper) .wp-block-separator:not(.is-style-wide):not(.is-style-dots) {
	width: 4rem;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-separator.is-style-wide {
	border-block-start-color: var(--article-border);
	border-block-start-width: 1px;
	width: 100%;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-separator.is-style-dots {
	border: 0;
	color: var(--article-accent);
	width: auto;
}

/* ─── Knapper ──────────────────────────────────────────────────────────────── */

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-buttons {
	margin-block: 2.5rem;
}

/* Samme mål og oppførsel som Beaver Builder-knappene ellers på nettstedet:
   13px/600, 16px 32px, ingen ramme og ingen overgang på hover. */
:is(.acroboat-article, .editor-styles-wrapper) .wp-block-button__link {
	background-color: var(--article-button-background);
	border: 0;
	border-radius: 9999px;
	color: var(--article-button-color);
	font-family: var(--article-font-body);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	padding: 1rem 2rem;
	text-decoration: none;
}

/* `.wp-block-button` er med bare for å veie tyngre enn Beaver Builders
   `.fl-builder-content a:hover`, som ellers farger knappeteksten oransje. */
:is(.acroboat-article, .editor-styles-wrapper) .wp-block-button .wp-block-button__link:is(:hover, :focus-visible) {
	background-color: var(--article-button-hover-background);
	color: var(--article-button-color);
}

:is(.acroboat-article, .editor-styles-wrapper) .is-style-outline .wp-block-button__link {
	background-color: transparent;
	border: 1px solid var(--article-muted);
	color: var(--article-text);
	/* Rammen trekkes fra polstringen, ellers blir omrisset 2px høyere enn
	   den fylte knappen. */
	padding: calc(1rem - 1px) calc(2rem - 1px);
}

:is(.acroboat-article, .editor-styles-wrapper) .is-style-outline .wp-block-button__link:is(:hover, :focus-visible) {
	background-color: var(--article-surface);
	border-color: var(--article-text);
	color: var(--article-text);
}

/* ─── Fil ──────────────────────────────────────────────────────────────────── */

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-file {
	align-items: center;
	background-color: var(--article-surface);
	border-radius: var(--article-radius);
	column-gap: 1.5rem;
	display: flex;
	flex-wrap: wrap;
	margin-block: 2rem;
	padding: 1.125rem 1.25rem;
	row-gap: 0.75rem;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-file :where(a):not(.wp-block-file__button) {
	font-size: 1rem;
	font-weight: 500;
	text-decoration-color: var(--article-muted);
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-file__button {
	background-color: var(--article-button-background);
	border-radius: 9999px;
	color: var(--article-button-color);
	font-size: 13px;
	font-weight: 600;
	margin-inline-start: auto;
	padding: 0.5rem 1.375rem;
	text-decoration: none;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-file .wp-block-file__button:is(:hover, :focus-visible) {
	background-color: var(--article-button-hover-background);
	color: var(--article-button-color);
}

/* ─── Innbygging ───────────────────────────────────────────────────────────── */

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-embed {
	margin-block: 2.5rem;
}

:is(.acroboat-article, .editor-styles-wrapper) .wp-block-embed iframe {
	border-radius: var(--article-radius);
	display: block;
	max-width: 100%;
}
