/* ==========================================================================
   KK Top utility bar — phone, socials, announcements, today's hours
   Colours come from the admin settings (--tb-bg / --tb-text / --tb-accent).
   The hours tooltip keeps its hover + tap-to-open behaviour.
   ========================================================================== */

/* The bar is a slim deep-brown strip: the one dark band above the white
   header, so the logo and navigation read as the main event. The admin
   colour settings feed --tb-bg / --tb-accent; brand brown is the fallback. */
.kk-top-bar {
	position: sticky;
	top: 0;
	z-index: 1100;
	background: var(--tb-bg, var(--kk-brown)) !important;
	color: rgba(255, 255, 255, 0.82) !important;
	font-family: var(--kk-font);
	font-size: 12.5px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0.01em;
	border-bottom: none;
	overflow: visible;
}

.kk-top-bar__inner,
.kk-top-bar__right { overflow: visible; }

.kk-top-bar a {
	color: #fff;
	text-decoration: none;
	transition: color var(--kk-duration) var(--kk-ease);
}

.kk-top-bar a:hover { color: var(--tb-accent, var(--kk-gold)); opacity: 1; }

.kk-top-bar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 22px;
	max-width: var(--kk-container);
	min-height: 38px;
	margin: 0 auto;
	padding: 2px var(--kk-gutter);
	box-sizing: border-box;
}

.kk-tb-icon { width: 14px; height: 14px; flex-shrink: 0; vertical-align: middle; }

