/* ==========================================================================
   The public manifesto reader (.mp-*)
   --------------------------------------------------------------------------
   Approach: identity band -> commitments board -> the document itself.
   A voter should be able to judge the promises in ten seconds and then read any
   one of them in full. There is no sidebar: the board is the navigation, and
   everything is in the HTML, so crawlers see exactly what people see.
   ========================================================================== */

.manifesto-page {
    --mp-ink: #0b1613;
    --mp-ink-soft: #10231c;
    --mp-body: #2f3a35;
    --mp-muted: #64756d;
    --mp-line: rgba(11, 22, 19, 0.1);
    --mp-paper-soft: #f4f7f5;
    --mp-accent: #0f766e;
    --mp-accent-bright: #12b76a;
    --mp-radius: 1rem;

    color: var(--mp-body);
}

/* ---------- reading progress ---------- */
.mp-progress {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 60;
    height: 3px;
    background: rgba(255, 255, 255, 0.12);
    pointer-events: none;
}

.mp-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--mp-accent-bright), #f0b429);
}

.manifesto-preview-banner {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 0.7rem 1rem;
    background: #f0b429;
    color: #3d2c00;
    font-size: 0.84rem;
    font-weight: 800;
    text-align: center;
}

/* ==========================================================================
   1. Identity band
   ========================================================================== */

.mp-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(115% 150% at 100% 0%, #17402f 0%, #0b1613 52%, #060d0b 100%);
    color: #fff;
}

/* A cover image the candidate supplied from their profile. The overlay is not
   decoration: it is what keeps the title readable over a photograph. */
.mp-hero.has-image {
    background-image:
        linear-gradient(180deg,
            rgba(6, 13, 11, 0.72) 0%,
            rgba(6, 13, 11, 0.52) 30%,
            rgba(6, 13, 11, 0.88) 100%),
        var(--mp-hero-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.mp-hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 1px;
    background: linear-gradient(90deg, var(--mp-accent-bright), #f0b429 45%, transparent);
}

.mp-hero-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: clamp(1.25rem, 3.5vw, 2rem) clamp(1rem, 4vw, 2rem) clamp(2rem, 5vw, 3.5rem);
}

.mp-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.75rem;
    font-size: 0.8rem;
}

.mp-breadcrumb a {
    color: rgba(255, 255, 255, 0.62);
    text-decoration: none;
    font-weight: 700;
}

.mp-breadcrumb a:hover {
    color: #fff;
    text-decoration: underline;
}

.mp-breadcrumb span {
    color: rgba(255, 255, 255, 0.3);
}

.mp-breadcrumb [aria-current="page"] {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
}

.mp-kicker {
    margin: 0 0 0.7rem;
    color: var(--mp-accent-bright);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.mp-title {
    margin: 0;
    max-width: 20ch;
    color: #fff;
    font-size: clamp(2.1rem, 5.2vw, 3.6rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.02;
}

.mp-subtitle {
    margin: 1rem 0 0;
    max-width: 54ch;
    color: rgba(255, 255, 255, 0.74);
    font-size: clamp(1.02rem, 1.6vw, 1.2rem);
    line-height: 1.6;
}

.mp-hero-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.mp-author {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.mp-author-photo,
.mp-author-fallback {
    flex: none;
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 999px;
    object-fit: cover;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.16);
}

.mp-author-fallback {
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 800;
}

.mp-author-text {
    min-width: 0;
}

.mp-author-name {
    display: block;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    text-decoration: none;
}

.mp-author-name:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.mp-author-role {
    margin: 0.15rem 0 0;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.86rem;
}

.mp-author-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.mp-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.32rem 0.72rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.73rem;
    font-weight: 700;
}

.mp-share {
    margin-top: 1.75rem;
    padding-top: 1.35rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.mp-share .share-buttons-label {
    color: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   2. The reader: the chapter list, and one chapter at a time
   ========================================================================== */

.mp-reader {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: clamp(1.5rem, 3vw, 3rem);
    align-items: start;
}

.mp-chapters {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow: auto;
    padding: 1rem;
    border: 1px solid var(--mp-line);
    border-radius: var(--mp-radius);
    background: #fff;
}

.mp-chapters-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}

.mp-chapters-head .mp-kicker {
    margin: 0;
    color: var(--mp-muted);
}

.mp-toggle {
    flex: none;
    text-decoration: none;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--mp-line);
    border-radius: 999px;
    background: var(--mp-paper-soft);
    color: var(--mp-ink);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
}

.mp-toggle:hover {
    border-color: rgba(15, 118, 110, 0.4);
    color: var(--mp-accent);
}

.mp-chapter-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 2px;
}

