/* ============================================================
   COMPONENTS.CSS
   Reusable pieces. Each block is one thing you can drop
   anywhere and it looks the same. Loaded last, so it can
   override layout defaults when it needs to.
   ============================================================ */


/* ---------- BUTTON -------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  background: var(--color-accent);
  color: var(--color-accent-in);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.15s ease;
}

/* A small, calm grow on hover — no drifting toward the cursor. */
.btn:hover {
  transform: scale(1.04);
  box-shadow: var(--shadow-lift);
}

.btn:active {
  transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
  .btn:hover,
  .btn:active { transform: none; }
}

.btn--ghost {
  background: transparent;
  color: var(--color-ink);
  border-color: var(--color-border);
}

.btn--light {
  background: var(--color-surface);
  color: var(--color-accent);
  border-color: var(--color-surface);
}

.btn--small {
  padding: var(--space-xs) var(--space-md);
}

/* Ghost buttons sit on the dark hero, so they need light text
   there. Scoping to .hero leaves the default version alone. */
.hero .btn--ghost {
  color: var(--color-on-dark);
  border-color: rgb(255 255 255 / 0.3);
}

.hero .btn--ghost:hover {
  background: rgb(255 255 255 / 0.08);
}


/* ---------- MEDIA SLOT -----------------------------------------
   Where a photograph goes. aspect-ratio holds the shape before
   any image loads, so the page never jumps as things arrive.
   Swap the <img> src inside and everything else stays put.
   ---------------------------------------------------------------- */

.media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-alt);
}

.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;    /* fills the box, crops the overflow */
}

.media--wide { aspect-ratio: 16 / 9; }


/* ---------- PROMISE ITEM ---------------------------------------- */

.promises li {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: var(--space-sm);
  align-items: start;
  padding-block: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  font-weight: 500;
}

.promises li::before {
  content: "\2713";                /* the tick character */
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.2rem;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-in);
  font-size: 0.72rem;
  font-weight: 700;
}


/* ---------- PARTNER LOGO PLACEHOLDER ----------------------------- */

.logo {
  display: grid;
  place-items: center;
  min-height: 5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-muted);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.logo:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}


/* ---------- PROSE + PANEL ----------------------------------------- */

/* Baseline rhythm: any element after another gets the same gap,
   so paragraphs, lists, quotes and headings all line up — instead
   of relying on * { margin: 0 } and every combination looking
   cramped or oversized depending on what happens to precede it. */
.prose > * + * {
  margin-top: var(--space-md);
}

.prose p {
  color: var(--color-muted);
}

.prose p:first-of-type {
  margin-top: var(--space-md);
}

.prose h2,
.prose h3 {
  color: var(--color-ink);
  margin-top: var(--space-xl);
}

.prose h2 { font-size: var(--text-xl); }
.prose h3 { font-size: var(--text-lg); }

/* Pull whatever sits right under a heading back in close to it —
   the big gap belongs above the heading, not below it. */
.prose h2 + *,
.prose h3 + * {
  margin-top: var(--space-sm);
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
  color: var(--color-muted);
}

.prose ul li {
  position: relative;
  padding-left: 1.3em;
}

.prose ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-gold);
}

.prose ol { list-style: decimal; }

.prose li + li { margin-top: var(--space-xs); }

.prose strong {
  color: var(--color-ink);
  font-weight: 800;
}

.prose a:not(.btn) {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 3px;
}

.prose a:not(.btn):hover { text-decoration-color: currentColor; }

.prose blockquote {
  padding-left: var(--space-md);
  border-left: 3px solid var(--brand-gold);
  color: var(--color-muted);
  font-style: italic;
}

.prose img {
  border-radius: var(--radius);
}

/* Photos inside an article, side by side. Each tile is cropped to
   the same shape so a portrait and a landscape shot still line up.
   Write it in a вест as:
     <div class="gallery"><img src="..." alt="..."> <img ...></div> */
.prose .gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--space-sm);
  margin-block: var(--space-lg);
}

/* ---------- PDF SHOWN OPEN IN AN ARTICLE ---------------------
   Wider than the text column — an A4 page squeezed to 38rem is
   hard to read — but never wider than the screen. The left:50% +
   translate pair centres it on the page, not on the column.
   ---------------------------------------------------------------- */
