/* Book & Guide Orders: scoped to .as-order so it sits safely inside Divi.
 *
 * Arran Smith personal brand (Arran-Smith-Brand-Guidelines.md v1.1):
 *   deep green #164E4E (anchor), warm cream #EFEDE8 (neutral), white. League Spartan for headings,
 *   Poppins for labels, buttons and body. No See Differently colours (navy / orange / pink / purple)
 *   and no gradients. The five main colours can be changed in Book & Guide Orders > Settings > Brand colours.
 *
 * League Spartan and Poppins are used if your site already loads them; otherwise a clean system font
 * is used. This plugin makes no Google Fonts request. */
.as-order {
  --as-accent: #164E4E;       /* button fill: white on deep green is 9.4:1 */
  --as-accent-text: #FFFFFF;
  --as-ring: #164E4E;         /* focus ring, ticks, current step */
  --as-text: #164E4E;         /* deep green on cream is 8:1 */
  --as-bg: #EFEDE8;           /* warm cream */
  --as-surface: #FFFFFF;      /* cards and fields */
  --as-muted: #3D5C5C;        /* secondary text: 6.2:1 on cream, 7.3:1 on white */
  --as-border: #5F7E7E;       /* field and card outlines: 3.8:1 on cream, 4.4:1 on white */
  --as-error: #B42318;        /* functional red: 5.6:1 on cream */
  --as-focus: var(--as-ring);
  --as-radius: 12px;
  --as-font-heading: "League Spartan", "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --as-font-body: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-family: var(--as-font-body);
  box-sizing: border-box;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 24px;
  color: var(--as-text);
  background: var(--as-bg);
  border-top: 6px solid var(--as-ring);   /* one simple green rule, no gradient */
  border-radius: 0 0 var(--as-radius) var(--as-radius);
  font-size: 18px;
  line-height: 1.6;
}
.as-order *, .as-order *::before, .as-order *::after { box-sizing: inherit; }