.mp-chapter-link {
    display: flex;
    gap: 0.6rem;
    padding: 0.55rem 0.6rem;
    border-radius: 0.65rem;
    color: var(--mp-body);
    text-decoration: none;
}

.mp-chapter-link:hover {
    background: var(--mp-paper-soft);
}

.mp-chapter-link.is-active {
    background: var(--mp-ink);
    color: #fff;
}

.mp-chapter-num {
    flex: none;
    padding-top: 0.1rem;
    color: var(--mp-muted);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.mp-chapter-link.is-active .mp-chapter-num {
    color: var(--mp-accent-bright);
}

.mp-chapter-text {
    min-width: 0;
}

.mp-chapter-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.3;
}

.mp-chapter-hint {
    display: block;
    margin-top: 0.2rem;
    color: var(--mp-muted);
    font-size: 0.74rem;
    font-weight: 500;
    line-height: 1.45;
}

.mp-chapter-link.is-active .mp-chapter-hint {
    color: rgba(255, 255, 255, 0.62);
}

.mp-stage {
    min-width: 0;
}

/* The stage can be very wide now; the text inside keeps a readable measure and
   the chapter controls line up with it. */
.mp-stage-inner {
    max-width: 80ch;
}

/* Only shown once the script has taken over: without JavaScript every chapter
   is simply visible, which is also what a crawler should see. */
.mp-stage-bar {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-top: 2.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--mp-line);
}

.mp-reader[data-enhanced] .mp-stage-bar,
.mp-stage-bar.is-static {
    display: flex;
}

.mp-stage-nav {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--mp-line);
    border-radius: 999px;
    background: #fff;
    color: var(--mp-ink);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
}

.mp-stage-nav:hover:not(:disabled) {
    border-color: rgba(15, 118, 110, 0.4);
    color: var(--mp-accent);
}

.mp-stage-nav:disabled {
    opacity: 0.4;
    cursor: default;
}

.mp-stage-count {
    color: var(--mp-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.mp-document .manifesto-chapter.is-hidden {
    display: none;
}

.mp-stage-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1rem 0 0;
}

.mp-stage-all {
    color: var(--mp-accent);
    font-size: 0.86rem;
    font-weight: 800;
    text-decoration: none;
}

.mp-stage-all:hover {
    text-decoration: underline;
}

/* ==========================================================================
   3. The document
   ========================================================================== */

.mp-doc-wrap {
    /* The rail takes its own column, so the shell is free to use the whole page
       rather than sitting in a narrow strip down the middle. Matches .mp-hero-inner
       and the .page-container it sits in. */
    max-width: 1440px;
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2rem) 5rem;
}

.mp-summary {
    margin-bottom: 2.5rem;
    padding: 1.1rem 1.25rem;
    background: var(--mp-paper-soft);
    border-radius: var(--mp-radius);
}

.mp-summary .mp-kicker {
    color: var(--mp-accent);
}

.mp-summary p:last-child {
    max-width: 80ch;
    margin: 0;
    color: var(--mp-body);
    font-size: 1.02rem;
    line-height: 1.7;
}

.mp-reading-inner,
.mp-document {
    min-width: 0;
}

.mp-empty {
    padding: 3rem 1.5rem;
    border: 1px dashed var(--mp-line);
    border-radius: var(--mp-radius);
    background: var(--mp-paper-soft);
    text-align: center;
}

.mp-empty-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.mp-empty h2 {
    margin: 0 0 0.5rem;
    color: var(--mp-ink);
    font-size: 1.3rem;
}

.mp-empty p {
    max-width: 34rem;
    margin: 0 auto 1.25rem;
    color: var(--mp-muted);
    line-height: 1.65;
}

/* ==========================================================================
   4. Author, related
   ========================================================================== */

