/* ==========================================================================
   Greenarys: cart drawer and shared shopping pieces (0.14)
   Loaded on every store-enabled page: the drawer, one-tap add-ons,
   quantity steppers and the reassurance row (product, cart, footer, menu).
   ========================================================================== */

/* ---------- Reassurance row ---------- */
.gr-assure { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gr-s3); }
.gr-assure li { display: flex; align-items: center; gap: var(--gr-s2); margin: 0; min-width: 0; font-size: var(--gr-fs-sm); line-height: 1.35; color: var(--gr-ink); }
.gr-assure svg { flex: 0 0 20px; width: 20px; height: 20px; color: var(--gr-green); }

.gr-assure--pdp {
	grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gr-s3) var(--gr-s4);
	margin-top: var(--gr-s4); padding: var(--gr-s4); background: var(--gr-surface);
	border: 1px solid var(--gr-line); border-radius: var(--gr-r);
}
.gr-assure--pdp li { font-size: var(--gr-fs-xs); font-weight: 600; }
.gr-assure--pdp svg { flex-basis: 32px; width: 32px; height: 32px; padding: 6px; box-sizing: border-box; border-radius: 50%; background: var(--gr-green-50); }
@media (min-width: 480px) { .gr-assure--pdp li { font-size: var(--gr-fs-sm); } }

.gr-assure--cart { margin-top: var(--gr-s4); padding-top: var(--gr-s4); border-top: 1px solid var(--gr-line); gap: var(--gr-s2); }
.gr-assure--cart li { font-size: var(--gr-fs-sm); color: var(--gr-ink-soft); }
.gr-assure--cart svg { flex-basis: 18px; width: 18px; height: 18px; }

.gr-assure--drawer { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px var(--gr-s4); }
.gr-assure--drawer li { font-size: var(--gr-fs-xs); color: var(--gr-ink-soft); gap: 6px; }
.gr-assure--drawer svg { flex-basis: 16px; width: 16px; height: 16px; }

.gr-assure--menu { padding: var(--gr-s4) var(--gr-s5); margin: var(--gr-s2) var(--gr-s4) 0; background: var(--gr-green-50); border-radius: var(--gr-r); gap: var(--gr-s2); }
.gr-assure--menu li { font-size: var(--gr-fs-sm); font-weight: 600; }

/* ---------- Quantity steppers ---------- */
.gr-stepper { display: inline-flex !important; align-items: stretch; border: 1px solid var(--gr-line-strong); border-radius: var(--gr-r); background: var(--gr-surface); overflow: hidden; }
.gr-stepper .qty {
	width: 44px !important; min-height: 0 !important; height: auto !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important;
	text-align: center; font: 700 var(--gr-fs-base) var(--gr-font-head) !important; background: transparent !important; box-shadow: none !important;
	-moz-appearance: textfield; appearance: textfield;
}
.gr-stepper .qty::-webkit-outer-spin-button, .gr-stepper .qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.gr-stepper__btn {
	flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--gr-ink);
	font: 500 22px/1 var(--gr-font-body); cursor: pointer; transition: background-color var(--gr-fast) var(--gr-ease), color var(--gr-fast) var(--gr-ease);
}
.gr-stepper__btn:hover { background: var(--gr-green-50); color: var(--gr-green); }
.gr-stepper__btn:focus-visible { outline-offset: -3px; }

