/**
 * cllb layout — marketing chrome and the logged-in app shell.
 */

/* ------------------------------------------------------------------ */
/* Logo (full lockup: logoface + logotype, always used as one asset)   */
/* ------------------------------------------------------------------ */
.logo { display: inline-flex; align-items: center; }
.logo img { height: 26px; width: auto; display: block; }
.logo.is-lg img { height: 32px; }

/* ------------------------------------------------------------------ */
/* Marketing header (logged out / public pages)                        */
/* ------------------------------------------------------------------ */
.site-header {
	position: sticky; top: 0; z-index: 50;
	background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line);
}
.site-header .inner {
	display: flex; align-items: center; gap: 26px; padding: 14px 24px;
	max-width: 1280px; margin: 0 auto;
}
.main-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.main-nav .nav-auth { display: none; }
.main-nav a { color: var(--text-2); padding: 6px 12px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 500; }
.main-nav a:hover, .main-nav a.active { color: var(--text); background: var(--surface-2); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 7px 11px; font-size: 1rem; cursor: pointer; color: var(--text); }

/* Landing paint-splatter accent — anchored to the viewport's left edge (on the
   body) so it reaches the screen edge instead of being clipped by the centered
   content column. Multiply drops the image's white background; content sits
   above it via z-index. */
/* Sticky footer: the marketing body is a flex column that fills at least the
   viewport height, the header/footer hug their content and .site-main grows to
   take the slack — so on short pages (auth, legal, about) the footer rests at
   the bottom of the viewport instead of floating mid-screen. */
body.is-marketing {
	display: flex; flex-direction: column;
	min-height: 100vh; min-height: 100dvh;
	position: relative;
}
body.is-marketing > .site-main { flex: 1 0 auto; }
body.is-marketing > .site-header,
body.is-marketing > .site-footer { flex: 0 0 auto; }

/* Full-width marketing wrapper. overflow-x: clip contains the hero/feature
   paint-splatter accents that bleed to the window edge without triggering a
   horizontal scrollbar. Crucially it must NOT create a stacking context (no
   z-index/opacity/transform here): the accents multiply-blend against the
   off-white page background, which only works if this wrapper doesn't isolate
   the blend group. The accents sit at z-index:-1 so content still paints above. */
.site-main { position: relative; overflow-x: clip; }

/* Paint-splatter accent on every marketing page — landing, about, auth, legal,
   etc. — so no public page is ever a plain white slab. */
body.is-marketing::before {
	content: ""; position: absolute; top: 96px; left: 0; z-index: -1;
	width: min(48vw, 640px); aspect-ratio: 1024 / 683;
	background: url(../bg-accent.png) no-repeat left top / contain;
	mix-blend-mode: multiply; opacity: 0.9; pointer-events: none;
}
@media (max-width: 720px) {
	body.is-marketing::before { top: 68px; width: min(82vw, 340px); opacity: 0.8; }
}

/* Same accent for the logged-in app shell: fixed to the bottom-left corner
   behind the (now semi-transparent) member sidebar. z-index:-1 keeps it under
   the content while the frosted sidebar lets it show through. */
body.is-app::before {
	content: ""; position: fixed; left: 0; bottom: 0; z-index: -1;
	width: min(42vw, 520px); aspect-ratio: 1024 / 683;
	background: url(../bg-accent.png) no-repeat left bottom / contain;
	mix-blend-mode: multiply; opacity: 0.85; pointer-events: none;
}

/* Marketing footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 70px; padding: 30px 24px; color: var(--muted); font-size: 0.86rem; background: var(--surface); }
.site-footer .inner { max-width: 1280px; margin: 0 auto; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.site-footer a { color: var(--text-2); }

/* ------------------------------------------------------------------ */
/* App shell (logged in): sidebar | topbar + content                   */
/* ------------------------------------------------------------------ */
.app { display: flex; min-height: 100vh; }

