/*
 * Quiz (/quiz/, .dm-qz), compare (/compare/, .dm-cp) and the compare tray +
 * card toggle (.dm-cmp, .dm-cmpb) on every page with coffee cards (lane P3-a).
 * Colours from --dm-* tokens only (dark mode allowed); logical properties for RTL.
 */

.dx .dm-x [hidden], .dx .dm-cmp[hidden], body.dx .dm-qz ul.products li.product.dm-cell[hidden] { display: none; }

/* ---------- QUIZ ---------- */
.dx .dm-qz__hero { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(24px, 5vw, 72px); align-items: start; padding-block: 24px clamp(44px, 6vw, 72px); }
.dx .dm-qz__intro { position: sticky; top: 110px; }
.dx .dm-qz__intro .dx-lead { margin-block: 12px 0; }
.dx .dm-qz__how { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 4px; border-block-start: 1px solid var(--dm-border); }
.dx .dm-qz__how li { display: flex; gap: 14px; align-items: baseline; padding-block: 12px; border-block-end: 1px solid var(--dm-border); color: var(--dm-muted); font-weight: 600; transition: color .25s; }
.dx .dm-qz__how li span { font-size: 13px; font-variant-numeric: tabular-nums; min-width: 2ch; }
.dx .dm-qz__how li.is-on { color: var(--dm-text); }
.dx .dm-qz__how li.is-on span { color: var(--dm-accent); }
.dx .dm-qz__how li.is-done { text-decoration: line-through; text-decoration-color: var(--dm-accent); }

.dx .dm-qz__box { padding: clamp(20px, 3vw, 36px); box-shadow: 0 24px 60px -30px var(--dm-shadow); }
.dx .dm-qz__prog { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-block-end: 26px; }
.dx .dm-qz__prog i { height: 6px; border-radius: 3px; background: var(--dm-meter-0); transition: background .3s; }
.dx .dm-qz__prog i:first-child,
.dx .dm-qz__prog[aria-valuenow="2"] i:nth-child(-n+2),
.dx .dm-qz__prog[aria-valuenow="3"] i { background: var(--dm-accent); }
.dx .dm-qz__step { border: 0; margin: 0; padding: 0; min-width: 0; animation: dm-qz-step .35s ease both; }
.dx .dm-qz__step legend { padding: 0; margin-block-end: 20px; outline: 0; }
.dx .dm-qz__n { display: block; font-size: 13px; color: var(--dm-muted); margin-block-end: 6px; }
.dx .dm-qz__q { display: block; font-size: clamp(22px, 2.2vw, 30px); font-weight: 700; line-height: 1.25; }
.dx .dm-qz__opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.dx .dm-qz__opt { min-height: 64px; font-weight: 600; transition: border-color .15s, background .15s, transform .15s; }
.dx .dm-qz__opt:hover { border-color: var(--dm-text); }
.dx .dm-qz__opt:has(input:checked) { background: var(--dm-surface); box-shadow: inset 0 0 0 1px var(--dm-text); }
.dx .dm-qz__opt:has(input:focus-visible) { outline: 3px solid var(--dm-focus); outline-offset: 2px; }
.dx .dm-qz__opt:active { transform: scale(.985); }
.dx .dm-qz__opt input { flex: none; margin: 0; }
.dx .dm-qz__nav { display: flex; gap: 10px; margin-block-start: 22px; }
.dx .dm-qz__nav [data-next] { margin-inline-start: auto; }
.dx .dm-qz__nav [data-next]:disabled { opacity: .4; cursor: not-allowed; }
@keyframes dm-qz-step { from { opacity: 0; transform: translateX(calc(var(--dm-x) * 18px)); } }