/* ----- Left: phone + socials ----- */
.kk-top-bar__left { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.kk-top-bar__phone {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 30px;
	padding: 0 8px 0 0;
	font-weight: 600;
	white-space: nowrap;
}

.kk-top-bar__phone-label { border: none; }

.kk-top-bar__social {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: var(--kk-radius-sm);
	background: transparent;
	transition: background var(--kk-duration) var(--kk-ease);
}

.kk-top-bar__social:hover { background: rgba(255, 255, 255, 0.12); opacity: 1; }

/* ----- Centre: announcements ----- */
/* Clear breathing room either side so scrolling text never butts up against
   the social icons or the hours pill; the mask fades the ends out over a
   fixed 48px rather than a percentage, so it looks the same at every width. */
.kk-top-bar__centre { flex: 1; min-width: 0; overflow: hidden; margin: 0 20px; }

.kk-top-bar__ticker {
	position: relative;
	overflow: hidden;
	mask-image: linear-gradient(to right, transparent 0, #000 72px, #000 calc(100% - 72px), transparent 100%);
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 72px, #000 calc(100% - 72px), transparent 100%);
}

.kk-top-bar__ticker-track {
	display: inline-flex;
	white-space: nowrap;
	animation: kk-ticker-scroll var(--tb-speed, 30s) linear infinite;
}

.kk-top-bar__ticker-item {
	display: inline-block;
	padding: 0 32px;
	color: rgba(255, 255, 255, 0.9);
	font-weight: 500;
}

.kk-top-bar__ticker-item::before { content: "\2022"; margin-right: 10px; color: var(--tb-accent, var(--kk-gold)); }

@keyframes kk-ticker-scroll {
	0%   { transform: translateX(0); }
	100% { transform: translateX(-50%); }
}

.kk-top-bar__ticker:hover .kk-top-bar__ticker-track { animation-play-state: paused; }

.kk-top-bar__ticker--static {
	display: flex;
	justify-content: center;
	align-items: center;
	mask-image: none;
	-webkit-mask-image: none;
}

.kk-top-bar__ticker--static .kk-top-bar__ticker-item { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

/* ----- Right: hours ----- */
.kk-top-bar__right { display: flex; align-items: center; flex-shrink: 0; }

.kk-top-bar__hours {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 28px;
	padding: 3px 12px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid rgba(255, 255, 255, 0.14);
	white-space: nowrap;
	position: relative;
	cursor: default;
	transition: background var(--kk-duration) var(--kk-ease), border-color var(--kk-duration) var(--kk-ease);
}

.kk-top-bar__hours--has-tooltip { cursor: pointer; }
.kk-top-bar__hours--has-tooltip:hover,
.kk-top-bar__hours--has-tooltip.is-open {
	background: rgba(255, 255, 255, 0.14);
	border-color: rgba(255, 255, 255, 0.28);
}

.kk-top-bar__hours-text strong { font-weight: 600; color: #fff; }

.kk-top-bar__status {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	flex-shrink: 0;
}

.kk-top-bar__status--open { background: #6FCF7F; box-shadow: 0 0 0 3px rgba(111, 207, 127, 0.25); }
.kk-top-bar__status--closed { background: #E5736A; box-shadow: 0 0 0 3px rgba(229, 115, 106, 0.25); }

.kk-top-bar__special-tag {
	display: inline-block;
	font-size: 10px;
	font-weight: 600;
	padding: 1px 6px;
	background: var(--tb-accent, var(--kk-gold));
	color: var(--kk-brown);
	border-radius: 3px;
	margin-left: 6px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	vertical-align: middle;
}

/* ==========================================================================
   Week tooltip / dropdown
   ========================================================================== */

.kk-top-bar__week-tooltip {
	display: flex;
	flex-direction: row;
	position: absolute;
	top: calc(100% + 10px);
	min-width: 280px;
	background: #fff;
	color: var(--kk-text);
	border: 1px solid var(--kk-line);
	border-radius: var(--kk-radius);
	box-shadow: var(--kk-shadow-xl);
	z-index: 1200;
	font-size: 13.5px;
	visibility: hidden;
	pointer-events: none;
	opacity: 0;
	transform: translateY(-6px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0.2s;
	/* visible, not hidden: the Shabbos-times popup on Fri/Sat rows opens
	   outside the card and was being clipped. Corners are rounded on the
	   banner and content instead. */
	overflow: visible;
}
.kk-top-bar__week-tooltip > :first-child { border-top-left-radius: inherit; border-bottom-left-radius: inherit; }
.kk-top-bar__week-tooltip > :last-child { border-top-right-radius: inherit; border-bottom-right-radius: inherit; }

.kk-top-bar__week-tooltip::after {
	content: "";
	position: absolute;
	bottom: 100%;
	left: 0; right: 0;
	height: 16px;
}

/* Invisible bridge over the 10px gap between the pill and the dropdown, so the
   pointer stays "inside" while moving down (the tooltip's own ::after is clipped
   by its overflow:hidden). JS adds .is-hover with a short close delay as well. */
.kk-top-bar__hours--has-tooltip::after {
	content: "";
	position: absolute;
	left: -12px;
	right: -12px;
	top: 100%;
	height: 14px;
}

@media (hover: hover) {
	.kk-top-bar__hours--has-tooltip.is-hover .kk-top-bar__week-tooltip,
	.kk-top-bar__hours--has-tooltip:hover .kk-top-bar__week-tooltip {
		visibility: visible !important;
		pointer-events: auto !important;
		opacity: 1 !important;
		transform: translateY(0) !important;
		transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0s;
	}
	.kk-top-bar__hours--has-tooltip.is-hover .kk-top-bar__week-tooltip--center,
	.kk-top-bar__hours--has-tooltip:hover .kk-top-bar__week-tooltip--center {
		transform: translateX(-50%) translateY(0) !important;
	}
}

/* Branch name in the pill + Golders Green / Edgware tabs in the dropdown */
.kk-top-bar__hours-branch { display: inline-flex; align-items: center; gap: 7px; }
.kk-top-bar__hours-branch[hidden] { display: none; }
.kk-top-bar__branch-name { font-weight: 600; color: #fff; margin-right: 2px; }
.kk-top-bar__branch-name::after { content: " \00B7"; opacity: .7; }

.kk-top-bar__branch-tabs {
	display: flex;
	gap: 4px;
	margin: 10px 14px 4px;
	padding: 3px;
	background: var(--kk-surface-2, #F0F0ED);
	border-radius: 999px;
}
.kk-top-bar__branch-tab,
.kk-top-bar__branch-tab:hover,
.kk-top-bar__branch-tab:focus {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 6px 10px;
	font: inherit;
	font-size: 12.5px;
	font-weight: 500;
	color: var(--kk-text-2);
	background: transparent;
	border: 0;
	border-radius: 999px;
	box-shadow: none;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color .12s ease, color .12s ease, box-shadow .12s ease;
}
.kk-top-bar__branch-tab:hover { color: var(--kk-ink); }
.kk-top-bar__branch-tab[aria-selected="true"] {
	color: var(--kk-ink);
	font-weight: 600;
	background: #fff;
	box-shadow: 0 1px 3px rgba(31, 26, 20, 0.12);
}
.kk-top-bar__branch-tab:focus-visible { outline: 2px solid var(--kk-gold-deep); outline-offset: 1px; }
.kk-top-bar__branch-tab .kk-top-bar__status { width: 7px; height: 7px; box-shadow: none; }
.kk-top-bar__week-branch[hidden],
.kk-top-bar__week-status[hidden] { display: none; }

.kk-top-bar__hours--has-tooltip.is-open .kk-top-bar__week-tooltip {
	visibility: visible !important;
	pointer-events: auto !important;
	opacity: 1 !important;
	transform: translateY(0) !important;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0s;
}

.kk-top-bar__week-tooltip--right { right: 0; }
.kk-top-bar__week-tooltip--left  { left: 0; }
.kk-top-bar__week-tooltip--center { left: 50%; transform: translateX(-50%) translateY(-6px); }
.kk-top-bar__hours--has-tooltip.is-open .kk-top-bar__week-tooltip--center { transform: translateX(-50%) translateY(0) !important; }

.kk-top-bar__week-tooltip::before { display: none; }

/* Media panel */
.kk-top-bar__week-tooltip--card { min-width: 280px; }

.kk-top-bar__week-banner {
	width: 0;
	min-height: 100%;
	background-size: cover;
	background-position: center;
	overflow: hidden;
	transition: width 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
	flex-shrink: 0;
	position: relative;
}

@media (hover: hover) {
	.kk-top-bar__hours--has-tooltip:hover .kk-top-bar__week-tooltip--card .kk-top-bar__week-banner {
		width: var(--media-width, 180px);
		transition: width 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s;
	}
}

.kk-top-bar__hours--has-tooltip.is-open .kk-top-bar__week-tooltip--card .kk-top-bar__week-banner {
	width: var(--media-width, 180px);
	transition: width 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s;
}

.kk-top-bar__week-banner-overlay {
	position: absolute;
	bottom: 0; left: 0; right: 0;
	padding: 12px;
	background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
	color: #fff;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.kk-top-bar__week-banner-name { font-weight: 600; font-size: 14px; }
.kk-top-bar__week-banner-msg { font-size: 12px; opacity: 0.85; }
.kk-top-bar__week-banner video { width: 100%; height: 100%; object-fit: cover; }

.kk-top-bar__week-period-bar {
	padding: 10px 16px;
	color: #fff;
	font-size: 13px;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.kk-top-bar__week-period-bar strong { font-weight: 600; }

/* Hours content */
.kk-top-bar__week-content { flex: 1; min-width: 250px; overflow: visible; }

.kk-top-bar__week-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 14px 18px 12px;
	font-weight: 600;
	font-size: 14px;
	color: var(--kk-ink);
	border-bottom: 1px solid var(--kk-line);
}

.kk-top-bar__week-status {
	font-size: 11px;
	font-weight: 600;
	padding: 3px 8px;
	border-radius: var(--kk-radius-xs);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.kk-top-bar__week-status--open { background: var(--kk-green-light); color: var(--kk-green-dark); }
.kk-top-bar__week-status--closed { background: var(--kk-red-light); color: var(--kk-red); }

.kk-top-bar__week-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 18px;
	border-bottom: 1px solid var(--kk-border-light);
	transition: background 0.15s;
	color: var(--kk-text);
}

.kk-top-bar__week-row:last-of-type { border-bottom: none; padding-bottom: 12px; }
.kk-top-bar__week-row:hover { background: var(--kk-surface); }

.kk-top-bar__week-row--today { font-weight: 600; color: var(--kk-ink); background: var(--kk-gold-pale); }
.kk-top-bar__week-row--today:hover { background: var(--kk-gold-soft); }

.kk-top-bar__week-row--special .kk-top-bar__week-time { color: var(--kk-text-2); }

.kk-top-bar__week-row--zmanim { position: relative; cursor: pointer; }

.kk-top-bar__week-day { min-width: 100px; display: flex; align-items: baseline; gap: 6px; }

.kk-top-bar__week-date { font-size: 12px; font-weight: 400; color: var(--kk-text-3); }
.kk-top-bar__week-row--today .kk-top-bar__week-date { color: var(--kk-gold-deep); }

.kk-top-bar__week-time { text-align: right; color: var(--kk-text-2); }
.kk-top-bar__week-row--today .kk-top-bar__week-time { color: var(--kk-ink); }

.kk-top-bar__week-special { color: #B45309; font-weight: 700; }

.kk-hours-close-hl {
	font-weight: 600;
	color: #8A4B0B;
	background: rgba(180, 83, 9, 0.1);
	padding: 1px 6px;
	border-radius: 3px;
	font-size: 0.9em;
}

.kk-top-bar__hours-text .kk-hours-close-hl {
	background: none;
	padding: 0;
	font-size: inherit;
	color: #fff;
	text-decoration: underline;
	text-decoration-color: var(--tb-accent, var(--kk-gold));
	text-underline-offset: 2px;
}

.kk-top-bar__week-row[data-candles],
.kk-top-bar__week-row[data-havdalah] { position: relative; cursor: pointer; }

.kk-zmanim-icon {
	margin-left: 6px;
	vertical-align: middle;
	flex-shrink: 0;
	transition: opacity 0.2s, transform 0.2s;
}

.kk-zmanim-icon--candle { color: #D97706; opacity: 0.75; }
.kk-zmanim-icon--havdalah { color: var(--kk-gold); opacity: 0.75; }
.kk-top-bar__week-row:hover .kk-zmanim-icon { opacity: 1; transform: scale(1.12); }

/* Zmanim tooltip */
.kk-zmanim-tip {
	position: absolute;
	right: calc(100% + 12px);
	top: 50%;
	transform: translateY(-50%) translateX(4px);
	background: #fff;
	color: var(--kk-text);
	border: 1px solid var(--kk-line);
	border-radius: var(--kk-radius);
	padding: 14px 16px 10px;
	min-width: 210px;
	white-space: nowrap;
	font-size: 13px;
	line-height: 1.5;
	box-shadow: var(--kk-shadow-lg);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
	z-index: 60;
}

.kk-zmanim-tip::after {
	content: '';
	position: absolute;
	right: -6px;
	top: 50%;
	transform: translateY(-50%) rotate(45deg);
	width: 11px; height: 11px;
	background: #fff;
	border-right: 1px solid var(--kk-line);
	border-top: 1px solid var(--kk-line);
}

.kk-top-bar__week-row:hover .kk-zmanim-tip { opacity: 1; pointer-events: auto; transform: translateY(-50%) translateX(0); }

.kk-zmanim-tip__header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 10px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--kk-line);
}

.kk-zmanim-tip__title { font-size: 13px; font-weight: 600; color: var(--kk-ink); }
.kk-zmanim-tip__hebrew { font-size: 14px; color: var(--kk-text-2); direction: rtl; }

.kk-zmanim-tip__row { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.kk-zmanim-tip__row + .kk-zmanim-tip__row { border-top: 1px solid var(--kk-border-light); }

.kk-zmanim-tip__label { display: flex; align-items: center; gap: 6px; color: var(--kk-text-2); font-size: 13px; flex: 1; }
.kk-zmanim-tip__ico { flex-shrink: 0; opacity: 0.8; }
.kk-zmanim-tip__row:first-of-type .kk-zmanim-tip__ico { color: #D97706; }
.kk-zmanim-tip__row:last-of-type .kk-zmanim-tip__ico { color: var(--kk-gold); }

.kk-zmanim-tip__time {
	font-weight: 600;
	color: var(--kk-ink);
	font-size: 13px;
	background: var(--kk-gold-soft);
	padding: 2px 8px;
	border-radius: var(--kk-radius-xs);
}

.kk-zmanim-tip__extras { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--kk-line); }
.kk-zmanim-tip__extra { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 2px 0; }
.kk-zmanim-tip__extra-name { font-size: 12px; color: var(--kk-text-2); }
.kk-zmanim-tip__extra-heb { font-size: 12.5px; color: var(--kk-text-3); direction: rtl; }

.kk-zmanim-tip__footer {
	display: flex; align-items: center; gap: 4px;
	margin-top: 8px; padding-top: 6px;
	border-top: 1px solid var(--kk-border-light);
	font-size: 11px; color: var(--kk-text-3);
}

.kk-zmanim-tip__footer svg { opacity: 0.5; }

.kk-top-bar__week-footer {
	padding: 10px 18px;
	border-top: 1px solid var(--kk-line);
	font-size: 12px;
	color: var(--kk-text-3);
}

/* Header overflow */
.kk-top-bar + .kk-centered-header { overflow: visible; }

/* Mobile backdrop */
.kk-top-bar__backdrop { display: none; }

@media (max-width: 767px) {
	.kk-top-bar__backdrop {
		position: fixed;
		inset: 0;
		background: rgba(31, 26, 20, 0.35);
		/* Just under the top bar (1100): the sheet lives inside the bar's stacking
		   context, so anything above 1100 here would cover the sheet too. */
		z-index: 1099;
		opacity: 0;
		transition: opacity 0.25s ease;
	}
	.kk-top-bar__backdrop.is-visible { display: block; opacity: 1; }
}

.kk-top-bar__tooltip-handle { display: none; }

/* ----- Mobile ----- */
@media (max-width: 767px) {
	.kk-top-bar { font-size: 12.5px; }

	.kk-top-bar__inner { min-height: 36px; padding: 3px var(--kk-gutter); gap: 8px; }
	.kk-top-bar__social { display: none; }
	.kk-top-bar__centre { margin: 0 4px; }
	.kk-top-bar__ticker-item { padding: 0 20px; }
	.kk-top-bar__hours-text strong { display: none; }
	.kk-top-bar__phone-label { display: none; }
	.kk-top-bar__phone { min-width: 30px; justify-content: center; padding: 0; }
	.kk-tb-icon { width: 14px; height: 14px; }

	/* Bottom sheet */
	.kk-top-bar__week-tooltip {
		position: fixed;
		top: auto;
		bottom: 0;
		left: 0;
		right: 0;
		border-radius: var(--kk-radius-lg) var(--kk-radius-lg) 0 0;
		border: none;
		max-height: 85vh;
		overflow-y: auto;
		transform: translateY(100%);
		box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
	}

	.kk-top-bar__hours--has-tooltip:hover .kk-top-bar__week-tooltip,
	.kk-top-bar__hours--has-tooltip.is-open .kk-top-bar__week-tooltip { transform: translateY(0) !important; }

	.kk-top-bar__week-tooltip::after { display: none; }

	.kk-top-bar__tooltip-handle { display: flex; justify-content: center; padding: 10px 0 4px; }
	.kk-top-bar__tooltip-handle span { width: 40px; height: 4px; border-radius: 2px; background: var(--kk-line-strong); }

	.kk-top-bar__week-tooltip--card { flex-direction: column; }
	.kk-top-bar__week-tooltip--card .kk-top-bar__week-banner {
		width: 100% !important;
		height: 36vw;
		min-height: 140px;
		border-radius: var(--kk-radius-lg) var(--kk-radius-lg) 0 0;
	}

	.kk-top-bar__week-tooltip--center { left: 0; transform: translateY(100%); }
	.kk-top-bar__hours--has-tooltip:hover .kk-top-bar__week-tooltip--center,
	.kk-top-bar__hours--has-tooltip.is-open .kk-top-bar__week-tooltip--center { transform: translateY(0) !important; }

	.kk-top-bar__week-row { padding: 10px 16px; flex-wrap: nowrap; }
	.kk-top-bar__week-time { white-space: nowrap; font-size: 13px; }

	.kk-zmanim-tip {
		position: fixed;
		left: 16px; right: 16px;
		top: auto;
		bottom: 50%;
		transform: translateY(50%) translateX(0) !important;
		z-index: 1300;
		white-space: normal;
	}
	.kk-zmanim-tip::after { display: none; }
	.kk-top-bar__week-row:hover .kk-zmanim-tip { transform: translateY(50%) translateX(0) !important; }

	.kk-top-bar__week-title { padding: 12px 16px 10px; }
	.kk-top-bar__week-day { min-width: 85px; }
	.kk-top-bar__week-content { min-width: 0; }

	.kk-top-bar__hours--has-tooltip.is-open .kk-top-bar__week-tooltip {
		visibility: visible !important;
		pointer-events: auto !important;
		opacity: 1 !important;
	}
}

/* Admin bar offset */
.admin-bar .kk-top-bar { top: 32px; }
@media (max-width: 782px) { .admin-bar .kk-top-bar { top: 46px; } }
