/* system.css (P2): the storefront's own pages: checkout, order status, lookup, contact, state and error pages
   (views/layout.js). Served as /_sf/<hash>/system.css. Colours, fonts and corners follow the store's live theme through
   --sf-* variables (set by the layout); without a store (unknown address) the plain defaults below apply.

   Plain HTML looks right on its own: headings, paragraphs, links, forms (label, input, select, textarea, button,
   fieldset), tables, lists and <hr> are styled at element level. Helpers for page code (P3–P5 views):
     .sf-card        a panel                      .sf-muted     secondary text      .sf-small   12–13 px text
     .sf-grid-2      two columns (one on phones)  .sf-row       a row that wraps    .sf-stack   vertical spacing
     .sf-btn         an outlined button / link    .sf-btn--primary  filled accent   .sf-btn--wide  full width
     .sf-field       label + control + .sf-hint / .sf-error      .sf-notice (.is-error | .is-ok)  a message box
     .sf-summary     a totals list (dl)           .sf-hp        the honeypot (hidden from people)  .sf-sr  screen readers
*/

:root {
  --sf-bg: #f7f7f8;
  --sf-surface: #ececf1;
  --sf-text: #1d1f2b;
  --sf-accent: #6a5cc4;
  --sf-on-accent: #ffffff;
  --sf-head: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --sf-body: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --sf-r: 8px;
  --sf-danger: #c0392b;
  --sf-ok: #2f7d4f;
}
body.sf {
  --sf-line: color-mix(in srgb, var(--sf-text) 15%, transparent);
  --sf-soft: color-mix(in srgb, var(--sf-text) 6%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body.sf {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--sf-bg); color: var(--sf-text); font-family: var(--sf-body); font-size: 15px; line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: var(--sf-accent); }
:focus-visible { outline: 2px solid var(--sf-accent); outline-offset: 2px; }

.sf-banner { margin: 0; padding: 8px 16px; background: #1d1f2b; color: #f3f3f6; font: 500 13px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; text-align: center; }
.sf-header { box-shadow: inset 0 -1px 0 var(--sf-line); }
.sf-header-in, .sf-footer-in { max-width: 760px; margin: 0 auto; padding: 16px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sf-logo { font-family: var(--sf-head); font-size: 20px; font-weight: 600; color: var(--sf-text); text-decoration: none; margin-right: auto; overflow-wrap: anywhere; }
.sf-logo img { height: 36px; width: auto; max-width: 180px; object-fit: contain; }
.sf-header-link { font-size: 14px; color: var(--sf-text); }
.sf-main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 32px 20px 48px; }
.sf-footer { box-shadow: inset 0 1px 0 var(--sf-line); font-size: 12px; }
.sf-footer-in { justify-content: space-between; opacity: .75; }
.sf-footer a { color: inherit; text-decoration: none; }
.sf-footer a:hover { text-decoration: underline; }
.sf-footer-links { display: flex; gap: 14px; flex-wrap: wrap; }

h1, h2, h3 { font-family: var(--sf-head); font-weight: 600; line-height: 1.2; margin: 0 0 12px; overflow-wrap: anywhere; }
h1 { font-size: 30px; }
h2 { font-size: 21px; margin-top: 28px; }
h3 { font-size: 17px; margin-top: 20px; }
p, ul, ol, dl, table, form, fieldset { margin: 0 0 16px; }
hr { border: 0; height: 1px; background: var(--sf-line); margin: 24px 0; }
small, .sf-small { font-size: 13px; }
.sf-muted { opacity: .7; }
.sf-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* display:none, not off-screen: browsers' address autofill fills any focusable field, an off-screen one included, and that
   dropped real checkouts (2026-11-16). Bots that ignore CSS still fill it. */
.sf-hp { display: none !important; }

/* Forms */
label { display: block; font-size: 14px; font-weight: 500; margin: 0 0 6px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="search"], input[type="password"], select, textarea {
  display: block; width: 100%; padding: 10px 12px; border: 1px solid var(--sf-line); border-radius: var(--sf-r); background: transparent;
  color: inherit; font: inherit; font-size: 15px;
}
select { background: var(--sf-bg); }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sf-accent); outline-offset: 0; border-color: transparent; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--sf-accent); flex: none; }
/* Checkboxes drawn the same in every browser (owner, 2026-11-17): still a real <input type=checkbox>, so it works without
   JavaScript. 18px, 4px corners, a 1.5px border from the text colour (reads on light and dark themes), accent fill and an
   on-accent tick when ticked (a clip-path shape: no image, nothing for the CSP to allow). The ring shows for the keyboard only. */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center; flex: none; width: 18px; height: 18px;
  font: inherit; margin: 2px 0 0; margin-top: max(0px, calc((1lh - 18px) / 2)); padding: 0; cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--sf-text) 42%, transparent); border-radius: 4px; background: transparent; color: var(--sf-on-accent);
  transition: background-color .12s, border-color .12s;
}
input[type="checkbox"]::before {
  content: ""; width: 10px; height: 10px; background: currentColor; transform: scale(0); transition: transform .1s ease-in-out;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
input[type="checkbox"]:hover { border-color: var(--sf-accent); }
input[type="checkbox"]:checked { background: var(--sf-accent); border-color: var(--sf-accent); }
input[type="checkbox"]:checked::before { transform: scale(1); }
input[type="checkbox"]:focus { outline: none; }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--sf-accent); outline-offset: 2px; }
input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .5; }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; }
label:has(> input[type="checkbox"]:not(:disabled)) { cursor: pointer; }
fieldset { border: 1px solid var(--sf-line); border-radius: var(--sf-r); padding: 16px; }
legend { padding: 0 6px; font-weight: 600; }
button, .sf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: var(--sf-r);
  border: 1px solid var(--sf-line); background: transparent; color: var(--sf-text); font: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