/* Visually hidden, still read by screen readers (for "was" / "now" around a crossed-out price). */
.as-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.as-order__head { display: block; margin-bottom: 20px; }
.as-order__head > div { min-width: 0; }      /* the text always uses the full width of the box */
.as-order__img { width: 100%; height: auto; border-radius: var(--as-radius); display: block; }
.as-order__title, .as-order__h, .as-total, .as-sub { font-family: var(--as-font-heading); font-weight: 700; color: var(--as-text); }   /* explicit: Divi/theme headings would otherwise win */
.as-order__title { margin: 0 0 8px; font-size: 1.75rem; line-height: 1.15; color: var(--as-text); }
.as-order__desc p { margin: 0 0 8px; }
.as-order__muted { color: var(--as-muted); font-size: 0.9rem; font-weight: 400; }
.as-order__badge { display: inline-block; margin: 0; padding: 6px 14px; border: 2px solid var(--as-ring); border-radius: 999px; font-weight: 600; background: var(--as-surface); }
.as-order__closed, .as-order-notice { padding: 12px 16px; border: 2px solid var(--as-border); border-radius: var(--as-radius); background: var(--as-surface); }
.as-order__error { color: var(--as-error); font-weight: 600; }
.as-order__live { min-height: 1px; position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Price and discount: the regular price is crossed out AND labelled in text, so it never relies on styling alone. */
.as-order__price { margin: 8px 0; font-size: 1.3rem; font-family: var(--as-font-heading); }
.as-was { color: var(--as-muted); font-weight: 500; text-decoration: line-through; text-decoration-thickness: 2px; }
.as-now { font-weight: 700; }
.as-save-badge {
  display: inline-block; margin-left: 4px; padding: 2px 12px; vertical-align: middle;
  font-family: var(--as-font-body); font-size: 0.85rem; font-weight: 600;
  color: var(--as-accent-text); background: var(--as-accent); border-radius: 999px;
}
.as-offer-ends { margin: 0 0 8px; font-weight: 500; }
.as-lines__save { font-weight: 600; }
.as-lines__save span:last-child { white-space: nowrap; }

.as-order__steps { display: flex; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; flex-wrap: wrap; }
.as-order__steps li { padding: 4px 14px; border: 2px solid var(--as-border); border-radius: 999px; font-size: 0.9rem; font-weight: 500; background: var(--as-surface); }
.as-order__steps li[aria-current="step"] { border-color: var(--as-ring); color: var(--as-accent-text); background: var(--as-accent); font-weight: 600; }
.as-order__steps li[data-done="true"]::after { content: " (done)"; }
.as-order__steps li[aria-current="step"]::after { content: " (current)"; }

.as-order__panel[hidden], .as-order [hidden] { display: none !important; }
.as-order__h { margin: 0 0 12px; font-size: 1.4rem; }
.as-order__h:focus { outline: none; }
.as-order__h:focus-visible, .as-sub:focus-visible { outline: 3px solid var(--as-focus); outline-offset: 4px; }
.as-sub { margin: 24px 0 8px; font-size: 1.15rem; }
.as-order__h--sub { margin-top: 28px; }
/* The payment opens underneath the form on the same page, set apart by a rule. */
.as-order__pay { margin-top: 24px; padding-top: 16px; border-top: 2px solid var(--as-border); }
.as-form-err { margin-top: 8px; }
.as-sub:focus { outline: none; }
.as-sub:focus-visible { outline: 3px solid var(--as-focus); }

.as-field { margin-bottom: 18px; }
.as-field label { display: block; margin-bottom: 4px; font-weight: 600; }
.as-req, .as-opt { font-weight: 400; color: var(--as-muted); font-size: 0.85rem; }
.as-field input {
  width: 100%; min-height: 48px; padding: 10px 14px;
  font: inherit; font-size: 16px; font-weight: 500; /* 16px stops iOS zooming into the field */
  color: var(--as-text); background: var(--as-surface);
  border: 2px solid var(--as-border); border-radius: 10px;
}
.as-field input[aria-invalid="true"] { border-color: var(--as-error); border-width: 3px; }
.as-field__err { margin: 4px 0 0; color: var(--as-error); font-weight: 600; font-size: 0.95rem; }
.as-field__err:empty { display: none; }

.as-check, .as-bump { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0; }
.as-check input, .as-bump input { flex: 0 0 auto; width: 28px; height: 28px; margin: 2px 0 0; accent-color: var(--as-ring); }
.as-check label, .as-bump label { cursor: pointer; }
.as-bump { padding: 14px 16px; border: 2px solid var(--as-border); border-radius: var(--as-radius); background: var(--as-surface); }
.as-kicker { display: block; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em; color: var(--as-muted); }
/* Free extra: a solid green panel with a "+" mark and no tick-box, so it cannot be mistaken for a choice. */
.as-bump--included { align-items: center; color: var(--as-accent-text); background: var(--as-accent); border-color: var(--as-accent); }
.as-bump--included .as-kicker, .as-bump--included .as-bump__d { color: var(--as-accent-text); }
.as-bump__name { display: block; font-family: var(--as-font-heading); font-size: 1.15rem; }
.as-included-mark { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 2px solid currentColor; border-radius: 50%; font-weight: 700; font-size: 1.2rem; line-height: 1; }
.as-bump__body { min-width: 0; }
/* Optional extra: a white card with an empty tick-box until the buyer chooses it. */
.as-bump--paid { border-style: solid; }
.as-bump--paid:has(input:checked) { border-color: var(--as-ring); box-shadow: inset 0 0 0 1px var(--as-ring); }
.as-bump__d { display: block; font-weight: 400; color: var(--as-muted); font-size: 0.95rem; }
.as-tag { display: inline-block; padding: 0 8px; border: 2px solid currentColor; border-radius: 6px; font-size: 0.8rem; font-weight: 700; }

.as-lines { margin: 0 0 8px; padding: 0; list-style: none; }
.as-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--as-border); }
.as-total { display: flex; justify-content: space-between; margin: 14px 0 8px; font-size: 1.4rem; }

.as-btn {
  display: block; width: 100%; min-height: 52px; margin-top: 18px; padding: 12px 20px;
  font: inherit; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer;
  color: var(--as-accent-text); background: var(--as-accent);
  border: 2px solid var(--as-accent); border-radius: var(--as-radius);
}
.as-btn:hover:not(:disabled) { filter: brightness(1.2); }
.as-btn:disabled { opacity: 0.7; cursor: progress; }
.as-btn--secondary { color: var(--as-text); background: var(--as-surface); border-color: var(--as-ring); }
.as-btn--secondary:hover:not(:disabled) { filter: none; background: var(--as-bg); }
.as-embedded { margin-top: 8px; }
.as-embedded [data-embedded-mount] { min-height: 120px; }
.as-secure { margin-top: 12px; text-align: center; }
.as-pay-err { margin: 12px 0 0; }

.as-order a:focus-visible, .as-order input:focus-visible, .as-order button:focus-visible {
  outline: 3px solid var(--as-focus); outline-offset: 2px;
}

@media (min-width: 640px) {
  /* Image beside the text only when there IS an image; otherwise the description fills the whole box. */
  .as-order__head--img { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }
}
.as-order__head--img .as-order__img { margin-bottom: 16px; }
@media (min-width: 640px) { .as-order__head--img .as-order__img { margin-bottom: 0; } }
@media (prefers-reduced-motion: reduce) {
  .as-order * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
