/*
Theme Name: SmallBusinessGrants
Theme URI: https://smallbusinessgrants.eu
Description: EU grant listings for SMEs. Plain language, no jargon.
Version: 3.0.0
Author: Lyalpha GmbH
Text Domain: sbg
*/

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

:root {
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "SF Mono", "Fira Code", Consolas, monospace;

    --color-white: #ffffff;
    --color-black: #0a0a0a;
    --color-gray-50: #fafafa;
    --color-gray-100: #f4f4f5;
    --color-gray-200: #e4e4e7;
    --color-gray-300: #d4d4d8;
    --color-gray-400: #a1a1aa;
    --color-gray-500: #71717a;
    --color-gray-600: #52525b;
    --color-gray-700: #3f3f46;
    --color-gray-800: #27272a;
    --color-gray-900: #18181b;
    --color-gray-950: #09090b;

    --color-blue-50: #eff6ff;
    --color-blue-100: #dbeafe;
    --color-blue-500: #3b82f6;
    --color-blue-600: #2563eb;
    --color-blue-700: #1d4ed8;

    --color-green-50: #f0fdf4;
    --color-green-600: #16a34a;
    --color-red-50: #fef2f2;
    --color-red-600: #dc2626;

    --content-narrow: 640px;
    --content-wide: 1100px;
    --radius: 12px;
    --radius-sm: 6px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 6px 16px rgba(0,0,0,0.06);
}

/* System font stack, no external requests */

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-gray-800);
    background: var(--color-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--color-blue-600);
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: var(--color-blue-700);
}

img {
    max-width: 100%;
    display: block;
}

/* ===================================================
   HEADER
   =================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-gray-200);
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
}

.site-header__inner {
    max-width: var(--content-wide);
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.site-title a {
    color: var(--color-gray-900);
}

.site-title a:hover {
    text-decoration: none;
}

.site-nav {
    display: flex;
    gap: 2rem;
}

.site-nav a {
    color: var(--color-gray-500);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
}

.site-nav a:hover {
    color: var(--color-gray-900);
    text-decoration: none;
}

/* === Disable site-main constraints on homepage === */
body.home .site-main,
body.post-type-archive-grant .site-main,
body.page-template-page-templates-template-main-page .site-main {
    max-width: none;
    padding: 0;
}

.site-main {
    max-width: var(--content-wide);
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* ===================================================
   HERO
   =================================================== */
.hero {
    background: var(--color-gray-950);
    color: var(--color-white);
    padding: 6rem 2rem 5rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(59,130,246,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.hero::after {
    content: "";
    position: absolute;
    bottom: -50%;
    right: -20%;
    width: 50%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(59,130,246,0.05) 0%, transparent 70%);
    pointer-events: none;
}

.hero__inner {
    max-width: var(--content-narrow);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero__title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--color-white);
}

.hero__lede {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--color-gray-300);
    margin-bottom: 1rem;
}

.hero__lede strong {
    color: var(--color-white);
    font-weight: 700;
}

.hero__lede a {
    color: var(--color-gray-300);
    text-decoration: underline;
    text-decoration-color: var(--color-gray-600);
    text-underline-offset: 3px;
}

.hero__lede a:hover {
    color: var(--color-white);
    text-decoration-color: var(--color-white);
}

.hero__lede a strong {
    color: var(--color-blue-500);
}

.hero__lede a:hover strong {
    color: var(--color-white);
}

.hero__sub {
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--color-gray-400);
}

/* ===================================================
   SECTIONS
   =================================================== */
.section {
    padding: 5rem 2rem;
}

.section--surface {
    background: var(--color-gray-50);
}

.section--dark {
    background: var(--color-gray-950);
    color: var(--color-white);
}

.section__inner {
    max-width: var(--content-wide);
    margin: 0 auto;
}

.section__inner--narrow {
    max-width: var(--content-narrow);
}

.section__inner--wide {
    max-width: var(--content-wide);
}

.section__heading {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.2;
    margin-bottom: 1.25rem;
    color: var(--color-gray-900);
}

.section--dark .section__heading {
    color: var(--color-white);
}

.section__heading--center {
    text-align: center;
}

.section p {
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--color-gray-600);
    margin-bottom: 1rem;
}

.section p:last-child {
    margin-bottom: 0;
}

.section--dark p {
    color: var(--color-gray-400);
}

.section__emphasis {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-gray-900);
    padding: 0.75rem 0;
    font-style: normal;
}

