/* ==========================================================================
   Riman Agency v3.1: mega menu, book library, book pages, page index,
   two-column guides, checklists.
   ========================================================================== */

/* 1. Mega menu --------------------------------------------------------------- */
.mega-v2 { max-height: calc(100vh - var(--header-h)); overflow-y: auto; overscroll-behavior: contain; background: color-mix(in srgb, var(--surface) 94%, transparent); -webkit-backdrop-filter: saturate(170%) blur(28px); backdrop-filter: saturate(170%) blur(28px); box-shadow: 0 40px 80px -40px rgba(10, 16, 6, .45); }
.site-header.is-dark .mega-v2 { background: rgba(16, 20, 12, .94); }
.mega-bg { position: absolute; inset: 0; color: var(--brand); opacity: .1; pointer-events: none; -webkit-mask-image: radial-gradient(circle 420px at var(--mx, 85%) var(--my, 30%), #000, transparent 75%); mask-image: radial-gradient(circle 420px at var(--mx, 85%) var(--my, 30%), #000, transparent 75%); }
.mega-bg svg { width: 100%; height: 100%; }
.mega-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr) minmax(0, .85fr); gap: clamp(20px, 2.6vw, 40px); padding-block: 26px 30px; }
.mega-learn .mega-grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.5fr) minmax(0, .85fr); }
.mega-about .mega-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, .95fr); }
.mm-h { margin: 0 0 10px; font-size: .82rem; font-weight: 600; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.mm-h::before { content: ""; width: 14px; height: 2px; border-radius: 2px; background: var(--brand); }
.mm-rows { display: grid; gap: 2px; }
.mm-rows-2 { grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.mm-row { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 14px; color: var(--ink) !important; text-decoration: none !important; transition: background .2s, transform .3s var(--ease); }
.mm-row:hover, .mm-row:focus-visible, .mm-row.is-hot { background: color-mix(in srgb, var(--brand) 9%, transparent); transform: translateX(3px); }
[dir="rtl"] .mm-row:hover, [dir="rtl"] .mm-row.is-hot { transform: translateX(-3px); }
.mm-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--lime-50); color: var(--brand-700); transition: background .2s, color .2s, transform .3s var(--ease-out); }
.mm-ico svg { width: 19px; height: 19px; }
.mm-row:hover .mm-ico, .mm-row.is-hot .mm-ico { background: var(--brand); color: #fff; transform: rotate(-6deg) scale(1.05); }
.mm-txt b { display: block; font-size: .95rem; font-weight: 650; letter-spacing: -.01em; line-height: 1.25; }
.mm-txt b em, .mm-cat small { font-style: normal; font-weight: 600; font-size: .78rem; color: var(--ink-3); margin-inline-start: 4px; }
.mm-txt small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .8rem; line-height: 1.4; color: var(--ink-3); margin-top: 2px; }
.mm-row-s { padding-block: 6px; }
.mm-row-s .mm-ico { width: 30px; height: 30px; border-radius: 9px; }
.mm-row-s .mm-ico svg { width: 16px; height: 16px; }
.mm-row-s { grid-template-columns: 30px 1fr; }
.mm-also { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.mm-also > span { font-size: .82rem; color: var(--ink-3); font-weight: 600; margin-inline-end: 4px; }
.mm-also .chip { min-height: 30px; font-size: .82rem; border-radius: 999px; }
.mm-also .chip svg { width: 14px; height: 14px; }
.mm-preview { position: relative; min-height: 340px; border-radius: 22px; overflow: hidden; background: var(--forest); }
.mm-pv { position: absolute; inset: 0; opacity: 0; transform: scale(1.04); transition: opacity .45s var(--ease-out), transform .8s var(--ease-out); color: #fff !important; text-decoration: none !important; }
.mm-pv.is-on { opacity: 1; transform: none; }
.mm-pv img { width: 100%; height: 100%; object-fit: cover; }
.mm-pv::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, rgba(10, 14, 6, .88)); }
.mm-pv-cap { position: absolute; inset-inline: 18px; bottom: 18px; z-index: 1; display: grid; gap: 4px; }
.mm-pv-cap small { font-size: .78rem; opacity: .8; }
.mm-pv-cap b { font-size: 1.25rem; letter-spacing: -.02em; line-height: 1.2; }
.mm-pv-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mm-pv-links span { padding: 4px 9px; border-radius: 999px; background: rgba(255, 255, 255, .14); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); font-size: .74rem; font-weight: 600; }
.mm-start { display: grid; gap: 8px; align-content: start; }
.mm-card { position: relative; display: block; border-radius: 20px; overflow: hidden; min-height: 210px; color: #fff !important; text-decoration: none !important; background: var(--forest); }
.mm-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease-out); }
.mm-card:hover img { transform: scale(1.06); }
.mm-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 14, 6, .05) 20%, rgba(10, 14, 6, .9)); }
.mm-card > span { position: absolute; inset-inline: 16px; bottom: 14px; z-index: 1; display: grid; gap: 3px; }
.mm-card small { font-size: .76rem; opacity: .82; }
.mm-card b { font-size: 1.08rem; line-height: 1.25; letter-spacing: -.015em; }
.mm-card em { font-style: normal; font-size: .8rem; opacity: .8; }
.mm-mini { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--line); color: var(--ink) !important; text-decoration: none !important; transition: border-color .2s, background .2s; }
.mm-mini:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.mm-mini > svg { width: 20px; height: 20px; color: var(--brand-700); justify-self: center; }
.mm-mini b { display: block; font-size: .9rem; }
.mm-mini small { display: block; font-size: .78rem; color: var(--ink-3); }
.mm-cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mm-cat { display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; column-gap: 9px; align-items: center; padding: 9px; border-radius: 12px; border: 1px solid transparent; color: var(--ink) !important; text-decoration: none !important; transition: border-color .2s, background .2s; }
.mm-cat .mm-ico { width: 30px; height: 30px; border-radius: 9px; grid-row: span 2; }
.mm-cat .mm-ico svg { width: 16px; height: 16px; }
.mm-cat b { font-size: .84rem; line-height: 1.2; }
.mm-cat small { margin: 0; font-size: .74rem; }
.mm-cat:hover { border-color: var(--line-2); background: var(--bg-2); }
.mm-search { display: flex; align-items: center; gap: 8px; padding: 4px 12px; margin-bottom: 8px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); }
.mm-search svg { width: 16px; height: 16px; color: var(--ink-3); }
.mm-search input { flex: 1; min-width: 0; border: 0; background: none; padding: 8px 0; outline: none; font-size: .92rem; }
.mm-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--glow); }
.mm-shelf { list-style: none; margin: 4px 0 0; padding: 0 6px; display: flex; gap: 12px; align-items: flex-end; perspective: 900px; }
.mm-shelf li { flex: 0 0 auto; width: clamp(54px, 5.4vw, 74px); }
.mm-shelf a { display: block; transform: rotateY(-16deg); transform-origin: left center; transition: transform .5s var(--ease-out); }
.mm-shelf a:hover, .mm-shelf a:focus-visible { transform: rotateY(0) translateY(-10px) scale(1.06); }
.mm-plank { height: 12px; margin: -2px 0 14px; border-radius: 3px; background: linear-gradient(180deg, #a0754b, #6c4a2c); box-shadow: 0 10px 18px -8px rgba(40, 25, 10, .5); }
.mm-shelves { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.mm-posts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.mm-post { display: grid; gap: 8px; color: var(--ink) !important; text-decoration: none !important; }
.mm-post-img { display: block; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: var(--bg-2); }
.mm-post-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease-out); }
.mm-post:hover img { transform: scale(1.06); }
.mm-post small { font-size: .74rem; color: var(--brand-700); font-weight: 600; }
.mm-post b { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: .88rem; line-height: 1.35; }
.mm-founder-card { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; padding: 14px; border-radius: 20px; background: var(--forest); color: #f3f6ec !important; text-decoration: none !important; }
.mm-founder-img { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; border: 3px solid rgba(198, 224, 143, .5); }
.mm-founder-img img { width: 100%; height: 100%; object-fit: cover; }
.mm-founder-card small { font-size: .76rem; color: #c6e08f; }
.mm-founder-card b { display: block; font-size: 1.15rem; }
.mm-founder-card em { display: block; font-style: normal; font-size: .82rem; opacity: .78; margin-top: 2px; }
.mm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 0; }
.mm-stats div { padding: 10px; border-radius: 12px; border: 1px solid var(--line); }
.mm-stats dt { font-size: 1.4rem; font-weight: 800; letter-spacing: -.03em; color: var(--brand-700); }
.mm-stats dd { margin: 0; font-size: .74rem; color: var(--ink-3); line-height: 1.3; }
.mm-office { position: relative; display: grid; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 8px; overflow: hidden; }
.mm-office-art { position: absolute; inset-inline-end: -10px; bottom: -6px; width: 60%; color: var(--brand); opacity: .35; }
.mm-office-art svg { width: 100%; height: 50px; }
.mm-office b { font-size: .92rem; }
.mm-office small { font-size: .78rem; color: var(--ink-3); }
.mm-office time { font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }
.mm-social { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: .85rem; }
.mm-social a:not(:last-child) { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); color: var(--ink) !important; }
.mm-social svg { width: 14px; height: 14px; fill: currentColor; }
@keyframes mm-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.nav-item.is-open .mm-row, .nav-item.is-open .mm-cat, .nav-item.is-open .mm-post, .nav-item.is-open .mm-shelf li, .nav-item.is-open .mm-card, .nav-item.is-open .mm-mini, .nav-item.is-open .mm-preview, .nav-item.is-open .mm-founder-card, .nav-item.is-open .mm-office { animation: mm-in .5s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 30ms + 70ms); }
.nav-item.is-open .mm-start, .nav-item.is-open .mm-offices { --i: 4; }
@media (max-width: 1280px) { .mm-rows-2 { grid-template-columns: 1fr; } .mm-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .mm-posts { grid-template-columns: 1fr 1fr; } .mm-posts .mm-post:nth-child(3) { display: none; } }

