/*
Theme Name:   Astra Child (Otaku3D)
Theme URI:    https://otaku3d.com
Description:  Child theme of Astra. Replaces the Astra Pro features the shop relies on, so the site runs with Astra Pro deactivated.
Author:       Otaku3D
Template:     astra
Version:      0.3.0
Text Domain:  astra-child
*/

/* ==========================================================================
   Sticky header (replaces Astra Pro "Sticky Header")
   Pro stuck the main and below rows and let the above row scroll away.
   The whole masthead sticks, shifted up by the height of the above row.
   Update --o3d-above-h if the above-row height changes.
   ========================================================================== */
:root {
	--o3d-above-h: 40px;
}

#masthead {
	position: sticky;
	top: calc(var(--wp-admin--admin-bar--height, 0px) - var(--o3d-above-h));
	z-index: 99;
}

/* ==========================================================================
   Category banner and subcategory strip (product category archives)
   ========================================================================== */
.o3d-cat-banner {
	margin: 0 auto 16px;
	max-width: var(--ast-container-width, 1200px);
}

.o3d-cat-banner .metaslider {
	border-radius: 12px;
	overflow: hidden;
}

.o3d-subcats {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 auto 20px;
	padding: 0;
	list-style: none;
	max-width: var(--ast-container-width, 1200px);
}

.o3d-subcats a {
	display: inline-block;
	padding: 8px 16px;
	border: 1px solid currentColor;
	border-radius: 999px;
	font-size: 0.9rem;
	line-height: 1.2;
	text-decoration: none;
}

.o3d-subcats a:hover,
.o3d-subcats a:focus-visible {
	background: var(--ast-global-color-0, #333);
	border-color: var(--ast-global-color-0, #333);
	color: #fff;
}

.o3d-subcats__count {
	opacity: 0.7;
	margin-left: 4px;
}

@media (max-width: 544px) {
	.o3d-subcats {
		flex-wrap: nowrap;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 4px;
	}

	.o3d-subcats a {
		white-space: nowrap;
	}
}

/* ==========================================================================
   Additional CSS migrated from Appearance > Customize > Additional CSS.
   That CSS belongs to the parent theme only, so it is copied here to keep
   working once this child theme is active. Do not paste it back into the
   Customizer or it will load twice.
   ========================================================================== */

/* Header: slimmer bar, logo and menu alignment */
.main-header-bar {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    min-height: 50px !important;
    position: relative !important;
    z-index: 100 !important;
}

.ast-sticky-main-header-bar {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    min-height: 45px !important;
    position: relative !important;
    z-index: 100 !important;
}

.site-logo-img img,
.ast-sticky-device-setup .site-logo-img img {
    max-height: 40px !important;
    width: auto !important;
}

.main-header-menu > .menu-item > a {
    line-height: 40px !important;
}

.ast-primary-header-bar {
    border-bottom: none !important;
    position: relative !important;
    z-index: 100 !important;
}

/* Full-width marquee announcement bar */
.ast-above-header-wrap,
.ast-above-header-bar,
.site-header-above-section-center,
.ast-builder-grid-row,
.ast-builder-grid-row-container-inner {
    overflow: visible !important;
}

.header-widget-area:has(marquee),
section.widget_block:has(marquee) {
    position: relative !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.header-widget-area:has(marquee) > div,
section.widget_block:has(marquee) > div {
    width: 100% !important;
}

.ast-above-header marquee,
.header-widget-area marquee {
    width: 100% !important;
    display: block !important;
}

/* Footer: headings, links and icons */
.otaku-header {
    color: #ffffff !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    margin: 0 0 15px 0 !important;
    display: block !important;
    text-transform: none !important;
}

.otaku-item {
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
    margin-bottom: 8px !important;
    font-size: 15px !important;
    transition: opacity 0.2s ease !important;
    line-height: 1.4 !important;
}

.otaku-item:hover {
    opacity: 0.7 !important;
    text-decoration: underline !important;
}

.otaku-icon {
    width: 20px !important;
    margin-right: 10px !important;
    display: flex !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.otaku-icon svg {
    fill: #ffffff !important;
}

/* Coupon drawer: show only on cart and checkout */
body:not(.woocommerce-cart):not(.woocommerce-checkout) #power-coupons-drawer {
    display: none !important;
}

/* Phones: hide the floating cart (header already has a cart icon) */
@media (max-width: 767px) {
    #moderncart-floating-cart {
        display: none !important;
    }
}

/* Phones: blog cards get a matching right gutter to the left one */
@media (max-width: 767px) {
    .blog .post-content,
    .archive .post-content,
    .search .post-content {
        padding-right: 20px;
    }
}

/* ==========================================================================
   Header links (below row) — the Header links menu printed by [o3d_header_menu].
   Matches the old five-item row: 15px bold orange links, 20px apart.
   ========================================================================== */
.ast-below-header-bar .o3d-header-menu {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ast-below-header-bar .o3d-header-menu a {
	display: inline-block;
	color: #E85D10;
	font-size: 15px;
	font-weight: 700;
	line-height: 22px;
	text-decoration: none;
}

.ast-below-header-bar .o3d-header-menu a:hover,
.ast-below-header-bar .o3d-header-menu a:focus-visible {
	text-decoration: underline;
}

/* ==========================================================================
   Footer: widget 3 holds four link columns, widget 1 the contact column.
   Same proportions as the old five equal columns.
   ========================================================================== */
@media (min-width: 922px) {
	#colophon .site-primary-footer-wrap .ast-builder-grid-row {
		grid-template-columns: 4fr 1fr !important;
	}
}

.footer-widget-area[data-section="sidebar-widgets-footer-widget-3"].footer-widget-area-inner,
.footer-widget-area[data-section="sidebar-widgets-footer-widget-3"] .footer-widget-area-inner {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 0 20px;
}

@media (max-width: 921px) {
	.footer-widget-area[data-section="sidebar-widgets-footer-widget-3"].footer-widget-area-inner,
.footer-widget-area[data-section="sidebar-widgets-footer-widget-3"] .footer-widget-area-inner {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 544px) {
	.footer-widget-area[data-section="sidebar-widgets-footer-widget-3"].footer-widget-area-inner,
.footer-widget-area[data-section="sidebar-widgets-footer-widget-3"] .footer-widget-area-inner {
		grid-template-columns: 1fr;
	}
}

/* Header search: a wide pill between the logo and the right-hand links.
   The tagline under the logo is hidden. */
#ast-desktop-header .ast-primary-header-bar .ast-builder-grid-row {
	grid-template-columns: auto minmax(0, 1fr) auto !important;
}

#ast-desktop-header .ast-primary-header-bar .site-header-primary-section-center {
	padding: 0 32px;
}

#ast-desktop-header .ast-header-search,
#ast-desktop-header .ast-header-search .ast-search-menu-icon.ast-inline-search {
	width: 100%;
	max-width: none;
}

