/* Базові стилі, спільні для всіх блоків і сторінок. */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: 1.1;
  color: var(--color-text);
}
h1 { font-size: var(--h1); line-height: 1.05; }
h2 { font-size: var(--h2); }
h3 { font-size: var(--h3); font-weight: 600; line-height: 1.2; }

p { margin: 0; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }

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

::selection { background: var(--color-tint); color: var(--color-text); }

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: calc(var(--z-drawer) + 1);
  padding: var(--space-3) var(--space-4);
  background: var(--color-accent);
  color: var(--color-on-accent);
  border-radius: var(--radius-field);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: var(--space-3); }

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-h);
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn--primary { background: var(--color-accent); color: var(--color-on-accent); }
.btn--primary:hover:not(:disabled) { background: var(--color-accent-hover); transform: translateY(-1px); }

.btn--secondary { background: transparent; color: var(--color-accent); border-color: var(--color-accent); }
.btn--secondary:hover:not(:disabled) { background: var(--color-accent); color: var(--color-on-accent); }

.btn--text {
  min-height: var(--tap);
  padding: 0;
  background: none;
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Круглі кнопки-іконки (шапка, обране в картці) */
.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text);
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--color-surface); }
.icon-btn svg { width: 22px; height: 22px; }

/* Лічильник на іконці */
.badge {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}
.badge[hidden] { display: none; }
.badge.is-bumped { animation: badge-bump var(--dur-slow) var(--ease); }
@keyframes badge-bump {
  40% { transform: scale(1.35); }
}

/* Поля */
.field {
  width: 100%;
  min-height: var(--control-h);
  padding: 0 var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-field);
  background: #fff;
  color: var(--color-text);
  transition: border-color var(--dur-fast) var(--ease);
}
.field::placeholder { color: var(--color-muted); }
.field:hover { border-color: var(--color-muted); }
.field:focus-visible { border-color: var(--color-focus); outline-offset: 1px; }

/* Слоти блоків: поки блок не готовий, слот не займає місця */
[data-block]:empty { display: contents; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
