/*
 * Painted by Robot Core — component & layout system.
 * Built entirely on the tokens in tokens.css. This is the reusable, brand-but-
 * generic surface; the pbr-home child adds homepage-specific composition and
 * ornament. Organised: base · a11y · shell · header/nav · buttons · cards ·
 * forms · notices · footer · pagination · woocommerce · generator · debug ·
 * responsive.
 */

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

body.pbr-theme {
	margin: 0;
	background: var(--ink-950);
	color: var(--text-primary);
	font-family: var(--font-ui);
	font-size: var(--step-0);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	overflow-x: hidden;
}

img,
svg,
video { max-width: 100%; height: auto; }
img { display: block; }

a { color: var(--gold-400); }
a:hover,
a:focus-visible { color: var(--gold-200); }

h1, h2, h3, h4 {
	font-family: var(--font-display);
	font-weight: 400;
	line-height: 1.1;
	color: var(--text-primary);
	margin: 0 0 var(--space-3);
}
h1 { font-size: var(--step-3); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }

p { margin: 0 0 var(--space-3); }

:where(hr) {
	border: 0;
	height: 1px;
	background: var(--gold-hairline);
	margin: var(--space-5) 0;
}

/* ---------- Accessibility ---------- */
.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}

.pbr-skip-link {
	position: absolute;
	left: 8px; top: -60px;
	z-index: 1000;
	background: var(--gold-400);
	color: var(--ink-900);
	padding: 10px 18px;
	border-radius: var(--radius-sm);
	font-weight: 600;
	text-decoration: none;
	transition: top var(--transition-hover);
}
.pbr-skip-link:focus {
	top: 8px;
	color: var(--ink-900);
	clip: auto; width: auto; height: auto;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: 2px;
	border-radius: 2px;
}

/* ---------- Shell / layout ---------- */
.pbr-shell,
.wp-block-group.pbr-shell {
	width: 100%;
	max-width: var(--content-wide);
	margin-inline: auto;
	padding-inline: clamp(16px, 3vw, 40px);
}

.pbr-band {
	position: relative;
	padding-block: var(--space-6);
	background-color: var(--ink-800);
	background-size: cover;
	background-position: center;
}
.pbr-band--ink700 { background-color: var(--ink-700); }
.pbr-band--ink900 { background-color: var(--ink-900); }
.pbr-band--ink600 { background-color: var(--ink-600); }

.pbr-panel,
.wp-block-group.is-style-pbr-panel {
	background: var(--ink-700);
	border: 1px solid var(--gold-hairline);
	border-radius: var(--radius-lg);
	box-shadow: var(--seat);
}

/* Gold hairline media frame (block style: is-style-pbr-hairline) */
.wp-block-image.is-style-pbr-hairline img {
	border: 1px solid var(--gold-hairline);
	border-radius: var(--radius-md);
}

/* Ornamental section header with gold flourishes */
.pbr-section-header { text-align: center; margin-bottom: var(--space-5); }
.pbr-section-header__title {
	font-family: var(--font-display);
	font-size: var(--step-2);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--gold-400);
	margin: 0 0 var(--space-2);
}
.pbr-section-header__subtitle {
	font-family: var(--font-ui);
	font-size: var(--step-0);
	color: var(--text-muted);
	margin: 0;
}
.pbr-flourish {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--gold-400);
	margin: 0 auto var(--space-2);
}
.pbr-flourish__rule {
	display: block;
	width: 64px; height: 1px;
	background: linear-gradient(90deg, transparent, var(--gold-400));
}
.pbr-flourish__rule:last-child { transform: scaleX(-1); }
.pbr-flourish__star { font-size: 0.8em; }

/* ---------- Header & navigation ---------- */
.pbr-header {
	position: sticky;
	top: 0;
	z-index: 500;
	min-height: var(--header-height);
	display: flex;
	align-items: center;
	background: transparent;
	transition: background var(--transition-hover), box-shadow var(--transition-hover);
}
.pbr-header.is-stuck {
	background: var(--ink-900);
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.pbr-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	width: 100%;
}

.pbr-logo img { display: block; }

/* Primary nav (block navigation gets these via className) */
.pbr-nav .wp-block-navigation__container,
.pbr-nav ul {
	gap: 34px;
}
.pbr-nav a,
.pbr-nav .wp-block-navigation-item__content {
	font-family: var(--font-ui);
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-primary);
	text-decoration: none;
	padding-bottom: 4px;
	transition: color var(--transition-hover);
}
.pbr-nav a:hover,
.pbr-nav a:focus-visible {
	color: var(--gold-400);
	box-shadow: 0 6px 0 -5px var(--gold-400);
}