.pdf-embed {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(60rem, calc(100vw - 2rem));
  margin-top: var(--space-xl);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.pdf-embed__frame {
  display: block;
  width: 100%;
  height: min(85vh, 70rem);
  border: 0;
  background: var(--color-alt);
}

.pdf-embed__fallback {
  display: grid;
  place-content: center;
  gap: var(--space-sm);
  height: 100%;
  min-height: 14rem;
  padding: var(--space-lg);
  text-align: center;
  color: var(--color-muted);
}

.pdf-embed__fallback strong { color: var(--color-ink); }

.pdf-embed__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-xs) var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: 700;
}

.pdf-embed__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}


/* A single upright poster or flyer — centred and kept from
   filling the whole column, so it does not tower over the text. */
.prose .poster {
  display: block;
  width: 100%;
  max-width: 24rem;
  height: auto;
  margin: var(--space-lg) auto;
  box-shadow: var(--shadow);
}

.prose .gallery img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow);
}

.panel__title {
  font-size: var(--text-lg);
}

.steps {
  counter-reset: step;
  margin-top: var(--space-md);
  display: grid;
  gap: var(--space-md);
}

/* The numbers are real information here - the order of the
   process matters - so a numbered marker earns its place. */
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 1.9rem 1fr;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--color-alt);
  color: var(--color-accent);
  font-weight: 800;
  font-size: var(--text-sm);
}


/* ---------- NEWS CARD ---------------------------------------------- */

.news {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;     /* clips the image to the rounded corner */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.news:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

.news .media {
  border-radius: 0;
  aspect-ratio: 16 / 10;
}

.news__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-lg);
  flex-grow: 1;
}

.news__date {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.news__title {
  font-size: var(--text-lg);
}

.news__body p {
  color: var(--color-muted);
  font-size: var(--text-sm);
  flex-grow: 1;         /* pushes the link down to the card floor */
}

.news__link {
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-accent);
  text-decoration: none;
}

.news__link::after {
  content: " \2192";    /* arrow */
  transition: margin 0.15s ease;
}

.news:hover .news__link::after {
  margin-left: 0.3em;
}


/* ---------- STAT ---------------------------------------------------- */

.stat__value {
  display: block;
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--color-gold);
  font-variant-numeric: tabular-nums;  /* stops digits jittering */
}

.stat span {
  display: block;
  margin-top: var(--space-xs);
  color: var(--color-on-dark-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
}


/* ---------- FORM ------------------------------------------------------ */

.form {
  display: grid;
  gap: var(--space-md);
  justify-items: start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: var(--space-xs);
  width: 100%;
}

.field label {
  font-size: var(--text-sm);
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
  resize: vertical;
  transition: border-color 0.15s ease;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--color-accent);
}

/* Added by JavaScript when a field fails validation. */
.field.has-error input,
.field.has-error textarea {
  border-color: #b3261e;
}

.form__status {
  font-size: var(--text-sm);
  color: var(--color-muted);
}


/* ============================================================
   SPOTLIGHT CARDS
   A very soft warmth follows the cursor. Deliberately near the
   threshold of noticing - you should feel the card respond
   without being able to point at what changed.
   ============================================================ */

.spotlight {
  position: relative;
  isolation: isolate;
}

.spotlight::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.35s ease;
  background: radial-gradient(
    11rem 11rem at var(--mx, 50%) var(--my, 50%),
    rgb(84 102 54 / 0.045),
    transparent 68%
  );
}

.spotlight:hover::before {
  opacity: 1;
}


/* ---------- IMAGE ZOOM ON HOVER --------------------------------
   The wrapper clips, the image scales. Scaling the wrapper
   instead would drag the card's border along with it.
   ---------------------------------------------------------------- */

.media a {
  display: block;
  height: 100%;
}

