/* acode commerce module v2: buy blocks, promo banner, offers + newsletter popup.
   Every selector is namespaced .acc-*. Colours, fonts, radii, shadow and motion reuse the redesign tokens of
   styles.css (--ink, --orange, --head, --r-l, --shadow-card, --ease-out...) when the page defines them, with the
   same values as fallbacks. Logical properties only (LTR and RTL). No @font-face, no url(), no external resource.

   Surfaces: the buy card and the popup body are light "paper" surfaces (like .form-card of the page); the banner
   and the popup header are ink surfaces. Each surface declares its own tokens, so the module reads the same on a
   cream section and on an ink section, whatever the page remaps on .acc-buy. */
:where(.acc-buy, .acc-banner, .acc-dialog) {
  --acc-ink: var(--ink, #151713);
  --acc-ink-2: var(--ink-2, #20231d);
  --acc-ink-3: var(--ink-3, #2b2f27);
  --acc-cream: var(--cream, #e9e8df);
  --acc-paper: var(--paper, #f5f4ee);
  --acc-white: var(--white, #fffefa);
  --acc-orange: var(--orange, #ff6b35);
  --acc-orange-hi: var(--orange-hi, #ff8a5c);
  --acc-rust: var(--rust, #a8390f);
  --acc-muted: var(--muted, #464940);
  --acc-muted-on-ink: var(--muted-on-ink, #c3c3b6);
  --acc-line: var(--line, #c9c8bc);
  --acc-line-on-ink: var(--line-on-ink, #3a3d35);
  --acc-edge-on-ink: var(--edge-on-ink, #71756a);
  --acc-field-line: var(--field-line, #6d7065);
  --acc-danger: var(--danger, #a11a1a);
  --acc-danger-bg: var(--danger-bg, #fbeaea);
  --acc-danger-text: var(--danger-text, #6f1010);
  --acc-head: var(--head, system-ui, -apple-system, 'Segoe UI', sans-serif);
  --acc-body: var(--body, system-ui, -apple-system, 'Segoe UI', sans-serif);
  --acc-fs-small: var(--fs-small, .9375rem);
  --acc-fs-label: var(--fs-label, .8125rem);
  --acc-track: var(--track-label, .12em);
  --acc-r-s: var(--r-s, 10px);
  --acc-r-m: var(--r-m, 18px);
  --acc-r-l: var(--r-l, 28px);
  --acc-shadow: var(--shadow-card, 0 30px 60px -28px rgba(10, 12, 8, .55), 0 2px 0 rgba(255, 255, 255, .04) inset);
  --acc-ease: var(--ease-out, cubic-bezier(.16, 1, .3, 1));
  --acc-t-fast: var(--t-fast, .18s);
  --acc-t-mid: var(--t-mid, .45s);
  --acc-focus: #151713;
  font-family: var(--acc-body);
}
:lang(ar):where(.acc-buy, .acc-banner, .acc-dialog), :lang(ar) :where(.acc-buy, .acc-banner, .acc-dialog) { --acc-track: 0em; --acc-fs-label: .9375rem; }
.acc-vh {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
.acc-money { unicode-bidi: isolate; white-space: nowrap; }
:where(.acc-buy, .acc-banner, .acc-dialog) :focus-visible { outline: 3px solid var(--acc-focus); outline-offset: 3px; border-radius: 6px; }
.acc-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons (same shape as .btn of the page) ---------- */
.acc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 12px 26px; border-radius: 999px; border: 2px solid transparent;
  font-family: var(--acc-head); font-size: 1rem; font-weight: 600; line-height: 1.25; text-align: center; text-decoration: none; cursor: pointer;
  transition: transform var(--acc-t-fast) ease, background-color var(--acc-t-fast) ease, color var(--acc-t-fast) ease, border-color var(--acc-t-fast) ease;
}
:lang(ar) .acc-btn { font-weight: 700; }
.acc-btn:hover { transform: translateY(-2px); }
.acc-btn:active { transform: translateY(0); }
.acc-btn:focus-visible { border-radius: 999px; }
.acc-btn-primary { background: var(--acc-orange); color: #151713; }
.acc-btn-primary:hover { background: var(--acc-orange-hi); }
.acc-btn-ink { background: #151713; color: #e9e8df; }
.acc-btn-ink:hover { background: #2b2f27; }
.acc-btn-line { min-height: 44px; padding: 8px 18px; background: transparent; color: #151713; border: 1.5px solid #151713; font-size: var(--acc-fs-small); }
.acc-btn-line:hover { background: #151713; color: #e9e8df; }
.acc-btn-quiet { min-height: 44px; padding: 8px 18px; background: transparent; color: #151713; font-size: var(--acc-fs-small); text-decoration: underline; text-underline-offset: 4px; }
.acc-btn-quiet:hover { transform: none; background: rgba(21, 23, 19, .07); }
.acc-btn[disabled] { opacity: .65; cursor: progress; transform: none; }
.acc-arrow { display: inline-block; transition: transform var(--acc-t-fast) ease; }
[dir="rtl"] .acc-arrow { transform: scaleX(-1); }
.acc-btn:hover .acc-arrow { transform: translateX(4px); }
[dir="rtl"] .acc-btn:hover .acc-arrow { transform: scaleX(-1) translateX(4px); }
.acc-ext::after { content: "↗"; font-family: var(--acc-head); color: var(--acc-rust); }
[dir="rtl"] .acc-ext::after { content: "↖"; }
.acc-btn-line:hover .acc-ext::after { color: var(--acc-orange); }

/* ---------- Offer pieces: badge, saving, last day, prices ---------- */
.acc-badge {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; background: var(--acc-orange); color: #151713;
  font-family: var(--acc-head); font-size: var(--acc-fs-label); font-weight: 700; letter-spacing: var(--acc-track); line-height: 1.5; text-transform: uppercase; white-space: nowrap;
}
.acc-save {
  display: inline-block; padding: 3px 10px; border-radius: 999px; background: #ffe3d6; color: #151713;
  font-size: var(--acc-fs-small); font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.acc-offer-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; }
.acc-until { margin-inline-start: auto; color: var(--acc-muted); font-size: var(--acc-fs-small); line-height: 1.5; }
.acc-price { display: grid; gap: 4px; min-width: 0; }
.acc-price p { margin: 0; }
.acc-price-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.acc-now { font-family: var(--acc-head); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
:lang(ar) .acc-now { letter-spacing: 0; }
.acc-price-lg .acc-now { font-size: clamp(2.75rem, 11vw, 3.5rem); }
.acc-price-md .acc-now { font-size: 1.75rem; }
.acc-price-sm .acc-now { font-size: 1.25rem; }
.acc-was { color: var(--acc-muted); font-size: 1.25rem; font-weight: 500; text-decoration-thickness: 2px; }
.acc-price-md .acc-was { font-size: 1.0625rem; }
.acc-price-sm .acc-was { font-size: 1rem; text-decoration-thickness: 1.5px; }
.acc-meta { margin: 0; color: var(--acc-muted); font-size: var(--acc-fs-small); line-height: 1.5; }

/* ---------- Buy block: one light card, the same on cream and on ink sections ---------- */
[data-commerce="buy"].acc-ready { align-self: stretch; width: 100%; }
.acc-buy { width: 100%; max-width: 34rem; }
.acc-card {
  /* Own tokens: the card stays a light surface even where the page remaps .acc-buy for an ink section. */
  --acc-ink: #151713; --acc-muted: #464940; --acc-line: #c9c8bc; --acc-focus: #151713;
  display: grid; gap: 20px; padding: 20px; border: 1px solid var(--acc-line); border-radius: var(--acc-r-l);
  background: var(--acc-white); color: var(--acc-ink); box-shadow: var(--acc-shadow);
}
.acc-main { display: grid; gap: 16px; }
.acc-main .acc-btn { width: 100%; }
.acc-others { display: grid; gap: 12px; padding-block-start: 18px; border-block-start: 1px solid var(--acc-line); }
.acc-alts { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.acc-also { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.acc-also .acc-price { justify-items: end; }
.acc-also .acc-offer-head { justify-content: flex-end; }
.acc-also .acc-until { margin-inline-start: 0; }
.acc-fine { margin: 0; color: var(--acc-muted); font-size: var(--acc-fs-label); line-height: 1.5; }
:lang(ar) .acc-fine { font-size: .875rem; }
@media (min-width: 480px) {
  .acc-card { padding: 28px; gap: 22px; }
}

/* ---------- Banner: one quiet ink line above the header ---------- */
.acc-banner { --acc-focus: #ffb499; background: var(--acc-ink-2); color: var(--acc-cream); border-block-end: 1px solid var(--acc-line-on-ink); }
.acc-banner-row {
  display: flex; align-items: center; gap: 4px 12px; width: 100%; max-width: 1320px; margin-inline: auto;
  padding-block: 2px; padding-inline: var(--gutter, 20px) calc(var(--gutter, 20px) - 12px);
}
.acc-banner-text { flex: 1 1 auto; margin: 0; padding-block: 8px; font-size: var(--acc-fs-small); line-height: 1.6; }
.acc-banner .acc-badge { margin-inline-end: 6px; padding: 1px 10px; font-size: .75rem; vertical-align: 1px; }
:lang(ar) .acc-banner .acc-badge { font-size: .8125rem; }
.acc-banner .acc-money { font-weight: 700; }
/* Inline link: the vertical padding enlarges the hit area to 44 px without changing the line height. */
.acc-banner-link {
  display: inline; padding: 12px 2px; color: var(--acc-orange-hi); white-space: nowrap;
  font-weight: 600; text-decoration: underline; text-underline-offset: 4px;
}
.acc-banner-link:hover { color: var(--acc-cream); }
.acc-banner-close, .acc-x {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: inherit; cursor: pointer;
  transition: background-color var(--acc-t-fast) ease, color var(--acc-t-fast) ease;
}
.acc-banner-close { color: var(--acc-muted-on-ink); }
.acc-banner-close:hover { background: var(--acc-ink-3); color: var(--acc-cream); }
.acc-banner-close:focus-visible, .acc-x:focus-visible { border-radius: 999px; }
.acc-banner-short { display: none; }
@media (min-width: 900px) {
  .acc-banner-text { text-align: center; padding-inline-start: 32px; }
}
/* Phones: one short line, which is the link itself, so the banner stays 48 px high above the hero. */
@media (max-width: 640px) {
  .acc-banner-full { display: none; }
  .acc-banner-text { padding-block: 0; font-size: .875rem; }
  .acc-banner-short { display: inline-block; padding: 11px 0; color: var(--acc-cream); white-space: normal; font-weight: 500; text-decoration: none; }
  .acc-banner-short strong { margin-inline-end: 1px; color: var(--acc-orange-hi); font-family: var(--acc-head); font-weight: 700; }
  .acc-banner-short .acc-money { text-decoration: underline; text-underline-offset: 4px; }
  .acc-banner-short .acc-arrow { margin-inline-start: 8px; color: var(--acc-orange-hi); }
}

/* ---------- Popup (native <dialog>, modal) ---------- */
html.acc-lock { overflow: hidden; }
.acc-dialog {
  width: min(680px, calc(100% - 32px)); max-width: none; max-height: min(90vh, 860px); max-height: min(90dvh, 860px); padding: 0; border: 0;
  border-radius: var(--acc-r-l); background: var(--acc-paper); color: var(--acc-ink); box-shadow: var(--acc-shadow), 0 0 0 1px rgba(233, 232, 223, .08);
  overflow: auto; overscroll-behavior: contain;
}
.acc-dialog::backdrop { background: rgba(10, 12, 8, .66); }
.acc-dialog h2, .acc-dialog h3, .acc-dialog p { margin: 0; }
.acc-dialog-head {
  --acc-focus: #ffb499;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 26px 16px 24px 32px; background: var(--acc-ink); color: var(--acc-cream);
}
[dir="rtl"] .acc-dialog-head { padding: 26px 32px 24px 16px; }
.acc-dialog-heading { display: grid; gap: 10px; justify-items: start; min-width: 0; padding-block-start: 4px; }
.acc-dialog-title { font-family: var(--acc-head); font-size: clamp(1.75rem, 6vw, 2.25rem); font-weight: 600; line-height: 1.06; letter-spacing: -0.035em; text-wrap: balance; }
:lang(ar) .acc-dialog-title { font-weight: 700; letter-spacing: 0; line-height: 1.35; }
.acc-dialog-title:focus { outline: none; }
.acc-dialog-title:focus-visible { outline: 3px solid var(--acc-focus); outline-offset: 6px; }
.acc-dialog-sub { color: var(--acc-muted-on-ink); font-size: var(--acc-fs-small); line-height: 1.55; }
.acc-x { margin-block-start: -12px; border: 1px solid var(--acc-edge-on-ink); }
.acc-x:hover { background: var(--acc-cream); color: var(--acc-ink); border-color: var(--acc-cream); }
.acc-dialog-body { display: grid; gap: 20px; padding: 24px 32px 20px; }
.acc-offer-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.acc-offer { display: grid; gap: 12px; padding: 18px 20px 20px; border: 1px solid var(--acc-line); border-radius: var(--acc-r-m); background: var(--acc-white); }
.acc-offer-name { font-family: var(--acc-head); font-size: 1.25rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
:lang(ar) .acc-offer-name { font-weight: 700; letter-spacing: 0; line-height: 1.5; }
.acc-offer-row { display: grid; gap: 14px; }
.acc-offer-row + .acc-offer-row { padding-block-start: 14px; border-block-start: 1px solid var(--acc-line); }
.acc-offer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.acc-offer-actions .acc-btn-primary { flex: 1 0 100%; min-height: 48px; padding: 10px 22px; }
.acc-offer-actions .acc-btn-line { flex: 1 1 0; white-space: nowrap; }
/* Wide popup, one price per product: name and price share the first line, the buttons take the second. */
@media (min-width: 641px) {
  .acc-offer:not(:has(.acc-offer-row + .acc-offer-row)) { grid-template-columns: 1fr auto; align-items: center; column-gap: 16px; }
  .acc-offer:not(:has(.acc-offer-row + .acc-offer-row)) .acc-offer-row { display: contents; }
  .acc-offer:not(:has(.acc-offer-row + .acc-offer-row)) .acc-offer-actions, .acc-offer:not(:has(.acc-offer-row + .acc-offer-row)) .acc-meta { grid-column: 1 / -1; }
}
.acc-code { padding: 1px 7px; border-radius: 6px; background: var(--acc-cream); font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .9em; font-weight: 600; }

/* Newsletter */
.acc-news { display: grid; gap: 12px; }
.acc-news-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.acc-news-head .acc-icon { color: var(--acc-rust); }
.acc-news h3 { font-family: var(--acc-head); font-size: 1.0625rem; font-weight: 600; line-height: 1.3; }
:lang(ar) .acc-news h3 { font-weight: 700; }
.acc-intro { color: var(--acc-muted); font-size: var(--acc-fs-small); line-height: 1.55; }
.acc-form { display: grid; gap: 14px; }
.acc-field { display: grid; gap: 6px; }
.acc-field label { font-weight: 600; }
.acc-field input {
  width: 100%; min-height: 50px; padding: 11px 14px; border: 1.5px solid var(--acc-field-line); border-radius: var(--acc-r-s);
  background: var(--acc-white); color: var(--acc-ink); font: inherit; font-size: 1rem; line-height: 1.4; text-align: start;
  transition: border-color var(--acc-t-fast) ease, box-shadow var(--acc-t-fast) ease;
}
.acc-field input:hover { border-color: var(--acc-ink); }
.acc-field input:focus-visible { outline-offset: 1px; border-color: var(--acc-ink); border-radius: var(--acc-r-s); }
.acc-field input[aria-invalid="true"] { border-color: var(--acc-danger); border-width: 2px; box-shadow: 0 0 0 3px rgba(161, 26, 26, .14); }
.acc-consent { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; min-height: 44px; cursor: pointer; font-size: var(--acc-fs-small); line-height: 1.5; }
.acc-consent input { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--acc-ink); cursor: pointer; }
.acc-consent input[aria-invalid="true"] { outline: 2px solid var(--acc-danger); outline-offset: 2px; }
.acc-hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }
.acc-error { padding: 12px 14px; border-radius: var(--acc-r-s); border: 2px solid var(--acc-danger); background: var(--acc-danger-bg); color: var(--acc-danger-text); font-weight: 500; }
.acc-form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.acc-status { color: var(--acc-muted); font-size: var(--acc-fs-small); }
.acc-success { padding: 14px 16px; border-radius: var(--acc-r-s); border: 2px solid var(--acc-ink); background: var(--acc-white); font-weight: 600; }
.acc-success:focus { outline: none; }
.acc-dialog-foot { display: flex; justify-content: flex-end; margin-block-start: -6px; margin-inline-end: -12px; }

/* Entrance: short fade and rise; the backdrop fades. Skipped under prefers-reduced-motion. */
@media (prefers-reduced-motion: no-preference) {
  .acc-dialog[open] { animation: acc-in var(--acc-t-mid) var(--acc-ease) both; }
  .acc-dialog[open]::backdrop { animation: acc-fade var(--acc-t-mid) ease both; }
}
@keyframes acc-in { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes acc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes acc-sheet { from { transform: translateY(100%); } to { transform: none; } }

/* Phones: bottom sheet */
@media (max-width: 640px) {
  .acc-dialog {
    width: 100%; max-width: 100%; max-height: 90vh; max-height: 90dvh; margin: auto 0 0;
    border-radius: var(--acc-r-l) var(--acc-r-l) 0 0; padding-block-end: env(safe-area-inset-bottom, 0);
  }
  .acc-dialog-head, [dir="rtl"] .acc-dialog-head { position: relative; padding: 30px 20px 22px; }
  .acc-dialog-head::before {
    content: ""; position: absolute; top: 10px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 999px; background: var(--acc-edge-on-ink);
  }
  .acc-x { margin-block-start: -6px; margin-inline-end: -8px; }
  .acc-dialog-body { padding: 18px 20px 14px; gap: 16px; }
  .acc-offer { padding: 16px; }
  .acc-offer-actions .acc-btn { flex: 1 0 100%; }
  .acc-form-foot .acc-btn { width: 100%; }
  .acc-dialog-foot { justify-content: center; margin-inline-end: 0; }
}
@media (max-width: 640px) and (prefers-reduced-motion: no-preference) {
  .acc-dialog[open] { animation: acc-sheet var(--acc-t-mid) var(--acc-ease) both; }
}

@media (prefers-reduced-motion: reduce) {
  .acc-btn, .acc-arrow, .acc-banner-close, .acc-x, .acc-field input { transition: none; }
  .acc-dialog[open], .acc-dialog[open]::backdrop { animation: none; }
  .acc-btn:hover, .acc-btn:hover .acc-arrow { transform: none; }
  [dir="rtl"] .acc-btn:hover .acc-arrow { transform: scaleX(-1); }
}
@media (forced-colors: active) {
  .acc-btn, .acc-badge, .acc-save, .acc-card, .acc-offer { border: 1px solid ButtonText; }
  .acc-banner { border-block-end: 1px solid CanvasText; }
}
