/* ============================================
   MALEK LEARNS — page parts
   Home hero, cards, featured, page and book heroes,
   table of contents, reader, prose, callouts, boxes.
   Builds on the tokens in css/styles.css.
   ============================================ */

/* ============ Home hero ============ */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding: calc(var(--header-h) + 48px) 0 96px;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: 8%;
    right: -180px;
    width: 760px;
    height: 760px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--hero-glow), transparent 62%);
    pointer-events: none;
}

.hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
    align-items: center;
    gap: clamp(32px, 5vw, 72px);
}

.hero-name {
    display: flex;
    flex-direction: column;
    margin-bottom: 22px;
    font-family: var(--font-display);
    font-size: clamp(3.3rem, 6.6vw, 5.8rem);
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}

.hero-role {
    min-height: 1.4em;
    margin-bottom: 14px;
    font-family: var(--font-mono);
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    font-weight: 700;
    line-height: 1.4;
    color: var(--text);
}
.hero-role::before { content: '> '; color: var(--accent); }
.role-caret {
    display: inline-block;
    width: 3px;
    height: 1.05em;
    margin-left: 4px;
    vertical-align: -0.15em;
    border-radius: 2px;
    background: var(--accent);
    animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.hero-sub { max-width: 580px; font-size: 1.05rem; color: var(--text-soft); }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 34px;
    margin-top: 34px;
    padding-top: 22px;
    border-top: 1px solid var(--border-soft);
}
.hero-stats li { display: flex; align-items: baseline; gap: 9px; }
.hero-stats strong {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 900;
    line-height: 1;
    color: var(--accent);
}
.hero-stats span {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.hero-visual { display: grid; justify-items: center; gap: 22px; }
.cover-stack { position: relative; width: min(340px, 100%); aspect-ratio: 1 / 1.1; }
.cover-stack img {
    position: absolute;
    width: 62%;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: var(--cover-shadow);
    transition: transform 0.5s var(--ease);
}
.cover-stack img:first-child { left: 0; top: 8%; transform: rotate(-7deg); }
.cover-stack img:last-child { right: 0; top: 0; transform: rotate(5deg); }
.hero-visual:hover .cover-stack img:first-child { transform: rotate(-10deg) translateX(-8px); }
.hero-visual:hover .cover-stack img:last-child { transform: rotate(7deg) translateX(8px); }
.hero-visual-cap { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-muted); }

/* ============ Page hero (books, book pages) ============ */
.page-hero {
    position: relative;
    padding: calc(var(--header-h) + 64px) 0 44px;
    overflow: hidden;
}
.page-hero::before {
    content: '';
    position: absolute;
    top: -260px;
    right: -200px;
    width: 680px;
    height: 680px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--hero-glow), transparent 62%);
    pointer-events: none;
}
.page-hero > .container { position: relative; }

.crumbs {
    margin-bottom: 18px;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--text-muted);
}
.crumbs a { color: var(--text-soft); transition: color 0.2s; }
.crumbs a:hover { color: var(--accent); }
.crumbs span { margin: 0 7px; color: var(--border-strong); }

.page-kicker {
    margin-bottom: 14px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
}

.page-title {
    font-size: clamp(2.5rem, 5.4vw, 4rem);
    font-weight: 850;
    letter-spacing: -0.05em;
    line-height: 1.02;
    text-wrap: balance;
}

.page-sub { max-width: 660px; margin-top: 16px; font-size: 1.05rem; color: var(--text-soft); }
.page-sub .stars { margin: 0 2px; }

.page-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.page-body { padding-top: 32px; }

/* ============ Section head (home) ============ */
.section-head .section-lead { margin-top: 14px; }

/* ============ Knowledge grid and cards ============ */
.knowledge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 22px;
}

.k-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 26px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--card-bg);
    transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
}
.k-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-deep), var(--accent-hover));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s var(--ease);
}
a.k-card:hover {
    transform: translateY(-4px);
    border-color: rgba(var(--accent-rgb), 0.5);
    box-shadow: var(--shadow-card);
}
a.k-card:hover::before { transform: scaleX(1); }

