/*
Theme Name: lmin Theme
Theme URI: https://github.com/hidonny/lmin
Description: Custom theme for lmin (Link Minifier) SaaS URL shortening platform
Version: 2.1.0
Author: Your Name
License: GPL v2 or later
Text Domain: lmin
*/

/*
 * Theme chrome — header, primary nav, mobile toggle + mobile nav panel.
 * Markup owned by header.php; controller is assets/js/theme-mobile-nav.js.
 * Design tokens come from assets/css/lmin-variables.css (enqueued globally).
 */

/* ── Base typography ──
   The theme never set a body font, so ALL chrome outside .home-b (header,
   primary nav, mobile panel, colophon) rendered in the browser default serif
   — measured live 2026-09-11: body/header/nav computed "Times New Roman".
   Page-level CSS (dashboard, my-links, manage-link, home-b) still wins where
   it declares its own font-family. */
body {
	font-family: var(--lmin-font-sans, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	margin:0;
	padding:0;
	/* Warm cream base + pinstripe — global (all pages match homepage). */
	background-color: #F5F2EC;
	background-image: repeating-linear-gradient(
		90deg,
		transparent,
		transparent 39px,
		rgba(0, 0, 0, 0.04) 39px,
		rgba(0, 0, 0, 0.04) 40px
	);
}

/* ── Dark mode: global body background ──
   Replaces the per-page body:has(.lmin-*) scattered rules with one global
   rule. The per-page rules in lmin-dashboard-v2.css, lmin-links.css, and
   lmin-manage-link.css are now redundant but harmless (same color). */
[data-theme="dark"] body {
	background-color: #0F172A;
	background-image: repeating-linear-gradient(
		90deg,
		transparent,
		transparent 39px,
		rgba(255, 255, 255, 0.03) 39px,
		rgba(255, 255, 255, 0.03) 40px
	);
}

/* ── Accessibility: visually-hidden text ──
   No theme stylesheet defined this class before 2026-09-11 (Sherlock audit),
   so header.php's skip link and the homepage's .screen-reader-text labels
   rendered as 1×1px positioned blocks instead of being properly hidden. */
.screen-reader-text {
 border: 0;
 clip: rect(1px, 1px, 1px, 1px);
 clip-path: inset(50%);
 height: 1px;
 width: 1px;
 margin: -1px;
 overflow: hidden;
 padding: 0;
 position: absolute;
 word-wrap: normal !important;
}

.screen-reader-text:focus {
 background-color: #f1f1f1;
 border-radius: 3px;
 box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
 clip: auto;
 clip-path: none;
 color: #21759b;
 display: block;
 font-size: var(--step--1);
 font-weight: 700;
 height: auto;
 left: 5px;
 line-height: normal;
 padding: 15px 23px 14px;
 text-decoration: none;
 top: 5px;
 width: auto;
 z-index: 100000;
}

/* ── Header ── */
.lmin-site-header {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px); /* clears the WP admin bar when logged in */
	z-index: 1000;
	background: rgba(255, 255, 255, 0.85);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--lmin-slate-200, #e5e7eb);
}

/* ── Homepage header: transparent over hero → glass on scroll ──
   body.home only: the header is fixed and merges with the hero (the cream
   pinstripe / dark pinstripe shows through behind it). Scrolling past a
   threshold (theme-mobile-nav.js toggles .lmin-header-scrolled) restores the
   standard glass treatment. All other pages keep the sticky header untouched.
   `top` keeps the admin-bar var from the base .lmin-site-header rule above. */
body.home .lmin-site-header {
	position: fixed;
	left: 0;
	right: 0;
	background: transparent;
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	border-bottom-color: transparent;
	transition: background-color 0.25s ease, border-color 0.25s ease;
}

