/**
 * grants.css
 *
 * Styles for the Grants CPT: archive page, cards, single post,
 * sidebar, accordion, and tabs.
 * Scoped under .grants-* and .grant-* to avoid collisions.
 *
 * @author Fudo
 * @date   2025-04-21
 */

/* ─────────────────────────────────────────────
   CSS Custom Properties
───────────────────────────────────────────── */
:root {
    --gr-color-primary:       #2c6e49;
    --gr-color-primary-dark:  #1e4d33;
    --gr-color-primary-light: #d1fae5;
    --gr-color-surface:       #ffffff;
    --gr-color-bg:            #f4f7f5;
    --gr-color-text:          #1a1a2e;
    --gr-color-muted:         #111d2d;
    --gr-color-border:        #e5e7eb;

    --gr-label-default-bg:    #ecfdf5;
    --gr-label-default-text:  #065f46;
    --gr-label-accordion-bg:  #eff6ff;
    --gr-label-accordion-text:#1e3a5f;
    --gr-label-tabs-bg:       #fefce8;
    --gr-label-tabs-text:     #713f12;
    --gr-label-guidance-bg:   #fdf4ff;
    --gr-label-guidance-text: #6b21a8;
    --gr-label-contacts-bg:   #fff7ed;
    --gr-label-contacts-text: #9a3412;

    --gr-radius:              8px;
    --gr-radius-lg:           12px;
    --gr-shadow:              0 2px 8px rgba(0,0,0,0.08);
    --gr-shadow-hover:        0 6px 24px rgba(0,0,0,0.12);

    --gr-ease:                cubic-bezier(0.23, 1, 0.32, 1);
    --gr-fast:                150ms cubic-bezier(0.23, 1, 0.32, 1);
    --gr-enter:               260ms cubic-bezier(0.23, 1, 0.32, 1);
}

/* ─────────────────────────────────────────────
   Archive Hero
───────────────────────────────────────────── */
.grants-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.grants-hero__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transform: scale(1.03);
    transition: transform 6s var(--gr-ease);
}

.grants-hero:hover .grants-hero__bg {
    transform: scale(1);
}

.grants-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(10, 35, 20, 0.88) 0%,
        rgba(10, 35, 20, 0.45) 60%,
        transparent 100%
    );
}

.grants-hero__content {
    position: relative;
    z-index: 1;
    padding-block: 0rem;
    color: #fff;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.grants-hero__title {
    font-size: clamp(1.75rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
}

.grants-hero__subtitle {
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    color: rgba(255,255,255,0.85);
    margin: 0;
    max-width: 60ch;
}

/* ─────────────────────────────────────────────
   Archive Page Wrapper
───────────────────────────────────────────── */
.grants-content {
    padding-block: 0rem 4rem;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.grants-empty {
    color: var(--gr-color-muted);
    font-style: italic;
    padding: 2rem 0;
}

/* ─────────────────────────────────────────────
   Archive Grid
───────────────────────────────────────────── */
.grants-archive {
    display: block;
}

/* ─────────────────────────────────────────────
   Grant Card
───────────────────────────────────────────── */
.grant-card {
/*     background: #F2F4F0; */
    border: 1px solid var(--gr-color-border);
/*     border-radius: var(--gr-radius-lg); */
/*     box-shadow: var(--gr-shadow); */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--gr-enter) var(--gr-ease),
                transform var(--gr-enter) var(--gr-ease);
    opacity: 0;
    transform: scale(0.97) translateY(12px);
    animation: gr-card-enter var(--gr-enter) forwards;
    animation-fill-mode: both;
}

.grant-card:nth-child(1) { animation-delay: 0ms;   }
.grant-card:nth-child(2) { animation-delay: 50ms;  }
.grant-card:nth-child(3) { animation-delay: 100ms; }
.grant-card:nth-child(4) { animation-delay: 150ms; }
.grant-card:nth-child(5) { animation-delay: 200ms; }
.grant-card:nth-child(6) { animation-delay: 250ms; }
.grant-card:nth-child(7) { animation-delay: 300ms; }
.grant-card:nth-child(8) { animation-delay: 350ms; }

@keyframes gr-card-enter {
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* .grant-card:hover {
    box-shadow: var(--gr-shadow-hover);
    transform: translateY(-2px);
} */

/* .grant-card::before {
    content: '';
    display: block;
    height: 4px;
    background: var(--gr-color-primary);
    flex-shrink: 0;
} */

.grant-card__image-link {
    display: block;
    overflow: hidden;
}

.grant-card__image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.grant-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--gr-enter) var(--gr-ease);
}

