/* ============================================================
   FINKI – MAIN wrapper + HERO (почетна)
   ------------------------------------------------------------
   ПРАВИЛО БР. 1: сликата НИКОГАШ не се сече.
   Таа е `width:100%; height:auto` со свој aspect-ratio.
   Ако текстот не се собира врз неа (типично на телефон),
   текстот се спушта во панел ПОД сликата – не се крати сликата.

   Панелот се стилизира преку --panel-* променливи, па секој
   стил (.hero--panel-*) поставува само вредности, не правила.

   ACF променливи по инстанца:
     --hero-ratio  --hero-scrim  --hero-panel-bg
     --hero-title-color  --hero-subtitle-color
     --hero-btn-bg  --hero-btn-color
     --hero-stat-value-color  --hero-stat-label-color
   ============================================================ */


/* ============================================================
   MAIN
   ============================================================ */

.site-main {
  min-height: 60vh;
}


/* ============================================================
   HERO – GRID SHELL
   Ред 1 = слика (+ текст врз неа). Ред 2+ = панел под сликата.
   ============================================================ */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  margin: 0 0 40px 0;

  /* --- стандарден панел = „картичка“ --- */
  --panel-bg: #ffffff;
  --panel-width: min(100% - 2 * clamp(16px, 4vw, 64px), 833px);

  /* темата нема заоблени рабови – ниту картичката */
  --panel-radius: 0;
  --panel-shadow: 0 8px 24px rgba(21, 26, 70, 0.16);
  --panel-bar-h: 6px;
  --panel-bar: linear-gradient(90deg, #2c3179 0%, #2b92d0 100%);

  /* колку картичката влегува врз сликата (ACF: --hero-panel-offset) */
  --panel-pull-scale: 1;
  --panel-pull: calc(-1 * var(--hero-panel-offset, 40px) * var(--panel-pull-scale, 1));

  /* внатрешни растојанија – збиено, за да не е гломазна картичката */
  --panel-pad-y: clamp(20px, 2.1vw, 32px);
  --panel-pad-x: clamp(20px, 2.6vw, 44px);
  --panel-gap-sm: clamp(8px, 0.9vw, 13px);
  --panel-gap-md: clamp(12px, 1.2vw, 18px);
  --panel-gap-lg: clamp(14px, 1.5vw, 20px);

  --panel-fg: #1b1b1b;
  --panel-fg-strong: #2c3179;
  --panel-fg-muted: #5b6270;
  --panel-rule: rgba(44, 49, 121, 0.14);
}


/* --- Стилови на панелот (само вредности) --- */

.hero--panel-light {
  --panel-bg: #f3f6fb;
  --panel-width: 100%;
  --panel-radius: 0;
  --panel-shadow: none;
  --panel-pull: 0;
  --panel-pad-y: clamp(26px, 2.8vw, 40px);
}

