/*
Theme Name: Commons
Theme URI: https://example.com/commons
Author: Your Site
Description: A feed-and-rail community theme built for Community Loan Manager. Sticky top bar, a three-column "social hub" layout for profiles, messages and notifications, and a card-based feed that reads like a shared ledger as much as a social wall.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: community-commons
*/

/* =========================================================
   Design tokens
   ========================================================= */
:root {
	/* surfaces */
	--cc-canvas: #eef1f6;
	--cc-surface: #ffffff;
	--cc-surface-2: #f7f8fb;

	/* text */
	--cc-ink: #16202e;
	--cc-muted: #5b6b82;
	--cc-faint: #93a1b5;

	/* brand — matches the plugin's existing button blue so the two layers read as one product */
	--cc-brand: #1877f2;
	--cc-brand-ink: #0f5cc4;
	--cc-brand-wash: #eaf1fe;

	/* ledger accents */
	--cc-money: #157a55;
	--cc-money-wash: #e7f5ee;
	--cc-amber: #b6791c;
	--cc-amber-wash: #fbf1e2;

	/* structure */
	--cc-line: #dde3ee;
	--cc-line-strong: #c7d0e0;
	--cc-radius: 16px;
	--cc-radius-sm: 10px;
	--cc-shadow: 0 1px 2px rgba(22, 32, 46, 0.04), 0 8px 24px -16px rgba(22, 32, 46, 0.18);

	/* type */
	--cc-font-display: "Fraunces", "Iowan Old Style", "Georgia", serif;
	--cc-font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--cc-font-ledger: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

	/* layout */
	--cc-topbar-h: 60px;
	--cc-rail-left: 248px;
	--cc-rail-right: 300px;
	--cc-content-max: 700px;
}

/* =========================================================
   Reset & base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--cc-topbar-h) + 12px); }
body {
	margin: 0;
	background: var(--cc-canvas);
	color: var(--cc-ink);
	font-family: var(--cc-font-body);
	font-size: 15px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--cc-brand); }
a:hover { color: var(--cc-brand-ink); }
h1, h2, h3, h4 { font-family: var(--cc-font-display); color: var(--cc-ink); line-height: 1.2; font-weight: 600; }
.screen-reader-text {
	position: absolute !important; clip: rect(1px,1px,1px,1px); width: 1px; height: 1px; overflow: hidden;
}
:focus-visible { outline: 2px solid var(--cc-brand); outline-offset: 2px; border-radius: 4px; }

/* the ledger rule — the theme's one recurring signature: a stitched, receipt-like
   dashed line used only at seams that matter (top bar base, widget-title underline,
   the foot of a stat block). It's meant to nod at the plugin's real subject —
   a shared financial record — without turning every divider into decoration. */
.cc-ledger-rule {
	border: 0;
	height: 1px;
	background-image: repeating-linear-gradient(to right, var(--cc-line-strong) 0 6px, transparent 6px 12px);
}

/* =========================================================
   Top bar
   ========================================================= */
.cc-topbar {
	position: sticky;
	top: 0;
	z-index: 60;
	height: var(--cc-topbar-h);
	background: var(--cc-surface);
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 18px;
}
.cc-topbar-inner {
	width: 100%;
	max-width: 1400px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	gap: 16px;
}
.cc-brand-mark {
	font-family: var(--cc-font-display);
	font-weight: 600;
	font-style: italic;
	font-size: 22px;
	color: var(--cc-ink);
	text-decoration: none;
	white-space: nowrap;
	flex-shrink: 0;
}
.cc-brand-mark:hover { color: var(--cc-brand); }
.cc-topbar-search { flex: 1; max-width: 420px; }
.cc-topbar-search form { display: flex; }
.cc-topbar-search input[type="search"] {
	width: 100%;
	border: 1px solid transparent;
	background: var(--cc-canvas);
	border-radius: 999px;
	padding: 9px 16px;
	font-size: 14px;
	color: var(--cc-ink);
}
.cc-topbar-search input[type="search"]:focus { background: var(--cc-surface); border-color: var(--cc-line-strong); }
.cc-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.cc-icon-btn {
	position: relative;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: var(--cc-canvas);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--cc-ink);
	text-decoration: none;
	flex-shrink: 0;
}
.cc-icon-btn:hover { background: var(--cc-brand-wash); color: var(--cc-brand-ink); }
.cc-icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.cc-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 999px;
	background: #e0245e;
	color: #fff;
	font-family: var(--cc-font-ledger);
	font-size: 10px;
	font-weight: 600;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid var(--cc-surface);
}
.cc-account {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px 10px 5px 5px;
	border-radius: 999px;
	background: var(--cc-canvas);
	text-decoration: none;
	color: var(--cc-ink);
	font-size: 13px;
	font-weight: 600;
}
.cc-account:hover { background: var(--cc-brand-wash); color: var(--cc-brand-ink); }
.cc-account img, .cc-avatar-fallback {
	width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; background: var(--cc-brand-wash);
}
.cc-avatar-fallback { display: flex; align-items: center; justify-content: center; color: var(--cc-brand-ink); font-family: var(--cc-font-ledger); font-size: 12px; font-weight: 700; }
.cc-menu-toggle {
	display: none;
	width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--cc-canvas);
	align-items: center; justify-content: center; cursor: pointer;
}
.cc-menu-toggle svg { width: 20px; height: 20px; stroke: var(--cc-ink); fill: none; stroke-width: 1.8; }