.k-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.k-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    border-radius: 12px;
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--accent);
    font-size: 1.1rem;
}

.k-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-inset);
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-soft);
}
.k-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.k-status.done {
    border-color: rgba(var(--success-rgb), 0.35);
    background: rgba(var(--success-rgb), 0.08);
    color: var(--success);
}
.k-status.done::before { box-shadow: 0 0 0 3px rgba(var(--success-rgb), 0.2); }
.k-status.reading { border-color: rgba(var(--accent-rgb), 0.35); background: rgba(var(--accent-rgb), 0.08); color: var(--accent); }
.k-status.planned { border-color: rgba(var(--imp-rgb), 0.35); background: rgba(var(--imp-rgb), 0.08); color: var(--imp); }

.k-title { margin-bottom: 6px; font-size: 1.3rem; font-weight: 850; letter-spacing: -0.03em; line-height: 1.2; }
.k-meta { margin-bottom: 12px; font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); }
.k-meta i { margin-right: 5px; color: var(--accent); }
.k-rating { margin-bottom: 12px; font-size: 0.9rem; letter-spacing: 2px; color: var(--accent); }
.k-desc { font-size: 0.92rem; color: var(--text-soft); }

.k-takeaways { margin-top: 14px; }
.k-takeaways li { margin-bottom: 8px; font-size: 0.88rem; line-height: 1.55; color: var(--text-soft); }

.k-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }

.k-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 18px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--accent);
}
.k-cta i { font-size: 0.7rem; transition: transform 0.2s; }
a.k-card:hover .k-cta i { transform: translateX(4px); }

.k-card.is-soon {
    align-items: center;
    justify-content: center;
    min-height: 240px;
    border-style: dashed;
    border-color: var(--border-strong);
    background: var(--surface-inset);
    text-align: center;
    color: var(--text-muted);
}
.k-card.is-soon::before { display: none; }
.k-card.is-soon > i { margin-bottom: 14px; font-size: 1.6rem; color: var(--text-muted); }
.k-soon-title { margin-bottom: 6px; font-size: 1.02rem; font-weight: 800; color: var(--text-soft); }
.k-card.is-soon p:not(.k-soon-title) { font-size: 0.88rem; }
.k-card.is-soon a { color: var(--accent); font-weight: 700; }

/* ============ Featured banner ============ */
.featured {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: clamp(24px, 4vw, 48px);
    padding: clamp(24px, 3.4vw, 40px);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background: var(--card-bg);
    box-shadow: var(--shadow-card);
}
.featured::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-deep), var(--accent-hover) 60%, rgba(var(--accent-rgb), 0.1));
}
.featured-cover {
    display: block;
    width: 170px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: var(--cover-shadow);
    transition: transform 0.4s var(--ease);
}
.featured-cover:hover { transform: translateY(-4px) rotate(-1deg); }
.featured-cover img { width: 100%; height: auto; }
.featured-eyebrow {
    margin-bottom: 10px;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--accent);
}
.featured-eyebrow::before { content: '// '; }
.featured-title { margin-bottom: 8px; font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 850; letter-spacing: -0.04em; }
.featured-meta { margin-bottom: 14px; font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-muted); }
.featured-meta i { margin-right: 5px; color: var(--accent); }
.featured-desc { max-width: 600px; margin-bottom: 22px; color: var(--text-soft); }

/* ============ Book hero ============ */
.book-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: clamp(32px, 5vw, 64px);
}
.book-hero-main { min-width: 0; max-width: 760px; }
.book-hero-main .callout:first-of-type { margin-top: 26px; }
.book-cover {
    width: 290px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    box-shadow: var(--cover-shadow);
}
.book-cover img { width: 100%; height: auto; }

/* ============ Book layout: table of contents + reader ============ */
.book-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    align-items: start;
    gap: 48px;
    max-width: 1120px;
    margin: 0 auto;
}