.hero--panel-gradient {
  --panel-bg: linear-gradient(120deg, #2c3179 0%, #2b92d0 100%);
  --panel-width: 100%;
  --panel-radius: 0;
  --panel-shadow: none;
  --panel-pull: 0;
  --panel-pad-y: clamp(26px, 2.8vw, 40px);
  --panel-bar-h: 0;
}

.hero--panel-dark {
  --panel-bg: #171b3f;
  --panel-width: 100%;
  --panel-radius: 0;
  --panel-shadow: none;
  --panel-pull: 0;
  --panel-pad-y: clamp(26px, 2.8vw, 40px);
  --panel-bar-h: 0;
}

.hero--panel-plain {
  --panel-bg: transparent;
  --panel-width: 100%;
  --panel-radius: 0;
  --panel-shadow: none;
  --panel-pull: 0;
  --panel-pad-y: clamp(26px, 2.8vw, 40px);
  --panel-bar-h: 0;
}

.hero--panel-gradient,
.hero--panel-dark {
  --panel-fg: #ffffff;
  --panel-fg-strong: #ffffff;
  --panel-fg-muted: rgba(255, 255, 255, 0.78);
  --panel-rule: rgba(255, 255, 255, 0.22);
}


/* ============================================================
   СЛИКА
   ============================================================ */

.hero__stack {
  grid-row: 1;
  grid-column: 1;
  position: relative;
  display: grid;
  grid-template-columns: 1fr;

  /* се гледа само ако текстот врз сликата ја надрасне –
     брендирана лента наместо бела дупка */
  background: linear-gradient(135deg, #2c3179 0%, #2b92d0 100%);
}

.hero__stack > * {
  grid-row: 1;
  grid-column: 1;
  min-width: 0;
}

.hero__picture {
  display: block;
  width: 100%;
  align-self: start;
}

.hero__img {
  display: block;
  width: 100%;
  height: auto;          /* ← без сечење, никогаш */
  align-self: start;
  aspect-ratio: var(--hero-ratio, auto);
}

.hero__scrim {
  z-index: 1;
  background: rgba(0, 0, 0, var(--hero-scrim, 0));
  pointer-events: none;
}


/* ============================================================
   ТЕКСТ ВРЗ СЛИКАТА
   ============================================================ */

.hero__content--over {
  position: relative;
  grid-row: 1;
  grid-column: 1;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 40px);
  color: #ffffff;
}

.hero__inner {
  position: relative;
  text-align: center;
  max-width: 1100px;
  width: 100%;
  z-index: 2;
}

.hero__content--over:has(.hero-stats) .hero__inner {
  padding-bottom: clamp(38px, 6vw, 92px);
}

/* Скриен H1 кога насловот е врежан во сликата */
.hero__sr-title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}


/* ============================================================
   ПАНЕЛ ПОД СЛИКАТА
   ============================================================ */

.hero__content--below {
  position: relative;
  grid-row: 2;
  grid-column: 1;
  z-index: 3;

  width: var(--panel-width);
  margin-inline: auto;
  margin-top: var(--panel-pull);
  padding: var(--panel-pad-y) var(--panel-pad-x);
  text-align: center;

  color: var(--panel-fg);
  background: var(--hero-panel-bg, var(--panel-bg));
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
  overflow: hidden;
}

/* градиентна линија на врвот – го „шие“ панелот со брендот */
.hero__content--below::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--panel-bar-h, 0);
  background: var(--panel-bar, transparent);
}


/* ============================================================
   НАСЛОВ
   ============================================================ */

.hero-title {
  position: relative;
  font-size: clamp(1.9rem, 4.7vw, 90px);
  font-weight: 900;
  line-height: 1.05;
  text-transform: uppercase;
  margin: 0 0 clamp(18px, 3.6vw, 70px);
  z-index: 1;
}

