/* Wazo — public site. Mobile first. Tokens from the approved mockup. */

@font-face { font-family: "DM Serif Display"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/assets/fonts/dm-serif-display-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "DM Serif Display"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/assets/fonts/dm-serif-display-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Manrope; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/fonts/manrope-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Manrope; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/fonts/manrope-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #111214;
  --surface: #18191C;
  --surface-2: #1F2024;
  --border: #26272B;
  --text: #F2EEE6;
  --text-muted: #B9B5AC;
  --text-subtle: #A7A39B;
  --accent: #E8A33D;
  --accent-text: #E8A33D;
  --on-accent: #1A1408;
  --ok: #7CC49A;
  --font-body: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* One font for the whole platform (titles, covers, writing): Manrope. Only the Wazo•
     logo keeps its serif. To go back to serif titles and writing, use
     --font-display: "DM Serif Display", Georgia, serif; --font-serif: Georgia, serif;
     --display-weight: 400. */
  --font-display: var(--font-body);
  --font-serif: var(--font-body);
  --display-weight: 700;
  --font-logo: "DM Serif Display", Georgia, "Times New Roman", serif;
  --reading-size: 1.15rem;
  --gutter: 1rem;
  --radius: 10px;
  --header-h: 3.5rem;
  --bottom-nav-h: 3.75rem;
  color-scheme: dark;
}

/* Reading themes (chosen by the reader on reading pages) */
:root[data-theme="light"] {
  --bg: #FBF8F2; --surface: #FFFFFF; --surface-2: #F1ECE2; --border: #E2DCCF;
  --text: #1E1A14; --text-muted: #57524A; --text-subtle: #635D53; --accent-text: #8A5A12; color-scheme: light;
}
:root[data-theme="sepia"] {
  --bg: #F4ECD8; --surface: #FBF4E4; --surface-2: #EADFC4; --border: #D9CBA8;
  --text: #3B2F1E; --text-muted: #5E4F37; --text-subtle: #6A5A40; --accent-text: #7E5310; color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 1rem; line-height: 1.6; padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { body { padding-bottom: 0; } }
img { max-width: 100%; height: auto; }
a { color: var(--accent-text); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2 { font-family: var(--font-display); font-weight: var(--display-weight); line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 7vw, 3rem); margin: 0 0 0.75rem; }
h2 { font-size: clamp(1.4rem, 4.5vw, 1.8rem); margin: 0; }
.muted { color: var(--text-muted); }
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 40rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 0.5rem; top: -3rem; z-index: 100; padding: 0.5rem 1rem; background: var(--accent); color: var(--on-accent); border-radius: 6px; }
.skip-link:focus { top: 0.5rem; }

/* Buttons */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 44px; padding: 0.6rem 1.3rem; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.button-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.button-small { min-height: 40px; padding: 0.4rem 1rem; font-size: 0.9rem; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 1rem; height: var(--header-h); }
.logo { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--font-logo); font-size: 1.6rem; color: var(--text); text-decoration: none; line-height: 1; }
/* The wazo logo: the saffron dot sits at the vertical centre of the letters, at every size */
.logo-dot { display: inline-block; flex: none; width: 0.24em; height: 0.24em; margin-left: 0.08em; border-radius: 50%; background: var(--accent); transform: translateY(0.066em); }
.top-nav { display: none; gap: 0.25rem; }
.top-nav a { padding: 0.5rem 0.75rem; border-radius: 999px; color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.top-nav a:hover, .top-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 0.25rem; }
.icon-btn, .lang-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 0.85rem; }
.is-switching body { opacity: 0.55; transition: opacity 0.15s; }
.icon-btn:hover, .lang-btn:hover { background: var(--surface-2); }
.icon-btn svg, .bottom-nav svg { width: 22px; height: 22px; }
@media (min-width: 900px) { .top-nav { display: flex; } .header-search { display: inline-flex; } }
.header-search { display: none; }
.header-write { display: none; align-items: center; min-height: 40px; padding: 0 0.9rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.header-write:hover, .header-write[aria-current="page"] { border-color: var(--accent); color: var(--accent-text); }
@media (min-width: 900px) { .header-write { display: inline-flex; } }

/* Bottom navigation (phones) */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem; color: var(--text-muted); text-decoration: none; font-size: 0.75rem; font-weight: 600; }
.bottom-nav a[aria-current="page"] { color: var(--accent-text); }
@media (min-width: 900px) { .bottom-nav { display: none; } }

/* Footer */
.site-footer { margin-top: 4rem; padding: 2rem 0 2.5rem; border-top: 1px solid var(--border); color: var(--text-subtle); font-size: 0.9rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; display: inline-block; padding: 0.4rem 0; }
.footer-links a:hover { color: var(--text); }