.media img {
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.news:hover .media img,
.edu:hover .media img {
  transform: scale(1.06);
}

@media (prefers-reduced-motion: reduce) {
  .media img,
  .news:hover .media img,
  .edu:hover .media img {
    transition: none;
    transform: none;
  }
}


/* ============================================================
   POINTER-REACTIVE COMPONENTS
   Everything below is driven by CSS custom properties that
   JavaScript writes. JS reports numbers; CSS decides looks.
   ============================================================ */


/* ---------- 3D TILT ---------------------------------------------
   The card leans toward the cursor. perspective on the PARENT is
   what makes it three-dimensional rather than a flat skew.
   ---------------------------------------------------------------- */

.tilt-scene {
  perspective: 900px;
}

.tilt {
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(0);
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.4s ease;
  will-change: transform;
}

/* Snap out of the easing while the pointer is moving, so the card
   tracks the cursor instead of lagging behind it. */
.tilt.is-tilting {
  transition: box-shadow 0.4s ease;
}

.tilt.is-tilting {
  box-shadow: var(--shadow-lift);
}


/* ---------- PROMISE ROW HOVER -------------------------------------- */

.promises li {
  position: relative;
  transition: color 0.25s ease, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: default;
}

.promises li:hover {
  color: var(--brand-olive);
  transform: translateX(6px);
}

.promises li::before {
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
              background 0.25s ease, box-shadow 0.25s ease;
}

.promises li:hover::before {
  transform: scale(1.18);
  background: var(--brand-gold);
  color: var(--brand-olive);
  box-shadow: 0 0 0 5px rgb(192 162 84 / 0.22);
}

/* The underline sweeps in from the left as you pass over a row. */
.promises li::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--brand-green), var(--brand-gold), transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.promises li:hover::after {
  transform: scaleX(1);
}


/* ---------- PARTNER LOGOS ------------------------------------------
   Muted by default so the strip reads as one texture, full colour
   on hover so a visitor can pick out a name they recognise.
   ---------------------------------------------------------------- */

.logo {
  filter: grayscale(1);
  opacity: 0.55;
  transition: filter 0.3s ease, opacity 0.3s ease,
              transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
              border-color 0.3s ease;
}

.logo:hover {
  filter: grayscale(0);
  opacity: 1;
  transform: translateY(-3px);
  border-color: var(--brand-gold);
}


/* ---------- STAT GLOW ------------------------------------------------
   Added by JavaScript the moment a number finishes counting.
   ---------------------------------------------------------------- */

.stat__value {
  transition: text-shadow 0.6s ease;
}

.stat__value.is-done {
  text-shadow: 0 0 26px rgb(246 198 90 / 0.45);
}


/* ---------- CTA BAND EDGE --------------------------------------------
   A thin lit line along the top of the green band, in the three
   brand colours. Small, and it makes the band look deliberate.
   ---------------------------------------------------------------- */

.band::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg,
    var(--brand-olive), var(--brand-gold-lt),
    var(--brand-red), var(--brand-khaki), var(--brand-olive));
}


@media (prefers-reduced-motion: reduce) {
  .tilt,
  .promises li,
  .logo {
    transform: none !important;
    transition: none;
  }
}


/* ============================================================
   BENEFITS STRIP — "приказати кључне користи" on the homepage
   ============================================================ */

.benefits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--space-md);
}

.benefit {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.benefit__icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius);
  background: var(--color-alt);
  color: var(--brand-green);
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: var(--space-md);
}

.benefit h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-xs);
}

.benefit p {
  color: var(--color-muted);
  font-size: var(--text-sm);
}


/* ============================================================
   FLAGSHIP BLOCK — used for Твој агроном
   The brief asks for this to stand out, so it gets the one
   treatment nothing else on the page has: full-bleed dark,
   photo on one side, offset panel on the other.
   ============================================================ */

.flagship {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--color-deep);
  color: var(--color-on-dark);
  padding-block: var(--space-2xl);
}

.flagship::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--img-furrow);
  opacity: 0.5;
}

.flagship__inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--space-xl);
  align-items: center;
}

@media (max-width: 56rem) {
  .flagship__inner { grid-template-columns: 1fr; }
}

.flagship__title {
  font-size: var(--text-2xl);
  margin-top: var(--space-sm);
}

.flagship__lede {
  color: var(--color-on-dark-muted);
  font-size: var(--text-lg);
  margin-top: var(--space-md);
}

.flagship .eyebrow {
  color: var(--brand-gold-lt);
}

/* The service list inside the flagship block. */
.flagship__list {
  display: grid;
  gap: var(--space-xs);
  margin-top: var(--space-lg);
}

