/*
 * Base reset + typography.
 * Minimal — only what the theme needs. No utility framework.
 */

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

html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background-color: var(--at-canvas);
	color: var(--at-body);
	font-family: var(--at-font-body);
	font-size: var(--at-fs-body);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}
/* WP admin bar (32px on desktop, 46px on mobile) eats into the viewport. */
body.admin-bar { min-height: calc(100vh - 32px); }
@media (max-width: 782px) {
	body.admin-bar { min-height: calc(100vh - 46px); }
}

/* Display headings (h1/h2) in WarText, subheadings (h3+) in IBM Plex Mono.
 * Pin font-weight: normal because the WarText face only ships at one weight —
 * the browser default of `bold` on h1/h2 makes it synthesize a faux-bold that
 * looks like a glow/smear, especially at large sizes. */
h1, h2 {
	font-family: var(--at-font-display);
	font-weight: normal;
	color: var(--at-headline);
	text-transform: uppercase;
	letter-spacing: var(--at-tracking-default);
	line-height: 1.05;
	margin: 0 0 var(--at-space-4);
}
h3, h4, h5, h6 {
	font-family: var(--at-font-mono);
	color: var(--at-headline);
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: var(--at-tracking-eyebrow);
	margin: 0 0 var(--at-space-3);
}
h1 { font-size: var(--at-fs-h1); }
h2 { font-size: var(--at-fs-h2); }
h3 { font-size: var(--at-fs-subhead); }
h4 { font-size: var(--at-fs-body); }
h5 { font-size: var(--at-fs-body-sm); }
h6 { font-size: var(--at-fs-eyebrow); }

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

a {
	color: var(--at-body);
	text-decoration: none;
	transition: color var(--at-trans-default);
}
a:hover { color: var(--at-highlight); }

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

button, input, select, textarea { font: inherit; color: inherit; }

/* Form controls — brand default: black canvas, hairline border, square corners.
 * Prefixed with body#at-theme so we beat WC's `.woocommerce form .form-row .input-text`
 * (0,3,1) without resorting to !important. Our specificity: (1,1,2). */
body#at-theme input[type="text"],
body#at-theme input[type="email"],
body#at-theme input[type="tel"],
body#at-theme input[type="url"],
body#at-theme input[type="password"],
body#at-theme input[type="search"],
body#at-theme input[type="number"],
body#at-theme input[type="date"],
body#at-theme input[type="time"],
body#at-theme input[type="datetime-local"],
body#at-theme input[type="month"],
body#at-theme input[type="week"],
body#at-theme input[type="color"],
body#at-theme input[type="file"],
body#at-theme select,
body#at-theme textarea {
	background-color: var(--at-canvas);
	color: var(--at-headline);
	border: 1px solid var(--at-divider);
	border-radius: 0;
	padding: 0 var(--at-space-3);
	height: 44px;
	font-family: var(--at-font-body);
	font-size: var(--at-fs-body-sm);
	transition: border-color var(--at-trans-fast);
	box-sizing: border-box;
}
body#at-theme textarea {
	height: auto;
	min-height: 96px;
	padding: var(--at-space-2) var(--at-space-3);
}
body#at-theme input:focus,
body#at-theme select:focus,
body#at-theme textarea:focus {
	border-color: var(--at-highlight);
	outline: none;
}
body#at-theme input::placeholder,
body#at-theme textarea::placeholder {
	color: var(--at-muted);
}

/* === Global button component ===
 * Brand pattern:
 *   default → black fill, white border, white text
 *   hover   → white fill, black text (border stays white)
 *
 * Variants:
 *   .at-btn         → standard (the pattern above)
 *   .at-btn--ghost  → alias of .at-btn (semantic clarity)
 *   .at-btn--solid  → inverted (white default, black on hover) — use for
 *                     prominent CTAs (Place order, Proceed to checkout)
 */