button:hover, .sf-btn:hover { background: var(--sf-soft); }
button[type="submit"], .sf-btn--primary { background: var(--sf-accent); color: var(--sf-on-accent); border-color: var(--sf-accent); }
button[type="submit"]:hover, .sf-btn--primary:hover { background: var(--sf-accent); filter: brightness(1.06); }
button:disabled, .sf-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; filter: none; }
.sf-btn--wide { width: 100%; }
.sf-field { margin: 0 0 16px; }
.sf-hint { font-size: 13px; opacity: .7; margin: 6px 0 0; }
.sf-error { font-size: 13px; color: var(--sf-danger); margin: 6px 0 0; }
[aria-invalid="true"] { border-color: var(--sf-danger); }

/* Layout helpers */
.sf-card { padding: 20px; border-radius: calc(var(--sf-r) * 1.4); background: var(--sf-surface); margin: 0 0 16px; }
.sf-card > :last-child { margin-bottom: 0; }
.sf-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.sf-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.sf-stack > * + * { margin-top: 12px; }
.sf-notice { padding: 12px 14px; border-radius: var(--sf-r); background: var(--sf-surface); margin: 0 0 16px; }
.sf-notice.is-error { box-shadow: inset 3px 0 0 var(--sf-danger); }
.sf-notice.is-ok { box-shadow: inset 3px 0 0 var(--sf-ok); }
.sf-summary { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; }
.sf-summary dt { opacity: .75; }
.sf-summary dd { margin: 0; text-align: right; font-weight: 500; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 8px; text-align: left; box-shadow: inset 0 -1px 0 var(--sf-line); vertical-align: top; }
th { font-weight: 600; opacity: .8; }

@media (max-width: 600px) {
  body.sf { font-size: 14px; }
  h1 { font-size: 25px; }
  .sf-main { padding: 24px 16px 40px; }
  .sf-grid-2 { grid-template-columns: minmax(0, 1fr); }
}
