/*
  Mena Made base styles: fonts, reset, the five text styles, the one button and form fields.
  Loaded on every page after tokens.css, before the area files (site.css, admin.css ...).
  design/rules.md is the law. In short:
    - One font (Inter), two weights (400, 600), letter-spacing 0 everywhere.
    - Five text styles, defined only here: h1 Display, h2/h3 Heading, body Body,
      .t-small Small, .t-lead Large body. No other file sets font-size, font-weight,
      font-family, letter-spacing or text-transform.
    - One button: .btn (dark ink fill; cream fill inside a dark band). .btn--danger is the
      only variant. Any other action is a plain text link (.link-button for a form button).
    - No pills, chips, status dots, left bars, eyebrows or numbered steps.
*/

/* ---- Fonts (self-hosted Inter, SIL Open Font License; see /fonts/LICENSE.md) ---- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(/fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(/fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 400 600; font-display: swap;
  src: url(/fonts/inter-italic-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 400 600; font-display: swap;
  src: url(/fonts/inter-italic-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
[hidden] { display: none !important; }
p, ul, ol, dl, blockquote, figure { margin: 0; }
blockquote { padding: 0; border: 0; }   /* a quote is just text: no bar, no box */

/* ---- The five text styles (sizes in tokens.css) ---- */

/* 3. Body: the default for everything, including buttons and form controls. */
body {
  margin: 0;
  background: var(--mm-cream);
  color: var(--mm-ink);
  font-family: var(--mm-font);
  font-size: var(--mm-text-body);
  font-weight: var(--mm-weight-regular);
  line-height: var(--mm-leading-body);
  letter-spacing: 0;
  text-transform: none;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea, optgroup { font: inherit; letter-spacing: 0; color: inherit; }
p { text-wrap: pretty; }
/* Bold is 600, never the browser's 700. */
b, strong, th, dt, legend, label { font-weight: var(--mm-weight-semibold); }

/* 1. Display and 2. Heading: bold, normal case (the one rule for both), no tracking. */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--mm-font-heading);   /* the same as --mm-font unless the shop's look picks a heading font (looks.css) */
  font-weight: var(--mm-weight-semibold);
  letter-spacing: 0;
  text-transform: none;
  text-wrap: balance;
}
h1, .t-display { font-size: var(--mm-text-display); line-height: var(--mm-leading-display); }
h2, h3, h4, h5, h6, .t-heading { font-size: var(--mm-text-heading); line-height: var(--mm-leading-heading); }

/* The shop's text font (looks.css, or the chosen font's own stylesheet in /fonts/choices/) on any
   element that carries one, and words that take the heading font without being a heading (the
   samples on the admin Look page and in the editor's font lists). */
[data-body-font] { font-family: var(--mm-font); }
.font-heading { font-family: var(--mm-font-heading); }

/* 5. Large body: the one intro sentence under a Display headline. */
.t-lead { font-size: var(--mm-text-lead); line-height: var(--mm-leading-lead); font-weight: var(--mm-weight-regular); }

/* 4. Small: helper text, captions, meta lines, footnotes and status words. */
.t-small, small { font-size: var(--mm-text-small); line-height: var(--mm-leading-small); font-weight: var(--mm-weight-regular); }

/* Deprecated aliases (pages are moving to .t-small and .t-lead): same styles, not new ones. */
.small { font-size: var(--mm-text-small); line-height: var(--mm-leading-small); }
.lead { font-size: var(--mm-text-lead); line-height: var(--mm-leading-lead); color: var(--mm-ink-soft); }

a { color: var(--mm-terracotta); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--mm-terracotta-deep); }

:focus-visible { outline: 2px solid var(--mm-focus); outline-offset: 2px; }
main:focus { outline: none; }

::selection { background: var(--mm-linen); color: var(--mm-ink); }

/* ---- Small utilities ---- */
/* All !important: a page rule such as `fieldset > legend { width: 100% }` must not stretch hidden
   text, or the 1px box becomes page-wide and the page scrolls sideways. */