body#at-theme .at-btn,
body#at-theme .at-btn--ghost,
body#at-theme .at-btn--solid {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--at-space-3) var(--at-space-6);
	font-family: var(--at-font-body);
	font-weight: 700;
	font-size: var(--at-fs-body-sm);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	border-radius: 0;
	border: 2px solid var(--at-highlight);
	background-color: var(--at-canvas);
	color: var(--at-highlight);
	cursor: pointer;
	text-decoration: none;
	transition: background-color var(--at-trans-fast), color var(--at-trans-fast);
}
body#at-theme .at-btn:hover,
body#at-theme .at-btn--ghost:hover {
	background-color: var(--at-highlight);
	color: var(--at-canvas);
}
body#at-theme .at-btn--solid {
	background-color: var(--at-highlight);
	color: var(--at-canvas);
}
body#at-theme .at-btn--solid:hover {
	background-color: var(--at-canvas);
	color: var(--at-highlight);
}

/* === Custom select (at-select.js) ===
 * Hides the native <select> visually but keeps it focusable for form submit.
 * Wrapper mirrors its state with brand-aligned dropdown.
 */
body#at-theme .at-select {
	position: relative;
	display: block;
}
body#at-theme .at-select > select {
	position: absolute;
	opacity: 0;
	pointer-events: none;
	width: 100%;
	height: 100%;
	left: 0;
	top: 0;
	z-index: -1;
}
body#at-theme .at-select__trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	height: 44px;
	padding: 0 var(--at-space-3);
	background-color: var(--at-surface);
	color: var(--at-headline);
	border: 1px solid var(--at-divider);
	border-radius: 0;
	font-family: var(--at-font-body);
	font-size: var(--at-fs-body-sm);
	cursor: pointer;
	transition: border-color var(--at-trans-fast);
	text-align: left;
}
body#at-theme .at-select__trigger:hover { border-color: var(--at-hairline-hover); }
body#at-theme .at-select.is-open .at-select__trigger,
body#at-theme .at-select__trigger:focus-visible {
	border-color: var(--at-highlight);
	outline: none;
}
body#at-theme .at-select__label {
	flex: 1 1 auto;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
body#at-theme .at-select__chevron {
	flex-shrink: 0;
	margin-left: var(--at-space-2);
	font-size: 0.75rem;
	color: var(--at-muted);
	transition: transform var(--at-trans-fast);
}
body#at-theme .at-select.is-open .at-select__chevron { transform: rotate(180deg); }

body#at-theme .at-select__menu {
	display: none;
	position: absolute;
	top: calc(100% + 2px);
	left: 0;
	right: 0;
	max-height: 280px;
	overflow-y: auto;
	margin: 0;
	padding: 0;
	list-style: none;
	background-color: var(--at-surface);
	border: 1px solid var(--at-divider);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
	z-index: 200;
}
body#at-theme .at-select.is-open .at-select__menu { display: block; }
body#at-theme .at-select__option {
	padding: var(--at-space-2) var(--at-space-3);
	color: var(--at-body);
	font-family: var(--at-font-body);
	font-size: var(--at-fs-body-sm);
	cursor: pointer;
	transition: background-color var(--at-trans-fast), color var(--at-trans-fast);
}
body#at-theme .at-select__option:hover {
	background-color: rgba(255, 255, 255, 0.04);
	color: var(--at-highlight);
}
body#at-theme .at-select__option.is-selected {
	color: var(--at-highlight);
	background-color: rgba(255, 255, 255, 0.06);
}
body#at-theme .at-select__option.is-disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Eyebrow utility — used widely across the design system */
.at-eyebrow {
	display: inline-block;
	font-family: var(--at-font-mono);
	font-size: var(--at-fs-eyebrow);
	color: var(--at-muted);
	text-transform: uppercase;
	letter-spacing: var(--at-tracking-pill);
	margin: 0;
}

.at-eyebrow--bracketed::before { content: "[ "; color: var(--at-divider); }
.at-eyebrow--bracketed::after  { content: " ]"; color: var(--at-divider); }

/* Screen-reader text */
.screen-reader-text {
	border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%);
	height: 1px; width: 1px; margin: -1px; overflow: hidden;
	padding: 0; position: absolute; word-wrap: normal !important;
}

/* Container helpers — same width as the header for grid alignment. */
.at-container {
	max-width: var(--at-content-max);
	margin-inline: auto;
	padding-inline: var(--at-space-5);
}

