/*
 * Buttons. One file for the site and the block editor (includes/core/enqueue.php),
 * so a button looks the same in both.
 *
 * .btn is the site's button (design-system stage 3, 2026-10): square, a 1px
 * line, medium words, no shadow (the owner took the «neo» shadow and the bold
 * off); under the pointer it fills with the lighter blue.
 *
 *   <a class="btn" href="…">…</a>                 navy, for paper
 *   .btn--secondary   paper with a strong line, for paper
 *   .btn--danger      the red line and words, for paper (cancel, delete)
 *   .btn--inverse     white, for navy and photos under navy
 *   .btn--ghost       navy wash with a white line, for navy and photos
 *   .btn--sm / --lg   40px / 56px instead of 48px
 *   .btn--block       the whole width
 *
 * An icon goes in as it is (<svg> or .ph-icon) before or after the words. A
 * variant only sets the three properties at the top of .btn, and again for
 * :hover; a page that needs a button of its own colour sets them too, rather
 * than writing a new button.
 *
 * The «Кнопка-посилання» block (blocks/block-page-link-button.php) draws an
 * outline .btn, as do the footer's link buttons.
 */

.btn {
  --btn-bg: var(--color-blue-200);
  --btn-fg: var(--color-white);
  --btn-line: var(--color-blue-200);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  /* A submit button in a form takes the whole width and 250px at most from
     style.css (at no weight, see there); a .btn keeps its own size. */
  width: auto;
  max-width: 100%;
  min-height: 48px;
  padding: 11px 23px;
  border: 1px solid var(--btn-line);
  border-radius: 0;
  background: var(--btn-bg);
  /* Links in running text take the link colour with a stronger selector. */
  color: var(--btn-fg) !important;
  font-family: inherit;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn svg,
.btn .ph-icon {
  flex: none;
  width: 18px;
  height: 18px;
}

/* style.css shrinks every <span> inside a form's <div> to 10px light text;
   the words of a button in a form are often in one. */
/* No display here: a span a script hides (a spinner) keeps its display: none. */
.btn > span {
  font: inherit;
  line-height: inherit;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--secondary {
  --btn-bg: var(--color-bg-primary);
  --btn-fg: var(--color-text-heading);
  --btn-line: var(--color-border-strong);
}

.btn--danger {
  --btn-bg: var(--color-bg-primary);
  --btn-fg: var(--color-danger);
  --btn-line: var(--color-danger);
}

.btn--inverse {
  --btn-bg: var(--color-white);
  --btn-fg: var(--color-blue-200);
  --btn-line: var(--color-white);
}

/* The navy under the words, so a photo behind does not show through them. */
.btn--ghost {
  --btn-bg: rgba(var(--color-blue-200--rgb), 0.82);
  --btn-fg: var(--color-white);
  --btn-line: var(--color-white);
}

/* Under the pointer: on paper a button fills with the lighter blue (as the
   document viewer's buttons do); on navy, as the openings always did, the white
   one empties to its white line and the outline one takes a light wash. A
   keyboard focus has the ring from reset.css. */
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover {
    --btn-bg: var(--color-blue-100);
    --btn-fg: var(--color-white);
    --btn-line: var(--color-blue-100);
  }

  .btn--danger:not(:disabled):hover {
    --btn-bg: var(--color-danger);
    --btn-fg: var(--color-white);
    --btn-line: var(--color-danger);
  }

  .btn--inverse:not(:disabled):hover {
    --btn-bg: transparent;
    --btn-fg: var(--color-white);
    --btn-line: var(--color-white);
  }

  .btn--ghost:not(:disabled):hover {
    --btn-bg: rgba(255, 255, 255, 0.15);
    --btn-fg: var(--color-white);
    --btn-line: var(--color-white);
  }
}

.btn--sm {
  min-height: 40px;
  padding: 9px 17px;
  font-size: 0.9375rem;
}

.btn--lg {
  min-height: 56px;
  padding: 13px 29px;
  font-size: 1.125rem;
}

.btn--block {
  display: flex;
  width: 100%;
}

/* A button a script shows later («Показати ще») waits with [hidden]; the
   display above would outweigh the browser's own rule for it. */
.btn[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}
