/*
 * HBU – block styles
 * Everything here hangs off core block classes, registered block styles (is-style-*)
 * or a few hbu-* class names set in the patterns, so editors keep full control.
 *
 * Colour has a meaning: teppe (red) = watch / tickets, sol (yellow) = join,
 * blekk (ink) = parents. Pastel gruppe-* tints are only used for the groups.
 */

:root {
	--hbu-krem: var(--wp--preset--color--krem);
	--hbu-papir: var(--wp--preset--color--papir);
	--hbu-blekk: var(--wp--preset--color--blekk);
	--hbu-teppe: var(--wp--preset--color--teppe);
	--hbu-sol: var(--wp--preset--color--sol);
	--hbu-display: var(--wp--preset--font-family--display);
	--hbu-skygge: 0 18px 40px rgba(36, 26, 62, .12);
	--hbu-strek: #E5D5BB;
	/* The scalloped curtain valance, drawn in the page colour over a coloured block. */
	--hbu-kappe: radial-gradient(circle at 36px 0, var(--hbu-krem) 0 36px, transparent 37px) 0 0 / 72px 44px repeat-x;
}

[hidden] { display: none !important; }

::selection { background: var(--hbu-sol); color: var(--hbu-blekk); }

:where(a, button, summary, input, textarea):focus-visible {
	outline: 3px solid var(--hbu-sol);
	outline-offset: 3px;
	border-radius: 6px;
}

/* ---------- Small label above headings ---------- */
.is-style-etikett {
	font-size: .9375rem;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
}

/* ---------- Header ---------- */
.hbu-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--hbu-krem) 92%, transparent);
	backdrop-filter: blur(8px);
}
.admin-bar .hbu-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .hbu-header { top: 46px; } }

