/**
 * Oh My Mogra — shell.
 *
 * Header, footer, overlays (drawer / search / toast) and the shared atoms that
 * patterns compose from. Commerce surfaces live in woocommerce.css.
 *
 * Colours are never written literally below: theme.json owns the palette and
 * exposes it as --wp--preset--color--*, aliased here for legibility.
 */

:root {
	--omm-surface:     var(--wp--preset--color--base, #FFFFFF);
	--omm-ground:      var(--wp--preset--color--ground, #F1F2ED);
	--omm-surface-2:   var(--wp--preset--color--surface-2, #F7F8F4);
	--omm-ink:         var(--wp--preset--color--contrast, #191C16);
	--omm-ink-2:       var(--wp--preset--color--ink-2, #454A40);
	--omm-muted:       var(--wp--preset--color--muted, #737A6D);
	--omm-line:        var(--wp--preset--color--line, #DADED2);
	--omm-line-2:      var(--wp--preset--color--line-strong, #C3C9B9);
	--omm-brand:       var(--wp--preset--color--brand, #20452F);
	--omm-brand-soft:  var(--wp--preset--color--brand-soft, #E1EAE2);
	--omm-oil:         var(--wp--preset--color--oil, #9A6C16);
	--omm-oil-soft:    var(--wp--preset--color--oil-soft, #F6EDD8);

	--omm-serif: var(--wp--preset--font-family--display);
	--omm-sans:  var(--wp--preset--font-family--body);
	--omm-mono:  var(--wp--preset--font-family--mono);

	--omm-r-sm: 3px;
	--omm-r:    6px;
	--omm-r-lg: 12px;

	--omm-shadow: 0 1px 2px rgba(25, 28, 22, .05), 0 12px 28px -14px rgba(25, 28, 22, .22);
	--omm-shadow-lg: 0 24px 60px -20px rgba(25, 28, 22, .35);

	--omm-ease: cubic-bezier(.4, 0, .2, 1);
	--omm-header-h: 60px;
}

/* -------------------------------------------------------------------------
 * Base
 * ---------------------------------------------------------------------- */

html.omm-locked {
	overflow: hidden;
}

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

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

.omm-money,
.omm-tabular {
	font-family: var(--omm-mono);
	font-variant-numeric: tabular-nums;
}

.omm-label {
	font-family: var(--omm-mono);
	font-size: .6875rem;
	letter-spacing: .13em;
	text-transform: uppercase;
	color: var(--omm-muted);
}

.omm-eyebrow {
	font-family: var(--omm-mono);
	font-size: .625rem;
	letter-spacing: .15em;
	text-transform: uppercase;
	color: var(--omm-oil);
}

/* Screen-reader-only, matching core's naming so patterns can use either. */
.omm-sr,
.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;
}

/* -------------------------------------------------------------------------
 * Buttons — shared by overlays and patterns. The block editor's own button
 * styling comes from theme.json; this is for markup we render in PHP.
 * ---------------------------------------------------------------------- */

.omm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	width: 100%;
	padding: .875rem 1.375rem;
	border: 1px solid var(--omm-brand);
	border-radius: var(--omm-r);
	background: var(--omm-brand);
	color: var(--wp--preset--color--base, #fff);
	font-family: var(--omm-sans);
	font-size: .9375rem;
	font-weight: 500;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background .16s var(--omm-ease), opacity .16s var(--omm-ease);
}

.omm-btn:hover {
	background: #183524;
	color: var(--wp--preset--color--base, #fff);
}

.omm-btn[disabled],
.omm-btn.is-loading {
	opacity: .6;
	cursor: progress;
}

.omm-btn--ghost {
	background: transparent;
	color: var(--omm-ink);
	border-color: var(--omm-line-2);
}

.omm-btn--ghost:hover {
	background: var(--omm-surface-2);
	color: var(--omm-ink);
	border-color: var(--omm-ink);
}

.omm-btn--auto {
	width: auto;
}

/* -------------------------------------------------------------------------
 * Header
 * ---------------------------------------------------------------------- */

/* The block markup also carries has-brand-background-color / has-base-color, so
   the bar still paints if this stylesheet is ever overridden or stripped. */
.omm-announce,
.omm-header .omm-announce {
	background-color: var(--omm-brand);
	color: var(--wp--preset--color--base, #fff);
	text-align: center;
	padding: .45rem .75rem;
	font-family: var(--omm-mono);
	font-size: .625rem;
	letter-spacing: .1em;
	text-transform: uppercase;
}

.omm-announce .omm-announce-text {
	color: inherit;
}

.omm-announce a {
	color: inherit;
}

/* The bar's padding is the spacing; the paragraph inside must not add its own. */
.omm-announce p {
	margin: 0;
}

.omm-header {
	position: sticky;
	top: 0;
	z-index: 40;
	background: var(--omm-surface);
	border-bottom: 1px solid var(--omm-line);
}

/* Every child is placed explicitly rather than left to auto-flow. WooCommerce
   injects its own Mini-Cart and Customer Account blocks into block-theme
   headers; with auto-placement those extra children wrapped the bar onto a
   second row. Explicit areas mean anything injected lands on top of row 1
   instead of adding to the layout, and the rule below hides them outright. */
.omm-header-inner {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	grid-template-rows: auto;
	align-items: center;
	gap: 1rem;
	min-height: var(--omm-header-h);
	padding: .625rem 1.125rem;
}

.omm-header-nav {
	grid-area: 1 / 1;
	justify-self: start;
}

/* The wordmark sits centred on mobile — burger left, icons right — and moves
   to the left edge once there is room for the links beside it. */
.omm-header-brand {
	grid-area: 1 / 2;
	justify-self: center;
	white-space: nowrap;
}

.omm-header-tools {
	grid-area: 1 / 3;
	justify-self: end;
	display: flex;
	align-items: center;
	gap: 1rem;
}

.omm-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: relative;
	padding: .25rem;
	border: 0;
	background: none;
	color: var(--omm-ink-2);
	cursor: pointer;
	text-decoration: none;
}

.omm-icon-btn:hover {
	color: var(--omm-ink);
}

.omm-icon-btn svg {
	display: block;
}

.omm-cart-count {
	position: absolute;
	top: -2px;
	right: -6px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 100px;
	background: var(--omm-oil);
	color: #fff;
	font-family: var(--omm-mono);
	font-size: .5625rem;
	line-height: 16px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

/* An empty bag needs no badge. */
.omm-cart-count[data-count="0"] {
	display: none;
}

.omm-header .wp-block-navigation__responsive-container-open,
.omm-header .wp-block-navigation__responsive-container-close {
	color: var(--omm-ink-2);
}

@media (min-width: 782px) {
	.omm-header-inner {
		grid-template-columns: auto 1fr auto;
		padding: .875rem 2.5rem;
		gap: 2rem;
	}

	.omm-header-brand {
		grid-area: 1 / 1;
		justify-self: start;
	}

	.omm-header-nav {
		grid-area: 1 / 2;
		justify-self: start;
	}
}

/* Checkout strips the header to the wordmark: nothing on that page competes
   with the pay button. */
.omm-header--minimal .omm-header-inner {
	grid-template-columns: 1fr;
	justify-items: center;
}

/* -------------------------------------------------------------------------
 * Footer
 * ---------------------------------------------------------------------- */

.omm-footer {
	background: var(--omm-surface-2);
	border-top: 1px solid var(--omm-line);
}

.omm-footer a {
	text-decoration: none;
	color: var(--omm-ink-2);
}

.omm-footer a:hover {
	color: var(--omm-ink);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.omm-footer-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: .375rem;
}

/* -------------------------------------------------------------------------
 * Mini-cart drawer
 *
 * The primary cart surface. Sending someone to /cart mid-browse loses the
 * thread; the drawer keeps them where they were.
 * ---------------------------------------------------------------------- */

.omm-drawer[hidden] {
	display: none;
}

.omm-drawer {
	position: fixed;
	inset: 0;
	z-index: 90;
}

.omm-drawer-scrim {
	position: absolute;
	inset: 0;
	background: rgba(25, 28, 22, .38);
	opacity: 0;
	transition: opacity .28s var(--omm-ease);
}

.omm-drawer.is-open .omm-drawer-scrim {
	opacity: 1;
}

.omm-drawer-panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(420px, 100%);
	display: flex;
	flex-direction: column;
	background: var(--omm-surface);
	box-shadow: var(--omm-shadow-lg);
	transform: translateX(100%);
	transition: transform .32s var(--omm-ease);
}

.omm-drawer.is-open .omm-drawer-panel {
	transform: translateX(0);
}

.omm-drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.125rem 1.25rem;
	border-bottom: 1px solid var(--omm-line);
}

.omm-drawer-title {
	margin: 0;
	font-family: var(--omm-serif);
	font-size: 1.25rem;
	font-weight: 500;
	letter-spacing: -.01em;
}

.omm-drawer-close {
	border: 0;
	background: none;
	padding: .25rem;
	color: var(--omm-ink-2);
	cursor: pointer;
	line-height: 0;
}

.omm-drawer-body {
	flex: 1;
	overflow-y: auto;
	padding: 1.25rem;
	-webkit-overflow-scrolling: touch;
}

.omm-drawer-foot {
	border-top: 1px solid var(--omm-line);
	background: var(--omm-surface-2);
	padding: 1.125rem 1.25rem;
	display: grid;
	gap: .75rem;
}

.omm-drawer-foot[hidden] {
	display: none;
}

.omm-drawer-cartlink {
	text-align: center;
	font-size: .8125rem;
	color: var(--omm-ink-2);
	text-underline-offset: 3px;
}

.omm-fineprint {
	margin: 0;
	text-align: center;
	font-size: .6875rem;
	color: var(--omm-muted);
}

.omm-sum-row {
	display: flex;
	justify-content: space-between;
	gap: .75rem;
	font-size: .9375rem;
}

.omm-sum-row > span:first-child {
	color: var(--omm-ink-2);
}

/* Free-shipping meter — occupies the square inches a coupon field usually
   wastes. See inc/woocommerce.php for why. */
.omm-meter-wrap {
	display: grid;
	gap: .5rem;
	margin-bottom: 1.25rem;
}

.omm-meter {
	height: 4px;
	border-radius: 100px;
	background: var(--omm-line);
	overflow: hidden;
}

.omm-meter i {
	display: block;
	height: 100%;
	border-radius: 100px;
	background: var(--omm-oil);
	transition: width .4s var(--omm-ease);
}

.omm-meter-text {
	margin: 0;
	font-size: .78125rem;
	color: var(--omm-ink-2);
}

.omm-meter-text b {
	font-family: var(--omm-mono);
	font-variant-numeric: tabular-nums;
	color: var(--omm-ink);
	font-weight: 500;
}

/* Lines */
.omm-lines {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
}

.omm-line {
	display: grid;
	grid-template-columns: 72px 1fr;
	gap: .875rem;
	padding: 1.125rem 0;
	border-top: 1px solid var(--omm-line);
	transition: opacity .2s var(--omm-ease);
}

.omm-line:first-child {
	border-top: 0;
	padding-top: 0;
}

.omm-line.is-busy,
.omm-line.is-going {
	opacity: .45;
	pointer-events: none;
}

.omm-line-media img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--omm-r-sm);
	background: var(--omm-oil-soft);
	aspect-ratio: 4 / 5;
	object-fit: cover;
}

.omm-line-main {
	display: grid;
	gap: .1875rem;
	align-content: start;
	min-width: 0;
}

.omm-line-top {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: .625rem;
}

.omm-line-name {
	font-size: .9375rem;
	font-weight: 600;
	text-decoration: none;
	color: var(--omm-ink);
}

.omm-line-price {
	font-family: var(--omm-mono);
	font-size: .875rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.omm-line-variant {
	margin: 0;
	font-family: var(--omm-mono);
	font-size: .6875rem;
	letter-spacing: .05em;
	color: var(--omm-muted);
}

.omm-line-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .75rem;
	margin-top: .5rem;
}

.omm-stepper {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--omm-line-2);
	border-radius: var(--omm-r);
	overflow: hidden;
}

.omm-stepper button {
	width: 30px;
	height: 30px;
	border: 0;
	background: none;
	color: var(--omm-ink-2);
	font-size: .9375rem;
	line-height: 1;
	cursor: pointer;
}

.omm-stepper button:hover {
	background: var(--omm-surface-2);
	color: var(--omm-ink);
}

.omm-qty {
	min-width: 30px;
	text-align: center;
	font-family: var(--omm-mono);
	font-size: .8125rem;
	font-variant-numeric: tabular-nums;
	border-left: 1px solid var(--omm-line-2);
	border-right: 1px solid var(--omm-line-2);
	line-height: 30px;
}

.omm-remove {
	border: 0;
	background: none;
	padding: 0;
	font-size: .78125rem;
	color: var(--omm-muted);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.omm-remove:hover {
	color: var(--omm-ink);
}

/* Empty states — the screen a frustrated visitor actually sees. */
.omm-empty {
	display: grid;
	gap: .625rem;
	justify-items: start;
	padding: 2rem 0;
}

.omm-empty-title {
	margin: 0;
	font-family: var(--omm-serif);
	font-size: 1.25rem;
}

.omm-empty-note {
	margin: 0;
	color: var(--omm-ink-2);
	font-size: .875rem;
}

.omm-empty .omm-btn {
	width: auto;
	margin-top: .5rem;
}

/* -------------------------------------------------------------------------
 * Live search
 * ---------------------------------------------------------------------- */

.omm-search[hidden] {
	display: none;
}

.omm-search {
	position: fixed;
	inset: 0;
	z-index: 95;
}

.omm-search-scrim {
	position: absolute;
	inset: 0;
	background: rgba(25, 28, 22, .38);
	opacity: 0;
	transition: opacity .24s var(--omm-ease);
}

.omm-search.is-open .omm-search-scrim {
	opacity: 1;
}

.omm-search-panel {
	position: relative;
	background: var(--omm-surface);
	border-bottom: 1px solid var(--omm-line);
	padding: 1.25rem 1.125rem 1.5rem;
	transform: translateY(-12px);
	opacity: 0;
	transition: transform .24s var(--omm-ease), opacity .24s var(--omm-ease);
}

.omm-search.is-open .omm-search-panel {
	transform: translateY(0);
	opacity: 1;
}

.omm-search-form {
	display: flex;
	align-items: center;
	gap: .75rem;
	max-width: 720px;
	margin: 0 auto;
}

.omm-search-input {
	flex: 1;
	border: 0;
	border-bottom: 1px solid var(--omm-line-2);
	background: none;
	padding: .625rem 0;
	font-family: var(--omm-serif);
	font-size: 1.375rem;
	color: var(--omm-ink);
}

.omm-search-input::placeholder {
	color: var(--omm-muted);
}

.omm-search-close {
	border: 0;
	background: none;
	color: var(--omm-ink-2);
	cursor: pointer;
	font-size: .8125rem;
}

.omm-search-status {
	max-width: 720px;
	margin: .875rem auto 0;
	font-family: var(--omm-mono);
	font-size: .6875rem;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--omm-muted);
	min-height: 1em;
}

.omm-search-results {
	max-width: 720px;
	margin: .75rem auto 0;
	display: grid;
	gap: .25rem;
}

.omm-search-hit {
	display: grid;
	grid-template-columns: 48px 1fr;
	gap: .875rem;
	align-items: center;
	padding: .5rem;
	border-radius: var(--omm-r);
	text-decoration: none;
	color: inherit;
}

.omm-search-hit:hover {
	background: var(--omm-surface-2);
}

.omm-search-hit-media img {
	display: block;
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: var(--omm-r-sm);
	background: var(--omm-oil-soft);
}

.omm-search-hit-copy {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: .75rem;
}

.omm-search-hit-copy b {
	font-size: .9375rem;
	font-weight: 500;
}

/* -------------------------------------------------------------------------
 * Toast
 * ---------------------------------------------------------------------- */

.omm-toast {
	position: fixed;
	left: 50%;
	bottom: 1.5rem;
	z-index: 100;
	transform: translate(-50%, 1rem);
	max-width: min(420px, calc(100vw - 2rem));
	padding: .75rem 1.125rem;
	border-radius: var(--omm-r);
	background: var(--omm-ink);
	color: var(--omm-surface);
	font-size: .875rem;
	box-shadow: var(--omm-shadow-lg);
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s var(--omm-ease), transform .2s var(--omm-ease);
}

.omm-toast.is-visible {
	opacity: 1;
	transform: translate(-50%, 0);
}

.omm-toast.is-error {
	background: #7A2118;
	color: #fff;
}

/* -------------------------------------------------------------------------
 * Pattern atoms
 * ---------------------------------------------------------------------- */

/* Numbered steps. The numerals appear only where the content is genuinely an
   ordered sequence — a routine, a checkout flow — never as decoration. */
.omm-steps {
	counter-reset: omm-step;
}

.omm-steps .omm-step {
	counter-increment: omm-step;
	position: relative;
	padding-top: .875rem;
	border-top: 1px solid var(--omm-line-2);
}

.omm-steps .omm-step::before {
	content: counter(omm-step, decimal-leading-zero);
	display: block;
	margin-bottom: .375rem;
	font-family: var(--omm-mono);
	font-size: .6875rem;
	letter-spacing: .1em;
	color: var(--omm-oil);
}

/* Claim figures. */
.omm-claim {
	padding-top: .875rem;
	border-top: 1px solid var(--omm-line-2);
}

.omm-claim-figure {
	display: block;
	font-family: var(--omm-mono);
	font-size: 1.875rem;
	font-weight: 500;
	letter-spacing: -.02em;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}

.omm-badge {
	display: inline-block;
	padding: .1875rem .5rem;
	border-radius: 100px;
	border: 1px solid rgba(154, 108, 22, .3);
	background: var(--omm-oil-soft);
	color: var(--omm-oil);
	font-family: var(--omm-mono);
	font-size: .5625rem;
	letter-spacing: .09em;
	text-transform: uppercase;
}

.omm-rule {
	border: 0;
	border-top: 1px solid var(--omm-line);
	margin: 0;
}

/* -------------------------------------------------------------------------
 * Motion
 * ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: .001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .001ms !important;
		scroll-behavior: auto !important;
	}
}
