/**
 * BeyondAge40 homepage.
 * Warm editorial design with accessible contrast and generous reading rhythm.
 */

:root {
    --ba40-ink: #18231f;
    --ba40-ink-soft: #4f5d56;
    --ba40-forest: #173f35;
    --ba40-forest-deep: #0c211c;
    --ba40-sage: #789b88;
    --ba40-cream: #f7f2e8;
    --ba40-cream-deep: #eee5d5;
    --ba40-paper: #fffdf8;
    --ba40-amber: #e5a832;
    --ba40-amber-dark: #9b6500;
    --ba40-line: rgba(24, 35, 31, 0.14);
    --ba40-line-dark: rgba(255, 255, 255, 0.16);
    --ba40-shadow: 0 18px 50px rgba(35, 43, 38, 0.09);
    --ba40-radius-sm: 12px;
    --ba40-radius: 20px;
    --ba40-radius-lg: 32px;
    --ba40-container: 1180px;
}

html {
    scroll-behavior: smooth;
}

#ba40-home,
#ba40-home *,
#ba40-home *::before,
#ba40-home *::after {
    box-sizing: border-box;
}

#ba40-home {
    overflow: hidden;
    background: var(--ba40-cream);
    color: var(--ba40-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 17px;
    line-height: 1.65;
}

#ba40-home h1,
#ba40-home h2,
#ba40-home h3,
#ba40-home p,
#ba40-home ul {
    margin-top: 0;
}

#ba40-home h1,
#ba40-home h2,
#ba40-home h3 {
    color: inherit;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    letter-spacing: -0.035em;
}

#ba40-home a {
    color: inherit;
    text-decoration: none;
}

#ba40-home a:focus-visible {
    border-radius: 4px;
    outline: 3px solid var(--ba40-amber);
    outline-offset: 4px;
}

.ba40-container {
    width: min(calc(100% - 40px), var(--ba40-container));
    margin-inline: auto;
}

.ba40-section {
    padding-block: clamp(76px, 9vw, 124px);
}

.ba40-kicker,
.ba40-card-label {
    margin-bottom: 14px;
    color: var(--ba40-amber-dark);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    line-height: 1.35;
    text-transform: uppercase;
}

.ba40-section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
    align-items: end;
    gap: 48px;
    margin-bottom: 44px;
}

.ba40-section-heading h2,
.ba40-products-heading h2,
.ba40-principles h2,
.ba40-cta h2 {
    max-width: 760px;
    margin-bottom: 0;
    font-size: clamp(2.25rem, 4.8vw, 4.35rem);
    line-height: 0.99;
}

.ba40-section-heading > p,
.ba40-products-heading > p,
.ba40-principles-grid > div > p:last-child,
.ba40-cta-panel > div > p:last-child {
    margin-bottom: 0;
    color: var(--ba40-ink-soft);
}

.ba40-button,
.ba40-small-button {
    display: inline-flex;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    gap: 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1;
    transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.ba40-button {
    min-height: 56px;
    padding: 0 24px;
}

.ba40-button:hover,
.ba40-small-button:hover {
    transform: translateY(-2px);
}

.ba40-button-primary {
    background: var(--ba40-amber);
    color: var(--ba40-forest-deep) !important;
    box-shadow: 0 8px 26px rgba(229, 168, 50, 0.22);
}

.ba40-button-primary:hover {
    background: #f0b946;
}

.ba40-small-button {
    min-width: 150px;
    padding: 0 20px;
    border-color: var(--ba40-line);
    background: rgba(255, 255, 255, 0.42);
}

.ba40-small-button:hover {
    border-color: var(--ba40-forest);
    background: var(--ba40-paper);
}

/* Hero */
.ba40-hero {
    position: relative;
    padding-block: clamp(76px, 10vw, 132px);
    background:
        radial-gradient(circle at 83% 15%, rgba(120, 155, 136, 0.22), transparent 29%),
        var(--ba40-forest-deep);
    color: #fffdf8;
}

.ba40-hero::after {
    position: absolute;
    right: -90px;
    bottom: -160px;
    width: 420px;
    height: 420px;
    border: 1px solid rgba(229, 168, 50, 0.2);
    border-radius: 50%;
    content: "";
}

.ba40-hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.72fr);
    align-items: center;
    gap: clamp(48px, 8vw, 100px);
}

