/**
 * Diilikaubamaja design system v3.4 - the shared components.
 *
 * Which one to use, in order, stop at the first yes:
 *   1. You type or set a value            -> .dkm-field / .dkm-qty   (radius-sm)
 *   2. A choice, a filter, where you are  -> .dkm-chip               (pill)
 *   3. The action this section exists for -> .dkm-btn--primary       (one per section)
 *   4. Saves or changes something         -> .dkm-btn--secondary
 *   5. Everything else (cancel, dismiss, share, show more, remove)
 *                                         -> .dkm-btn--tertiary
 * Every button is radius-sm; levels differ by fill only. Colours come from the
 * component tokens on DKM > Design tokens.
 *
 * Every element is built from a component. Plugin widgets read the component
 * tokens themselves; Elementor V4 elements use the Global Classes of the same
 * names (dkm-btn, dkm-btn-primary, dkm-card ...); classic widgets, popups, HTML
 * widgets and snippets use these classes. Local styles are for layout only:
 * width, spacing, flex - never colour, border or radius.
 */

/* ---------------------------------------------------------------- buttons */

:where(.dkm-btn) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-sizing: border-box;
	min-height: var(--control-md);
	margin: 0;
	padding: 0 18px;
	border: 0;
	border-radius: var(--button-radius);
	font-family: var(--font-sans);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}

.dkm-btn.dkm-btn--sm { min-height: var(--control-sm); padding: 0 12px; font-size: 14px; }
.dkm-btn.dkm-btn--lg { min-height: var(--control-lg); padding: 0 24px; font-size: 16px; }
.dkm-btn.dkm-btn--block { display: flex; width: 100%; }

.dkm-btn.dkm-btn--primary { background: var(--button-primary-bg); color: var(--button-primary-text); font-weight: 700; }
.dkm-btn.dkm-btn--primary:hover { background: var(--button-primary-hover-bg); color: var(--button-primary-text); }
.dkm-btn.dkm-btn--primary:active { background: var(--button-primary-press-bg); }

.dkm-btn.dkm-btn--secondary { background: var(--button-secondary-bg); color: var(--button-secondary-text); }
.dkm-btn.dkm-btn--secondary:hover { background: var(--button-secondary-hover-bg); color: var(--button-secondary-text); }
.dkm-btn.dkm-btn--secondary:active { background: var(--button-secondary-press-bg); }

.dkm-btn.dkm-btn--tertiary { background: var(--button-tertiary-bg); color: var(--button-tertiary-text); }
.dkm-btn.dkm-btn--tertiary:hover { background: var(--button-tertiary-hover-bg); color: var(--button-tertiary-hover-text); }
.dkm-btn.dkm-btn--tertiary:active { background: var(--bg-press); }