.section__closing {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.7;
    color: var(--color-gray-800);
    margin-top: 0.75rem;
}

/* ===================================================
   COMPARE / EXAMPLE CARD
   =================================================== */
.compare {
    margin: 2rem auto;
    max-width: 480px;
}

.compare__card {
    padding: 1.75rem;
    border-radius: var(--radius);
    position: relative;
}

.compare__card--after {
    background: var(--color-white);
    border: 2px solid var(--color-blue-600);
    box-shadow: var(--shadow-card);
}

.compare__label {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
}

.compare__card--before .compare__label {
    color: var(--color-gray-500);
    background: var(--color-gray-100);
}

.compare__card--after .compare__label {
    color: var(--color-blue-600);
    background: var(--color-blue-50);
}

.compare__text {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--color-gray-500);
    font-style: italic;
}

.compare__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0;
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--color-gray-100);
}

.compare__row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.compare__row:first-of-type {
    padding-top: 0;
}

.compare__key {
    color: var(--color-gray-500);
    font-size: 0.875rem;
}

.compare__val {
    font-weight: 600;
    color: var(--color-gray-900);
}

.compare__caption {
    text-align: center;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-gray-500);
    margin-top: 1.5rem;
}

/* ===================================================
   PILLARS (3 columns)
   =================================================== */
.pillars {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.pillar {
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius);
    padding: 2rem 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.pillar:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-gray-300);
}

.pillar__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--color-gray-900);
    color: var(--color-white);
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.pillar__title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-gray-900);
}

.pillar__desc {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--color-gray-500);
}

/* ===================================================
   CTA BOX
   =================================================== */
.cta-box {
    max-width: var(--content-narrow);
    margin: 0 auto;
    padding: 2.5rem 2.5rem;
    background: var(--color-gray-950);
    color: var(--color-white);
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.cta-box::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(59,130,246,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.cta-box .cta-box__text {
    font-size: 1.0625rem;
    font-weight: 500;
    line-height: 1.7;
    color: var(--color-white);
    margin: 0;
    position: relative;
    z-index: 1;
}

/* ===================================================
   GRANT TABLE
   =================================================== */
.grants-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--color-white);
}

.grant-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.grant-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-gray-200);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-gray-500);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.grant-table th:hover {
    color: var(--color-gray-900);
}

.grant-table th.sorted-asc::after {
    content: " \2191";
    color: var(--color-blue-600);
}

.grant-table th.sorted-desc::after {
    content: " \2193";
    color: var(--color-blue-600);
}

.grant-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-gray-100);
    vertical-align: middle;
    color: var(--color-gray-700);
}

.grant-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.grant-table tbody tr:hover {
    background: var(--color-blue-50);
}

.grant-table tbody tr:last-child td {
    border-bottom: none;
}

/* === Status Tags === */
.tag {
    display: inline-block;
    padding: 0.1875rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.tag--open {
    background: var(--color-green-50);
    color: var(--color-green-600);
}

.tag--closing {
    background: var(--color-red-50);
    color: var(--color-red-600);
}

.tag--closed {
    background: var(--color-gray-100);
    color: var(--color-gray-400);
}

/* ===================================================
   FAQ
   =================================================== */
.faq {
    max-width: var(--content-narrow);
}

.faq__item {
    border-bottom: 1px solid var(--color-gray-200);
}

.faq__item:last-child {
    border-bottom: none;
}

.faq__question {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 1.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-gray-900);
    cursor: pointer;
    list-style: none;
    gap: 0.75rem;
    transition: color 0.15s;
}

.faq__question:hover {
    color: var(--color-blue-600);
}

.faq__question::-webkit-details-marker {
    display: none;
}

.faq__question::after {
    content: "+";
    margin-left: auto;
    font-size: 1.25rem;
    font-weight: 300;
    color: var(--color-gray-400);
    flex-shrink: 0;
    transition: transform 0.2s;
}

details[open] > .faq__question::after {
    content: "\2212";
    color: var(--color-blue-600);
}

.faq__answer {
    font-size: 0.9375rem;
    line-height: 1.8;
    color: var(--color-gray-500);
    padding: 0 0 1.5rem 0;
}

.faq__answer a {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--color-gray-300);
}

.faq__answer a:hover {
    text-decoration-color: var(--color-blue-600);
}

/* ===================================================
   SINGLE GRANT PAGE
   =================================================== */
.grant-single {
    max-width: var(--content-narrow);
}

.grant-header {
    margin-bottom: 2rem;
}

