/*
 * Tilkynningar – NESMO
 * Flipi sem hangir neðst á haus vefsins og leggst yfir efsta hluta síðunnar.
 * Litum má breyta með CSS-breytum, t.d. í Blocksy › Customizer › Additional CSS:
 *   .nesmo-tilk { --nesmo-tilk-accent: #E65D16; }
 */

.nesmo-tilk {
	--nesmo-tilk-accent: var(--theme-palette-color-1, #E65D16);
	--nesmo-tilk-bg: #1F1F1F;
	--nesmo-tilk-ear: 22px;

	position: relative;
	z-index: 40;
	height: 0;
	font-family: inherit;
}

.nesmo-tilk[hidden] { display: none; }

/* Fest inni í haus vefsins: neðri brún hauss, óháð því hvað kemur á eftir honum. */
.nesmo-tilk--docked {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	/* Aftast innan hauss: fastur (sticky) haus rennur yfir borðann þegar skrunað er,
	   en hausinn í heild er áfram ofan á hero/efni síðunnar. */
	z-index: -1;
}

/* Skel: staðsetur flipann og klippir hann við neðri brún hauss, svo hann
   renni út undan hausnum eins og skúffa þegar hann kemur niður. */
.nesmo-tilk__tab {
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: min(1040px, calc(100% - (var(--nesmo-tilk-ear) * 2) - 12px));
	clip-path: inset(0 -80px -100px -80px);
}

/* Sjálfur flipinn: gler, skuggi og efni. */
.nesmo-tilk__inner {
	position: relative;
	box-sizing: border-box;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 18px;
	padding: 8px 10px 12px 24px;
	border-radius: 0 0 24px 24px;
	color: #FFFFFF;
	line-height: 1.3;
	background: linear-gradient(180deg, var(--nesmo-tilk-bg) 0px, var(--nesmo-tilk-bg) 16px, rgba(31, 31, 31, 0.70) 100%);
	-webkit-backdrop-filter: blur(24px) saturate(160%);
	backdrop-filter: blur(24px) saturate(160%);
	box-shadow:
		inset 0 -1px 0 rgba(255, 255, 255, 0.16),
		inset 1px 0 0 rgba(255, 255, 255, 0.05),
		inset -1px 0 0 rgba(255, 255, 255, 0.05),
		0 18px 40px rgba(0, 0, 0, 0.40);
}

/* „Háls“ í lit hauss fyrir ofan flipann – fyllir bilið þegar hann fjaðrar niður. */
.nesmo-tilk__inner::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 100%;
	height: 48px;
	background: var(--nesmo-tilk-bg);
	pointer-events: none;
}

/* Glampi sem rennur einu sinni yfir glerið eftir lendingu. */
.nesmo-tilk__shine {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	overflow: hidden;
	pointer-events: none;
}
.nesmo-tilk__shine::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 45%;
	background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.10) 40%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 255, 255, 0.06) 60%, transparent 100%);
	transform: translateX(-120%);
	opacity: 0;
}

/* Vafrar án backdrop-filter: þéttari bakgrunnur svo textinn sé læsilegur. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.nesmo-tilk__inner { background: linear-gradient(180deg, var(--nesmo-tilk-bg) 0px, var(--nesmo-tilk-bg) 16px, rgba(31, 31, 31, 0.94) 100%); }
}

/* Innfelld horn sem tengja flipann við hausinn. */
.nesmo-tilk__ear {
	position: absolute;
	top: 0;
	width: var(--nesmo-tilk-ear);
	height: var(--nesmo-tilk-ear);
	pointer-events: none;
}
.nesmo-tilk__ear--l { left: calc(var(--nesmo-tilk-ear) * -1); background: radial-gradient(circle at 0 100%, transparent calc(var(--nesmo-tilk-ear) - 0.5px), var(--nesmo-tilk-bg) var(--nesmo-tilk-ear)); }
.nesmo-tilk__ear--r { right: calc(var(--nesmo-tilk-ear) * -1); background: radial-gradient(circle at 100% 100%, transparent calc(var(--nesmo-tilk-ear) - 0.5px), var(--nesmo-tilk-bg) var(--nesmo-tilk-ear)); }