.hbu-header .wp-block-site-logo img { transform-origin: 50% 85%; }
.hbu-merke:hover .wp-block-site-logo img { animation: hbu-vink .6s ease-in-out 2; }
@keyframes hbu-vink {
	0%, 100% { transform: rotate(0); }
	25% { transform: rotate(-12deg); }
	75% { transform: rotate(10deg) translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) { .hbu-merke:hover .wp-block-site-logo img { animation: none; } }
.hbu-ordmerke { margin: 0; line-height: 1.1; font-size: .9375rem; font-weight: 600; }
.hbu-ordmerke a { text-decoration: none; }
.hbu-ordmerke strong {
	display: block;
	font-family: var(--hbu-display);
	font-size: 1.5rem;
	font-weight: 800;
	letter-spacing: -.02em;
}
.hbu-header .wp-block-navigation-item__content { text-decoration: none; }
.hbu-header .wp-block-navigation-item__content:hover { text-decoration: underline; text-underline-offset: 6px; }
.hbu-nav-billett > .wp-block-navigation-item__content {
	padding: .8rem 1.4rem !important;
	background: var(--hbu-teppe);
	color: var(--hbu-krem) !important;
	border-radius: 999px;
	font-weight: 700;
}
.hbu-nav-billett > .wp-block-navigation-item__content:hover { text-decoration: none; background: #A92915; }

/* ---------- Curtain (hero) ---------- */
.is-style-teppe {
	position: relative;
	background-color: var(--hbu-teppe);
	background-image: repeating-linear-gradient(90deg, rgba(0, 0, 0, .08) 0 22px, rgba(255, 255, 255, .03) 22px 48px, rgba(0, 0, 0, .05) 48px 70px);
	color: var(--hbu-krem);
}
.is-style-teppe::before,
.hbu-kappe::before {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	height: 44px;
	background: var(--hbu-kappe);
	pointer-events: none;
}
.hbu-kappe { position: relative; }
.is-style-teppe h1 { color: inherit; }

/* ---------- Pierrot, the live mascot (assets/js/pierrot.js) ---------- */
.hbu-pierrot-figur {
	position: relative;
	flex-shrink: 0;
	width: 112px;
	aspect-ratio: 1;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
	overflow: hidden;
}
.hbu-pierrot-figur img,
.hbu-pierrot-figur video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	mix-blend-mode: multiply;
	transition: opacity .15s ease;
}
.hbu-pierrot-figur video { opacity: 0; }
.hbu-pierrot-figur.is-dancing video { opacity: 1; }
.hbu-pierrot-figur.is-dancing img { opacity: 0; }
.hbu-pierrot-figur img {
	transform-origin: 50% 85%;
	animation: hbu-vugge 3.2s ease-in-out infinite;
}
@keyframes hbu-vugge {
	0%, 100% { transform: rotate(-4deg) translateY(0); }
	50% { transform: rotate(4deg) translateY(-3%); }
}
@media (prefers-reduced-motion: reduce) {
	.hbu-pierrot-figur img { animation: none; }
}
/* No white disc variant: sits straight on the page colour. */
.hbu-pierrot-figur.is-fri { background: transparent; border-radius: 0; overflow: visible; }

/* ---------- Three doors ---------- */
.hbu-pierrot img {
	background: #fff;
	border-radius: 50%;
	padding: 8px 12px;
	box-sizing: content-box;
}
.is-style-dor {
	position: relative;
	overflow: hidden;
	border-radius: 180px 180px 28px 28px;
	box-shadow: var(--hbu-skygge);
	transition: transform .2s ease, box-shadow .2s ease;
}
.is-style-dor:hover { transform: translateY(-4px); box-shadow: 0 24px 48px rgba(36, 26, 62, .18); }
.is-style-dor .wp-block-image { margin: 0; }
.is-style-dor .wp-block-image img { display: block; width: 100%; }
.hbu-dor-ikon {
	aspect-ratio: 5 / 2;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFC23C' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='4' width='14' height='17' rx='2'/%3E%3Cpath d='M9 4V3h6v1M9 10h6M9 14h6M9 18h3'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center 70%;
	background-size: 64px;
}
.hbu-dor-tekst { position: relative; padding-right: 5.5rem !important; }
.hbu-dor-tekst h3 a { text-decoration: none; }
/* Stretched link: the whole door is clickable, the heading stays the one real link. */
.hbu-dor-tekst h3 a::after { content: ""; position: absolute; inset: -100vh 0 0; }
.hbu-dor-tekst::after {
	content: "→";
	position: absolute;
	right: 1.5rem;
	top: 50%;
	translate: 0 -50%;
	width: 3.25rem;
	height: 3.25rem;
	display: grid;
	place-items: center;
	border-radius: 50%;
	font-weight: 800;
	font-size: 1.3rem;
	background: var(--hbu-blekk);
	color: var(--hbu-krem);
}
.hbu-dor-teppe .hbu-dor-tekst::after { background: var(--hbu-teppe); }
.hbu-dor-sol .hbu-dor-tekst::after { background: var(--hbu-sol); color: var(--hbu-blekk); }

/* ---------- Ticket ---------- */
.is-style-billett {
	position: relative;
	border-radius: 32px;
	box-shadow: var(--hbu-skygge);
}
.is-style-billett > .wp-block-columns { margin: 0; align-items: stretch !important; }
.hbu-billett-bilde { overflow: hidden; border-radius: 32px 0 0 32px; min-height: 280px; }
.hbu-billett-bilde .wp-block-image { margin: 0; height: 100%; }
.hbu-billett-bilde img { width: 100%; height: 100% !important; object-fit: cover; }
.hbu-billett-stubb {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 1.5rem;
	text-align: center;
	border-left: 3px dashed var(--hbu-strek);
}
/* Punched notches where the stub tears off */
.hbu-billett-stubb::before,
.hbu-billett-stubb::after {
	content: "";
	position: absolute;
	left: -16px;
	width: 29px;
	height: 29px;
	border-radius: 50%;
	background: var(--hbu-krem);
}
.hbu-billett-stubb::before { top: -15px; }
.hbu-billett-stubb::after { bottom: -15px; }
.hbu-billett-dato span {
	display: block;
	font-size: .9375rem;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
}
.hbu-billett-dato strong {
	display: block;
	font-family: var(--hbu-display);
	font-size: clamp(2.75rem, 5vw, 3.75rem);
	line-height: 1;
	color: var(--hbu-teppe);
}
.hbu-merkelapp {
	width: fit-content;
	padding: .35rem .9rem !important;
	border-radius: 999px;
	font-size: .9375rem;
	font-weight: 700;
}
@media (max-width: 781px) {
	.hbu-billett-bilde { border-radius: 32px 32px 0 0; min-height: 200px; }
	.hbu-billett-stubb { border-left: 0; border-top: 3px dashed var(--hbu-strek); flex-direction: row; align-items: center; text-align: left; flex-basis: auto !important; }
	.hbu-billett-stubb::before, .hbu-billett-stubb::after { display: none; }
	.hbu-billett-stubb .wp-block-buttons { flex: 1; justify-content: flex-end; }
	.hbu-billett-stubb .wp-block-button { width: auto; }
}

/* ---------- Dark panel (group finder, weekly schedule) ---------- */
.is-style-panel { border-radius: 48px; }
.is-style-panel a:where(:not(.wp-element-button)) { color: inherit; }
@media (max-width: 781px) { .is-style-panel { border-radius: 28px; } }

/* ---------- Group finder (enhanced by assets/js/gruppevelger.js) ---------- */
.hbu-aar-knapper {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(4.75rem, 1fr));
	gap: .6rem;
}
.hbu-aar-knapper button {
	min-height: 3.5rem;
	border: 2px solid rgba(255, 245, 228, .35);
	border-radius: 16px;
	background: transparent;
	color: var(--hbu-krem);
	font-family: var(--hbu-display);
	font-size: 1.125rem;
	font-weight: 800;
	white-space: nowrap;
	padding: 0 .5rem;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease;
}
.hbu-aar-knapper button:hover { border-color: var(--hbu-krem); }
.hbu-aar-knapper button[aria-pressed="true"] {
	background: var(--tint, var(--hbu-sol));
	border-color: var(--tint, var(--hbu-sol));
	color: var(--hbu-blekk);
}
.hbu-gruppevelger.is-ready .hbu-grupper { display: block; }
.hbu-gruppevelger.is-ready .hbu-gruppe { min-height: 100%; box-sizing: border-box; }
.hbu-gruppevelger.is-ready .hbu-gruppe h3 { font-size: var(--wp--preset--font-size--xx-large); }
.hbu-gruppe-hint {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	margin: 0;
	min-height: 100%;
	box-sizing: border-box;
	padding: 2rem;
	border: 2px dashed rgba(255, 245, 228, .35);
	border-radius: 24px;
	font-family: var(--hbu-display);
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.25;
}
.hbu-gruppe-hint::before {
	content: "";
	flex-shrink: 0;
	width: 80px;
	height: 94px;
	background: url("../images/pierrot.png") center / contain no-repeat;
	filter: invert(1);
}
.hbu-gruppe-tid { font-weight: 700; }