.visually-hidden {
  position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; border: 0 !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; white-space: nowrap !important;
}
.skip-link {
  position: absolute; left: var(--mm-space-4); top: -100px; z-index: 100;
  background: var(--mm-ink); color: var(--mm-cream); padding: var(--mm-space-2) var(--mm-space-4);
  border-radius: var(--mm-radius-button); font-weight: var(--mm-weight-semibold); text-decoration: none;
}
.skip-link:focus { top: var(--mm-space-3); color: var(--mm-cream); }
.muted { color: var(--mm-ink-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stack > * + * { margin-top: var(--mm-space-3); }

/* ---- The one button ----
  .btn: dark ink fill, cream text, Body size, bold, normal case, 44px tall, 0 20px, 6px corners.
  Inside the dark band (.band--cocoa, or .band--dark) it reverses: cream fill, dark text.
  .btn--danger (error red fill) is the only variant: delete, refund and cancel confirmations.
  A secondary action is a plain text link; a secondary action that must POST is button.link-button.

  DEPRECATED modifiers, kept only so pages don't break while they are removed. Each renders
  exactly like .btn: .btn--primary, .btn--secondary, .btn--quiet, .btn--small, .btn--filled.
  .btn--block is layout only (full width), not a style. */
.btn,
.btn--primary, .btn--secondary, .btn--quiet, .btn--small, .btn--filled {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--mm-space-2);
  min-height: var(--mm-button-height); padding: 0 1.25rem;
  border: 0; border-radius: var(--mm-radius-button);
  background: var(--mm-ink); color: var(--mm-cream);
  font-family: var(--mm-font); font-size: var(--mm-text-body); font-weight: var(--mm-weight-semibold); line-height: 1.2;
  letter-spacing: 0; text-transform: none;
  text-align: center; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color var(--mm-duration) var(--mm-ease), color var(--mm-duration) var(--mm-ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover,
.btn--primary:hover, .btn--secondary:hover, .btn--quiet:hover, .btn--small:hover, .btn--filled:hover {
  background: var(--mm-cocoa); color: var(--mm-cream); text-decoration: none;
}
.btn--danger, .btn.btn--danger { background: var(--mm-danger); color: var(--mm-cream); }
.btn--danger:hover, .btn.btn--danger:hover { background: #7E261E; color: var(--mm-cream); }
.btn--block { display: flex; width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--mm-line); color: var(--mm-ink-soft); cursor: not-allowed; }

/* Reversed inside the dark band: the same button, cream fill and dark text. */
.band--cocoa .btn, .band--dark .btn { background: var(--mm-cream); color: var(--mm-cocoa); }
.band--cocoa .btn:hover, .band--dark .btn:hover { background: var(--mm-oat); color: var(--mm-cocoa); }
.band--cocoa :focus-visible, .band--dark :focus-visible { outline-color: var(--mm-cream); }

/* A form button that reads as a plain text link (a secondary action that has to POST). */
.link-button {
  display: inline; padding: 0; margin: 0; border: 0; background: none; cursor: pointer;
  color: var(--mm-terracotta); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  font: inherit; letter-spacing: 0; text-align: left;
}
.link-button:hover { color: var(--mm-terracotta-deep); }

/* ---- Fields ----
  <div class="field [field--error]"> label, p.hint, p.error, input.input [input--money|input--short]
  Label above in Body bold, no colon. 48px tall, Body text, 4px corners, 1px ink-faint border on --mm-card. */
.input, input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea {
  width: 100%; min-height: var(--mm-control-height); padding: 10px 14px;
  font-family: var(--mm-font); font-size: var(--mm-text-body); font-weight: var(--mm-weight-regular); line-height: 1.4;
  color: var(--mm-ink);
  background: var(--mm-card); border: var(--mm-border-field); border-radius: var(--mm-radius-control);
  transition: border-color var(--mm-duration) var(--mm-ease);
}
/* A box for one big number (an expense's amount) takes the Display style, not a new one. */
input.t-display:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
  font-size: var(--mm-text-display); line-height: var(--mm-leading-display); font-weight: var(--mm-weight-semibold); font-variant-numeric: tabular-nums;
}
textarea { min-height: 5.5rem; resize: vertical; }
select { appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%233B2A22' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.input:hover, input:hover, select:hover, textarea:hover { border-color: var(--mm-ink-soft); }
.input:focus, input:focus, select:focus, textarea:focus { outline: 2px solid var(--mm-focus); outline-offset: 1px; border-color: var(--mm-focus); }
[aria-invalid="true"] { border-color: var(--mm-danger) !important; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--mm-ink); width: 20px; height: 20px; }
::placeholder { color: var(--mm-ink-faint); opacity: 1; }
.input--money { max-width: 10rem; font-variant-numeric: tabular-nums; }
.input--short { max-width: 14rem; }

.field { display: grid; gap: 6px; align-content: start; }
.field .hint, .hint { font-size: var(--mm-text-small); line-height: var(--mm-leading-small); font-weight: var(--mm-weight-regular); color: var(--mm-ink-soft); }
.field .error, .field-error {
  display: block; color: var(--mm-danger);
  font-size: var(--mm-text-small); line-height: var(--mm-leading-small); font-weight: var(--mm-weight-regular);
}
/* An error shows as red text and a red field border. No bar down the side. */
.field--error > .input, .field--error > input, .field--error > textarea, .field--error > select,
.field--error .field__control { border-color: var(--mm-danger); }
.opt { font-weight: var(--mm-weight-regular); color: var(--mm-ink-soft); }
.field__control { display: flex; align-items: stretch; border: var(--mm-border-field); border-radius: var(--mm-radius-control); background: var(--mm-card); max-width: 14rem; }
.field__control:focus-within { outline: 2px solid var(--mm-focus); outline-offset: 1px; border-color: var(--mm-focus); }
.field__control > .input, .field__control > input { border: 0 !important; outline: none !important; background: transparent; min-width: 0; }
.field__affix { display: grid; place-items: center; padding: 0 0 0 14px; color: var(--mm-ink-soft); }
.field__affix:last-child { padding: 0 14px 0 0; }

/* Check and radio rows: label.check > input + span, at least 44px tall. Body, normal weight. */
.check { display: flex; gap: var(--mm-space-3); align-items: flex-start; min-height: 44px; padding: 10px 0; font-weight: var(--mm-weight-regular); cursor: pointer; }
.check input { margin: 2px 0 0; flex: none; }

/* ---- Status words: plain Small text in the row they belong to. No dot, no pill, no colour code. ----
  .status is what the shared Badge components now render. .badge (deprecated, still written by
  some pages) is flattened to the same plain text until those pages stop using it. */
.status, .badge, .badge--ok, .badge--warn, .badge--bad, .badge--muted, .badge--info {
  display: inline; padding: 0; border: 0; border-radius: 0; background: none;
  font-size: var(--mm-text-small); line-height: var(--mm-leading-small); font-weight: var(--mm-weight-regular);
  letter-spacing: 0; text-transform: none; color: inherit; white-space: normal;
}
.status::before, .status::after, .badge::before, .badge::after { content: none; display: none; }

/* ---- Notice: plain text in the page flow, a heading and a sentence. No box, no bar, no tint. ----
  The tone classes (--ok, --warn, --bad, --soon, --closed) are kept for markup and look the same. */
.notice, .notice--ok, .notice--warn, .notice--bad, .notice--soon, .notice--closed {
  display: block; padding: 0; margin: 0; background: none; border: 0; border-radius: 0; box-shadow: none; color: var(--mm-ink);
}
.notice > * + * { margin-top: var(--mm-space-2); }
.notice__title { font-size: var(--mm-text-heading); line-height: var(--mm-leading-heading); }

/* ---- Error summary: a heading and the list of problems. No box, no bar. ---- */
.error-summary { display: grid; gap: var(--mm-space-2); padding: 0; background: none; border: 0; }
.error-summary:focus { outline: 2px solid var(--mm-focus); outline-offset: 4px; }
.error-summary h2, .error-summary__title { color: var(--mm-ink); }
.error-summary ul { padding-left: var(--mm-space-5); display: grid; gap: 4px; }
.error-summary a, .error-summary li { color: var(--mm-danger); }

/* ---- Stepper: 40px squares inside one 1px box. Without JavaScript it is a number box. ---- */
.stepper { display: inline-flex; align-items: center; }
.stepper__input { width: 5.5rem !important; text-align: center; font-weight: var(--mm-weight-semibold) !important; font-variant-numeric: tabular-nums; }
.is-enhanced .stepper, .stepper.is-enhanced {
  border: var(--mm-border-field); border-radius: var(--mm-radius-control); background: var(--mm-card); height: var(--mm-control-height-sm);
}
.is-enhanced .stepper:focus-within, .stepper.is-enhanced:focus-within { border-color: var(--mm-focus); }
.is-enhanced .stepper__input, .stepper.is-enhanced .stepper__input {
  width: 2.75rem !important; min-height: 0 !important; height: 100%; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important;
  -moz-appearance: textfield; appearance: textfield;
}
.is-enhanced .stepper__input:focus { outline: none; }
.is-enhanced .stepper__input::-webkit-outer-spin-button, .is-enhanced .stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper__btn {
  width: var(--mm-control-height-sm); height: 100%; border: 0; background: none; cursor: pointer; color: var(--mm-ink);
  font-family: var(--mm-font); font-size: var(--mm-text-heading); font-weight: var(--mm-weight-regular); line-height: 1;
  display: grid; place-items: center; border-radius: 0;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.stepper__btn:hover:not(:disabled) { background: var(--mm-linen); }
.stepper__btn:disabled { color: var(--mm-line); cursor: default; }

/* ---- Empty state: only for a whole empty page or list ---- */
.empty { display: grid; gap: var(--mm-space-3); justify-items: start; padding: var(--mm-space-7) 0; max-width: var(--mm-reading-max); }
.empty p { color: var(--mm-ink-soft); }

/* ---- Confirm (no JavaScript): a question, the consequence, then one danger button and a Cancel link ---- */
.confirm { display: grid; gap: var(--mm-space-3); justify-items: start; max-width: var(--mm-reading-max); }
.confirm__actions { display: flex; flex-wrap: wrap; gap: var(--mm-space-5); align-items: center; margin-top: var(--mm-space-2); }
details.confirm > summary { cursor: pointer; list-style: none; }
details.confirm > summary::-webkit-details-marker { display: none; }
.danger-zone { border-top: var(--mm-rule); padding-top: var(--mm-space-5); margin-top: var(--mm-space-7); }

/* ---- A button that POSTs, and previous / next page links ---- */
.post-button { display: inline-flex; margin: 0; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: var(--mm-space-5); margin-top: var(--mm-space-5); }

/* ---- Development hints, error detail and the email outbox ---- */
.dev-hint {
  background: var(--mm-card); color: var(--mm-ink); padding: var(--mm-space-3) var(--mm-space-4);
  border: 1px dashed var(--mm-ink-faint); border-radius: var(--mm-radius-control);
  font-size: var(--mm-text-small); line-height: var(--mm-leading-small);
}
.error-detail {
  white-space: pre-wrap; font-size: var(--mm-text-small); line-height: var(--mm-leading-small); background: var(--mm-linen);
  padding: var(--mm-space-3); border-radius: var(--mm-radius-control); overflow-x: auto; text-align: left;
}
.outbox-text { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--mm-card); border: var(--mm-border); padding: var(--mm-space-3); border-radius: var(--mm-radius-control); }
.outbox-frame { border: var(--mm-border); background: #fff; border-radius: var(--mm-radius-control); }
.outbox-list { padding-left: var(--mm-space-5); display: grid; gap: var(--mm-space-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