.ba40-hero .ba40-kicker,
.ba40-principles .ba40-kicker {
    color: #f2bd54;
}

.ba40-hero h1 {
    max-width: 780px;
    margin-bottom: 26px;
    font-size: clamp(3.65rem, 7.2vw, 7.2rem);
    line-height: 0.86;
}

.ba40-hero h1 span {
    display: block;
    color: #a9c4b4;
    font-style: italic;
    font-weight: 400;
}

.ba40-hero-intro {
    max-width: 650px;
    margin-bottom: 32px;
    color: rgba(255, 253, 248, 0.76);
    font-size: clamp(1.08rem, 1.8vw, 1.28rem);
    line-height: 1.65;
}

.ba40-hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 24px;
    margin-bottom: 38px;
}

.ba40-text-link {
    position: relative;
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    font-size: 0.94rem;
    font-weight: 750;
}

.ba40-text-link::after {
    position: absolute;
    right: 0;
    bottom: 7px;
    left: 0;
    height: 1px;
    background: currentColor;
    content: "";
    transform: scaleX(0.3);
    transform-origin: left;
    transition: transform 180ms ease;
}

.ba40-text-link:hover::after {
    transform: scaleX(1);
}

.ba40-trust-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    margin: 0;
    padding: 0;
    color: rgba(255, 253, 248, 0.68);
    font-size: 0.75rem;
    font-weight: 700;
    list-style: none;
}

.ba40-trust-list li {
    position: relative;
    padding-left: 16px;
}

.ba40-trust-list li::before {
    position: absolute;
    top: 0.62em;
    left: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ba40-amber);
    content: "";
}

.ba40-feature-card {
    overflow: hidden;
    border: 1px solid var(--ba40-line-dark);
    border-radius: var(--ba40-radius-lg);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.24);
}

.ba40-feature-media,
.ba40-feature-card > .ba40-image-fallback {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.ba40-feature-media img,
.ba40-product-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 400ms ease;
}

.ba40-feature-media:hover img,
.ba40-product-visual:hover img {
    transform: scale(1.025);
}

.ba40-image-fallback {
    position: relative;
    display: grid;
    width: 100%;
    height: 100%;
    min-height: 340px;
    place-items: center;
    overflow: hidden;
    background:
        linear-gradient(145deg, rgba(229, 168, 50, 0.15), transparent 45%),
        linear-gradient(135deg, #315c4f, #102820);
}

.ba40-image-fallback strong {
    position: relative;
    z-index: 2;
    color: var(--ba40-cream);
    font-family: Georgia, serif;
    font-size: clamp(4rem, 9vw, 7rem);
    font-style: italic;
    font-weight: 400;
}

.ba40-orbit {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
}

.ba40-orbit-one {
    width: 280px;
    height: 280px;
}

.ba40-orbit-two {
    width: 430px;
    height: 190px;
    transform: rotate(-24deg);
}

.ba40-feature-body {
    padding: 28px 30px 32px;
}

.ba40-feature-body .ba40-card-label {
    color: #f2bd54;
}

.ba40-feature-body h2 {
    margin-bottom: 18px;
    font-size: clamp(1.55rem, 2.5vw, 2.15rem);
    line-height: 1.12;
}

.ba40-feature-body h2 a:hover,
.ba40-article-body h3 a:hover,
.ba40-latest-body h3 a:hover {
    text-decoration: underline;
    text-decoration-color: var(--ba40-amber);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

.ba40-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--ba40-ink-soft);
    font-size: 0.78rem;
    font-weight: 650;
}