.nesmo-tilk__title {
	flex: none;
	font-size: 19px;
	font-weight: 900;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	white-space: nowrap;
}
.nesmo-tilk__accent { color: var(--nesmo-tilk-accent); }

.nesmo-tilk__divider {
	flex: none;
	width: 1px;
	height: 28px;
	background: rgba(255, 255, 255, 0.22);
}

.nesmo-tilk__text {
	flex: 1 1 260px;
	min-width: 0;
	margin: 0 !important;
	font-size: 14px;
	color: #FFFFFF;
}
.nesmo-tilk__text strong,
.nesmo-tilk__text b { font-weight: 800; color: #FFFFFF; }

.nesmo-tilk__countdown { flex: none; display: flex; }
.nesmo-tilk__countdown[hidden],
.nesmo-tilk__chips[hidden],
.nesmo-tilk__live[hidden],
.nesmo-tilk__btn[hidden],
.nesmo-tilk__close[hidden],
.nesmo-tilk__title[hidden],
.nesmo-tilk__divider[hidden] { display: none; }

.nesmo-tilk__chips { display: flex; gap: 6px; }
.nesmo-tilk__chip {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 40px;
	padding: 4px 6px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.10);
	border: 1px solid rgba(255, 255, 255, 0.16);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
	line-height: 1.1;
}
.nesmo-tilk__num { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.nesmo-tilk__unit { font-size: 9.5px; font-weight: 600; color: #D4D4D4; text-transform: uppercase; letter-spacing: 0.5px; }

.nesmo-tilk__live { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.nesmo-tilk__dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--nesmo-tilk-accent);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--nesmo-tilk-accent) 30%, transparent);
	animation: nesmo-tilk-pulse 2s ease-in-out infinite;
}

.nesmo-tilk__actions { flex: none; display: flex; align-items: center; gap: 6px; margin-left: auto; }

.nesmo-tilk__btn,
.nesmo-tilk__btn:visited {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 18px;
	border-radius: 999px;
	background: var(--nesmo-tilk-accent);
	color: #1F1F1F;
	text-decoration: none;
	font-size: 13.5px;
	font-weight: 800;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 14px color-mix(in srgb, var(--nesmo-tilk-accent) 35%, transparent);
	transition: transform 0.15s ease, filter 0.15s ease;
}
.nesmo-tilk__btn:hover,
.nesmo-tilk__btn:focus-visible { color: #1F1F1F; filter: brightness(1.08); transform: translateY(-1px); }

.nesmo-tilk__close {
	width: 40px;
	height: 40px;
	padding: 0;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.10);
	border: 1px solid rgba(255, 255, 255, 0.18);
	color: #FFFFFF;
	cursor: pointer;
	transition: background 0.15s ease;
}
.nesmo-tilk__close:hover { background: rgba(255, 255, 255, 0.2); }

.nesmo-tilk__btn:focus-visible,
.nesmo-tilk__close:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }

