/* ████████████████████████████████████████████████████████████████████████████
   Lemmid Tools — shared design system
   Matches lemmid.com (picker surface) + manager.lemmid.com (work surface)
   ████████████████████████████████████████████████████████████████████████████ */

:root {
	/* Brand colours (source: lemmid.com + manager.lemmid.com stylesheets) */
	--lemmid-blue: #0054a5;
	--lemmid-blue-deep: #003d7a;
	--manager-bg: #efefef;
	--surface: #fff;
	--text: #000;
	--text-muted: #646464;
	--text-faint: #969696;
	--border: #e0e0e0;
	--border-strong: #c8c8c8;
	--danger: #b00;
	--danger-accent: #c80000;
	--success: #0b0;
	--link: #298ced;
	--warn: #f05a28;

	/* Translucent overlays on dark blue */
	--on-blue-fill: rgba(255,255,255,.1);
	--on-blue-fill-hover: rgba(255,255,255,.18);
	--on-blue-border: rgba(255,255,255,.2);
	--on-blue-border-strong: rgba(255,255,255,.45);
	--on-blue-text-soft: rgba(255,255,255,.85);
	--on-blue-text-faint: rgba(255,255,255,.55);

	/* Shadows */
	--shadow-header: 0 0 5px 5px rgba(150,150,150,.2);
	--shadow-card: 0 1px 2px rgba(0,0,0,.05);
	--shadow-card-hover: 0 8px 24px rgba(0,0,0,.08);

	/* Radii — pill buttons match Lemmid */
	--radius-pill: 15px;
	--radius-tile: 14px;
	--radius: 10px;

	/* Fonts — system-ui everywhere, matches Lemmid platform convention (native OS feel). */
	--font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-display: system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 140%;
	-webkit-font-smoothing: antialiased;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	/* Kill the iOS/Android double-tap-to-zoom gesture (conflicts with the tool UIs).
	   Pinch-zoom still works for accessibility. Drag-heavy elements (the crop box and
	   its handles) override this with `touch-action: none`. */
	touch-action: manipulation;
	/* Disable text selection by default — none of the tools need it, and dragging
	   sliders/handles otherwise selects surrounding text. Form inputs override below. */
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

/* Re-enable selection inside form controls and anywhere marked editable. */
input,
textarea,
select,
[contenteditable],
[contenteditable="true"] {
	-webkit-user-select: text;
	user-select: text;
}

/* ──── Surface variants ──── */
body.surface-picker {
	background-color: var(--lemmid-blue);
	color: #fff;
}
body.surface-work {
	background-color: var(--manager-bg);
	color: var(--text);
}

a { color: inherit; text-decoration: none; }

/* ████ Top bar ████████████████████████████████████████████████████████████ */
.topbar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 14px 24px;
	padding-top: calc(14px + env(safe-area-inset-top));
	padding-left: calc(24px + env(safe-area-inset-left));
	padding-right: calc(24px + env(safe-area-inset-right));
}
.surface-work .topbar {
	background-color: rgba(255,255,255,.95);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	box-shadow: var(--shadow-header);
	position: sticky;
	top: 0;
	z-index: 100;
	border-bottom: 1px solid var(--border);
}

.topbar__crumbs {
	flex: 1 1 auto;
	font-size: 13px;
	color: var(--on-blue-text-soft);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.surface-work .topbar__crumbs { color: var(--text-muted); }
.topbar__crumbs a:hover { text-decoration: underline; }
.topbar__crumbs .sep { margin: 0 8px; opacity: .55; }

/* ████ Hero (picker pages) █████████████████████████████████████████████████ */
.hero {
	flex: 0 0 auto;
	text-align: center;
	padding: 40px 24px 28px;
	padding-top: calc(40px + env(safe-area-inset-top));
}
.hero h1 {
	font-weight: 400;
	font-size: 44px;
	line-height: 1.1;
	letter-spacing: -0.4px;
}
@media (max-width: 520px) {
	.hero h1 { font-size: 30px; }
}
.hero p.tagline {
	margin-top: 10px;
	font-size: 18px;
	color: var(--on-blue-text-soft);
}

/* ████ Page section (work pages) ████████████████████████████████████████████ */
.page {
	flex: 1 1 auto;
	width: 100%;
	max-width: 960px;
	margin: 0 auto;
	padding: 32px 24px;
}
.page h1 {
	font-weight: 500;
	font-size: 28px;
	margin-bottom: 6px;
	letter-spacing: -0.3px;
}
.page p.lead { color: var(--text-muted); margin-bottom: 24px; }

/* ████ Tile grid ████████████████████████████████████████████████████████████ */
.tile-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
	max-width: 960px;
	margin: 0 auto;
	width: 100%;
	padding: 8px 24px 40px;
}
@media (min-width: 720px) {
	.tile-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
}

