/* ══════════════════════════════════════════════════════════════════════
   Каталог грантів — вигляд нового сайту (dev3.getgrant.ua/grants-and-funding/)
   на старій ПРОДівській темі `getgrants`.

   Правила `.gc-*`, `.gr-*`, `.cat-*` взято з astro-frontend/src/styles/
   design-system.css, а потім main.css — саме в такому порядку їх підключає
   BaseLayout нового сайту, тож каскад лишається тим самим. Усе зсунуто під
   `.gr-page`, щоб не зачепити решту сайту і перебити глобальні правила теми.
   ══════════════════════════════════════════════════════════════════════ */

.gr-page {
  --blue:       #0166b0;
  --blue-dark:  #0152A0;
  --navy:       #0D1B3E;
  --white:      #ffffff;
  --surface:    #F8F9FB;
  --border:     #E8ECEF;
  --border-mid: #D4D8DF;
  --text:       #1A202C;
  --text-body:  #374151;
  --text-muted: #6B7280;
  --text-faint: #9CA3AF;
  --text-blue:  #0166b0;
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 2px 6px rgba(0,0,0,.06);
  --shadow-md: 0 4px 14px rgba(0,0,0,.07);
  --t: .16s ease;

  font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
}
.gr-page *, .gr-page *::before, .gr-page *::after { box-sizing: border-box; }
.gr-page h1, .gr-page h2, .gr-page h3, .gr-page h4, .gr-page p {
  margin: 0; padding: 0; font-family: inherit; text-transform: none; line-height: inherit;
}
.gr-page ul { margin: 0; padding: 0; list-style: none; }
.gr-page a { text-decoration: none; }
.gr-page img { max-width: 100%; }