/* =========================================================
   Shell: three-column community layout
   ========================================================= */
.cc-shell {
	max-width: 1400px;
	margin: 0 auto;
	padding: 22px 18px 60px;
	display: grid;
	grid-template-columns: var(--cc-rail-left) minmax(0, 1fr) var(--cc-rail-right);
	gap: 22px;
	align-items: start;
}
.cc-shell.cc-shell--plain { grid-template-columns: minmax(0, 1fr); max-width: var(--cc-content-max); }

.cc-rail-left, .cc-rail-right { position: sticky; top: calc(var(--cc-topbar-h) + 18px); }

/* left rail */
.cc-me-card {
	background: var(--cc-surface);
	border-radius: var(--cc-radius);
	box-shadow: var(--cc-shadow);
	padding: 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 14px;
	text-decoration: none;
	color: var(--cc-ink);
}
.cc-me-card:hover { color: var(--cc-ink); }
.cc-me-card img, .cc-me-card .cc-avatar-fallback { width: 42px; height: 42px; font-size: 15px; }
.cc-me-card strong { display: block; font-size: 14px; }
.cc-me-card span { display: block; font-size: 12px; color: var(--cc-muted); }

.cc-nav {
	background: var(--cc-surface);
	border-radius: var(--cc-radius);
	box-shadow: var(--cc-shadow);
	padding: 8px;
	list-style: none;
	margin: 0 0 14px;
}
.cc-nav li { margin: 0; }
.cc-nav a {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: var(--cc-radius-sm);
	color: var(--cc-ink);
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
}
.cc-nav a:hover { background: var(--cc-canvas); }
.cc-nav a.is-current { background: var(--cc-brand-wash); color: var(--cc-brand-ink); }
.cc-nav svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; flex-shrink: 0; }
.cc-nav .cc-badge { position: static; margin-left: auto; border: 0; }

.cc-widget-area { background: var(--cc-surface); border-radius: var(--cc-radius); box-shadow: var(--cc-shadow); padding: 16px; margin-bottom: 14px; }
.cc-widget-area .widget + .widget { margin-top: 18px; padding-top: 18px; border-top: none; position: relative; }
.cc-widget-area .widget + .widget::before { content: ""; display: block; position: absolute; top: 0; left: 0; right: 0; height: 1px; background-image: repeating-linear-gradient(to right, var(--cc-line-strong) 0 6px, transparent 6px 12px); }
.cc-widget-area .widgettitle, .cc-widget-area .widget-title { font-family: var(--cc-font-display); font-size: 15px; font-weight: 600; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px dashed var(--cc-line-strong); }
.cc-widget-area ul { list-style: none; margin: 0; padding: 0; }
.cc-widget-area li { padding: 6px 0; font-size: 13px; color: var(--cc-muted); }
.cc-widget-area p:last-child { margin-bottom: 0; }

/* center column */
.cc-main { min-width: 0; }
.cc-page-eyebrow {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin: 2px 0 16px;
}
.cc-page-eyebrow h1 {
	font-size: 22px;
	margin: 0;
}
.cc-page-eyebrow .cc-eyebrow-tag {
	font-family: var(--cc-font-ledger);
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--cc-faint);
}