/* ---------- One-tap add-ons ---------- */
.gr-addons { display: grid; gap: var(--gr-s2); }
.gr-addon {
	position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: var(--gr-s3);
	margin: 0; padding: var(--gr-s2); background: var(--gr-surface); border: 1px solid var(--gr-line); border-radius: var(--gr-r);
	transition: border-color var(--gr-fast) var(--gr-ease), box-shadow var(--gr-fast) var(--gr-ease);
}
.gr-addon:hover { border-color: var(--gr-green-100); box-shadow: var(--gr-shadow); }
.gr-addon__media { display: block; width: 56px; height: 56px; border-radius: var(--gr-r-sm); overflow: hidden; background: var(--gr-sand); }
.gr-addon__media img, .gr-addon__ph { display: block; width: 100%; height: 100%; object-fit: cover; }
.gr-addon__info { display: grid; gap: 2px; min-width: 0; }
.gr-addon__name {
	font: 600 var(--gr-fs-sm)/1.3 var(--gr-font-head); color: var(--gr-ink); text-decoration: none;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gr-addon__name:hover { color: var(--gr-green); }
.gr-addon__name::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* whole row opens the product */
.gr-addon__btn { position: relative; z-index: 1; }
.gr-addon__meta { font-size: var(--gr-fs-xs); color: var(--gr-ink-soft); font-variant-numeric: tabular-nums; }
.gr-addon__meta strong { color: var(--gr-ink); font-weight: 700; }
.gr-addon__btn {
	display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 var(--gr-s4) 0 var(--gr-s3);
	border: 1.5px solid var(--gr-green); border-radius: var(--gr-r-pill); background: var(--gr-surface); color: var(--gr-green);
	font: 600 var(--gr-fs-sm) var(--gr-font-head); cursor: pointer; white-space: nowrap;
	transition: background-color var(--gr-fast) var(--gr-ease), color var(--gr-fast) var(--gr-ease);
}
.gr-addon__btn svg { width: 16px; height: 16px; stroke-width: 2.4; }
.gr-addon__btn:hover { background: var(--gr-green); color: #fff; }
.gr-addon__btn.is-loading { opacity: 0.6; pointer-events: none; }
.gr-addon__btn.is-loading svg { animation: gr-spin 0.8s linear infinite; }
@keyframes gr-spin { to { transform: rotate(360deg); } }

/* ---------- Drawer ---------- */
.gr-cdrawer { position: fixed; inset: 0; z-index: 300; }
.gr-cdrawer[hidden] { display: none; }
.gr-cdrawer__scrim {
	position: absolute; inset: 0; background: rgba(29, 42, 31, 0.5); opacity: 0; cursor: pointer;
	transition: opacity 300ms var(--gr-ease);
}
.gr-cdrawer.is-open .gr-cdrawer__scrim { opacity: 1; }
.gr-cdrawer__panel {
	position: absolute; top: 0; right: 0; bottom: 0; width: min(100%, 440px); display: flex; flex-direction: column;
	background: var(--gr-canvas); box-shadow: -12px 0 40px rgba(29, 42, 31, 0.18); outline: none;
	transform: translateX(100%); transition: transform 320ms var(--gr-ease);
}
.gr-cdrawer.is-open .gr-cdrawer__panel { transform: none; }
.gr-cdrawer__head {
	flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--gr-s3);
	min-height: 64px; padding: 0 var(--gr-s2) 0 var(--gr-s5); background: var(--gr-surface); border-bottom: 1px solid var(--gr-line);
}
.gr-cdrawer__head h2 { margin: 0; font-size: var(--gr-fs-lg); }
.gr-cdrawer__count { color: var(--gr-ink-soft); font-weight: 500; font-variant-numeric: tabular-nums; }
.gr-cdrawer__content { flex: 1; min-height: 0; display: flex; flex-direction: column; transition: opacity var(--gr-fast) var(--gr-ease); }
.gr-cdrawer__content[aria-busy="true"] { cursor: progress; }
.gr-cdrawer__scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--gr-s4) var(--gr-s5) var(--gr-s5); }
.gr-cdrawer__notice { margin: 0 0 var(--gr-s3); padding: var(--gr-s2) var(--gr-s3); border-radius: var(--gr-r-sm); background: var(--gr-warn-bg); font-size: var(--gr-fs-sm); }