/* ---------- Cards and shortcuts ---------- */
.is-style-kort {
	padding: 2rem;
	border-radius: 24px;
	box-shadow: 0 10px 30px rgba(36, 26, 62, .08);
}
.hbu-snarvei {
	position: relative;
	min-height: 7.5rem;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: 1.5rem;
}
.hbu-snarvei::after { content: "→"; font-weight: 800; font-size: 1.25rem; }
.hbu-snarvei h3 { hyphens: manual; overflow-wrap: normal; }
.hbu-snarvei h3 a { text-decoration: none; }
.hbu-snarvei h3 a::after { content: ""; position: absolute; inset: 0; }
.hbu-snarvei:hover { box-shadow: var(--hbu-skygge); }

/* ---------- Arched image ---------- */
.is-style-bue img {
	border: 8px solid var(--hbu-krem);
	border-radius: 240px 240px 28px 28px;
	box-sizing: border-box;
}

/* ---------- News ---------- */
.hbu-nyhet { align-items: center; }
.hbu-nyhet .wp-block-post-featured-image { flex-shrink: 0; margin: 0; }
.hbu-nyhet .wp-block-post-title a { text-decoration: none; }
.hbu-nyhet .wp-block-post-title a:hover { text-decoration: underline; }
@media (max-width: 600px) {
	.hbu-nyhet { flex-wrap: wrap !important; }
	.hbu-nyhet .wp-block-post-featured-image { width: 100% !important; }
}

