/* ==========================================================================
   Digital Sandbox Services — notas: lectura y banco de conocimiento
   Se apoya en /styles.css (tokens, nav, botones, footer, .note, .reveal, .wr).
   Movimiento mínimo: el texto manda, los efectos acompañan.
   ========================================================================== */

.page-notas {
    --col: 720px;              /* columna de lectura */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* el nav ya está presente al llegar: sin la entrada del arranque del inicio */
.page-notas .nav-menu,
.page-notas .nav-actions { animation: none; }

.post-col {
    max-width: calc(var(--col) + 2 * var(--pad-x));
}

/* ---------- héroe oscuro compartido (nota y banco) ---------- */

.post-hero,
.arch-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: var(--ink);
    color: var(--paper);
    padding: clamp(128px, 17vh, 172px) 0 clamp(52px, 7vw, 84px);
}

/* halo verde estático, muy tenue */
.post-hero::before,
.arch-hero::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -48%;
    right: -14%;
    width: min(72vw, 760px);
    aspect-ratio: 1;
    background: radial-gradient(circle, rgba(0, 200, 138, 0.15), transparent 64%);
    pointer-events: none;
}

/* retícula técnica que se desvanece */
.post-hero::after,
.arch-hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background-image:
        linear-gradient(rgba(246, 246, 246, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(246, 246, 246, 0.045) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse 75% 80% at 78% 0%, #000 8%, transparent 70%);
    mask-image: radial-gradient(ellipse 75% 80% at 78% 0%, #000 8%, transparent 70%);
    pointer-events: none;
}

/* ==========================================================================
   PÁGINA DE LECTURA
   ========================================================================== */

.post-back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    color: var(--muted-on-ink);
    transition: color 0.25s ease;
}

.post-back svg {
    width: 16px;
    height: 16px;
    transition: transform 0.35s var(--ease-out);
}

.post-back:hover { color: var(--paper); }
.post-back:hover svg { transform: translateX(-4px); }

.post-kicker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: clamp(28px, 4vw, 44px);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    color: var(--muted-on-ink);
}

.post-cat {
    color: var(--green);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.post-cat:hover { border-bottom-color: var(--green); }

.post-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--muted-on-ink);
    opacity: 0.6;
}

.post-title {
    margin: 18px 0 22px;
    font-weight: 700;
    font-size: clamp(2.05rem, 4.6vw, 3.3rem);
    line-height: 1.06;
    letter-spacing: -0.03em;
    color: var(--paper);
    text-wrap: balance;
}

.post-dek {
    max-width: 58ch;
    font-size: clamp(1.05rem, 1.4vw, 1.2rem);
    line-height: 1.55;
    color: #c9ced3;
}

.post-byline {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 34px;
    padding-top: 26px;
    border-top: 1px solid var(--ink-line);
}

.post-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--ink-line);
}

.post-byline b {
    display: block;
    font-weight: 600;
    font-size: 0.98rem;
}

.post-byline span {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--muted-on-ink);
    margin-top: 2px;
}

/* ---------- cuerpo: columna de lectura centrada + índice lateral ---------- */

.post-layout {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--col)) minmax(0, 1fr);
    column-gap: clamp(32px, 4vw, 64px);
    padding-block: clamp(52px, 6vw, 84px) clamp(44px, 5vw, 64px);
}

.prose { grid-column: 2; }

.post-toc {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    position: sticky;
    top: 112px;
    width: 210px;
}

.post-toc-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 14px;
}

.post-toc ol {
    list-style: none;
    border-left: 1px solid var(--line);
}

.post-toc a {
    display: block;
    margin-left: -1px;
    padding: 7px 0 7px 16px;
    border-left: 2px solid transparent;
    font-size: 0.86rem;
    line-height: 1.35;
    color: var(--muted);
    transition: color 0.3s ease, border-color 0.3s ease;
}

.post-toc a:hover { color: var(--ink); }

.post-toc a.is-active {
    color: var(--ink);
    border-left-color: var(--green);
}

/* ---------- tipografía de lectura ---------- */

.prose {
    font-size: clamp(1.06rem, 1.15vw, 1.15rem);
    line-height: 1.78;
    color: #242424;
}

.prose > * + * { margin-top: 1.2em; }

.prose > p:first-child {
    font-size: 1.16em;
    line-height: 1.66;
    color: var(--ink);
}