.ba40-feature-body .ba40-article-meta {
    color: rgba(255, 253, 248, 0.62);
}

/* Topics */
.ba40-topics {
    background: var(--ba40-cream);
}

.ba40-topic-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.ba40-topic-card {
    display: flex;
    min-height: 285px;
    flex-direction: column;
    padding: 28px;
    border: 1px solid var(--ba40-line);
    border-radius: var(--ba40-radius);
    background: rgba(255, 253, 248, 0.68);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
    transition: border-color 200ms ease, background-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.ba40-topic-card:hover {
    border-color: rgba(23, 63, 53, 0.36);
    background: var(--ba40-paper);
    box-shadow: var(--ba40-shadow);
    transform: translateY(-4px);
}

.ba40-topic-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 34px;
}

.ba40-topic-icon {
    display: grid;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(23, 63, 53, 0.08);
    color: var(--ba40-forest);
    place-items: center;
}

.ba40-topic-icon svg {
    width: 24px;
    height: 24px;
}

.ba40-topic-number {
    color: #7b857f;
    font-size: 0.75rem;
    font-weight: 800;
}

.ba40-topic-title {
    margin-bottom: 10px;
    font-family: Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.ba40-topic-description {
    margin-bottom: 24px;
    color: var(--ba40-ink-soft);
    font-size: 0.92rem;
    line-height: 1.55;
}

.ba40-topic-link {
    margin-top: auto;
    color: var(--ba40-forest);
    font-size: 0.78rem;
    font-weight: 800;
}

/* Articles */
.ba40-featured,
.ba40-latest {
    background: var(--ba40-paper);
}

.ba40-article-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.ba40-article-card {
    overflow: hidden;
    border: 1px solid var(--ba40-line);
    border-radius: var(--ba40-radius);
    background: #fff;
    box-shadow: 0 14px 34px rgba(35, 43, 38, 0.06);
    transition: box-shadow 200ms ease, transform 200ms ease;
}

.ba40-article-card:hover {
    box-shadow: var(--ba40-shadow);
    transform: translateY(-4px);
}

.ba40-article-image {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--ba40-cream-deep);
}

.ba40-article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 350ms ease;
}

.ba40-article-card:hover .ba40-article-image img {
    transform: scale(1.025);
}

