/* ============================================================================
   Article / prose layer
   Shared by the long-form reading pages (chapter, ongoing-conversation).
   Layers eco design-system prose on top of home-v2.css (tokens, nav, footer).
   ============================================================================ */

/* ---- Local tokens for in-content media cards (category colors) ---- */
:root {
    --cap-green: #2f8f5b;
    --cap-red: #c4303a;
    --cap-blue: #5a7d9c;
    --cap-yellow: #d1b812;
    --cap-brown: #7b5a3a;

    /* Reading-layout grid: [fluid] [TEXT] [MEDIA GUTTER] [fluid] */
    --eco-read-text: 720px;
    --eco-read-gutter: 300px;
    --eco-read-gap: 40px;
    --eco-read-break: 1080px; /* below this the layout collapses to one column */
}

/* ============================================================================
   Title header (clears the fixed site header)
   ============================================================================ */
.eco-article-hero {
    background: var(--color-eco-cream);
    padding: 8rem 0 2.5rem;
}

@media (min-width: 768px) {
    .eco-article-hero {
        padding: 9rem 0 3rem;
    }
}

/* Mobile / tablet: a single, left-aligned reading column. */
.eco-article-hero__inner,
.eco-article {
    max-width: 760px;
    margin-inline: auto;
    padding-inline: var(--gutter);
    text-align: left;
}

@media (min-width: 768px) {
    .eco-article-hero__inner,
    .eco-article {
        padding-inline: var(--gutter-lg);
    }
}

/* Desktop: restore the [fluid] [TEXT] [MEDIA GUTTER] [fluid] grid so the
   prose stays left-aligned in its column and media cards float in the
   sticky right-hand gutter instead of breaking up the text flow. */
@media (min-width: 1080px) {
    .eco-article-hero__inner,
    .eco-article {
        max-width: none;
        margin-inline: auto;
        padding-inline: var(--gutter-lg);
        display: grid;
        grid-template-columns: 1fr minmax(0, var(--eco-read-text)) var(--eco-read-gutter) 1fr;
        column-gap: var(--eco-read-gap);
    }

    /* Everything in the prose / hero defaults to the text column. */
    .eco-article > *,
    .eco-article-hero__inner > * {
        grid-column: 2;
    }
}

.eco-article-hero__eyebrow {
    margin-bottom: 1.25rem;
}

.eco-article-hero__title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2.5rem, 5.5vw, 4.25rem);
    line-height: 1.04;
    letter-spacing: -0.015em;
    color: var(--color-eco-ink);
    text-wrap: balance;
}

.eco-article-hero__subtitle {
    margin-top: 1rem;
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(1.25rem, 2.4vw, 1.75rem);
    line-height: 1.3;
    color: var(--color-eco-forest);
}

.eco-article-hero__rule {
    margin-top: 1.75rem;
    width: 72px;
    height: 2px;
    background: var(--color-eco-olive);
    opacity: 0.55;
}

/* ============================================================================
   Article prose — styles the raw xml_content in the eco aesthetic
   ============================================================================ */
.eco-article {
    padding-bottom: 5rem;
    font-family: var(--font-sans);
    font-size: 1.075rem;
    line-height: 1.75;
    color: var(--color-eco-ink);
}

.eco-article p {
    margin: 0 0 1.25em;
    max-width: 68ch;
}

.eco-article h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.9rem, 3vw, 2.6rem);
    line-height: 1.12;
    letter-spacing: -0.01em;
    margin: 2em 0 0.5em;
    color: var(--color-eco-ink);
}

.eco-article h3 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.4rem, 2.2vw, 1.8rem);
    line-height: 1.2;
    margin: 1.6em 0 0.4em;
    color: var(--color-eco-forest);
}

.eco-article h4,
.eco-article h5,
.eco-article h6 {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-eco-ink-soft);
    margin: 2em 0 0.75em;
}

.eco-article a {
    color: var(--color-eco-olive-deep);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(79, 92, 62, 0.4);
    transition:
        color 0.2s,
        text-decoration-color 0.2s;
}

.eco-article a:hover {
    color: var(--color-eco-accent);
    text-decoration-color: currentColor;
}

.eco-article strong,
.eco-article b {
    font-weight: 700;
}

.eco-article em,
.eco-article i {
    font-style: italic;
}

.eco-article .leadin {
    font-weight: 600;
}

/* Inline phrase highlight */
.eco-article .phrase {
    background: rgba(138, 154, 104, 0.22);
    padding: 0 0.28em;
    border-radius: 0.45em;
}

/* ---- Lists ---- */
.eco-article ul,
.eco-article ol {
    margin: 0 0 1.25em;
    padding-left: 0;
    list-style: none;
}

.eco-article li {
    position: relative;
    padding-left: 1.75rem;
    margin: 0.5em 0;
    line-height: 1.65;
    font-family: var(--font-sans);
    font-weight: var(--weight-semibold);
}

.eco-article ul li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.7em;
    width: 6px;
    height: 6px;
    transform: rotate(45deg);
    background: var(--color-eco-olive);
}

.eco-article ul.nonbold li {
    font-weight: 400;
}

.eco-article ul.list2 {
    margin-top: -0.6em;
}

.eco-article ul.list2 li {
    font-style: italic;
}

.eco-article ul.list2 li::before {
    transform: none;
    background: var(--color-eco-ink-soft);
}

.eco-article ol {
    counter-reset: eco-counter;
}

.eco-article ol li::before {
    counter-increment: eco-counter;
    content: counter(eco-counter);
    position: absolute;
    left: 0;
    top: 0;
    font-family: var(--font-mono);
    font-size: 0.85em;
    font-weight: 500;
    color: var(--color-eco-olive-deep);
}