/* Free-shipping progress (drawer) */
.gr-cship { padding: var(--gr-s3) var(--gr-s4); background: var(--gr-green-50); border: 1px solid var(--gr-green-100); border-radius: var(--gr-r); }
.gr-cship p { display: flex; align-items: center; gap: var(--gr-s2); margin: 0 0 var(--gr-s2); font-size: var(--gr-fs-sm); }
.gr-cship p strong { color: var(--gr-green); }
.gr-cship svg { flex: 0 0 20px; width: 20px; height: 20px; color: var(--gr-green); }
.gr-cship__track { height: 8px; border-radius: var(--gr-r-pill); background: #fff; overflow: hidden; }
.gr-cship__track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gr-green), #5b8a26); transition: width 500ms var(--gr-ease); }
.gr-cship.is-done { background: var(--gr-green); border-color: var(--gr-green); color: #fff; }
.gr-cship.is-done p, .gr-cship.is-done p strong, .gr-cship.is-done svg { color: #fff; }
.gr-cship.is-done .gr-cship__track { background: rgba(255, 255, 255, 0.25); }
.gr-cship.is-done .gr-cship__track span { background: var(--gr-lime); }

/* Lines */
.gr-ci-list { list-style: none; margin: var(--gr-s2) 0 0; padding: 0; }
.gr-ci {
	display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: var(--gr-s3); margin: 0; padding: var(--gr-s4) 0;
	border-bottom: 1px solid var(--gr-line); transition: opacity var(--gr-fast) var(--gr-ease);
}
.gr-ci.is-busy { opacity: 0.5; }
.gr-ci.is-new { animation: gr-ci-new 1.6s var(--gr-ease); }
@keyframes gr-ci-new { 0%, 40% { background: var(--gr-green-50); box-shadow: -12px 0 0 var(--gr-green-50), 12px 0 0 var(--gr-green-50); } 100% { background: transparent; box-shadow: none; } }
.gr-ci__media { display: block; width: 80px; height: 80px; border-radius: var(--gr-r-sm); overflow: hidden; background: var(--gr-sand); }
.gr-ci__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gr-ci__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gr-ci__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--gr-s2); }
.gr-ci__name {
	padding-top: 2px; font: 600 var(--gr-fs-sm)/1.35 var(--gr-font-head); color: var(--gr-ink); text-decoration: none;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
a.gr-ci__name:hover { color: var(--gr-green); }
.gr-ci__remove {
	flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin: -10px -12px -6px 0; padding: 0;
	border: 0; border-radius: 50%; background: transparent; color: var(--gr-ink-soft); cursor: pointer;
}
.gr-ci__remove svg { width: 18px; height: 18px; }
.gr-ci__remove:hover { background: var(--gr-error-bg); color: var(--gr-error); }
.gr-ci__pack { font-size: var(--gr-fs-xs); color: var(--gr-ink-soft); }
.gr-ci__row { display: flex; align-items: center; justify-content: space-between; gap: var(--gr-s3); margin-top: auto; padding-top: var(--gr-s2); }
.gr-ci__price { font: 700 var(--gr-fs-base) var(--gr-font-head); font-variant-numeric: tabular-nums; }
.gr-ci__single { font-size: var(--gr-fs-sm); color: var(--gr-ink-soft); }

.gr-qty { display: inline-flex; align-items: center; border: 1px solid var(--gr-line-strong); border-radius: var(--gr-r-pill); background: var(--gr-surface); }
.gr-qty__btn {
	display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--gr-r-pill);
	background: transparent; color: var(--gr-ink); cursor: pointer;
}
.gr-qty__btn svg { width: 16px; height: 16px; stroke-width: 2.2; }
.gr-qty__btn:hover { color: var(--gr-green); background: var(--gr-green-50); }
.gr-qty__btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.gr-qty__val { min-width: 24px; text-align: center; font: 700 var(--gr-fs-sm) var(--gr-font-head); font-variant-numeric: tabular-nums; }

