/*
Theme Name: Nilssons Åkeri
Theme URI: https://spolbilvbg.se
Author: Nilssons Åkeri i Vänersborg AB
Description: Eget blocktema för Nilssons Åkeri i Vänersborg AB – sug- och spoltjänster från Vänersborg. Vid aktivering installeras kärntillägget, Forminator och Wordfence, och sidor och tjänster läggs in om de saknas.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.0
Version: 1.1.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nilssons-akeri
*/

/* ---------- Grund ---------- */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
:where(a, button, input, textarea, select, summary):focus-visible {
	outline: 3px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}
.has-ink-background-color :where(a, button):focus-visible,
.has-ink-2-background-color :where(a, button):focus-visible,
.has-primary-background-color :where(a, button):focus-visible {
	outline-color: var(--wp--preset--color--accent);
}
.skip-link.screen-reader-text:focus { z-index: 100000; }

/* Överrubrik ("eyebrow") */
.is-style-eyebrow {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 600;
	font-size: 0.875rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wp--preset--color--primary);
}
.has-ink-background-color .is-style-eyebrow,
.has-ink-2-background-color .is-style-eyebrow,
.nak-hero .is-style-eyebrow { color: var(--wp--preset--color--accent); }

/* ---------- Sidhuvud ---------- */
.nak-topbar { font-size: 0.9375rem; }
.nak-topbar a { color: inherit; text-decoration: none; font-weight: 600; }
.nak-topbar a:hover { text-decoration: underline; }
.nak-topbar .nak-dot {
	display: inline-block; width: 8px; height: 8px; border-radius: 50%;
	background: var(--wp--preset--color--accent); margin-right: 0.5rem;
	box-shadow: 0 0 0 0 rgba(210, 221, 28, 0.6);
	animation: nak-pulse 2s infinite;
}
@keyframes nak-pulse {
	70% { box-shadow: 0 0 0 8px rgba(210, 221, 28, 0); }
	100% { box-shadow: 0 0 0 0 rgba(210, 221, 28, 0); }
}
@media (prefers-reduced-motion: reduce) { .nak-topbar .nak-dot { animation: none; } }
@media (max-width: 640px) { .nak-topbar .nak-topbar__mail { display: none; } }

.nak-site-header { position: sticky; top: 0; z-index: 50; }
.admin-bar .nak-site-header { top: var(--wp-admin--admin-bar--height, 32px); }
@media (max-width: 600px) { .admin-bar .nak-site-header { top: 0; } }
.nak-header { border-bottom: 1px solid var(--wp--preset--color--border); }