.toc {
    position: sticky;
    top: calc(var(--header-h) + 24px);
    max-height: calc(100vh - var(--header-h) - 48px);
    overflow-y: auto;
    padding: 20px 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--panel-bg);
    scrollbar-width: thin;
}
.toc-head { display: none; }
.toc-label {
    margin-bottom: 10px;
    padding-left: 14px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.toc-list + .toc-label { margin-top: 18px; }
.toc-list { border-left: 2px solid var(--border); }
.toc-list a {
    display: flex;
    gap: 10px;
    margin-left: -2px;
    padding: 7px 8px 7px 12px;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    font-size: 0.84rem;
    line-height: 1.4;
    color: var(--text-soft);
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.toc-list a:hover { color: var(--text); background: var(--surface-inset); }
.toc-list a.active {
    border-left-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
    font-weight: 700;
    color: var(--accent);
}
.toc-num { flex: none; font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-muted); }
.toc-list a.active .toc-num { color: var(--accent); }

/* ============ Reader (chapter carousel) ============ */
.reader { min-width: 0; max-width: 740px; }
.reader-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 28px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--panel-bg);
}
.reader-nav { width: 40px; height: 40px; }
.reader-status { min-width: 0; text-align: center; }
.reader-count {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--accent);
}
.reader-now {
    display: block;
    overflow: hidden;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--text);
}

.reader-viewport { position: relative; }
.reader-viewport .chapter-slide { display: none; }
.reader-viewport .chapter-slide.is-active { display: block; }
.reader-viewport .chapter-slide.is-active.dir-next { animation: chapNext 0.45s var(--ease); }
.reader-viewport .chapter-slide.is-active.dir-prev { animation: chapPrev 0.45s var(--ease); }
@keyframes chapNext { from { opacity: 0; transform: translateX(30px); } }
@keyframes chapPrev { from { opacity: 0; transform: translateX(-30px); } }

.reader-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}
.reader-foot .btn { flex: none; }
.reader-dots { display: flex; flex: 1 1 auto; flex-wrap: wrap; justify-content: center; gap: 8px; }
.reader-dots button {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--border-strong);
    transition: width 0.3s var(--ease), background 0.2s;
}
.reader-dots button:hover { background: var(--text-muted); }
.reader-dots button.is-active { width: 24px; background: var(--accent); }

.section-anchor { scroll-margin-top: 0; }

/* ============ Prose ============ */
.prose { max-width: 70ch; font-size: 1.02rem; line-height: 1.75; color: var(--text-soft); }
.prose .chapter-eyebrow {
    margin-bottom: 10px;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--accent);
}
.prose h2 {
    position: relative;
    margin: 0 0 20px;
    padding-left: 18px;
    font-size: clamp(1.7rem, 2.6vw, 2.1rem);
    font-weight: 850;
    letter-spacing: -0.04em;
    line-height: 1.15;
    color: var(--text);
}
.prose h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.14em;
    bottom: 0.14em;
    width: 4px;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--accent-hover), var(--accent-deep));
}
.prose h3 { margin: 32px 0 12px; font-size: 1.22rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.prose h4 { margin: 22px 0 8px; font-size: 1rem; font-weight: 800; color: var(--text); }
.prose p { margin-bottom: 16px; }
.prose strong { font-weight: 700; color: var(--text); }
.prose em { color: var(--text); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { margin: 0 0 16px 22px; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--accent); }
.prose code {
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-inset);
    font-family: var(--font-mono);
    font-size: 0.86em;
    color: var(--text);
}
.prose blockquote {
    margin: 26px 0 0;
    padding: 18px 22px;
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    background: rgba(var(--accent-rgb), 0.07);
    font-size: 1.05rem;
    font-style: italic;
    color: var(--text);
}

.prose table {
    width: 100%;
    margin: 22px 0;
    border: 1px solid var(--border);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--r-sm);
    overflow: hidden;
    background: var(--surface-card);
    font-size: 0.9rem;
    line-height: 1.55;
}
.prose th,
.prose td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: top; }
.prose th {
    background: var(--surface-strong);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text);
}
.prose tbody tr:nth-child(even) { background: var(--surface-inset); }
.prose tbody tr:hover { background: rgba(var(--accent-rgb), 0.06); }
.prose tr:last-child td { border-bottom: 0; }

