/* =========================================================================
   BUAI EDGE - article page
   Editorial layout (two-column hero, sticky reading rail, author strip,
   related band) rendered in BUAI's own identity: black / cream / line
   greys, Inter throughout, pill buttons and the accent rule used across
   the rest of the site. No external fonts - main.css already defines the
   palette tokens this file reuses.
   ========================================================================= */

/* ---------- tokens ---------- */
/* Mirrored onto <body> as well: the "more perspectives" band and the CTA are
   SIBLINGS of the article, not children, so they must still resolve these. */
body:has(.perspective-page),
.perspective-page {
    --pp-bg-hero: var(--cream, #f6f5ef);
    --pp-bg-body: #ffffff;
    --pp-ink: var(--black, #090909);
    --pp-ink-strong: #090909;
    --pp-body: #2a2a28;
    --pp-muted: var(--muted, #71736d);
    --pp-rule: var(--line, #dedfd6);
    --pp-font: 'Inter', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

/* works whether or not the page is wrapped in a container */
.perspective-page {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    background: var(--pp-bg-body);
    color: var(--pp-body);
    font-family: var(--pp-font);
    -webkit-font-smoothing: antialiased;
}

/* the old fixed-width article shell must not constrain the new layout */
.perspective-page.article-page {
    max-width: none;
    padding: 0;
    margin: 0;
}

/* =========================================================================
   HERO
   ========================================================================= */
.perspective-hero {
    width: 100%;
    min-height: 495px;
    padding: 100px 6.7% 30px;
    display: grid;
    grid-template-columns: 48% 52%;
    align-items: stretch;
    background: var(--pp-bg-hero);
    border-bottom: 1px solid var(--pp-rule);
    box-sizing: border-box;
}

.perspective-hero .hero-left {
    padding: 36px 45px 25px 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.perspective-hero .article-category {
    margin-bottom: 18px;
    font-family: var(--pp-font);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--pp-muted);
}

.perspective-hero .hero-left h1 {
    margin: 0;
    max-width: 680px;
    font-family: var(--pp-font);
    font-size: clamp(34px, 4.2vw, 60px);
    font-weight: 800;
    line-height: 1.03;
    letter-spacing: -2px;
    color: var(--pp-ink);
    overflow-wrap: anywhere;
}

.perspective-hero .hero-description {
    max-width: 560px;
    margin: 27px 0 25px;
    font-family: var(--pp-font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--pp-body);
}

.perspective-hero .article-meta {
    display: block;
    margin-top: auto;
    font-family: var(--pp-font);
    font-size: 13px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--pp-ink);
}

.perspective-hero .article-meta strong {
    font-weight: 600;
    color: var(--pp-ink-strong);
}

.perspective-hero .meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 70px;
    margin-top: 5px;
    line-height: 1.45;
}

.perspective-hero .shared-from {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 25px;
    font-family: var(--pp-font);
    font-size: 13px;
    color: var(--pp-ink);
}

.perspective-hero .shared-from .oftnly-logo {
    font-family: var(--pp-font);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -1px;
    text-transform: none;
}

.perspective-hero .shared-from .feather {
    font-size: 20px;
    opacity: .75;
}

/* image side */
.perspective-hero .hero-right {
    padding-left: 5px;
    overflow: hidden;
    min-width: 0;
}

.perspective-hero .article-banner {
    position: relative;
    margin: 0;
    /* the same 16:10 frame as the insight cards — every article hero is
       identical whether the uploaded image is portrait, square or wide */
    aspect-ratio: 16 / 10;
    height: auto;
    max-height: 460px;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--pp-rule);
    background: #fff;
}

.perspective-hero .article-banner img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    max-height: none;
}

/* shown when the article has no banner - keeps the grid balanced */
.perspective-hero .hero-abstract {
    aspect-ratio: 16 / 10;
    height: auto;
    max-height: 460px;
    display: grid;
    place-items: center;
    border: 1px solid var(--pp-rule);
    border-radius: 16px;
    background: #fff;
}

.perspective-hero .hero-abstract span {
    font-family: var(--pp-font);
    font-size: clamp(20px, 2.2vw, 30px);
    font-weight: 800;
    letter-spacing: .18em;
    color: #d9dad2;
}

/* =========================================================================
   BODY - sticky rail + content
   ========================================================================= */
/* =========================================================================
   BODY - sticky rail + content
   ========================================================================= */
.article-section {
    width: 100%;
    display: grid;
    /* rail 190px, then the measure fills the remaining width */
    grid-template-columns: 190px minmax(0, 1fr);
    column-gap: 40px;
    padding: 52px 6.7%;
    background: var(--pp-bg-body);
    box-sizing: border-box;
    align-items: start;
}

.article-sidebar {
    position: sticky;
    top: 50px;
    align-self: start;
    height: fit-content;
    max-height: calc(100vh - 60px);
    padding-top: 0;
    border-right: 1px solid var(--pp-rule);
    padding-right: 24px;
}

.article-sidebar .sidebar-inner {
    width: 100%;
}

.reading-progress {
    font-family: var(--pp-font);
    font-size: 12px;
    color: #555;
}

.progress-line {
    position: relative;
    width: 2px;
    height: min(58vh, 480px);
    margin: 12px 0 0 2px;
    background: var(--pp-rule);
    border-radius: 2px;
}

/* the fill grows from the top of the rail */
.article-section .progress-filled {
    position: absolute;
    inset: 0 auto auto 0;
    display: block;
    width: 100%;
    height: 0%;
    background: var(--pp-ink);
    border-radius: 2px;
    transition: height .12s linear;
}

/* progress is a plain rule now - the percentage readout was removed */
.progress-line .progress-pct { display: none !important; }

/* ---------- share dropdown ---------- */
.share-menu {
    position: relative;
    margin-top: 24px;
}

.share-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid var(--pp-ink);
    border-radius: 999px;
    background: var(--pp-ink);
    color: #fff;
    font-family: var(--pp-font);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.share-toggle:hover,
.share-toggle[aria-expanded="true"] {
    background: transparent;
    color: var(--pp-ink);
}

.share-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 40;
    min-width: 196px;
    padding: 6px;
    border: 1px solid var(--pp-rule);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(9, 9, 9, .16);
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.share-panel[hidden] { display: none !important; }

.share-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 11px;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--pp-ink);
    font-family: var(--pp-font);
    font-size: 12.5px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background .14s ease;
}