.nak-brand { line-height: 1; text-decoration: none; }
.nak-brand .wp-block-site-title { margin: 0; line-height: 1; }
.nak-brand .wp-block-site-title a { text-decoration: none; color: var(--wp--preset--color--ink); }
.nak-brand__sub {
	margin: 0.2rem 0 0 !important;
	font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

/* Ring-knappar från kortkoden [nak_ring] */
.nak-ring {
	display: inline-flex; align-items: center; gap: 0.55rem;
	text-decoration: none !important;
}
.nak-ring--accent {
	background: var(--wp--preset--color--accent) !important;
	color: var(--wp--preset--color--ink) !important;
}
.nak-ring--accent:hover { background: #e3ee3a !important; }
.nak-ring--ghost {
	background: transparent !important;
	color: currentColor !important;
	box-shadow: inset 0 0 0 2px currentColor;
}
.nak-ring--ghost:hover { background: rgba(255,255,255,.1) !important; }
p:has(> .nak-ring) { margin-block: 0; }

/* Knapp: kontur på mörk bakgrund */
.wp-block-button.is-style-outline > .wp-block-button__link {
	border: 2px solid currentColor;
	background: transparent;
	padding: calc(0.85rem - 2px) calc(1.5rem - 2px);
}
.wp-block-button.is-style-outline > .wp-block-button__link:hover { background: rgba(127,127,127,.12); }

/* ---------- Hero ---------- */
.nak-hero.wp-block-cover { min-height: min(88vh, 760px); }
.nak-hero h1 { color: #fff; max-width: 18ch; }
.nak-hero .wp-block-cover__inner-container { width: 100%; }
.nak-hero__lead { max-width: 640px; }
.nak-hero__lead { font-size: var(--wp--preset--font-size--large); color: rgba(255,255,255,.88); }

/* Helbreddssektioner ska ligga kant i kant */
.wp-block-post-content > .alignfull + .alignfull,
main > .alignfull + .alignfull,
main > .wp-block-post-content > .alignfull:first-child { margin-block-start: 0; }

/* Sidrubrik (undersidor) */
.nak-pagehead { position: relative; overflow: hidden; }
.nak-pagehead::after {
	content: ""; position: absolute; right: -6rem; bottom: -6rem; width: 22rem; height: 22rem;
	border-radius: 50%; border: 2px dashed rgba(210, 221, 28, .35); pointer-events: none;
}
.nak-pagehead h1 { color: #fff; }
.nak-pagehead p { color: rgba(255,255,255,.82); }
.nak-pagehead > .has-large-font-size,
.nak-pagehead > .wp-block-post-excerpt {
	max-width: 62ch;
	margin-left: max(0px, (100% - 1240px) / 2) !important;
}

/* ---------- Kort ---------- */
.nak-card {
	height: 100%;
	transition: transform .2s ease, box-shadow .2s ease;
}
.nak-card .wp-block-post-featured-image { margin: 0; overflow: hidden; border-radius: var(--wp--custom--radius) var(--wp--custom--radius) 0 0; }
.nak-card .wp-block-post-featured-image img { transition: transform .4s ease; }
.nak-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(10,26,44,.06), 0 18px 36px -16px rgba(10,26,44,.3); }
.nak-card:hover .wp-block-post-featured-image img { transform: scale(1.04); }
.nak-card .wp-block-post-title a { text-decoration: none; color: inherit; }
.nak-card .wp-block-post-title a::after { content: ""; position: absolute; inset: 0; }
.nak-card { position: relative; }
.nak-card .wp-block-read-more { position: relative; z-index: 1; font-weight: 600; text-decoration: none; }
.nak-card .wp-block-read-more::after { content: " →"; }
@media (prefers-reduced-motion: reduce) {
	.nak-card, .nak-card .wp-block-post-featured-image img { transition: none; }
}
.wp-block-post-template.is-layout-grid > li { display: flex; }
.wp-block-post-template.is-layout-grid > li > .nak-card { flex: 1; }

/* Ikoner i fördelslistor */
.nak-icon {
	display: inline-grid; place-items: center;
	width: 3rem; height: 3rem; border-radius: 50%;
	background: var(--wp--preset--color--primary); color: #fff;
}
.nak-icon svg { width: 1.5rem; height: 1.5rem; }
.has-ink-background-color .nak-icon, .has-ink-2-background-color .nak-icon { background: var(--wp--preset--color--accent); color: var(--wp--preset--color--ink); }

/* Checklista */
.is-style-checklist { list-style: none; padding-left: 0 !important; }
.is-style-checklist li { position: relative; padding-left: 2rem; margin-bottom: 0.6rem; }
.is-style-checklist li::before {
	content: ""; position: absolute; left: 0; top: 0.3em; width: 1.25rem; height: 1.25rem; border-radius: 50%;
	background: var(--wp--preset--color--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center/70% no-repeat;
}
.has-ink-background-color .is-style-checklist li::before,
.has-ink-2-background-color .is-style-checklist li::before {
	background-color: var(--wp--preset--color--accent);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A1A2C' stroke-width='3'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E");
}

/* Ortlista */

/* Akutbanner */
.nak-akut .nak-akut__number a {
	color: var(--wp--preset--color--accent); text-decoration: none;
	font-family: var(--wp--preset--font-family--heading); font-weight: 700;
}
.nak-akut .nak-akut__number a:hover { text-decoration: underline; }

/* Kontaktlista */
.nak-contactlist p { margin: 0; }
.nak-contactlist .nak-contactlist__label {
	font-size: 0.8125rem; letter-spacing: .1em; text-transform: uppercase; color: var(--wp--preset--color--muted);
}
.nak-contactlist .nak-contactlist__value { font-family: var(--wp--preset--font-family--heading); font-weight: 600; font-size: 1.375rem; }
.nak-contactlist .nak-contactlist__value a { color: var(--wp--preset--color--ink); text-decoration: none; }
.nak-contactlist .nak-contactlist__value a:hover { color: var(--wp--preset--color--primary); text-decoration: underline; }

/* ---------- Formulär ---------- */
.nak-form { display: grid; gap: 1rem; }
.nak-form p { margin: 0; }
.nak-form__row { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .nak-form__row { grid-template-columns: 1fr; } }
.nak-field { display: grid; gap: 0.35rem; }
.nak-field label { font-weight: 600; font-size: 0.9375rem; }
.nak-field input[type="text"], .nak-field input[type="email"], .nak-field input[type="tel"], .nak-field textarea {
	width: 100%; box-sizing: border-box;
	font: inherit; color: var(--wp--preset--color--ink);
	padding: 0.75rem 0.9rem;
	background: #fff; border: 1px solid #b9c4d2; border-radius: var(--wp--custom--radius);
	transition: border-color .15s, box-shadow .15s;
}
.nak-field input:focus, .nak-field textarea:focus {
	outline: none; border-color: var(--wp--preset--color--primary);
	box-shadow: 0 0 0 3px rgba(20, 88, 191, .2);
}
.nak-field [aria-invalid="true"] { border-color: #b42318; }
.nak-field__error { color: #b42318; font-size: 0.875rem; font-weight: 500; }
.nak-field--check { grid-template-columns: auto 1fr; align-items: start; column-gap: 0.6rem; }
.nak-field--check input { width: 1.15rem; height: 1.15rem; margin-top: 0.2rem; accent-color: var(--wp--preset--color--primary); }
.nak-field--check label { font-weight: 400; }
.nak-field--check .nak-field__error { grid-column: 2; }
.nak-field--hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.nak-form button { border: 0; cursor: pointer; }
.nak-form-notice { padding: 1rem 1.25rem; border-radius: var(--wp--custom--radius); border-left: 4px solid; }
.nak-form-notice--success { background: #ecf7ee; border-color: #1f7a3a; }
.nak-form-notice--error { background: #fdeceb; border-color: #b42318; }

/* ---------- Sidfot ---------- */
.nak-footer a { color: inherit; text-decoration: none; }
.nak-footer p, .nak-footer li { color: #c4cfdc; }
.nak-footer strong { color: #fff; font-weight: 600; }
.nak-footer a:hover { color: var(--wp--preset--color--accent); text-decoration: underline; }
.nak-footer h2 {
	color: #fff; font-size: 0.875rem !important; letter-spacing: 0.12em; text-transform: uppercase;
}
.nak-footer .wp-block-post-template li { margin-bottom: 0.35rem; }
.nak-footer .wp-block-post-title { color: #c4cfdc; font-family: var(--wp--preset--font-family--body); font-size: inherit !important; font-weight: 400; }
.nak-footer__logo img { background: #fff; padding: 0.6rem 0.9rem; border-radius: var(--wp--custom--radius); }

/* Tjänst – sidokolumn */
.nak-aside { position: sticky; top: 7rem; }
.nak-aside .wp-block-post-template li { border-bottom: 1px solid var(--wp--preset--color--border); }
.nak-aside .wp-block-post-title { font-family: var(--wp--preset--font-family--body); font-size: 1rem !important; font-weight: 500; margin: 0; }
.nak-aside .wp-block-post-title a { display: block; padding: 0.6rem 0; text-decoration: none; color: var(--wp--preset--color--ink); }
.nak-aside .wp-block-post-title a:hover { color: var(--wp--preset--color--primary); }
.nak-aside .wp-block-post-title a::after { content: "→"; float: right; color: var(--wp--preset--color--primary); }
@media (max-width: 781px) { .nak-aside { position: static; } }

/* Löptext i tjänster/sidor */
.nak-prose h2 { font-size: var(--wp--preset--font-size--x-large); margin-top: 2.5rem; }
.nak-prose h3 { font-size: var(--wp--preset--font-size--large); margin-top: 2rem; }

/* Sidfoten ska ansluta direkt till sista sektionen */
.wp-site-blocks > footer { margin-block-start: 0; }
.nak-footer__links { list-style: none; }

/* =================================================================
   Mobilanpassning
   ================================================================= */

/* Fast ring-knapp längst ner på mobilen */
.nak-mobilebar { display: none; }
@media (max-width: 781px) {
	.nak-mobilebar {
		display: block;
		position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
		padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom));
		background: var(--wp--preset--color--ink);
		box-shadow: 0 -6px 20px rgba(10, 26, 44, .25);
	}
	.nak-mobilebar p { margin: 0; }
	.nak-mobilebar .nak-ring { display: flex; justify-content: center; width: 100%; box-sizing: border-box; min-height: 48px; font-size: 1.0625rem; }
	body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
	/* Toppbalken behövs inte när knappen alltid syns – spar höjd */
	.nak-topbar { display: none; }
	.nak-header { padding-top: 0.7rem !important; padding-bottom: 0.7rem !important; }
	.nak-brand .wp-block-site-title { font-size: 1.5rem !important; }
}


@media (max-width: 600px) {
	/* Kompakta tjänstekort: bild bredvid text */
	.nak-card { flex-direction: row !important; flex-wrap: nowrap !important; align-items: stretch !important; }
	.nak-card .wp-block-post-featured-image {
		position: relative; flex: 0 0 34%; min-height: 128px; border-radius: 6px 0 0 6px !important;
	}
	.nak-card .wp-block-post-featured-image a { position: absolute; inset: 0; }
	.nak-card .wp-block-post-featured-image img {
		position: absolute; inset: 0; width: 100% !important; height: 100% !important;
		aspect-ratio: auto !important; object-fit: cover;
	}
	.nak-card > .wp-block-group { flex: 1 1 auto; padding: 1rem !important; gap: 0.4rem !important; min-width: 0; }
	.nak-card .wp-block-post-title { font-size: 1.1875rem !important; }
	.nak-card .wp-block-post-excerpt__excerpt {
		display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0;
	}
	.nak-card .wp-block-read-more { display: none; }
	.wp-block-post-template.is-layout-grid { gap: 0.875rem !important; }

	/* Sektioner lite tätare på små skärmar */
	.nak-hero.wp-block-cover { min-height: 0 !important; padding-top: 3rem !important; padding-bottom: 2.5rem !important; }
	.nak-hero .wp-block-buttons, .nak-hero .wp-block-buttons .wp-block-button { width: 100%; }
	.nak-hero .nak-ring, .nak-hero .wp-block-button__link { width: 100%; justify-content: center; box-sizing: border-box; }
	.nak-hero .wp-block-group:has(> p > .nak-ring) > * { flex: 1 1 100%; }
	.nak-pagehead::after { display: none; }

	/* Kontaktuppgifter i två kolumner */
	.nak-contactlist { display: grid !important; grid-template-columns: 1fr 1fr; gap: 1.25rem 1rem !important; }
	.nak-contactlist .nak-contactlist__value { font-size: 1.125rem; overflow-wrap: anywhere; }
}

/* Sidfot i rutnät på mobil i stället för en lång kolumn */
@media (max-width: 781px) {
	.nak-footer > .wp-block-columns {
		display: grid !important; grid-template-columns: 1fr 1fr; gap: 2rem 1.25rem !important;
	}
	.nak-footer > .wp-block-columns > .wp-block-column:first-child,
	.nak-footer > .wp-block-columns > .wp-block-column:nth-child(3) { grid-column: 1 / -1; }
	.nak-footer .wp-block-post-template li { margin-bottom: 0; }
	.nak-footer .wp-block-post-title a, .nak-footer__links a { display: inline-block; padding: 0.35rem 0; }
	.nak-footer .wp-block-group.is-layout-flex { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
}

/* Rimliga tryckytor för textlänkar med telefon/e-post */
.nak-tel, .nak-mail { display: inline-block; padding-block: 0.15rem; }

/* =================================================================
   Huvudmeny
   Dator (från 1024px): menyn i raden, ingen hamburgare.
   Surfplatta (782–1023px): hamburgare + "Ring jouren" i sidhuvudet.
   Mobil (under 782px): hamburgare, ring-knappen ligger längst ner.
   ================================================================= */

.nak-header .wp-block-navigation-item__content { text-decoration: none; }
.nak-header .nak-nav-cta { display: none; }

/* ---------- Dator ---------- */
@media (min-width: 1024px) {
	.nak-header { padding-top: 0 !important; padding-bottom: 0 !important; }
	.nak-header > .wp-block-group { min-height: 84px; }
	.nak-header .wp-block-navigation__container { gap: 0.25rem !important; }
	.nak-header .wp-block-navigation-item__content {
		position: relative;
		display: flex; align-items: center;
		height: 84px; padding: 0 0.9rem !important;
		color: var(--wp--preset--color--ink);
		transition: color .15s ease;
	}
	/* Markering i nederkant: syns vid hovring och på aktuell sida */
	.nak-header .wp-block-navigation-item__content::after {
		content: ""; position: absolute; left: 0.9rem; right: 0.9rem; bottom: -1px;
		height: 3px; border-radius: 3px 3px 0 0;
		background: var(--wp--preset--color--primary);
		transform: scaleX(0); transition: transform .2s ease;
	}
	.nak-header .wp-block-navigation-item__content:hover { color: var(--wp--preset--color--primary); }
	.nak-header .wp-block-navigation-item__content:hover::after,
	.nak-header .current-menu-item > .wp-block-navigation-item__content::after { transform: scaleX(1); }
	.nak-header .current-menu-item > .wp-block-navigation-item__content { color: var(--wp--preset--color--primary); }
	.nak-header .wp-block-navigation-item__content:focus-visible { outline-offset: -6px; }
}
@media (min-width: 1024px) and (prefers-reduced-motion: reduce) {
	.nak-header .wp-block-navigation-item__content::after { transition: none; }
}

/* ---------- Surfplatta och mobil: hamburgermeny ---------- */
@media (max-width: 1023px) {
	/* WordPress byter först vid 600px – tvinga hamburgare upp till 1023px */
	.nak-header .wp-block-navigation__responsive-container-open:not(.always-shown) { display: flex !important; }
	.nak-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { display: none !important; }

	.nak-header .wp-block-navigation__responsive-container-open,
	.nak-header .wp-block-navigation__responsive-container-close {
		width: 48px; height: 48px; align-items: center; justify-content: center;
		border-radius: var(--wp--custom--radius);
	}
	.nak-header .wp-block-navigation__responsive-container-open { margin-right: -10px; }
	.nak-header .wp-block-navigation__responsive-container-open svg,
	.nak-header .wp-block-navigation__responsive-container-close svg { width: 30px; height: 30px; }
	.nak-header .wp-block-navigation__responsive-container-open:hover { background: var(--wp--preset--color--surface); }

	/* Ring jouren före hamburgaren på surfplatta */
	.nak-header .nak-header__cta { order: -1; }

	/* Helskärmsmeny */
	.nak-header .wp-block-navigation__responsive-container.is-menu-open {
		padding: 1rem clamp(1rem, 5vw, 2.5rem) calc(6rem + env(safe-area-inset-bottom)) !important;
		background: var(--wp--preset--color--ink) !important;
		color: #fff !important;
	}
	.nak-header .is-menu-open .wp-block-navigation__responsive-close { max-width: 640px; margin: 0 auto; }
	.nak-header .is-menu-open .wp-block-navigation__responsive-container-content {
		padding-top: 4.5rem !important;
		align-items: stretch !important;
	}
	.nak-header .is-menu-open .wp-block-navigation__container {
		flex-direction: column; align-items: stretch !important; gap: 0 !important; width: 100%;
	}
	.nak-header .is-menu-open .wp-block-navigation-item {
		width: 100%; align-items: stretch !important;
		border-bottom: 1px solid rgba(255, 255, 255, .14);
	}
	.nak-header .is-menu-open .wp-block-navigation-item__content {
		display: flex !important; align-items: center; justify-content: space-between;
		width: 100%; min-height: 64px; padding: 0.5rem 0 !important;
		font-size: clamp(1.625rem, 6vw, 2rem); color: #fff !important;
	}
	.nak-header .is-menu-open .wp-block-navigation-item__content::after {
		content: "→"; font-size: 1.25rem; color: rgba(255, 255, 255, .5);
		transition: transform .15s ease;
	}
	.nak-header .is-menu-open .wp-block-navigation-item__content:hover::after { transform: translateX(4px); color: var(--wp--preset--color--accent); }
	.nak-header .is-menu-open .current-menu-item > .wp-block-navigation-item__content { color: var(--wp--preset--color--accent) !important; }
	.nak-header .is-menu-open .current-menu-item > .wp-block-navigation-item__content::after { content: "●"; font-size: 0.75rem; color: var(--wp--preset--color--accent); }

	/* Knappar längst ner i menyn */
	.nak-header .is-menu-open .nak-nav-cta {
		display: flex; flex-direction: column; gap: 0.75rem; width: 100%;
		margin-top: 2rem;
	}
	.nak-header .is-menu-open .nak-nav-cta .wp-block-button,
	.nak-header .is-menu-open .nak-nav-cta .wp-block-button__link { width: 100%; box-sizing: border-box; text-align: center; }
	.nak-header .is-menu-open .nak-nav-cta .wp-block-button__link { min-height: 52px; display: flex; align-items: center; justify-content: center; font-size: 1.125rem; }
	.nak-header .is-menu-open .nak-nav-cta .is-style-outline .wp-block-button__link { color: #fff; border-color: rgba(255, 255, 255, .6); }
	.nak-header .is-menu-open .nak-nav-cta .nak-nav-cta__call .wp-block-button__link {
		background: var(--wp--preset--color--accent); color: var(--wp--preset--color--ink);
	}

	/* Menyns innehåll centreras i en lagom bred spalt på surfplatta */
	.nak-header .is-menu-open .wp-block-navigation__responsive-container-content { max-width: 640px; margin: 0 auto; width: 100%; }
}

/* Mobil: ring-knappen i botten finns redan, så menyn behöver inte egen ring-knapp */
@media (max-width: 781px) {
	.nak-header .nak-header__cta { display: none; }
	.nak-header .is-menu-open .nak-nav-cta .nak-nav-cta__call { display: none; }

	/* Bara den fasta knappen i botten – göm övriga ring-knappar och jouruppmaningar */
	.nak-ring { display: none; }
	p:has(> .nak-ring:only-child):not(.nak-mobilebar *) { display: none; }
	.nak-akut, .nak-jourbox { display: none !important; }
}

/* Upptagningsområde */
.nak-omraden .nak-ring { margin-top: var(--wp--preset--spacing--30); }