/* ---------- Buttons ---------- */
.pbr-btn,
.wp-block-button.is-style-pbr-gold .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-ui);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	line-height: 1;
	padding: 12px 22px;
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	text-decoration: none;
	cursor: pointer;
	transition: background var(--transition-hover), border-color var(--transition-hover), color var(--transition-hover), box-shadow var(--transition-hover);
}
.pbr-btn--gold,
.wp-block-button.is-style-pbr-gold .wp-block-button__link {
	background: var(--gold-400);
	color: var(--ink-900);
}
.pbr-btn--gold:hover,
.pbr-btn--gold:focus-visible {
	background: var(--gold-200);
	color: var(--ink-900);
	box-shadow: 0 0 0 1px var(--gold-400), 0 0 16px rgba(233, 194, 117, 0.4);
}
.pbr-btn--ghost,
.wp-block-button.is-style-pbr-ghost .wp-block-button__link {
	background: transparent;
	color: var(--gold-400);
	border-color: var(--gold-hairline);
}
.pbr-btn--ghost:hover,
.pbr-btn--ghost:focus-visible,
.wp-block-button.is-style-pbr-ghost .wp-block-button__link:hover {
	background: rgba(233, 194, 117, 0.12);
	color: var(--gold-200);
	border-color: var(--gold-400);
}
.pbr-btn--pink { background: var(--pink-600); color: var(--cream-100); }
.pbr-btn--pink:hover,
.pbr-btn--pink:focus-visible { background: var(--pink-500); color: var(--cream-100); }

.pbr-cta {
	font-family: var(--font-ui);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--gold-400);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.pbr-cta__arrow { transition: transform var(--transition-hover); }
.pbr-cta:hover .pbr-cta__arrow,
.pbr-cta:focus-visible .pbr-cta__arrow { transform: translateX(3px); }

/* ---------- Cards ---------- */
.pbr-card {
	display: flex;
	flex-direction: column;
	background: var(--ink-card);
	border: 1px solid var(--gold-hairline);
	border-radius: var(--radius-md);
	overflow: hidden;
	transition: border-color var(--transition-hover), background var(--transition-hover);
}
.pbr-card:hover,
.pbr-card:focus-within { border-color: var(--gold-400); }
.pbr-card__media {
	aspect-ratio: 16 / 10;
	overflow: hidden;
	border-bottom: 1px solid var(--gold-hairline);
}
.pbr-card__media img {
	width: 100%; height: 100%;
	object-fit: cover;
	transition: transform var(--transition-image);
}
.pbr-card:hover .pbr-card__media img { transform: scale(1.03); }
.pbr-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: var(--space-3) var(--space-3) var(--space-4);
	text-align: center;
	gap: var(--space-2);
}
.pbr-card__title {
	font-family: var(--font-ui);
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--text-primary);
	margin: 0;
}
.pbr-card__desc {
	font-size: 14px;
	line-height: 1.57;
	color: var(--text-muted);
	margin: 0;
}
.pbr-card__foot { margin-top: auto; padding-top: var(--space-2); }

.pbr-grid { display: grid; gap: var(--space-3); }
.pbr-grid--2 { grid-template-columns: repeat(2, 1fr); }
.pbr-grid--3 { grid-template-columns: repeat(3, 1fr); }
.pbr-grid--4 { grid-template-columns: repeat(4, 1fr); }
.pbr-grid--5 { grid-template-columns: repeat(5, 1fr); }