.ba40-card-fallback {
    display: grid;
    width: 100%;
    height: 100%;
    min-height: 210px;
    background:
        radial-gradient(circle at 70% 20%, rgba(229, 168, 50, 0.4), transparent 23%),
        linear-gradient(145deg, #b8cdbf, #e7decc);
    color: var(--ba40-forest);
    place-items: center;
}

.ba40-card-fallback span {
    font-family: Georgia, serif;
    font-size: 3.2rem;
    font-style: italic;
}

.ba40-article-body {
    padding: 25px 26px 28px;
}

.ba40-article-body h3 {
    margin-bottom: 13px;
    font-size: clamp(1.35rem, 2vw, 1.65rem);
    line-height: 1.15;
}

.ba40-excerpt {
    margin-bottom: 22px;
    color: var(--ba40-ink-soft);
    font-size: 0.9rem;
    line-height: 1.58;
}

/* Products */
.ba40-products {
    background: var(--ba40-cream-deep);
}

.ba40-products-heading {
    max-width: 790px;
    margin-bottom: 48px;
}

.ba40-products-heading > p:last-child {
    max-width: 640px;
    margin-top: 24px;
}

.ba40-product-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.ba40-product-card {
    overflow: hidden;
    border: 1px solid rgba(23, 63, 53, 0.14);
    border-radius: var(--ba40-radius);
    background: var(--ba40-paper);
}

.ba40-product-visual {
    display: grid;
    min-height: 320px;
    padding: 42px;
    background:
        radial-gradient(circle at 80% 15%, rgba(255, 255, 255, 0.72), transparent 24%),
        #b7cdbf;
    place-items: center;
}

.ba40-product-shape {
    display: flex;
    width: 78%;
    min-height: 238px;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
    border-radius: 8px 18px 18px 8px;
    background: var(--ba40-forest);
    box-shadow: -10px 18px 30px rgba(24, 35, 31, 0.22);
    color: var(--ba40-paper);
    transform: rotate(-3deg);
}

.ba40-product-shape-2 {
    background: #936b2e;
    transform: rotate(2deg);
}

.ba40-product-shape-3 {
    background: #355f6b;
    transform: rotate(-1deg);
}

.ba40-product-shape small {
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ba40-product-shape strong {
    max-width: 190px;
    font-family: Georgia, serif;
    font-size: clamp(1.6rem, 2.4vw, 2.2rem);
    line-height: 1.02;
}

.ba40-product-body {
    padding: 28px;
}

.ba40-product-body h3 {
    margin-bottom: 12px;
    font-size: 1.65rem;
    line-height: 1.15;
}

.ba40-product-body > p:not(.ba40-card-label) {
    min-height: 54px;
    margin-bottom: 22px;
    color: var(--ba40-ink-soft);
    font-size: 0.9rem;
    line-height: 1.58;
}

.ba40-product-link {
    color: var(--ba40-forest);
    font-size: 0.8rem;
    font-weight: 800;
}

/* Principles */
.ba40-principles {
    padding-block: clamp(80px, 10vw, 132px);
    background:
        radial-gradient(circle at 90% 80%, rgba(120, 155, 136, 0.18), transparent 27%),
        var(--ba40-forest-deep);
    color: var(--ba40-paper);
}

.ba40-principles-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(340px, 0.75fr);
    align-items: center;
    gap: clamp(54px, 9vw, 120px);
}

.ba40-principles-grid > div > p:last-child {
    max-width: 660px;
    margin-top: 28px;
    color: rgba(255, 253, 248, 0.7);
}

.ba40-principle-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ba40-principle-list li {
    display: flex;
    min-height: 66px;
    align-items: center;
    gap: 22px;
    padding: 12px 20px;
    border: 1px solid var(--ba40-line-dark);
    border-radius: var(--ba40-radius-sm);
    background: rgba(255, 255, 255, 0.045);
}

.ba40-principle-list span {
    color: #f2bd54;
    font-size: 0.72rem;
    font-weight: 800;
}

.ba40-principle-list strong {
    font-size: 0.93rem;
}

/* Latest */
.ba40-latest-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--ba40-line);
}

.ba40-latest-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    padding: 30px 30px 30px 0;
    border-bottom: 1px solid var(--ba40-line);
}

.ba40-latest-card:nth-child(odd) {
    padding-right: 38px;
    border-right: 1px solid var(--ba40-line);
}

.ba40-latest-card:nth-child(even) {
    padding-left: 38px;
}

.ba40-latest-body h3 {
    margin-bottom: 10px;
    font-size: 1.45rem;
    line-height: 1.18;
}

.ba40-latest-body > p:not(.ba40-card-label) {
    margin-bottom: 18px;
    color: var(--ba40-ink-soft);
    font-size: 0.87rem;
    line-height: 1.55;
}

.ba40-latest-arrow {
    display: grid;
    width: 46px;
    height: 46px;
    border: 1px solid var(--ba40-line);
    border-radius: 50%;
    place-items: center;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.ba40-latest-arrow:hover {
    background: var(--ba40-forest);
    color: white !important;
    transform: translateX(3px);
}

.ba40-no-posts {
    grid-column: 1 / -1;
    padding: 44px;
    border: 1px dashed var(--ba40-line);
    border-radius: var(--ba40-radius);
    text-align: center;
}

.ba40-no-posts h3 {
    margin-bottom: 8px;
    font-size: 1.6rem;
}

.ba40-no-posts p {
    margin-bottom: 0;
    color: var(--ba40-ink-soft);
}

/* Closing CTA */
.ba40-cta {
    padding: 0 0 clamp(76px, 9vw, 120px);
    background: var(--ba40-paper);
}

.ba40-cta-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 48px;
    padding: clamp(38px, 6vw, 72px);
    border-radius: var(--ba40-radius-lg);
    background:
        radial-gradient(circle at 85% 0%, rgba(229, 168, 50, 0.17), transparent 28%),
        var(--ba40-forest);
    color: var(--ba40-paper);
}

