/* ==========================================================================
   BASE.CSS – Reset, Typography, Global Styles
   ========================================================================== */

/* ─── Brand font: Muller Next (strict) ───
   Muller Next е лицензиран шрифт на Fontfabric (не е в Google Fonts).
   @font-face блоковете по-долу са ЗАКОМЕНТИРАНИ, защото assets/fonts/ все още
   е празна – активни те пораждаха 404 заявки за всяка използвана тежест на
   всяка страница. Поставете уеб-лицензираните .woff2 файлове в assets/fonts/
   с имената по-долу и разкоментирайте, за да ги активирате. До тогава текстът
   пада плавно към Montserrat (най-близкия свободен аналог с кирилица).

@font-face {
  font-family: 'Muller Next';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/MullerNext-Light.woff2') format('woff2');
}
@font-face {
  font-family: 'Muller Next';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/MullerNext-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Muller Next';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/MullerNext-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Muller Next';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/MullerNext-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Muller Next';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/MullerNext-Bold.woff2') format('woff2');
}
*/

/* ─── Modern CSS Reset ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  font-family: var(--font-family);
  font-size: var(--font-body-md-size);
  font-weight: var(--font-body-md-weight);
  line-height: var(--font-body-md-line-height);
  color: var(--color-on-surface);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex-grow: 1;
}

/* ─── Images ─── */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border: 0;
}

/* ─── Typography ─── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--color-on-surface);
  line-height: 1.2;
  letter-spacing: 0.01em;
  overflow-wrap: break-word;
  /* Even, aesthetically balanced line breaks on multi-line headings */
  text-wrap: balance;
}

/* Section intro paragraphs read better with tighter, pretty wrapping */
.section-header p,
.hero__subtext {
  text-wrap: pretty;
}

h1 {
  font-size: var(--font-display-lg-size);
  font-weight: var(--font-display-lg-weight);
  line-height: var(--font-display-lg-line-height);
  letter-spacing: var(--font-display-lg-letter-spacing);
}

h2 {
  font-size: var(--font-headline-lg-size);
  font-weight: var(--font-headline-lg-weight);
  line-height: var(--font-headline-lg-line-height);
}

h3 {
  font-size: var(--font-title-md-size);
  font-weight: var(--font-title-md-weight);
  line-height: var(--font-title-md-line-height);
}

p {
  color: var(--color-on-surface-variant);
  overflow-wrap: break-word;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-base);
}

ul, ol {
  list-style: none;
}

/* ─── Focus ─── */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ─── Skip link ───
   Първият фокусируем елемент – позволява на клавиатурни/екранни четци да
   прескочат навигацията директно към #main. Скрит визуално, докато не се
   фокусира. (Хедърът е JS-include, така че връзката идва в #site-header.) */
.skip-link {
  position: fixed;
  top: -80px;
  left: 8px;
  z-index: calc(var(--z-mobile-menu) + 10);
  padding: 10px 18px;
  background-color: var(--color-primary-dark);
  color: #ffffff;
  font-weight: 600;
  border-radius: var(--radius-default);
  box-shadow: var(--shadow-md);
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: 8px;
}

/* ─── No-JS навигация ───
   Хедърът и футърът се инжектират чрез nav.js. Този резервен блок дава
   работеща навигация и статични, обхождаеми връзки, когато JS е изключен. */
.noscript-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-md);
  background-color: var(--color-primary-dark);
}

.noscript-nav a {
  color: var(--color-on-primary);
  font-weight: 600;
}

.noscript-nav a:hover {
  text-decoration: underline;
}

/* ─── Selection ─── */
::selection {
  background-color: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
}

/* ─── Scrollbar (WebKit) ─── */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-surface-container-low);
}

::-webkit-scrollbar-thumb {
  background: var(--color-outline-variant);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-outline);
}

/* ─── Utility Classes ─── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.text-primary { color: var(--color-primary); }
.text-on-surface { color: var(--color-on-surface); }
.text-on-surface-variant { color: var(--color-on-surface-variant); }
.text-center { text-align: center; }

.body-lg {
  font-size: var(--font-body-lg-size);
  font-weight: var(--font-body-lg-weight);
  line-height: var(--font-body-lg-line-height);
}

.body-md {
  font-size: var(--font-body-md-size);
  font-weight: var(--font-body-md-weight);
  line-height: var(--font-body-md-line-height);
}

.label-sm {
  font-size: var(--font-label-sm-size);
  font-weight: var(--font-label-sm-weight);
  line-height: var(--font-label-sm-line-height);
  letter-spacing: var(--font-label-sm-letter-spacing);
}

.title-md {
  font-size: var(--font-title-md-size);
  font-weight: var(--font-title-md-weight);
  line-height: var(--font-title-md-line-height);
}

.ambient-shadow {
  box-shadow: var(--shadow-md);
}

/* ─── Material Symbols ─── */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}

/* ─── Display helper (за не-заглавни display текстове: числа на стъпки и др.) ─── */
.font-display {
  font-family: var(--font-display);
}