.dx .dm-qz__res { scroll-margin-top: 80px; }
.dx .dm-qz__res .dx-h2 { margin-block: 2px 8px; outline: 0; }
.dx .dm-qz__why { color: var(--dm-text-2); max-width: 62ch; margin-block-end: 26px; }
.dx .dm-qz__res.is-picked ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 980px; }
.dx .dm-qz__res.is-picked li.dm-cell:not([hidden]) { animation: dm-qz-in .5s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 90ms); }
@keyframes dm-qz-in { from { opacity: 0; transform: translateY(18px); } }
.dx .dm-qz__ctas { margin-block-start: 30px; display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; justify-content: space-between; background: var(--dm-card); border: 1px solid var(--dm-border); border-radius: 22px; padding: clamp(18px, 2.4vw, 26px); }
.dx .dm-qz__sub b { display: block; font-size: 18px; }
.dx .dm-qz__sub span { color: var(--dm-text-2); font-size: 14.5px; }
.dx .dm-qz__again { all: unset; cursor: pointer; font-weight: 600; font-size: 14px; border-block-end: 1.5px solid currentColor; padding-block-end: 2px; }
.dx .dm-qz__again:focus-visible { outline: 3px solid var(--dm-focus); outline-offset: 3px; }

@media (max-width: 960px) {
	.dx .dm-qz__hero { grid-template-columns: 1fr; }
	.dx .dm-qz__intro { position: static; }
	.dx .dm-qz__how { display: none; }
	.dx .dm-qz__res.is-picked ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- COMPARE ---------- */
.dx .dm-cp__wrap { padding-block: 24px clamp(44px, 6vw, 72px); }
.dx .dm-cp__top { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; justify-content: space-between; margin-block-end: 22px; }
.dx .dm-cp__h1 { font-size: clamp(30px, 3.6vw, 46px); margin-block-start: 2px; }
.dx .dm-cp__tools { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; }
.dx .dm-cp__add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; font-weight: 600; }
.dx .dm-cp__add select { min-height: 44px; max-width: 220px; border: 1.5px solid var(--dm-border); border-radius: 12px; padding-inline: 10px; background: var(--dm-card); color: var(--dm-text); font: inherit; font-weight: 400; }
.dx .dm-cp__tog { display: inline-flex; gap: 10px; align-items: center; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 44px; }
.dx .dm-cp__tog input { width: 20px; height: 20px; margin: 0; accent-color: var(--dm-text); }

