/*
 * chrome.css — Universal site chrome shared by every front-end route.
 *
 * Extracted from event-instance.css so chrome-only routes (upload, join,
 * archive, form pages, etc.) no longer carry the full event-page CSS. Loaded
 * on every front-end template via the `ce-chrome` handle. Event-heavy routes
 * (event_instance / event_series singles, front page, photographer landing)
 * load this first, then event-instance.css on top.
 *
 * Contents: header chrome (.ce-btn, .ce-topnav, .ce-user-menu, mobile nav
 * toggle + drawer, .ce-share-btn--copied state) and the .ce-section-label
 * utility used across nearly every page template.
 */

/* ── Shared buttons ──────────────────────────────────────────────────────── */

.ce-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	font-family: inherit;
	text-decoration: none;
	transition: background 120ms, border-color 120ms;
	line-height: 1;
}

.ce-btn--ghost {
	background: transparent;
	border: 1px solid var(--line-2);
	color: var(--fg);
}

.ce-btn--ghost:hover {
	background: var(--bg-2);
	border-color: var(--fg-3);
}

.ce-btn--primary {
	background: var(--accent);
	border: 1px solid var(--accent);
	color: oklch(15% 0 0); /* dark ink — passes 4.5:1 against --accent oklch(72%) cobalt */
	font-weight: 600;
}

.ce-btn--primary:hover {
	opacity: 0.88;
}

/* ── Top Nav ─────────────────────────────────────────────────────────────── */

.ce-topnav {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 28px;
	background: color-mix(in oklab, var(--bg) 85%, transparent);
	backdrop-filter: blur(18px);
	border-bottom: 1px solid var(--line);
}

.ce-topnav__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
}

.ce-topnav__brand-wrap {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: inherit;
	text-decoration: none;
}

.ce-topnav__brand-wrap--logo .custom-logo-link {
	display: inline-flex;
	align-items: center;
	line-height: 0;
}

.ce-topnav__brand-wrap--logo .custom-logo {
	height: 32px;
	width: auto;
	max-width: 220px;
	display: block;
}

.ce-topnav__logo-mark {
	width: 28px;
	height: 28px;
	border-radius: 7px;
	background: var(--accent);
	display: grid;
	place-items: center;
	color: oklch(15% 0 0);
	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-decoration: none;
}

.ce-topnav__site-name {
	font-family: var(--font-display);
	font-size: 17px;
	font-weight: 600;
	letter-spacing: -0.01em;
	color: var(--fg);
	text-decoration: none;
}

.ce-topnav__links {
	margin-left: 32px;
}

.ce-topnav__menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	gap: 22px;
}

.ce-topnav__menu a {
	color: var(--fg-3);
	text-decoration: none;
	font-size: 14px;
}

.ce-topnav__menu .current-menu-item > a,
.ce-topnav__menu a:hover {
	color: var(--fg-2);
}

.ce-topnav__left {
	display: flex;
	align-items: center;
}

.ce-topnav__actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

/* ── User menu (logged-in dropdown) ──────────────────────────────────────── */

.ce-user-menu {
	position: relative;
}

.ce-user-menu__toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	list-style: none;
	max-width: 180px;
}

.ce-user-menu__toggle::-webkit-details-marker {
	display: none;
}

.ce-user-menu__label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ce-user-menu__chevron {
	transition: transform 0.15s ease;
	flex: 0 0 auto;
}

.ce-user-menu[open] .ce-user-menu__chevron {
	transform: rotate(180deg);
}

.ce-user-menu__panel {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	min-width: 180px;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 10px;
	box-shadow: 0 8px 24px oklch(0% 0 0 / 0.18);
	padding: 6px;
	z-index: 100;
	display: flex;
	flex-direction: column;
}

.ce-user-menu__item {
	display: flex;
	align-items: center;
	min-height: 40px;
	padding: 0 12px;
	border-radius: 6px;
	color: var(--fg);
	text-decoration: none;
	font-size: 14px;
	white-space: nowrap;
}