.grant-card:hover .grant-card__image img {
    transform: scale(1.04);
}

.grant-card__body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.grant-card__title {
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

.grant-card__title a {
    color: var(--gr-color-text);
    text-decoration: none;
    transition: color var(--gr-fast);
}

.grant-card__title a:hover {
    color: var(--gr-color-primary);
}

.grant-card__excerpt {
    color: var(--gr-color-muted);
    font-size: 0.92rem;
    line-height: 1.65;
    margin: 0;
    flex: 1;
}

.grant-card__read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    margin-top: auto;
    font-size: 0.87rem;
    font-weight: 600;
    color: var(--gr-color-primary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    padding-bottom: 1px;
    transition: color var(--gr-fast), border-color var(--gr-fast);
}

.grant-card__read-more:hover {
    color: var(--gr-color-primary-dark);
    border-bottom-color: var(--gr-color-primary-dark);
}

.grant-card__read-more-arrow {
    display: inline-block;
    transition: transform var(--gr-fast);
}

.grant-card__read-more:hover .grant-card__read-more-arrow {
    transform: translateX(4px);
}

/* ─────────────────────────────────────────────
   Single — Title Bar
───────────────────────────────────────────── */
.grant-single__title-bar {
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 2.5rem);
    padding-block: 2rem 1.25rem;
    display: flex;
	padding-left: 0px!important;
	padding-right: 0px!important;
    flex-direction: column;
    gap: 0.6rem;
}

.grant-single__back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gr-color-muted);
    text-decoration: none;
    transition: color var(--gr-fast);
}

.grant-single__back-link:hover {
    color: var(--gr-color-primary);
}

.grant-single__title {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 700;
    line-height: 1.15;
    margin: 0;
    letter-spacing: -0.02em;
    color: var(--gr-color-text);
}

/* ─────────────────────────────────────────────
   Single — Two-column Layout
───────────────────────────────────────────── */
.grant-single__layout {
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 2.5rem);
    padding-block: 2.5rem 5rem;
    display: grid;
	padding-left: 0px!important;
	padding-right: 0px!important;
    grid-template-columns: minmax(0, 1fr) 400px; /* sidebar width from Figma */
    gap: 3rem;
    align-items: start;
}

/* ─────────────────────────────────────────────
   Single — Main Content
───────────────────────────────────────────── */
.grant-single__main {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    min-width: 0;
}

.grant-single__featured-image img {
    width: 100%;
    height: auto;
    max-height: 460px;
    object-fit: cover;
    display: block;
    border-radius: var(--gr-radius-lg);
}

/* ─────────────────────────────────────────────
   Single — Section pattern
───────────────────────────────────────────── */
.grant-single__section {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.grant-single__section--accordion,
.grant-single__section--tabs,
.grant-single__section--guidance {
    border-top: 1px solid var(--gr-color-border);
    padding-top: 2.5rem;
}

.grant-single__section-heading {
    margin: 0;
    font-size: 0;
}

.grant-single__section-label {
    display: inline-block;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
}


/* ─────────────────────────────────────────────
   WYSIWYG
───────────────────────────────────────────── */
.grant-single__wysiwyg {
    color: var(--gr-color-text);
    font-size: 1rem;
    line-height: 1.8;
}

.grant-single__wysiwyg > *:first-child { margin-top: 0; }
.grant-single__wysiwyg > *:last-child  { margin-bottom: 0; }

.grant-single__wysiwyg h2,
.grant-single__wysiwyg h3,
.grant-single__wysiwyg h4 {
    font-weight: 700;
    line-height: 1.25;
    margin-top: 1.4em;
    margin-bottom: 0.4em;
}

.grant-single__wysiwyg a {
    color: var(--gr-color-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.grant-single__wysiwyg a:hover {
    color: var(--gr-color-primary-dark);
}

.grant-single__wysiwyg ul,
.grant-single__wysiwyg ol {
    padding-left: 1.5rem;
}

.grant-single__wysiwyg li + li {
    margin-top: 0.35em;
}

/* ─────────────────────────────────────────────
   Accordion
───────────────────────────────────────────── */
.grant-accordion {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gr-color-border);
    border-radius: var(--gr-radius-lg);
    overflow: hidden;
}

.grant-accordion__item {
    border-bottom: 1px solid var(--gr-color-border);
}

.grant-accordion__item:last-child {
    border-bottom: none;
}

.grant-accordion__trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--gr-color-surface);
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gr-color-text);
    transition: background var(--gr-fast), color var(--gr-fast);
}

