/* Reset, typography, buttons, form controls, overlays and the toast, shared by the pages (architecture 7.1; PLAT-024, PLAT-022,
   PLAT-026, APP-008). The tokens come from tokens.css; the button colours of the owner's look are --btn-leading, --btn-standby and
   --btn-text, which exist only when she has chosen them ("Автоматично" sets none, so the token defaults apply). */
*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-gutter: stable; scroll-behavior: smooth; font-size: 16px; }
body { margin: 0; font-family: var(--font-body); color: var(--clr-text-main); background: var(--clr-bg); line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: clip; }
h1, h2, h3 { margin: 0 0 var(--sp-2); font-family: var(--font-heading); line-height: 1.2; }
p { margin: 0 0 1rem; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button { padding: 0; border: none; background: none; font-family: inherit; color: inherit; cursor: pointer; }
a:focus-visible, button:focus-visible, .field:focus-visible { outline: 2px solid var(--clr-primary); outline-offset: 2px; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--sp-4); }
.section-header { margin-bottom: var(--sp-6); text-align: center; }
.section-subtitle { display: block; margin-bottom: 0.5rem; font-family: var(--font-heading); font-size: 0.85rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--clr-secondary); }
.section-title { margin-bottom: 0.8rem; font-size: 2.4rem; color: var(--clr-accent); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--clr-border); }

/* Buttons (APP-008): the glossy primary one follows the leading colour, the secondary one is white. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); padding: 0.75rem 1.5rem; border: 1px solid transparent;
  border-radius: var(--radius-md); font-family: var(--font-heading); font-size: inherit; font-weight: 600; text-align: center; transition: var(--transition);
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; } /* AF55: a pale button that still answers a tap looks as a disabled one */
.btn--primary {
  color: var(--btn-text, #fff); border-color: rgba(255, 255, 255, 0.22); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(0, 0, 0, 0.05) 100%), var(--btn-leading, var(--clr-primary));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 3px 8px rgba(0, 0, 0, 0.08), 0 6px 18px color-mix(in srgb, var(--btn-leading, var(--clr-primary)) 28%, transparent);
}
.btn--primary:hover:not(:disabled, [aria-disabled="true"]) { filter: brightness(1.03); transform: translateY(-2px); }
.btn--primary:active:not(:disabled, [aria-disabled="true"]) { filter: brightness(0.97); transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2); }
.btn--secondary { color: #475569; background: #fff; border: 1.5px solid #cbd5e1; box-shadow: inset 0 1px 0 #fff, 0 1px 3px rgba(0, 0, 0, 0.05); }
.btn--secondary:hover:not(:disabled) { color: #0f172a; background: #f8fafc; border-color: #94a3b8; transform: translateY(-2px); }
.btn--secondary:active:not(:disabled) { background: #f1f5f9; transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08); }
.btn--ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn--lg { padding: 0.9rem 2rem; font-size: 1.05rem; }
.btn--small { padding: 0.4rem 0.9rem; font-size: 0.88rem; border-radius: var(--radius-sm); }
.btn--block { width: 100%; }

/* Form controls (PLAT-024 rule 5). */
.field { width: 100%; padding: 0.75rem 1rem; border: 1.5px solid #cbd5e1; border-radius: var(--radius-sm); background: #fff; color: #1e293b; font: inherit; font-size: 0.95rem; transition: var(--transition); }
.field:focus { outline: none; border-color: var(--clr-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--clr-primary) 15%, transparent); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-size: 0.85rem; font-weight: 600; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

/* Pills (APP-009): filter pills, tabs and the labels of a toy. At rest they are the standby colour, active ones the leading
   colour; the two pills of availability keep their own meaning whatever
   the theme (APP-009 rule 5, OQ-APP-06): green for ready, amber for made to order; slate otherwise. */
.pill {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 1rem; border: 1.5px solid rgba(255, 255, 255, 0.22); border-radius: var(--radius-full);
  font-size: 0.88rem; font-weight: 600; color: var(--btn-text, #fff); transition: var(--transition);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.05)), var(--btn-standby, var(--clr-accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 3px 8px color-mix(in srgb, var(--btn-standby, var(--clr-accent)) 22%, transparent);
}
.pill:hover { filter: brightness(1.06); transform: translateY(-1px); }
.pill--active, .pill[aria-pressed="true"] { transform: translateY(-1px); background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.05)), var(--btn-leading, var(--clr-accent)); }
.pill--ready.pill--active { background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.05)), var(--clr-ready); }
.pill--custom.pill--active { background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.05)), var(--clr-custom); }

/* Overlays (PLAT-022): one backdrop and one card for a window, a drawer, a sheet and a full page. The page is locked while
   one is drawn, and its layer is its place in the stack (--depth); the closing behaviour is declared in the markup. */