.share-item:hover,
.share-item:focus-visible {
    background: var(--pp-bg-hero);
    outline: none;
}

.share-item-ico {
    display: grid;
    place-items: center;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--pp-bg-hero);
    font-size: 11px;
    color: var(--pp-ink);
}

.share-feedback {
    display: block;
    padding: 4px 11px 2px;
    font-family: var(--pp-font);
    font-size: 11px;
    color: #2e6b40;
    min-height: 1em;
}

.article-actions {
    display: flex;
    flex-direction: column;
    margin-top: 22px;
    gap: 7px;
}

.article-actions button,
.article-actions a {
    padding: 0;
    border: none;
    background: none;
    text-align: left;
    text-decoration: none;
    font-family: var(--pp-font);
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: color .2s ease;
}

.article-actions button:hover,
.article-actions a:hover {
    color: var(--pp-ink-strong);
}

.article-actions span {
    margin-right: 5px;
}

.article-actions .share-feedback {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #2e6b40;
    min-height: 1em;
}

/* ---------- content typography ---------- */
.article-content {
    max-width: 1050px;
    width: 100%;
    padding: 0 0 55px;
    min-width: 0;
}

.article-content p {
    margin: 0 0 18px;
    font-family: var(--pp-font);
    font-size: 16.5px;
    line-height: 1.75;
    color: var(--pp-body);
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
    margin: 40px 0 14px;
    font-family: var(--pp-font);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1px;
    color: var(--pp-ink);
}

.article-content h1 { font-size: 34px; }
.article-content h2 { font-size: 27px; }
.article-content h3 { font-size: 21px; }
.article-content h4 { font-size: 17px; }

.article-content ul,
.article-content ol {
    margin: 0 0 22px;
    padding-left: 22px;
    font-family: var(--pp-font);
    font-size: 16.5px;
    line-height: 1.75;
    color: var(--pp-body);
}

.article-content li {
    margin-bottom: 10px;
}

.article-content a:not(.perspective-button) {
    color: var(--pp-ink);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-content a:hover {
    opacity: .6;
}

.article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 26px 0;
}

.article-content hr {
    border: 0;
    border-top: 1px solid var(--pp-rule);
    margin: 34px 0;
}

/* drop cap opening */
.opening-paragraph {
    position: relative;
}

.opening-paragraph .drop-cap {
    float: left;
    /* no negative top margin: it pulled the cap up into the heading above */
    margin: 2px 10px 0 0;
    font-family: var(--pp-font);
    font-size: 58px;
    font-weight: 800;
    line-height: .82;
    letter-spacing: -2px;
    color: var(--pp-ink);
}

