/* ==========================================================
   Handbook: a hands-on magazine for tutorials and guides.
   A bold coloured header, topic pills, bold sans headlines
   over a warm serif, pictures in tilted frames, colourful
   collections, callouts and code blocks. On the Classic styles.
   ========================================================== */

[data-bs-theme="light"] .theme-handbook {
    --hb-bg: #ffffff;
    --hb-head: #222222;
    --hb-text: #333333;
    --hb-muted: #5f5f5f;          /* 6.4:1 on white */
    --hb-line: #e6e6e6;
    --hb-tint: color-mix(in srgb, var(--fc-accent) 11%, #fff);        /* pills, newsletter box */
    --hb-accent-text: color-mix(in srgb, var(--fc-accent) 85%, #000);
    --hb-code: #f5f6f8;
    --hb-c1: color-mix(in srgb, var(--fc-accent) 85%, #000);
    --hb-c2: #b45309;             /* collection headings: amber, */
    --hb-c3: #a21caf;             /* magenta */
}
[data-bs-theme="dark"] .theme-handbook {
    --hb-bg: #15181c;
    --hb-head: #f1f3f5;
    --hb-text: #dde1e5;
    --hb-muted: #a8b0b8;
    --hb-line: #2a3036;
    --hb-tint: color-mix(in srgb, var(--fc-accent) 20%, #15181c);
    --hb-accent-text: color-mix(in srgb, var(--fc-accent) 50%, #fff);
    --hb-code: #1f2429;
    --hb-c1: color-mix(in srgb, var(--fc-accent) 50%, #fff);
    --hb-c2: #fbbf6a;
    --hb-c3: #f0a6f5;
}

.theme-handbook {
    --bs-body-bg: var(--hb-bg);
    --bs-body-color: var(--hb-text);
    --bs-emphasis-color: var(--hb-head);
    --bs-secondary-color: var(--hb-muted);
    --bs-border-color: var(--hb-line);
    background: var(--hb-bg);
    color: var(--hb-text);
    line-height: 1.7;
}
.theme-handbook h1, .theme-handbook h2, .theme-handbook h3, .theme-handbook h4 { color: var(--hb-head); font-weight: 700; letter-spacing: -.01em; }
:where(.theme-handbook) a { color: var(--hb-accent-text); }
.theme-handbook .btn { border-radius: 11px; font-weight: 700; }
.theme-handbook.width-wide .container { max-width: 1320px; }

/* ---- Header: a solid colour bar with white menu -------------------------- */
.theme-handbook .site-header { background: var(--fc-accent); border: 0 !important; }
.theme-handbook .site-header .navbar-brand, .theme-handbook .site-header .nav-link { color: var(--fc-on-accent) !important; }
.theme-handbook .site-header .navbar-brand { font-weight: 800 !important; }
.theme-handbook .site-header .nav-underline { --bs-nav-underline-border-width: 0; }
.theme-handbook .site-header .nav-link { font-weight: 700; border-radius: 11px; padding: .4rem .85rem; }
.theme-handbook .site-header .nav-link:hover { background: rgba(0, 0, 0, .15); }
.theme-handbook .site-header .nav-link.active { background: rgba(0, 0, 0, .22); }

/* ---- 1. Topic pills --------------------------------------------------------- */
.hb-topics { border-bottom: 1px solid var(--hb-line); padding: .7rem 0; background: var(--hb-bg); }
.hb-topics .container { display: flex; flex-wrap: wrap; gap: .5rem; }
.hb-pill { background: var(--hb-tint); color: var(--hb-accent-text); border-radius: 11px; padding: .2rem .8rem; font-size: .9rem; font-weight: 700; text-decoration: none; }
.hb-pill:hover { background: var(--fc-accent); color: var(--fc-on-accent); }

/* ---- Framed pictures (tilted unless the option is off) --------------------- */
.hb-frame { flex: none; width: 112px; transform: rotate(-3deg); transition: transform .2s; }
.hb-frame-lg { width: min(300px, 70vw); transform: rotate(-2.5deg); }
.hb-frame-img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border: 5px solid var(--fc-accent); border-radius: 18px; box-shadow: 0 14px 24px -14px rgba(0, 0, 0, .45); background: var(--hb-tint); }
.hb-frame-empty { display: grid; place-items: center; color: var(--hb-accent-text); font-size: 2rem; }
.hb-card:hover .hb-frame, .hb-lead-story:hover .hb-frame { transform: rotate(0deg); }

/* ---- 2. Lead story ------------------------------------------------------------ */
.hb-home { padding-top: 2.5rem; }
.hb-lead-story { display: flex; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; padding-bottom: 3rem; border-bottom: 1px solid var(--hb-line); }
.hb-h1 { font-size: clamp(2rem, 1.2rem + 2.4vw, 2.8rem); line-height: 1.15; margin: .2rem 0 1rem; }
.hb-h1 a { color: var(--hb-head); text-decoration: none; }
.hb-h1 a:hover { color: var(--hb-accent-text); }
.hb-lead { font-size: 1.05rem; color: var(--hb-text); max-width: 44rem; }
.hb-continue { font-weight: 700; color: var(--hb-accent-text); text-decoration: underline; text-underline-offset: .2em; }
@media (max-width: 767.98px) { .hb-lead-story { flex-direction: column; align-items: flex-start; } }

/* ---- Meta, headings --------------------------------------------------------- */
.hb-meta { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--hb-muted); margin: 0 0 .35rem; }
.hb-topic { color: var(--hb-accent-text); font-weight: 700; }
.hb-section { margin: 3.5rem 0; }
.hb-h2 { font-size: 1.8rem; margin-bottom: 1.5rem; padding-left: .8rem; border-left: 5px solid var(--fc-accent); line-height: 1.2; }

/* ---- 3. Cards (partials/card.php) ------------------------------------------ */
.hb-card { display: flex; gap: 1.4rem; align-items: flex-start; }
.hb-card-body { min-width: 0; }
.hb-title { font-size: 1.35rem; line-height: 1.25; margin: 0 0 .5rem; }
.hb-title a { color: var(--hb-head); text-decoration: none; }
.hb-card:hover .hb-title a { color: var(--hb-accent-text); }
.hb-summary { color: var(--hb-text); font-size: .95rem; margin: 0 0 .5rem; }
.hb-more { font-size: .9rem; font-weight: 700; color: var(--hb-accent-text); margin: 0; }
@media (max-width: 575.98px) { .hb-frame:not(.hb-frame-lg) { width: 84px; } .hb-card { gap: 1rem; } }

/* ---- 4. Collections -------------------------------------------------------------- */
.hb-collection { border-top: 5px solid currentColor; padding-top: 1rem; height: 100%; }
.hb-c1 { color: var(--hb-c1); } .hb-c2 { color: var(--hb-c2); } .hb-c3 { color: var(--hb-c3); }
.hb-collection-h { font-size: 1.5rem; color: inherit !important; margin-bottom: .75rem; }
.hb-collection-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.hb-collection-list li { border-bottom: 1px solid var(--hb-line); padding: .6rem 0; }
.hb-collection-list a { color: var(--hb-head); text-decoration: none; font-size: .98rem; }
.hb-collection-list a:hover { color: inherit; text-decoration: underline; }
.hb-collection-more { font-weight: 700; font-size: .9rem; color: inherit; text-decoration: underline; text-underline-offset: .2em; }

/* ---- 5. Newsletter box ------------------------------------------------------------ */
.hb-band { background: var(--hb-tint); border-radius: 22px; padding: clamp(2rem, 5vw, 3.5rem); margin: 3.5rem 0 1rem; text-align: center; }
.hb-band-h { font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.2rem); }
.hb-band .fc-newsletter { background: none; border: 0; box-shadow: none !important; margin: 0 auto !important; max-width: 36rem; }
.hb-band .fc-newsletter .card-body { padding: 0 !important; }
.hb-band .fc-newsletter h2 { font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.2rem) !important; }
.hb-band .fc-subscribe { justify-content: center; }
.hb-band .fc-newsletter .form-control { width: auto; flex: 1 1 240px; border-radius: 11px; padding: .7rem 1rem; }

/* ---- Articles: callouts, code, tables ------------------------------------------- */
.theme-handbook main > .container > header.card { border: 0; background: var(--hb-tint); border-radius: 22px; margin-top: 2rem; }
.theme-handbook .content-body blockquote { border-left: 5px solid var(--fc-accent); background: var(--hb-tint); border-radius: 0 14px 14px 0; padding: 1rem 1.25rem; margin: 1.75rem 0; }
.theme-handbook .content-body blockquote > :last-child { margin-bottom: 0; }
.theme-handbook .content-body code { font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace; font-size: .88em; background: var(--hb-code); color: var(--hb-head); padding: .1em .35em; border-radius: 6px; }
.theme-handbook .content-body pre { background: #1d232a; color: #e6edf3; border-radius: 14px; padding: 1.1rem 1.25rem; overflow-x: auto; font-size: .9rem; }
.theme-handbook .content-body pre code { background: none; color: inherit; padding: 0; }
.theme-handbook .content-body table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: .95rem; }
.theme-handbook .content-body th { text-align: left; border-bottom: 3px solid var(--fc-accent); padding: .6rem .75rem; font-family: -apple-system, 'Segoe UI', Roboto, sans-serif; }
.theme-handbook .content-body td { border-bottom: 1px solid var(--hb-line); padding: .6rem .75rem; }
.theme-handbook .toc, .theme-handbook .sidebar .card { border-radius: 16px; overflow: hidden; }
.theme-handbook .pagination { gap: .35rem; --bs-pagination-color: var(--hb-accent-text); --bs-pagination-hover-bg: var(--hb-tint); --bs-pagination-hover-color: var(--hb-head); }
.theme-handbook .page-link { border-radius: 11px !important; min-width: 2.5rem; text-align: center; font-weight: 700; }

/* ---- Footer ----------------------------------------------------------------------- */
.theme-handbook .site-footer .link-secondary { color: var(--hb-muted) !important; }
