/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
    --navy-ink: #1b2a4a;
    --navy-void: #0e1626;
    --navy-void-2: #131d33;
    --gold: #c9a227;
    --gold-bright: #e4c25a;
    --cream: #f6f1e4;
    --cream-2: #efe7d3;
    --slate: #5b6478;
    --ink-on-cream: #23283a;

    --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
    --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas,
        monospace;

    --nav-w: 320px;
    --nav-w-collapsed: 56px;

    --ease: cubic-bezier(0.22, 0.8, 0.32, 1);
}

/* ==========================================================================
   Reset & base
   ========================================================================== */
* {
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

html {
    font-size: 112.5%;
}
@media (max-width: 520px) {
    html {
        font-size: 100%;
    }
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--ink-on-cream);
    font-family: var(--font-body);
    font-size: 1.2rem;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

.section--paper {
    background-color: var(--cream);
    background-image: radial-gradient(
        rgba(27, 42, 74, 0.05) 1px,
        transparent 1px
    );
    background-size: 3px 3px;
}

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

a {
    color: inherit;
}

::selection {
    background: var(--gold);
    color: var(--navy-void);
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    margin: 0;
}

/* ==========================================================================
   Layout scaffolding
   ========================================================================== */
main {
    margin-left: var(--nav-w);
}
.hero {
    margin-left: var(--nav-w);
}
.site-footer {
    margin-left: var(--nav-w);
}

@media (max-width: 960px) {
    main,
    .hero,
    .site-footer {
        margin-left: 0;
    }
}

.section__inner {
    max-width: 85%;
    margin: 0 auto;
    padding: 3rem 1.75rem;
}

.section__inner--split {
    max-width: 980px;
    display: grid;
    grid-template-columns: 1fr 0.85fr;
    gap: 3.5rem;
    align-items: start;
}
.section__inner--split .section__figure {
    position: sticky;
    top: 3rem;
    margin: 0.5rem 0 0;
}
@media (max-width: 760px) {
    .section__inner--split {
        grid-template-columns: 1fr;
    }
}

.section--paper {
    background: var(--cream);
}
.section--dark {
    background: var(--navy-void);
    color: var(--cream);
}
.section--projection {
    background: linear-gradient(
        180deg,
        var(--navy-void-2),
        var(--navy-void) 60%
    );
    color: var(--cream);
    border-top: 1px solid rgba(201, 162, 39, 0.25);
    border-bottom: 1px solid rgba(201, 162, 39, 0.25);
}

/* ==========================================================================
   Type — eyebrows, leads, prose
   ========================================================================== */
.eyebrow,
.section__eyebrow {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold);
    margin: 0 0 1.3rem;
    display: flex;
    align-items: baseline;
    gap: 0.65em;
}
.section__eyebrow--light {
    color: var(--gold-bright);
}

.section__num {
    font-family: var(--font-mono);
    color: var(--slate);
    font-size: 0.85rem;
}

.prose {
    max-width: 100%;
    font-size: 1.15rem;
}
.prose p {
    margin: 0 0 1.3em;
    text-align: justify;
}
.prose p:last-child {
    margin-bottom: 0;
}
.prose + .prose {
    margin-top: 1.3em;
}
.prose--light {
    color: rgba(246, 241, 228, 0.9);
}

.prose--dropcap > p:first-child::first-letter {
    font-family: var(--font-display);
    font-size: 4.6rem;
    font-weight: 600;
    line-height: 0.78;
    float: left;
    padding: 0.1em 0.1em 0 0;
    color: var(--gold);
}
.section--dark .prose--dropcap > p:first-child::first-letter {
    color: var(--gold-bright);
}

.section__figure {
    margin: 1.25rem 0;
}
.section__figure img {
    border-radius: 10px;
    box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.35);
}
.section__figure--full {
    max-width: 860px;
}
.section__figure--full img {
    margin: 0 auto;
}
.section__figure--square img {
    max-width: 480px;
    margin: 0 auto;
}

/* ==========================================================================
   Pull quotes
   ========================================================================== */
.pull-quote {
    margin: 1.5rem auto;
    max-width: 100%;
    text-align: center;
    padding: 0.5rem 1rem;
    border-top: 1px solid rgba(201, 162, 39, 0.4);
    border-bottom: 1px solid rgba(201, 162, 39, 0.4);
}
.pull-quote p {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 440;
    font-size: 1.25rem;
    line-height: 1.35;
    color: var(--gold-bright);
    margin: 0;
}
.section--paper .pull-quote p {
    color: var(--navy-ink);
}
.pull-quote--closing {
    max-width: 52ch;
}

/* ==========================================================================
   Step list (RVCC-For stages)
   ========================================================================== */