.ba40-cta h2 {
    max-width: 800px;
    font-size: clamp(2.15rem, 4.4vw, 3.85rem);
}

.ba40-cta-panel > div > p:last-child {
    max-width: 650px;
    margin-top: 22px;
    color: rgba(255, 253, 248, 0.72);
}

@media (max-width: 1024px) {
    .ba40-hero-grid {
        grid-template-columns: minmax(0, 1fr) minmax(300px, 0.7fr);
        gap: 44px;
    }

    .ba40-topic-grid,
    .ba40-article-grid,
    .ba40-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ba40-product-card:last-child,
    .ba40-article-card:last-child {
        grid-column: 1 / -1;
    }

    .ba40-product-card:last-child {
        display: grid;
        grid-template-columns: 0.9fr 1.1fr;
    }
}

@media (max-width: 780px) {
    .ba40-container {
        width: min(calc(100% - 32px), var(--ba40-container));
    }

    .ba40-section-heading,
    .ba40-hero-grid,
    .ba40-principles-grid,
    .ba40-cta-panel {
        grid-template-columns: 1fr;
    }

    .ba40-section-heading {
        gap: 24px;
    }

    .ba40-section-heading .ba40-small-button {
        width: max-content;
    }

    .ba40-hero {
        padding-top: 70px;
    }

    .ba40-hero h1 {
        font-size: clamp(3.45rem, 16vw, 5.6rem);
    }

    .ba40-hero-feature {
        max-width: 560px;
    }

    .ba40-topic-grid,
    .ba40-article-grid,
    .ba40-product-grid,
    .ba40-latest-grid {
        grid-template-columns: 1fr;
    }

    .ba40-article-card:last-child,
    .ba40-product-card:last-child {
        grid-column: auto;
    }

    .ba40-product-card:last-child {
        display: block;
    }

    .ba40-latest-card,
    .ba40-latest-card:nth-child(odd),
    .ba40-latest-card:nth-child(even) {
        padding: 28px 0;
        border-right: 0;
    }

    .ba40-cta-panel {
        justify-items: start;
    }
}

@media (max-width: 520px) {
    #ba40-home {
        font-size: 16px;
    }

    .ba40-section {
        padding-block: 72px;
    }

    .ba40-hero {
        padding-block: 64px 76px;
    }

    .ba40-hero h1 {
        font-size: clamp(3.25rem, 18vw, 4.5rem);
    }

    .ba40-hero-actions {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .ba40-hero-actions .ba40-button {
        width: 100%;
    }

    .ba40-text-link {
        justify-content: center;
    }

    .ba40-trust-list {
        align-items: flex-start;
        flex-direction: column;
    }

    .ba40-feature-body,
    .ba40-article-body,
    .ba40-product-body,
    .ba40-topic-card {
        padding: 24px;
    }

    .ba40-topic-card {
        min-height: 270px;
    }

    .ba40-product-visual {
        min-height: 290px;
        padding: 34px;
    }

    .ba40-principles-grid {
        gap: 48px;
    }

    .ba40-principle-list li {
        align-items: flex-start;
        padding-block: 18px;
    }

    .ba40-latest-arrow {
        width: 44px;
        height: 44px;
    }

    .ba40-cta-panel {
        gap: 30px;
        padding: 34px 24px;
        border-radius: var(--ba40-radius);
    }

    .ba40-cta-panel .ba40-button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    #ba40-home *,
    #ba40-home *::before,
    #ba40-home *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