.prose h2 {
    margin-top: 2.3em;
    font-size: clamp(1.42rem, 2.1vw, 1.75rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 700;
    color: var(--ink);
    scroll-margin-top: 104px;
}

/* marca verde de sección: se dibuja al entrar en pantalla */
.prose h2::before {
    content: "";
    display: block;
    width: 26px;
    height: 2px;
    margin-bottom: 16px;
    background: var(--green);
    transform-origin: left center;
}

.prose h3 {
    margin-top: 1.9em;
    font-size: 1.18rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--ink);
    scroll-margin-top: 104px;
}

.prose h2 + *,
.prose h3 + * { margin-top: 0.7em; }

.prose strong {
    font-weight: 600;
    color: var(--ink);
}

.prose a {
    color: var(--green-text);
    text-decoration: underline;
    text-decoration-color: rgba(0, 200, 138, 0.45);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s ease;
}

.prose a:hover { text-decoration-color: var(--green); }

.prose ul,
.prose ol { padding-left: 1.35em; }

.prose li + li { margin-top: 0.55em; }

.prose li { padding-left: 0.3em; }

.prose ul li::marker { color: var(--green); }

.prose ol li::marker {
    font-family: var(--font-mono);
    font-size: 0.86em;
    color: var(--green-text);
}

.prose blockquote {
    margin-block: 1.8em;
    padding: 6px 0 6px 24px;
    border-left: 3px solid var(--green);
    font-size: 1.14em;
    line-height: 1.55;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.prose blockquote p + p { margin-top: 0.8em; }

.prose hr {
    border: 0;
    height: 1px;
    margin-block: 2.6em;
    background: var(--line);
}

.prose code {
    font-family: var(--font-mono);
    font-size: 0.86em;
    padding: 0.12em 0.4em;
    border-radius: 6px;
    background: #ebebeb;
}

/* ---------- pie de la nota: autor + compartir ---------- */

.post-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 30px 0 clamp(56px, 7vw, 88px);
    border-top: 1px solid var(--line);
}

.post-author {
    display: flex;
    align-items: center;
    gap: 16px;
}

.post-author img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
}

.post-author-name {
    font-weight: 700;
    font-size: 1.02rem;
}

.post-author-role {
    font-size: 0.9rem;
    color: var(--muted);
}

.post-share {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-share-label {
    margin-right: 6px;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--muted);
}

.share-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #d6d6d6;
    border-radius: 50%;
    background: var(--white);
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.share-btn svg {
    width: 17px;
    height: 17px;
}

.share-btn:hover {
    border-color: var(--ink);
}

.share-copy.is-done {
    background: var(--green);
    border-color: var(--green);
}

.share-copy-msg {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.25s ease, transform 0.25s var(--ease-out);
    pointer-events: none;
}

.share-copy.is-done .share-copy-msg {
    opacity: 1;
    transform: none;
}

/* ---------- sigue leyendo ---------- */

.post-more {
    padding-block: clamp(56px, 7vw, 96px);
    background: var(--white);
    border-top: 1px solid var(--line);
}

.post-more-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px 24px;
    margin-bottom: 28px;
}

.post-more-head .eyebrow { margin-bottom: 0; }

.more-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.94rem;
}

.more-all svg {
    width: 16px;
    height: 16px;
    transition: transform 0.35s var(--ease-out);
}

.more-all:hover svg { transform: translateX(4px); }

.more-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(16px, 2vw, 24px);
}

.post-more .note {
    background: var(--paper);
}

/* ---------- llamada a la acción ---------- */

.post-cta {
    padding-block: clamp(20px, 3vw, 32px) clamp(64px, 8vw, 112px);
}

.post-more + .post-cta {
    background: var(--white);
}

.post-cta-box {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 28px 40px;
    padding: clamp(32px, 4.4vw, 56px);
    border-radius: 22px;
    background: var(--ink);
    color: var(--paper);
}

.post-cta-box::before {
    content: "";
    position: absolute;
    z-index: -1;
    right: -120px;
    bottom: -220px;
    width: 460px;
    height: 460px;
    background: radial-gradient(circle, rgba(0, 200, 138, 0.22), transparent 66%);
    pointer-events: none;
}

.post-cta-box .eyebrow { margin-bottom: 14px; }

.post-cta-box h2 {
    font-size: clamp(1.6rem, 2.8vw, 2.2rem);
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.post-cta-box p:not(.eyebrow) {
    max-width: 46ch;
    margin-top: 10px;
    color: #c9ced3;
}

/* ==========================================================================
   BANCO DE CONOCIMIENTO
   ========================================================================== */

.arch-h1 {
    font-weight: 700;
    font-size: clamp(2.5rem, 5.6vw, 4.4rem);
    line-height: 1;
    letter-spacing: -0.035em;
}

.arch-hero .lead {
    margin-top: 22px;
    color: #c9ced3;
}

.arch-hero .hero-meta { margin-top: 46px; }

.arch {
    padding-block: clamp(40px, 5vw, 64px) var(--section-y);
}

.arch-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
}

