/* ============================================================
   library.css: the Library section (/library/ and its pages).
   Loaded only by layouts/library/*. Uses the site's own tokens
   from data/theme.yaml (emitted by head/extensions.html); no
   colours of its own beyond tints of those.
   ============================================================ */

.library .lib-crumb {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 1rem;
}
.library .lib-crumb a { color: var(--accent-color); text-decoration: none; }
.library .lib-crumb a:hover { text-decoration: underline; }

.library .title h1 { text-align: left; color: var(--primary-color); }
.library .lib-subtitle { color: var(--text-secondary-color); font-size: 1.15rem; margin: 0 0 0.4rem; }
.library .lib-meta { color: var(--text-secondary-color); font-size: 0.85rem; margin: 0; }

/* On this page */
.lib-toc {
    background: var(--secondary-background-color);
    border-radius: 0.75rem;
    padding: 1rem 1.3rem;
    margin: 0 0 2rem;
    font-size: 0.95rem;
}
.lib-toc-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 0.4rem;
}
.lib-toc ul { list-style: none; margin: 0; padding: 0; }
.lib-toc ul ul { display: none; }
.lib-toc li { margin: 0.15rem 0; }
.lib-toc a { color: var(--text-link-color); text-decoration: none; }
.lib-toc a:hover { text-decoration: underline; }

/* Page text */
.lib-page h2 {
    font-size: 1.55rem;
    color: var(--primary-color);
    margin: 2.6rem 0 0.9rem;
    scroll-margin-top: 5rem;
}
.lib-page h3 {
    font-size: 1.15rem;
    color: var(--text-color);
    margin: 1.8rem 0 0.6rem;
    scroll-margin-top: 5rem;
}
.lib-page p, .lib-page li { line-height: 1.7; }
.lib-page ul { padding-left: 1.2rem; }
.lib-page ul li { margin-bottom: 0.5rem; }

/* Takeaway line */
.lib-page blockquote {
    border-left: 3px solid var(--accent-color);
    background: var(--secondary-background-color);
    border-radius: 0 0.5rem 0.5rem 0;
    padding: 0.9rem 1.2rem;
    margin: 1.4rem 0;
    color: var(--text-color);
    font-family: var(--body-font);
    font-size: 1.05rem;
    font-weight: 400;
    font-style: normal;
}
.lib-page blockquote p { margin: 0; font-size: inherit; font-weight: inherit; }

/* Numbered steps */
.lib-page ol {
    list-style: none;
    counter-reset: step;
    padding: 0;
    margin: 1.2rem 0;
}
.lib-page ol > li {
    counter-increment: step;
    position: relative;
    background: var(--secondary-background-color);
    border-radius: 0.75rem;
    padding: 1.1rem 1.3rem 1.1rem 3.6rem;
    margin-bottom: 0.9rem;
}
.lib-page ol > li::before {
    content: counter(step);
    position: absolute;
    left: 1.1rem;
    top: 1.05rem;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--background-color);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.7rem;
    text-align: center;
}
.lib-page ol > li p { margin: 0.4rem 0 0; }
.lib-page ol > li > strong:first-child { color: var(--primary-color); }

/* Folds: detail a reader may skip */
.lib-fold {
    border: 1px solid var(--secondary-color);
    border-radius: 0.75rem;
    background: var(--background-color);
    margin: 1.6rem 0;
}
.lib-fold > summary {
    cursor: pointer;
    list-style: none;
    padding: 1rem 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.lib-fold > summary::-webkit-details-marker { display: none; }
.lib-fold > summary::after {
    content: "+";
    font-size: 1.4rem;
    line-height: 1;
    color: var(--accent-color);
}
.lib-fold[open] > summary::after { content: "\2212"; }
.lib-fold[open] > summary { border-bottom: 1px solid var(--secondary-color); }
.lib-fold-body { padding: 0.4rem 1.3rem 1.2rem; }
.lib-fold-body h3:first-child { margin-top: 1rem; }

/* The two-axis map: a card grid where the design earns it */
.lib-quad {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin: 1.6rem 0 0.4rem;
}
.lib-quad .q {
    border-radius: 0.75rem;
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--secondary-color);
}
.lib-quad .q h4 { font-size: 1.1rem; margin: 0 0 0.15rem; color: var(--primary-color); }
.lib-quad .q .tag {
    font-size: 0.8rem;
    color: var(--text-secondary-color);
    margin: 0 0 0.6rem;
}
.lib-page .lib-quad .q ul { list-style: none; padding: 0; margin: 0; }
.lib-page .lib-quad .q li { margin: 0.1rem 0; padding: 0; line-height: 1.5; }
.lib-quad .q .note { margin: 0.7rem 0 0; font-weight: 600; color: var(--accent-color); }
.lib-quad .agitating   { background: rgba(160, 78, 52, 0.12); }
.lib-quad .invigorating { background: rgba(16, 62, 70, 0.10); }
.lib-quad .draining    { background: var(--secondary-color); }
.lib-quad .soothing    { background: var(--secondary-background-color); }
.lib-axis {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-secondary-color);
    margin: 0 0 1.6rem;
}
.lib-axis-top { margin: 1.6rem 0 0; justify-content: center; }
@media (max-width: 575px) {
    .lib-quad { grid-template-columns: 1fr; }
}

/* Licence notice at the foot of each page */
.lib-licence {
    margin: 2.5rem 0 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--secondary-color);
    font-size: 0.85rem;
    color: var(--text-secondary-color);
}

/* "Why it works" boxes and the author's own stance, set off from the body text */
.lib-page .lib-why {
    background: var(--secondary-background-color);
    border-radius: 0.5rem;
    padding: 0.9rem 1.2rem;
    margin: 1.2rem 0;
}
.lib-page .lib-why p, .lib-page .lib-stance { margin: 0; }
.lib-page .lib-stance {
    border-left: 3px solid var(--secondary-color);
    padding: 0.2rem 0 0.2rem 1rem;
    margin: 1.2rem 0;
    color: var(--text-secondary-color);
}

/* Practice target for the widening gaze */
.lib-gaze {
    margin: 1.2rem 0;
    padding: 0.6rem;
    border: 1px solid var(--secondary-color);
    border-radius: 0.75rem;
    background: var(--secondary-background-color);
}
.lib-gaze svg { display: block; width: 100%; height: auto; }
.lib-gaze p { margin: 0.5rem 0.3rem 0; font-size: 0.9rem; color: var(--text-secondary-color); }

/* Index */
.lib-index { display: flex; flex-direction: column; gap: 1.1rem; margin-bottom: 3rem; }
.lib-card {
    display: block;
    background-color: var(--secondary-background-color);
    border: 1px solid var(--secondary-color);
    border-radius: 0.75rem;
    padding: 1.4rem 1.6rem;
    text-decoration: none !important;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.lib-card:hover { box-shadow: 0 6px 28px rgba(41, 36, 33, 0.1); transform: translateY(-2px); }
.lib-card h2 { font-size: 1.3rem; color: var(--primary-color) !important; margin: 0 0 0.4rem; }
.lib-card p { color: var(--text-color); margin: 0 0 0.5rem; line-height: 1.6; }
.lib-card-meta { font-size: 0.8rem; color: var(--text-secondary-color); }