/* ---------- Innkomuhreyfing ---------- */
.nesmo-tilk {
	--nesmo-tilk-delay: 0.45s;
}
.nesmo-tilk--animate .nesmo-tilk__inner {
	animation: nesmo-tilk-drop 0.95s cubic-bezier(0.22, 0.9, 0.3, 1) var(--nesmo-tilk-delay) both;
}
.nesmo-tilk--animate .nesmo-tilk__title,
.nesmo-tilk--animate .nesmo-tilk__divider,
.nesmo-tilk--animate .nesmo-tilk__text,
.nesmo-tilk--animate .nesmo-tilk__coupon,
.nesmo-tilk--animate .nesmo-tilk__countdown,
.nesmo-tilk--animate .nesmo-tilk__actions {
	animation: nesmo-tilk-settle 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.nesmo-tilk--animate .nesmo-tilk__title     { animation-delay: calc(var(--nesmo-tilk-delay) + 0.38s); }
.nesmo-tilk--animate .nesmo-tilk__divider   { animation-delay: calc(var(--nesmo-tilk-delay) + 0.44s); }
.nesmo-tilk--animate .nesmo-tilk__text      { animation-delay: calc(var(--nesmo-tilk-delay) + 0.50s); }
.nesmo-tilk--animate .nesmo-tilk__coupon    { animation-delay: calc(var(--nesmo-tilk-delay) + 0.56s); }
.nesmo-tilk--animate .nesmo-tilk__countdown { animation-delay: calc(var(--nesmo-tilk-delay) + 0.62s); }
.nesmo-tilk--animate .nesmo-tilk__actions   { animation-delay: calc(var(--nesmo-tilk-delay) + 0.66s); }
.nesmo-tilk--animate .nesmo-tilk__shine::after {
	animation: nesmo-tilk-shine 1.1s cubic-bezier(0.4, 0, 0.2, 1) calc(var(--nesmo-tilk-delay) + 0.95s) both;
}
.nesmo-tilk--animate .nesmo-tilk__btn {
	animation: nesmo-tilk-ping 1.3s ease-out calc(var(--nesmo-tilk-delay) + 1.35s) 1 both;
}

.nesmo-tilk.is-closing .nesmo-tilk__inner { animation: nesmo-tilk-up 0.38s cubic-bezier(0.5, 0, 0.75, 0) both; }

/* Afsláttarkóði – flipinn breikkar svo allt komist í eina línu í tölvu. */
.nesmo-tilk--has-coupon .nesmo-tilk__tab { width: min(1200px, calc(100% - (var(--nesmo-tilk-ear) * 2) - 12px)); }
.nesmo-tilk--has-coupon .nesmo-tilk__text { flex-basis: 180px; }

.nesmo-tilk__coupon {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 3px 3px 3px 12px;
	border-radius: 12px;
	border: 1px dashed rgba(255, 255, 255, 0.38);
	background: rgba(255, 255, 255, 0.07);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.nesmo-tilk__coupon[hidden] { display: none; }
.nesmo-tilk__coupon-label { font-size: 10px; font-weight: 700; color: #D4D4D4; text-transform: uppercase; letter-spacing: 0.6px; }
.nesmo-tilk__code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 14px;
	font-weight: 800;
	letter-spacing: 1px;
	color: #FFFFFF;
	background: none;
	padding: 0;
	user-select: all;
}
.nesmo-tilk__copy {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	min-height: 32px;
	padding: 0 11px;
	border-radius: 9px;
	border: 0;
	background: rgba(255, 255, 255, 0.14);
	color: #FFFFFF;
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}
.nesmo-tilk__copy:hover { background: rgba(255, 255, 255, 0.24); }
.nesmo-tilk__copy:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
.nesmo-tilk__ico-check { display: none; }
.nesmo-tilk__copy.is-copied { background: var(--nesmo-tilk-accent); color: #1F1F1F; }
.nesmo-tilk__copy.is-copied .nesmo-tilk__ico-copy { display: none; }
.nesmo-tilk__copy.is-copied .nesmo-tilk__ico-check { display: inline; animation: nesmo-tilk-pop 0.3s cubic-bezier(0.3, 1.6, 0.5, 1); }
.nesmo-tilk__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@keyframes nesmo-tilk-pop { from { transform: scale(0.4); } to { transform: scale(1); } }

/* Rúllandi texti – virkjast aðeins ef textinn kemst ekki fyrir (sjá tilkynningar.js). */
.nesmo-tilk__text.is-marquee {
	overflow: hidden;
	white-space: nowrap;
	cursor: pointer;
	-webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
	mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}
.nesmo-tilk__track {
	display: inline-flex;
	gap: 56px;
	padding-left: 28px;
	will-change: transform;
	animation: nesmo-tilk-marquee var(--nesmo-tilk-marquee-dur, 20s) linear infinite;
}
.nesmo-tilk__seg { flex: none; }
.nesmo-tilk__text.is-marquee:hover .nesmo-tilk__track,
.nesmo-tilk__tab:focus-within .nesmo-tilk__track,
.nesmo-tilk__text.is-paused .nesmo-tilk__track { animation-play-state: paused; }

@keyframes nesmo-tilk-marquee { to { transform: translateX(calc(-50% - 14px)); } } /* = einn bútur + bil (56px), að teknu tilliti til 28px padding */

/* Farsími */
@media (max-width: 689px) {
	.nesmo-tilk { --nesmo-tilk-ear: 14px; }
	.nesmo-tilk__tab { width: calc(100% - (var(--nesmo-tilk-ear) * 2) - 8px); }
	.nesmo-tilk__inner {
		padding: 8px 8px 10px 16px;
		gap: 8px 12px;
		border-radius: 0 0 18px 18px;
	}
	.nesmo-tilk__title { font-size: 16px; }
	.nesmo-tilk__divider { display: none; }
	.nesmo-tilk__text { flex-basis: 100%; order: 2; font-size: 13.5px; }
	.nesmo-tilk__coupon { order: 3; padding-left: 10px; }
	.nesmo-tilk__countdown { order: 3; margin-left: auto; }
	/* Þéttari kóði í síma: fela „Kóði“ og texta á takka (skjálesarar heyra hann enn). */
	.nesmo-tilk__coupon-label { display: none; }
	.nesmo-tilk__code { font-size: 13px; letter-spacing: 0.5px; }
	.nesmo-tilk__copy { padding: 0 9px; min-width: 32px; justify-content: center; }
	.nesmo-tilk__copy-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	.nesmo-tilk__actions { order: 1; }
	.nesmo-tilk__chip { min-width: 34px; padding: 3px 5px; }
	.nesmo-tilk__num { font-size: 13.5px; }
	.nesmo-tilk__btn { min-height: 36px; padding: 0 14px; font-size: 13px; }
	.nesmo-tilk__close { width: 36px; height: 36px; }
}

/* Rennur niður undan hausnum og fjaðrar: smá yfirskot, lítill skoppur, lendir. */
@keyframes nesmo-tilk-drop {
	0%   { transform: translateY(-115%); }
	58%  { transform: translateY(6%); }
	76%  { transform: translateY(-2.5%); }
	90%  { transform: translateY(1%); }
	100% { transform: translateY(0); }
}
@keyframes nesmo-tilk-settle {
	from { opacity: 0; transform: translateY(-8px); filter: blur(3px); }
	to   { opacity: 1; transform: none; filter: none; }
}
@keyframes nesmo-tilk-shine {
	0%   { transform: translateX(-120%); opacity: 1; }
	100% { transform: translateX(260%); opacity: 1; }
}
@keyframes nesmo-tilk-ping {
	0%   { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 14px color-mix(in srgb, var(--nesmo-tilk-accent) 35%, transparent), 0 0 0 0 color-mix(in srgb, var(--nesmo-tilk-accent) 60%, transparent); }
	100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 14px color-mix(in srgb, var(--nesmo-tilk-accent) 35%, transparent), 0 0 0 16px color-mix(in srgb, var(--nesmo-tilk-accent) 0%, transparent); }
}
@keyframes nesmo-tilk-up { to { transform: translateY(-115%); } }
@keyframes nesmo-tilk-pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--nesmo-tilk-accent) 10%, transparent); } }

@media (prefers-reduced-motion: reduce) {
	.nesmo-tilk--animate *,
	.nesmo-tilk--animate .nesmo-tilk__inner,
	.nesmo-tilk--animate .nesmo-tilk__shine::after,
	.nesmo-tilk.is-closing .nesmo-tilk__inner,
	.nesmo-tilk__dot,
	.nesmo-tilk__track { animation: none !important; }
}