/* ============ Callouts ============ */
.callout {
    --c: var(--accent);
    --c-rgb: var(--accent-rgb);
    position: relative;
    margin: 22px 0;
    padding: 16px 18px 16px 50px;
    border: 1px solid rgba(var(--c-rgb), 0.22);
    border-left: 3px solid var(--c);
    border-radius: var(--r-sm);
    background: linear-gradient(rgba(var(--c-rgb), var(--tint)), rgba(var(--c-rgb), var(--tint))), var(--callout-base);
    font-size: 0.96rem;
    line-height: 1.7;
    color: var(--text-soft);
}
.callout::before {
    position: absolute;
    left: 18px;
    top: 17px;
    font-family: 'Font Awesome 6 Free';
    font-size: 0.92rem;
    font-weight: 900;
    color: var(--c);
}
.callout-title {
    display: block;
    margin-bottom: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c);
}
.callout p { margin-bottom: 10px; }
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--text); }
.callout ol, .callout ul { margin: 6px 0 0 18px; }
.callout ol { list-style: decimal; }
.callout ul { list-style: disc; }
.callout li { margin-bottom: 6px; }
.callout li::marker { color: var(--c); }

.callout.quote::before { content: '\f10d'; }
.callout.warning { --c: var(--warn); --c-rgb: var(--warn-rgb); }
.callout.warning::before { content: '\f071'; }
.callout.important { --c: var(--imp); --c-rgb: var(--imp-rgb); }
.callout.important::before { content: '\f0eb'; }
.callout.example { --c: var(--ex); --c-rgb: var(--ex-rgb); }
.callout.example::before { content: '\f0c3'; }

/* ============ Takeaways and rules boxes ============ */
.box {
    margin: 26px 0;
    padding: 22px 24px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--panel-bg);
}
.box .box-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text);
}
.box-title i { color: var(--accent); }
.box ol, .box ul { margin: 0; list-style: none; }
.box li { margin-bottom: 10px; font-size: 0.93rem; line-height: 1.6; color: var(--text-soft); }
.box li:last-child { margin-bottom: 0; }
.box.takeaways ol { counter-reset: item; }
.box.takeaways li { position: relative; padding-left: 34px; }
.box.takeaways li::before {
    content: counter(item, decimal-leading-zero);
    counter-increment: item;
    position: absolute;
    left: 0;
    top: 1px;
    display: grid;
    place-items: center;
    width: 24px;
    height: 22px;
    border-radius: 6px;
    background: rgba(var(--accent-rgb), 0.12);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--accent);
}

/* ============ Closing call to action ============ */
.cta-strip {
    position: relative;
    margin-top: 56px;
    padding: clamp(28px, 4vw, 48px);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background: var(--card-bg);
    box-shadow: var(--shadow-card);
    text-align: center;
}
.cta-strip::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.1), var(--accent-hover), rgba(var(--accent-rgb), 0.1));
}
.cta-strip h3 { margin-bottom: 12px; font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 850; letter-spacing: -0.04em; }
.cta-strip p { max-width: 540px; margin: 0 auto 24px; color: var(--text-soft); }
.cta-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

/* ============ Responsive ============ */
@media (max-width: 1024px) {
    .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 0.6fr); }
}

@media (max-width: 900px) {
    .book-layout { grid-template-columns: 1fr; gap: 24px; }
    .toc { position: static; max-height: none; }
    .book-hero-inner { grid-template-columns: minmax(0, 1fr) 200px; }
    .book-cover { width: 200px; }
}

@media (max-width: 820px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero-visual { display: none; }
}

@media (max-width: 560px) {
    .reader-foot { flex-wrap: wrap; }
    .reader-dots { order: 3; flex-basis: 100%; margin-top: 4px; }
}