.mp-end-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 3rem;
    padding: clamp(1.25rem, 3vw, 1.75rem);
    border: 1px solid var(--mp-line);
    border-radius: var(--mp-radius);
    background: var(--mp-ink);
    color: #fff;
}

.mp-end-card .mp-kicker {
    color: var(--mp-accent-bright);
}

.mp-end-card h2 {
    margin: 0;
    color: #fff;
    font-size: 1.4rem;
    letter-spacing: -0.03em;
}

.mp-end-card p {
    margin: 0.4rem 0 0;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
}

.mp-end-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* The share row lives here now, at the end of the document, rather than at the
   top where it competed with the title. */
.mp-end-card .mp-share {
    margin: 0;
    padding: 0;
    border: 0;
}

.mp-end-actions .button {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: none;
}

.mp-end-actions .button:hover {
    background: rgba(255, 255, 255, 0.18);
}

.mp-end-actions .button-secondary {
    background: #fff;
    color: var(--mp-ink);
    border-color: #fff;
}

.mp-related {
    margin-top: 3.5rem;
}

.mp-related .mp-kicker {
    color: var(--mp-accent);
}

.mp-related-heading h2 {
    margin: 0;
    color: var(--mp-ink);
    font-size: 1.4rem;
    letter-spacing: -0.03em;
}

.mp-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.85rem;
    margin-top: 1.25rem;
}

.mp-related-card {
    display: block;
    padding: 1.1rem;
    border: 1px solid var(--mp-line);
    border-radius: var(--mp-radius);
    background: #fff;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mp-related-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.9rem 1.75rem rgba(11, 22, 19, 0.08);
}

.mp-related-card h3 {
    margin: 0;
    color: var(--mp-ink);
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.mp-related-card p {
    margin: 0.5rem 0 0.75rem;
    color: var(--mp-muted);
    font-size: 0.86rem;
    line-height: 1.6;
}

.mp-related-card span {
    color: var(--mp-accent);
    font-size: 0.8rem;
    font-weight: 800;
}

/* ==========================================================================
   5. Responsive + print
   ========================================================================== */

/* Nothing drawer-shaped on a wide screen: the list is already beside the text. */
.mp-drawer-open,
.mp-drawer-close,
.mp-drawer-scrim {
    display: none;
}

@media (max-width: 1024px) {
    .mp-reader {
        grid-template-columns: minmax(0, 1fr);
    }

    /* The chapter list becomes a drawer: off-screen until asked for, then over the
       page from the left, where a thumb already rests. */
    .mp-chapters {
        position: fixed;
        z-index: 80;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(86vw, 360px);
        max-height: none;
        border: 0;
        border-right: 1px solid var(--mp-line);
        border-radius: 0;
        box-shadow: 0 24px 60px rgba(6, 20, 16, 0.28);
        padding: 1.1rem 1rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
        transform: translateX(-101%);
        transition: transform 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
        visibility: hidden;
    }

    .mp-chapters.is-open {
        transform: translateX(0);
        visibility: visible;
    }

    .mp-chapter-hint {
        display: none;
    }

    .mp-drawer-scrim {
        position: fixed;
        inset: 0;
        z-index: 70;
        display: block;
        background: rgba(9, 20, 16, 0.45);
        backdrop-filter: blur(1px);
    }

    .mp-drawer-scrim[hidden] {
        display: none;
    }

    .mp-drawer-open {
        display: inline-flex;
    }
}

.mp-drawer-open {
    align-items: center;
    gap: 0.4rem;
    margin-right: auto;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--mp-line);
    border-radius: 999px;
    background: #fff;
    color: var(--mp-ink);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.mp-drawer-open-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.mp-drawer-close {
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--mp-line);
    border-radius: 999px;
    background: var(--mp-paper-soft);
    color: var(--mp-ink);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 1024px) {
    .mp-drawer-close {
        display: inline-flex;
    }
}

/* The page behind the drawer does not scroll under it. */
body.mp-drawer-locked {
    overflow: hidden;
}

@media (max-width: 720px) {
    .mp-hero-foot {
        align-items: flex-start;
        flex-direction: column;
    }

    .mp-title {
        max-width: none;
    }

    .mp-end-actions,
    .mp-end-actions .button {
        width: 100%;
    }
}

