/* ============================================================
   Компоненты — переиспользуемые элементы интерфейса
   (кнопки, заголовки секций, FAQ, плитки)
   ============================================================ */

@layer components {

  /* ---------- Кнопки ---------- */
  .btn {
    --btn-bg: var(--ink);
    --btn-fg: var(--bg);
    --btn-bd: var(--ink);
    --btn-bg-hover: var(--ink-2);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 22px;
    font-family: var(--font-text);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -.005em;
    line-height: 1;
    background: var(--btn-bg);
    color: var(--btn-fg);
    border: 1px solid var(--btn-bd);
    border-radius: var(--r-pill);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: background var(--t) var(--ease),
                color var(--t) var(--ease),
                border-color var(--t) var(--ease),
                transform var(--t) var(--ease),
                box-shadow var(--t) var(--ease);
  }
  .btn:hover { background: var(--btn-bg-hover); transform: translateY(-1px); }
  .btn:active { transform: translateY(0); }

  .btn--primary {
    --btn-bg: #E6BD60;
    --btn-fg: #2A1A08;
    --btn-bd: #E6BD60;
    --btn-bg-hover: #F2CC72;
    font-weight: 600;
    box-shadow: 0 8px 24px -8px rgba(200, 150, 40, .38);
  }
  .btn--ghost {
    --btn-bg: transparent;
    --btn-fg: var(--ink);
    --btn-bd: var(--line-strong);
    --btn-bg-hover: var(--ink);
  }
  .btn--ghost:hover { color: var(--bg); }
  .btn--quiet {
    --btn-bg: transparent;
    --btn-fg: var(--ink);
    --btn-bd: transparent;
    --btn-bg-hover: var(--bg-2);
    padding: 10px 14px;
  }
  :root[data-theme="night"] .btn--quiet:hover { color: var(--ink); }

  .btn--lg { padding: 17px 28px; font-size: 16px; }
  .btn--block { width: 100%; }

  .btn .arrow { transition: transform var(--t) var(--ease); }
  .btn:hover .arrow { transform: translateX(3px); }

  /* ---------- Заголовок секции ---------- */
  .sec-head { margin-bottom: clamp(32px, 4vw, 56px); }
  .sec-head--center { text-align: center; }

  .sec-head__num {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--gold-lo);
    font-weight: 500;
    margin-bottom: 16px;
  }
  :root[data-theme="night"] .sec-head__num { color: var(--gold); }
  .sec-head__num::before {
    content: "";
    width: 28px;
    height: 1px;
    background: currentColor;
    opacity: .6;
  }
  .sec-head--center .sec-head__num { justify-content: center; }
  .sec-head--center .sec-head__num::before { display: none; }

  .sec-head__title {
    font-family: var(--font-display);
    font-size: clamp(34px, 4vw, 56px);
    line-height: 1.04;
    letter-spacing: -.025em;
    font-weight: 380;
    color: var(--ink);
  }
  .sec-head__title em {
    font-style: italic;
    font-family: var(--font-serif);
    color: var(--gold-lo);
    font-weight: 500;
  }
  :root[data-theme="night"] .sec-head__title em { color: var(--gold-hi); }

  /* ---------- Заголовок секции (вариант с подзаголовком) ---------- */
  /* max-width убран: заголовок sекции идёт на полную ширину, как контент под ним */
  .s-head { margin-bottom: clamp(36px, 4vw, 56px); }

  .s-head--compact { margin-bottom: clamp(20px, 2.5vw, 32px); }
  .s-head--compact .s-head__title { font-size: clamp(22px, 2.5vw, 32px); }

  .s-head__title {
    font-family: var(--font-display);
    font-size: clamp(34px, 4vw, 56px);
    line-height: 1.04;
    letter-spacing: -.025em;
    font-weight: 380;
    color: var(--ink);
    margin-top: 8px;
  }
  .s-head__title em {
    font-style: italic;
    font-family: var(--font-serif);
    color: var(--gold-lo);
    font-weight: 500;
  }
  :root[data-theme="night"] .s-head__title em { color: var(--gold-hi); }
  .s-head__sub {
    margin-top: 18px;
    font-size: 17px;
    line-height: 1.6;
    color: var(--ink-2);
    max-width: 64ch;
  }

  /* ---------- Плитки (Темы / Спец-расчёты) ---------- */
  .tiles { display: grid; gap: clamp(14px, 1.6vw, 22px); }
  .tiles--2 { grid-template-columns: repeat(2, 1fr); }
  .tiles--3 { grid-template-columns: repeat(3, 1fr); }

  .tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-4);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 28px;
    overflow: hidden;
    color: var(--ink);
    transition: transform var(--t) var(--ease),
                box-shadow var(--t) var(--ease),
                border-color var(--t) var(--ease);
  }
  .tile::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--gold);
    transition: width .35s var(--ease);
  }
  .tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
  .tile:hover::before { width: 100%; }

  .tile__num {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--gold-lo);
  }
  :root[data-theme="night"] .tile__num { color: var(--gold-hi); }
  .tile__title {
    font-family: var(--font-display);
    font-size: 22px;
    letter-spacing: -.01em;
    font-weight: 400;
    color: var(--ink);
  }
  .tile__desc { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
  .tile--lg .tile__desc { max-width: 50ch; }
  .tile__arrow {
    margin-top: auto;
    font-family: var(--font-display);
    font-style: italic;
    color: var(--gold-lo);
    font-size: 24px;
    align-self: flex-end;
    line-height: 1;
    transition: transform var(--t) var(--ease);
  }
  .tile:hover .tile__arrow { transform: translateX(4px); }
  .tile--lg { padding: 36px; }
  .tile--lg .tile__title { font-size: 26px; }

  @media (max-width: 920px) {
    .tiles--3 { grid-template-columns: 1fr 1fr; }
  }
  @media (max-width: 760px) {
    .tiles--2, .tiles--3 { grid-template-columns: 1fr; }
  }

  /* ---------- FAQ (аккордеон, общий для всех страниц) ---------- */
  .faq-v6 { counter-reset: fqv6; }
  .faq-v6__col { display: flex; flex-direction: column; }

  .faq-v6 details {
    counter-increment: fqv6;
    padding: 22px 0;
    border-bottom: 1px solid var(--line);
  }
  .faq-v6 summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    grid-template-columns: 48px 1fr 32px;
    gap: 18px;
    align-items: start;
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 1.25;
    letter-spacing: -.01em;
    font-weight: 420;
    color: var(--ink);
    text-wrap: balance;
  }
  .faq-v6 summary::-webkit-details-marker { display: none; }
  .faq-v6 summary::before {
    content: counter(fqv6, decimal-leading-zero);
    font-family: var(--font-display);
    font-style: italic;
    color: var(--gold-lo);
    font-size: 32px;
    line-height: .9;
    font-weight: 380;
  }
  .faq-v6 summary::after {
    content: "+";
    width: 32px;
    height: 32px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--ink-3);
    font-size: 18px;
    line-height: 1;
    align-self: center;
    transition: background var(--t) var(--ease),
                color var(--t) var(--ease),
                border-color var(--t) var(--ease),
                transform var(--t) var(--ease);
  }
  .faq-v6 details[open] summary::after {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
    transform: rotate(45deg);
  }
  .faq-v6 details > div {
    padding: 18px 14px 0 66px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink-2);
    animation: faqSlide .3s var(--ease);
  }
  .faq-v6 details > div a {
    color: var(--gold-lo);
    border-bottom: 1px solid currentColor;
  }
  :root[data-theme="night"] .faq-v6 summary::before,
  :root[data-theme="night"] .faq-v6 details > div a { color: var(--gold); }

  @keyframes faqSlide {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .faq-v6--cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
  }
  @media (max-width: 1100px) {
    .faq-v6--cols { grid-template-columns: 1fr; gap: 0; }
  }
  @media (max-width: 640px) {
    .faq-v6 summary { grid-template-columns: 36px 1fr 28px; gap: 12px; font-size: 17px; }
    .faq-v6 summary::before { font-size: 24px; }
    .faq-v6 summary::after { width: 28px; height: 28px; font-size: 16px; }
    .faq-v6 details > div { padding: 14px 0 0 48px; }
  }

  /* ============================================================
     FIELD — інпут-форма (chislo-imeni, chislo-sudby, calculator)
  ============================================================ */
  .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .field__label {
    font-family: var(--font-text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
  }
  .field__input {
    width: 100%;
    padding: 14px 18px;
    font-family: var(--font-text);
    font-size: 17px;
    line-height: 1.4;
    color: var(--ink);
    background: var(--bg);
    border: 1.5px solid var(--line);
    border-radius: var(--r-md);
    outline: none;
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
    -webkit-appearance: none;
  }
  .field__input::placeholder { color: var(--ink-3); }
  .field__input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(185, 138, 62, .12);
  }
  :root[data-theme="night"] .field__input {
    background: var(--bg-2);
    border-color: var(--line);
  }
  :root[data-theme="night"] .field__input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(185, 138, 62, .18);
  }
  .field__hint {
    font-size: 12.5px;
    color: var(--ink-3);
    line-height: 1.4;
  }
  .field__error {
    font-size: 12.5px;
    color: #c0392b;
    line-height: 1.4;
    display: none;
  }
  .field.is-error .field__input { border-color: #c0392b; }
  .field.is-error .field__error { display: block; }


}