.grant-header__back {
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.grant-header__back a {
    color: var(--color-gray-500);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.grant-header__back a:hover {
    color: var(--color-gray-900);
}

.grant-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 0.4rem;
}

.grant-header__topic {
    font-size: 0.8125rem;
    color: var(--color-gray-400);
    font-family: var(--font-mono);
    margin-bottom: 0.5rem;
}

/* === Grant Meta Grid === */
.grant-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius);
    margin-bottom: 2.5rem;
}

.grant-meta__item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.grant-meta__label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-gray-400);
    font-weight: 600;
}

.grant-meta__value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-gray-900);
}

.grant-meta__value small {
    font-weight: 400;
    color: var(--color-gray-500);
    font-size: 0.8125rem;
}

/* === Grant Body === */
.grant-body {
    margin-bottom: 2.5rem;
}

.grant-body h2 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--color-gray-900);
}

.grant-body p {
    margin-bottom: 0.75rem;
    line-height: 1.8;
    font-size: 1rem;
    color: var(--color-gray-600);
}

.grant-body--original {
    color: var(--color-gray-500);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid var(--color-gray-200);
}

.grant-body--original h2 {
    color: var(--color-gray-500);
}

.grant-body--original p {
    color: var(--color-gray-400);
    font-size: 0.9375rem;
}

/* === Grant CTA === */
.grant-actions {
    margin: 2.5rem 0;
    padding-top: 2rem;
    border-top: 1px solid var(--color-gray-200);
}

.grant-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--color-blue-600);
    color: var(--color-white);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9375rem;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: var(--shadow-sm);
}

.grant-cta:hover {
    background: var(--color-blue-700);
    color: var(--color-white);
    text-decoration: none;
    box-shadow: var(--shadow-md);
}

/* ===================================================
   FOOTER
   =================================================== */
.site-footer {
    border-top: 1px solid var(--color-gray-200);
    padding: 3rem 2rem;
    background: var(--color-gray-50);
}

.site-footer__inner {
    max-width: var(--content-wide);
    margin: 0 auto;
}

.site-footer__disclaimer {
    font-size: 0.8125rem;
    color: var(--color-gray-400);
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.site-footer__disclaimer a {
    color: var(--color-gray-500);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: var(--color-gray-300);
}

.site-footer__disclaimer a:hover {
    color: var(--color-gray-700);
}

.site-footer__legal {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.site-footer__legal a {
    font-size: 0.8125rem;
    color: var(--color-gray-500);
    text-decoration: none;
    font-weight: 500;
}

.site-footer__legal a:hover {
    color: var(--color-gray-700);
}

.site-footer__copy {
    font-size: 0.75rem;
    color: var(--color-gray-400);
}

/* ===================================================
   ABOUT PAGE
   =================================================== */
.page-about {
    max-width: var(--content-narrow);
}

.page-about h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
}

.page-about p {
    margin-bottom: 1rem;
    line-height: 1.8;
    font-size: 1.0625rem;
    color: var(--color-gray-600);
}

.page-about a {
    text-underline-offset: 3px;
}

/* ===================================================
   RESPONSIVE
   =================================================== */
@media (max-width: 768px) {
    .hero {
        padding: 4rem 1.5rem 3.5rem;
    }

    .hero__title {
        font-size: 2rem;
    }

    .hero__lede {
        font-size: 1rem;
    }

    .section {
        padding: 3.5rem 1.5rem;
    }

    .section__heading {
        font-size: 1.375rem;
    }

    .compare {
        max-width: 100%;
    }

    .pillars {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .pillar {
        padding: 1.5rem;
    }

    .cta-box {
        padding: 2rem 1.5rem;
    }

    .site-header {
        height: auto;
        padding: 0.75rem 1.5rem;
    }

    .site-header__inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .site-nav {
        gap: 1.25rem;
    }

    .grant-table {
        font-size: 0.8125rem;
    }

    .grant-table th,
    .grant-table td {
        padding: 0.625rem 0.75rem;
    }

    .grant-meta {
        grid-template-columns: 1fr 1fr;
    }

    .grant-header h1 {
        font-size: 1.375rem;
    }

    .site-main {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 3rem 1.25rem 2.5rem;
    }

    .hero__title {
        font-size: 1.75rem;
    }

    .section {
        padding: 2.5rem 1.25rem;
    }

    .section__heading {
        font-size: 1.25rem;
    }

    .compare__card {
        padding: 1.25rem;
    }

    .grant-meta {
        grid-template-columns: 1fr;
    }
}