/* ============ Phone layout ============ */
@media (max-width: 760px) {
    .section { padding: 20px 0; }
    .section-head { margin-bottom: 18px; }
    .eyebrow { margin-bottom: 10px; }
    .section-title { font-size: 1.875rem; }
    .section-lead { margin-top: 8px; font-size: 0.9rem; line-height: 1.5; }

    /* Home: the hero and each section fill one screen */
    .hero { min-height: 100svh; padding: calc(var(--header-h) + 24px) 0 28px; }
    .hero::before { top: 4%; right: -240px; width: 480px; height: 480px; }
    .hero-name { margin-bottom: 16px; font-size: 3.1rem; }
    .hero-role { margin-bottom: 10px; font-size: 0.95rem; }
    .hero-sub { font-size: 0.92rem; line-height: 1.55; }
    .hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
    .hero-actions .btn { padding: 14px 10px; font-size: 0.82rem; }
    .hero-stats { gap: 10px 22px; margin-top: 24px; padding-top: 16px; }
    .hero-stats strong { font-size: 1.5rem; }
    .hero-stats span { font-size: 0.62rem; }

    .hero ~ main > .section {
        display: flex;
        align-items: center;
        min-height: calc(100svh - var(--header-h));
    }
    #explore .section-lead { display: none; }

    .knowledge-grid { grid-template-columns: 1fr; gap: 12px; }
    .k-card { padding: 20px; }
    .k-head { margin-bottom: 14px; }
    .k-icon { width: 42px; height: 42px; font-size: 1rem; }
    .k-title { font-size: 1.15rem; }
    .k-meta, .k-rating { margin-bottom: 8px; }
    .k-desc { font-size: 0.88rem; line-height: 1.55; }
    .k-takeaways { margin-top: 10px; }
    .k-takeaways li { margin-bottom: 6px; font-size: 0.84rem; }
    .k-tags { margin-top: 12px; }
    .k-tag { padding: 5px 10px; font-size: 0.7rem; }
    .k-cta { padding-top: 14px; }

    .k-card.is-soon {
        display: grid;
        grid-template-columns: 40px minmax(0, 1fr);
        grid-template-areas: "icon title" "icon text";
        align-items: center;
        gap: 2px 14px;
        min-height: 0;
        padding: 14px 16px;
        text-align: left;
    }
    .k-card.is-soon > i {
        display: grid;
        grid-area: icon;
        place-items: center;
        width: 40px;
        height: 40px;
        margin: 0;
        border-radius: 10px;
        background: var(--surface-inset);
        font-size: 1.05rem;
    }
    .k-soon-title { grid-area: title; margin: 0; font-size: 0.92rem; }
    .k-card.is-soon p:not(.k-soon-title) { grid-area: text; font-size: 0.8rem; line-height: 1.45; }

    .featured {
        grid-template-columns: 92px minmax(0, 1fr);
        grid-template-rows: auto auto 1fr;
        align-items: start;
        gap: 6px 16px;
        padding: 18px;
    }
    .featured-body { display: contents; }
    .featured-cover { grid-column: 1; grid-row: 1 / span 3; width: 92px; border-radius: 10px; }
    .featured-eyebrow { grid-column: 2; grid-row: 1; margin: 0; font-size: 0.7rem; }
    .featured-title { grid-column: 2; grid-row: 2; margin: 0; font-size: 1.4rem; }
    .featured-meta { grid-column: 2; grid-row: 3; margin: 0; font-size: 0.68rem; }
    .featured-desc {
        display: -webkit-box;
        grid-column: 1 / -1;
        margin: 12px 0 14px;
        overflow: hidden;
        font-size: 0.88rem;
        line-height: 1.55;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
    }
    .featured .btn { grid-column: 1 / -1; width: 100%; }

    /* Page heroes */
    .page-hero { padding: calc(var(--header-h) + 24px) 0 12px; }
    .page-hero::before { top: -200px; right: -260px; width: 480px; height: 480px; }
    .crumbs { margin-bottom: 12px; font-size: 0.7rem; }
    .page-kicker { margin-bottom: 8px; font-size: 0.72rem; }
    .page-title { font-size: 2.3rem; }
    .page-sub { margin-top: 10px; font-size: 0.9rem; line-height: 1.55; }
    .page-body { padding-top: 12px; }

    /* Book hero: cover thumbnail beside the title, sized to one screen */
    .book-hero { padding-bottom: 20px; }
    .book-hero-inner {
        grid-template-columns: 92px minmax(0, 1fr);
        grid-template-rows: auto auto auto 1fr;
        gap: 0 16px;
    }
    .book-hero-main { display: contents; }
    .book-hero-main > .crumbs { grid-column: 1 / -1; grid-row: 1; }
    .book-hero-cover { grid-column: 1; grid-row: 2 / span 3; }
    .book-cover { width: 92px; border-radius: 10px; }
    .book-hero-main > .page-kicker { grid-column: 2; grid-row: 2; font-size: 0.68rem; }
    .book-hero-main > .page-title { grid-column: 2; grid-row: 3; font-size: 1.9rem; }
    .book-hero-main > .page-sub { grid-column: 2; grid-row: 4; margin-top: 8px; font-size: 0.8rem; }
    .book-hero-main > .callout,
    .book-hero-main > .page-actions { grid-column: 1 / -1; }
    .book-hero-main .callout:first-of-type { margin-top: 18px; }
    .book-hero-main > .callout { margin: 12px 0 0; padding: 12px 14px 12px 42px; font-size: 0.86rem; line-height: 1.6; }
    .book-hero-main > .callout::before { left: 15px; top: 13px; }

    .page-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
    .page-actions .btn { padding: 13px 10px; font-size: 0.8rem; white-space: normal; text-align: center; }

    /* Phone accordions */
    .is-m-collapsed > [data-m-acc-head],
    .is-m-open > [data-m-acc-head] {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        cursor: pointer;
    }
    .is-m-collapsed > [data-m-acc-head]::after,
    .is-m-open > [data-m-acc-head]::after {
        content: '+';
        flex: none;
        font-size: 1.2rem;
        font-weight: 500;
        line-height: 1;
        transition: transform 0.3s var(--ease);
    }
    .is-m-open > [data-m-acc-head]::after { transform: rotate(45deg); }
    .callout.is-m-collapsed > :not(.callout-title) { display: none; }
    .callout.is-m-collapsed > .callout-title { margin-bottom: 0; }

    /* Table of contents: a collapsed "Chapters" bar */
    .book-layout { gap: 16px; }
    .toc { padding: 0; }
    .toc > :not(.toc-head) { margin-right: 16px; margin-left: 16px; }
    .toc .toc-head {
        justify-content: flex-start;
        gap: 10px;
        padding: 14px 16px;
        font-size: 0.74rem;
        font-weight: 800;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--text);
    }
    .toc-head i { color: var(--accent); }
    .toc-count {
        margin-right: auto;
        padding: 2px 8px;
        border-radius: 999px;
        background: rgba(var(--accent-rgb), 0.12);
        font-family: var(--font-mono);
        font-size: 0.68rem;
        letter-spacing: 0;
        color: var(--accent);
    }
    .toc.is-m-collapsed > :not(.toc-head) { display: none; }
    .toc.is-m-open { padding-bottom: 14px; }

    /* Reader: the chapter bar sticks under the header */
    .reader-bar {
        position: sticky;
        top: var(--header-h);
        z-index: 20;
        margin: 0 calc(-1 * var(--gutter)) 22px;
        padding: 8px var(--gutter);
        border-width: 0 0 1px;
        border-radius: 0;
        background: var(--header-solid);
    }
    .reader-now { font-size: 0.88rem; }
    /* Added to the header's scroll-padding: clears the sticky chapter bar. */
    .section-anchor { scroll-margin-top: 72px; }

    .prose { font-size: 1rem; line-height: 1.7; }
    .prose h2 { margin-bottom: 16px; font-size: 1.6rem; }
    .prose h3 { margin-top: 26px; font-size: 1.12rem; }
    .callout { padding: 14px 14px 14px 42px; font-size: 0.93rem; }
    .callout::before { left: 15px; top: 15px; }
    .box { padding: 18px; }
    .prose blockquote { padding: 14px 16px; font-size: 1rem; }
    .prose table { display: block; max-width: 100%; overflow-x: auto; font-size: 0.85rem; }
    .prose th, .prose td { min-width: 150px; padding: 10px 12px; }

    .reader-foot { gap: 12px; }
    .reader-foot .btn { padding: 12px 16px; font-size: 0.8rem; }

    .cta-strip { margin-top: 36px; padding: 24px 20px; }
    .cta-strip h3 { font-size: 1.4rem; }
    .cta-strip p { font-size: 0.92rem; }
}