.step-list {
    list-style: none;
    counter-reset: step;
    margin: 2.5rem 0;
    padding: 0;
    display: grid;
    gap: 1.1rem;
}
.step-list li {
    counter-increment: step;
    position: relative;
    padding: 1.5rem 1.6rem 1.5rem 4.2rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    border-left: 3px solid var(--gold);
    font-size: 1.12rem;
}
.step-list li::before {
    content: counter(step);
    font-family: var(--font-mono);
    position: absolute;
    left: 1.4rem;
    top: 1.55rem;
    color: var(--gold);
    font-size: 1.05rem;
    font-weight: 500;
}
.step-list--projection li {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(246, 241, 228, 0.9);
}
.step-list li strong {
    color: var(--navy-ink);
    font-family: var(--font-display);
    font-weight: 600;
}
.step-list--projection li strong {
    color: var(--gold-bright);
}

/* ==========================================================================
   Callout (achado)
   ========================================================================== */
.callout {
    margin: 2.5rem 0;
    padding: 1.6rem 1.8rem;
    background: rgba(201, 162, 39, 0.08);
    border: 1px solid rgba(201, 162, 39, 0.35);
    border-radius: 10px;
    max-width: 66ch;
}
.callout__label {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold-bright);
    margin: 0 0 0.6em;
}
.callout p:last-child {
    margin: 0;
    color: rgba(246, 241, 228, 0.92);
    font-size: 1.15rem;
}

/* ==========================================================================
   Accordion (módulos)
   ========================================================================== */
.accordion {
    margin-top: 3rem;
    border-top: 1px solid rgba(27, 42, 74, 0.15);
}

.accordion__item {
    border-bottom: 1px solid rgba(27, 42, 74, 0.15);
}

.accordion__header {
    margin: 0;
}

.accordion__trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
}

.accordion__code {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 500;
    color: var(--gold);
    min-width: 2.8em;
}

.accordion__title {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 500;
    color: var(--navy-ink);
    flex: 1;
    line-height: 1.25;
}

.accordion__chevron {
    width: 11px;
    height: 11px;
    border-right: 1.6px solid var(--navy-ink);
    border-bottom: 1.6px solid var(--navy-ink);
    transform: rotate(45deg);
    transition: transform 0.35s var(--ease);
    flex-shrink: 0;
}
.accordion__item.is-open .accordion__chevron {
    transform: rotate(-135deg);
}

.accordion__panel {
    overflow: hidden;
    padding: 0 0.25rem 2rem;
    max-width: 100%;
    font-size: 1.12rem;
    text-align: justify;
}

.activity-list {
    list-style: none;
    margin: 1.6rem 0 0;
    padding: 0;
    display: grid;
    gap: 1.3rem;
}
.activity-list li {
    padding-left: 1.2rem;
    border-left: 2px solid var(--cream-2);
}
.activity-list__tag {
    display: block;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--navy-ink);
    margin-bottom: 0.35em;
}

.activity-list__ref {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.9rem;
    margin-top: 0.7rem;
    padding: 0.5rem 0.8rem;
    background: rgba(201, 162, 39, 0.08);
    border: 1px solid rgba(201, 162, 39, 0.25);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--slate);
}
.activity-list__ref a {
    color: var(--navy-ink);
    text-decoration-color: var(--gold);
    text-underline-offset: 3px;
}
.activity-list__ref a:hover {
    color: var(--gold);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy-void);
    overflow: hidden;
}

#thread-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.hero__scrim {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at 50% 40%,
        rgba(14, 22, 38, 0.15) 0%,
        rgba(14, 22, 38, 0.75) 72%,
        rgba(14, 22, 38, 0.95) 100%
    );
    pointer-events: none;
}

.hero__content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
    max-width: 46rem;
}

.hero .eyebrow {
    justify-content: center;
}

.hero__title {
    color: var(--cream);
    font-size: clamp(3.75rem, 11vw, 8rem);
    font-weight: 340;
    line-height: 0.98;
    letter-spacing: -0.01em;
}
.hero__title em {
    font-style: italic;
    font-weight: 460;
    color: var(--gold-bright);
}

.hero__subtitle {
    font-family: var(--font-body);
    font-size: clamp(1.15rem, 2.4vw, 1.5rem);
    color: rgba(246, 241, 228, 0.8);
    margin: 2rem 0 2.75rem;
    line-height: 1.6;
}

.hero__byline {
    display: grid;
    gap: 0.55rem;
}
.hero__name {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.4rem;
    color: var(--gold);
}
.hero__meta {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    color: rgba(246, 241, 228, 0.55);
}

.hero__scroll-cue {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: rgba(246, 241, 228, 0.6);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    animation: bob 2.6s ease-in-out infinite;
}
@keyframes bob {
    0%,
    100% {
        transform: translate(-50%, 0);
    }
    50% {
        transform: translate(-50%, 8px);
    }
}