/* the plugin renders its own .clm-wrap cards; inside the community shell we
   want that content to sit flush in the center column rather than re-center
   itself with its own max-width/margins. */
.cc-main .clm-wrap { max-width: none; margin: 0; padding: 0; }
.cc-main .clm-card, .cc-main .clm-cover, .cc-main .clm-profile-hero { box-shadow: var(--cc-shadow); }
.cc-main .clm-loan-row strong,
.cc-main .clm-history-row strong,
.cc-main .clm-stats strong { font-family: var(--cc-font-ledger); font-variant-numeric: tabular-nums; }

/* =========================================================
   Plain (non-community) pages: article-style single column
   ========================================================= */
.cc-article { background: var(--cc-surface); border-radius: var(--cc-radius); box-shadow: var(--cc-shadow); padding: 40px; }
.cc-article .cc-hero-title { font-size: 34px; margin: 0 0 6px; }
.cc-article .cc-hero-meta { color: var(--cc-muted); font-size: 13px; margin: 0 0 24px; }
.cc-article > .cc-ledger-rule { margin: 24px 0; }
.cc-article :is(h2, h3) { margin-top: 1.6em; }

/* blog feed (index.php) reuses the card feed language */
.cc-feed-card { background: var(--cc-surface); border-radius: var(--cc-radius); box-shadow: var(--cc-shadow); padding: 26px; margin-bottom: 16px; }
.cc-feed-card .cc-feed-title { font-size: 20px; margin: 0 0 6px; }
.cc-feed-card .cc-feed-title a { color: var(--cc-ink); text-decoration: none; }
.cc-feed-card .cc-feed-title a:hover { color: var(--cc-brand); }
.cc-feed-card .cc-feed-meta { color: var(--cc-muted); font-size: 12px; margin: 0 0 12px; font-family: var(--cc-font-ledger); }
.cc-feed-card .cc-feed-excerpt { margin: 0; }
.cc-pagination { display: flex; gap: 8px; justify-content: center; margin: 24px 0 0; }
.cc-pagination a, .cc-pagination span { padding: 8px 14px; border-radius: var(--cc-radius-sm); background: var(--cc-surface); box-shadow: var(--cc-shadow); text-decoration: none; color: var(--cc-ink); font-size: 13px; }
.cc-pagination .current { background: var(--cc-brand); color: #fff; }

/* =========================================================
   Footer
   ========================================================= */
.cc-footer { margin-top: 40px; background: var(--cc-ink); color: #cbd5e6; }
.cc-footer-inner { max-width: 1400px; margin: 0 auto; padding: 40px 18px 26px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.cc-footer .widgettitle, .cc-footer .widget-title { font-family: var(--cc-font-display); color: #fff; font-size: 15px; margin: 0 0 12px; }
.cc-footer a { color: #cbd5e6; }
.cc-footer a:hover { color: #fff; }
.cc-footer ul { list-style: none; margin: 0; padding: 0; }
.cc-footer li { padding: 4px 0; font-size: 13px; }
.cc-footer-note { font-size: 12px; color: #8fa0b8; line-height: 1.6; }
.cc-footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); padding: 16px 18px; text-align: center; font-size: 12px; color: #8fa0b8; }

/* =========================================================
   Mobile
   ========================================================= */
@media (max-width: 1080px) {
	.cc-shell { grid-template-columns: minmax(0, 1fr) var(--cc-rail-right); }
	.cc-rail-left { position: fixed; top: 0; left: 0; bottom: 0; width: 268px; padding: calc(var(--cc-topbar-h) + 14px) 14px 20px; background: var(--cc-canvas); overflow-y: auto; transform: translateX(-100%); transition: transform .2s ease; z-index: 70; }
	.cc-rail-left.is-open { transform: translateX(0); box-shadow: 8px 0 24px rgba(0,0,0,.12); }
	.cc-menu-toggle { display: flex; }
	.cc-topbar-search { display: none; }
}
@media (max-width: 800px) {
	.cc-shell { grid-template-columns: minmax(0, 1fr); }
	.cc-rail-right { position: static; }
	.cc-footer-inner { grid-template-columns: 1fr; }
	.cc-article { padding: 24px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
	.cc-rail-left { transition: none; }
}