.ast-inline-search .search-field {
	border-radius: 999px;
	padding-left: 1.1em;
}

#masthead .site-description {
	display: none !important;
}

/* Header search box: submit icon at the right edge of the input */
#ast-desktop-header .ast-inline-search .search-form,
#ast-mobile-header .ast-inline-search .search-form {
	position: relative;
}

#ast-desktop-header .ast-inline-search .search-submit,
#ast-mobile-header .ast-inline-search .search-submit {
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	right: 0;
	top: 0;
	height: 100%;
	width: 40px;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	color: #666;
}

.footer-widget-area[data-section="sidebar-widgets-footer-widget-3"] .widget {
	margin-bottom: 0;
}

/* Header links: one level of dropdown (child menu items), opens on hover or keyboard focus */
.o3d-header-menu li {
	position: relative;
}

.o3d-header-menu .menu-item-has-children > a::after {
	content: "";
	display: inline-block;
	margin-left: 6px;
	padding: 2px;
	border: solid currentColor;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg) translateY(-2px);
}

.o3d-header-menu .sub-menu {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 101;
	min-width: 220px;
	margin: 0;
	padding: 8px 0;
	list-style: none;
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.o3d-header-menu li:hover > .sub-menu,
.o3d-header-menu li:focus-within > .sub-menu {
	display: block;
}

.ast-below-header-bar .o3d-header-menu .sub-menu a {
	display: block;
	padding: 8px 16px;
	font-size: 14px;
	white-space: nowrap;
}

.ast-below-header-bar .o3d-header-menu .sub-menu a:hover,
.ast-below-header-bar .o3d-header-menu .sub-menu a:focus-visible {
	background: #f6f6f6;
	text-decoration: none;
}

/* ==========================================================================
   Product page trust section (inc/product-trust.php)
   ========================================================================== */
.o3d-trust {
	margin: 20px 0 8px;
	padding: 14px 16px;
	border: 1px solid #ececec;
	border-radius: 12px;
	background: #fafafa;
}

.o3d-trust__list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px 18px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.o3d-trust__item {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin: 0;
}

.o3d-trust__icon {
	flex: 0 0 24px;
	color: #E85D10;
}

.o3d-trust__body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.o3d-trust__title {
	font-size: 14px;
	line-height: 1.3;
}

.o3d-trust__text {
	font-size: 13px;
	line-height: 1.4;
	color: #555;
}

a.o3d-trust__text {
	text-decoration: underline;
}

@media (max-width: 420px) {
	.o3d-trust__list {
		grid-template-columns: 1fr;
	}
}

/* ==========================================================================
   Shop filter: button plus slide-in panel, CSS only (inc/shop-filter.php)
   ========================================================================== */
.o3d-filter__toggle {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.o3d-filter__button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 16px;
	padding: 9px 18px;
	border: 1px solid #E85D10;
	border-radius: 999px;
	color: #E85D10;
	font-weight: 700;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
}

.o3d-filter__toggle:focus-visible + .o3d-filter__button {
	outline: 2px solid #E85D10;
	outline-offset: 2px;
}

.o3d-filter__overlay {
	position: fixed;
	inset: 0;
	z-index: 9998;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.o3d-filter__panel {
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	width: min(340px, 88vw);
	background: #fff;
	box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
	transform: translateX(-105%);
	visibility: hidden;
	transition: transform 0.25s ease, visibility 0.25s ease;
}

.o3d-filter__toggle:checked ~ .o3d-filter__overlay {
	opacity: 1;
	visibility: visible;
}

.o3d-filter__toggle:checked ~ .o3d-filter__panel {
	transform: none;
	visibility: visible;
}

.o3d-filter__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid #eee;
}

.o3d-filter__title {
	font-size: 18px;
	font-weight: 700;
}

.o3d-filter__close {
	cursor: pointer;
	text-decoration: underline;
	font-size: 14px;
}

.o3d-filter__body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 20px 24px;
}