.gr-page .grants-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.gr-page .grants-empty p {
  margin-bottom: 1rem; font-size: 1rem;
}
.gr-page .cat-pill {
  display: inline-flex;
  align-items: center;
  padding: .35rem .9rem;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--navy-light);
  background: var(--white);
  border: 1px solid var(--border);
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}
.gr-page .cat-pill:hover {
  background: var(--blue-light);
  color: var(--blue);
  border-color: var(--blue);
}
.gr-page .cat-pill.is-active {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}
.gr-page .cat-pill {
  display: inline-flex;
  align-items: center;
  padding: .35rem .875rem;
  border-radius: 2rem;
  border: 1px solid var(--border);
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--white);
  text-decoration: none;
  transition: all var(--transition);
}
.gr-page .cat-pill:hover {
  border-color: var(--blue); color: var(--blue); background: var(--blue-light);
}
.gr-page .cat-pill.is-active {
  background: var(--blue); color: var(--white); border-color: var(--blue);
}
.gr-page .gr-hero {
  background: #0260A6;
  min-height: 180px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  color: #fff;
}
.gr-page .gr-hero::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 100% at 100% -20%, rgba(255,255,255,.08) 0%, transparent 55%);
}
.gr-page .gr-hero-inner {
  max-width: 1350px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  position: relative; z-index: 1;
  width: 100%;
}
.gr-page .gr-hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.82); font-size: 11px; font-weight: 500;
  padding: 4px 10px; border-radius: 5px; margin-bottom: 1rem;
  letter-spacing: .05em; text-transform: uppercase;
}
.gr-page .gr-hero-title {
  font-size: 28px; font-weight: 800; color: #fff;
  line-height: 1.2; letter-spacing: -0.03em; margin: 0 0 .6rem;
}
.gr-page .gr-hero-sub {
  font-size: 15px; color: rgba(255,255,255,.68);
  line-height: 1.65; max-width: 560px; margin: 0;
}
.gr-page .grants-content-area {
  background: #fff;
}
.gr-page .gr-layout {
  max-width: 1350px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr 248px;
  gap: 1.5rem;
  align-items: start;
}
.gr-page .gr-toolbar {
  display: flex; align-items: center; gap: .75rem; margin-bottom: 1.1rem; flex-wrap: wrap;
}
.gr-page .gr-toolbar-count {
  font-size: 14px; font-weight: 800; color: #1F2937; margin-right: auto;
}
.gr-page .gr-toolbar-count span {
  color: #9CA3AF; font-weight: 600; font-size: 13px;
}
.gr-page .gr-view-toggle {
  display: flex; background: #fff; border: 1px solid #DDE3EC; border-radius: 8px; overflow: hidden;
}
.gr-page .gr-view-btn {
  padding: 6px 14px; font-size: 12px; font-weight: 700; border: none; background: transparent; cursor: pointer; color: #6B7280;
}
.gr-page .gr-view-btn--on {
  background: #0166b0; color: #fff;
}
.gr-page .gc-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;
}
.gr-page .gc-grid--3col {
  grid-template-columns: repeat(3, 1fr);
}
.gr-page .gc-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #E5EAF0;
  box-shadow: 0 2px 12px rgba(1,102,176,.06);
  transition: box-shadow .18s, border-color .18s;
  display: flex;
  flex-direction: column;
}
.gr-page .gc-card:hover {
  box-shadow: 0 4px 16px rgba(1,102,176,.10); border-color: #BFDBFE;
}
.gr-page .gc-img {
  display: block;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  aspect-ratio: 16 / 9;
  min-height: 160px;
  background: #1e3a5f;
}
.gr-page .gc-img-icon {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
.gr-page .gc-img-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover;
}
.gr-page .gc-img-overlay {
  position: absolute; bottom: 0; left: 0; right: 0; height: 65%; background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
}
.gr-page .gc-chips {
  display: flex; gap: 6px; padding: .65rem .85rem .45rem; flex-wrap: wrap; border-bottom: 1px solid #F3F4F6;
}
.gr-page .gc-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; color: #4B5563;
  white-space: nowrap; background: #F0F2F5; border: 1px solid rgba(0,0,0,.07);
  border-radius: 6px; padding: 3px 8px; line-height: 1.4;
}
.gr-page .gc-chip svg {
  width: 12px; height: 12px; flex-shrink: 0; color: #6B7280;
}
.gr-page .gc-chip--urgent {
  background: #FEF2F2; color: #B91C1C; border-color: rgba(185,28,28,.15); font-weight: 700;
}
.gr-page .gc-chip--urgent svg {
  color: #DC2626;
}
.gr-page .gc-chip--soon {
  background: #FFFBEB; color: #92400E; border-color: rgba(146,64,14,.12); font-weight: 700;
}
.gr-page .gc-chip--soon svg {
  color: #D97706;
}
.gr-page .gc-chip--ok {
  background: #F0FDF4; color: #166534; border-color: rgba(22,101,52,.12); font-weight: 700;
}
.gr-page .gc-chip--ok svg {
  color: #16A34A;
}
.gr-page .gc-chip--past {
  background: #F0F2F5; color: #4B5563; border-color: rgba(0,0,0,.07); font-weight: 600;
}
.gr-page .gc-chip--past svg {
  color: #6B7280;
}
.gr-page .gc-body {
  padding: .75rem .85rem; flex: 1; display: flex; flex-direction: column; gap: .45rem;
}
.gr-page .gc-title {
  font-size: 16px; font-weight: 800; color: #1F2937; line-height: 1.4;
}
.gr-page .gc-title a {
  color: inherit; text-decoration: none;
}
.gr-page .gc-title a:hover {
  color: #0166b0;
}
.gr-page .gc-desc {
  font-size: 15px; color: #6B7280; line-height: 1.6; flex: 1;
}
.gr-page .gc-who {
  margin-top: .5rem;
}
.gr-page .gc-who-label {
  display: flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; color: #0F2D6B;
  letter-spacing: .04em; text-transform: uppercase; margin-bottom: 4px;
}
.gr-page .gc-who-label svg {
  width: 10px; height: 10px;
}
.gr-page .gc-who-tags {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.gr-page .gc-who-tag {
  display: inline-block;
  font-size: 11px; font-weight: 500; color: #374151;
  background: #F3F4F6; border-radius: 5px;
  padding: 2px 7px; line-height: 1.5;
}
.gr-page .gc-who-tag--more {
  color: #6B7280; background: #E5E7EB;
}
.gr-page .gc-footer {
  padding: .55rem .85rem .7rem; border-top: 1px solid #F3F4F6; margin-top: auto;
}
.gr-page .gc-detail-link {
  font-size: 13px; font-weight: 800; color: #0166b0;
  text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
}
.gr-page .gc-detail-link svg {
  width: 12px; height: 12px;
}
.gr-page .gc-detail-link:hover {
  text-decoration: underline;
}
.gr-page .gr-sidebar {
  display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 80px;
}
.gr-page .gr-sb-card {
  background: #F5F6F8; border-radius: 12px; border: 1px solid #E8ECF2; padding: .9rem 1rem;
}
.gr-page .gr-sb-title {
  font-size: 11px; font-weight: 800; color: #6B7280;
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: .65rem;
}
.gr-page .gr-sb-search {
  display: flex; align-items: center; gap: 7px;
  background: #EDEEF1; border-radius: 8px; padding: 7px 11px; border: 1px solid #E2E5EA;
}
.gr-page .gr-sb-search svg {
  width: 14px; height: 14px; color: #9CA3AF; flex-shrink: 0;
}
.gr-page .gr-sb-search input {
  border: none; background: transparent; font-size: 12px; color: #374151;
  outline: none; flex: 1; font-family: inherit;
}
.gr-page .gr-sb-item {
  display: block;
  font-size: 12px; font-weight: 600; color: #4B5563;
  padding: 5px 0; border-bottom: 1px solid #EDEEF1;
  text-decoration: none; line-height: 1.4;
  transition: color .15s;
}
.gr-page .gr-sb-item:last-child {
  border-bottom: none;
}
.gr-page .gr-sb-item:hover {
  color: #0166b0;
}
.gr-page .gr-sb-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 600; color: #4B5563;
  padding: 5px 0; border-bottom: 1px solid #EDEEF1;
}
.gr-page .gr-sb-row:last-child {
  border-bottom: none;
}
.gr-page .gr-sb-row-label {
  display: flex; align-items: center; gap: 6px;
}
.gr-page .gr-sb-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.gr-page .gr-sb-dot--red {
  background: #DC2626;
}
.gr-page .gr-sb-dot--amber {
  background: #D97706;
}
.gr-page .gr-sb-dot--green {
  background: #059669;
}
.gr-page .gr-sb-count {
  font-size: 11px; color: #9CA3AF; background: #EDEEF1; padding: 1px 7px; border-radius: 10px;
}
.gr-page .gr-sb-row--filter {
  text-decoration: none; cursor: pointer; border-radius: 6px; padding: 6px 6px; margin: 0 -6px; transition: background .15s, color .15s;
}
.gr-page .gr-sb-row--filter:hover {
  background: #EFF6FF; color: #0166b0;
}
.gr-page .gr-sb-row--filter:hover .gr-sb-count {
  background: #BFDBFE; color: #0166b0;
}
.gr-page .gr-sb-row--filter.gr-sb-row--active {
  background: #EFF6FF; color: #0166b0; font-weight: 700;
}
.gr-page .gr-sb-row--filter.gr-sb-row--active .gr-sb-count {
  background: #0166b0; color: #fff;
}
@media (max-width: 1024px) {
.gr-page .gr-hero-title {
  font-size: 24px;
}
}
@media (max-width: 900px) {
.gr-page .gr-layout {
  grid-template-columns: 1fr;
}
.gr-page .gr-sidebar {
  display: none;
}
.gr-page .gc-grid,
.gr-page .gc-grid--3col {
  grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 600px) {
.gr-page .gc-grid,
.gr-page .gc-grid--3col {
  grid-template-columns: 1fr;
}
.gr-page .gr-hero-title {
  font-size: 20px;
}
}

.gr-page .grants-content-area {
  background: #fff; width: 100%;
}
.gr-page .gr-hero {
  background: #0260A6;
  padding: 0;
  min-height: 180px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  color: #fff;
  border-bottom: none;
}
.gr-page .gr-hero::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 100% at 100% -20%, rgba(255,255,255,.08) 0%, transparent 55%);
}
.gr-page .gr-hero-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  position: relative; z-index: 1;
  width: 100%;
}
.gr-page .gr-hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.82); font-size: 11px; font-weight: 500;
  padding: 4px 10px; border-radius: 5px; margin-bottom: 1rem;
  letter-spacing: .05em; text-transform: uppercase;
}
.gr-page .gr-hero-title {
  font-size: 28px; font-weight: 800; color: #fff;
  line-height: 1.2; letter-spacing: -0.03em; margin: 0 0 .6rem;
}
.gr-page .gr-hero-sub {
  font-size: 15px; color: rgba(255,255,255,.68);
  line-height: 1.65; max-width: 560px; margin: 0;
}
@media (min-width: 1024px) {
.gr-page .gr-hero-title {
  font-size: 32px;
}
}
@media (max-width: 768px) {
.gr-page .gr-hero-title {
  font-size: 24px;
}
.gr-page .gr-hero-sub {
  font-size: 14px;
}
}
@media (max-width: 767px) {
.gr-page .gr-hero-title {
  font-size: 22px;
}
.gr-page .gr-hero-inner {
  padding: 0 1rem;
}
}
@media (max-width: 389px) {
.gr-page .gr-hero-title {
  font-size: 19px;
}
}
.gr-page .cat-pill.is-active,
.gr-page .cat-pill--all.is-active,
.gr-page .cat-pill.is-active .cat-pill-count {
  
}
.gr-page .cat-nav {
  background: #fff;
  border-bottom: 1px solid #E8ECF0;
  position: sticky;
  top: 60px;
  z-index: 200;
}
.gr-page .cat-nav-inner {
  max-width: 1350px;
  margin: 0 auto;
  padding: 12px 1.5rem;
  display: flex;
  align-items: center;
}
.gr-page .cat-seg-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #F1F4F8;
  border-radius: 10px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}