/* Free-shipping suggestions */
.gr-unlock--drawer { margin-top: var(--gr-s5); }
.gr-unlock--drawer h3 { margin: 0 0 var(--gr-s3); font-size: var(--gr-fs-sm); font-weight: 700; letter-spacing: 0.02em; }

/* Footer of the drawer: one total line and the two buttons side by side, so the items keep the room. */
.gr-cdrawer__foot {
	flex: none; display: grid; gap: var(--gr-s3); padding: var(--gr-s3) var(--gr-s5) calc(var(--gr-s3) + env(safe-area-inset-bottom, 0px));
	background: var(--gr-surface); border-top: 1px solid var(--gr-line); box-shadow: 0 -8px 24px rgba(29, 42, 31, 0.06);
}
.gr-cdrawer__row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--gr-s3); margin: 0; font-size: var(--gr-fs-sm); font-variant-numeric: tabular-nums; }
.gr-cdrawer__row--total { font: 700 var(--gr-fs-md) var(--gr-font-head); }
.gr-cdrawer__row--total > span:first-child { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 var(--gr-s2); }
.gr-cdrawer__small { font: 400 var(--gr-fs-xs) var(--gr-font-body); color: var(--gr-ink-soft); }
.gr-cdrawer__actions { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--gr-s2); }
.gr-cdrawer__actions .gr-btn { min-height: 52px; margin: 0; padding-left: var(--gr-s3); padding-right: var(--gr-s3); white-space: nowrap; }
.gr-cdrawer__checkout svg { width: 18px; height: 18px; transition: transform var(--gr-fast) var(--gr-ease); }
.gr-cdrawer__checkout:hover svg { transform: translateX(3px); }

/* Impact note and reassurance, at the end of the scrolling list */
.gr-cdrawer__extras { display: grid; gap: var(--gr-s3); margin-top: var(--gr-s5); }
.gr-cdrawer__extras .gr-ipromo--drawer { margin: 0; }
.gr-cdrawer__extras .gr-assure--drawer { padding-top: var(--gr-s3); border-top: 1px dashed var(--gr-line); }

/* Tighter lines and shipping bar */
.gr-cdrawer__scroll .gr-cship { padding: var(--gr-s2) var(--gr-s3); }
.gr-cdrawer__scroll .gr-cship p { margin-bottom: 6px; }
.gr-ci { grid-template-columns: 72px minmax(0, 1fr); padding: var(--gr-s3) 0; }
.gr-ci__media { width: 72px; height: 72px; }

/* Empty */
.gr-cdrawer__empty { display: grid; gap: var(--gr-s3); justify-items: center; text-align: center; padding: var(--gr-s6) 0 var(--gr-s4); }
.gr-cdrawer__empty p { margin: 0; }
.gr-cdrawer__empty-icon { display: grid; place-items: center; width: 80px; height: 80px; border-radius: 50%; background: var(--gr-green-50); color: var(--gr-green); }
.gr-cdrawer__empty-icon svg { width: 36px; height: 36px; }
.gr-cdrawer__empty-title { font: 700 var(--gr-fs-lg) var(--gr-font-head); }
.gr-cdrawer__cats { list-style: none; width: 100%; margin: var(--gr-s3) 0 var(--gr-s2); padding: 0; border-top: 1px solid var(--gr-line); text-align: left; }
.gr-cdrawer__cats li { margin: 0; border-bottom: 1px solid var(--gr-line); }
.gr-cdrawer__cats a { display: flex; align-items: center; justify-content: space-between; min-height: 52px; font: 600 var(--gr-fs-base) var(--gr-font-head); color: var(--gr-ink); text-decoration: none; }
.gr-cdrawer__cats a:hover { color: var(--gr-green); }
.gr-cdrawer__cats svg { width: 18px; height: 18px; color: var(--gr-green); }

@media (prefers-reduced-motion: reduce) {
	.gr-ci.is-new { animation: none; background: var(--gr-green-50); }
}