/* 2. Mobile drawer ------------------------------------------------------------- */
.mobile-v2 .m-search { display: flex; align-items: center; gap: 10px; width: 100%; margin: 10px 0 6px; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-3); font-size: 1rem; text-align: start; cursor: pointer; }
.mobile-v2 .m-search svg { width: 18px; height: 18px; }
.mobile-v2 .m-search span { flex: 1; }
.mobile-v2 .m-rows { display: grid; gap: 2px; margin: 0 0 12px; }
.mobile-v2 .mm-row { padding-inline: 4px; }
.mobile-v2 .m-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.mobile-v2 .m-cats a { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 12px; background: var(--bg-2); color: var(--ink) !important; text-decoration: none; font-size: .9rem; font-weight: 600; }
.mobile-v2 .m-cats svg { width: 16px; height: 16px; color: var(--brand-700); flex: none; }
.mobile-v2 .m-all { display: inline-block; margin: 0 0 16px; font-weight: 700; color: var(--brand-700) !important; }
.mobile-v2 .m-books { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 14px; list-style: none; margin: 0; scroll-snap-type: x mandatory; }
.mobile-v2 .m-books li { flex: 0 0 72px; scroll-snap-align: start; }
.mobile-v2 .m-cta { display: flex; width: 100%; margin-top: 18px; min-height: 52px; font-size: 1rem; }