/* ── Global WooCommerce notices (L1/L2) ─────────────────────────────────
   Brand the add-to-cart toast / "cart updated" / info notices on EVERY page.
   cart.css & checkout.css load only on their own pages, so product/archive
   toasts fell back to default WooCommerce styling. */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
	background-color: var(--at-canvas);
	border: 1px solid var(--at-divider);
	border-left: 2px solid var(--at-highlight);
	border-radius: var(--at-radius-xs);
	padding: var(--at-space-3) var(--at-space-4);
	/* The status glyph is an absolute ::before (left:24px, width:16px). The
	   default horizontal padding (~16px) leaves the text underneath it, hiding
	   the message's leading characters. Clear the icon column. */
	padding-left: 3em;
	color: var(--at-body);
	list-style: none;
	box-shadow: none;
}
.woocommerce-error { border-left-color: var(--at-stock-out); }
.woocommerce-message::before,
.woocommerce-info::before,
.woocommerce-error::before { color: var(--at-body); }
.woocommerce-message .button,
.woocommerce-message .wc-forward,
.woocommerce-info .button {
	background: transparent;
	color: var(--at-body);
	border: 1px solid var(--at-divider);
	border-radius: var(--at-radius-xs);
	box-shadow: none;
}
.woocommerce-message .button:hover,
.woocommerce-message .wc-forward:hover,
.woocommerce-info .button:hover {
	color: var(--at-highlight);
	border-color: var(--at-highlight);
}

/* ── Select2 (WooCommerce country/state searchable dropdowns) ────────────────
   WC enhances the country/state selects on checkout + account address into
   Select2; at-select.js skips .country_select/.state_select. Skin it dark to
   match the theme (default Select2 CSS is light). The closed control sits in
   the form; the open dropdown is appended to <body> — both are under
   body#at-theme, so target it directly to beat select2.css. */
body#at-theme .select2-container--default .select2-selection--single {
	height: 44px;
	background-color: var(--at-canvas);
	border: 1px solid var(--at-divider);
	border-radius: 0;
	color: var(--at-headline);
}
body#at-theme .select2-container--default .select2-selection--single .select2-selection__rendered {
	color: var(--at-headline);
	font-size: var(--at-fs-body-sm); /* match .input-text (14px) */
	/* Center the value in the 44px control: full-height line-box, left inset
	   only — drop Select2's default 8px top/bottom padding that overflowed. */
	line-height: 44px;
	padding: 0 0 0 var(--at-space-3);
}
body#at-theme .select2-container--default .select2-selection--single .select2-selection__arrow {
	height: 42px;
}
body#at-theme .select2-container--default .select2-selection--single .select2-selection__arrow b {
	border-color: var(--at-muted) transparent transparent transparent;
}
body#at-theme .select2-container--open .select2-selection--single {
	border-color: var(--at-highlight);
}

/* Open dropdown panel (appended to <body>) */
body#at-theme .select2-dropdown {
	background-color: var(--at-canvas);
	border: 1px solid var(--at-divider);
	border-radius: 0;
	color: var(--at-headline);
}
body#at-theme .select2-search--dropdown {
	padding: var(--at-space-2);
}
body#at-theme .select2-container--default .select2-search--dropdown .select2-search__field {
	background-color: var(--at-surface);
	border: 1px solid var(--at-divider);
	border-radius: 0;
	color: var(--at-headline);
	font-size: var(--at-fs-body-sm);
	padding: var(--at-space-2) var(--at-space-3);
	outline: none;
}
body#at-theme .select2-container--default .select2-results__option {
	color: var(--at-body);
	font-size: var(--at-fs-body-sm);
	background-color: transparent;
}
body#at-theme .select2-container--default .select2-results__option--highlighted[aria-selected],
body#at-theme .select2-container--default .select2-results__option--highlighted {
	background-color: var(--at-highlight);
	color: var(--at-canvas);
}
body#at-theme .select2-container--default .select2-results__option[aria-selected="true"] {
	background-color: var(--at-surface);
	color: var(--at-headline);
}
body#at-theme .select2-results__options {
	max-height: 240px;
}

/* === 2026-06-15 (Travis): friendlier stock colours; map good-people
	   cross-site-stock block onto the at-theme tokens === */
body#at-theme .gp-css-stock-block--in-stock     { color: var(--at-stock-ok); }
body#at-theme .gp-css-stock-block--backorder    { color: var(--at-stock-low); }
body#at-theme .gp-css-stock-block--out-of-stock { color: var(--at-stock-out); }
