/* Teams: My Account screens and the product page loader.
 *
 * Deliberately plain, per the agreed scope for the first demo. It borrows the
 * brand tokens where they exist and carries its own fallbacks, because
 * homepage.css only loads on the front page and these two surfaces are not it.
 *
 * Nothing here sets a font family: both surfaces already inherit the right one
 * from the theme, and declaring it again would mean a second place to fix when
 * the licensed display face arrives.
 */

.mimi-teams,
.mimi-team-order {
	--mt-copper: var(--copper, #BB8335);
	--mt-rule: rgba(246, 243, 239, .14);
}

/* On a light account page the bone-on-dark rules disappear, so the few places
   that draw a line fall back to the text colour at low alpha instead. */
.woocommerce-account .mimi-teams {
	--mt-rule: color-mix(in srgb, currentColor 18%, transparent);
}

/* ---------------------------------------------------------------- My Account */

.mimi-teams__lede {
	margin: 0 0 24px;
	max-width: 60ch;
}

.mimi-teams__list {
	border-top: 1px solid var(--mt-rule);
	list-style: none;
	margin: 0 0 32px;
	padding: 0;
}

.mimi-teams__item {
	align-items: baseline;
	border-bottom: 1px solid var(--mt-rule);
	display: flex;
	gap: 16px;
	justify-content: space-between;
	padding: 14px 0;
}

.mimi-teams__name {
	font-size: 19.5px;
	text-decoration: none;
}

.mimi-teams__name:hover,
.mimi-teams__name:focus-visible {
	text-decoration: underline;
}

.mimi-teams__meta {
	display: block;
	font-size: 15px;
	opacity: .65;
	margin-top: 2px;
}

.mimi-teams__empty {
	opacity: .7;
	margin: 0 0 28px;
}

.mimi-teams__inline {
	margin: 0;
}

/* A button that has to read as a quiet link, because the loud control on every
   one of these rows is the team name itself. */
/* These are <button> only because the action needs a POST; they read as links.
   account.css styles every submit button in the content area as a copper
   outlined control, which is right for Save and Create team and wrong here:
   one of these is Delete, and a destructive action must not be the loudest
   thing on its row. Carries the #brx-content scope purely to outrank that. */
body.woocommerce-account #brx-content .mimi-teams__link-btn,
.mimi-teams__link-btn {
	background: none;
	border: 0;
	color: inherit;
	cursor: pointer;
	font: inherit;
	font-size: 15px;
	letter-spacing: 0;
	opacity: .6;
	padding: 0;
	text-decoration: underline;
	text-transform: none;
}

body.woocommerce-account #brx-content .mimi-teams__link-btn:hover,
body.woocommerce-account #brx-content .mimi-teams__link-btn:focus-visible,
.mimi-teams__link-btn:hover,
.mimi-teams__link-btn:focus-visible {
	background: none;
	color: inherit;
	opacity: 1;
}

.mimi-teams__field {
	margin: 0 0 18px;
}

.mimi-teams__field label,
.mimi-teams__create label {
	display: block;
	font-size: 15px;
	letter-spacing: .04em;
	margin-bottom: 6px;
	text-transform: uppercase;
}

.mimi-teams__row {
	display: flex;
	gap: 10px;
	max-width: 460px;
}

.mimi-teams__row input[type="text"] {
	flex: 1 1 auto;
	min-width: 0;
}

.mimi-teams__back {
	font-size: 15px;
	margin: 0 0 18px;
}

/* ------------------------------------------------------------------- areas */

.mimi-area {
	border: 1px solid var(--mt-rule);
	margin: 0 0 16px;
	padding: 16px;
}

.mimi-area__head {
	align-items: flex-end;
	display: flex;
	gap: 16px;
	justify-content: space-between;
	margin-bottom: 12px;
}

.mimi-area__name {
	flex: 1 1 auto;
	margin: 0;
	max-width: 360px;
}

.mimi-area__name input {
	width: 100%;
}

.mimi-row {
	align-items: end;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 10px;
}

.mimi-row label {
	display: block;
	margin: 0;
}

.mimi-row label span {
	display: block;
	font-size: 13.5px;
	letter-spacing: .04em;
	margin-bottom: 4px;
	opacity: .7;
	text-transform: uppercase;
}

.mimi-row__qty input {
	width: 92px;
}

.mimi-row__remove {
	padding-bottom: 8px;
}

.mimi-teams__actions {
	display: flex;
	gap: 12px;
	margin-top: 24px;
}

/* --------------------------------------------------- the product page block
 *
 * A <dialog> rather than a Bricks popup on purpose. Bricks wraps popup content
 * in its own white .brx-popup-content box that update-popup-settings cannot
 * reach, its @layer bricks rules cap every element at max-width 100%, and an
 * anchor trigger gets swallowed by data-brx-anchor. A dialog opened with
 * showModal() renders in the browser's top layer, so none of those apply, and
 * it brings focus trapping and escape-to-close with it.
 */

.mimi-team-order {
	border-top: 1px solid var(--mt-rule);
	margin-top: 28px;
	padding-top: 22px;
}

/* The rail trigger. Quieter than Add to cart, which stays the page's one solid
   control, but unmistakably a button. */
/* ------------------------------------------------------- ordering for whom */

/* The switch is the first decision in the buy column, above the colourway, so
   it is drawn as two halves of one control rather than as two buttons. */
.mimi-buy-mode {
	--mt-copper: var(--copper, #BB8335);
	--mt-rule: rgba(246, 243, 239, .14);
	border: 1px solid var(--mt-rule);
	display: grid;
	gap: 1px;
	grid-template-columns: 1fr 1fr;
	margin: 0 0 22px;
}

.mimi-buy-mode__option {
	cursor: pointer;
	font-size: 13.5px;
	letter-spacing: .1em;
	padding: 12px 14px;
	position: relative;
	text-align: center;
	text-transform: uppercase;
	transition: background .15s ease, color .15s ease;
}

/* The radio carries the state and the keyboard behaviour; it is off screen
   rather than display:none, which would take it out of the tab order. */
.mimi-buy-mode__option input {
	height: 1px;
	margin: 0;
	opacity: 0;
	position: absolute;
	width: 1px;
}

.mimi-buy-mode__option:has(input:checked) {
	background: var(--mt-copper);
	color: var(--rich, #0E1010);
}

.mimi-buy-mode__option:has(input:focus-visible) {
	outline: 1px solid var(--mt-copper);
	outline-offset: 2px;
}

/* The panel is a mode, not an extra button: until a team is chosen it is not
   on the page at all. */
.mimi-team-order {
	display: none;
}

.mimi-buy--team .mimi-team-order {
	display: block;
}

/* The roster supplies the size and the count, so Woo's own controls for both
   would be answering a question nobody asked. The colourway row stays: it is
   the one thing a team order still needs from this page. */

/* .variations is carried only to outrank product-sections.php's own
   `<rail> .variations tr{display:block}`, which reflows the variation table
   into stacked blocks and at 0,2,1 beat the plain two-class rule this started
   as. Hiding a row is not something a more specific display rule should undo. */
.mimi-buy--team .variations [data-mimi-row="size"] {
	display: none;
}

/* !important because WooCommerce calls jQuery's .show() on this wrap, which
   writes style="display:block" on the element itself. Coming back from a team
   order is exactly when it does so, so without this the buyer lands on the page
   they just ordered from with Add to cart back and the size gone: the two
   halves of one control disagreeing. An inline style can only be beaten here. */
.mimi-buy--team .single_variation_wrap {
	display: none !important;
}

.mimi-team-order__open {
	background: none;
	border: 1px solid var(--mt-rule);
	color: inherit;
	cursor: pointer;
	display: block;
	font: inherit;
	font-size: 13.5px;
	letter-spacing: .1em;
	padding: 13px 18px;
	text-transform: uppercase;
	text-align: left;
	transition: border-color .15s ease;
	width: 100%;
}

.mimi-team-order__open:hover,
.mimi-team-order__open:focus-visible {
	border-color: var(--mt-copper);
}

.mimi-team-order__count {
	display: block;
	font-size: 13.5px;
	letter-spacing: 0;
	margin-top: 3px;
	opacity: .55;
	text-transform: none;
}

/* ------------------------------------------------------------------ modal */

.mimi-team-modal {
	/* Without this the checkboxes render in the browser's own blue, which is the
	   one thing on the panel that does not belong to the brand. */
	accent-color: var(--mt-copper);
	background: #1C2120;
	border: 1px solid rgba(246, 243, 239, .16);
	color: var(--bone, #F6F3EF);
	max-height: min(82vh, 760px);
	max-width: min(92vw, 560px);
	padding: 0;
	width: 100%;
}

.mimi-team-modal::backdrop {
	background: rgba(14, 16, 16, .72);
}

.mimi-team-modal__form {
	display: flex;
	flex-direction: column;
	max-height: inherit;
}

.mimi-team-modal__head {
	align-items: center;
	border-bottom: 1px solid var(--mt-rule);
	display: flex;
	gap: 16px;
	justify-content: space-between;
	padding: 20px 24px 16px;
}

.mimi-team-modal__title {
	font-size: 15px;
	/* Focused on open so the panel is announced. It is a heading, not a control,
	   so it carries no ring; this also overrides Bricks' blanket outline:auto,
	   which sits in @layer bricks and so loses to any unlayered declaration. */
	outline: none;
	letter-spacing: .1em;
	margin: 0;
	text-transform: uppercase;
}

.mimi-team-modal__close {
	background: none;
	border: 0;
	color: inherit;
	cursor: pointer;
	font-size: 26px;
	line-height: 1;
	opacity: .6;
	padding: 0 4px;
}

.mimi-team-modal__close:hover,
.mimi-team-modal__close:focus-visible {
	opacity: 1;
}

.mimi-team-modal__product {
	border-bottom: 1px solid var(--mt-rule);
	font-size: 16px;
	margin: 0;
	padding: 14px 24px;
}

.mimi-team-modal__colour {
	color: var(--mt-copper);
}

.mimi-team-modal__colour.is-missing {
	color: inherit;
	display: block;
	font-size: 13.5px;
	margin-top: 4px;
	opacity: .6;
}

/* ------------------------------------------------- colourway, in the panel
 *
 * The colourway lives in here rather than being read off the product form. A
 * dialog opened with showModal() makes the rest of the document inert, so the
 * old note telling a buyer to "choose a colourway on the page behind this" was
 * asking for something they could not physically do without closing the panel.
 * The roster supplies the sizes, so this is the only variation choice the team
 * path ever needs, and the page's size control plays no part in it.
 */

.mimi-team-modal__colourways {
	border: 0;
	border-bottom: 1px solid var(--mt-rule);
	margin: 0 -24px 18px;
	padding: 0 24px 18px;
}

.mimi-team-modal__legend {
	align-items: baseline;
	display: flex;
	font-size: 13px;
	gap: 10px;
	letter-spacing: .12em;
	margin-bottom: 12px;
	padding: 0;
	text-transform: uppercase;
}

.mimi-team-modal__chosen {
	color: var(--mt-copper);
	letter-spacing: 0;
	text-transform: none;
}

.mimi-team-modal__chosen.is-missing {
	color: inherit;
	opacity: .5;
}

.mimi-team-modal__swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.mimi-swatch {
	cursor: pointer;
	display: block;
	line-height: 0;
}

/* The radio carries the state and the keyboard behaviour; the chip beside it is
   what gets drawn. Clipped rather than display:none so it stays focusable. */
.mimi-swatch input {
	height: 1px;
	margin: 0;
	opacity: 0;
	position: absolute;
	width: 1px;
}

.mimi-swatch__chip {
	border: 1px solid rgba(246, 243, 239, .28);
	display: block;
	height: 26px;
	transition: box-shadow .15s ease, border-color .15s ease;
	width: 26px;
}

/* A swatch is a colour, so its name is for assistive tech and the tooltip. */
.mimi-swatch .mimi-swatch__name {
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

/* A colourway term with no swatch colour set. Bricks' own fallback here is a
   hardcoded white square, which reads as a real and selectable colour, so this
   shows the name instead of inventing one. */
.mimi-swatch--named {
	border: 1px solid var(--mt-rule);
	line-height: 1;
	padding: 7px 11px;
}

.mimi-swatch--named .mimi-swatch__name {
	clip: auto;
	clip-path: none;
	font-size: 13.5px;
	height: auto;
	overflow: visible;
	position: static;
	width: auto;
}

.mimi-swatch:hover .mimi-swatch__chip {
	border-color: rgba(246, 243, 239, .6);
}

.mimi-swatch input:checked + .mimi-swatch__chip {
	border-color: var(--mt-copper);
	box-shadow: 0 0 0 2px var(--mt-copper);
}

.mimi-swatch input:focus-visible + .mimi-swatch__chip {
	box-shadow: 0 0 0 2px var(--mt-copper);
}

.mimi-swatch--named:has(input:checked) {
	border-color: var(--mt-copper);
	color: var(--mt-copper);
}

/* The one scrolling region. However many teams a customer has, the heading,
   the garment and the action bar all stay put. */
.mimi-team-modal__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 18px 24px;
}

.mimi-team-modal__foot {
	align-items: center;
	border-top: 1px solid var(--mt-rule);
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	justify-content: space-between;
	padding: 16px 24px 20px;
}

.mimi-team-modal__tally {
	font-size: 15px;
	margin: 0;
	opacity: .7;
}

.mimi-team-modal__actions {
	align-items: center;
	display: flex;
	gap: 18px;
}

.mimi-team-order__teams,
.mimi-team-order__areas {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mimi-team-order__team + .mimi-team-order__team {
	border-top: 1px solid var(--mt-rule);
	margin-top: 16px;
	padding-top: 16px;
}

.mimi-team-order__all {
	align-items: center;
	cursor: pointer;
	display: flex;
	font-size: 17px;
	gap: 9px;
}

.mimi-team-order__areas {
	margin: 10px 0 0 24px;
}

.mimi-team-order__areas li + li {
	margin-top: 9px;
}

.mimi-team-order__areas label {
	align-items: baseline;
	cursor: pointer;
	display: grid;
	gap: 0 9px;
	grid-template-columns: auto 1fr;
}

.mimi-team-order__areas input {
	grid-column: 1;
	grid-row: 1;
}

.mimi-team-order__area-name {
	grid-column: 2;
	grid-row: 1;
}

/* The roster line sits under its area name rather than beside it, so a long
   split like "2 x Women XS, 3 x Women M, 1 x Women L" wraps in its own column
   instead of pushing the checkbox out of line. */
.mimi-team-order__area-rows {
	font-size: 13.5px;
	grid-column: 2;
	grid-row: 2;
	opacity: .6;
}

.mimi-team-order__load {
	background: var(--mt-copper);
	border: 1px solid var(--mt-copper);
	color: #0E1010;
	cursor: pointer;
	font: inherit;
	font-size: 13.5px;
	letter-spacing: .1em;
	padding: 11px 22px;
	text-transform: uppercase;
}

.mimi-team-order__load[disabled] {
	background: none;
	border-color: var(--mt-rule);
	color: inherit;
	cursor: not-allowed;
	opacity: .4;
}

.mimi-team-order__manage {
	font-size: 15px;
	opacity: .65;
}

.mimi-team-order__manage:hover,
.mimi-team-order__manage:focus-visible {
	opacity: 1;
}

@media (max-width: 520px) {
	.mimi-team-modal__foot {
		flex-direction: column;
		align-items: stretch;
	}

	.mimi-team-modal__actions {
		justify-content: space-between;
	}
}


/* Save team is the primary action on the edit screen and has to look like it. */
.mimi-teams__save,
.mimi-teams__create button {
	background: none;
	border: 1px solid var(--mt-copper);
	color: var(--mt-copper);
	cursor: pointer;
	font: inherit;
	font-size: 13.5px;
	letter-spacing: .1em;
	padding: 11px 22px;
	text-transform: uppercase;
	/* The flex row would otherwise break "Create team" across two lines. */
	white-space: nowrap;
	transition: background-color .15s ease, color .15s ease;
}

.mimi-teams__save:hover,
.mimi-teams__save:focus-visible,
.mimi-teams__create button:hover,
.mimi-teams__create button:focus-visible {
	background: var(--mt-copper);
	color: #0E1010;
}

.mimi-teams__add-area {
	background: none;
	border: 1px solid var(--mt-rule);
	color: inherit;
	cursor: pointer;
	font: inherit;
	font-size: 13.5px;
	letter-spacing: .1em;
	padding: 11px 22px;
	text-transform: uppercase;
}

.mimi-teams__add-area:hover,
.mimi-teams__add-area:focus-visible {
	border-color: var(--mt-copper);
	color: var(--mt-copper);
}

/* showModal() moves focus to the first focusable child, which is the close
   button, so its ring is on screen the moment the modal opens. Left to the
   browser that renders as a white box over a dark panel. Copper gives keyboard
   users a clear target that belongs to the brand. The heading is excluded: it
   takes focus on open purely so the panel is announced. */
.mimi-team-modal :focus-visible:not([data-mimi-title]) {
	outline: 2px solid var(--mt-copper);
	outline-offset: 2px;
}

.mimi-team-modal__close:focus-visible {
	outline-offset: 0;
}

/* Firefox and Safari still paint a default ring on the dialog itself when it
   takes focus; it is never a useful target. */
.mimi-team-modal:focus,
.mimi-team-modal:focus-visible {
	outline: none;
}

/* What the last load did. These live in the rail, not the modal, because the
   modal is closed by the time the redirect lands. Rendered from this module's
   own one-shot store rather than WooCommerce's notice queue: Bricks strips the
   notice printer from every Woo hook and consumes the queue in an earlier
   render pass, so a wc_add_notice() here would be stored and never shown. */
.mimi-team-order__notices {
	list-style: none;
	margin: 0 0 18px;
	padding: 0;
}

.mimi-team-order__notice {
	border-left: 2px solid var(--mt-rule);
	font-size: 15px;
	margin: 0 0 8px;
	padding: 7px 0 7px 12px;
}

.mimi-team-order__notice:last-child {
	margin-bottom: 0;
}

.mimi-team-order__notice--success {
	border-left-color: var(--mt-copper);
}

.mimi-team-order__notice--notice {
	opacity: .68;
}

.mimi-team-order__notice--error {
	border-left-color: #C4553D;
}