.tile {
	display: flex;
	flex-direction: column;
	padding: 24px 22px;
	background-color: var(--on-blue-fill);
	border: 1px solid var(--on-blue-border);
	border-radius: var(--radius-tile);
	color: #fff;
	transition: background-color .2s linear, border-color .2s linear, transform .15s ease;
	cursor: pointer;
	position: relative;
	overflow: hidden;
	min-height: 180px;
}
.tile:hover {
	background-color: var(--on-blue-fill-hover);
	border-color: var(--on-blue-border-strong);
}
.tile:active { transform: scale(.99); }

.tile[aria-disabled="true"] {
	cursor: not-allowed;
	opacity: .6;
}
.tile[aria-disabled="true"]:hover {
	background-color: var(--on-blue-fill);
	border-color: var(--on-blue-border);
}

.tile__icon {
	width: 48px;
	height: 48px;
	border-radius: 12px;
	background-color: rgba(255,255,255,.15);
	border: 1px solid rgba(255,255,255,.2);
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 14px;
	flex: 0 0 auto;
}
.tile__icon svg { width: 26px; height: 26px; stroke: #fff; }

.tile h2 {
	font-weight: 400;
	font-size: 22px;
	line-height: 1.2;
	margin-bottom: 6px;
	letter-spacing: -0.2px;
}
.tile p {
	font-size: 14px;
	color: var(--on-blue-text-soft);
	line-height: 1.45;
	flex: 1 1 auto;
	margin-bottom: 14px;
}

/* Compact variant for sub-tool tiles */
.tile.compact { min-height: 0; padding: 20px; }
.tile.compact h2 { font-size: 18px; }
.tile.compact .tile__icon { width: 40px; height: 40px; margin-bottom: 12px; }
.tile.compact .tile__icon svg { width: 22px; height: 22px; }

.tile .badge {
	display: inline-block;
	align-self: flex-start;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.5px;
	padding: 3px 10px;
	border-radius: var(--radius-pill);
	background-color: rgba(255,255,255,.15);
	border: 1px solid rgba(255,255,255,.2);
	color: #fff;
	text-transform: uppercase;
}
.tile .badge.soon {
	background-color: rgba(255,255,255,.05);
	color: var(--on-blue-text-soft);
}

/* ████ Buttons (Lemmid pill) ████████████████████████████████████████████████ */
.btn {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 30px;
	padding: 0 15px;
	border-radius: var(--radius-pill);
	font-family: var(--font-body);
	font-weight: 700;
	font-size: 14px;
	color: #fff;
	border: 1px solid transparent;
	cursor: pointer;
	transition: all .2s linear;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
	text-decoration: none;
}
.btn.normal { background-color: #000; border-color: #000; }
.btn.normal:hover { background-color: #232323; }
.btn.red { background-color: var(--danger); border-color: var(--danger); }
.btn.red:hover { background-color: #8a0000; }
.btn.ghost-light { background-color: var(--on-blue-fill); border-color: var(--on-blue-border); }
.btn.ghost-light:hover { border-color: #fff; }

/* ████ Empty / under-construction block ████████████████████████████████████ */
.under-construction {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 32px 24px;
	text-align: center;
	color: var(--text-muted);
	box-shadow: var(--shadow-card);
	max-width: 520px;
	margin: 8px auto 0;
}
.under-construction h2 {
	font-weight: 500;
	font-size: 20px;
	color: var(--text);
	margin-bottom: 8px;
	letter-spacing: -0.2px;
}
.under-construction p { font-size: 14px; line-height: 1.5; }
.under-construction p + p { margin-top: 8px; }

/* ████ Footer ████████████████████████████████████████████████████████████ */
.footer {
	flex: 0 0 auto;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: baseline;
	gap: 10px;
	padding: 20px 24px calc(20px + env(safe-area-inset-bottom));
	font-size: 12px;
	line-height: 1.4;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}
.surface-picker .footer { color: var(--on-blue-text-faint); }
.surface-work .footer { color: var(--text-faint); }
.footer a { color: inherit; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer__sep { opacity: .4; }

/* ──── Minimal text language switcher (lives in footer) ──── */
.langtoggle {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
}
.langtoggle [data-lang-set] {
	opacity: 0.55;
	transition: opacity .15s linear;
}
.langtoggle [data-lang-set]:hover { opacity: 0.85; }
.langtoggle [data-lang-set].active { opacity: 1; cursor: default; }
.langtoggle__sep { opacity: 0.35; }

/* ──── Visibility helpers ──── */
[hidden] { display: none !important; }
