/* profbuh.com.ua: base. Reset, typography, layout primitives, accessibility helpers. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s-4));
}

body {
  margin: 0;
  background: var(--c-paper);
  color: var(--c-ink);
  font-family: var(--font-text);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

img {
  height: auto;
}

svg:not([fill]) {
  fill: none;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  padding: 0;
}

/* Headings */
h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--c-ink);
  text-wrap: balance;
}

h1 {
  font-size: var(--t-display);
  line-height: var(--lh-display);
  font-weight: 700;
  letter-spacing: var(--tr-display);
}

h2 {
  font-size: var(--t-h2);
  line-height: var(--lh-h2);
  font-weight: 600;
  letter-spacing: var(--tr-h2);
}

h3 {
  font-size: var(--t-h3);
  line-height: var(--lh-h3);
  font-weight: 600;
  letter-spacing: var(--tr-h3);
}

h4 {
  font-family: var(--font-text);
  font-size: var(--t-h4);
  line-height: var(--lh-h4);
  font-weight: 600;
}

/* Italic accent fragment: only inside H1/H2, max one per heading */
h1 em,
h2 em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

h3 em,
h4 em {
  font-style: normal;
}

p {
  text-wrap: pretty;
}

strong,
b {
  font-weight: 600;
}

small {
  font-size: var(--t-small);
}

/* Links */
a {
  color: var(--c-accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}

a:hover {
  color: var(--c-accent-strong);
  text-decoration-thickness: 2px;
}

/* Focus: 3px accent outline on every interactive element */
:focus {
  outline: none;
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: var(--r-sm);
}

::selection {
  background: var(--c-sage);
  color: var(--c-ink);
}

/* Numbers */
.num,
time {
  font-variant-numeric: tabular-nums;
}

/* Tables (base; styled variant is .data-table) */
table {
  border-collapse: collapse;
  width: 100%;
}

/* Form base */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

/* Icons from the sprite */
.icon {
  width: 24px;
  height: 24px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon--sm {
  width: 20px;
  height: 20px;
}

.icon--lg {
  width: 32px;
  height: 32px;
}

/* Accessibility helpers */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: 100;
  padding: var(--s-3) var(--s-4);
  background: var(--c-ink);
  color: var(--c-on-dark);
  font-weight: 600;
  border-radius: var(--r-md);
  text-decoration: none;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: var(--s-3);
  color: var(--c-on-dark);
}

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

.section {
  padding-block: var(--section-y);
}

.section--tight {
  padding-block: calc(var(--section-y) / 2);
}

.section--flush-top {
  padding-top: 0;
}

.section--flush-bottom {
  padding-bottom: 0;
}

.stack > * + * {
  margin-top: var(--s-4);
}

.stack--lg > * + * {
  margin-top: var(--s-6);
}

/* Section header: kicker + H2 + lead */
.section-head {
  max-width: 820px;
  margin-bottom: var(--s-7);
}

.section-head > * + * {
  margin-top: var(--s-4);
}

.section-head--center {
  margin-inline: auto;
  text-align: center;
}

.kicker {
  display: block;
  font-family: var(--font-text);
  font-size: var(--t-kicker);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: var(--tr-kicker);
  text-transform: uppercase;
  color: var(--c-muted);
}

.lead {
  font-size: var(--t-lead);
  line-height: var(--lh-lead);
  color: var(--c-ink);
  max-width: var(--measure);
}

.meta-line {
  font-size: var(--t-small);
  line-height: var(--lh-small);
  color: var(--c-muted);
}

.text-muted {
  color: var(--c-muted);
}

/* Prose: long-form text column */
.prose {
  max-width: var(--measure);
}

.prose > * + * {
  margin-top: var(--s-4);
}

.prose > h2 {
  margin-top: var(--s-8);
}

.prose > h3 {
  margin-top: var(--s-7);
}

.prose > h4 {
  margin-top: var(--s-6);
}

.prose > h2 + *,
.prose > h3 + *,
.prose > h4 + * {
  margin-top: var(--s-3);
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2,
.prose h3,
.prose h4 {
  scroll-margin-top: calc(var(--header-h) + var(--s-5));
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li + li {
  margin-top: var(--s-2);
}

.prose ul > li::marker {
  color: var(--c-accent);
}

.prose ol > li::marker {
  color: var(--c-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.prose table:not(.data-table) {
  font-size: var(--t-small);
}

.prose table:not(.data-table) th,
.prose table:not(.data-table) td {
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--c-line);
  text-align: left;
  vertical-align: top;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--c-line);
  margin-block: var(--s-7);
}

/* Anchored targets clear the sticky header */
[id] {
  scroll-margin-top: calc(var(--header-h) + var(--s-5));
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