/* ---------- Forms ---------- */
input[type="text"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="password"],
input[type="number"],
textarea,
select {
	font-family: var(--font-ui);
	font-size: 14px;
	color: var(--ink-900);
	background: rgba(255, 255, 255, 0.92);
	border: 1px solid var(--gold-hairline);
	border-radius: var(--radius-sm);
	padding: 9px 12px;
	min-height: 34px;
	width: 100%;
}
input::placeholder,
textarea::placeholder { color: #5a5f74; }
label { display: inline-block; margin-bottom: 6px; font-size: 13px; color: var(--text-muted); }

/* ---------- Notices ---------- */
.pbr-notice {
	border: 1px solid var(--gold-hairline);
	border-left-width: 3px;
	border-left-color: var(--gold-400);
	background: var(--ink-700);
	color: var(--text-primary);
	padding: var(--space-3);
	border-radius: var(--radius-sm);
	margin-block: var(--space-3);
}
.pbr-notice--error { border-left-color: var(--pink-500); }
.pbr-notice--success { border-left-color: var(--gold-400); }

/* ---------- Footer ---------- */
.pbr-footer {
	background: var(--ink-700);
	border-top: 1px solid var(--gold-hairline);
	padding-block: var(--space-6);
}
.pbr-footer__legal {
	background: var(--ink-950);
	padding-block: var(--space-3);
	font-size: 11px;
	letter-spacing: 0.02em;
	color: var(--text-muted);
}
.pbr-footer__legal a { color: var(--gold-400); text-decoration: none; }

/* ---------- Pagination ---------- */
.wp-block-query-pagination,
.pbr-pagination {
	display: flex; gap: var(--space-2);
	justify-content: center;
	margin-top: var(--space-5);
}
.wp-block-query-pagination a,
.wp-block-query-pagination span {
	color: var(--gold-400);
	text-decoration: none;
	padding: 6px 12px;
	border: 1px solid var(--gold-hairline);
	border-radius: var(--radius-sm);
}
.wp-block-query-pagination .current { background: var(--gold-400); color: var(--ink-900); }

/* ---------- Generator container ---------- */
.pbr-generator,
.pbr-generator-app {
	border: 1px solid var(--gold-hairline);
	border-radius: var(--radius-md);
	background: var(--ink-card);
	padding: var(--space-4);
	min-height: 240px;
}

/* ---------- WooCommerce ---------- */
.pbr-woo .price { color: var(--gold-400); font-weight: 600; }
.pbr-woo .button,
.pbr-woo .wp-element-button,
.woocommerce a.button,
.woocommerce button.button {
	background: var(--gold-400);
	color: var(--ink-900);
	border-radius: var(--radius-sm);
	font-family: var(--font-ui);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-weight: 600;
}
.pbr-woo .button:hover,
.woocommerce a.button:hover { background: var(--gold-200); color: var(--ink-900); }
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
	background: var(--ink-card);
	border: 1px solid var(--gold-hairline);
	border-radius: var(--radius-md);
	padding: var(--space-3);
}
.woocommerce span.onsale {
	background: var(--pink-600);
	color: var(--cream-100);
	border-radius: 999px;
}
.woocommerce .woocommerce-message,
.woocommerce .woocommerce-info {
	border-top-color: var(--gold-400);
	background: var(--ink-700);
	color: var(--text-primary);
}

/* ---------- Debug log panel ---------- */
.pbr-debug {
	position: fixed;
	right: 12px; bottom: 12px;
	z-index: 900;
	max-width: min(420px, calc(100vw - 24px));
	font-family: var(--font-mono);
}
.pbr-debug__summary {
	cursor: pointer;
	list-style: none;
	background: var(--ink-900);
	color: var(--gold-400);
	border: 1px solid var(--gold-hairline);
	border-radius: var(--radius-sm);
	padding: 8px 14px;
	font-size: 12px;
	letter-spacing: 0.04em;
	user-select: none;
}
.pbr-debug__summary::-webkit-details-marker { display: none; }
.pbr-debug__body {
	margin-top: 8px;
	background: var(--ink-950);
	border: 1px solid var(--gold-hairline);
	border-radius: var(--radius-sm);
	padding: 12px;
}
.pbr-debug__pre {
	margin: 8px 0 0;
	max-height: 40vh;
	overflow: auto;
	color: var(--text-primary);
	font-size: 12px;
	line-height: 1.5;
	white-space: pre-wrap;
}
.pbr-debug__copy {
	background: var(--ink-700);
	color: var(--gold-400);
	border: 1px solid var(--gold-hairline);
	border-radius: var(--radius-sm);
	padding: 6px 14px;
	font-family: var(--font-ui);
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
	transition: box-shadow 220ms ease-out, background 220ms ease-out, color 220ms ease-out;
}
.pbr-debug__copy.is-copied {
	background: var(--gold-400);
	color: var(--ink-900);
	box-shadow: 0 0 0 1px var(--gold-400), 0 0 18px rgba(233, 194, 117, 0.65);
}
.pbr-debug__status { margin: 8px 0 0; font-size: 11px; color: var(--text-muted); min-height: 1em; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
	.pbr-shell { max-width: none; padding-inline: 24px; }
	.pbr-grid--5 { grid-template-columns: repeat(3, 1fr); }
	.pbr-grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
	.pbr-grid--5,
	.pbr-grid--4,
	.pbr-grid--3 { grid-template-columns: repeat(2, 1fr); }
	.pbr-nav ul { gap: 20px; }
}
@media (max-width: 640px) {
	.pbr-grid--2,
	.pbr-grid--3,
	.pbr-grid--4,
	.pbr-grid--5 { grid-template-columns: 1fr; }
	h1 { font-size: clamp(2.25rem, 8vw, 2.5rem); }
	.pbr-section-header__title { font-size: 1.375rem; }
	.pbr-shell { padding-inline: 16px; }
}

@media print {
	.pbr-debug, .pbr-skip-link, .pbr-header { display: none; }
	body.pbr-theme { background: #fff; color: #000; }
}