.app-sidebar {
	flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
	background: rgba(255, 255, 255, 0.66); border-right: 1px solid var(--line);
	-webkit-backdrop-filter: blur(10px) saturate(1.05); backdrop-filter: blur(10px) saturate(1.05);
	position: sticky; top: 0; height: 100vh; overflow-y: auto;
	display: flex; flex-direction: column; padding: 18px 12px; z-index: 60;
}
.app-sidebar .logo { padding: 2px 10px 18px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
	display: flex; align-items: center; gap: 11px; padding: 9px 12px;
	border-radius: var(--radius-sm); color: var(--text-2); font-size: 0.9rem; font-weight: 500;
}
.side-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-nav a.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.side-nav a .ico { width: 18px; text-align: center; font-size: 0.95rem; opacity: 0.85; }
.side-nav a .count-badge { margin-left: auto; }
.side-group { color: var(--muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; padding: 18px 12px 6px; }

.side-foot { margin-top: auto; padding-top: 16px; }
.side-pro {
	border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
	font-size: 0.8rem; color: var(--muted); margin-bottom: 10px; background: var(--brand-softer);
}
.side-pro strong { color: var(--text); display: flex; justify-content: space-between; font-size: 0.85rem; }
.side-pro .state { color: var(--success); font-weight: 600; }
.side-pro a { font-weight: 600; }
.side-links { padding: 4px 12px; font-size: 0.78rem; color: var(--muted); }
.side-links a { color: var(--muted); }

/* Scrim behind the off-canvas sidebar on small screens */
.app-scrim { display: none; position: fixed; inset: 0; background: rgba(22, 23, 29, 0.4); z-index: 55; border: 0; }

.app-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
	position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
	background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line);
	display: flex; align-items: center; gap: 14px; padding: 0 24px;
}
.app-topbar .search { flex: 1; max-width: 480px; position: relative; }
.app-topbar .search input {
	background: var(--surface-2); border-color: transparent; padding-left: 38px;
	border-radius: var(--radius-sm);
}
.app-topbar .search input:focus { background: var(--surface); border-color: var(--brand-ink); }
.app-topbar .search .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 0.9rem; pointer-events: none; }
.app-topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.app-topbar .sidebar-toggle { display: none; }
.app-topbar .topbar-logo { display: none; }

.app-content { flex: 1; padding: 0 24px 56px; width: 100%; max-width: calc(var(--content-max) + 48px); margin: 0 auto; }
/* .app-content already pads the viewport — neutralize legacy .wrap padding */
.app-content .wrap, .app-content .wrap-narrow { padding-left: 0; padding-right: 0; }

/* Content + right rail split used by detail pages */
.rail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.rail-layout .rail .card:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ */
/* Mobile bottom navigation (logged-in app)                            */
/* ------------------------------------------------------------------ */
.bottom-nav {
	display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
	background: var(--surface); border-top: 1px solid var(--line); height: var(--bottombar-h);
	padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
	grid-template-columns: repeat(5, 1fr); align-items: center;
}
.bottom-nav a {
	display: flex; flex-direction: column; align-items: center; gap: 2px;
	color: var(--muted); font-size: 0.62rem; font-weight: 600;
}
.bottom-nav a:hover { text-decoration: none; }
.bottom-nav a.active { color: var(--brand-ink); }
.bottom-nav a .ico { font-size: 1.15rem; }
.bottom-nav .fab {
	width: 48px; height: 48px; margin: -18px auto 0; border-radius: var(--radius-pill);
	background: var(--brand); color: var(--on-brand); display: flex; align-items: center;
	justify-content: center; font-size: 1.4rem; box-shadow: var(--shadow-md);
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */
@media (max-width: 1080px) {
	.rail-layout { grid-template-columns: 1fr; }
	.hero { grid-template-columns: 1fr; gap: 36px; }
}

@media (max-width: 960px) {
	/* Sidebar becomes off-canvas */
	.app-sidebar {
		position: fixed; left: 0; top: 0; bottom: 0; height: 100dvh;
		transform: translateX(-100%); transition: transform 0.2s ease;
		box-shadow: var(--shadow-lg); background: rgba(255, 255, 255, 0.94);
	}
	.app.sidebar-open .app-sidebar { transform: translateX(0); }
	.app.sidebar-open .app-scrim { display: block; }
	.app-topbar .sidebar-toggle { display: inline-flex; }
	.app-topbar .topbar-logo { display: inline-flex; }
	.app-topbar { padding: 0 16px; }
	.app-content { padding: 0 16px 90px; }

	/* Marketing nav collapses behind the toggle */
	.nav-toggle { display: block; margin-left: auto; }
	.site-header .main-nav { display: none; }
	.site-header.nav-open .main-nav {
		display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0;
		background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 16px 16px;
		box-shadow: var(--shadow-md);
	}
	.site-header.nav-open .main-nav .nav-auth { display: block; }
	.site-header .header-actions { display: none; }
}

@media (max-width: 720px) {
	body.has-bottom-nav .bottom-nav { display: grid; }
	.app-topbar .search { max-width: none; }
	.app-topbar .actions .btn-new-collab { display: none; } /* replaced by the FAB */
	.chat-box { height: 380px; }
	.collab-card { flex-wrap: wrap; }
	.collab-card .aside { flex: 1 1 100%; border-left: 0; border-top: 1px solid var(--line); padding: 12px 0 0; }
	.media-thumb { flex-basis: 96px; height: 96px; }
	.page-head { padding-top: 18px; }
	.hero { padding: 40px 0 30px; }
	.trust-bar { padding: 20px; }
}