/* Hero */
.hero-label { margin: 0 0 0.25rem; color: var(--accent-text); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* Rows of cards (swipe sideways) */
.row { margin-top: 2rem; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.row-head a { color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; white-space: nowrap; padding: 0.5rem 0; }
.row-head a:hover { color: var(--accent-text); }
.row-scroller { display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: 0.85rem; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 0.25rem; list-style: none; }
.row-scroller::-webkit-scrollbar { display: none; }
.row-scroller > li { scroll-snap-align: start; }
@media (min-width: 600px) { .row-scroller { grid-auto-columns: 27%; } }
@media (min-width: 900px) { .row-scroller { grid-auto-columns: calc((100% - 5 * 0.85rem) / 6); margin: 0; padding: 0 0 0.25rem; } }

/* Grid (category, author, search pages) */
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 0.85rem; list-style: none; margin: 0; padding: 0; }
@media (min-width: 600px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .card-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* Cards and covers */
.card { display: block; color: var(--text); text-decoration: none; }
.card:hover .card-title { color: var(--accent-text); }
.card-title { margin: 0.55rem 0 0.1rem; font-weight: 700; font-size: 0.95rem; line-height: 1.3; overflow-wrap: anywhere; }
.card-meta { margin: 0; color: var(--text-subtle); font-size: 0.8rem; }
.cover { position: relative; display: flex; flex-direction: column; justify-content: space-between; aspect-ratio: 2 / 3; width: 100%; overflow: hidden; border-radius: 8px; padding: 0.8rem; box-shadow: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 8px 24px rgb(0 0 0 / 0.25); }
/* A picture cover always fills the whole card (inner margins are only for typed covers) */
img.cover { padding: 0 !important; object-fit: cover; object-position: center; background: var(--surface); }
.cover-cat { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.85; }
.cover-text { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: -0.01em; line-height: 1.14; text-wrap: balance; overflow-wrap: break-word; overflow: hidden; }
.cover-text-l { font-size: clamp(1.35rem, 6vw, 1.85rem); }
.cover-text-m { font-size: clamp(1.1rem, 4.6vw, 1.45rem); }
.cover-text-s { font-size: clamp(0.92rem, 3.8vw, 1.15rem); }
.book-cover .cover-text-l { font-size: clamp(1.6rem, 7vw, 2.4rem); }
.book-cover .cover-text-m { font-size: clamp(1.3rem, 5vw, 1.8rem); }
.book-cover div.cover { padding: 1.25rem; }
.cover-mark { align-self: flex-start; display: inline-flex; align-items: center; font-family: var(--font-logo); font-size: 0.85rem; line-height: 1; opacity: 0.85; }
.book-cover .cover-mark { font-size: 1.1rem; }
.cover-c3 .logo-dot { background: currentColor; }
.cover-c0 { background: #2B3A55; color: #F2EEE6; }
.cover-c1 { background: #6B2E2E; color: #F7EFE2; }
.cover-c2 { background: #2F4A3A; color: #F2EEE6; }
.cover-c3 { background: #E8A33D; color: #1A1408; }
.cover-c4 { background: #3D3550; color: #F2EEE6; }
.cover-c5 { background: #E9DFCB; color: #1E1A14; }

/* Page headings and pagination */
.page-head { padding: 2rem 0 1.25rem; }
.page-head p { margin: 0; color: var(--text-muted); }
.pager { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; align-items: center; margin: 2.5rem 0 0; }
.pager a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 1rem; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--text); }
.empty { padding: 3rem 0; text-align: center; color: var(--text-muted); }

/* Reading page */
.reading { max-width: 40rem; margin: 0 auto; padding: 1.5rem var(--gutter) 2rem; }
.piece-category { margin: 0 0 0.5rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.piece-category a { color: var(--accent-text); text-decoration: none; }
.piece-title { margin-bottom: 0.5rem; font-size: calc(var(--reading-size) * 1.85); }   /* A− / A+ size the title with the writing */
.piece-subtitle { margin: 0 0 0.75rem; font-size: var(--reading-size); color: var(--text-muted); }
.piece-meta { margin: 0 0 1.25rem; font-size: 0.9rem; color: var(--text-subtle); }
.piece-meta a { color: var(--text-muted); }
.piece-cover { display: block; width: 100%; max-width: 22rem; height: auto; margin: 0 auto 2rem; border-radius: 8px; }
.piece-body { font-size: var(--reading-size); line-height: 1.8; overflow-wrap: break-word; }
.font-serif .piece-body { font-family: var(--font-serif); }
.font-display .piece-body { font-family: var(--font-display); font-size: calc(var(--reading-size) * 1.08); line-height: 1.6; }
.font-sans .piece-body { font-family: var(--font-body); }
.piece-body p { margin: 0 0 1.25em; }
.piece-body h2 { font-size: 1.5em; margin: 2em 0 0.75em; }
.piece-body h3 { font-family: var(--font-body); font-size: 1.1em; margin: 1.75em 0 0.5em; }
.piece-body blockquote { margin: 1.5em 0; padding-left: 1em; border-left: 3px solid var(--accent); color: var(--text-muted); }
.piece-body hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em auto; width: 40%; }
.piece-body ul, .piece-body ol { padding-left: 1.4em; }
.piece-body-mashairi p, .piece-body-tungo p { margin-bottom: 1.6em; }
.piece-body-tungo { font-family: var(--font-display); font-weight: 600; font-size: calc(var(--reading-size) * 1.3); line-height: 1.5; }
.piece-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 1.25rem; }
.piece-head > div { min-width: 0; }
.piece-head .reader-toggle { flex: none; margin-top: 0.15rem; }
/* Slim bar under the site header once the title has scrolled away (title, "Aa", progress line) */
.piece-bar { -webkit-user-select: none; user-select: none; position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 19; background: var(--bg); border-bottom: 1px solid var(--border); transform: translateY(-110%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s; }
.piece-bar.is-on { transform: none; visibility: visible; }
.piece-bar-inner { display: flex; align-items: center; gap: 0.75rem; min-height: 50px; }
.piece-bar-title { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 700; }
.piece-bar .reader-toggle { flex: none; min-width: 40px; min-height: 40px; }
.piece-bar .reading-tools { margin: 0 0 0.6rem; }
.piece-bar-progress { height: 3px; background: var(--border); }
.piece-bar-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.1s linear; }
@media (prefers-reduced-motion: reduce) { .piece-bar, .piece-bar-progress span { transition: none; } }
/* Tungo and poems are centred: the header, the © line, the author and the icons line up with them */
.piece-tungo .piece-head, .piece-mashairi .piece-head { position: relative; justify-content: center; padding: 0 3.25rem; text-align: center; }
.piece-tungo .piece-head .reader-toggle, .piece-mashairi .piece-head .reader-toggle { position: absolute; top: 0; right: 0; margin: 0; }
.piece-tungo .reading-tools, .piece-mashairi .reading-tools { margin-left: auto; margin-right: auto; }
.piece-tungo .piece-copyright, .piece-mashairi .piece-copyright { text-align: center; }
.piece-tungo .author-chip, .piece-mashairi .author-chip { display: flex; width: fit-content; margin-left: auto; margin-right: auto; }
.piece-tungo .actions, .piece-mashairi .actions { margin-left: auto; margin-right: auto; }
.piece-tungo .share-panel, .piece-mashairi .share-panel { max-width: 20rem; margin-left: auto; margin-right: auto; }
.piece-copyright { margin: 2.5rem 0 0; font-size: 0.78rem; color: var(--text-subtle); }
/* A tungo gets the screen to itself: large, centred, with room around it */
/* The tungo always starts at the same height (about a third down the screen) and longer
   ones simply continue downward; the title sits just above it, well below the "Aa" button. */
.piece-tungo .piece-head { padding-top: 15vh; padding-top: 15svh; margin-bottom: 1.25rem; }
.piece-tungo .piece-title { margin-bottom: 0; }
.piece-tungo .piece-body-tungo { min-height: 30vh; min-height: 30svh; padding: 0 0 1.5rem; text-align: center; }
.piece-tungo .piece-body-tungo p:last-child { margin-bottom: 0; }
.author-chip { display: inline-flex; align-items: center; gap: 0.65rem; margin-top: 1rem; padding: 0.35rem 1rem 0.35rem 0.35rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text); text-decoration: none; }
.author-chip:hover { background: var(--surface-2); }
.author-avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em; }
.author-chip-text { display: grid; line-height: 1.25; }
.author-chip-name { font-size: 0.88rem; font-weight: 700; }
.author-chip-text time { color: var(--text-subtle); font-size: 0.75rem; }

.reading-tools { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; margin: 0 0 2rem; padding: 0.3rem; border: 1px solid var(--border); border-radius: 14px; width: fit-content; max-width: 100%; }
.reading-tools button { min-width: 44px; min-height: 40px; padding: 0 0.7rem; border: 0; border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.reading-tools button:hover { background: var(--surface-2); }
.reading-tools button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.reading-tools .sep { width: 1px; height: 1.5rem; background: var(--border); }

.follow-link { display: inline-flex; margin-top: 1rem; font-weight: 600; }

.preview-banner { margin: 0; padding: 0.6rem 1rem; background: var(--accent); color: var(--on-accent); font-weight: 700; text-align: center; }

/* Author page, static pages, forms */
.author-bio { color: var(--text-muted); max-width: 40rem; white-space: pre-line; }
.prose { max-width: 40rem; font-size: 1.05rem; }
.prose p { margin: 0 0 1em; white-space: pre-line; }
.contact-list { list-style: none; padding: 0; margin: 0 0 2rem; }
.contact-list li { padding: 0.35rem 0; }
.form { display: grid; gap: 1rem; max-width: 32rem; }
.form label { display: grid; gap: 0.35rem; font-weight: 600; font-size: 0.95rem; }
.form input, .form textarea { width: 100%; min-height: 44px; padding: 0.65rem 0.8rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.form textarea { min-height: 9rem; resize: vertical; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.notice { padding: 0.8rem 1rem; border-radius: var(--radius); background: var(--surface-2); border-left: 4px solid var(--ok); margin-bottom: 1.5rem; }
.notice-error { border-left-color: #E5786D; }

/* Search */
.search-form { display: flex; gap: 0.5rem; max-width: 36rem; }
.search-form input { flex: 1; min-height: 48px; padding: 0.6rem 1rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 999px; font: inherit; font-size: 1rem; }
.result-list { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.result-list li { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.result-list a { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.result-list a:hover { color: var(--accent-text); }
.result-list p { margin: 0.25rem 0 0; color: var(--text-muted); font-size: 0.95rem; }
.result-cat { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); }

/* Categories page */
.category-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.category-list a { display: flex; justify-content: space-between; align-items: center; min-height: 64px; padding: 0.75rem 1.1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-family: var(--font-display); font-weight: var(--display-weight); font-size: 1.35rem; }
.category-list a span { font-family: var(--font-body); font-size: 0.85rem; color: var(--text-subtle); }

/* Centered simple pages (404, errors, prelaunch) */
.center-page .logo { align-self: center; }
.center-page { min-height: 60vh; max-width: 32rem; margin: 0 auto; padding: 3rem var(--gutter); display: flex; flex-direction: column; justify-content: center; text-align: center; }
.error-details { text-align: left; white-space: pre-wrap; font-size: 0.75rem; background: var(--surface); border: 1px solid var(--border); padding: 1rem; overflow: auto; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* Book page */
.book-head { display: grid; gap: 1.5rem; padding-top: 1.5rem; }
.book-cover { display: block; width: min(60vw, 16rem); margin: 0 auto; color: inherit; text-decoration: none; }
@media (min-width: 720px) { .book-head { grid-template-columns: 17rem 1fr; gap: 2.5rem; padding-top: 3rem; } .book-cover { width: 100%; } }
.book-description { font-size: 1.05rem; color: var(--text-muted); margin: 1.5rem 0 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0 0 1.25rem; padding: 0; }
.chips li { padding: 0.25rem 0.75rem; border: 1px solid var(--border); border-radius: 999px; font-size: 0.85rem; color: var(--text-muted); }
.book-head .hero-actions { margin-top: 0.75rem; }
.book-note { margin: 0.9rem 0 0; font-size: 0.9rem; }
.chapter-toc { margin-top: 2.5rem; }
.chapter-toc h2 { margin-bottom: 0.75rem; }
.chapter-toc ol { list-style: none; margin: 0; padding: 0; }
.chapter-toc li { border-bottom: 1px solid var(--border); }
.chapter-toc a, .toc-row { display: flex; align-items: center; gap: 0.75rem; min-height: 52px; padding: 0.5rem 0; color: var(--text); text-decoration: none; }
.chapter-toc a:hover .toc-title { color: var(--accent-text); }
.toc-n { width: 2rem; flex: none; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.toc-title { flex: 1; }
.is-locked .toc-title, .is-locked .toc-n { color: var(--text-subtle); }
.badge-free { padding: 0.15rem 0.6rem; border-radius: 999px; background: #1E3A2A; color: #BFE8CF; font-size: 0.75rem; font-weight: 700; }
.badge-locked { font-size: 0.75rem; color: var(--text-subtle); text-align: right; }

/* Ebook reader */
.reader { padding-bottom: 1rem; }
.reader-bar { display: flex; align-items: center; gap: 0.75rem; min-height: 48px; }
.reader > * { min-width: 0; }   /* never let the reader be wider than the screen */
.reader > .wrap { width: 100%; }  /* centred bars must still fill (not exceed) the screen width */
.reader-back { flex: 1 1 0; min-width: 0; display: flex; gap: 0.3rem; color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; padding: 0.6rem 0; }
.reader-back span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-progress { color: var(--text-subtle); font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.reader-toggle { min-width: 44px; min-height: 44px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-family: var(--font-logo); font-size: 1.05rem; cursor: pointer; }
.reader-toggle[aria-expanded="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.reader-tools .reading-tools { margin: 0.25rem 0 0.75rem; }
.reader-content { max-width: 38rem; margin: 0 auto; padding: 0 var(--gutter); font-size: var(--reading-size); line-height: 1.8; }
.font-serif.reader-content { font-family: var(--font-serif); }
.font-display.reader-content { font-family: var(--font-display); }
.chapter-label { margin: 1rem 0 0.25rem; color: var(--accent-text); font-family: var(--font-body); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.chapter-title { font-size: calc(var(--reading-size) * 1.65); margin-bottom: 1.5rem; }
.chapter-end { margin-top: 2.5rem; font-family: var(--font-body); font-size: 1rem; break-inside: avoid; }
.buy-cta { padding: 1.25rem; margin-bottom: 1.5rem; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--surface); text-align: center; break-inside: avoid; }
.buy-cta-title { margin: 0 0 0.25rem; font-family: var(--font-display); font-weight: var(--display-weight); font-size: 1.4rem; }
.continue-card { position: relative; display: block; padding: 1.1rem 3.2rem 1.1rem 1.25rem; border-radius: var(--radius); background: var(--accent); color: var(--on-accent); text-decoration: none; break-inside: avoid; }
.continue-label { display: block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.8; }
.continue-title { display: block; margin-top: 0.2rem; font-family: var(--font-display); font-weight: var(--display-weight); font-size: 1.35rem; line-height: 1.2; }
.continue-arrow { position: absolute; right: 1.1rem; top: 50%; transform: translateY(-50%); font-size: 1.6rem; }
.book-end { margin: 0; text-align: center; font-family: var(--font-display); font-weight: var(--display-weight); font-size: 1.5rem; }
.chapter-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; }
.chapter-nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 1rem; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--text); }

/* Paged mode (added by reader.js): one screen at a time, turn like a book */
.reader-paged body { padding-bottom: 0; }
/* Reading mode: nothing but the book — no site header, footer or bottom menu */
.reader-paged .site-header, .reader-paged .site-footer, .reader-paged .bottom-nav, .reader-paged .skip-link { display: none; }
.reader-paged, .reader-paged body { overflow: hidden; height: 100%; }
.reader-paged .reader { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; padding-bottom: 0; padding-top: env(safe-area-inset-top); background: var(--bg); }
.reader-paged .reader-progress-top { display: none; }
.reader-pager { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.35rem var(--gutter) calc(0.35rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--bg); }
.reader-pager-btn { min-width: 88px; min-height: 44px; padding: 0 0.9rem; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.reader-pager-btn:disabled { opacity: 0.35; cursor: default; }
.reader-pager-btn.is-next-chapter { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.reader-pager .reader-progress { flex: 1; text-align: center; }
.reader-hint { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: rgb(0 0 0 / 0.55); }
.reader-hint-box { max-width: 20rem; padding: 1.25rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-align: center; font-family: var(--font-body); font-size: 1rem; line-height: 1.5; }
.reader-hint-box p { margin: 0 0 0.9rem; }
.reader-hint-icon { font-size: 1.8rem; letter-spacing: 0.2rem; }
.reader-paged .reader-viewport { flex: 1; min-height: 0; overflow: hidden; position: relative; padding: 1.1rem 0 0.9rem; }
/* Divider under the title bar, matching the one above the Nyuma/Mbele bar */
.reader-paged .reader-bar { border-bottom: 1px solid var(--border); padding-top: 0.55rem; padding-bottom: 0.55rem; }
.reader-paged .reader-tools .reading-tools { margin: 0.6rem 0; }
.reader-paged .chapter-label { margin-top: 0; }
.reader-paged .reader-content { max-width: none; margin: 0; padding: 0 var(--gutter); box-sizing: border-box; column-fill: auto; transition: transform 0.25s ease; will-change: transform; }
.reader-paged .reader-content > * { break-inside: avoid-column; }
.reader-paged .reader-content p { break-inside: auto; orphans: 2; widows: 2; }
@media (min-width: 900px) { .reader-paged .reader-viewport { max-width: 44rem; width: 100%; margin: 0 auto; } }

/* Likes, saves and comments */
.engage { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.5rem 0 0; }
.engage-btn { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px; padding: 0 1rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.9rem; font-family: var(--font-body); }
.engage-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.engage-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-text); }
.engage-btn[aria-pressed="true"] svg { fill: currentColor; }
.engage-count { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.comments { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); font-family: var(--font-body); font-size: 1rem; line-height: 1.6; }
.comments h2 { font-size: 1.4rem; margin-bottom: 1rem; }
.comment-list { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.comment-list li { padding: 0.75rem 0; border-bottom: 1px solid var(--border); break-inside: avoid; }
.comment-meta { margin: 0 0 0.2rem; font-size: 0.85rem; color: var(--text-subtle); }
.comment-meta strong { color: var(--text); }
.comment-body { margin: 0; overflow-wrap: anywhere; }
.comment-form { max-width: none; }
.reader-content .comments, .reader-content .engage { font-size: 1rem; }

/* Account pages */
.benefits { padding-left: 1.2rem; }
.benefits li { margin: 0.3rem 0; }
.account-section { margin-top: 2.5rem; }
.account-section h2 { margin-bottom: 1rem; }
.account-actions { display: grid; gap: 1.5rem; justify-items: start; }
.account-actions summary { cursor: pointer; color: var(--text-muted); min-height: 44px; display: flex; align-items: center; }
.button-danger-public { background: transparent; color: #E5786D; border: 1px solid #E5786D; }
.policy h2 { font-size: 1.35rem; margin: 2rem 0 0.5rem; }
.policy p { white-space: normal; }

/* "Install Wazo App" card and iPhone instructions */
.install-card { position: fixed; left: 0.75rem; right: 0.75rem; bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 0.75rem); z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgb(0 0 0 / 0.4); font-family: var(--font-body); }
.install-card img { border-radius: 10px; flex: none; }
.install-text { flex: 1 1 10rem; display: grid; line-height: 1.35; }
.install-text span { color: var(--text-muted); font-size: 0.9rem; }
.install-actions { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }
.install-no { min-height: 40px; padding: 0 0.75rem; background: none; border: 0; color: var(--text-muted); font: inherit; font-size: 0.9rem; cursor: pointer; }
@media (min-width: 900px) { .install-card { left: auto; right: 1.5rem; bottom: 1.5rem; max-width: 26rem; } }
.reader-paged .install-card { bottom: calc(env(safe-area-inset-bottom) + 4.25rem); }
.install-ios { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; padding: 1rem 1rem 4.25rem; background: rgb(0 0 0 / 0.88); }
.install-ios-top { align-items: flex-start; padding: 4.25rem 1rem 1rem; }
.install-ios-box { width: 100%; max-width: 26rem; max-height: 100%; overflow-y: auto; padding: 1.25rem; background: var(--surface); color: var(--text); border-radius: 16px; font-family: var(--font-body); }
.install-ios-box h2 { font-size: 1.35rem; margin: 0 0 0.35rem; }
.install-ios-intro { margin: 0 0 1rem; color: var(--text-muted); font-size: 0.9rem; line-height: 1.45; }
.install-ios-box ol { list-style: none; padding: 0; margin: 0 0 1.1rem; display: grid; gap: 0.9rem; }
.install-ios-box li { display: flex; align-items: flex-start; gap: 0.75rem; }
.step-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--surface-2); color: var(--accent-text); font-weight: 700; }
.step-text { display: grid; gap: 0.15rem; }
.step-text strong { font-size: 0.98rem; }
.step-text small { color: var(--text-muted); font-size: 0.84rem; line-height: 1.45; }
.install-ios-box .button { width: 100%; }
.install-ios-arrow { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 0.3rem); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; margin: 0; color: var(--accent); font-family: var(--font-body); font-weight: 700; font-size: 0.85rem; pointer-events: none; }
.install-ios-arrow b { font-size: 1.9rem; line-height: 1; animation: install-bounce 1.1s ease-in-out infinite; }
.install-ios-top .install-ios-arrow { top: calc(env(safe-area-inset-top) + 0.3rem); bottom: auto; left: auto; right: 0.75rem; transform: none; flex-direction: column-reverse; align-items: flex-end; }
@keyframes install-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
.install-ios-top .install-ios-arrow b { animation-direction: reverse; }
@media (prefers-reduced-motion: reduce) { .install-ios-arrow b { animation: none; } }

/* Reminders page */
.reminder-box { margin: 1.5rem 0; padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.reminder-status { margin: 0 0 1rem; font-weight: 600; }

/* Small wazo mark in the reader, so screenshots show where the text came from */
.reader-mark { flex: none; display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-family: var(--font-logo); font-size: 1.15rem; color: var(--text); line-height: 1; }

/* Share a selected quote as a branded picture */
.quote-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 0.75rem); z-index: 40; display: flex; gap: 0.4rem; padding: 0.45rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: 0 10px 28px rgb(0 0 0 / 0.4); font-family: var(--font-body); white-space: nowrap; }
@media (min-width: 900px) { .quote-bar { bottom: 1.5rem; } }
.reader-paged .quote-bar { bottom: calc(env(safe-area-inset-bottom) + 4.25rem); }
.quote-preview { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgb(0 0 0 / 0.9); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.quote-preview-box { display: grid; gap: 0.9rem; justify-items: center; max-height: 100%; }
.quote-preview-box img { max-height: 62vh; max-height: 62dvh; max-width: 100%; width: auto; border-radius: 12px; box-shadow: 0 12px 40px rgb(0 0 0 / 0.5); }
.quote-preview-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.quote-colours { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.55rem; }
.quote-colour { width: 40px; height: 40px; padding: 0; border: 2px solid rgb(255 255 255 / 0.35); border-radius: 50%; cursor: pointer; }
.quote-colour[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(232 163 61 / 0.35); }

/* Page turn: a soft shadow sweeps across in the direction of the turn */
.reader-paged .reader-viewport::after { content: ""; position: absolute; top: 0; bottom: 0; width: 45%; pointer-events: none; opacity: 0; z-index: 2; }
.reader-paged .reader-viewport.turn-next::after { right: 0; background: linear-gradient(to left, rgb(0 0 0 / 0.28), rgb(0 0 0 / 0.08) 35%, transparent); animation: wazo-turn-next 0.32s ease-out; }
.reader-paged .reader-viewport.turn-prev::after { left: 0; background: linear-gradient(to right, rgb(0 0 0 / 0.28), rgb(0 0 0 / 0.08) 35%, transparent); animation: wazo-turn-prev 0.32s ease-out; }
:root[data-theme="light"].reader-paged .reader-viewport.turn-next::after, :root[data-theme="sepia"].reader-paged .reader-viewport.turn-next::after { background: linear-gradient(to left, rgb(60 40 10 / 0.22), rgb(60 40 10 / 0.06) 35%, transparent); }
:root[data-theme="light"].reader-paged .reader-viewport.turn-prev::after, :root[data-theme="sepia"].reader-paged .reader-viewport.turn-prev::after { background: linear-gradient(to right, rgb(60 40 10 / 0.22), rgb(60 40 10 / 0.06) 35%, transparent); }
@keyframes wazo-turn-next { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(-120%); } }
@keyframes wazo-turn-prev { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(120%); } }
@media (prefers-reduced-motion: reduce) { .reader-paged .reader-viewport::after { display: none; } }
.quote-preview-note { max-width: 26rem; margin: 0; padding: 0.6rem 0.9rem; border-radius: 10px; background: var(--surface); color: var(--text); font-family: var(--font-body); font-size: 0.9rem; line-height: 1.45; text-align: center; }

/* Highlights: coloured words kept in "Alama zangu" */
mark.hl { color: inherit; border-radius: 3px; padding: 0.04em 0; -webkit-box-decoration-break: clone; box-decoration-break: clone; cursor: pointer; }
.hl-yellow { background: rgb(245 200 66 / 0.42); }
.hl-green { background: rgb(110 190 110 / 0.38); }
.hl-blue { background: rgb(100 170 230 / 0.38); }
.hl-pink { background: rgb(240 130 170 / 0.38); }
mark.hl-has-note { text-decoration: underline dotted; text-decoration-color: var(--text-subtle); text-underline-offset: 3px; }
mark.hl-active { outline: 2px solid var(--accent); outline-offset: 1px; }
mark.hl-new { animation: hl-pop 0.7s ease-out; }
@keyframes hl-pop { from { box-shadow: 0 0 0 6px rgb(232 163 61 / 0.45); } to { box-shadow: 0 0 0 0 rgb(232 163 61 / 0); } }
@media (prefers-reduced-motion: reduce) { mark.hl-new { animation: none; } }
.hl-dots { display: flex; align-items: center; gap: 0.4rem; }
.hl-dot { width: 32px; height: 32px; flex: none; padding: 0; border: 2px solid rgb(255 255 255 / 0.25); border-radius: 50%; cursor: pointer; }
.hl-dot-yellow { background: #F5C842; }
.hl-dot-green { background: #6EBE6E; }
.hl-dot-blue { background: #64AAE6; }
.hl-dot-pink { background: #F082AA; }
.hl-dot[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--accent); }
.quote-bar-hl { align-items: center; padding-left: 0.55rem; }
.quote-bar-hl .hl-dots { margin-right: 0.15rem; }
.hl-sheet { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 0.75rem); z-index: 45; width: min(26rem, calc(100% - 1.5rem)); display: grid; gap: 0.7rem; padding: 0.8rem; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 10px 28px rgb(0 0 0 / 0.4); font-family: var(--font-body); }
.reader-paged .hl-sheet { bottom: calc(env(safe-area-inset-bottom) + 4.25rem); }
@media (min-width: 900px) { .hl-sheet { bottom: 1.5rem; } }
.hl-sheet-row { display: flex; align-items: center; justify-content: space-between; }
.hl-sheet-close { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; }
.hl-sheet-note { width: 100%; padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 0.95rem; resize: vertical; }
.hl-sheet-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }
.hl-sheet-actions .button { flex-direction: column; gap: 0.1rem; min-height: 58px; padding: 0.4rem; border-radius: 14px; font-size: 0.8rem; }
.hl-action-icon { font-size: 1.15rem; line-height: 1; }
.hl-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1.25rem; }
.hl-filter { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 40px; padding: 0 0.9rem; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.hl-filter-yellow::before, .hl-filter-green::before, .hl-filter-blue::before, .hl-filter-pink::before { content: ''; width: 12px; height: 12px; border-radius: 50%; }
.hl-filter-yellow::before { background: #F5C842; }
.hl-filter-green::before { background: #6EBE6E; }
.hl-filter-blue::before { background: #64AAE6; }
.hl-filter-pink::before { background: #F082AA; }
.hl-filter[aria-pressed="true"] { border-color: var(--accent); background: var(--surface-2); }
.hl-group { margin: 0 0 2rem; }
.hl-group-title { margin: 0 0 0.25rem; font-size: 1.35rem; }
.hl-place { margin: 1rem 0 0.3rem; color: var(--text-subtle); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.hl-item { position: relative; border-bottom: 1px solid var(--border); }
.hl-link { display: block; padding: 0.85rem 2.75rem 0.85rem 0; color: var(--text); text-decoration: none; }
.hl-quote { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; overflow: hidden; margin: 0; font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.65; white-space: pre-line; }
.hl-note { margin: 0.4rem 0 0; color: var(--text-muted); font-size: 0.9rem; white-space: pre-line; }
.hl-delete { position: absolute; top: 0.45rem; right: 0; min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--text-subtle); cursor: pointer; }
.hl-empty { padding: 2rem 0; text-align: center; }
.hl-empty-demo { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 1.3rem; line-height: 1.6; }
.hl-signin { margin-top: 1.5rem; font-size: 0.9rem; }

/* Homepage: works taking turns at the top */

/* Only the writing itself can be selected (to copy, share or highlight); menus, cards,
   buttons and headings react to taps like an app instead of selecting words. */
body { -webkit-user-select: none; user-select: none; }
[data-quote], .comment-body, input, textarea, select, [contenteditable] { -webkit-user-select: text; user-select: text; }
[data-quote] .chapter-end, [data-quote] .piece-copyright, [data-quote] button, [data-quote] .reading-tools, [data-quote] .actions, [data-quote] .share-panel { -webkit-user-select: none; user-select: none; }

/* Shiriki · Penda · Hifadhi: three matching icons, evenly spaced */
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.25rem; max-width: 20rem; margin: 1.5rem 0 0; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.action-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem; min-height: 50px; padding: 0.35rem; border: 0; border-radius: 12px; background: transparent; color: var(--text-muted); font: inherit; font-family: var(--font-body); font-size: 0.72rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.action-btn:hover { background: var(--surface-2); color: var(--text); }
.action-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.action-btn[aria-pressed="true"] { color: var(--accent-text); }
.action-btn[aria-pressed="true"] svg { fill: currentColor; }
.action-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.share-panel { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.share-panel > * { flex: 1 1 0; min-width: 0; }
.share-option { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 1rem; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-family: var(--font-body); font-size: 0.85rem; white-space: nowrap; padding-left: 0.6rem; padding-right: 0.6rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.reader-content .actions { font-size: 1rem; }

/* Homepage: compact featured carousel, shelves */
.featured { margin-top: 1.25rem; }
.featured-scroller { display: grid; grid-auto-flow: column; grid-auto-columns: 86%; gap: 0.75rem; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); list-style: none; }
.featured-scroller::-webkit-scrollbar { display: none; }
.featured-card { scroll-snap-align: start; display: flex; gap: 0.9rem; align-items: center; padding: 0.85rem; border-radius: 18px; background: color-mix(in srgb, var(--card-bg) 45%, var(--surface)); border: 1px solid color-mix(in srgb, var(--card-bg) 60%, var(--border)); color: var(--text); }
.featured-cover { flex: none; width: 5.5rem; color: inherit; text-decoration: none; }
.featured-cover .cover { border-radius: 6px; box-shadow: 0 6px 16px rgb(0 0 0 / 0.3); }
.featured-cover div.cover { padding: 0.5rem; }
.featured-cover .cover-text-l { font-size: 1.05rem; }
.featured-cover .cover-text-m { font-size: 0.86rem; }
.featured-cover .cover-text-s { font-size: 0.76rem; }
.featured-cover .cover-cat { font-size: 0.5rem; }
.featured-cover .cover-mark { font-size: 0.65rem; }
.featured-text { min-width: 0; }
.featured-label { margin: 0; color: var(--accent-text); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.featured-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin: 0.15rem 0 0.2rem; font-size: 1.2rem; line-height: 1.2; }
.featured-title a { color: inherit; text-decoration: none; }
.featured-author { margin: 0 0 0.6rem; color: var(--text-muted); font-size: 0.82rem; }
.featured-card .button { min-height: 36px; padding: 0.35rem 1.1rem; }
.featured-dots { display: flex; justify-content: center; gap: 0.35rem; margin-top: 0.7rem; }
.featured-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--text-subtle); opacity: 0.5; transition: width 0.2s; }
.featured-dot.is-on { width: 18px; background: var(--accent); opacity: 1; }
@media (min-width: 720px) { .featured-scroller { grid-auto-columns: calc((100% - 0.75rem) / 2); margin: 0; padding: 0; } .featured-cover { width: 6.5rem; } }
@media (min-width: 1100px) { .featured-scroller { grid-auto-columns: calc((100% - 1.5rem) / 3); } }
.row-small { margin-top: 1.5rem; }
.row-small .row-head h2 { font-size: 1.35rem; }
.row-small .row-scroller { grid-auto-columns: 29%; gap: 0.7rem; }
.row-small .card-title { font-size: 0.85rem; -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.row-small .card-meta { font-size: 0.72rem; }
.row-small div.cover { padding: 0.55rem; }
.row-small .cover-text-l { font-size: clamp(1.1rem, 5vw, 1.4rem); }
.row-small .cover-text-m { font-size: clamp(0.86rem, 3.6vw, 1.02rem); }
.row-small .cover-text-s { font-size: clamp(0.76rem, 3.1vw, 0.88rem); }
.row-small .cover-cat { font-size: 0.5rem; }
.row-small .cover-mark { font-size: 0.65rem; }
@media (min-width: 600px) { .row-small .row-scroller { grid-auto-columns: 19%; } }
@media (min-width: 900px) { .row-small .row-scroller { grid-auto-columns: calc((100% - 6 * 0.7rem) / 7); } }

/* Pictures inside the writing (illustrations), with an optional caption */
.piece-body figure { margin: 1.5em 0; text-align: center; break-inside: avoid; }
.piece-body figure img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 8px; }
.piece-body figcaption { margin-top: 0.5em; color: var(--text-subtle); font-family: var(--font-body); font-weight: 400; font-size: 0.82em; line-height: 1.4; }
/* In the book reader a picture always fits on one page (never cut across two) */
.reader-paged .reader-content figure { margin: 0.75em 0; }
.reader-paged .reader-content figure img { width: auto; max-height: calc(var(--page-h, 70vh) - 4.5em); object-fit: contain; }

/* The work's language on its cover, so readers know before opening it */
.cover-frame { position: relative; display: block; }
.featured-cover { position: relative; }
.lang-tag { position: absolute; right: 0.35rem; bottom: 0.35rem; padding: 0.08rem 0.38rem; border-radius: 999px; background: rgb(17 18 20 / 0.72); color: #F2EEE6; font-family: var(--font-body); font-size: 0.5rem; font-weight: 700; letter-spacing: 0.02em; line-height: 1.45; pointer-events: none; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

/* "Inakuja": announced works */
.upcoming-ribbon { position: absolute; top: 0.55rem; left: -0.1rem; padding: 0.15rem 0.55rem 0.15rem 0.5rem; border-radius: 0 999px 999px 0; background: var(--accent); color: var(--on-accent); font-family: var(--font-body); font-size: 0.55rem; font-weight: 800; letter-spacing: 0.08em; box-shadow: 0 2px 6px rgb(0 0 0 / 0.35); pointer-events: none; }
.cover-frame:has(.upcoming-ribbon) .cover-cat { visibility: hidden; }   /* the ribbon takes the type label's place */
.upcoming-page { display: grid; gap: 1.5rem; padding-top: 1.5rem; padding-bottom: 2rem; }
.upcoming-cover { width: min(60vw, 16rem); margin: 0 auto; }
.upcoming-cover .upcoming-ribbon { top: 1rem; font-size: 0.75rem; padding: 0.25rem 0.8rem 0.25rem 0.7rem; }
.upcoming-description { margin: 1.25rem 0 0; color: var(--text-muted); font-size: 1.05rem; line-height: 1.6; }
.upcoming-when { margin: 1rem 0 0; color: var(--accent-text); font-weight: 700; }
.upcoming-alert { margin-top: 1.25rem; }
.upcoming-alert-status { margin: 0.6rem 0 0; font-size: 0.88rem; }
.upcoming-alert .button.is-busy { opacity: 0.6; cursor: progress; }
.upcoming-alert .button.is-on, .upcoming-alert .button.is-on:disabled { background: var(--ok); color: #0B2416; opacity: 1; cursor: default; }
.upcoming-alert .button.is-pop { animation: alert-pop 0.45s ease-out; }
@keyframes alert-pop { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .upcoming-alert .button.is-pop { animation: none; } }
@media (min-width: 720px) { .upcoming-page { grid-template-columns: 17rem 1fr; gap: 2.5rem; padding-top: 3rem; } .upcoming-cover { width: 100%; } }
.reminder-frequency { display: grid; gap: 0.5rem; margin: 1rem 0; padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); }
.reminder-frequency legend { padding: 0 0.3rem; font-weight: 700; }
.reminder-frequency label { display: flex; align-items: center; gap: 0.55rem; min-height: 40px; }
.featured-cover .upcoming-ribbon { top: 0.4rem; font-size: 0.45rem; padding: 0.1rem 0.4rem 0.1rem 0.35rem; }
.featured-cover:has(.upcoming-ribbon) .cover-cat { visibility: hidden; }

/* Kazi zangu: readers write their own works (same editor as the admin, no pictures) */
.write-page .form { max-width: 48rem; }
.form select { width: 100%; min-height: 44px; padding: 0.5rem 0.7rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.write-row { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.write-label { display: block; margin-bottom: 0.35rem; font-weight: 600; font-size: 0.95rem; }
.write-confirm { display: flex !important; grid-template-columns: none; gap: 0.6rem; align-items: flex-start; font-weight: 500 !important; }
.write-confirm input { width: auto; min-height: 0; margin-top: 0.25rem; }
.write-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.write-delete { margin-top: 2rem; }
.field-error { margin: -0.5rem 0 0; color: #E5786D; font-size: 0.9rem; }
.write-note { margin: 0.5rem 0 0; padding: 0.5rem 0.75rem; border-left: 3px solid #E5786D; background: var(--surface-2); border-radius: 6px; }
.write-status-pending, .write-status-returned { font-weight: 700; }
.write-page .editor-shell { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.write-page .editor-toolbar { position: sticky; top: var(--header-h); z-index: 5; display: flex; flex-wrap: wrap; gap: 0.15rem; padding: 0.35rem; background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.write-page .tb-btn { min-width: 40px; min-height: 40px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.write-page .tb-btn:hover { background: var(--border); }
.write-page .tb-btn.is-active { background: var(--accent); color: var(--on-accent); }
.write-page .tb-italic { font-style: italic; }
.write-page .tb-underline { text-decoration: underline; }
.write-page .editor-area .ProseMirror { min-height: 45vh; padding: 1rem; outline: none; font-size: 1.05rem; line-height: 1.7; }
.write-page .editor-area .ProseMirror p { margin: 0 0 1em; }
.write-page .editor-area .ProseMirror blockquote { margin: 1rem 0; padding-left: 1rem; border-left: 3px solid var(--accent); color: var(--text-muted); }

/* Notices from Wazo to writers */
.has-notice { position: relative; }
.has-notice::after { content: ""; position: absolute; top: 6px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: #E5786D; box-shadow: 0 0 0 2px var(--bg); }
.bottom-nav a.has-notice::after { top: 8px; right: calc(50% - 18px); }
.header-write.has-notice::after { top: 2px; right: 2px; }
.writer-notices { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 0.6rem; }
.writer-notice { display: grid; gap: 0.2rem; padding: 0.8rem 1rem; border-radius: var(--radius); background: var(--surface-2); border-left: 4px solid var(--ok); }
.writer-notice-returned, .writer-notice-rejected { border-left-color: #E5786D; }
.writer-notice.is-read { opacity: 0.65; }
.writer-notice time { color: var(--text-muted); font-size: 0.8rem; }

.writer-notify { display: grid; gap: 0.4rem; justify-items: start; margin: -0.5rem 0 1.5rem; }

/* Picha pana: wide picture at the top of a work, and the news-style Makala list */
.piece-wide { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); margin: 0 0 1.75rem; background: var(--surface); }
.news-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.75rem; }
@media (min-width: 700px) { .news-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1.5rem; } }
@media (min-width: 1100px) { .news-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.news-card { display: grid; gap: 0.75rem; color: var(--text); text-decoration: none; }
.news-media { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius); background: var(--surface); }
.news-media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.news-card:hover .news-media img { transform: scale(1.03); }
.news-banner { display: flex; align-items: flex-end; width: 100%; height: 100%; padding: 1rem 1.1rem; }
.news-banner span { font-size: 1.35rem; font-weight: 800; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-media .lang-tag { position: absolute; right: 0.5rem; bottom: 0.5rem; font-size: 0.68rem; }
.news-text { display: grid; gap: 0.35rem; }
.news-title { font-size: 1.2rem; font-weight: 800; line-height: 1.3; }
.news-card:hover .news-title { color: var(--accent-text); }
.news-excerpt { color: var(--text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-meta { color: var(--text-subtle, var(--text-muted)); font-size: 0.85rem; }
@media (prefers-reduced-motion: reduce) { .news-media img { transition: none; } }

/* Writers' chapter list (their book) */
.write-chapters { margin-top: 2.5rem; max-width: 48rem; }
.write-chapter-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.write-chapter { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.write-chapter-name { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.write-chapter-name a { color: var(--text); font-weight: 600; text-decoration: none; }
.write-chapter-n { min-width: 1.6rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.write-chapter-badge { padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--surface-2); color: var(--accent-text); font-size: 0.75rem; font-weight: 700; }
.write-chapter-deleted .write-chapter-name { color: var(--text-muted); }
.write-chapter-actions { display: flex; align-items: center; gap: 0.35rem; }
.write-chapter-actions form { margin: 0; }
.icon-action { min-width: 36px; min-height: 36px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.link-action { border: 0; background: none; color: var(--accent-text); font: inherit; font-size: 0.9rem; cursor: pointer; padding: 0.3rem; }
.link-danger { color: #E5786D; }

/* Public view count, next to likes (not a button) */
.action-views { cursor: default; }
.action-views:hover { background: transparent; }

/* Sun/moon switch in the header */
.theme-switch { border: 0; background: transparent; cursor: pointer; }
.theme-switch .icon-sun { display: none; }
:root:not([data-theme]) .theme-switch .icon-sun { display: block; }
:root:not([data-theme]) .theme-switch .icon-moon { display: none; }

/* "Aa Mwonekano": the reading-settings button says what it does */
.reader-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0 0.85rem; }
/* "Aa" (serif) and the word (Manrope) have different heights: each sits in its own box, centred on the same line */
.reader-toggle .toggle-aa, .reader-toggle .toggle-word { display: block; line-height: 1; }
.reader-toggle .toggle-aa { font-size: 1.05rem; transform: translateY(0.085em); }
.reader-toggle .toggle-word { font-family: var(--font-body); font-size: 0.85rem; font-weight: 700; transform: translateY(0.02em); }
/* Poems and tungo: the button sits under the centred title */
.piece-tungo .piece-head, .piece-mashairi .piece-head { flex-direction: column; align-items: center; padding: 0; }
.piece-tungo .piece-head .reader-toggle, .piece-mashairi .piece-head .reader-toggle { position: static; margin: 0.25rem auto 0; }
.piece-tungo .piece-head { padding-top: 15vh; padding-top: 15svh; }

/* One-time tip pointing at the button */
.display-tip { position: fixed; z-index: 40; max-width: 15rem; padding: 0.7rem 0.9rem; border-radius: 12px; background: var(--accent); color: var(--on-accent); font-size: 0.9rem; font-weight: 600; line-height: 1.4; box-shadow: 0 10px 30px rgb(0 0 0 / 0.3); cursor: pointer; animation: tip-in 0.25s ease; }
.display-tip::before { content: ""; position: absolute; top: -7px; right: var(--tip-arrow, 1.5rem); border: 7px solid transparent; border-top: 0; border-bottom-color: var(--accent); }
@keyframes tip-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .display-tip { animation: none; } }