/* ==========================================================================
   Thread nav — "o percurso"
   ========================================================================== */
.thread-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--nav-w);
    height: 100vh;
    z-index: 50;
    display: flex;
    align-items: center;
    padding-left: 2.25rem;
}

.thread-nav__toggle {
    display: none;
}

.thread-nav__rail {
    position: absolute;
    left: 2.75rem;
    top: 8%;
    bottom: 8%;
    width: 1px;
    background: rgba(27, 42, 74, 0.18);
}
.thread-nav__rail-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: var(--gold);
    transition: height 0.15s linear;
}

.thread-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.35rem;
    position: relative;
}

.thread-nav__list a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    padding: 0.2rem 0;
}

.thread-nav__list a::before {
    content: attr(data-num);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--slate);
    width: 1.4em;
    flex-shrink: 0;
    text-align: right;
    opacity: 0.75;
}

.thread-nav__dot {
    position: relative;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--cream-2);
    border: 1.5px solid rgba(27, 42, 74, 0.35);
    flex-shrink: 0;
    transition:
        background 0.3s var(--ease),
        border-color 0.3s var(--ease),
        transform 0.3s var(--ease);
}

.thread-nav__label {
    font-family: var(--font-mono);
    font-size: 0.86rem;
    letter-spacing: 0.01em;
    color: var(--slate);
    transition: color 0.3s var(--ease);
    white-space: nowrap;
}

.thread-nav__list a:hover .thread-nav__label {
    color: var(--navy-ink);
}
.thread-nav__list a:hover .thread-nav__dot {
    border-color: var(--gold);
}

.thread-nav__list a.is-active .thread-nav__dot {
    background: var(--gold);
    border-color: var(--gold);
    transform: scale(1.35);
}
.thread-nav__list a.is-active .thread-nav__label {
    color: var(--navy-ink);
    font-weight: 500;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    background: var(--navy-void);
    color: rgba(246, 241, 228, 0.55);
    text-align: center;
    padding: 3.5rem 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    letter-spacing: 0.03em;
}
.site-footer__thread {
    width: 1px;
    height: 3rem;
    background: linear-gradient(var(--gold), transparent);
    margin: 0 auto 2rem;
}

/* ==========================================================================
   Responsive nav (mobile)
   ========================================================================== */
@media (max-width: 960px) {
    .thread-nav {
        width: 100%;
        height: auto;
        top: 0;
        left: 0;
        padding: 0;
        flex-direction: column;
        align-items: stretch;
        background: rgba(246, 241, 228, 0.94);
        backdrop-filter: blur(6px);
        border-bottom: 1px solid rgba(27, 42, 74, 0.12);
    }

    .thread-nav__toggle {
        display: flex;
        align-items: center;
        gap: 0.7rem;
        width: 100%;
        padding: 1.1rem 1.25rem;
        background: none;
        border: none;
        font-family: var(--font-mono);
        font-size: 0.85rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--navy-ink);
        cursor: pointer;
    }
    .thread-nav__toggle-line {
        width: 22px;
        height: 1px;
        background: var(--gold);
        position: relative;
    }
    .thread-nav__toggle-line::before,
    .thread-nav__toggle-line::after {
        content: "";
        position: absolute;
        left: 0;
        width: 100%;
        height: 1px;
        background: var(--gold);
    }
    .thread-nav__toggle-line::before {
        top: -6px;
    }
    .thread-nav__toggle-line::after {
        top: 6px;
    }

    .thread-nav__rail {
        display: none;
    }

    .thread-nav__list {
        max-height: 0;
        overflow: hidden;
        padding: 0 1.25rem;
        gap: 0;
        transition:
            max-height 0.35s var(--ease),
            padding 0.35s var(--ease);
    }
    .thread-nav.is-open .thread-nav__list {
        max-height: 70vh;
        padding: 0.25rem 1.25rem 1.25rem;
        overflow-y: auto;
    }
    .thread-nav__list li {
        padding: 0.6rem 0;
        border-bottom: 1px solid rgba(27, 42, 74, 0.08);
    }
    .thread-nav__label {
        white-space: normal;
        font-size: 0.95rem;
    }
    .thread-nav__list a {
        align-items: flex-start;
    }
    .thread-nav__list a::before {
        padding-top: 0.15em;
    }
    .thread-nav__dot {
        margin-top: 0.5em;
    }
}

/* ==========================================================================
   Small screens
   ========================================================================== */
@media (max-width: 520px) {
    .section__inner {
        padding: 2.25rem 1.25rem;
    }
    .step-list li {
        padding-left: 3rem;
    }
}