.flagship__list li {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: var(--space-sm);
  align-items: start;
  padding-block: var(--space-xs);
  border-bottom: 1px solid rgb(255 255 255 / 0.09);
  font-size: var(--text-sm);
}

.flagship__list li::before {
  content: "\2713";
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  margin-top: 0.15rem;
  border-radius: 50%;
  background: var(--brand-gold);
  color: var(--color-deep);
  font-size: 0.68rem;
  font-weight: 700;
}

/* The card that explains how the free service works. */
.flagship__card {
  background: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  backdrop-filter: blur(6px);
}

.flagship__card h3 {
  font-size: var(--text-lg);
  color: var(--brand-gold-lt);
}

.flagship__card p {
  color: var(--color-on-dark-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-sm);
}

.flagship__note {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid rgb(255 255 255 / 0.14);
  font-size: var(--text-sm);
  color: var(--color-on-dark);
}


/* ============================================================
   3П BLOCK
   The three П's are the whole idea, so the letterform IS the
   design. Nothing else on the site uses type at this size.
   ============================================================ */

.p3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-md);
}

.p3__card {
  position: relative;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.25s ease, border-color 0.25s ease;
}

.p3__card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  border-color: var(--brand-gold);
}

/* The giant П sits behind the text, clipped by the card. */
.p3__letter {
  position: absolute;
  top: -1.5rem;
  right: -0.5rem;
  font-size: 9rem;
  line-height: 1;
  font-weight: 800;
  color: var(--brand-gold);
  opacity: 0.14;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.p3__card:hover .p3__letter {
  opacity: 0.24;
  transform: scale(1.06) rotate(-3deg);
}

.p3__num {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--brand-gold);
  text-transform: uppercase;
}

.p3__title {
  font-size: var(--text-lg);
  margin-top: var(--space-xs);
}

.p3__card p {
  color: var(--color-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-sm);
  position: relative;
}


/* ============================================================
   TEAM
   ============================================================ */

.team {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-md);
}

.person {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.person__photo {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background: var(--color-alt);
  overflow: hidden;
}

.person__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;   /* portraits: keep the face, crop the chest */
}

.person__initial {
  font-size: 3rem;
  font-weight: 800;
  color: var(--brand-green);
  opacity: 0.35;
}

.person__body { padding: var(--space-lg); }

.person__name  { font-size: var(--text-lg); }

.person__role  {
  color: var(--brand-green);
  font-size: var(--text-sm);
  font-weight: 700;
  margin-top: 0.15rem;
}

.person__field {
  color: var(--color-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-xs);
}

/* The name is a button whose ::after covers the whole card, so a
   click on the photo opens the biography too. The button keeps
   looking like a heading. */
.person { transition: box-shadow 0.25s ease, transform 0.25s ease; }

.person:hover { box-shadow: var(--shadow-lift); }

.person__open {
  all: unset;
  cursor: pointer;
}