.dkm-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* Motion: the add-to-cart button's (tokens motion-*). Its own rule, not in the
   :where() above: at zero weight it lost to Hello's `button { transition: all
   .3s }` on every <button>, so "Vaata Diile" moved unlike "Tutvu lähemalt". */
.dkm-btn,
.dkm-button {
	transition: var(--motion-control);
}

.dkm-btn:active:not([disabled]):not([aria-disabled="true"]),
.dkm-button:active:not([disabled]):not([aria-disabled="true"]) {
	transform: scale(var(--motion-press-scale));
}

.dkm-btn[disabled],
.dkm-btn[aria-disabled="true"] { background: var(--bg-subtle); color: var(--text-disabled); cursor: not-allowed; }
.dkm-btn.dkm-btn--tertiary[disabled],
.dkm-btn.dkm-btn--tertiary[aria-disabled="true"] { background: transparent; }

/* ----------------------------------------------------------------- fields */

:where(.dkm-field) {
	box-sizing: border-box;
	min-height: var(--control-md);
	padding: 0 12px;
	border: var(--border-hairline) solid var(--input-border);
	border-radius: var(--input-radius);
	background: var(--input-bg);
	color: var(--input-text);
	font-family: var(--font-sans);
	font-size: 16px;
}

.dkm-field:hover:not(:focus) { border-color: var(--input-hover-border); }
.dkm-field:focus { background: var(--input-focus-bg); }
.dkm-field:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 0; }
.dkm-field[aria-invalid="true"] { border: var(--border-thick) solid var(--text-danger); }

/* A quantity is a field: minus and plus belong to it, radius-xs inside its radius-sm. */
:where(.dkm-qty) {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	height: var(--control-md);
	padding: 3px;
	border: var(--border-hairline) solid var(--input-border);
	border-radius: var(--input-radius);
	background: var(--input-bg);
}

.dkm-qty:hover:not(:focus-within) { border-color: var(--input-hover-border); }
.dkm-qty:focus-within { background: var(--input-focus-bg); }
.dkm-qty.dkm-qty--sm { height: var(--control-sm); }
.dkm-qty.dkm-qty--lg { height: var(--control-lg); }
.dkm-qty button { display: flex; align-items: center; justify-content: center; height: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--text-primary); cursor: pointer; }
.dkm-qty button:hover:not(:disabled) { background: var(--button-tertiary-hover-bg); }
.dkm-qty button:disabled { color: var(--text-disabled); cursor: not-allowed; }
.dkm-qty input { width: 3ch; border: 0; background: transparent; text-align: center; font: 700 16px/1 var(--font-sans); color: var(--text-primary); }

/* ------------------------------------------------------------------ chips */

:where(.dkm-chip) {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	box-sizing: border-box;
	min-height: var(--control-sm);
	padding: 0 12px;
	border: var(--border-hairline) solid var(--chip-border);
	border-radius: var(--chip-radius);
	background: var(--chip-bg);
	color: var(--text-secondary);
	font-family: var(--font-sans);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.dkm-chip:hover { border-color: var(--border-control); color: var(--text-primary); }
.dkm-chip.is-selected,
.dkm-chip[aria-pressed="true"] { border-color: var(--chip-selected-bg); background: var(--chip-selected-bg); color: var(--chip-selected-text); }
.dkm-chip:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* -------------------------------------------------------------- the badge */

:where(.dkm-deal-badge) { display: inline-flex; align-items: center; padding: 2px 6px; border-radius: var(--badge-radius); background: var(--deal-badge-bg); color: var(--deal-badge-text); font: 700 13px/1.2 var(--font-sans); }

/* ------------------------------------------------------------- containers */

:where(.dkm-card) { background: var(--card-bg); border: var(--border-hairline) solid var(--card-border); border-radius: var(--card-radius); }
/* Over Elementor's container default (.e-con: .3s, transform .4s). */
html body .dkm-card { transition: var(--motion-control); }
.dkm-card:hover { border-color: var(--border-default); }
:where(.dkm-panel) { background: var(--card-bg); border: var(--border-hairline) solid var(--card-border); border-radius: var(--card-radius); padding: 24px; }
:where(.dkm-panel-brand) { background: var(--bg-brand); color: var(--text-primary); border-radius: var(--card-radius); }
/* Classic containers (popups) carry their own element selector, hence the doubled class. */
.dkm-modal.dkm-modal { border-radius: var(--modal-radius); background-color: var(--bg-surface); overflow: hidden; }
:where(.dkm-hero) { border-radius: var(--radius-xl); overflow: hidden; }

/* ------------------------------------------------------------------ pills */

:where(.dkm-pill-brand) { display: inline-block; padding: 2px 8px; border-radius: var(--radius-full); background: var(--bg-brand); color: var(--text-primary); font: 700 13px/1.3 var(--font-sans); }
:where(.dkm-logo-pill) { border-radius: var(--radius-full); background: var(--bg-brand); }
:where(.dkm-badge) { display: inline-flex; align-items: center; padding: 2px 6px; border-radius: var(--badge-radius); background: var(--deal-badge-bg); color: var(--deal-badge-text); font: 700 13px/1.2 var(--font-sans); }

/* ----------------------------------------------------------------- motion */

/* Everything the theme, WooCommerce, the Elementor kit or a third party draws
   moves like our own controls. Left to them, every button changed colour at a
   speed of its own: Hello's `button { transition: all .3s }`, FunnelKit's
   `.wfty_wrap a { all .4s ease-in-out }` (the invoice buttons on the thank-you
   page), the side cart's `.2s ease-out`, Elementor's `.elementor-icon
   { all .3s }`. Weighed to win over those and lose to any component of ours,
   which names its own transition (the same tokens). */
html body :is(button, [type="button"], [type="submit"], [type="reset"], .button) {
	transition: var(--motion-control);
}

/* Links weigh no more than the element: any class that names a transition
   of its own keeps it. Fields as Hello's `[type="email"], select ...` do. */
html body :where(a, summary) {
	transition: var(--motion-control);
}

/* Elementor's atomic links (a linked heading or paragraph: the footer, the
   product card title) reset every property, transition included, at class
   weight (.elementor .e-paragraph-link-base). */
html body .elementor :is(.e-paragraph-link-base, .e-heading-link-base) {
	transition: var(--motion-control);
}

html body .elementor-icon,
html body .jet-checkboxes-list__button,
html body :is(input:not([type="checkbox"], [type="radio"], [type="range"]), select, textarea) {
	transition: var(--motion-control);
}

html body .wfty_wrap a,
html body .wfty_wrap a.button {
	transition: var(--motion-control);
}

body #fkcart-modal .fkcart-checkout-wrap #fkcart-checkout-button {
	transition: var(--motion-control);
}

/* FunnelKit checkout names `.3s ease-in` on its links and buttons by id
   (#wfacp-e-form a, #wfacp-e-form button:not(.wfacp_btn_clicked) and the
   submit button inside .wfacp_main_form); its order bump names none, and
   EveryPay's payment cards fade their ring over .3s. A clicked (loading)
   button keeps FunnelKit's own. */
html body #wfacp-e-form :is(a:not(.button-social-login), button:not(.wfacp_btn_clicked)),
html body #wfacp-e-form .wfacp_main_form :is(button[type="submit"]:not(.wfacp_btn_clicked), input[type="button"], input[type="submit"]),
html body .wfacp_delete_item_wrap a,
html body .everypay-wrapper :is(label.payment-method-option, label.payment-token-option) {
	transition: var(--motion-control);
}

/* The order bump's button: FunnelKit says `transition: none !important`, so
   only an !important one step heavier reaches it. Colours only fade; its
   label swap is FunnelKit's. */
html body #wfob_wrap .wfob_wrapper .wfob_l3_s_btn .wfob_l3_f_btn.wfob_bump_product {
	transition: var(--motion-control) !important;
}

/* A link inside a paragraph or heading's own text: Elementor unsets its
   transition with `.e-paragraph-base a`. */
html body :is(.e-paragraph-base, .e-heading-base) a {
	transition: var(--motion-control);
}

/* The design system bridge (Elementor custom code) gives the search and
   newsletter fields `.15s`; this is the same rule, one step heavier. */
html body .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input,
html body .fluentform .ff-el-form-control {
	transition: var(--motion-control);
}

/* A press, as the add-to-cart button has one: the newsletter submit and
   FunnelKit's buttons. */
html body #wfacp-e-form .wfacp_main_form #place_order:active:not(:disabled),
html body .fluentform .ff-btn-submit:active,
html body .wfty_wrap a.button:active,
body #fkcart-modal .fkcart-checkout-wrap #fkcart-checkout-button:active {
	transform: scale(var(--motion-press-scale));
}

/* Reduced motion: colours change at once and nothing scales. */
@media (prefers-reduced-motion: reduce) {
	html:root:root {
		--motion-hover: 0s;
		--motion-press: 0s;
		--motion-press-scale: 1;
	}
}
