/*
 * WordPress / WooCommerce additions.
 *
 * Nothing in this file changes the designed homepage. It only covers the parts
 * WordPress adds on top of the original React app: the admin bar, the skip
 * link, editor content, comments, pagination and the WooCommerce shop pages -
 * all styled with the same tokens as the design.
 */

/* ---------------------------------------------------------------
 * Accessibility helpers
 * ------------------------------------------------------------- */

.rrr-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100000;
	background-color: var(--red);
	color: #EDE8DF;
	font-family: var(--font-label);
	font-size: 0.82rem;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	padding: 0.95rem 2.2rem;
	text-decoration: none;
}

.rrr-skip-link:focus {
	left: 1rem;
	top: 1rem;
}

/* Honeypot: hidden from humans, present for bots. */
.rrr-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------------------------------------------------------------
 * Admin bar - keep the fixed navbar clear of it
 * ------------------------------------------------------------- */

body.admin-bar #rrr-navbar {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar #rrr-navbar {
		top: 46px;
	}
}

/* ---------------------------------------------------------------
 * Editor content (pages, posts, the optional front-page block area)
 * ------------------------------------------------------------- */

.rrr-entry h1,
.rrr-entry h2,
.rrr-entry h3,
.rrr-entry h4 {
	font-family: var(--font-display);
	font-weight: 900;
	text-transform: uppercase;
	letter-spacing: -0.01em;
	line-height: 0.95;
	color: var(--text);
	margin: 2rem 0 0.75rem;
}

.rrr-entry h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
.rrr-entry h3 { font-size: clamp(1.35rem, 3vw, 1.75rem); }
.rrr-entry h4 { font-size: 1.15rem; }

.rrr-entry p,
.rrr-entry li {
	line-height: 1.75;
}

.rrr-entry p { margin: 0 0 1rem; }

.rrr-entry a {
	color: var(--red);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.rrr-entry a:hover { color: var(--red-hi); }

.rrr-entry ul,
.rrr-entry ol {
	margin: 0 0 1rem 1.25rem;
	padding: 0;
}

.rrr-entry ul { list-style: square; }
.rrr-entry ol { list-style: decimal; }
.rrr-entry li { margin-bottom: 0.35rem; }

.rrr-entry blockquote {
	border-left: 2px solid var(--red);
	background-color: rgba(218, 206, 177, 0.6);
	margin: 1.5rem 0;
	padding: 0.75rem 1rem;
	font-family: var(--font-label);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--red);
	font-weight: 700;
}

.rrr-entry img,
.rrr-entry iframe,
.rrr-entry video {
	max-width: 100%;
	height: auto;
}

.rrr-entry table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 1.5rem;
}

.rrr-entry th,
.rrr-entry td {
	border: 1px solid var(--border);
	padding: 0.6rem 0.8rem;
	text-align: left;
}

.rrr-entry th {
	font-family: var(--font-label);
	letter-spacing: 0.2em;
	text-transform: uppercase;
	background-color: var(--surface-1);
}

.rrr-entry code,
.rrr-entry pre {
	font-family: var(--font-body);
	background-color: var(--surface-1);
	border: 1px solid var(--border);
}

.rrr-entry code { padding: 0.1rem 0.35rem; }

.rrr-entry pre {
	padding: 1rem;
	overflow-x: auto;
	margin-bottom: 1.5rem;
}

/* Editorial section: the block-level rhythm the React version got from
   Tailwind's space-y-4 on a static child list. */
.rrr-editorial p { margin: 0; }
.rrr-editorial p + p { margin-top: 1rem; }

/* ---------------------------------------------------------------
 * Pagination, comments
 * ------------------------------------------------------------- */

.rrr-pagination,
.navigation.pagination {
	margin-top: 3rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--border);
	font-family: var(--font-label);
	font-size: 0.75rem;
	letter-spacing: 0.25em;
	text-transform: uppercase;
}

.navigation.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.navigation.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	height: 2.5rem;
	padding: 0 0.6rem;
	border: 1px solid var(--border);
	color: var(--text);
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.navigation.pagination .page-numbers:hover,
.navigation.pagination .page-numbers.current {
	background-color: var(--red);
	border-color: var(--red);
	color: #EDE8DF;
}

.rrr-comments .comment-body {
	background-color: var(--surface-1);
	border: 1px solid var(--border);
	padding: 1.25rem;
}

.rrr-comments .children {
	list-style: none;
	margin: 1rem 0 0 1.5rem;
	padding: 0;
}

.rrr-comments .comment-form input[type="text"],
.rrr-comments .comment-form input[type="email"],
.rrr-comments .comment-form input[type="url"],
.rrr-comments .comment-form textarea {
	width: 100%;
	background-color: var(--surface-1);
	border: 1px solid rgba(26, 23, 18, 0.2);
	padding: 0.75rem 1rem;
	font-family: var(--font-body);
	font-size: 0.85rem;
	color: var(--text);
}

.rrr-comments .comment-form label {
	display: block;
	font-family: var(--font-label);
	font-size: 0.7rem;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: rgba(26, 23, 18, 0.6);
	margin-bottom: 0.35rem;
}

.rrr-comments .comment-form p { margin-bottom: 1rem; }