.person__open::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.person__open:focus-visible::after {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.person__more {
  color: var(--brand-green);
  font-size: var(--text-sm);
  font-weight: 700;
  margin-top: var(--space-sm);
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.person:hover .person__more { opacity: 1; }


/* ---------- BIOGRAPHY POPUP -----------------------------------
   A native <dialog>. showModal() puts it above everything else,
   traps focus, and closes on Escape for free.
   --------------------------------------------------------------- */

.bio-modal {
  width: min(44rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;            /* base.css zeroes every margin; this re-centres it */
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-lift);
  overflow: auto;
}

.bio-modal[open] {
  display: grid;
  grid-template-columns: 15rem 1fr;
  animation: bio-in 0.22s ease-out;
}

.bio-modal::backdrop {
  background: rgb(20 26 15 / 0.55);
  backdrop-filter: blur(3px);
}

@keyframes bio-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* The frame decides its own size; the photo is laid over it and
   clipped. With the image in normal flow and height:100%, Safari on
   iPhone gave the frame no height and let the photo spill over the
   biography text. */
.bio-modal__photo {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--color-alt);
  min-height: 15rem;
  overflow: hidden;
}

.bio-modal__photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

.bio-modal__body { padding: var(--space-lg); }

.bio-modal__name {
  font-size: var(--text-xl);
  padding-right: 2.5rem;   /* room for the close button */
}

.bio-modal__text {
  margin-top: var(--space-md);
  font-size: var(--text-base);
}

.bio-modal__empty {
  color: var(--color-muted);
  font-style: italic;
}

.bio-modal__contact {
  list-style: none;
  padding: 0;
  margin-top: var(--space-md);
  font-size: var(--text-sm);
  font-weight: 700;
}

.bio-modal__contact a { color: var(--brand-green); }

.bio-modal__close {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.bio-modal__close:hover { background: var(--color-alt); }

/* Phones: plain stacking — photo on top, text starting below it.
   The × sticks to the top while a long biography is scrolled, so
   the popup can always be closed (phones have no Escape key). The
   negative bottom margin lets the photo slide up underneath it. */
@media (max-width: 40rem) {
  .bio-modal[open] { display: block; }
  .bio-modal__photo { aspect-ratio: 4 / 3; min-height: 0; }

  .bio-modal__close {
    position: sticky;
    z-index: 2;
    display: block;
    margin: var(--space-xs) var(--space-xs) calc(-2.5rem - var(--space-xs)) auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bio-modal[open] { animation: none; }
}

/* Stops the page behind the popup from scrolling. */
html:has(.bio-modal[open]) { overflow: hidden; }


/* ============================================================
   FUNDS + EDUCATION LISTS
   ============================================================ */

.funds, .edus {
  display: grid;
  gap: var(--space-sm);
}

.edus { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }

.fund, .edu {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.fund__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.fund__title, .edu__title { font-size: var(--text-lg); }

.fund__status {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.fund__status--otvoren  { background: #dcebd4; color: #2e5a24; }
.fund__status--zatvoren { background: var(--color-alt); color: var(--color-muted); }

.fund__meta, .edu__meta {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-top: var(--space-xs);
}

.fund p, .edu p {
  color: var(--color-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-sm);
}

.edu__tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-green);
  background: var(--color-alt);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  margin-bottom: var(--space-sm);
}

/* Optional event photo. The card keeps its normal padding for the
   text, so the image is pulled out to the edges with a negative
   margin equal to that padding, rather than restructuring the card. */
.edu {
  overflow: hidden;
}

.edu .media {
  border-radius: 0;
  aspect-ratio: 16 / 10;
  margin: calc(-1 * var(--space-lg)) calc(-1 * var(--space-lg)) var(--space-md);
}


/* ============================================================
   FAQ — <details> gives open/close behaviour with no JavaScript
   ============================================================ */

.faq { display: grid; gap: var(--space-xs); }

.faq details {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-md) var(--space-lg);
}

.faq summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  color: var(--brand-green);
  font-weight: 800;
}

.faq details[open] summary::after { content: "\2212"; }

.faq details p {
  color: var(--color-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-sm);
}


/* ---------- LOADING + ERROR STATES ---------------------------- */

.feed-loading, .feed-error {
  color: var(--color-muted);
  font-size: var(--text-sm);
}


/* ============================================================
   ЕУ ВИДЉИВОСТ — logo + disclaimer in the footer
   ============================================================ */

.site-footer__eu {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid rgb(255 255 255 / 0.12);
}

/* White plate: the logo's blue lettering needs a light ground.
   One fixed-size plate (14 × 6rem) on every screen, with the logo
   centered in it via object-fit. The logo is 3rem tall, which leaves
   about 1.5rem of white on every side — well over the brand sheet's
   minimum clear space (the width of the letter Е, 0.24 × logo
   height), at the funder's request for a roomier plate.
   The EU emblem has a minimum-size requirement in the grant rules —
   do not let the logo go below 2.25rem without checking the
   project's visibility guidelines. */
.site-footer__eu-logo {
  flex-shrink: 0;
  width: 14rem;
  height: 6rem;
  box-sizing: border-box;
  padding: 1.5rem 1rem;
  object-fit: contain;
  object-position: center;
  background: #fff;
}

.site-footer__disclaimer {
  color: var(--color-on-dark-muted);
  font-size: 0.82rem;
  line-height: 1.55;
  max-width: 70ch;
}

@media (max-width: 40rem) {
  .site-footer__eu {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }
}