.dx .dm-cp__scroll { position: relative; overflow-x: auto; border: 1px solid var(--dm-border); border-radius: 24px; background: var(--dm-card); }
.dx .dm-cp__scroll:focus-visible { outline: 3px solid var(--dm-focus); outline-offset: 2px; }
.dx .dm-cp__t { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; table-layout: fixed; }
.dx .dm-cp__t.cols-2 { min-width: 520px; }
.dx .dm-cp__t.cols-3 { min-width: 720px; }
.dx .dm-cp__t th, .dx .dm-cp__t td { padding: 14px 16px; border: 0; border-block-end: 1px solid var(--dm-border); text-align: center; vertical-align: top; font-size: 15px; color: var(--dm-text); background: var(--dm-card); }
.dx .dm-cp__t tbody tr:last-child > * { border-block-end: 0; }
.dx .dm-cp__t thead td, .dx .dm-cp__t th[scope=row] { width: 150px; }
.dx .dm-cp__t th[scope=row] { position: sticky; inset-inline-start: 0; z-index: 1; text-align: start; font-weight: 600; font-size: 13.5px; color: var(--dm-muted); background: var(--dm-surface); }
.dx .dm-cp__t thead td { background: var(--dm-surface); }
.dx .dm-cp__t thead > tr > * { border-block-end: 2px solid var(--dm-text); }
.dx .dm-cp__head { font-weight: 400; }
.dx .dm-cp__img { display: block; width: min(150px, 100%); aspect-ratio: 1; margin: 0 auto 10px; border-radius: 18px; overflow: hidden; background: var(--dm-well, var(--dm-subtle)); }
.dx .dm-cp__img img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.dx .dm-cp__name { display: block; font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--dm-text); text-decoration: none; }
.dx .dm-cp__name:hover { text-decoration: underline; }
.dx .dm-cp__rm { display: inline-flex; align-items: center; min-height: 32px; margin-block-start: 4px; font-size: 13px; color: var(--dm-muted); text-decoration: underline; }
.dx .dm-cp__rm:hover { color: var(--dm-text); }
.dx .dm-cp__na { color: var(--dm-placeholder); }
.dx .dm-cp__t tr.is-diff td { background: color-mix(in srgb, var(--dm-accent) 5%, var(--dm-card)); }
.dx .dm-cp__t.cols-2 tr.is-diff th[scope=row]::after, .dx .dm-cp__t.cols-3 tr.is-diff th[scope=row]::after,
.dx .dm-cp__key i { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dm-accent); margin-inline-start: 6px; vertical-align: 2px; }
.dx .dm-cp__t.cols-1 tr.is-diff td { background: var(--dm-card); }
.dx .dm-cp:has(#dm-cp-diff:checked) tr.is-same { display: none; }
.dx .dm-cp__meter { width: 110px; margin: 2px auto 6px; }
.dx .dm-cp__taste { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; font-size: 12.5px; }
.dx .dm-cp__taste > * { padding: 3px 9px; border-radius: 999px; background: var(--dm-subtle); color: var(--dm-muted); font-weight: 400; }
.dx .dm-cp__taste b { background: var(--dm-accent); color: var(--dm-on-accent); font-weight: 700; }
.dx .dm-cp__buy td { padding-block: 18px 22px; }
.dx .dm-cp__pr { display: block; font-size: 18px; font-weight: 700; margin-block-end: 10px; }
.dx .dm-cp__key { margin-block-start: 14px; font-size: 13.5px; color: var(--dm-muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.dx .dm-cp__key i { margin: 0; vertical-align: 0; }
.dx .dm-cp__key .dx-more { color: var(--dm-text); }

/* Empty state: pick 2–3 coffees */
.dx .dm-cp__pick .dx-lead { margin-block-end: 20px; }
.dx .dm-cp__pick fieldset { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
.dx .dm-cp__grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 10px; }
.dx .dm-cp__tile { position: relative; display: flex; gap: 12px; align-items: center; padding-block: 10px; padding-inline: 10px 14px; border: 1.5px solid var(--dm-border); border-radius: 16px; background: var(--dm-card); cursor: pointer; transition: border-color .15s; }
.dx .dm-cp__tile:hover { border-color: var(--dm-text); }
.dx .dm-cp__tile input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.dx .dm-cp__tile img { width: 64px; height: 64px; flex: none; object-fit: contain; border-radius: 12px; }
.dx .dm-cp__tile > span { display: grid; gap: 3px; min-width: 0; flex: 1; }
.dx .dm-cp__tile b { font-size: 15px; line-height: 1.3; }
.dx .dm-cp__tile small { font-size: 12.5px; color: var(--dm-muted); }
.dx .dm-cp__tile .dx-meter { max-width: 90px; }
.dx .dm-cp__tile::after { content: ""; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--dm-border); }
.dx .dm-cp__tile:has(input:checked) { border-color: var(--dm-text); box-shadow: inset 0 0 0 1px var(--dm-text); }
.dx .dm-cp__tile:has(input:checked)::after { background: var(--dm-accent); border-color: var(--dm-accent); box-shadow: inset 0 0 0 4px var(--dm-card); }
.dx .dm-cp__tile:has(input:focus-visible) { outline: 3px solid var(--dm-focus); outline-offset: 2px; }
.dx .dm-cp__tile:has(input:disabled) { opacity: .45; cursor: not-allowed; }

@media (max-width: 760px) {
	.dx .dm-cp__t th, .dx .dm-cp__t td { padding: 12px 10px; font-size: 14px; }
	.dx .dm-cp__t thead td, .dx .dm-cp__t th[scope=row] { width: 92px; }
	.dx .dm-cp__t.cols-2 { min-width: 0; }
	.dx .dm-cp__t.cols-3 { min-width: 560px; }
	.dx .dm-cp__name { font-size: 15px; }
	.dx .dm-cp__meter { width: 80px; }
	.dx .dm-cp__add { width: 100%; }
	.dx .dm-cp__add label { flex-basis: 100%; }
	.dx .dm-cp__add select { flex: 1 1 0; min-width: 0; max-width: none; }
	.dx .dm-cp__taste span { display: none; } /* only the coffee's own character on small screens */
}

/* ---------- CARD TOGGLE "⇄ Compare" ---------- */
.dx .dm-cmpb { all: unset; box-sizing: border-box; position: absolute; top: 10px; inset-inline-end: 10px; z-index: 2; display: inline-flex; gap: 5px; align-items: center; justify-content: center; min-height: 32px; padding: 0 11px; border-radius: 999px; background: var(--dm-card); color: var(--dm-text); border: 1.5px solid var(--dm-text); font-size: 12.5px; font-weight: 700; cursor: pointer; transition: background .15s, color .15s; }
.dx .dm-cmpb:hover { background: var(--dm-subtle); }
.dx .dm-cmpb[aria-pressed="true"] { background: var(--dm-text); color: var(--dm-card); }
.dx .dm-cmpb:focus-visible { outline: 3px solid var(--dm-focus); outline-offset: 2px; }
@media (max-width: 760px) {
	.dx .dm-cmpb { width: 34px; height: 34px; min-height: 0; padding: 0; font-size: 0; gap: 0; top: 8px; inset-inline-end: 8px; }
	.dx .dm-cmpb span { font-size: 16px; }
}

/* ---------- TRAY ---------- */
.dx .dm-cmp { position: fixed; bottom: 18px; inset-inline: 0; margin: 0 auto; width: fit-content; max-width: calc(100% - 24px); z-index: 66; display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 22px; background: var(--dm-inverse-bg); color: var(--dm-inverse-text); border: 1px solid var(--dm-inverse-border); box-shadow: 0 14px 40px var(--dm-shadow); animation: dm-cmp-in .35s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes dm-cmp-in { from { transform: translateY(140%); } }
.dx .dm-cmp__slots { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.dx .dm-cmp__slot { position: relative; width: 56px; height: 56px; border-radius: 14px; border: 1.5px dashed var(--dm-inverse-muted); }
.dx .dm-cmp__slot:has(img) { border: 0; background: var(--dm-btn-white-bg); }
.dx .dm-cmp__slot img { width: 100%; height: 100%; object-fit: contain; border-radius: 14px; }
.dx .dm-cmp__rm { all: unset; cursor: pointer; position: absolute; top: -7px; inset-inline-end: -7px; width: 22px; height: 22px; border-radius: 50%; background: var(--dm-accent); color: var(--dm-on-accent); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.dx .dm-cmp__rm:focus-visible, .dx .dm-cmp__clr:focus-visible, .dx .dm-cmp__go:focus-visible { outline: 3px solid var(--dm-focus); outline-offset: 2px; }
.dx .dm-cmp__go { display: inline-flex; align-items: center; min-height: 46px; padding: 0 20px; border-radius: 999px; background: var(--dm-btn-white-bg); color: var(--dm-btn-white-text); font-weight: 700; font-size: 15px; white-space: nowrap; text-decoration: none; transition: background .15s; }
.dx .dm-cmp__go:hover { background: var(--dm-accent); color: var(--dm-on-accent); }
.dx .dm-cmp__go[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.dx .dm-cmp__go[aria-disabled="true"]:hover { background: var(--dm-btn-white-bg); color: var(--dm-btn-white-text); }
.dx .dm-cmp__clr { all: unset; cursor: pointer; font-size: 13px; color: var(--dm-inverse-muted); text-decoration: underline; white-space: nowrap; }
.dx .dm-cmp__msg { position: absolute; bottom: calc(100% + 8px); inset-inline: 0; margin: 0 auto; width: fit-content; max-width: 100%; padding: 6px 14px; border-radius: 999px; background: var(--dm-accent); color: var(--dm-on-accent); font-size: 13px; font-weight: 700; }
html.dm-cmp-on .dx-ft { padding-block-end: 110px; }
@media (max-width: 760px) {
	/* Clear of the WhatsApp float (inset-inline-end 20px, 58px wide) and the product page's mobile bar. */
	.dx .dm-cmp { inset-inline: 12px 90px; width: auto; max-width: none; margin: 0; bottom: 20px; gap: 8px; padding: 8px; justify-content: space-between; }
	.dx:has(.dx-mbar) .dm-cmp { bottom: 86px; }
	.dx .dm-cmp__slot { width: 44px; height: 44px; }
	.dx .dm-cmp__slots { gap: 6px; }
	.dx .dm-cmp__go { min-height: 44px; padding: 0 14px; font-size: 14px; }
	.dx .dm-cmp__clr { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.dx .dm-qz__step, .dx .dm-qz__res.is-picked li.dm-cell, .dx .dm-cmp { animation: none; }
}