html:has(.overlay) { overflow: hidden; overscroll-behavior: none; }
.overlay {
  position: fixed; inset: 0; z-index: calc(var(--z-modal) + var(--depth, 0) * 10); display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4); background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(6px); overscroll-behavior: contain; animation: overlayIn 0.3s ease;
}
.overlay__panel { position: relative; width: 100%; max-width: 720px; max-height: 90vh; padding: 1.8rem; overflow: hidden auto; border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-lg); }
.overlay__panel:focus { outline: none; }
.overlay__close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 1px solid #cbd5e1; border-radius: 50%; background: #f1f5f9; color: #64748b;
  line-height: 1; transition: transform 0.3s ease, background 0.2s, color 0.2s, border-color 0.2s;
}
.overlay__close:hover { transform: rotate(90deg); background: #fee2e2; color: #ef4444; border-color: #fca5a5; }
.overlay--drawer { z-index: calc(var(--z-drawer) + var(--depth, 0) * 10); justify-content: flex-end; align-items: stretch; padding: 0; }
.overlay--drawer .overlay__panel { max-width: 420px; max-height: none; border-radius: 0; }
.overlay--sheet { align-items: flex-end; padding: 0; }
.overlay--sheet .overlay__panel { max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.overlay--page { padding: 0; }
.overlay--page .overlay__panel { max-width: none; max-height: none; height: 100%; border-radius: 0; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

/* The toast (PLAT-026): bottom right, above everything. */
.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: var(--z-toast); padding: 0.75rem 1.25rem; border-radius: var(--radius-sm); color: #fff; font-size: 0.9rem; font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.toast[data-state="open"] { opacity: 1; }
.toast--success { background: #16a34a; }
.toast--error { background: var(--clr-danger); }

@media (max-width: 767.98px) {
  .section-title { font-size: 1.8rem; }
  .container { padding: 0 var(--sp-3); }
  .toast { left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); }
}
@media (max-width: 600px) {
  .overlay { padding: var(--sp-3); }
  .overlay__panel { padding: 1.4rem 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms; transition-duration: 0.01ms; scroll-behavior: auto; }
}

/* What the storefront and the admin both draw (the widgets of lib/widgets.js and lib/toast.js): the pills of a filter, the search box, the sewing buttons of the ratings, the question window. */
.pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }
/* The search box (CAT-004), shared by the catalogue and the Collections page; its focus ring follows the leading colour (OQ-APP-11). */
.search { display: flex; align-items: center; gap: 0.4rem; min-width: 190px; max-width: 250px; height: 38px; padding: 0 0.7rem; border: 1.5px solid #cbd5e1; border-radius: var(--radius-full); background: #fff; transition: var(--transition); }
.search:hover { border-color: #94a3b8; }
.search:focus-within { border-color: var(--btn-leading, var(--clr-primary)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--btn-leading, var(--clr-primary)) 18%, transparent); }
.search__input { flex: 1; min-width: 0; border: none; background: none; outline: none; color: #1e293b; font: inherit; font-size: 0.88rem; font-weight: 500; }
.search__input::placeholder { color: #94a3b8; }
.search__clear { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #e2e8f0; color: #64748b; font-size: 0.72rem; font-weight: 700; }
.search__clear:hover { background: #cbd5e1; color: #0f172a; }
/* The sewing buttons of the ratings (REV-010): the colours of the five positions are the class of the position. */
.rbtns { display: inline-flex; gap: 2px; vertical-align: middle; }
.rbtn { flex: none; filter: drop-shadow(0 1.5px 2.5px rgba(0, 0, 0, 0.12)); transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease, opacity 0.2s ease; }
.rbtn__rim { fill: var(--fill, #f8fafc); stroke: var(--line, #cbd5e1); stroke-width: 4.5; }
.rbtn__face { fill: var(--mid, #f1f5f9); fill-opacity: 0.38; }
.rbtn__hole { fill: var(--holes, #cbd5e1); }
.rbtn--empty .rbtn__face { fill-opacity: 0.6; }
.rbtn--1 { --fill: #facc15; --line: #ca8a04; --mid: #eab308; --holes: #713f12; }
.rbtn--2 { --fill: #22c55e; --line: #15803d; --mid: #16a34a; --holes: #14532d; }
.rbtn--3 { --fill: #38bdf8; --line: #0284c7; --mid: #0ea5e9; --holes: #0c4a6e; }
.rbtn--4 { --fill: #a855f7; --line: #7e22ce; --mid: #9333ea; --holes: #581c87; }
.rbtn--5 { --fill: #ec4899; --line: #be185d; --mid: #db2777; --holes: #831843; }
.overlay__panel.ask, .overlay__panel.confirm { max-width: 540px; }
.ask__text { margin: 0 0 0.8rem; font-size: 1rem; }
.ask__buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.ask__buttons .btn { flex: 1 1 11rem; }
/* REV-011: the badge of a review that came through an invitation, on the storefront and in the admin's list. */
.review__verified { padding: 1.5px 7px; border: 1px solid #a7f3d0; border-radius: 12px; background: #ecfdf5; color: #047857; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.2px; }
