/*
Theme Name: Globalgood Publishing
Theme URI: https://globalgoodpublishing.com
Author: Americas Book Service
Description: Publishing and bookstore theme for Globalgood Publishing Corporation. Implements the Publication Tree library architecture - 22 trees across 5 discovery groups - over WooCommerce, with the Tree > Branch > Series > Volume > Format hierarchy from the Publication Tree document.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: Proprietary
Text Domain: globalgood
Tags: publishing, bookstore, woocommerce
*/

/*
 * The real stylesheet is split across assets/css/style.css (design tokens, base
 * typography, homepage) and assets/css/pages.css (library, tree, catalogue and
 * product pages). Both are enqueued in functions.php.
 *
 * This file exists because WordPress requires a style.css with the header above
 * in order to recognise the theme at all. Put only WordPress-specific overrides
 * here, so the two main stylesheets stay in step with the static site they came
 * from.
 */

/* ---- WordPress core classes the static site never had ---- */

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

.alignleft {
	float: left;
	margin: 0 24px 16px 0;
}

.alignright {
	float: right;
	margin: 0 0 16px 24px;
}

.aligncenter {
	display: block;
	margin: 0 auto 16px;
}

.wp-caption {
	max-width: 100%;
}

.wp-caption-text {
	font-size: 13px;
	color: var(--c-muted, #6b6b6b);
	margin-top: 8px;
}

/* ---- Price beside each format's Buy button ----
 * The static site had no prices, so assets/css/pages.css has no rule for this.
 * Kept here rather than in pages.css so that file stays byte-identical to the
 * static site it was copied from.
 * .format-row is a two-child flex with space-between, so the price and the
 * button are grouped into one right-hand child rather than added as a third.
 */
.format-buy {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-shrink: 0;
}

.format-price {
	font-family: var(--font-head, Georgia, serif);
	font-size: 15px;
	font-weight: 600;
	color: var(--c-primary, #0E2238);
	white-space: nowrap;
}

/* WooCommerce wraps prices in <span class="amount"> and uses <del>/<ins> on sale. */
.format-price .amount {
	font-size: inherit;
	color: inherit;
}

.format-price del {
	opacity: .55;
	margin-right: 6px;
	font-weight: 400;
}

.format-price ins {
	text-decoration: none;
}

@media (max-width: 560px) {
	.format-row {
		align-items: flex-start;
		flex-direction: column;
	}
	.format-buy {
		width: 100%;
		justify-content: space-between;
	}
}

/* ============================================================
 * Legal pages
 * ============================================================ */

.legal-body {
	max-width: 760px;
}

.legal-body p,
.legal-body li {
	font-size: 15px;
	line-height: 1.8;
	color: var(--c-text-muted, #4a4a4a);
}

.legal-body h3 {
	font-family: var(--font-head, Georgia, serif);
	font-size: 19px;
	color: var(--c-primary, #0E2238);
	margin: 34px 0 12px;
	padding-top: 22px;
	border-top: 1px solid var(--c-border, #e2dccd);
}

.legal-body h3:first-of-type { border-top: 0; padding-top: 0; margin-top: 24px; }

.legal-body ul { margin: 0 0 18px 20px; }
.legal-body li { margin-bottom: 9px; }
.legal-body p { margin-bottom: 16px; }
.legal-body strong { color: var(--c-text, #2b2b2b); }

.legal-body a {
	color: var(--c-gold, #B8903D);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.legal-updated {
	font-size: 13px !important;
	letter-spacing: .03em;
	text-transform: uppercase;
	color: var(--c-text-muted, #6b6b6b);
	padding-bottom: 18px;
	border-bottom: 1px solid var(--c-border, #e2dccd);
}

/* Facts only the publisher can supply. Deliberately loud so they cannot
   go live unnoticed. */
.legal-tbc {
	background: #fff3cd;
	color: #7a5600;
	font-weight: 700;
	font-size: 12px;
	letter-spacing: .04em;
	padding: 2px 7px;
	border-radius: 3px;
	border: 1px solid #e0c060;
}

/* ============================================================
 * Checkout
 * ============================================================ */

/* Billing block is hidden until the customer says the addresses differ.
   WooCommerce still needs the fields in the DOM, so they are hidden rather
   than removed. */
.globalgood-hidden-field { display: none !important; }

.billing-toggle {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 22px 0 6px;
	padding: 14px 16px;
	background: var(--c-surface, #fff);
	border: 1px solid var(--c-border, #e2dccd);
	border-radius: var(--radius-sm, 6px);
}

.billing-toggle input { margin-top: 3px; flex-shrink: 0; }
.billing-toggle label { font-size: 14px; font-weight: 600; cursor: pointer; }
.billing-toggle small { display: block; font-weight: 400; font-size: 12.5px; color: var(--c-text-muted, #6b6b6b); margin-top: 2px; }

/* Billing fields collapse until needed. */
.woocommerce-billing-fields[hidden] { display: none; }

/* ---- Form fields ----
 * What the customer has typed should read as their own words - weighted and
 * dark - while empty fields stay quiet. :placeholder-shown distinguishes the
 * two without any JavaScript.
 */

.woocommerce-checkout .input-text,
.woocommerce-checkout select,
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row select {
	font-family: var(--font-body, Inter, system-ui, sans-serif);
	font-size: 15px;
	padding: 12px 14px;
	border: 1px solid var(--c-border, #e2dccd);
	border-radius: var(--radius-sm, 6px);
	background: #fff;
	color: var(--c-text, #2b2b2b);
	transition: border-color .15s ease, box-shadow .15s ease;
}

/* Filled in: heavier and darker, so completed answers stand out. */
.woocommerce-checkout .input-text:not(:placeholder-shown),
.woocommerce form .form-row input.input-text:not(:placeholder-shown),
.woocommerce-checkout select,
.woocommerce form .form-row select {
	font-weight: 600;
	letter-spacing: .1px;
	color: var(--c-primary, #0E2238);
}

/* A text input with no placeholder attribute never matches
   :placeholder-shown, so weight it whenever it holds a value. */
.woocommerce-checkout .input-text:valid:not(:placeholder-shown) { font-weight: 600; }

.woocommerce-checkout .input-text:focus,
.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row select:focus {
	outline: none;
	border-color: var(--c-gold, #B8903D);
	box-shadow: 0 0 0 3px rgba(184,144,61,.15);
}

/* Labels: quiet, uppercase, clearly separated from the value beneath. */
.woocommerce-checkout .form-row label,
.woocommerce form .form-row label {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--c-text-muted, #6b6b6b);
	margin-bottom: 6px;
	display: block;
}

.woocommerce-checkout .form-row label .required,
.woocommerce form .form-row label .required {
	color: var(--c-gold, #B8903D);
	text-decoration: none;
	border: 0;
}

/* Section headings on the checkout. */
.woocommerce-checkout h3,
.woocommerce-billing-fields h3,
.woocommerce-shipping-fields h3 {
	font-family: var(--font-head, Georgia, serif);
	font-size: 20px;
	color: var(--c-primary, #0E2238);
	margin: 0 0 16px;
}


/* Section hint under a checkout heading. */
.gg-section-hint {
	font-size: 13px;
	color: var(--c-text-muted, #6b6b6b);
	margin: -8px 0 18px;
}

/* Billing heading, when the customer reveals it. */
#gg-billing-wrap h3 { margin-top: 26px; }

/* ---- Shipping method list ---- */

.ship-hint {
	font-size: 13px;
	color: var(--c-text-muted, #6b6b6b);
	margin: 0 0 10px;
}


/* ---- Cart table ----
 * The book is the thing the customer is checking; it should read as the
 * strongest item on the row, not the same weight as the column headings.
 */
.woocommerce-cart-form .product-name,
.woocommerce-cart-form .product-name a,
.woocommerce-checkout-review-order-table .product-name {
	font-weight: 700 !important;
	font-size: 15px;
	color: var(--c-primary, #0E2238) !important;
	line-height: 1.5;
}

.woocommerce-cart-form .product-name a:hover {
	color: var(--c-gold, #B8903D) !important;
}

/* Quantity, price and subtotal stay quieter than the title. */
.woocommerce-cart-form .product-price,
.woocommerce-cart-form .product-subtotal {
	font-family: var(--font-head, Georgia, serif);
	font-weight: 600;
	color: var(--c-primary, #0E2238);
}

/* One clear, tappable row per option instead of a bare radio list.
 *
 * WooCommerce renders the radio and the label as SIBLINGS inside each <li>, so
 * the <li> has to be the flex container. Making only the label flex left the
 * radio sitting outside the box and the name and price jammed together as
 * "Mail$6.99". Selectors are deliberately specific because WooCommerce's own
 * stylesheet loads after the theme's.
 */
.woocommerce-checkout #shipping_method,
ul#shipping_method {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.woocommerce-checkout #shipping_method li,
ul#shipping_method li {
	display: flex !important;
	align-items: center;
	gap: 12px;
	margin: 0 !important;
	padding: 13px 16px !important;
	border: 1px solid var(--c-border, #e2dccd);
	border-radius: var(--radius-sm, 6px);
	background: var(--c-surface, #fff);
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
	text-indent: 0 !important;
}

.woocommerce-checkout #shipping_method li:hover {
	border-color: var(--c-gold, #B8903D);
}

.woocommerce-checkout #shipping_method li:has(input:checked) {
	border-color: var(--c-gold, #B8903D);
	background: #fffdf7;
	box-shadow: inset 0 0 0 1px var(--c-gold, #B8903D);
}

.woocommerce-checkout #shipping_method li input[type="radio"] {
	flex: 0 0 auto;
	margin: 0 !important;
	width: 17px;
	height: 17px;
	accent-color: var(--c-gold, #B8903D);
	cursor: pointer;
}

/* The label carries the name on the left and the price hard right. */
.woocommerce-checkout #shipping_method li label,
ul#shipping_method li label {
	display: flex !important;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	flex: 1 1 auto;
	margin: 0 !important;
	padding: 0 !important;
	cursor: pointer;
	font-size: 14.5px;
	text-transform: none !important;
	letter-spacing: 0 !important;
	color: var(--c-text, #2b2b2b) !important;
	font-weight: 500 !important;
}

.ship-name {
	font-weight: 600;
	color: var(--c-primary, #0E2238);
}

.ship-price {
	font-family: var(--font-head, Georgia, serif);
	font-weight: 600;
	font-size: 15px;
	color: var(--c-primary, #0E2238);
	white-space: nowrap;
}

/* The shipment row itself: give it room rather than squeezing it into a
   totals-table cell. */
.woocommerce-checkout-review-order-table .shipping th {
	vertical-align: top;
	padding-top: 20px;
}

.woocommerce-checkout-review-order-table .shipping td {
	padding: 14px 0;
}

/* ============================================================
 * Added-to-cart bar
 * ============================================================ */

body.has-cartbar .woocommerce-message {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 900;
	margin: 0;
	border: 0;
	border-top: 2px solid var(--c-gold, #B8903D);
	border-radius: 0;
	background: var(--c-primary, #0E2238);
	color: #fff;
	padding: 14px 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 20px;
	flex-wrap: wrap;
	box-shadow: 0 -6px 24px rgba(0,0,0,.18);
	animation: cartbar-in .28s ease-out;
}

@keyframes cartbar-in {
	from { transform: translateY(100%); }
	to   { transform: translateY(0); }
}

body.has-cartbar .woocommerce-message::before { display: none; }

.cartbar-text { font-size: 14.5px; }
.cartbar-text strong { color: var(--c-gold-light, #D4AF6A); }

.cartbar-actions { display: flex; gap: 10px; }
.cartbar-btn { padding: 8px 18px !important; font-size: 13px !important; }

body.has-cartbar .cartbar-btn.btn-outline-dark {
	border-color: rgba(255,255,255,.45);
	color: #fff;
}

/* Keep the floating CTA clear of the bar. */
body.has-cartbar .floating-cta { bottom: 86px; }

@media (max-width: 600px) {
	body.has-cartbar .woocommerce-message { flex-direction: column; gap: 12px; text-align: center; }
	.cartbar-actions { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
	body.has-cartbar .woocommerce-message { animation: none; }
}

/* Admin bar must not sit over the fixed header. */
body.admin-bar .site-header {
	top: 32px;
}

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

/* ============================================================
 * Checkout order line: cover, title, quantity
 *
 * The review table has no thumbnail or quantity column of its own, so both
 * live inside the product-name cell.
 * ============================================================ */

.gg-line {
	display: flex;
	align-items: flex-start;
	gap: 14px;
}

.gg-line-cover {
	flex: 0 0 54px;
	width: 54px;
	line-height: 0;
}

.gg-line-cover img,
img.gg-line-thumb {
	width: 54px;
	height: auto;
	border-radius: 3px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
	display: block;
}

.gg-line-body { flex: 1 1 auto; min-width: 0; }

.gg-line-title {
	font-weight: 700;
	font-size: 14.5px;
	line-height: 1.45;
	color: var(--c-primary, #0E2238);
}

.gg-line-title a {
	color: inherit;
	text-decoration: none;
}

.gg-line-title a:hover { color: var(--c-gold, #B8903D); }

/* ---- quantity stepper ---- */

.gg-qty {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	margin-top: 8px;
	transition: opacity .15s ease;
}

.gg-qty.is-busy { opacity: .45; pointer-events: none; }

.gg-qty-btn {
	width: 26px;
	height: 26px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--c-border, #e2dccd);
	background: #fff;
	color: var(--c-primary, #0E2238);
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	border-radius: 4px;
	padding: 0;
	transition: border-color .15s ease, background .15s ease;
}

.gg-qty-btn:hover {
	border-color: var(--c-gold, #B8903D);
	background: #fffdf7;
}

.gg-qty-n {
	min-width: 30px;
	text-align: center;
	font-weight: 700;
	font-size: 14px;
	color: var(--c-primary, #0E2238);
}

.gg-qty-remove {
	margin-left: 10px;
	border: 0;
	background: none;
	padding: 0;
	font-size: 12px;
	letter-spacing: .02em;
	color: var(--c-text-muted, #6b6b6b);
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

.gg-qty-remove:hover { color: #a3342b; }

/* The quantity lives in the name cell now, so WooCommerce's own "x 2" suffix
   would state it twice. */
.woocommerce-checkout-review-order-table .product-name .product-quantity { display: none; }

/* ---- Downloads-only checkout -------------------------------------------
   An eBook basket asks for a name and an email and nothing else, so the email
   field carries the warning that would otherwise sit on a delivery address:
   get it wrong and the order is paid for but never arrives. */

.gg-download-heading {
	margin: 0 0 .35rem;
}

.gg-download-hint {
	margin-bottom: 1.4rem;
}

.gg-email-field .description {
	display: block;
	margin-top: .45rem;
	padding: .6rem .75rem;
	border-left: 3px solid var(--gold, #b08d3f);
	background: rgba(176, 141, 63, .07);
	font-size: .86rem;
	line-height: 1.45;
	color: var(--ink-soft, #4a4a4a);
}

.gg-email-field input[type="email"] {
	font-weight: 600;
}

/* The ship-to-different-address checkbox must exist and stay checked for
   WooCommerce to post the shipping address, but the customer never sees it:
   on this checkout the delivery address is the only address. Hidden with CSS,
   not removed, because a CSS-hidden field still submits. */
.gg-ship-flag {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	pointer-events: none;
}