body.admin-bar .o3d-filter__panel {
	top: var(--wp-admin--admin-bar--height, 32px);
}

/* ==========================================================================
   Homepage on phones: compact intro, and two blocks per row in the
   category, event and card sections (a lone last block is centred).
   ========================================================================== */
@media (max-width: 781px) {
	body.home .wp-block-columns:has(> .wp-block-column:nth-child(2)) {
		flex-wrap: wrap;
		gap: 16px;
	}

	body.home .wp-block-columns:has(> .wp-block-column:nth-child(2)) > .wp-block-column {
		flex: 0 0 calc(50% - 8px) !important;
		max-width: calc(50% - 8px) !important;
		margin: 0 !important;
	}

	body.home .wp-block-columns:has(> .wp-block-column:nth-child(2)) > .wp-block-column:last-child:nth-child(odd) {
		margin-left: auto !important;
		margin-right: auto !important;
	}

	body.home .spectra-overlay-color:has(> .otaku-card) {
		display: grid !important;
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 20px 16px !important;
		justify-items: center !important;
	}

	/* Spectra nests two padded containers around these rows; keep the outer padding only, so phone tiles are not squeezed. */
	body.home .spectra-overlay-color:has(.otaku-card) {
		padding-left: 16px !important;
		padding-right: 16px !important;
	}

	body.home .spectra-overlay-color .spectra-overlay-color:has(.otaku-card) {
		padding-left: 0 !important;
		padding-right: 0 !important;
	}

	/* New Launches: the third card in a three-card row takes the full width instead of sitting at half width. */
	body.home .wp-block-columns:has(> .wp-block-column.otaku-card:nth-child(3)) > .wp-block-column.otaku-card:nth-child(3) {
		width: 100% !important;
		max-width: 100% !important;
		flex-basis: 100% !important;
	}

	body.home .otaku-card {
		width: 100% !important;
		max-width: 100% !important;
		margin: 0 !important;
	}

	body.home .otaku-card:last-child:nth-child(odd) {
		grid-column: 1 / -1 !important;
		justify-self: center !important;
		width: 50% !important;
	}

	body.home .wp-block-group[style*="border-radius:18px"] {
		padding: 24px 16px !important;
	}

	body.home .wp-block-group[style*="border-radius:18px"] h2 {
		font-size: 30px !important;
		line-height: 1.15 !important;
	}
}

/* Product cards: hide the category name under the product title. */
.woocommerce ul.products li.product .ast-woo-product-category {
	display: none;
}

/* Tablet: centre short product rows (for example two products in a three-column grid). */
@media (min-width: 601px) and (max-width: 1024px) {
	.woocommerce ul.products {
		justify-content: center;
	}

	/* Exactly two products: use two columns so the pair sits in the middle. */
	.woocommerce ul.products:has(> li:nth-child(2)):not(:has(> li:nth-child(3))) {
		grid-template-columns: repeat(2, minmax(0, 240px));
	}
}

/* Contact page: the Spectra section adds 130px of top padding on phones; reduce it. */
@media (max-width: 781px) {
	body.page-id-2162 .entry-content > .spectra-background-overlay:first-child {
		padding-top: 80px !important;
	}
}

/* Contact page on desktop: the section adds 180px of top padding and centres the text against the taller form; start both at the top. */
@media (min-width: 782px) {
	body.page-id-2162 .entry-content > .spectra-background-overlay:first-child {
		padding-top: 60px !important;
	}

	body.page-id-2162 .entry-content > .spectra-background-overlay:first-child > .spectra-overlay-color {
		align-items: flex-start !important;
	}
}

/* Shop page: hide the "Shop" title above the product grid (Astra archive title). */
body.woocommerce-shop .page-title.ast-archive-title {
	display: none;
}