/* pull quote */
.article-content blockquote {
    max-width: 900px;
    margin: 36px 0;
    padding: 0 0 0 22px;
    border-left: 3px solid var(--pp-ink);
    text-align: left;
    font-family: var(--pp-font);
    font-size: clamp(18px, 2vw, 23px);
    font-weight: 600;
    font-style: normal;
    line-height: 1.45;
    letter-spacing: -.3px;
    color: var(--pp-ink);
}

.article-content blockquote p {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

/* ---------- sources ---------- */
.article-sources {
    margin-top: 44px;
    padding: 22px 26px;
    background: #eeece7;
    border-radius: 4px;
}

.article-sources h3 {
    margin: 0 0 12px;
    font-family: var(--pp-font);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--pp-muted);
}

.article-sources ol {
    margin: 0;
    padding-left: 20px;
}

.article-sources li {
    margin-bottom: 8px;
    font-size: 12px;
    word-break: break-word;
}

.article-sources a {
    color: #1a73e8;
    text-decoration: underline;
    font-size: inherit;
}

/* ---------- author strip ---------- */
.author-section {
    width: 100%;
    margin-top: 60px;
    padding: 25px 0;
    border-top: 1px solid #aaa;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.author-image {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 64px;
    background: var(--pp-bg-hero);
}

.author-info h3 {
    margin: 0 0 2px;
    font-family: var(--pp-font);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.3px;
    color: var(--pp-ink);
}

.author-info span {
    display: block;
    font-family: var(--pp-font);
    font-size: 12px;
    color: var(--pp-muted);
}

.author-info p {
    max-width: 350px;
    margin: 3px 0 0;
    font-family: var(--pp-font);
    font-size: 12px;
    line-height: 1.5;
    color: var(--pp-body);
}

.perspective-button {
    padding: 11px 22px;
    border: 1px solid var(--pp-ink);
    border-radius: 999px;
    background: var(--pp-ink);
    color: #fff;
    font-family: var(--pp-font);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}

.perspective-button:hover {
    background: transparent;
    color: var(--pp-ink);
    transform: translateY(-1px);
}

/* =========================================================================
   MORE PERSPECTIVES
   ========================================================================= */