/* 3. Book covers ----------------------------------------------------------------- */
.bk-cover { position: relative; display: block; aspect-ratio: 2 / 3; border-radius: 3px 8px 8px 3px; overflow: hidden; box-shadow: inset 4px 0 0 rgba(255, 255, 255, .1), inset 6px 0 10px rgba(0, 0, 0, .25), 0 14px 26px -12px rgba(15, 20, 8, .55); background: #ddd; }
.bk-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bk-cover.is-drawn { background: linear-gradient(150deg, var(--c1), var(--c2)); color: #fff; padding: 12% 10%; display: flex; flex-direction: column; justify-content: space-between; text-align: start; }
.bk-cover.is-drawn::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 80% 10%, rgba(255, 255, 255, .18), transparent 45%); pointer-events: none; }
.bk-cover.is-drawn small { font-size: .55em; opacity: .7; position: relative; }
.bk-cover.is-drawn b { font-size: .8em; line-height: 1.15; letter-spacing: -.01em; position: relative; }
.bk-cover.is-drawn i { font-style: normal; font-size: .5em; opacity: .8; position: relative; }
.bk-cover::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 6%; background: linear-gradient(90deg, rgba(0, 0, 0, .25), rgba(255, 255, 255, .08), transparent); pointer-events: none; }
[dir="rtl"] .bk-cover::after { inset-inline-start: auto; left: 0; }
.mm-shelf .bk-cover, .m-books .bk-cover { font-size: 9px; }
.book-strip { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; flex-wrap: wrap; }
.book-strip li { width: 92px; }
.book-strip-lg { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 28px 22px; }
.book-strip-lg li { width: auto; }
.book-strip-lg a { display: grid; gap: 10px; color: var(--ink) !important; text-decoration: none; font-weight: 600; font-size: .92rem; line-height: 1.3; }
.book-strip-lg .bk-cover { font-size: 14px; transition: transform .5s var(--ease-out); }
.book-strip-lg a:hover .bk-cover { transform: translateY(-8px) rotate(-1.5deg); }