.gr-page .cat-seg-wrap::-webkit-scrollbar {
  display: none;
}
.gr-page .cat-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #6B7280;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  transition: background .15s, color .15s, box-shadow .15s;
  border: none;
}
.gr-page .cat-pill:hover {
  color: #374151;
  background: rgba(255,255,255,.6);
}
.gr-page .cat-pill.is-active,
.gr-page .cat-pill.active {
  background: #0166b0 !important;
  color: #fff !important;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(1,102,176,.25);
}
.gr-page .cat-pill--all {
  color: #1F2937;
  font-weight: 600;
}
.gr-page .cat-pill--all.is-active,
.gr-page .cat-pill--all.active {
  color: #fff !important;
}
@media (max-width: 640px) {
.gr-page .cat-nav {
  position: static;
    box-shadow: none;
    border-bottom: 1px solid #E5EAF0;
    background: #fff;
}
.gr-page .cat-nav-inner {
  padding: 12px 1rem 14px;
    display: block;
}
.gr-page .cat-seg-wrap {
  display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    background: transparent;
    border-radius: 0;
    padding: 0;
    overflow: visible;
}
.gr-page .cat-pill {
  display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    font-size: 12px;
    font-weight: 500;
    padding: 9px 6px;
    border-radius: 10px;
    border: 1.5px solid #E5EAF0;
    background: #fff;
    color: #374151;
    min-height: 40px;
    line-height: 1.25;
    transition: border-color .15s, background .15s, color .15s;
}
.gr-page .cat-pill:hover {
  border-color: #0166b0;
    color: #0166b0;
    background: #EFF6FF;
}
.gr-page .cat-pill.is-active,
.gr-page .cat-pill.active {
  background: #0166b0 !important;
    color: #fff !important;
    border-color: #0166b0 !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(1,102,176,.25);
}
.gr-page .cat-pill--all {
  grid-column: span 3;
    font-weight: 600;
    font-size: 13px;
    padding: 10px 6px;
}
}
@media (min-width: 641px) and (max-width: 768px) {
.gr-page .cat-nav-inner {
  padding: 10px 1rem;
}
.gr-page .cat-pill {
  padding: 5px 11px; font-size: 12px;
}
}
.gr-page .grants-content-area {
  background: #fff;
}
.gr-page h2.gr-hero-title {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  color: inherit;
  margin: 0;
}