@media print {
    .mp-progress,
    .mp-share,
    .mp-related,
    .mp-chapters,
    .mp-stage-bar,
    .mp-stage-foot,
    .site-header,
    .site-footer {
        display: none !important;
    }

    /* Paper gets the whole manifesto, not whichever chapter is on screen. */
    .mp-document .manifesto-chapter.is-hidden {
        display: block !important;
    }

    .mp-hero {
        background: none;
        color: #000;
    }

    .mp-title,
    .mp-author-name,
    .mp-end-card h2 {
        color: #000;
    }

    .mp-subtitle,
    .mp-author-role,
    .mp-chip,
    .mp-end-card p {
        color: #333;
    }

    .manifesto-chapter {
        break-inside: avoid;
    }
}

/* -------------------------------------------------------- chapter drawer bar */

.mp-drawer-bar {
    display: none;
}

@media (max-width: 1024px) {
    .mp-drawer-bar {
        display: block;
        margin: 0 0 0.75rem;
    }

    /* Sticky, because a reader three screens into a chapter should still be able to
       change chapters without scrolling back to the top. */
    .mp-drawer-bar {
        position: sticky;
        top: 0;
        z-index: 30;
        padding: 0.5rem 0;
        background: linear-gradient(to bottom, var(--mp-paper) 72%, rgba(255, 255, 255, 0));
    }

    .mp-drawer-open {
        width: 100%;
        justify-content: flex-start;
        margin: 0;
        padding: 0.6rem 0.9rem;
        font-size: 0.82rem;
    }

    .mp-drawer-current {
        margin-left: auto;
        max-width: 46%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: var(--mp-muted);
        font-weight: 700;
    }
}


/* --------------------------------------------------------- share panel */

.mp-stage-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--mp-line);
    border-radius: 999px;
    background: #fff;
    color: var(--mp-ink);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.mp-stage-icon:hover {
    border-color: rgba(15, 118, 110, 0.45);
    color: var(--mp-accent);
}

/* The previous/next controls: a chevron each, so the row reads as one unit. */
.mp-stage-nav.is-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--mp-line);
    border-radius: 999px;
    background: #fff;
    color: var(--mp-ink);
}

.mp-stage-nav.is-icon:hover {
    border-color: rgba(15, 118, 110, 0.45);
    color: var(--mp-accent);
}

.mp-stage-nav.is-icon.is-disabled,
.mp-stage-nav.is-icon:disabled {
    opacity: 0.35;
    cursor: default;
}

.mp-stage-count strong {
    font-size: 1.02em;
}

/* The panel itself, matching the comments drawer on the right. */
.mp-share-panel {
    position: fixed;
    z-index: 90;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(92vw, 420px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-left: 1px solid var(--mp-line);
    box-shadow: -18px 0 60px rgba(6, 20, 16, 0.22);
    transform: translateX(102%);
    transition: transform 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
    visibility: hidden;
}

.mp-share-panel.is-open {
    transform: translateX(0);
    visibility: visible;
}

.mp-share-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--mp-line);
}

.mp-share-panel-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
}

.mp-share-panel-body {
    padding: 1.1rem;
    overflow-y: auto;
}

.mp-share-panel-body .share-buttons {
    display: grid;
    gap: 0.5rem;
}

.mp-share-panel-body .share-buttons-label {
    display: none;
}

.mp-share-panel-body .share-btn {
    display: block;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--mp-line);
    border-radius: 12px;
    background: #fff;
    color: var(--mp-ink);
    font-size: 0.9rem;
    font-weight: 700;
    text-align: left;
    text-decoration: none;
}

.mp-share-panel-body .share-btn:hover {
    border-color: rgba(15, 118, 110, 0.45);
    color: var(--mp-accent);
}

.mp-share-panel-note {
    margin: 1rem 0 0;
    color: var(--mp-muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.mp-share-scrim {
    position: fixed;
    inset: 0;
    z-index: 85;
    background: rgba(9, 20, 16, 0.42);
}

.mp-share-scrim[hidden] {
    display: none;
}

body.mp-panel-open {
    overflow: hidden;
}
