/* Redline Ink base + components, shared by the public site and admin.
   Layout-specific rules live in public.css and admin.css. */

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--font-body);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 var(--space-3);
}
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 var(--space-4); }

a { color: var(--red-strong); text-underline-offset: 3px; }
a:hover { color: var(--red); }

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 2px;
  border-radius: 2px;
}

.num, .price { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-muted); }
.small { font-size: 0.875rem; }
code, .mono { font-family: var(--font-mono); font-size: 0.9em; }
code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
  overflow-wrap: anywhere;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -48px;
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus { top: var(--space-2); }

/* ---------- brand mark ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 1rem;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand img { width: 40px; height: 40px; flex: none; display: block; }
.brand b { color: var(--brand); font-weight: 800; }

/* The registration-mark bullet: the ⊕ used by printers. */
.reg {
  display: inline-block;
  width: 1em; height: 1em;
  color: var(--red);
  vertical-align: -0.15em;
}

/* ---------- language switch (МН / EN) ---------- */
.locale-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--pill); padding: 2px; }
.locale-switch button {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: 600 0.8rem/1 var(--font-body);
  padding: 7px 10px;
  border-radius: var(--pill);
  cursor: pointer;
  min-height: 30px;
}
.locale-switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }


/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-border: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-5);
  border: 1px solid var(--btn-border);
  border-radius: var(--pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 600 0.95rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:hover { --btn-border: var(--ink-muted); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn--primary { --btn-bg: var(--red); --btn-fg: var(--on-red); --btn-border: var(--red); }
.btn--primary:hover { --btn-bg: var(--red-strong); --btn-border: var(--red-strong); }
.btn--ghost { --btn-bg: transparent; --btn-border: transparent; }
.btn--ghost:hover { --btn-bg: var(--surface-2); --btn-border: transparent; }
.btn--small { min-height: 34px; padding: 0 var(--space-4); font-size: 0.85rem; }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: var(--space-4); align-content: start; }
.field label, .field .label { font-weight: 600; font-size: 0.9rem; }
.field .hint { font-size: 0.85rem; color: var(--ink-muted); margin: 0; }
.field .error { font-size: 0.85rem; color: var(--red-strong); margin: 0; display: flex; gap: 6px; }
.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.textarea { min-height: 96px; resize: vertical; }
.select { height: 44px; padding-top: 0; padding-bottom: 0; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-wash); }
.field--invalid .input { border-color: var(--red); }
.two { display: grid; gap: 0 var(--space-4); }
@media (min-width: 640px) { .two { grid-template-columns: 1fr 1fr; } }
fieldset.plain { border: 0; padding: 0; margin: 0 0 var(--space-4); min-width: 0; }
fieldset.plain > legend { padding: 0; margin-bottom: 6px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-5);
}
.card > :last-child { margin-bottom: 0; }

/* Selected / hover state of a choice card: a dashed red "cut line" traced
   around it instead of a filled highlight. */
.card--choice { position: relative; transition: box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease); }
.card--choice::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1.5px dashed var(--red);
  border-radius: calc(var(--radius) + 5px);
  opacity: 0;
  transition: opacity var(--fast) var(--ease);
  pointer-events: none;
}
.card--choice:hover { box-shadow: var(--shadow-lift); }
.card--choice:hover::after, .card--choice.is-selected::after, .card--choice:focus-within::after { opacity: 1; }

/* ---------- pills (status) ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--pill);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-muted);
  white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--ok { background: var(--ok-wash); color: var(--ok); }
.pill--warn { background: var(--warn-wash); color: var(--warn); }
.pill--fail { background: var(--red-wash); color: var(--red-strong); }
.pill--info { background: var(--info-wash); color: var(--info); }

/* ---------- notices ---------- */
.notice {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: var(--space-4);
}
.notice::before { content: "i"; flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font: 700 0.75rem/1 var(--font-body); background: var(--info); color: var(--surface); }
.notice--ok { background: var(--ok-wash); border-color: transparent; }
.notice--ok::before { content: "✓"; background: var(--ok); }
.notice--warn { background: var(--warn-wash); border-color: transparent; }
.notice--warn::before { content: "!"; background: var(--warn); }
.notice--error { background: var(--red-wash); border-color: transparent; }
.notice--error::before { content: "!"; background: var(--red); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); background: var(--surface-2); position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }

/* ---------- stepper (configurator, order timeline) ---------- */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: var(--space-4); }
.steps > li { position: relative; padding-left: 40px; counter-increment: step; }
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: -2px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--red);
  color: var(--red);
  display: grid;
  place-items: center;
  font: 700 0.85rem/1 var(--font-display);
}
.steps > li.is-done::before { content: "✓"; background: var(--red); color: var(--on-red); }

/* ---------- untranslated-string marker (dev only; t() prefixes "¤") ---------- */
.i18n-banner { background: var(--warn-wash); color: var(--warn); font-size: 0.8rem; padding: 4px var(--space-4); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- SVG colour utilities (CSS variables cannot be used in SVG
   presentation attributes, and inline styles are blocked by the CSP) ---------- */
.f-none { fill: none; }
.f-ink { fill: var(--ink); }
.f-muted { fill: var(--ink-muted); }
.f-red { fill: var(--red); }
.f-onred { fill: var(--on-red); }
.f-surface { fill: var(--surface); }
.f-strong { fill: var(--line-strong); }
.s-line { stroke: var(--line); }
.s-strong { stroke: var(--line-strong); }
.s-onred { stroke: var(--on-red); }

/* ---------- roll layout preview (app/View/LayoutSvg.php) ---------- */
.lay { width: 100%; height: auto; display: block; }
.lay-roll { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.lay-margin { fill: var(--surface-2); }
.lay-band { fill: var(--warn-wash); }
.lay-panel { fill: none; stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.lay-label { font: 600 11px var(--font-body); fill: var(--ink-muted); }
.lay-info { fill: var(--surface-2); stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.lay-sheet { fill: var(--paper); }
.lay-sticker { fill: var(--red-wash); }
.lay-kiss { stroke: var(--red); stroke-width: 1.25; fill-opacity: 1; vector-effect: non-scaling-stroke; }
.lay-through { stroke: var(--info); stroke-width: 1.25; vector-effect: non-scaling-stroke; }
.lay-sheet.lay-through { fill: var(--paper); }

.lay-legend { display: flex; flex-wrap: wrap; gap: 4px var(--space-4); margin: 6px 0 0; padding: 0; list-style: none; font-size: 0.8rem; color: var(--ink-muted); }
.lay-legend li { display: inline-flex; align-items: center; gap: 6px; }
.lay-legend i { width: 14px; height: 10px; border-radius: 2px; border: 2px solid; display: inline-block; }
.lay-legend .k { border-color: var(--red); background: var(--red-wash); }
.lay-legend .t { border-color: var(--info); }
.lay-legend .b { border-color: transparent; background: var(--warn-wash); }

/* ---------- one sticker preview (app/View/StickerSvg.php) ---------- */
.sticker-svg { display: block; width: 100%; height: auto; }
.sticker-svg .st-vinyl { fill: #ffffff; stroke: var(--line-strong); stroke-width: 0.4; }
.sticker-svg .st-cut { fill: none; stroke: var(--red); stroke-width: 0.8; stroke-dasharray: 2.5 2; }

/* shared by admin and the public cart/checkout */
.calc-lines { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--space-2); margin: 0; font-size: 0.8rem; }
.calc-lines dt { color: var(--ink-muted); }
.calc-lines dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; min-height: 32px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-muted); }
.status--awaiting_payment::before, .status--payment_claimed::before { background: var(--warn); }
.status--paid::before, .status--in_production::before { background: var(--info); }
.status--ready::before, .status--completed::before { background: var(--ok); }
.status--cancelled, .status--expired { color: var(--ink-muted); }
.status--payment_claimed { background: var(--warn-wash); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: var(--on-red); font-size: 0.75rem; font-weight: 700; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.item-row { display: flex; gap: var(--space-3); align-items: center; min-width: 0; }
.item-pic { flex: none; width: 72px; height: 72px; display: grid; place-items: center; background: var(--surface-2); border-radius: var(--radius-sm); padding: 6px; }
.item-pic .sticker-svg { max-height: 60px; }
.item-text { display: grid; gap: 2px; min-width: 0; }
.item-text > * { overflow-wrap: anywhere; }
.warn-text { color: var(--red-strong); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 var(--space-3); border-left: 2px solid var(--line); display: grid; gap: var(--space-2); }
.timeline li { display: grid; }
.pay-qr { width: 240px; height: 240px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: var(--radius-sm); }
/* A secondary action that must be easy to spot (e.g. "Use another image"). */
.btn--outline { --btn-bg: var(--red-wash); --btn-fg: var(--red-strong); --btn-border: var(--red); border-width: 1.5px; }
.btn--outline:hover { --btn-bg: var(--red); --btn-fg: var(--on-red); --btn-border: var(--red); }