/* ── Пагінація ───────────────────────────────────────────────────────────
   Новий сайт має власний компонент; тут малюємо вивід paginate_links(). */
.gr-page .gr-pag {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: .4rem; margin-top: 2rem;
}
.gr-page .gr-pag .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 .65rem;
  border: 1px solid #DDE3EC; border-radius: 8px; background: #fff;
  font-size: 13px; font-weight: 600; color: #4B5563;
  transition: border-color .15s, color .15s, background .15s;
}
.gr-page .gr-pag .page-numbers:hover { border-color: #0166b0; color: #0166b0; }
.gr-page .gr-pag .page-numbers.current {
  background: #0166b0; border-color: #0166b0; color: #fff;
}
.gr-page .gr-pag .page-numbers.dots {
  border-color: transparent; background: transparent; color: #9CA3AF;
}

/* Кнопка «Показати ще»: наступна порція грантів доїжджає в цю саму сторінку.
   Нумерація під нею лишається — для обходу пошуковиками і на випадок без JS. */
.gr-page .gr-more {
  display: flex; flex-direction: column; align-items: center;
  gap: .5rem; margin-top: 2rem;
}
.gr-page .gr-more[hidden] { display: none; }
.gr-page .gr-more-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 0 1.75rem;
  border: 1px solid #0166b0; border-radius: 10px;
  background: #0166b0; color: #fff;
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: normal;
  cursor: pointer; transition: background .15s, border-color .15s, opacity .15s;
}
.gr-page .gr-more-btn:hover { background: #0152A0; border-color: #0152A0; }
.gr-page .gr-more-btn[disabled] { opacity: .65; cursor: default; }
.gr-page .gr-more-err { margin: 0; font-size: 13px; color: #B91C1C; }
.gr-page .gr-more-err[hidden] { display: none; }
.gr-page .gr-more + .gr-pag { margin-top: 1rem; }

/* Порожній результат */
.gr-page .grants-empty { text-align: center; padding: 3rem 1rem; color: #6B7280; }
.gr-page .grants-empty p { margin-bottom: 1rem; }

/* Фокус із клавіатури */
.gr-page a:focus-visible,
.gr-page button:focus-visible,
.gr-page input:focus-visible {
  outline: 2px solid #0166b0;
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .gr-page * { animation: none !important; transition: none !important; }
}

/* Кнопки перемикача колонок: тема дає їм успадкований line-height, через
   що вони на три пікселі вищі, ніж на новому сайті. */
.gr-page .gr-view-btn { line-height: normal; }
/* Колір посилання теми не має протікати в обкладинку картки. */
.gr-page .gc-img { color: inherit; }