/* 4. The library ---------------------------------------------------------------- */
.lib-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin-bottom: 30px; position: sticky; top: calc(var(--header-h) + 10px); z-index: 5; padding: 10px 12px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.lib-bar .chip { border-radius: 999px; }
.lib-search { display: flex; align-items: center; gap: 8px; padding: 2px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); min-width: min(260px, 100%); }
.lib-search svg { width: 16px; height: 16px; color: var(--ink-3); }
.lib-search input { border: 0; background: none; padding: 8px 0; outline: none; flex: 1; min-width: 0; }
@media (max-width: 720px) { .lib-bar { border-radius: 20px; position: static; } .lib-bar .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; } .lib-search { width: 100%; } }
.shelf { margin-bottom: 46px; scroll-margin-top: calc(var(--header-h) + 90px); }
.shelf[hidden] { display: none; }
.shelf-head { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.shelf-thumb { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; flex: none; border: 3px solid var(--surface); box-shadow: var(--shadow-2); }
.shelf-thumb img { width: 100%; height: 100%; object-fit: cover; }
.shelf-head h3 { margin: 0; font-size: 1.3rem; }
.shelf-head h3 small { font-size: .85rem; color: var(--ink-3); font-weight: 600; }
.shelf-head p { margin: 2px 0 0; color: var(--ink-3); font-size: .95rem; }
.shelf-row { list-style: none; margin: 0; padding: 30px 18px 0; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 26px 22px; perspective: 1400px; }
.shelf-book { width: clamp(96px, 10.5vw, 138px); display: grid; gap: 10px; }
.shelf-book[hidden] { display: none; }
.shelf-pull { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; transform-style: preserve-3d; transform: rotateY(-24deg); transform-origin: left center; transition: transform .6s var(--ease-out); border-radius: 4px 8px 8px 4px; }
[dir="rtl"] .shelf-pull { transform: rotateY(24deg); transform-origin: right center; }
.shelf-pull .bk-cover { font-size: clamp(11px, 1.15vw, 15px); }
.bk-spine { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: 16px; transform: rotateY(90deg) translateZ(-8px); transform-origin: left; background: linear-gradient(90deg, var(--c1, #2c3c12), color-mix(in srgb, var(--c1, #2c3c12) 70%, #000)); filter: brightness(.8); }
.shelf-pull:hover, .shelf-pull:focus-visible, .shelf-book.is-hover .shelf-pull { transform: rotateY(0) translateY(-16px) translateZ(40px); }
.shelf-pull:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.shelf-label { font-size: .82rem; font-weight: 600; line-height: 1.3; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .8; transition: opacity .3s; }
.shelf-book:hover .shelf-label { opacity: 1; }
.shelf-plank { height: 22px; margin: -4px 0 0; border-radius: 4px; background: linear-gradient(180deg, #b3895c 0%, #8c6640 55%, #5e4228 100%); box-shadow: 0 18px 28px -14px rgba(40, 25, 10, .55), inset 0 2px 0 rgba(255, 255, 255, .25); position: relative; }
.shelf-plank::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .03) 0 2px, transparent 2px 9px); border-radius: inherit; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .shelf-plank { filter: brightness(.7); } }
:root[data-theme="dark"] .shelf-plank { filter: brightness(.7); }

/* Reader dialog */
.reader { width: min(1080px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 0; border-radius: 28px; background: var(--surface); color: var(--ink); box-shadow: 0 60px 120px -40px rgba(0, 0, 0, .6); overflow: auto; }
.reader::backdrop { background: rgba(10, 14, 6, .62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.reader[open] { animation: reader-in .5s var(--ease-out); }
@keyframes reader-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }
.reader-in { position: relative; display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: clamp(20px, 4vw, 48px); padding: clamp(22px, 4vw, 48px); }
.reader-close { position: absolute; top: 14px; inset-inline-end: 14px; z-index: 3; background: var(--bg-2); }
.reader-book { display: grid; place-items: center; min-height: 380px; perspective: 1800px; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 70%); border-radius: 20px; padding: 20px; }
.rb-3d { position: relative; width: min(250px, 60vw); aspect-ratio: 2 / 3; transform-style: preserve-3d; transform: rotateY(-14deg) rotateX(4deg); transition: transform .9s var(--ease-out); }
.reader.is-open .rb-3d { transform: rotateY(-4deg) translateX(18%); }
[dir="rtl"] .reader.is-open .rb-3d { transform: rotateY(4deg) translateX(-18%); }
.rb-cover { position: absolute; inset: 0; z-index: 2; transform-origin: left center; transition: transform 1.1s cubic-bezier(.3, .1, .2, 1) .25s; backface-visibility: hidden; }
.rb-cover .bk-cover { width: 100%; height: 100%; font-size: 18px; }
.reader.is-open .rb-cover { transform: rotateY(-155deg); }
[dir="rtl"] .rb-cover { transform-origin: right center; }
[dir="rtl"] .reader.is-open .rb-cover { transform: rotateY(155deg); }
.rb-page { position: absolute; inset: 0; z-index: 1; padding: 14% 12%; border-radius: 2px 8px 8px 2px; background: linear-gradient(90deg, #ece5d6, #faf6ec 12%, #fbf8f0); color: #3a3428; box-shadow: 0 20px 40px -18px rgba(0, 0, 0, .5); overflow: hidden; font-family: Georgia, "Times New Roman", serif; }
.rb-first { margin: 0; font-size: .86rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 12; -webkit-box-orient: vertical; overflow: hidden; }
.rb-first::first-letter { font-size: 2.4em; float: left; line-height: .9; margin: 4px 6px 0 0; color: var(--brand-700); }
.rb-pages { position: absolute; top: 2%; bottom: 2%; inset-inline-end: -8px; width: 8px; background: repeating-linear-gradient(180deg, #e9e2d2 0 1px, #fbf8f0 1px 3px); border-radius: 0 3px 3px 0; }
.reader-info h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin: 0 0 6px; }
.reader-sub { color: var(--ink-2); font-size: 1.05rem; margin: 0 0 10px; }
.reader-meta { color: var(--ink-3); font-size: .9rem; margin: 0 0 14px; }
.reader-desc { color: var(--ink-2); line-height: 1.7; max-height: 15em; overflow: auto; }
.reader-links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 16px; }
.reader-links a[hidden] { display: none; }
.reader-nav { display: flex; gap: 8px; margin-top: 22px; }
.reader-nav button { border: 1px solid var(--line-2); }
.reader-nav [data-r-prev] svg { transform: rotate(90deg); }
.reader-nav [data-r-next] svg { transform: rotate(-90deg); }
[dir="rtl"] .reader-nav [data-r-prev] svg { transform: rotate(-90deg); }
[dir="rtl"] .reader-nav [data-r-next] svg { transform: rotate(90deg); }
@media (max-width: 760px) { .reader-in { grid-template-columns: 1fr; } .reader-book { min-height: 300px; } }

/* 5. Book page -------------------------------------------------------------------- */
.book-hero-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); gap: clamp(24px, 5vw, 80px); align-items: end; }
.book-hero h1 { max-width: 20ch; }
.book-hero-cover { justify-self: center; width: min(300px, 70vw); }
.bk-big { font-size: 22px; box-shadow: 0 50px 80px -30px rgba(0, 0, 0, .8), inset 6px 0 12px rgba(0, 0, 0, .3); }
@media (max-width: 860px) { .book-hero-grid { grid-template-columns: 1fr; } .book-hero-cover { width: 200px; justify-self: start; } }
.twocol { display: grid; grid-template-columns: minmax(240px, .38fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.twocol-aside { position: sticky; top: calc(var(--header-h) + 28px); }
@media (max-width: 860px) { .twocol { grid-template-columns: 1fr; } .twocol-aside { position: static; } }
.buybox { display: grid; gap: 16px; padding: 22px; border-radius: 24px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-2); }
.buybox .bk-mini { width: 120px; font-size: 11px; }
.facts { margin: 0; display: grid; gap: 0; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; font-weight: 600; text-align: end; }
.buybox-btns { display: grid; gap: 8px; }
.buybox-btns .btn { width: 100%; }
.prose-v3 p { font-size: 1.08rem; line-height: 1.75; color: var(--ink-2); max-width: 68ch; }
.note-card { margin: 28px 0; padding: 22px 24px; border-radius: 20px; background: var(--lime-50); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); }
.note-card h3 { margin: 0 0 6px; }

/* 6. Page index (sticky "On this page") ------------------------------------------- */
.pindex { position: sticky; top: var(--header-h); z-index: 50; background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: saturate(170%) blur(16px); backdrop-filter: saturate(170%) blur(16px); border-bottom: 1px solid var(--line); }
.pindex .wrap { display: flex; align-items: center; gap: 14px; }
.pindex-label { flex: none; font-size: .82rem; font-weight: 700; color: var(--ink-3); }
.pindex ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
.pindex ol::-webkit-scrollbar { display: none; }
.pindex a { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 13px 10px; font-size: .86rem; font-weight: 600; color: var(--ink-3) !important; text-decoration: none; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.pindex a:hover { color: var(--ink) !important; }
.pindex a.is-active { color: var(--brand-700) !important; border-bottom-color: var(--brand); }
.pindex-bar { position: absolute; inset-inline-start: 0; bottom: -1px; height: 2px; width: 100%; background: var(--brand); transform: scaleX(var(--pi, 0)); transform-origin: left; opacity: .35; }
[dir="rtl"] .pindex-bar { transform-origin: right; }
.section[id], .cine-hero + .section { scroll-margin-top: calc(var(--header-h) + 60px); }

/* 7. Guide (two-column long-form) and checklist ------------------------------------- */
.guide { display: grid; grid-template-columns: minmax(200px, .32fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 80px); align-items: start; }
.guide-nav { position: sticky; top: calc(var(--header-h) + 76px); }
.guide-nav ol { list-style: none; margin: 18px 0 0; padding: 0; counter-reset: gn; border-inline-start: 2px solid var(--line); }
.guide-nav li { counter-increment: gn; }
.guide-nav a { display: grid; grid-template-columns: 28px 1fr; gap: 6px; padding: 9px 14px; margin-inline-start: -2px; border-inline-start: 2px solid transparent; color: var(--ink-3) !important; text-decoration: none; font-weight: 600; font-size: .93rem; transition: color .2s, border-color .2s; }
.guide-nav a::before { content: counter(gn, decimal-leading-zero); font-variant-numeric: tabular-nums; font-size: .78rem; opacity: .7; padding-top: 2px; }
.guide-nav a.is-active { color: var(--ink) !important; border-inline-start-color: var(--brand); }
.guide-body { display: grid; gap: clamp(36px, 5vw, 56px); }
.guide-part { scroll-margin-top: calc(var(--header-h) + 80px); }
.guide-part > h3 { font-size: clamp(1.25rem, 2vw, 1.55rem); margin: 0 0 6px; }
.guide-part > p { color: var(--ink-2); font-size: 1.04rem; max-width: 66ch; }
.guide-fig { margin: 14px 0 18px; border-radius: 20px; overflow: hidden; aspect-ratio: 16 / 8; }
.guide-fig img { width: 100%; height: 100%; object-fit: cover; }
.terms { margin: 14px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.terms div { padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.terms dt { font-weight: 700; margin-bottom: 4px; }
.terms dd { margin: 0; color: var(--ink-3); font-size: .94rem; line-height: 1.55; }
.cols-2 { columns: 2; column-gap: 32px; padding: 0; margin: 14px 0 0; list-style: none; }
.cols-2 li { break-inside: avoid; position: relative; padding: 10px 0 10px 28px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
[dir="rtl"] .cols-2 li { padding: 10px 28px 10px 0; }
.cols-2 li::before { content: ""; position: absolute; inset-inline-start: 2px; top: 1.05em; width: 12px; height: 12px; border-radius: 3px; background: var(--brand); opacity: .75; transform: rotate(45deg); }
.cols-2.is-warn li::before { background: #c86a4a; border-radius: 50%; transform: none; width: 10px; height: 10px; }
.cols-2 li b { color: var(--ink); }
@media (max-width: 860px) { .guide { grid-template-columns: 1fr; } .guide-nav { position: static; } .terms { grid-template-columns: 1fr; } .cols-2 { columns: 1; } }
.check { margin-top: 14px; padding: 20px 22px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); }
.check-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; font-weight: 700; }
.check-bar { flex: 1; max-width: 220px; height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.check-bar i { display: block; height: 100%; width: calc(var(--done, 0) * 100%); background: linear-gradient(90deg, var(--lime), var(--brand-700)); transition: width .5s var(--ease-out); }
.check ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.check label { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 8px 0; cursor: pointer; color: var(--ink-2); }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--brand); }
.check input:checked + span { color: var(--ink-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--brand) 60%, transparent); }
.check-out { margin: 12px 0 0; font-size: .92rem; color: var(--ink-3); }
@media (max-width: 640px) { .check ul { grid-template-columns: 1fr; } }

/* 8. Illustration split (photo-real concept objects) ----------------------------------- */
.media-frame.is-ill { aspect-ratio: 4 / 3; background: #e9e6df; }

/* 9. Reduced motion --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .nav-item.is-open .mm-row, .nav-item.is-open .mm-cat, .nav-item.is-open .mm-post, .nav-item.is-open .mm-shelf li, .nav-item.is-open .mm-card, .nav-item.is-open .mm-mini, .nav-item.is-open .mm-preview, .nav-item.is-open .mm-founder-card, .nav-item.is-open .mm-office { animation: none; }
  .shelf-pull, .rb-3d, .rb-cover { transition: none; }
}
html.a11y-still .nav-item.is-open .mm-row, html.a11y-still .nav-item.is-open .mm-cat, html.a11y-still .nav-item.is-open .mm-post, html.a11y-still .nav-item.is-open .mm-shelf li, html.a11y-still .nav-item.is-open .mm-card { animation: none; }
html.a11y-still .shelf-pull, html.a11y-still .rb-3d, html.a11y-still .rb-cover { transition: none; }

/* 10. Compact cinematic heroes (posts, topics, tools, legal) ------------------------------ */
.cine-hero-compact, .cine-hero-post { min-height: min(62svh, 560px); }
.cine-hero-post h1 { font-size: clamp(2rem, 4.4vw, 3.5rem); max-width: 24ch; }
.cine-hero-compact h1 { font-size: clamp(2rem, 4.6vw, 3.6rem); }
.cine-hero .meta { display: flex; flex-wrap: wrap; gap: 8px; color: rgba(245, 245, 240, .78); font-size: .95rem; margin-top: 10px; }
.tag-hero { display: inline-block; margin-bottom: 14px; padding: 5px 12px; border-radius: 999px; background: rgba(131, 168, 61, .22); border: 1px solid rgba(131, 168, 61, .5); color: #d9efb0 !important; text-decoration: none; font-size: .82rem; font-weight: 700; }
.cine-hero-tool .ti-big { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: rgba(131, 168, 61, .2); color: #c6e08f; margin-bottom: 16px; border: 1px solid rgba(198, 224, 143, .3); }
.cine-hero-tool .ti-big svg { width: 32px; height: 32px; }
.cine-hero .tool-private { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.cine-hero .tool-private span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); color: #eef3e4; font-size: .85rem; }
.cine-hero .tool-private svg { width: 14px; height: 14px; fill: none; stroke: #c6e08f; stroke-width: 3; }
.cine-hero-plain .cine-media { background: radial-gradient(120% 90% at 70% 20%, #2a3a14 0%, var(--forest) 60%); }

/* 11. Remote (Amazon) covers sit over the drawn fallback */
.bk-cover.has-remote > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; background: transparent; color: transparent; }
.bk-cover.has-remote::after { z-index: 2; }
.book-row-real .bk-home { font-size: clamp(11px, 1.2vw, 15px); transition: transform .6s var(--ease-out); }
.book-row-real a:hover .bk-home { transform: translateY(-6px) rotate(-1deg); }
.rel-book .bk-rel { max-width: 180px; font-size: 13px; }
/* Mega shelf: shrink covers to fit the column instead of spilling into the next one */
.mm-shelf { overflow: clip; overflow-clip-margin: 16px; padding-top: 14px; gap: clamp(6px, .8vw, 12px); }
.mm-shelf li { flex: 1 1 0; min-width: 0; width: auto; max-width: 74px; }
.lib-bar .chip { white-space: nowrap; }
@media (max-width: 760px) {
  .lib-bar .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; padding: 2px 4px 6px; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .lib-bar .chips::-webkit-scrollbar { display: none; }
  .lib-bar .chip { flex: 0 0 auto; }
}
@media (max-width: 760px) { [dir="rtl"] .lib-bar .chips { -webkit-mask-image: linear-gradient(270deg, #000 85%, transparent); mask-image: linear-gradient(270deg, #000 85%, transparent); } }

/* 12. Solid mega menu: one plain colour per theme, never see-through, whatever sits behind it */
.mega, .mega-v2, .site-header.is-dark .mega, .site-header.is-dark .mega-v2 { -webkit-backdrop-filter: none; backdrop-filter: none; }
.mega, .mega-v2, .site-header.is-dark .mega, .site-header.is-dark .mega-v2,
.site-header.menu-open, .site-header.is-dark.menu-open {
  background: #ffffff;
  color: #222222; --ink: #222222; --ink-2: #444444; --ink-3: #5f5f5f; --line: #e1e1e1; --bg-2: #f6f7f4; --surface: #ffffff;
}
.site-header.menu-open, .site-header.is-dark.menu-open { border-bottom-color: #e1e1e1; }
.mega-v2 { border-top: 1px solid var(--line); }
.site-header.is-dark.menu-open .logo-on-light { display: block; }
.site-header.is-dark.menu-open .logo-on-dark { display: none; }
.mega-scrim { position: absolute; top: calc(100% + 1px); inset-inline: 0; bottom: auto; height: 100vh; background: rgba(0, 0, 0, .32); -webkit-backdrop-filter: none; backdrop-filter: none; pointer-events: none; }
.site-header.menu-open .mega-scrim { pointer-events: auto; }
/* No colour fade on the bar while a menu opens or switches: that fade read as flicker */
.site-header.menu-open, .site-header.menu-open .nav-link, .site-header.menu-open .brand img { transition: none; }
.nav-item.is-open > .mega { transition: opacity .18s var(--ease), visibility 0s; transform: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mega, :root:not([data-theme="light"]) .site-header .mega-v2,
  :root:not([data-theme="light"]) .site-header.menu-open, :root:not([data-theme="light"]) .site-header.is-dark.menu-open {
    background: #1b1d19; color: #f2f2ef; --ink: #f2f2ef; --ink-2: #d0d3cb; --ink-3: #a4a79f; --line: rgba(255, 255, 255, .12); --bg-2: #23261f; --surface: #1f221d;
  }
  :root:not([data-theme="light"]) .site-header.menu-open, :root:not([data-theme="light"]) .site-header.is-dark.menu-open { border-bottom-color: rgba(255, 255, 255, .12); }
  :root:not([data-theme="light"]) .site-header.menu-open .logo-on-light { display: none; }
  :root:not([data-theme="light"]) .site-header.menu-open .logo-on-dark { display: block; }
}
:root[data-theme="dark"] .mega, :root[data-theme="dark"] .site-header .mega-v2,
:root[data-theme="dark"] .site-header.menu-open, :root[data-theme="dark"] .site-header.is-dark.menu-open {
  background: #1b1d19; color: #f2f2ef; --ink: #f2f2ef; --ink-2: #d0d3cb; --ink-3: #a4a79f; --line: rgba(255, 255, 255, .12); --bg-2: #23261f; --surface: #1f221d;
}
:root[data-theme="dark"] .site-header.menu-open, :root[data-theme="dark"] .site-header.is-dark.menu-open { border-bottom-color: rgba(255, 255, 255, .12); }
:root[data-theme="dark"] .site-header.menu-open .logo-on-light { display: none; }
:root[data-theme="dark"] .site-header.menu-open .logo-on-dark { display: block; }
.site-header.menu-open .nav-item:not(.is-open) > .mega { transition: none; opacity: 0; visibility: hidden; }
.site-header.mm-instant .mega { transition: none !important; }

/* 13. Main nav: the label is a link, the chevron opens the panel */
.nav-item { display: flex; align-items: center; }
.nav-item > .nav-link { padding-inline: 13px 2px; }
.nav-caret { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 30px; margin-inline-end: 6px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--ink-2); cursor: pointer; opacity: .85; }
.nav-caret:hover, .nav-item.is-open > .nav-caret { color: var(--ink); opacity: 1; }
.nav-caret:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.nav-caret svg { width: 9px; height: 9px; transition: transform .25s var(--ease); }
.nav-item.is-open > .nav-caret svg { transform: rotate(180deg); }
.nav-link[aria-current="page"] { color: var(--ink) !important; box-shadow: inset 0 -2px 0 var(--brand); }
/* Library: no wooden plank, so nothing sits over the titles */
.lib .shelf-plank { display: none; }
.lib .shelf { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.lib .shelf:last-of-type { border-bottom: 0; }
.lib-bar { border-radius: 22px; }
/* English titles inside Arabic pages keep their own word order ("10 Truths About...", "500 Ways...") */
[dir="rtl"] [lang="en"] { unicode-bidi: plaintext; }
