/* =========================================================
   BrandBook — Public / Frontend Styles
   Clean, minimal, high-end brand guidelines presentation.
   ========================================================= */

/* ---- CSS Custom Properties (overridden per-brand via inline style) */
.brandbook-wrap {
	--bb-accent:    #1A3BFF;
	--bb-text:      #111827;
	--bb-bg:        #FFFFFF;
	--bb-muted:     #6B7280;
	--bb-border:    #E5E7EB;
	--bb-surface:   #F9FAFB;
	--bb-radius:    8px;
	--bb-font:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--bb-sidebar-w: 220px;
	--bb-content-max: 900px;

	font-family: var(--bb-font);
	color:       var(--bb-text);
	background:  var(--bb-bg);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

/* Unstyled mode — strip all default styles */
.brandbook-wrap.bb-unstyled * {
	all: revert;
}

/* =========================================================
   Sidebar Layout
   ========================================================= */
.brandbook-wrap.bb-style-sidebar {
	display:   flex;
	min-height: 100vh;
	position:  relative;
}

/* ---- Sidebar */
.bb-sidebar {
	width:       var(--bb-sidebar-w);
	min-width:   var(--bb-sidebar-w);
	background:  var(--bb-surface);
	border-right: 1px solid var(--bb-border);
	display:     flex;
	flex-direction: column;
	position:    sticky;
	top:         0;
	height:      100vh;
	overflow-y:  auto;
	scrollbar-width: thin;
	z-index:     10;
}

.bb-sidebar::-webkit-scrollbar       { width: 4px; }
.bb-sidebar::-webkit-scrollbar-thumb { background: var(--bb-border); border-radius: 2px; }

/* ---- Brand header in sidebar */
.bb-brand-header--sidebar {
	padding:       24px 20px 20px;
	border-bottom: 1px solid var(--bb-border);
}

.bb-brand-header--sidebar .bb-brand-logo img {
	max-width:  140px;
	max-height: 56px;
	object-fit: contain;
	display:    block;
}

.bb-brand-header--sidebar .bb-brand-name {
	font-size:   16px;
	font-weight: 700;
	color:       var(--bb-text);
}

.bb-brand-header--sidebar .bb-brand-tagline {
	font-size:  11px;
	color:      var(--bb-muted);
	margin-top: 3px;
}

/* ---- Sidebar nav */
.bb-nav {
	padding: 12px 0;
	flex:    1;
}

.bb-nav-link {
	display:      flex;
	align-items:  center;
	gap:          8px;
	padding:      9px 20px;
	font-size:    13px;
	color:        var(--bb-muted);
	text-decoration: none;
	transition:   background .15s, color .15s;
	border-left:  2px solid transparent;
	white-space:  nowrap;
}

.bb-nav-link:hover,
.bb-nav-link.is-active {
	color:        var(--bb-text);
	background:   rgba(0,0,0,.04);
	border-left-color: var(--bb-accent);
	text-decoration: none;
}

.bb-nav-link .dashicons {
	font-size: 14px;
	width:     14px;
	height:    14px;
	color:     inherit;
}

.bb-sidebar-footer {
	padding:    16px 20px;
	font-size:  11px;
	color:      var(--bb-muted);
	border-top: 1px solid var(--bb-border);
}

/* ---- Main content */
.bb-main {
	flex:       1;
	min-width:  0;
	padding:    48px 48px 80px;
	max-width:  calc(var(--bb-content-max) + 96px);
}

/* =========================================================
   Full Page Layout
   ========================================================= */
.brandbook-wrap.bb-style-fullpage .bb-fullpage-inner {
	max-width:  var(--bb-content-max);
	margin:     0 auto;
	padding:    60px 24px 100px;
}

.brandbook-wrap.bb-style-fullpage .bb-brand-header {
	text-align: center;
	margin-bottom: 48px;
}

.brandbook-wrap.bb-style-fullpage .bb-brand-header .bb-brand-logo img {
	max-height: 72px;
	max-width:  240px;
	object-fit: contain;
	display:    inline-block;
}

/* =========================================================
   Modal Layout
   ========================================================= */
.brandbook-wrap.bb-style-modal .bb-modal-backdrop {
	display:    none;
	position:   fixed;
	inset:      0;
	background: rgba(0,0,0,.5);
	z-index:    9998;
	backdrop-filter: blur(4px);
}

.brandbook-wrap.bb-style-modal .bb-modal {
	display:    none;
	position:   fixed;
	inset:      0;
	z-index:    9999;
	overflow-y: auto;
	background: var(--bb-bg);
}

.brandbook-wrap.bb-style-modal.bb-modal-open .bb-modal-backdrop,
.brandbook-wrap.bb-style-modal.bb-modal-open .bb-modal {
	display: block;
}

.bb-modal-close {
	position:   sticky;
	top:        16px;
	float:      right;
	margin:     16px 16px 0 0;
	background: none;
	border:     none;
	font-size:  20px;
	cursor:     pointer;
	color:      var(--bb-muted);
	width:      36px;
	height:     36px;
	border-radius: 50%;
	display:    flex;
	align-items: center;
	justify-content: center;
	transition: background .15s;
	z-index:    1;
}

.bb-modal-close:hover {
	background: var(--bb-surface);
}

.bb-modal-inner {
	max-width:  var(--bb-content-max);
	margin:     0 auto;
	padding:    48px 32px 80px;
}

/* ---- Button that opens modal */
.bb-modal-trigger {
	display:       inline-flex;
	align-items:   center;
	gap:           6px;
	padding:       10px 20px;
	background:    var(--bb-accent);
	color:         #fff;
	border:        none;
	border-radius: var(--bb-radius);
	font-size:     14px;
	font-weight:   500;
	cursor:        pointer;
	transition:    opacity .15s;
}

.bb-modal-trigger:hover { opacity: .85; }

/* =========================================================
   Back button
   ========================================================= */
.bb-back-button {
	display:     inline-flex;
	align-items: center;
	font-size:   13px;
	color:       var(--bb-muted);
	text-decoration: none;
	margin-bottom: 32px;
	transition:  color .15s;
}

.bb-back-button:hover {
	color:           var(--bb-text);
	text-decoration: none;
}

/* =========================================================
   Sections
   ========================================================= */
.bb-section {
	margin-bottom: 72px;
	scroll-margin-top: 24px;
}

.bb-section-header {
	border-bottom: 1px solid var(--bb-border);
	margin-bottom: 32px;
	padding-bottom: 12px;
}

.bb-section-header h2 {
	font-size:    20px;
	font-weight:  700;
	color:        var(--bb-text);
	margin:       0;
	letter-spacing: -.02em;
}

/* =========================================================
   Logos
   ========================================================= */
.bb-logos-grid {
	display:   grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap:       24px;
}

.bb-logo-item {
	border:        1px solid var(--bb-border);
	border-radius: var(--bb-radius);
	overflow:      hidden;
}

.bb-logo-canvas {
	padding:        40px 32px;
	display:        flex;
	align-items:    center;
	justify-content: center;
	min-height:     160px;
}

.bb-logo-canvas img {
	max-width:  100%;
	max-height: 120px;
	object-fit: contain;
}

.bb-bg-light { background: #FFFFFF; }
.bb-bg-dark  { background: #111827; }
.bb-bg-color { background: var(--bb-accent); }

.bb-logo-info {
	padding:    20px;
	border-top: 1px solid var(--bb-border);
	background: var(--bb-surface);
}

.bb-logo-name {
	font-size:   14px;
	font-weight: 600;
	margin:      0 0 8px;
}

.bb-logo-desc {
	font-size:  13px;
	color:      var(--bb-muted);
	margin:     0 0 10px;
}

.bb-logo-specs {
	display:   grid;
	grid-template-columns: auto 1fr;
	gap:       2px 12px;
	font-size: 12px;
	margin:    0 0 12px;
}

.bb-logo-specs dt {
	color:       var(--bb-muted);
	font-weight: 500;
}

.bb-logo-specs dd {
	margin: 0;
	color:  var(--bb-text);
}

/* =========================================================
   Colors
   ========================================================= */
.bb-colors-grid {
	display:   grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap:       16px;
}

.bb-color-item {
	border:        1px solid var(--bb-border);
	border-radius: var(--bb-radius);
	overflow:      hidden;
	transition:    box-shadow .15s;
}

.bb-color-item:hover {
	box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.bb-color-swatch-large {
	height:    120px;
	width:     100%;
}

.bb-color-details {
	padding: 14px 16px;
}

.bb-color-name {
	font-size:    13px;
	font-weight:  600;
	margin-bottom: 10px;
}

.bb-color-codes {
	margin: 0 0 8px;
}

.bb-color-code {
	display:        flex;
	justify-content: space-between;
	align-items:    center;
	padding:        4px 0;
	border-bottom:  1px solid var(--bb-border);
	cursor:         pointer;
	gap:            8px;
}

.bb-color-code:last-child {
	border-bottom: none;
}

.bb-color-code dt {
	font-size:   10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
	color:       var(--bb-muted);
	min-width:   44px;
}

.bb-color-code dd {
	font-size: 12px;
	font-family: monospace;
	margin:    0;
	color:     var(--bb-text);
}

.bb-color-code:hover dt,
.bb-color-code:hover dd {
	color: var(--bb-accent);
}

.bb-copy-tick {
	font-size:  10px;
	color:      var(--bb-accent);
	opacity:    0;
	transition: opacity .2s;
}

.bb-color-code.bb-just-copied .bb-copy-tick {
	opacity: 1;
}

.bb-color-usage {
	font-size:  12px;
	color:      var(--bb-muted);
	margin-top: 8px;
}

/* =========================================================
   Typography
   ========================================================= */
.bb-typography-list {
	display:       flex;
	flex-direction: column;
	gap:           48px;
}

.bb-font-item {
	border:        1px solid var(--bb-border);
	border-radius: var(--bb-radius);
	overflow:      hidden;
}

.bb-font-specimen {
	padding:    40px 40px 32px;
	background: var(--bb-surface);
	border-bottom: 1px solid var(--bb-border);
}

.bb-font-display {
	font-size:   48px;
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -.03em;
	margin-bottom: 12px;
	color:       var(--bb-text);
}

.bb-font-sample {
	font-size:   18px;
	color:       var(--bb-muted);
	margin-bottom: 16px;
	line-height: 1.5;
}

.bb-font-alphabet {
	font-size:  13px;
	color:      var(--bb-muted);
	line-height: 2;
	word-spacing: .3em;
}

.bb-font-meta {
	padding: 20px 24px;
}

.bb-font-role {
	font-size:    13px;
	font-weight:  600;
	text-transform: uppercase;
	letter-spacing: .08em;
	color:        var(--bb-accent);
	margin-bottom: 12px;
}

.bb-font-details {
	display:   grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap:       8px 24px;
	margin:    0;
}

.bb-font-detail {
	display:  flex;
	gap:      8px;
	font-size: 13px;
}

.bb-font-detail dt {
	font-weight: 500;
	color:       var(--bb-muted);
	min-width:   64px;
	flex-shrink: 0;
}

.bb-font-detail dd {
	margin: 0;
	color:  var(--bb-text);
}

/* =========================================================
   Graphics & Elements
   ========================================================= */
.bb-graphics-grid {
	display:   grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap:       20px;
}

.bb-graphic-item {
	border:        1px solid var(--bb-border);
	border-radius: var(--bb-radius);
	overflow:      hidden;
	transition:    box-shadow .15s;
}

.bb-graphic-item:hover {
	box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.bb-graphic-canvas {
	background:  var(--bb-surface);
	padding:     24px;
	display:     flex;
	align-items: center;
	justify-content: center;
	min-height:  160px;
}

.bb-graphic-canvas img {
	max-width:  100%;
	max-height: 140px;
	object-fit: contain;
}

.bb-graphic-info {
	padding:    14px 16px;
	border-top: 1px solid var(--bb-border);
}

.bb-graphic-name {
	font-size:    13px;
	font-weight:  600;
	margin-bottom: 2px;
}

.bb-graphic-cat {
	font-size:   11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .07em;
	color:       var(--bb-accent);
	margin-bottom: 6px;
}

.bb-graphic-desc {
	font-size:  12px;
	color:      var(--bb-muted);
	margin-bottom: 8px;
}

/* =========================================================
   Usage Guidelines (Do/Don't)
   ========================================================= */
.bb-rules-group {
	margin-bottom: 36px;
}

.bb-rules-group-title {
	font-size:    12px;
	font-weight:  700;
	text-transform: uppercase;
	letter-spacing: .1em;
	padding:      6px 12px;
	border-radius: 4px;
	display:      inline-block;
	margin-bottom: 16px;
}

.bb-rules-do   .bb-rules-group-title { background: #d1fae5; color: #065f46; }
.bb-rules-dont .bb-rules-group-title { background: #fee2e2; color: #991b1b; }
.bb-rules-info .bb-rules-group-title { background: #dbeafe; color: #1e40af; }

.bb-rules-list {
	display:   grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap:       16px;
}

.bb-rule-item {
	border:        1px solid var(--bb-border);
	border-radius: var(--bb-radius);
	overflow:      hidden;
}

.bb-rules-do   .bb-rule-item { border-top: 3px solid #16a34a; }
.bb-rules-dont .bb-rule-item { border-top: 3px solid #dc2626; }
.bb-rules-info .bb-rule-item { border-top: 3px solid #3b82f6; }

.bb-rule-image img {
	width:       100%;
	height:      160px;
	object-fit:  cover;
	display:     block;
}

.bb-rule-content {
	padding: 14px 16px;
}

.bb-rule-title {
	font-size:    13px;
	font-weight:  600;
	margin-bottom: 4px;
}

.bb-rule-desc {
	font-size:  12px;
	color:      var(--bb-muted);
	line-height: 1.5;
}

/* =========================================================
   Downloads
   ========================================================= */
.bb-downloads-list {
	list-style: none;
	margin:     0;
	padding:    0;
	display:    flex;
	flex-direction: column;
	gap:        12px;
}

.bb-download-item {
	display:       flex;
	align-items:   center;
	gap:           16px;
	padding:       16px 20px;
	border:        1px solid var(--bb-border);
	border-radius: var(--bb-radius);
	transition:    background .15s;
}

.bb-download-item:hover {
	background: var(--bb-surface);
}

.bb-download-icon {
	width:        36px;
	height:       36px;
	background:   var(--bb-accent);
	border-radius: 50%;
	display:      flex;
	align-items:  center;
	justify-content: center;
	flex-shrink:  0;
}

.bb-download-icon .dashicons {
	color:     #fff;
	font-size: 16px;
	width:     16px;
	height:    16px;
}

.bb-download-info {
	flex: 1;
	min-width: 0;
}

.bb-download-name {
	font-size:   14px;
	font-weight: 600;
}

.bb-download-desc {
	font-size:  12px;
	color:      var(--bb-muted);
	margin-top: 2px;
}

.bb-download-format {
	font-size:   11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .07em;
	color:       var(--bb-muted);
	padding:     3px 8px;
	background:  var(--bb-surface);
	border:      1px solid var(--bb-border);
	border-radius: 4px;
	white-space: nowrap;
}

/* =========================================================
   Download / action button
   ========================================================= */
.bb-download-btn {
	display:       inline-flex;
	align-items:   center;
	gap:           4px;
	padding:       8px 16px;
	border:        1px solid var(--bb-accent);
	border-radius: 4px;
	color:         var(--bb-accent);
	font-size:     12px;
	font-weight:   500;
	text-decoration: none;
	transition:    background .15s, color .15s;
	white-space:   nowrap;
}

.bb-download-btn:hover {
	background:    var(--bb-accent);
	color:         #fff;
	text-decoration: none;
}

/* =========================================================
   Access / password gate
   ========================================================= */
.bb-access-denied,
.bb-password-gate {
	display:        flex;
	align-items:    center;
	justify-content: center;
	min-height:     50vh;
	padding:        40px 20px;
}

.bb-password-box {
	max-width:     400px;
	width:         100%;
	text-align:    center;
	border:        1px solid var(--bb-border);
	border-radius: var(--bb-radius);
	padding:       40px;
	background:    var(--bb-bg);
}

.bb-password-box h2 {
	font-size:    22px;
	font-weight:  700;
	margin-bottom: 8px;
}

.bb-password-box p {
	color:         var(--bb-muted);
	margin-bottom: 24px;
}

.bb-password-box input[type="password"] {
	width:         100%;
	padding:       10px 14px;
	border:        1px solid var(--bb-border);
	border-radius: 4px;
	font-size:     14px;
	margin-bottom: 12px;
	box-sizing:    border-box;
}

.bb-btn-primary {
	width:         100%;
	padding:       10px 20px;
	background:    var(--bb-accent);
	color:         #fff;
	border:        none;
	border-radius: 4px;
	font-size:     14px;
	font-weight:   500;
	cursor:        pointer;
	transition:    opacity .15s;
}

.bb-btn-primary:hover { opacity: .85; }

/* =========================================================
   Footer
   ========================================================= */
.bb-footer {
	margin-top:  80px;
	padding-top: 24px;
	border-top:  1px solid var(--bb-border);
	font-size:   12px;
	color:       var(--bb-muted);
	text-align:  center;
}

/* =========================================================
   Responsive
   ========================================================= */
@media ( max-width: 768px ) {
	.brandbook-wrap.bb-style-sidebar {
		flex-direction: column;
	}

	.bb-sidebar {
		width:    100%;
		min-width: unset;
		height:   auto;
		position: static;
		border-right:   none;
		border-bottom:  1px solid var(--bb-border);
	}

	.bb-nav {
		display: flex;
		overflow-x: auto;
		padding: 0;
		gap:     0;
	}

	.bb-nav-link {
		padding:    12px 16px;
		white-space: nowrap;
		border-left:   none;
		border-bottom: 2px solid transparent;
		font-size:  12px;
	}

	.bb-nav-link.is-active,
	.bb-nav-link:hover {
		border-left-color:   transparent;
		border-bottom-color: var(--bb-accent);
	}

	.bb-main {
		padding: 32px 20px 60px;
	}

	.bb-colors-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.bb-logos-grid,
	.bb-graphics-grid {
		grid-template-columns: 1fr;
	}

	.bb-font-display {
		font-size: 32px;
	}

	.bb-font-specimen {
		padding: 24px 20px;
	}

	.bb-modal-inner {
		padding: 24px 16px 60px;
	}
}

@media ( max-width: 480px ) {
	.bb-colors-grid {
		grid-template-columns: 1fr;
	}
}