.ce-user-menu__item:hover,
.ce-user-menu__item:focus-visible {
	background: var(--bg-2);
	color: var(--fg);
}

.ce-user-menu__item--app {
	color: var(--accent, var(--fg));
	font-weight: 600;
	margin-block-end: 4px;
	padding-block-end: 8px;
	border-block-end: 1px solid var(--line);
	border-radius: 6px 6px 0 0;
}

/* ── Section label (used across nearly every page template) ──────────────── */

.ce-section-label {
	font-family: var(--font-mono);
	color: var(--fg-4);
	letter-spacing: 0.08em;
	font-size: 12px;
	text-transform: uppercase;
}

.ce-section-label--small {
	font-size: 11px;
}

/* ── Share button state ──────────────────────────────────────────────────── */

.ce-share-btn.ce-share-btn--copied {
	border-color: var(--accent);
	color: var(--accent);
}

/* ── Mobile nav toggle ───────────────────────────────────────────────────── */

.ce-topnav__toggle {
	display: none; /* hidden by default; shown inside the ≤640px block below */
	background: transparent;
	border: none;
	cursor: pointer;
	color: var(--fg);
	padding: 8px;
	line-height: 0;
}

@media (max-width: 640px) {
	/* Hide the horizontal nav; show the hamburger button instead. */
	.ce-topnav__links {
		display: none;
	}

	.ce-topnav__toggle {
		display: block;
	}

	/* Open state: show nav as a full-width drawer below the topnav. */
	body.has-menu-open .ce-topnav__links {
		display: block;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		z-index: 99;
		background: var(--bg);
		border-top: 1px solid var(--line);
	}

	body.has-menu-open .ce-topnav__links .ce-topnav__menu {
		flex-direction: column;
		gap: 0;
	}

	body.has-menu-open .ce-topnav__links .ce-topnav__menu a {
		display: flex;
		align-items: center;
		min-height: 44px;
		padding: 0 20px;
		font-size: 16px;
		border-bottom: 1px solid var(--line);
	}
}

/* ── Photo search: header toggle + overlay ───────────────────────────────── */

.ce-search-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	color: var(--fg-2);
	background: transparent;
	border: 1px solid var(--line);
	border-radius: 8px;
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.ce-search-toggle:hover,
.ce-search-toggle:focus-visible {
	color: var(--fg);
	background: var(--bg-2);
	border-color: var(--fg-3);
}

.ce-search-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 14vh 20px 20px;
}

.ce-search-overlay[hidden] {
	display: none;
}

.ce-search-overlay__backdrop {
	position: absolute;
	inset: 0;
	background: color-mix(in oklab, var(--bg) 78%, transparent);
	backdrop-filter: blur(4px);
}

.ce-search-overlay__panel {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	max-width: 640px;
}

.ce-search-form {
	display: flex;
	gap: 8px;
	flex: 1 1 auto;
}

.ce-search-form__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 14px 16px;
	font-family: var(--font-body);
	font-size: 17px;
	color: var(--fg);
	background: var(--bg);
	border: 1px solid var(--line-2);
	border-radius: 10px;
}

.ce-search-form__input:focus-visible {
	outline: none;
	border-color: var(--accent);
}

.ce-search-form__input::placeholder {
	color: var(--fg-4);
}

.ce-search-form__submit {
	flex: 0 0 auto;
}

.ce-search-overlay__close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	color: var(--fg-2);
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 10px;
	cursor: pointer;
}

.ce-search-overlay__close:hover,
.ce-search-overlay__close:focus-visible {
	color: var(--fg);
	border-color: var(--fg-3);
}

@media (max-width: 480px) {
	.ce-search-form {
		flex-wrap: wrap;
	}

	.ce-search-form__submit {
		flex: 1 1 auto;
	}
}