/* fall back to literal colours too, so the band is never unstyled */
.more-perspectives {
    padding: 64px 6.7% 72px;
    background: #fff;
    border-top: 1px solid var(--pp-rule, #dedfd6);
    color: var(--pp-ink, #090909);
}

.more-heading {
    display: grid;
    grid-template-columns: 2fr 1fr;
    align-items: end;
    gap: 50px;
    margin-bottom: 30px;
}

.more-heading .section-label {
    display: block;
    margin-bottom: 14px;
    font-family: var(--pp-font);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--pp-muted, #71736d);
}

.more-heading h2 {
    margin: 0;
    font-family: var(--pp-font);
    font-size: clamp(26px, 3vw, 38px);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -1.5px;
    color: var(--pp-ink, #090909);
}

.more-heading p {
    margin: 0;
    font-family: var(--pp-font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--pp-muted, #71736d);
}

/* =========================================================================
   INSIGHT MARQUEE - continuously scrolling article cards
   The track holds the set twice; animating it by exactly -50% loops with no
   visible seam. It pauses on hover/focus so cards stay clickable, and when
   the section is off-screen (class toggled in JS).
   ========================================================================= */
.insight-marquee {
    position: relative;
    overflow: hidden;
    /* bleed to the section edges so cards slide in from off-screen */
    margin-inline: -6.7%;
    padding-block: 4px;
    /* fade the edges instead of hard-cutting the cards */
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%);
}

.insight-track {
    display: flex;
    gap: 28px;
    width: max-content;
    /* NB: no padding-inline here. Padding is included in the 50% translate,
       which made the loop jump by the padding amount (measured 70px). The
       marquee's own padding provides the edge inset instead. */
    animation: insight-drift 60s linear infinite;
    will-change: transform;
}

/* IMPORTANT: the drift distance is ONE SET PITCH, not 50% of the track.
   With a gap between items, half the track = setWidth + gap/2, which is
   7px short of the true pitch — that 7px showed up as a visible jump.
   --set-pitch is computed in JS (offsetLeft of the duplicate's first card)
   and falls back to -50% before JS runs. */
@keyframes insight-drift {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(calc(-1 * var(--set-pitch, 50%)), 0, 0); }
}

.insight-marquee:hover .insight-track,
.insight-marquee:focus-within .insight-track,
.insight-marquee.is-paused .insight-track {
    animation-play-state: paused;
}

/* ---------- card: mirrors the Insight index card ---------- */
.insight-card {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    width: 320px;
    min-width: 0;
}

.insight-card .insight-thumb {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--pp-rule, #dedfd6);
    background: var(--pp-bg-hero, #f6f5ef);
    margin-bottom: 16px;
}

.insight-card .insight-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s ease;
}

.insight-card:hover .insight-thumb img {
    transform: scale(1.04);
}

.insight-card small {
    font-family: var(--pp-font);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--pp-muted, #71736d);
    margin-bottom: 8px;
}

.insight-card h2 {
    margin: 0 0 8px;
    font-family: var(--pp-font);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.6px;
    color: var(--pp-ink, #090909);
}

.insight-card h2 a {
    color: inherit;
    text-decoration: none;
}

.insight-card h2 a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.insight-card p {
    margin: 0 0 14px;
    font-family: var(--pp-font);
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--pp-muted, #71736d);
    /* reserve two lines so every card foots to the same baseline */
    min-height: 2.2em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.insight-card > a:last-child {
    margin-top: auto;
    align-self: flex-start;
    font-family: var(--pp-font);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--pp-ink, #090909);
    text-decoration: none;
    border-bottom: 1.5px solid currentColor;
    padding-bottom: 2px;
}

.insight-card > a:last-child:hover {
    opacity: .65;
}

/* no motion: show the set as a normal horizontal scroll instead */
@media (prefers-reduced-motion: reduce) {
    .insight-track {
        animation: none !important;
        overflow-x: auto;
        width: auto;
        scroll-snap-type: x mandatory;
    }
    .insight-card { scroll-snap-align: start; }
    .insight-card:hover .insight-thumb img { transform: none; }
}

@media (max-width: 820px) {
    .insight-marquee { margin-inline: -6%; }
    .insight-card { width: 264px; }
    .insight-track { gap: 18px; animation-duration: 45s; }
}


/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1100px) {
    .perspective-hero {
        padding: 90px 5% 26px;
        grid-template-columns: 50% 50%;
    }

    .perspective-hero .hero-left {
        padding-right: 28px;
    }

    .perspective-hero .meta-row {
        gap: 34px;
    }

    .article-section {
        padding: 56px 5%;
        grid-template-columns: 150px minmax(0, 1fr);
    }

    .perspectives-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {

    /* stack the hero: text first, image under it */
    .perspective-hero {
        grid-template-columns: 1fr;
        min-height: 0;
        padding: 96px 6% 28px;
        gap: 26px;
    }

    .perspective-hero .hero-left {
        padding: 0;
    }

    .perspective-hero .hero-left h1 {
        font-size: clamp(34px, 8vw, 52px);
        letter-spacing: -1px;
    }

    .perspective-hero .hero-description {
        margin: 18px 0;
        font-size: 15px;
    }

    .perspective-hero .article-meta {
        margin-top: 8px;
    }

    .perspective-hero .meta-row {
        gap: 26px;
    }

    .perspective-hero .hero-right {
        padding-left: 0;
    }

    .perspective-hero .article-banner,
    .perspective-hero .hero-abstract {
        height: auto;
        max-height: 300px;
    }

    .perspective-hero .article-banner img {
        height: 100%;
    }

    /* drop the sticky rail; the top bar carries progress on phones */
    .article-section {
        grid-template-columns: 1fr;
        padding: 40px 6% 44px;
    }

    .article-sidebar {
        display: none;
    }

    .article-content {
        max-width: none;
    }

    .article-content p,
    .article-content ul,
    .article-content ol {
        font-size: 15.5px;
    }

    .article-content h2 {
        font-size: 28px;
    }

    .article-content h3 {
        font-size: 24px;
    }

    .author-section {
        margin-top: 44px;
        padding: 22px 0;
    }

    .author-image {
        width: 62px;
        height: 62px;
        flex-basis: 62px;
    }

    .author-info h3 {
        font-size: 24px;
    }

    .author-info {
        gap: 14px;
    }

    .more-heading {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .more-perspectives {
        padding: 44px 6% 52px;
    }

    .perspectives-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .opening-paragraph .drop-cap {
        font-size: 76px;
    }
}

@media (max-width: 480px) {
    .perspective-hero {
        padding-top: 84px;
    }

    .perspective-hero .meta-row {
        gap: 18px;
        font-size: 12px;
    }

    .perspective-hero .article-banner,
    .perspective-hero .hero-abstract {
        height: auto;
        max-height: 220px;
    }

    .perspective-hero .article-banner img {
        height: 100%;
    }

    .article-content h2 {
        font-size: 25px;
    }

    .author-info p {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    .perspective-card-media img,
    .progress-filled,
    .progress-line .progress-pct,
    .perspective-button {
        transition: none !important;
    }

    .perspective-card:hover .perspective-card-media img {
        transform: none;
    }
}