.grant-accordion__trigger:hover,
.grant-accordion__trigger[aria-expanded="true"] {
    background: var(--gr-label-default-bg);
    color: var(--gr-color-primary-dark);
}

.grant-accordion__icon {
    flex-shrink: 0;
    color: var(--gr-color-muted);
    transition: transform var(--gr-fast);
}

.grant-accordion__trigger[aria-expanded="true"] .grant-accordion__icon {
    transform: rotate(180deg);
}

.grant-accordion__panel[hidden] {
    display: none;
}

.grant-accordion__panel-inner {
    padding: 1.25rem 1.5rem 1.5rem;
    background: #fafafa;
    border-top: 1px solid var(--gr-color-border);
}

/* ─────────────────────────────────────────────
   Tabs
───────────────────────────────────────────── */
/* Tabs are outlined pill buttons that wrap onto as many rows as they need;
   the open tab is filled. A line under the buttons separates them from
   the open tab's content. */
.grant-tabs__panels {
    overflow: hidden;
}

.grant-tabs__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e2e2;
}

.grant-tabs__nav-btn {
    padding: 8px 18px;
    border: 1px solid var(--gr-color-primary);
    border-radius: 20px;
    background: #fff;
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 600;
    text-align: left;
    color: var(--gr-color-primary-dark);
    cursor: pointer;
    transition: color var(--gr-fast), background var(--gr-fast);
}

.grant-tabs__nav-btn:hover {
    background: #e8f1ec;
}

.grant-tabs__nav-btn--active,
.grant-tabs__nav-btn--active:hover {
    background: var(--gr-color-primary);
    color: #fff;
}

.grant-tabs__nav-btn:focus {
    outline: none;
}

.grant-tabs__nav-btn:focus-visible {
    outline: 2px solid #284291;
    outline-offset: 2px;
}

.grant-tabs__panel {
    padding: 1.5rem 0rem;
    background: var(--gr-color-surface);
}

.grant-tabs__panel[hidden] {
    display: none;
}

/* ─────────────────────────────────────────────
   Sidebar
───────────────────────────────────────────── */
.grant-single__sidebar {
    position: sticky;
    top: 2rem;
}

/* Matches the Figma "Sidebar" (Webmaster-4.0-IOEM, node 184:1314):
   white panel, title in the H4 style, sub-headings in the H5 style,
   Body text, Color 4 links. */