.arch-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid #d6d6d6;
    border-radius: 999px;
    background: transparent;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--grafito);
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.chip small {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
    transition: color 0.25s ease;
}

.chip:hover { border-color: var(--ink); }

.chip[aria-pressed="true"] {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.chip[aria-pressed="true"] small { color: var(--green); }

.arch-search {
    position: relative;
    display: block;
    width: min(300px, 100%);
}

.arch-search svg {
    position: absolute;
    left: 15px;
    top: 50%;
    width: 17px;
    height: 17px;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.arch-search input {
    width: 100%;
    padding: 11px 16px 11px 42px;
    border: 1px solid #d6d6d6;
    border-radius: 999px;
    background: var(--white);
    font-family: var(--font-sans);
    font-size: 0.94rem;
    color: var(--ink);
    transition: border-color 0.2s ease;
}

.arch-search input::placeholder { color: #9a9a9a; }

.arch-search input:focus {
    outline: none;
    border-color: var(--ink);
}

.arch-count {
    margin: 30px 0 0;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--muted);
}

.arch-year {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 24px;
    margin-top: 16px;
    padding-top: 18px;
    border-top: 1px solid var(--ink);
}

.arch-year[hidden],
.arch-row[hidden] { display: none; }

.arch-year-label {
    position: sticky;
    top: 104px;
    align-self: start;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.arch-row {
    position: relative;
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    gap: 8px 28px;
    align-items: start;
    padding: 26px 0;
    border-bottom: 1px solid var(--line);
}

.arch-rows .arch-row:first-child { padding-top: 0; }

/* línea que se completa al pasar el cursor */
.arch-row::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: var(--ink);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.7s var(--ease-out);
}

.arch-date {
    padding-top: 3px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
}

.arch-cat {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.02em;
    color: var(--green-text);
}

.arch-title {
    margin-top: 6px;
    font-size: clamp(1.18rem, 1.8vw, 1.42rem);
    line-height: 1.22;
    letter-spacing: -0.018em;
    font-weight: 700;
}

.arch-sum {
    max-width: 68ch;
    margin-top: 8px;
    font-size: 0.98rem;
    color: var(--grafito);
}

.arch-side {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 2px;
}

.arch-read {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
    white-space: nowrap;
}

.arch-go {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid #d6d6d6;
    border-radius: 50%;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.arch-go svg {
    width: 16px;
    height: 16px;
    transition: transform 0.45s var(--ease-out);
}

@media (hover: hover) {
    .arch-row:hover::after { transform: scaleX(1); }
    .arch-row:hover .arch-go {
        background: var(--green);
        border-color: var(--green);
    }
    .arch-row:hover .arch-go svg { transform: translateX(3px); }
}

.arch-row:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 6px;
    border-radius: 4px;
}

.arch-empty {
    padding: 48px 0;
    color: var(--muted);
}

/* ==========================================================================
   MOVIMIENTO (solo si el usuario lo acepta)
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
    html.js-motion .prose h2::before {
        transform: scaleX(0);
        transition: transform 0.9s var(--ease-out) 0.1s;
    }

    html.js-motion .prose h2.in::before { transform: scaleX(1); }

    /* entradas más cortas que en el inicio: aquí se viene a leer */
    html.js-motion .page-notas .reveal {
        transform: translateY(16px);
        filter: blur(6px);
        transition-duration: 0.8s;
    }

    html.js-motion .page-notas .reveal.in {
        transform: none;
        filter: none;
    }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1180px) {
    .post-toc { display: none; }
    .post-layout {
        grid-template-columns: minmax(0, var(--col));
        justify-content: center;
    }
    .prose { grid-column: 1; }
}

@media (max-width: 760px) {
    .more-grid { grid-template-columns: 1fr; }

    .arch-tools { flex-direction: column; align-items: stretch; }
    .arch-search { width: 100%; }

    .arch-year { grid-template-columns: 1fr; gap: 12px; }
    .arch-year-label { position: static; }

    .arch-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px 16px;
    }
    .arch-date { grid-column: 1; padding-top: 0; }
    .arch-main { grid-column: 1; }
    .arch-side { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
    .arch-read { display: none; }

    .post-foot { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
    .post-cta-box .btn { width: 100%; }
    .arch-go { width: 34px; height: 34px; }
}