.hero__content--over .hero-title {
  color: var(--hero-title-color, #ffffff);
}

.hero__content--below .hero-title {
  color: var(--hero-title-color, var(--panel-fg-strong));
  font-size: clamp(1.35rem, 2.4vw, 38px);
  margin-bottom: var(--panel-gap-sm);
}

.hero-title--echo::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  transform: translate(0, 0.08em);
  z-index: -1;

  font: inherit;
  text-transform: inherit;
  white-space: inherit;

  background: linear-gradient(
    90deg,
    var(--hero-echo-from, #2c3179) 0%,
    var(--hero-echo-to,   #2b92d0) 100%
  );

  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* во панел ехото е премногу – се гаси */
.hero__content--below .hero-title--echo::after {
  display: none;
}


/* ============================================================
   ПОДНАСЛОВ
   ============================================================ */

.hero-subtitle {
  font-size: clamp(0.95rem, 1.2vw, 22px);
  font-weight: 400;
  line-height: 1.6;
  margin: 0 auto clamp(16px, 1.7vw, 26px);
  max-width: 760px;
}

.hero__content--over .hero-subtitle {
  color: var(--hero-subtitle-color, #ffffff);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.hero__content--below .hero-subtitle {
  color: var(--hero-subtitle-color, var(--panel-fg));
  text-shadow: none;
  margin-bottom: var(--panel-gap-md);
}


/* ============================================================
   КОПЧЕ
   ============================================================ */

.btn-hero {
  text-decoration: none !important;
  background: var(--hero-btn-bg, #f1cc16);
  color: var(--hero-btn-color, #1b1b1b);
  font-size: clamp(0.9rem, 1vw, 18px);
  padding: 0.75em 1.8em;
  border-radius: 4px;
  font-weight: 500;
  display: inline-block;
  transition: filter 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.btn-hero:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}


/* ============================================================
   СТАТИСТИКИ
   ============================================================ */

.hero-stat-value {
  font-size: clamp(1.4rem, 2.1vw, 40px);
  font-weight: 800;
  line-height: 1;
  color: var(--hero-stat-value-color, #ffffff);
}

.hero-stat-label {
  font-size: clamp(0.68rem, 0.7vw, 13px);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--hero-stat-label-color, #ffffff);
}

/* --- врз сликата --- */

.hero__content--over .hero-stats {
  position: absolute;
  bottom: clamp(12px, 1.7vw, 32px);
  left: clamp(16px, 2.6vw, 50px);
  right: clamp(16px, 2.6vw, 50px);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
  z-index: 3;
}

.hero__content--over .hero-stat {
  text-align: left;
  pointer-events: auto;
}

.hero__content--over .hero-stats .hero-stat:last-child {
  text-align: right;
}

.hero__content--over .hero-stat-value {
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.hero__content--over .hero-stat-label {
  opacity: 0.9;
}

/* --- во панелот --- */

.hero__content--below .hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: clamp(14px, 1.8vw, 26px);
  margin-top: var(--panel-gap-lg);
  padding-top: var(--panel-gap-lg);
  border-top: 1px solid var(--panel-rule);
}

.hero__content--below .hero-stat {
  text-align: center;
}

.hero__content--below .hero-stat-value {
  color: var(--hero-stat-value-color, var(--panel-fg-strong));
  text-shadow: none;
}

.hero__content--below .hero-stat-label {
  color: var(--hero-stat-label-color, var(--panel-fg-muted));
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1200px) {
  .hero {
    margin: 0 0 32px 0;
  }
}

@media (max-width: 767px) {

  /* полна ширина на телефон */
  .hero {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);

    /* сликата е пониска на телефон – преклопот се намалува пропорционално */
    --panel-pull-scale: 0.55;
    --panel-pad-y: clamp(18px, 4.4vw, 26px);
    --panel-pad-x: clamp(16px, 4.4vw, 26px);
    --panel-gap-sm: 7px;
    --panel-gap-md: 13px;
    --panel-gap-lg: 14px;
  }

  /* ----------------------------------------------------------
     Текстот врз сликата се спушта во панел под неа.
     Истите --panel-* променливи, па изгледот е идентичен.
     ---------------------------------------------------------- */
  .hero--mobile-below .hero__content--over {
    grid-row: 2;
    display: block;
    z-index: 3;

    width: var(--panel-width);
    margin-inline: auto;
    margin-top: var(--panel-pull);
    padding: var(--panel-pad-y) var(--panel-pad-x);
    text-align: center;

    color: var(--panel-fg);
    background: var(--hero-panel-bg, var(--panel-bg));
    border-radius: var(--panel-radius);
    box-shadow: var(--panel-shadow);
    overflow: hidden;
  }

  .hero--mobile-below .hero__content--over::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--panel-bar-h, 0);
    background: var(--panel-bar, transparent);
  }

  .hero--mobile-below .hero__content--over .hero-title {
    color: var(--hero-title-color, var(--panel-fg-strong));
    margin-bottom: var(--panel-gap-sm);
  }

  .hero--mobile-below .hero__content--over .hero-title--echo::after {
    display: none;
  }

  .hero--mobile-below .hero__content--over .hero-subtitle {
    color: var(--hero-subtitle-color, var(--panel-fg));
    text-shadow: none;
    max-width: 100%;
  }

  .hero--mobile-below .hero__content--over:has(.hero-stats) .hero__inner {
    padding-bottom: 0;
  }

  .hero--mobile-below .hero__content--over .hero-stats {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(14px, 4vw, 24px);
    margin-top: var(--panel-gap-lg);
    padding-top: var(--panel-gap-lg);
    border-top: 1px solid var(--panel-rule);
    pointer-events: auto;
  }

  .hero--mobile-below .hero__content--over .hero-stat,
  .hero--mobile-below .hero__content--over .hero-stats .hero-stat:last-child {
    text-align: center;
  }

  .hero--mobile-below .hero__content--over .hero-stat-value {
    color: var(--hero-stat-value-color, var(--panel-fg-strong));
    text-shadow: none;
  }

  .hero--mobile-below .hero__content--over .hero-stat-label {
    color: var(--hero-stat-label-color, var(--panel-fg-muted));
    opacity: 1;
  }

  /* два панела еден по друг = еден непрекинат панел */
  .hero--mobile-below .hero__content--below {
    grid-row: 3;
    margin-top: 0;
    padding-top: 0;
    border-radius: 0 0 var(--panel-radius) var(--panel-radius);
  }

  .hero--mobile-below .hero__content--over ~ .hero__content--below::before {
    display: none;
  }

  .hero--mobile-below .hero__content--over ~ .hero__content--below .hero-stats {
    border-top: 1px solid var(--panel-rule);
  }

  /* --- типографија --- */

  .hero-title {
    font-size: clamp(1.6rem, 8.5vw, 46px);
    line-height: 1.15;
  }

  .hero-subtitle {
    font-size: clamp(0.9rem, 4vw, 17px);
    line-height: 1.5;
  }

  .hero__content--over .hero-subtitle {
    max-width: 26ch;
  }

  .hero__content--over .btn-hero {
    width: 100%;
    max-width: 280px;
    font-size: 1rem;
  }

  /* ----------------------------------------------------------
     Типографија во панелот на телефон – збиено и мирно.
     Копчето не е преку цела ширина; насловот не доминира.
     ---------------------------------------------------------- */

  .hero__content--below .hero-title,
  .hero--mobile-below .hero__content--over .hero-title {
    font-size: clamp(1.05rem, 5.2vw, 22px);
    line-height: 1.2;
    letter-spacing: 0.01em;
  }

  .hero__content--below .hero-subtitle,
  .hero--mobile-below .hero__content--over .hero-subtitle {
    font-size: clamp(0.8rem, 3.5vw, 14px);
    line-height: 1.45;
  }

  .hero__content--below .btn-hero,
  .hero--mobile-below .hero__content--over .btn-hero {
    width: auto;
    max-width: none;
    font-size: 0.85rem;
    padding: 0.68em 1.5em;
  }

  .hero__content--below .hero-stat-label,
  .hero--mobile-below .hero__content--over .hero-stat-label {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    line-height: 1.35;
    margin-top: 4px;
  }

  /* статистиките оставени врз сликата остануваат скриени на телефон */
  .hero__content--over .hero-stats {
    display: none;
  }

  .hero--mobile-below .hero__content--over .hero-stats,
  .hero__content--below .hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  /* непарен последен податок се центрира преку двете колони */
  .hero--mobile-below .hero__content--over .hero-stat:last-child:nth-child(odd),
  .hero__content--below .hero-stat:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .hero__content--below .hero-stat-value,
  .hero--mobile-below .hero__content--over .hero-stat-value {
    font-size: clamp(1.05rem, 4.8vw, 20px);
  }
}
