/* =============================================================================
   SUPER WHITE — components.css
   Direct-response product page components. All states. Mobile-first.
   Requires colors_and_type.css (tokens + @layer order) loaded first.
   Compliance is baked in: NO before/after, NO reviews class, NO fake timers.
   ============================================================================= */

@layer components {

  /* ===========================================================================
     ICON  — outline SVG sprite (assets/icons.svg). 24px default, ≥32px spacing.
     =========================================================================== */
  .icon {
    width: 24px; height: 24px; flex: none;
    fill: none; stroke: currentColor;
    stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  }
  .icon--sm { width: 20px; height: 20px; }
  .icon--lg { width: 28px; height: 28px; }
  /* filled glyphs (check inside circle) opt out of stroke styling */
  .icon--fill { fill: currentColor; stroke: none; }

  /* ===========================================================================
     SECTION RHYTHM
     =========================================================================== */
  .section { padding-block: var(--s-12); }
  .section--soft { background: var(--soft); }
  .section__head {
    max-width: var(--measure); margin-inline: auto;
    text-align: center;                 /* short headings → center (UX 12) */
    margin-bottom: var(--s-8);
  }
  .section__head .kicker { margin-bottom: var(--s-3); }
  .section__title { }
  .section__lead {
    margin-top: var(--s-3);
    font-size: var(--fs-lead); color: var(--ink-2);
  }

  /* ===========================================================================
     KICKER  — category / context marker above a heading
     =========================================================================== */
  .kicker {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font-body);
    font-size: var(--fs-meta); font-weight: var(--fw-bold);
    letter-spacing: var(--ls-kicker); text-transform: uppercase;
    color: var(--brand-ink);
  }
  .kicker .icon { width: 16px; height: 16px; color: var(--brand); }

  /* ===========================================================================
     BUTTON  — cta / brand / ghost. ≥48px. Optionally full-width.
     =========================================================================== */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
    min-height: var(--tap-min);
    padding-inline: var(--s-6);
    font-family: var(--font-body);
    font-size: clamp(1rem, 0.95rem + 0.3vw, 1.0625rem);
    font-weight: var(--fw-bold);
    line-height: 1; white-space: nowrap; text-decoration: none;
    border: 1.5px solid transparent; border-radius: var(--r-md);
    cursor: pointer; user-select: none;
    transition: background var(--dur) var(--ease),
                border-color var(--dur) var(--ease),
                transform var(--dur) var(--ease);
  }
  .btn .icon { width: 20px; height: 20px; }
  .btn--block { width: 100%; }
  .btn:active { transform: translateY(1px); }
  .btn:focus-visible { box-shadow: var(--ring); }
  .btn[disabled], .btn[aria-disabled="true"] {
    opacity: .5; cursor: not-allowed; transform: none;
  }

  .btn--cta   { background: var(--cta);   color: #fff; }
  .btn--cta:hover    { background: var(--cta-hover); }
  .btn--cta:active   { background: var(--cta-active); }

  .btn--brand { background: var(--brand); color: #fff; }
  .btn--brand:hover  { background: var(--brand-hover); }
  .btn--brand:active { background: var(--brand-active); }

  .btn--ghost { background: transparent; color: var(--brand-ink);
                border-color: var(--line-strong); }
  .btn--ghost:hover  { background: var(--ghost-hover); border-color: var(--brand); }
  .btn--ghost:active { background: var(--brand-tint); }

  /* ===========================================================================
     BADGE  — sale / brand / success. Pills, icon optional.
     =========================================================================== */
  .badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-body);
    font-size: var(--fs-meta); font-weight: var(--fw-bold);
    line-height: 1; letter-spacing: .02em;
    padding: 6px 10px; border-radius: var(--r-pill);
  }
  .badge .icon { width: 14px; height: 14px; }
  .badge--sale    { background: color-mix(in oklab, var(--sale) 13%, white);
                    color: var(--sale); }
  .badge--brand   { background: var(--brand-tint); color: var(--brand-ink); }
  .badge--success { background: var(--success-tint);
                    color: color-mix(in oklab, var(--success) 78%, black); }
  .badge--cta     { background: var(--cta-tint); color: var(--cta-ink); }

  /* ===========================================================================
     PRICE  — old (struck, red line only) + new (largest number) + currency
     =========================================================================== */
  .price { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s-3); }
  .price__now {
    font-family: var(--font-display);
    font-size: var(--fs-price); font-weight: var(--fw-x);
    line-height: 1; letter-spacing: var(--ls-tight); color: var(--ink);
  }
  .price__cur { font-size: .5em; font-weight: var(--fw-bold); color: var(--ink-2);
                margin-left: 2px; }
  .price__old {
    font-family: var(--font-display);
    font-size: var(--fs-h3); font-weight: var(--fw-semi);
    color: var(--muted);
    text-decoration: line-through;
    text-decoration-color: var(--sale);   /* the ONLY use of red */
    text-decoration-thickness: 2px;
  }

  /* ===========================================================================
     CARD
     =========================================================================== */
  .card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    padding: var(--s-6);
  }
  .card--flat   { box-shadow: none; }
  .card--pad-lg { padding: var(--s-8); }
  .card--raised { box-shadow: var(--shadow-2); }

  /* ===========================================================================
     FORM FIELD  — label↔field 5px, field↔group 20px.
     :user-valid / :user-invalid → colour + icon + message.
     =========================================================================== */
  .field { display: flex; flex-direction: column; gap: var(--gap-label);
           margin-bottom: var(--gap-group); }
  .field__label { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--ink); }
  .field__hint  { font-size: var(--fs-meta); color: var(--muted); }

  .field__control { position: relative; display: flex; }
  .input {
    width: 100%; min-height: var(--tap-min);
    padding: 12px 14px; padding-right: 42px;
    font-family: var(--font-body); font-size: 16px;   /* ≥16px → no iOS zoom */
    color: var(--ink); background: var(--surface);
    border: 1.5px solid var(--line-strong); border-radius: var(--r-md);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  }
  .input::placeholder { color: var(--muted); }
  .input:hover { border-color: color-mix(in oklab, var(--brand) 32%, var(--line-strong)); }
  .input:focus-visible { border-color: var(--brand); box-shadow: var(--ring); outline: none; }
  textarea.input { min-height: 96px; padding-right: 14px; resize: vertical; }

  /* width = format hint (UX 9) */
  .field--wide  { }                              /* phone — full width (default) */
  .field--small .input { max-width: 150px; padding-right: 14px; } /* code / age / index */

  /* status icons (shown only after user interaction via :user-valid/:user-invalid) */
  .field__status { position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
                   display: none; pointer-events: none; }
  .field__status.icon--valid   { color: var(--success); }
  .field__status.icon--invalid { color: var(--sale); }
  .field__control:has(.input:user-valid)   .field__status.icon--valid   { display: block; }
  .field__control:has(.input:user-invalid) .field__status.icon--invalid { display: block; }
  .input:user-valid   { border-color: var(--success); }
  .input:user-invalid { border-color: var(--sale); }

  /* message line — colour + text, not colour alone */
  .field__msg { display: none; align-items: center; gap: 6px;
                margin-top: 5px; font-size: var(--fs-meta); }
  .field__msg .icon { width: 14px; height: 14px; }
  .field__msg--error { color: var(--sale); }
  .field:has(.input:user-invalid) .field__msg--error { display: flex; }

  /* consent — checkbox + full label clickable, ≥48px row */
  .consent {
    display: flex; align-items: flex-start; gap: var(--s-3);
    min-height: var(--tap-min); padding-block: 6px; cursor: pointer;
  }
  .consent input[type="checkbox"] {
    width: 22px; height: 22px; margin: 1px 0 0; flex: none;
    accent-color: var(--brand); cursor: pointer;
  }
  .consent__text { font-size: var(--fs-sm); color: var(--ink-2); }
  .consent__text a { font-weight: var(--fw-semi); }

  /* ===========================================================================
     CHECKLIST  — benefit list with check icons
     =========================================================================== */
  .checklist { list-style: none; margin: 0; padding: 0;
               display: flex; flex-direction: column; gap: var(--s-3); }
  .checklist li { display: flex; align-items: flex-start; gap: var(--s-3); }
  .checklist .icon { color: var(--success); margin-top: 1px; }

  /* ===========================================================================
     TRUST BADGES  — ЕАЭС / разработка / натуральный состав (outline icon + text)
     =========================================================================== */
  .trust-badges { display: flex; flex-wrap: wrap; gap: var(--s-3); }
  .trust-badge {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--ink-2);
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-pill); padding: 8px 14px;
  }
  .trust-badge .icon { width: 20px; height: 20px; color: var(--brand); }

  /* ===========================================================================
     HERO  — 1 → 2 columns. kicker + H1 + bullets + trust  |  media + order form
     =========================================================================== */
  .hero { padding-block: var(--s-10) var(--s-12); }
  .hero__grid { display: grid; grid-template-columns: 1fr; gap: var(--s-8); }
  .hero__title { margin-top: var(--s-3); }
  .hero__lead { margin-top: var(--s-4); max-width: var(--measure);
                font-size: var(--fs-lead); color: var(--ink-2); }
  .hero__bullets { margin-top: var(--s-5); }
  .hero__trust   { margin-top: var(--s-6); }
  .hero__media {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1);
  }
  .hero__photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--soft); }
  .hero__aside { display: flex; flex-direction: column; gap: var(--s-5); }
  @media (min-width: 880px) {
    .hero__grid { grid-template-columns: 1.05fr 0.95fr; align-items: start; }
  }

  /* ===========================================================================
     PRODUCT PREVIEW  — form ≈ result (photo + price next to the order form)
     =========================================================================== */
  .preview {
    display: flex; align-items: center; gap: var(--s-4);
    padding: var(--s-3); background: var(--soft); border-radius: var(--r-md);
  }
  .preview__img {
    width: 72px; height: 72px; flex: none; aspect-ratio: 1;
    object-fit: cover; border-radius: var(--r-sm);
    background: var(--surface); border: 1px solid var(--line);
  }
  .preview__name { font-weight: var(--fw-bold); color: var(--ink); }
  .preview__meta { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }

  /* ===========================================================================
     RADIO-AS-CARDS (packs)  — :has() + .is-selected fallback. Recommended preselected.
     =========================================================================== */
  .packs { display: grid; grid-template-columns: 1fr; gap: var(--s-3); }
  @media (min-width: 560px) { .packs--row { grid-template-columns: repeat(3, 1fr); } }

  .pack { position: relative; display: block; cursor: pointer; }
  .pack input { position: absolute; opacity: 0; width: 0; height: 0; }
  .pack__body {
    display: flex; align-items: center; gap: var(--s-4);
    min-height: var(--tap-min);
    padding: var(--s-4); padding-right: var(--s-5);
    background: var(--surface);
    border: 1.5px solid var(--line-strong); border-radius: var(--r-md);
    transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease);
  }
  .pack__radio {
    width: 22px; height: 22px; flex: none; border-radius: var(--r-pill);
    border: 2px solid var(--line-strong); position: relative;
    transition: border-color var(--dur) var(--ease);
  }
  .pack__radio::after {
    content: ""; position: absolute; inset: 4px; border-radius: var(--r-pill);
    background: var(--brand); transform: scale(0); transition: transform var(--dur) var(--ease);
  }
  .pack__qty  { font-family: var(--font-display); font-size: 1.6rem; font-weight: var(--fw-x);
                line-height: 1; color: var(--ink); }
  .pack__info { display: flex; flex-direction: column; gap: 2px; margin-right: auto; }
  .pack__unit { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--ink); }
  .pack__per  { font-size: var(--fs-meta); color: var(--muted); }
  .pack__price { font-family: var(--font-display); font-weight: var(--fw-bold); color: var(--ink); }
  .pack__badge { position: absolute; top: -10px; right: var(--s-4); }

  .pack:hover .pack__body { border-color: color-mix(in oklab, var(--brand) 45%, var(--line-strong)); }
  .pack:has(input:checked) .pack__body,
  .pack.is-selected .pack__body {
    border-color: var(--brand); background: var(--brand-tint);
    box-shadow: inset 0 0 0 1px var(--brand);
  }
  .pack:has(input:checked) .pack__radio,
  .pack.is-selected .pack__radio { border-color: var(--brand); }
  .pack:has(input:checked) .pack__radio::after,
  .pack.is-selected .pack__radio::after { transform: scale(1); }
  .pack input:focus-visible ~ .pack__body { box-shadow: var(--ring); }

  /* ===========================================================================
     ORDER BLOCK  — wrapper: preview + packs + form + price + CTA
     =========================================================================== */
  .order { display: flex; flex-direction: column; gap: var(--gap-group); }
  .order__price { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-3) var(--s-4); }
  .order > .btn--cta { margin-top: var(--s-1); }

  /* ===========================================================================
     MECHANISM  — "как работает": text + optional figure. No before/after.
     =========================================================================== */
  .mechanism { display: grid; grid-template-columns: 1fr; gap: var(--s-6); align-items: center; }
  .mechanism__text { max-width: var(--measure); }       /* >3 lines → left aligned */
  .mechanism__text p + p { margin-top: var(--s-4); }
  .mechanism__figure {
    background: var(--soft); border: 1px solid var(--line);
    border-radius: var(--r-lg); aspect-ratio: 4 / 3;
    display: grid; place-items: center; color: var(--brand);
  }
  .mechanism__figure .icon { width: 56px; height: 56px; }
  @media (min-width: 780px) { .mechanism { grid-template-columns: 1.15fr 0.85fr; gap: var(--s-10); } }

  /* ===========================================================================
     SITUATIONS  — grid of contexts (NOT diagnoses). icon-circle + short label.
     =========================================================================== */
  .situations { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-5) var(--s-4); }
  @media (min-width: 720px) { .situations { grid-template-columns: repeat(4, 1fr); } }
  .situation { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-3); }
  .situation__icon {
    width: 56px; height: 56px; border-radius: var(--r-pill);
    background: var(--brand-tint); color: var(--brand);
    display: grid; place-items: center;
  }
  .situation__icon .icon { width: 26px; height: 26px; }
  .situation__label { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--ink-2); }

  /* ===========================================================================
     INGREDIENT CARD  — media + name + dose + role line (S/F). Grid 2-up.
     =========================================================================== */
  .ingredients { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
  @media (min-width: 620px) { .ingredients { grid-template-columns: repeat(2, 1fr); } }
  .ingredient {
    display: flex; gap: var(--s-4);
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-md); padding: var(--s-4);
  }
  .ingredient__media {
    width: 64px; height: 64px; flex: none; aspect-ratio: 1;
    object-fit: cover; border-radius: var(--r-sm);
    background: var(--soft); border: 1px solid var(--line);
  }
  .ingredient__head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px var(--s-3); }
  .ingredient__name { font-weight: var(--fw-bold); color: var(--ink); }
  .ingredient__dose {
    font-family: var(--font-display); font-size: var(--fs-sm); font-weight: var(--fw-bold);
    color: var(--brand-ink); background: var(--brand-tint);
    padding: 2px 8px; border-radius: var(--r-pill);
  }
  .ingredient__role { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 4px; }

  /* ===========================================================================
     EXPERT / DOCTOR  — round portrait + name + credentials + quote
     =========================================================================== */
  .expert {
    display: flex; gap: var(--s-5); align-items: flex-start;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: var(--s-6); box-shadow: var(--shadow-1);
  }
  .expert__portrait {
    width: 84px; height: 84px; flex: none; aspect-ratio: 1;
    object-fit: cover; border-radius: var(--r-pill);
    background: var(--soft); border: 1px solid var(--line);
  }
  .expert__name { font-weight: var(--fw-bold); color: var(--ink); }
  .expert__cred { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
  .expert__quote { margin-top: var(--s-3); color: var(--ink-2); }

  /* ===========================================================================
     DOCUMENTS / TRUST  — cert thumbnail (→ PDF) + decl № + organ. Replaces reviews.
     =========================================================================== */
  .documents { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
  @media (min-width: 620px) { .documents { grid-template-columns: repeat(2, 1fr); } }
  .document {
    display: flex; align-items: center; gap: var(--s-4);
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-md); padding: var(--s-4);
    text-decoration: none; color: inherit;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  }
  .document:hover { border-color: var(--brand); box-shadow: var(--shadow-1); }
  .document:focus-visible { box-shadow: var(--ring); }
  .document__thumb {
    width: 58px; height: 76px; flex: none;
    display: grid; place-items: center; color: var(--brand);
    background: var(--success-tint); border: 1px solid var(--line);
    border-radius: var(--r-sm);
  }
  .document__thumb .icon { width: 28px; height: 28px; }
  .document__title { font-weight: var(--fw-bold); color: var(--ink); font-size: var(--fs-sm); }
  .document__meta  { font-size: var(--fs-meta); color: var(--muted); margin-top: 3px; }
  .document__rank  { margin-top: 6px; }

  /* ===========================================================================
     FAQ  — native <details>. icon + question + short answer.
     =========================================================================== */
  .faq { display: flex; flex-direction: column; gap: var(--s-3); }
  .faq__item {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-md); overflow: hidden;
  }
  .faq__item summary {
    display: flex; align-items: center; gap: var(--s-3);
    min-height: var(--tap-min); padding: var(--s-4);
    font-weight: var(--fw-semi); color: var(--ink);
    cursor: pointer; list-style: none;
  }
  .faq__item summary::-webkit-details-marker { display: none; }
  .faq__item summary:hover { background: var(--soft); }
  .faq__item summary .icon--q { color: var(--brand); flex: none; }
  .faq__item summary .chev { margin-left: auto; color: var(--muted);
                             transition: transform var(--dur) var(--ease); }
  .faq__item[open] summary .chev { transform: rotate(180deg); }
  .faq__answer { padding: 0 var(--s-4) var(--s-4) calc(var(--s-4) + 24px + var(--s-3));
                 color: var(--ink-2); }
  .faq__item summary:focus-visible { box-shadow: var(--ring); border-radius: var(--r-md); }

  /* ===========================================================================
     DISCLAIMER  — --inline (repeatable strip) / --footer (legal) / --bar (sticky)
     Always visible, ≥13px, AA contrast. Never hidden.
     =========================================================================== */
  .disclaimer { font-size: var(--fs-meta); line-height: 1.5; color: var(--ink-2); }
  .disclaimer--inline {
    display: flex; gap: var(--s-2);
    background: var(--soft); border-radius: var(--r-sm);
    padding: var(--s-3) var(--s-4);
  }
  .disclaimer--inline .icon { width: 16px; height: 16px; flex: none; color: var(--muted); margin-top: 1px; }
  .disclaimer--footer { color: var(--muted); max-width: 70ch; }
  .disclaimer--bar {
    position: sticky; bottom: 0; z-index: 40;
    background: color-mix(in oklab, var(--ink) 94%, black);
    color: color-mix(in oklab, #fff 84%, transparent);
    padding: var(--s-3) var(--s-4); text-align: center;
  }

  /* ===========================================================================
     STICKY CTA BAR  (mobile)  — price + button in thumb-zone
     =========================================================================== */
  .sticky-cta {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: flex; align-items: center; gap: var(--s-4);
    padding: var(--s-3) var(--s-4);
    padding-bottom: max(var(--s-3), env(safe-area-inset-bottom));
    background: color-mix(in oklab, var(--surface) 90%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 20px rgba(22,46,60,.08);
  }
  .sticky-cta__price { flex: none; }
  .sticky-cta__now { font-family: var(--font-display); font-weight: var(--fw-x);
                     font-size: 1.25rem; color: var(--ink); line-height: 1; }
  .sticky-cta__old { font-size: var(--fs-meta); color: var(--muted);
                     text-decoration: line-through; text-decoration-color: var(--sale); }
  .sticky-cta .btn { flex: 1; }
  @media (min-width: 880px) { .sticky-cta--mobile { display: none; } }

  /* ===========================================================================
     SITE FOOTER  — legal links + full disclaimer
     =========================================================================== */
  .site-footer { background: var(--surface); border-top: 1px solid var(--line);
                 padding-block: var(--s-10); }
  .site-footer__links { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6);
                        margin-bottom: var(--s-6); }
  .site-footer__links a { font-size: var(--fs-sm); color: var(--ink-2); text-decoration: none; }
  .site-footer__links a:hover { color: var(--brand); }

}