/* ---------------------------------------------------------------
 * WooCommerce - OPT-IN ONLY
 *
 * This site uses WooCommerce for product detail pages only; the shop front is
 * a hand-built page. Product, cart, checkout and account pages are therefore
 * deliberately NOT styled here - they keep whatever they look like today.
 *
 * The rules below apply exclusively to the WooCommerce shop archive, and only
 * after opting in with:
 *
 *   add_filter( 'rrr_wc_style_shop_archive', '__return_true' );
 *
 * Without that filter the class .rrr-woo-loop is never emitted and every rule
 * in this section stays inert.
 * ------------------------------------------------------------- */

ul.products.rrr-woo-loop {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

@media (min-width: 768px) {
	ul.products.rrr-woo-loop { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

ul.products.rrr-woo-loop li.product {
	background-color: var(--surface-1);
	border: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	position: relative;
	overflow: hidden;
	transition: border-color 0.3s ease;
	margin: 0;
	padding: 0;
	width: auto;
	float: none;
}

ul.products.rrr-woo-loop li.product:hover { border-color: var(--red); }

ul.products.rrr-woo-loop li.product > a:first-of-type {
	display: block;
	background-color: var(--surface-2);
	border-bottom: 1px solid var(--border);
	padding: 1.5rem;
	text-decoration: none;
}

ul.products.rrr-woo-loop li.product img {
	width: 100%;
	height: auto;
	object-fit: contain;
	transition: transform 0.5s ease;
	margin: 0;
}

ul.products.rrr-woo-loop li.product:hover img { transform: scale(1.05); }

ul.products.rrr-woo-loop li.product .woocommerce-loop-product__title {
	font-family: var(--font-display);
	font-weight: 900;
	text-transform: uppercase;
	font-size: 1.5rem;
	line-height: 1;
	color: var(--text);
	padding: 1.5rem 1.5rem 0.75rem;
}

ul.products.rrr-woo-loop li.product .price {
	display: block;
	font-family: var(--font-display);
	font-weight: 900;
	font-size: 1.5rem;
	color: var(--text);
	padding: 0 1.5rem;
	margin: 0 0 1rem;
}

ul.products.rrr-woo-loop li.product .price del { opacity: 0.5; font-size: 1rem; }
ul.products.rrr-woo-loop li.product .price ins { text-decoration: none; color: var(--red); }

ul.products.rrr-woo-loop li.product .onsale {
	position: absolute;
	top: 1rem;
	left: 1rem;
	z-index: 2;
	background-color: var(--red);
	color: #EDE8DF;
	font-family: var(--font-label);
	font-size: 0.62rem;
	letter-spacing: 0.25em;
	text-transform: uppercase;
	padding: 0.25rem 0.6rem;
	font-weight: 700;
}

ul.products.rrr-woo-loop li.product .button,
ul.products.rrr-woo-loop li.product .added_to_cart {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	background-color: var(--red);
	color: #EDE8DF;
	font-family: var(--font-label);
	font-size: 0.7rem;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	padding: 0.75rem 1.25rem;
	margin: 0 1.5rem 1.5rem;
	border: none;
	border-radius: 0;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

ul.products.rrr-woo-loop li.product .button:hover {
	background-color: var(--red-hi);
	transform: translateY(-2px);
	box-shadow: 0 4px 14px rgba(201, 18, 10, 0.35);
}

/* ---------------------------------------------------------------
 * The site's global footer (WPCode snippet 1432).
 *
 * That snippet is hooked to wp_footer at priority 5 and prints the shared RRR
 * footer on every page. This template calls wp_footer() - it has to, so that
 * analytics, cookie banners and the admin bar keep working - which means the
 * snippet fires here too and a SECOND footer appears below the designed one.
 * Its text is light, which is correct on the dark surface it was built for and
 * unreadable on this page's sand background.
 *
 * Hidden here, and only here (body.rrr-front is set by this package alone).
 *
 * This is a safety net. The cleaner permanent fix is to exclude this page in
 * the snippet's own conditional logic - see INSTALLATION.md, "Globaler Footer".
 * ------------------------------------------------------------- */

/*
 * Catch it by STRUCTURE, not by class name: this template's own footer sits
 * inside the .rrr-homepage wrapper, while anything printed by wp_footer() ends
 * up as a direct child of <body>. That holds no matter what the snippet calls
 * its markup.
 */
body.rrr-front > footer {
	display: none !important;
}

/* Plus the known class names from the RRR style guide, section 9. */
body.rrr-front .rrr-footer,
body.rrr-front .rrr-footer-wrap,
body.rrr-front #rrr-global-footer {
	display: none !important;
}

/* ---------------------------------------------------------------
 * Hero framing.
 *
 * Two things scale the hero image at the same time:
 *   --rrr-hero-zoom   the crop set in the Customizer (1 = fill the frame)
 *   --rrr-hero-state  the slide transition (1 active, 1.05 inactive)
 *
 * The original used Tailwind's scale-100 / scale-105 for the second one. A
 * separate zoom transform would have replaced that class outright and killed
 * the transition, so both factors are multiplied into one transform here.
 *
 * With the defaults this evaluates to scale(1) and scale(1.05) - byte for byte
 * the behaviour of the React original.
 * ------------------------------------------------------------- */

.rrr-hero-slide {
	transform: scale(calc(var(--rrr-hero-zoom, 1) * var(--rrr-hero-state, 1))) !important;
	transform-origin: center center;
}

/* No horizontal overflow, on any breakpoint. */
html,
body {
	max-width: 100%;
	overflow-x: hidden;
}

/* Print: hide the fixed chrome. */
@media print {
	#rrr-navbar,
	#rrr-cursor-root,
	.rrr-skip-link {
		display: none !important;
	}
}