body.home .lmin-site-header .lmin-header-inner {
	/* Border lives here (body.home-scoped) instead of the global
	   .lmin-header-inner rule — non-home pages must not get it (audit L-1). */
	border-bottom: var(--nb-border, 2px solid #0F172A);
	border-bottom-color: transparent;
	transition: border-color 0.25s ease;
}

/* Scrolled state — same glass as the default header. Also applied while the
   mobile nav panel is open so the bar stays readable over the hero. */
body.home .lmin-site-header.lmin-header-scrolled,
body.home .lmin-mobile-nav-open .lmin-site-header {
	background: rgba(255, 255, 255, 0.85);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border-bottom-color: var(--lmin-slate-200, #e5e7eb);
}

body.home .lmin-site-header.lmin-header-scrolled .lmin-header-inner,
body.home .lmin-mobile-nav-open .lmin-site-header .lmin-header-inner {
	border-bottom-color: var(--nb-border-color, #0F172A);
}

/* Fixed header is out of flow — push the hero content below the ~82-96px
   header bar so the eyebrow/title clear it (homepage only). */
body.home .home-b .hb-hero {
	padding-top: calc(var(--space-xl-2xl, 3rem) + 96px);
}

/* Full-width header (unshortened.com treatment): no max-width container,
   the header spans the viewport with edge padding instead.
   CSS Grid 3-column layout: logo left, nav truly centered, actions right.
   Unlike flex space-between, the nav is centered regardless of the
   left/right content widths — no fixed-width containers needed. */
.lmin-header-inner {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: var(--space-s, 16px);
	max-width: none;
	padding: 20px 48px;
}

/* Logo: left column, left-aligned */
.lmin-site-logo,
.lmin-site-title {
	justify-self: start;
}

/* Nav: center column, centered */
.lmin-primary-nav {
	justify-self: center;
}

/* Theme toggle + mobile toggle: right column, right-aligned */
.lmin-theme-toggle,
.lmin-mobile-toggle {
	justify-self: end;
}

/* Right action group (user dropdown + theme toggle) — occupies the grid's
   3rd column as ONE item so auto-placement stays stable; flex on mobile. */
.lmin-header-actions {
	display: flex;
	align-items: center;
	gap: var(--space-2xs, 10px);
	justify-self: end;
}

/* Non-home pages (dashboard, my-links, manage-link, …) get the 2px
   neobrutalist border on the navbar — mirrors the home scrolled state.
   body:not(.home) keeps it future-proof: any new page gets it too.
   Dark mode is handled by the --nb-border token itself (lmin-variables.css
   redefines it to #E2E8F0 under [data-theme="dark"]). */
body:not(.home) .lmin-site-header .lmin-header-inner {
	border-bottom: var(--nb-border, 2px solid #0F172A);
}

@media (max-width: 600px) {
	.lmin-header-inner {
		padding: 10px 16px;
	}
}

/* Brand wordmark — gradient text matching the hero H1 treatment.
   Only applies to the text-title branch of header.php; a custom logo
   (.lmin-site-logo) renders the image instead and is untouched. */
.lmin-site-title a {
	display: inline-flex;
	align-items: center;
	font-size: var(--step-1);
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.2;
	background: var(--lmin-gradient-text, linear-gradient(92deg, #2563EB, #06B6D4));
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent; /* Safari needs the fill, not just color */
	color: var(--lmin-blue-600, #2563EB); /* fallback if clip unsupported */
	text-decoration: none;
}

/* ── Primary nav (desktop) ── */
.lmin-primary-menu {
	display: flex;
	align-items: center;
	gap: var(--space-2xs, 10px);
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Neobrutalist nav links (neobrutalism.dev treatment): sharp corners, no
   pills. Inactive links carry a 2px transparent border to avoid layout
   shift; hover/active swap to a solid border + flat accent background. */
.lmin-primary-menu a {
	display: inline-flex;
	align-items: center;
	/* min-height: 40px; */
	padding: var(--nb-btn-padding-y) var(--nb-btn-padding-x);
	border: 2px solid transparent;
	border-radius: 5px;
	color: var(--lmin-slate-600, #475569);
	font-size: var(--step--1);
	font-weight: 600;
	text-decoration: none;
	transition: var(--lmin-transition, all 0.2s cubic-bezier(0.4, 0, 0.2, 1));
}

.lmin-primary-menu a:hover {
	color: var(--lmin-slate-900, #0F172A);
	border-color: var(--lmin-slate-900, #0F172A);
	background: var(--lmin-slate-100, #F1F5F9);
}

.lmin-primary-menu .current-menu-item > a {
	color: var(--nb-accent-fg, #FFFFFF);
	border-color: var(--lmin-slate-900, #0F172A);
	background: var(--nb-accent, #2563EB);
}

/* Keyboard focus — the default outline is barely visible against the
   semi-transparent header, so reuse the neobrutalism focus tokens. */
.lmin-primary-menu a:focus-visible {
	outline: var(--nb-focus-outline, 2px solid #2563EB);
	outline-offset: var(--nb-focus-offset, 2px);
}

/* ── Mobile toggle (hidden on desktop) ── */
.lmin-mobile-toggle {
	display: none;
	background: none;
	border: 0;
	padding: 8px;
	cursor: pointer;
}

.lmin-hamburger,
.lmin-hamburger::before,
.lmin-hamburger::after {
	display: block;
	width: 20px;
	height: 2px;
	background: var(--color-text, #111827);
	border-radius: 2px;
}

.lmin-hamburger {
	position: relative;
}

.lmin-hamburger::before,
.lmin-hamburger::after {
	content: "";
	position: absolute;
	left: 0;
}

.lmin-hamburger::before {
	top: -6px;
}

.lmin-hamburger::after {
	top: 6px;
}

/* ── Mobile nav panel (hidden on desktop) ── */
.lmin-mobile-nav {
	display: none;
}

/* ── Mobile only (≤900px, matches sidebar hide breakpoint) ── */
@media (max-width: 900px) {
	/* Hide the desktop nav — the mobile toggle + panel take over here.
	   Without this, both navs render and the desktop nav overflows ≤480px. */
	.lmin-primary-nav {
		display: none;
	}

	/* Mobile header layout: hamburger LEFT, logo CENTER, theme toggle RIGHT.
	   The logo is absolutely centered instead of using flex order because the
	   two flanking buttons have unequal widths — space-between + order cannot
	   truly center it. With the logo out of the flow, the remaining two flex
	   children sit at the edges in DOM order (burger first → left, theme
	   toggle → right). Desktop (>900px) uses CSS Grid for true nav centering;
	   mobile reverts to flex so the absolute-positioned logo + two flanking
	   buttons layout works as designed. */
	.lmin-header-inner {
		display: flex;
		justify-content: space-between;
		position: relative;
	}

	.lmin-site-title,
	.lmin-site-logo {
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
	}

	.lmin-mobile-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}

	.lmin-mobile-nav {
		display: block;
		position: fixed;
		top: 0;
		left: 0;
		height: 100vh;
		height: 100dvh;
		width: min(300px, 85vw);
		max-height: none;
		overflow-y: auto;
		transform: translateX(-100%);
		transition: transform 0.25s ease;
		background: var(--color-surface, #fff);
		border-right: var(--nb-border, 2px solid #0F172A);
		z-index: 1000;
		padding-top: var(--space-s, 1rem);
	}

	.lmin-mobile-nav.is-open {
		transform: translateX(0);
	}

	/* Backdrop: semi-transparent overlay when drawer is open */
	body.lmin-mobile-nav-open::after {
		content: "";
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.5);
		z-index: 999;
	}

	body.lmin-mobile-nav-open {
		overflow: hidden;
	}

	.lmin-mobile-menu {
		list-style: none;
		margin: 0;
		padding: var(--space-xs, 8px);
		display: flex;
		flex-direction: column;
		gap: 2px;
	}

	.lmin-mobile-menu a {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 10px 12px;
		border-radius: var(--radius-md, 8px);
		color: var(--color-text, #111827);
		font-size: var(--step--1);
		font-weight: 500;
		text-decoration: none;
		min-height: 44px;
	}

	.lmin-mobile-menu a:hover {
		background: var(--color-accent-subtle, #eef2ff);
	}

	.lmin-mobile-menu a svg,
	.lmin-mobile-menu a i {
		width: 18px;
		height: 18px;
		color: var(--color-text-muted, #6b7280);
		flex-shrink: 0;
	}

	.lmin-mobile-menu .current-menu-item > a {
		background: var(--color-accent-subtle, #eef2ff);
		color: var(--color-accent-text, #4338ca);
		font-weight: 600;
	}

	.lmin-mobile-menu .current-menu-item > a svg,
	.lmin-mobile-menu .current-menu-item > a i {
		color: var(--color-accent, #4f46e5);
	}
}

/* Respect reduced-motion preference for the slide animation and nav
   link transitions */
@media (prefers-reduced-motion: reduce) {
	.lmin-mobile-nav {
		transition: none;
	}
	.lmin-primary-menu a {
		transition: none;
	}
	body.home .lmin-site-header,
	body.home .lmin-site-header .lmin-header-inner {
		transition: none;
	}
}

/* ── Login notices (page templates, logged-out state) ── */
.lmin-dashboard-notice,
.lmin-my-links-notice,
.lmin-manage-link-notice {
	max-width: 720px;
	margin: var(--space-l, 32px) auto;
	padding: var(--space-s, 16px);
	background: var(--color-surface, #fff);
	border: 1px solid var(--color-border, #e5e7eb);
	border-radius: var(--radius-md, 8px);
}

/* ── Dark theme: chrome overrides ──
    Scoped to [data-theme="dark"] — no global token overrides.
    App-page body content stays light, except dashboard (dark
    per dashboard-neobrutalism-plan); only header/nav/mobile
    panel go dark (transitional state until app-chrome pass).
    G2: body bg scoped to body.home only — app pages keep cream.
    S1: color-scheme adapts native controls/scrollbars.
    Explicit light baseline on :root so UA defaults never
    shadow it (Check #39 reads 'light' in light mode). */
:root {
	color-scheme: light;
}

/* L1 (Sentinel audit 2026-09-11): color-scheme: dark on <html> is
   GLOBAL — app-page native scrollbars and form controls will also
   render dark in dark mode. Same transitional state as the dark
   header on light app pages. */
[data-theme="dark"] {
	color-scheme: dark;
}

[data-theme="dark"] body.home {
	background-color: #0F172A;
}

[data-theme="dark"] body.home {
	background-image: repeating-linear-gradient(
		90deg,
		transparent,
		transparent 39px,
		rgba(255, 255, 255, 0.04) 39px,
		rgba(255, 255, 255, 0.04) 40px
	);
}

[data-theme="dark"] .lmin-site-header {
	background: rgba(15, 23, 42, 0.85);
	border-bottom-color: var(--lmin-slate-700, #334155);
}

/* Homepage transparent state (dark) — over the dark pinstripe hero. Must
   out-specify the dark glass rule above, which would otherwise paint the
   fixed header at the top of the page. */
[data-theme="dark"] body.home .lmin-site-header {
	background: transparent;
	border-bottom-color: transparent;
}

[data-theme="dark"] body.home .lmin-site-header .lmin-header-inner {
	border-bottom-color: transparent;
}

/* Dark scrolled state — restores the dark glass. Class-driven, so toggling
   the theme mid-scroll is handled by the cascade alone (no JS involvement). */
[data-theme="dark"] body.home .lmin-site-header.lmin-header-scrolled,
[data-theme="dark"] body.home .lmin-mobile-nav-open .lmin-site-header {
	background: rgba(15, 23, 42, 0.85);
	border-bottom-color: var(--lmin-slate-700, #334155);
}

[data-theme="dark"] body.home .lmin-site-header.lmin-header-scrolled .lmin-header-inner,
[data-theme="dark"] body.home .lmin-mobile-nav-open .lmin-site-header .lmin-header-inner {
	border-bottom-color: var(--nb-border-color, #E2E8F0);
}

[data-theme="dark"] .lmin-primary-menu a {
	color: var(--lmin-slate-300, #CBD5E1);
}

[data-theme="dark"] .lmin-primary-menu a:hover {
	color: var(--lmin-slate-100, #F1F5F9);
	border-color: var(--lmin-slate-200, #E2E8F0);
	background: var(--lmin-slate-800, #1E293B);
}

[data-theme="dark"] .lmin-primary-menu .current-menu-item > a {
	border-color: var(--lmin-slate-200, #E2E8F0);
	/* S5: background var(--nb-accent) #2563EB + color var(--nb-accent-fg) #FFFFFF
	   are intentionally UNCHANGED in dark mode — 5.17:1 in both modes. */
}

[data-theme="dark"] .lmin-hamburger,
[data-theme="dark"] .lmin-hamburger::before,
[data-theme="dark"] .lmin-hamburger::after {
	background: var(--lmin-slate-300, #CBD5E1);
}

[data-theme="dark"] .lmin-mobile-nav {
	background: #0F172A;
	border-right-color: var(--nb-border-color, #E2E8F0);
}

[data-theme="dark"] .lmin-mobile-menu a {
	color: var(--lmin-slate-300, #CBD5E1);
}

[data-theme="dark"] .lmin-mobile-menu a:hover {
	background: var(--lmin-slate-800, #1E293B);
}

[data-theme="dark"] .lmin-mobile-menu .current-menu-item > a {
	background: var(--lmin-slate-800, #1E293B);
	color: var(--lmin-blue-400, #60A5FA);
}

[data-theme="dark"] .lmin-mobile-menu .current-menu-item > a svg,
[data-theme="dark"] .lmin-mobile-menu .current-menu-item > a i {
	color: var(--lmin-blue-400, #60A5FA);
}

[data-theme="dark"] .screen-reader-text:focus {
	background-color: #1E293B;
	box-shadow: 0 0 2px 2px rgba(255, 255, 255, 0.3);
	color: #60A5FA;
}

/* ── Theme toggle button ── */
.lmin-theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: 2px solid transparent;
	border-radius: 5px;
	padding: 8px;
	cursor: pointer;
	color: var(--lmin-slate-600, #475569);
	transition: var(--lmin-transition, all 0.2s cubic-bezier(0.4, 0, 0.2, 1));
	min-height: 44px;
	min-width: 44px;
}

.lmin-theme-toggle:hover {
	color: var(--lmin-slate-900, #0F172A);
	border-color: var(--lmin-slate-900, #0F172A);
	background: var(--lmin-slate-100, #F1F5F9);
}

[data-theme="dark"] .lmin-theme-toggle {
	color: var(--lmin-slate-300, #CBD5E1);
}

[data-theme="dark"] .lmin-theme-toggle:hover {
	color: var(--lmin-slate-100, #F1F5F9);
	border-color: var(--lmin-slate-200, #E2E8F0);
	background: var(--lmin-slate-800, #1E293B);
}

.lmin-theme-toggle:focus-visible {
	outline: var(--nb-focus-outline, 2px solid #2563EB);
	outline-offset: var(--nb-focus-offset, 2px);
}

[data-theme="dark"] .lmin-theme-toggle:focus-visible {
	outline: var(--nb-focus-outline-on-dark, 2px solid #FFFFFF);
	outline-offset: var(--nb-focus-offset, 2px);
}
/* S4: white focus outline on dark header — 17.85:1 on #0F172A */

/* Icon visibility — moon in light, sun in dark */
.lmin-theme-icon-sun { display: none; }
.lmin-theme-icon-moon { display: block; }
[data-theme="dark"] .lmin-theme-icon-sun { display: block; }
[data-theme="dark"] .lmin-theme-icon-moon { display: none; }

@media (prefers-reduced-motion: reduce) {
	.lmin-theme-toggle { transition: none; }
}

/* ── Header user dropdown (header.php .lmin-user-menu) ──
   Disclosure pattern: trigger button + panel, .is-open on the wrapper.
   Neobrutalism tokens from lmin-variables.css (flip automatically in dark
   mode); explicit [data-theme="dark"] rules below for surface/text colors. */
.lmin-user-menu {
	position: relative;
}

.lmin-user-toggle {
	display: inline-flex;
	align-items: center;
	gap: var(--space-3xs, 4px);
	padding: 4px 10px 4px 4px;
	background: var(--color-surface, #fff);
	border: var(--nb-border, 2px solid #0F172A);
	box-shadow: var(--nb-shadow-sm, 2px 2px 0 #0F172A);
	border-radius: var(--nb-radius-sm, 4px);
	font-family: var(--lmin-font-sans);
	font-size: var(--step--1, 0.9rem);
	font-weight: 700;
	color: var(--contrast, #1d2327);
	cursor: pointer;
	transition: var(--nb-transition, transform 0.1s ease, box-shadow 0.1s ease);
}

.lmin-user-toggle:hover {
	transform: translate(1px, 1px);
	box-shadow: var(--nb-shadow-press, 0 0 0 #0F172A);
}

.lmin-user-toggle:focus-visible {
	outline: var(--nb-focus-outline, 2px solid #2563EB);
	outline-offset: var(--nb-focus-offset, 2px);
}

.lmin-user-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	flex: 0 0 32px;
	border-radius: var(--nb-radius-sm, 4px);
	object-fit: cover;
	background: var(--nb-accent, #2563EB);
	color: #fff;
	font-weight: 800;
	font-size: var(--step--1, 0.9rem);
}

.lmin-user-caret {
	width: 16px;
	height: 16px;
	transition: transform 0.15s ease;
}

.is-open .lmin-user-caret {
	transform: rotate(180deg);
}

/* Panel: hidden via visibility+opacity so the fade/slide transition runs
   both ways (display:none would kill the closing animation). */
.lmin-user-dropdown {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 1100; /* above content + the 1000 mobile-nav drawer */
	min-width: 240px;
	background: var(--color-surface, #fff);
	border: var(--nb-border, 2px solid #0F172A);
	box-shadow: var(--nb-shadow, 4px 4px 0 #0F172A);
	border-radius: var(--nb-radius-sm, 4px);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.is-open .lmin-user-dropdown {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.lmin-user-dropdown-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2xs, 8px);
	padding: var(--space-2xs, 8px) var(--space-xs, 12px);
	border-bottom: var(--nb-border, 2px solid #0F172A);
}

.lmin-user-dropdown-name {
	font-weight: 800;
	font-size: var(--step--1, 0.9rem);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lmin-user-dropdown-tier {
	flex: 0 0 auto;
	padding: 2px 8px;
	background: var(--color-accent-subtle, #EFF6FF);
	border: 1px solid var(--color-accent, #3B82F6);
	border-radius: var(--nb-radius-sm, 4px);
	font-size: var(--step--2, 0.75rem);
	font-weight: 700;
	color: var(--color-accent-text, #2563EB);
}

.lmin-user-dropdown-item {
	display: flex;
	align-items: center;
	gap: var(--space-2xs, 8px);
	min-height: 44px; /* WCAG 2.5.8 touch target */
	padding: var(--space-2xs, 8px) var(--space-xs, 12px);
	color: var(--contrast, #1d2327);
	font-size: var(--step--1, 0.9rem);
	font-weight: 600;
	text-decoration: none;
}

.lmin-user-dropdown-item svg {
	width: 18px;
	height: 18px;
	flex: 0 0 18px;
}

.lmin-user-dropdown-item:hover {
	background: var(--color-accent-subtle, #EFF6FF);
}

.lmin-user-dropdown-item:focus-visible {
	outline: var(--nb-focus-outline, 2px solid #2563EB);
	outline-offset: calc(-1 * var(--nb-focus-offset, 2px));
}

.lmin-user-dropdown-external {
	margin-left: auto;
	width: 14px;
	height: 14px;
	flex: 0 0 14px;
	color: var(--contrast-2, #575760);
}

.lmin-user-dropdown-divider {
	border-top: 1px solid var(--color-border, #D8DDE9);
}

.lmin-user-dropdown-item.is-logout {
	color: var(--color-danger, #DC2626);
}

.lmin-user-dropdown-item.is-logout:hover {
	background: var(--lmin-error-bg, #FEE2E2);
}

/* Logged-out: Login button (minimalist) */
.lmin-login-btn {
	display: inline-flex;
	align-items: center;
	gap: var(--space-3xs, 4px);
	min-height: 44px;
	padding: var(--space-3xs, 4px) var(--space-2, 8px);
	background: transparent;
	border: none;
	border-radius: var(--nb-radius-sm, 4px);
	color: var(--lmin-slate-700, #334155);
	font-size: var(--step--1, 0.9rem);
	font-weight: 500;
	text-decoration: none;
	transition: color 0.15s ease, background 0.15s ease;
}

.lmin-login-btn:hover {
	color: var(--lmin-accent, #3B82F6);
	background: var(--lmin-accent-bg, #EFF6FF);
}

.lmin-login-btn:focus-visible {
	outline: var(--nb-focus-outline, 2px solid #2563EB);
	outline-offset: var(--nb-focus-offset, 2px);
}

/* Mobile: hide the name label; panel becomes full-width by re-anchoring to
   .lmin-header-inner (position:relative at ≤900px) so left/right 16px spans
   the header gutter-to-gutter — anchoring to the button overflows the left
   viewport edge (the theme toggle sits to its right). */
@media (max-width: 600px) {
	.lmin-user-name {
		display: none;
	}

	.lmin-user-menu {
		position: static;
	}

	.lmin-user-dropdown {
		top: 100%;
		left: 16px;
		right: 16px;
		width: auto;
		max-width: none;
	}
}

/* ── Dark theme: user dropdown ── */
[data-theme="dark"] .lmin-user-toggle,
[data-theme="dark"] .lmin-user-dropdown {
	background: var(--lmin-slate-800, #1E293B);
	color: var(--lmin-slate-100, #F1F5F9);
}

[data-theme="dark"] .lmin-user-dropdown-item {
	color: var(--lmin-slate-200, #E2E8F0);
}

[data-theme="dark"] .lmin-user-dropdown-item:hover {
	background: var(--lmin-slate-700, #334155);
}

[data-theme="dark"] .lmin-user-dropdown-item:focus-visible,
[data-theme="dark"] .lmin-user-toggle:focus-visible,
[data-theme="dark"] .lmin-login-btn:focus-visible {
	outline: var(--nb-focus-outline-on-dark, 2px solid #FFFFFF);
}

[data-theme="dark"] .lmin-login-btn {
	color: var(--lmin-slate-200, #E2E8F0);
}

[data-theme="dark"] .lmin-login-btn:hover {
	color: var(--lmin-accent-light, #60A5FA);
	background: rgba(59, 130, 246, 0.12);
}

[data-theme="dark"] .lmin-user-dropdown-tier {
	background: rgba(59, 130, 246, 0.15);
	border-color: var(--lmin-accent-light, #60A5FA);
	color: var(--lmin-accent-light, #60A5FA);
}

[data-theme="dark"] .lmin-user-dropdown-divider {
	border-top-color: var(--lmin-slate-600, #475569);
}

[data-theme="dark"] .lmin-user-dropdown-item.is-logout {
	color: #F87171;
}

[data-theme="dark"] .lmin-user-dropdown-item.is-logout:hover {
	background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .lmin-user-dropdown-external {
	color: var(--lmin-slate-400, #94A3B8);
}

@media (prefers-reduced-motion: reduce) {
	.lmin-user-dropdown,
	.lmin-user-caret,
	.lmin-user-toggle,
	.lmin-login-btn {
		transition: none;
	}
}

/* ── Mobile header refinements + drawer account/theme (≤900px, header.php) ──
   The drawer is display:none >900px, so the drawer rules here are
   mobile-only by construction. (The original brief asked for 768px; 900px
   matches the drawer breakpoint — at 769–900px the drawer exists.) */
@media (max-width: 900px) {
	/* Header user trigger goes avatar-only: name + caret hidden, dropdown
	   (anchored right:0 to the header trigger) still opens on tap as a
	   quick-access point. Scoped to the header instance so the drawer
	   account card (.lmin-mobile-user) keeps its full name + caret. */
	.lmin-header-actions .lmin-user-toggle .lmin-user-name,
	.lmin-header-actions .lmin-user-toggle .lmin-user-caret {
		display: none;
	}

	/* Header theme toggle hidden — the drawer hosts it (.lmin-mobile-theme
	   below). Desktop (>900px) keeps the header toggle. */
	.lmin-header-actions .lmin-theme-toggle {
		display: none;
	}

	/* Login button: icon only (text wrapped in .lmin-login-btn-text in
	   header.php so this hide is text-only). */
	.lmin-login-btn-text {
		display: none;
	}

	/* Drawer theme toggle: bottom section, styled like the menu rows. */
	.lmin-mobile-theme {
		margin: var(--space-xs, 8px) var(--space-xs, 8px) 0;
		padding-top: var(--space-xs, 8px);
		border-top: var(--nb-border, 2px solid #0F172A);
	}

	.lmin-mobile-theme .lmin-theme-toggle {
		width: 100%;
	}

	.lmin-mobile-user {
		margin: 0 0 var(--space-xs, 8px);
		padding: 0 var(--space-xs, 8px) var(--space-xs, 8px);
		border-bottom: var(--nb-border, 2px solid #0F172A);
	}

	.lmin-mobile-user .lmin-user-toggle {
		width: 100%;
		justify-content: flex-start;
		margin-bottom: var(--space-2xs, 8px);
	}

	/* Push the caret to the card's right edge */
	.lmin-mobile-user .lmin-user-caret {
		margin-left: auto;
	}

	/* Accordion instead of a floating panel: static position + display toggle.
	   ponytail: this kills the open/close animation (display:none can't
	   transition) — acceptable for a nested disclosure inside the drawer;
	   upgrade path: max-height/height transition if the fade is missed. */
	.lmin-mobile-user .lmin-user-dropdown {
		position: static;
		display: none;
		min-width: 0;
		box-shadow: none;
	}

	.lmin-mobile-user.is-open .lmin-user-dropdown {
		display: block;
	}

	/* Unlike the header trigger (name hidden ≤600px for space), the drawer
	   card is full-width so the name stays visible. */
	.lmin-mobile-user .lmin-user-name {
		display: inline;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
}