.grant-single__sidebar-inner {
    background: #fff;
    padding: 50px 36px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* "Contacts" title: Figma H4 */
.grant-single__sidebar .grant-single__sidebar-heading,
.grant-single__sidebar .grant-single__sidebar-heading .grant-single__section-label {
    margin: 0;
    font-size: 30px;
    line-height: 40px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: #000;
}

/* Contact details: Figma Body */
.grant-single__sidebar .grant-single__sidebar-content,
.grant-single__sidebar .grant-single__sidebar-content p {
    font-size: 16px;
    line-height: 26px;
    font-weight: 400;
    color: #000;
}

.grant-single__sidebar .grant-single__sidebar-content p {
    margin: 0 0 20px;
}

/* Every heading editors use in the Contacts field: Figma H5 */
.grant-single__sidebar .grant-single__sidebar-content :is(h1, h2, h3, h4, h5, h6) {
    margin: 0 0 10px;
    font-size: 20px;
    line-height: 24px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: #000;
}

/* style.css sets h4 { margin-top: 1.2rem !important } site-wide */
.grant-single__sidebar .grant-single__sidebar-content :is(h1, h2, h3, h4, h5, h6) {
    margin-top: 0 !important;
}

.grant-single__sidebar .grant-single__sidebar-content :is(p, h1, h2, h3, h4, h5, h6, div):last-child {
    margin-bottom: 0;
}

/* Figma Body Link. The colour stays the site link colour (--color2),
   which the parent theme sets with !important on every content link. */
.grant-single__sidebar .grant-single__sidebar-content a {
    font-weight: 400;
    text-decoration: underline;
    overflow-wrap: anywhere;
}

.grant-single__sidebar .grant-single__sidebar-content a:hover,
.grant-single__sidebar .grant-single__sidebar-content a:focus {
    text-decoration-thickness: 2px;
}

/* A line between contacts: above a heading that follows contact details,
   and above a paragraph that starts with a bold name. */
.grant-single__sidebar .grant-single__sidebar-content :is(p, ul, ol, div) + :is(h1, h2, h3, h4, h5, h6),
.grant-single__sidebar .grant-single__sidebar-content p + p:has(> :is(strong, b):first-child) {
    padding-top: 20px;
    border-top: 1px solid #e2e2e2;
}

/* ─────────────────────────────────────────────
   Back button
───────────────────────────────────────────── */
.grant-single__footer {
    border-top: 1px solid var(--gr-color-border);
    padding-top: 2rem;
}

.grant-single__back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gr-color-primary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    padding-bottom: 1px;
    transition: color var(--gr-fast), border-color var(--gr-fast);
}

.grant-single__back-btn:hover {
    color: var(--gr-color-primary-dark);
    border-bottom-color: var(--gr-color-primary-dark);
}

/* ─────────────────────────────────────────────
   Reduced Motion
───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .grant-card {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .grant-card__image img,
    .grants-hero__bg,
    .grant-accordion__icon {
        transition: none;
    }
}

/* ─────────────────────────────────────────────
   Responsive
───────────────────────────────────────────── */
@media (max-width: 900px) {
    .grant-single__layout {
        grid-template-columns: 1fr;
    }

    /* Sidebar moves above content on mobile */
    .grant-single__sidebar {
        position: static;
        order: -1;
    }
}

@media (max-width: 768px) {
    .grants-hero {
        min-height: 240px;
    }

    .grants-archive {
        gap: 1.25rem;
    }

    .grant-card__body {
        padding: 1rem;
    }

    .grant-single__layout {
        padding-block: 2rem 3.5rem;
    }
}

@media (max-width: 1100px) {
    .grants-archive {
    }
}

@media (max-width: 768px) {
    .grants-archive {
        gap: 1.25rem;
    }
}

@media (max-width: 480px) {
    .grants-archive {
    }
}

h2.grant-card__title {
	margin-top: 0px!important
}

/* -----------------------------------------------
   Grant category sections — 2026-07-10
----------------------------------------------- */
.grants-section {
    margin-bottom: 60px;
}
.grants-section__heading {
    font-size: 1.6rem;
    margin: 0 0 24px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--color-primary, #1a3a5c);
}
.grants-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}
@media (max-width: 1024px) {
    .grants-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .grants-grid { grid-template-columns: 1fr; }
}

/* -----------------------------------------------
   Grants filter bar — 2026-07-10
----------------------------------------------- */
.grants-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 40px;
}
.grants-filter__btn {
    display: inline-block;
    padding: 8px 50px;
    border: 2px solid var(--color-primary, #1a3a5c);
    color: var(--color-primary, #1a3a5c);
    border-radius: 999px;
    font-weight: 600;
    font-size: 1.25rem;
    font-style: normal;
	line-height: 1em;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.grants-filter__btn:hover,
.grants-filter__btn.is-active {
    background: var(--color-primary, #1a3a5c);
    color: #fff;
    font-style: normal;
}

.grants-filter__btn:hover {
    color: #fff !important;
    text-decoration: none !important;
}

.grants-section__heading {
    border-bottom: none;
}