/* ---- Quotes ---- */
.eco-article blockquote {
    margin: 1.75em 0;
    padding: 0.25em 0 0.25em 1.5rem;
    border-left: 2px solid var(--color-eco-olive);
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(1.3rem, 2vw, 1.6rem);
    line-height: 1.5;
    color: var(--color-eco-forest);
}

.eco-article blockquote.break {
    margin-top: 1em;
}

.eco-article .div-box {
    margin: 2em 0;
    padding: 1.5rem 1.75rem;
    border: 1px solid var(--color-eco-border);
    border-radius: 12px;
    background: var(--color-eco-green-muted);
}

.eco-article .div-box blockquote {
    margin: 0;
    padding: 0;
    border: 0;
}

.eco-article figcaption {
    margin-top: 0.6em;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-eco-ink-soft);
    text-align: left;
}

/* Boxed-quote attributions stay flush right (as before). */
.eco-article .div-box figcaption {
    text-align: right;
}

/* ---- Media ---- */
.eco-article figure {
    margin: 2em 0;
}

.eco-article img {
    border-radius: 12px;
}

.eco-article hr {
    margin: 2.5em auto;
    width: 120px;
    border: 0;
    border-top: 1px solid var(--color-eco-rule);
}

/* ---- In-content media cards (audio / video embeds inside chapters) ----
   On mobile the media stacks inline within the column. On desktop (see the
   grid override below) the .media-side aside floats into the right gutter. */
.eco-article .media-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
    margin: 1.75em 0;
}

.eco-article .media-side {
    display: flex;
    justify-content: center;
}

@media (min-width: 1080px) {
    /* The row spans the full grid and re-inherits the column template so its
       children line up with the prose / media columns. */
    .eco-article .media-row {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: inherit;
        column-gap: inherit;
        align-items: start;
        margin: 18px 0;
    }

    .eco-article .media-row > * {
        grid-column: 2;
    }

    /* The media card aside lives in the right gutter and sticks alongside
       the text as the reader scrolls. */
    .eco-article .media-side {
        grid-column: 3;
        justify-self: center;
        position: sticky;
        top: 120px;
        z-index: 2;
    }
}

.eco-article .media-card {
    --thumb: 120px;
    --caption: 120px;
    --icon: 60px;
    display: inline-block;
    text-decoration: none;
    border: 0;
    border-radius: 12px;
    outline: none;
    transition:
        transform 0.12s ease,
        box-shadow 0.12s ease;
}

.eco-article .media-card:hover {
    box-shadow: 0 10px 26px rgba(42, 47, 32, 0.18);
    animation: eco-media-wiggle 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.eco-article .media-card-items {
    display: flex;
    align-items: stretch;
}

.eco-article .media-card-img {
    width: var(--thumb);
    height: var(--thumb);
    object-fit: cover;
    display: block;
    border-radius: 12px 0 0 12px;
}

.eco-article .media-card-caption {
    width: var(--caption);
    padding: 10px 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    color: #fff;
    border-radius: 0 12px 12px 0;
}

.eco-article .media-card-icon {
    width: var(--icon);
    height: var(--icon);
    border-radius: 999px;
    flex-shrink: 0;
    outline: 1px solid rgba(255, 255, 255, 0.65);
    transition:
        box-shadow 0.18s ease,
        outline-color 0.18s ease;
}

.eco-article .media-card:hover .media-card-icon {
    outline-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.35);
}

.eco-article .media-card-text {
    font-size: 13px;
    line-height: 1.25;
    font-weight: 650;
}

.eco-article .cap-green .media-card-caption {
    background: var(--cap-green);
}
.eco-article .cap-red .media-card-caption {
    background: var(--cap-red);
}
.eco-article .cap-blue .media-card-caption {
    background: var(--cap-blue);
}
.eco-article .cap-yellow .media-card-caption {
    background: var(--cap-yellow);
}
.eco-article .cap-brown .media-card-caption {
    background: var(--cap-brown);
}

/* ---- In-content book covers ---- */
.eco-article .book-covers {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin: 32px auto;
}

.eco-article .book-cover {
    flex: 1 1 0;
    max-width: 290px;
    border: 0;
    transition: transform 0.12s ease;
}

.eco-article .book-cover img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

.eco-article .book-cover:hover {
    animation: eco-media-wiggle 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes eco-media-wiggle {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-0.6deg);
    }
    50% {
        transform: rotate(0.6deg);
    }
    75% {
        transform: rotate(-0.3deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .eco-article .media-card:hover,
    .eco-article .book-cover:hover {
        animation: none;
    }
}

/* ============================================================================
   Chapter prev / next navigation
   ============================================================================ */
.eco-chapter-nav {
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem var(--gutter) 1rem;
}

.eco-chapter-nav__inner {
    border-top: 1px solid var(--color-eco-rule);
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .eco-chapter-nav {
        padding-inline: var(--gutter-lg);
    }
}

/* Desktop: align the nav with the prose text column. */
@media (min-width: 1080px) {
    .eco-chapter-nav {
        max-width: none;
        padding-inline: var(--gutter-lg);
        display: grid;
        grid-template-columns: 1fr minmax(0, var(--eco-read-text)) var(--eco-read-gutter) 1fr;
        column-gap: var(--eco-read-gap);
    }

    .eco-chapter-nav__inner {
        grid-column: 2;
    }
}

.eco-chapter-nav a {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-eco-ink-soft);
    transition: color 0.2s;
    white-space: nowrap;
}

.eco-chapter-nav a:hover {
    color: var(--color-eco-ink);
}

.eco-chapter-nav a.hidden {
    visibility: hidden;
}