/* ---------- Price table, checklist, FAQ ---------- */
.hbu-pristabell table { border-collapse: collapse; width: 100%; }
.hbu-pristabell td { border: 0; border-bottom: 2px dashed var(--hbu-strek); padding: .9rem 0; }
.hbu-pristabell tr:last-child td { border-bottom: 0; }
.hbu-pristabell td:last-child { text-align: right; white-space: nowrap; }

.hbu-hakeliste { list-style: none; padding-left: 0; }
.hbu-hakeliste li {
	padding-left: 2.25rem;
	margin-bottom: .75rem;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23241A3E' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") 0 .15em / 1.4em no-repeat;
}

.wp-block-details summary {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	list-style: none;
	cursor: pointer;
	font-size: 1.2rem;
	font-weight: 700;
}
.wp-block-details summary::-webkit-details-marker { display: none; }
.wp-block-details summary::after { content: "+"; font-size: 1.6rem; line-height: 1; }
.wp-block-details[open] summary::after { content: "–"; }
.wp-block-details[open] summary { margin-bottom: .75rem; }

/* ---------- Weekly schedule ---------- */
.hbu-ukedag {
	padding-bottom: .5rem;
	border-bottom: 2px solid rgba(255, 245, 228, .3);
}
.hbu-uke-merknad {
	padding: 1rem 1.25rem;
	border: 2px dashed rgba(255, 245, 228, .4);
	border-radius: 18px;
}

/* ---------- Footer ---------- */
.hbu-footer a { color: inherit; }
.hbu-partner {
	margin: 0;
	padding: .6rem 1rem;
	border: 1px solid rgba(255, 245, 228, .3);
	border-radius: 12px;
}
.hbu-partner-cta { margin-left: auto !important; }

/* ---------- Responsive grids ----------
 * Core's grid layout keeps a fixed column count, so step the counts down here. */
@media (max-width: 1000px) {
	.hbu-uke { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 781px) {
	.hbu-dorer, .hbu-steg, .hbu-dugnad, .hbu-uke { grid-template-columns: minmax(0, 1fr) !important; }
	.hbu-snarveier { grid-template-columns: minmax(0, 1fr) !important; }
	.hbu-snarvei { min-height: 0; flex-direction: row; align-items: center; }
}

/* Collapse the menu into the hamburger below 900px (core switches at 600px). */
@media (max-width: 899px) {
	.hbu-header .wp-block-navigation__responsive-container-open:not(.always-shown) { display: flex; }
	.hbu-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { display: none; }
}

/* ---------- Mobile: tickets and join always one thumb away ---------- */
.hbu-mobilbar { display: none !important; }
@media (max-width: 781px) {
	.hbu-mobilbar {
		display: flex !important;
		position: fixed;
		left: 12px;
		right: 12px;
		bottom: 12px;
		z-index: 60;
		padding: 7px;
		background: #fff;
		border-radius: 999px;
		box-shadow: 0 12px 30px rgba(36, 26, 62, .3);
	}
	.hbu-mobilbar .wp-block-buttons { width: 100%; gap: 7px; }
	.hbu-mobilbar .wp-block-button__link { width: 100%; padding: .85rem 1rem; }
	body { padding-bottom: 88px; }
	.hbu-nav-billett { display: none !important; }
}

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