/*
Theme Name: Kannada Kathe
Author: Kannada Kathe
Description: A calm, accessible reading home for Kannada stories in English letters, with theme tags and phrase meanings.
Version: 1.7.1
Requires at least: 6.5
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kannada-kathe
*/

:root {
  color-scheme: light;
  --paper: #faf9f5;
  --white: #fffefa;
  --ink: #213a32;
  --muted: #63716a;
  --green: #254e3e;
  --orange: #ac5637;
  --line: #dedfd5;
  --soft: #eef0e7;
  --on-green: #ffffff;
  --green-hover: #183d2e;
  --selection: #e6c99b;
  --stack: #e6e7dc;
  --stamp: #f3dcaa;
  --stamp-ink: #55492a;
  --badge: #fffef0e8;
  --phrase-highlight: #e8eedb;
  --phrase-underline: #849b6f;
  --popover: #fffef5;
  --section-paper: #f3f5ed;
  --book-cover: #eceee1;
  --book-paper: #fffdf4;
  --book-edge: #d6dbc7;
  --book-line: #cdd5c0;
  --book-hover: #dee5cf;
  --book-spine: #263c2514;
  --illustration-filter: none;
  --illustration-blend: multiply;
  --illustration-paper: var(--paper);
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* The book's night control and the site switch use the same palette. */
:root[data-theme="dark"], .kk-book-reader.is-night {
  color-scheme: dark;
  --paper: #14221c;
  --white: #1c2d24;
  --ink: #ecebdc;
  --muted: #b5c1b4;
  --green: #c3d7a9;
  --orange: #edb38f;
  --line: #435849;
  --soft: #263b2e;
  --on-green: #192b21;
  --green-hover: #d5e4bf;
  --selection: #526542;
  --stack: #314537;
  --stamp: #5c472e;
  --stamp-ink: #fae0af;
  --badge: #263b2ef0;
  --phrase-highlight: #3a5037;
  --phrase-underline: #91ae85;
  --popover: #263e30;
  --section-paper: #24392c;
  --book-cover: #192b22;
  --book-paper: #253d2e;
  --book-edge: #344b30;
  --book-line: #526748;
  --book-hover: #3c5535;
  --book-spine: #00000038;
  --illustration-filter: invert(1) hue-rotate(180deg);
  --illustration-blend: screen;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 2rem; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); font-size: 1rem; line-height: 1.6; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-underline-offset: 0.2em; }
button, select, a { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.4; }
img, svg { max-width: 100%; }
img { height: auto; }
figure { margin-inline: 0; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.16; }
h1 { font-size: clamp(2.7rem, 4.8vw, 4.5rem); letter-spacing: -0.045em; }
h2 { font-size: clamp(2rem, 3vw, 2.7rem); letter-spacing: -0.035em; }
h3 { font-size: 1.75rem; letter-spacing: -0.025em; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 5px; }
::selection { color: var(--ink); background: var(--selection); }
[id] { scroll-margin-top: 2rem; }
.page-width { width: min(1200px, calc(100% - 6rem)); margin-inline: auto; }
.icon { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; vertical-align: middle; }
.screen-reader-text, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; z-index: 100; top: 1rem; left: 1rem; padding: 0.75rem 1rem; color: var(--on-green); background: var(--green); }
.button { display: inline-flex; min-height: 3.25rem; justify-content: center; align-items: center; gap: 0.7rem; border: 1px solid var(--line); border-radius: 5px; padding: 0.8rem 1.35rem; font-size: 0.9375rem; font-weight: 550; text-decoration: none; transition: background 160ms, transform 160ms; }
.button:hover { transform: translateY(-2px); }
.button-dark { background: var(--green); border-color: var(--green); color: var(--on-green); }
.button-dark:hover { background: var(--green-hover); }
.eyebrow { display: block; font-size: 0.75rem; font-weight: 650; letter-spacing: 0.13em; line-height: 1.5; }
.brand-dot { color: var(--orange); }

/* A quiet, compact navigation lets the stories lead. */
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { width: min(1320px, calc(100% - 6rem)); margin-inline: auto; min-height: 100px; display: flex; justify-content: space-between; align-items: center; gap: 2rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--serif); font-size: 1.6rem; letter-spacing: -0.06em; text-decoration: none; white-space: nowrap; }
.brand-light { font-style: italic; font-weight: 400; }
.brand-icon { display: flex; align-items: center; justify-content: center; color: var(--orange); }
.brand-icon .icon { width: 1.7rem; height: 1.7rem; }
.main-nav { display: flex; align-items: center; gap: 2rem; margin-left: auto; }
.main-nav a { font-size: 0.875rem; text-decoration: none; }
.main-nav a:hover, .closing-note a:hover { color: var(--orange); text-decoration: underline; }
.main-nav li { list-style: none; }
.custom-nav { display: flex; align-items: center; gap: 2rem; margin: 0; padding: 0; flex-wrap: wrap; }
[lang="kn-Latn"] { overflow-wrap: anywhere; }
.header-note { padding-left: 2rem; border-left: 1px solid var(--line); color: var(--muted); font-family: var(--serif); font-size: 0.9375rem; font-style: italic; }
.kk-theme-toggle { display: inline-flex; flex-shrink: 0; min-height: 44px; align-items: center; justify-content: center; gap: .5rem; border: 1px solid var(--line); border-radius: 5px; padding: .5rem .75rem; background: var(--white); color: var(--ink); font-size: .8rem; white-space: nowrap; }
.kk-theme-toggle:hover { border-color: var(--green); background: var(--soft); }
.kk-theme-toggle[hidden], .kk-theme-sun { display: none; }
:root[data-theme="dark"] .kk-theme-sun { display: block; }
:root[data-theme="dark"] .kk-theme-moon { display: none; }
@media (max-width: 1280px) { .header-note { display: none; } }

/* The featured story is an illustrated page on the reader's desk. */
.hero { display: grid; grid-template-columns: 1.12fr 1fr; align-items: center; gap: 6rem; padding-block: 5.5rem 6rem; }
.hero .eyebrow { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.65rem; color: var(--orange); }
.tiny-flower { font-size: 1.4rem; line-height: 1; }
.hero h1 { margin-bottom: 1.5rem; }
.hero h1 em { color: var(--orange); font-weight: 400; }
.hero-description { max-width: 440px; margin-bottom: 1.9rem; color: var(--muted); font-size: 1.0625rem; line-height: 1.85; }
.hero-facts { display: flex; flex-wrap: wrap; column-gap: 1rem; row-gap: 0.3rem; margin-top: 1.6rem; color: var(--muted); font-size: 0.75rem; }
.hero-facts span + span::before { content: "·"; margin-right: 1rem; color: var(--orange); }
.featured-story { position: relative; display: block; padding: 0.75rem; border: 1px solid var(--line); background: var(--white); box-shadow: 5px 10px 0 -3px var(--stack), 0 12px 35px #213a320b; color: var(--ink); text-decoration: none; transform: rotate(2deg); transition: transform 220ms, box-shadow 220ms; }
a.featured-story:hover { transform: rotate(0); box-shadow: 0 12px 35px #213a3214; }
.featured-story .featured-art, .hero-placeholder .story-art { height: 275px; }
.story-art { display: block; width: 100%; height: 230px; overflow: hidden; object-fit: cover; }
.story-art > svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.story-art > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.story-art.kk-has-thumbnail, .story-art.kk-has-thumbnail > img { object-fit: contain; }
/* Filter the image itself once, including thumbnails and images moved into the book. */
img.story-art, .story-art > img, .story-art > svg, .story-prose img, .wp-block-image img {
  background: white;
  filter: var(--illustration-filter);
  mix-blend-mode: var(--illustration-blend);
}
.featured-stamp { position: absolute; top: 2rem; right: -1.5rem; display: flex; align-items: center; gap: 0.5rem; max-width: calc(100% - 2rem); padding: 0.65rem 0.9rem; background: var(--stamp); color: var(--stamp-ink); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.11em; transform: rotate(-7deg); }
.featured-stamp .icon { width: 0.95rem; height: 0.95rem; }
.featured-caption { padding: 1.5rem 1.15rem 0.8rem; }
.featured-caption .eyebrow { margin-bottom: 0.5rem; color: var(--muted); font-size: 0.75rem; }
.featured-caption h2 { margin-bottom: 0.6rem; font-size: 1.9rem; }
.featured-caption p { max-width: 350px; margin-bottom: 0.8rem; color: var(--muted); font-size: 1rem; line-height: 1.6; }
.featured-read { color: var(--orange); font-size: 0.75rem; }
.reading-strip { border-block: 1px solid var(--line); background: var(--soft); }
.strip-inner { display: flex; min-height: 83px; align-items: center; justify-content: space-between; gap: 1.5rem; }
.strip-inner > span { font-size: 0.875rem; color: var(--muted); }
.strip-inner b { color: var(--ink); font-weight: 600; }
.strip-inner .strip-intro { display: flex; gap: 0.65rem; align-items: center; color: var(--green); font-family: var(--serif); font-size: 1.125rem; font-style: italic; }
.strip-intro .icon { color: var(--orange); width: 1rem; height: 1rem; }

/* Browsing uses ordinary WordPress tags and a server-rendered search. */
.library { padding-block: 5rem 3rem; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.section-heading .eyebrow { margin-bottom: 0.8rem; color: var(--orange); }
.section-heading h2 { margin: 0; font-size: clamp(1.9rem, 2.8vw, 2.55rem); }
.section-heading > p { margin: 0 0 0.35rem; color: var(--muted); font-family: var(--serif); font-style: italic; white-space: nowrap; }
.library-tools { display: flex; gap: 0.8rem; }
.search-field { display: flex; align-items: center; gap: 0.8rem; flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 5px; padding: 0 1rem; background: var(--white); color: var(--muted); }
.search-field:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.search-field input { min-width: 0; width: 100%; height: 3.2rem; border: 0; padding: 0; background: transparent; color: var(--ink); font-size: 0.875rem; }
.search-field input::placeholder { color: var(--muted); opacity: 1; }
.search-field input:focus-visible { outline: none; }
.sort-field { display: flex; position: relative; }
.sort-field::after { content: ""; position: absolute; right: 1rem; top: 1.25rem; width: 0.4rem; height: 0.4rem; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: rotate(45deg); pointer-events: none; }
.sort-field select { min-width: 175px; appearance: none; border: 1px solid var(--line); border-radius: 5px; padding: 0.7rem 2.4rem 0.7rem 1rem; background: var(--white); color: var(--ink); font-size: 0.875rem; }
.search-button { background: var(--soft); color: var(--green); font-size: 0.875rem; }
.tag-filters { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-block: 1.3rem 2.1rem; }
.tag-filter { display: inline-flex; align-items: center; gap: 0.6rem; min-height: 2.6rem; border: 1px solid var(--line); border-radius: 50px; padding: 0.45rem 1rem; font-size: 0.875rem; text-decoration: none; transition: border-color 160ms, background 160ms; }
.tag-filter span { font-size: 0.75rem; opacity: 0.75; }
.tag-filter:hover { border-color: var(--green); }
.tag-filter.is-active { border-color: var(--green); background: var(--green); color: var(--on-green); }
.results-label { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1.15rem; font-size: 0.75rem; color: var(--muted); }
.results-label p { margin: 0; }
.results-label > span { font-family: var(--serif); font-size: 0.875rem; font-style: italic; }
.story-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.75rem; }
.story-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--white); transition: box-shadow 180ms, transform 180ms; }
.story-card:hover { transform: translateY(-4px); box-shadow: 0 12px 25px #213a3209; }
.card-image-link { display: block; position: relative; overflow: hidden; }
.card-image-link .story-art { transition: transform 350ms; }
.story-card:hover .story-art { transform: scale(1.025); }
.level-label { position: absolute; bottom: 0.8rem; left: 1rem; padding: 0.3rem 0.6rem; border-radius: 3px; background: var(--badge); color: var(--ink); font-size: 0.75rem; font-weight: 650; letter-spacing: 0.07em; }
.card-body { display: flex; flex: 1; flex-direction: column; padding: 1.5rem 1.5rem 1.2rem; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.45rem 0.8rem; margin-bottom: 0.6rem; }
.card-tags a { color: var(--orange); font-size: 0.875rem; font-weight: 550; text-decoration: none; }
.card-tags a:hover { text-decoration: underline; }
.card-body h3 { margin-bottom: 0.7rem; font-size: 1.6rem; line-height: 1.2; }
.card-body h3 a { text-decoration: none; }
.card-body h3 a:hover { color: var(--orange); }
.card-subtitle { margin-bottom: 1.4rem; color: var(--muted); font-size: 1rem; line-height: 1.75; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; }
.card-meta > span:first-child { display: flex; align-items: center; gap: 0.4rem; }
.card-meta .icon { width: 0.875rem; height: 0.875rem; }
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.65rem; margin-top: 2.5rem; }
.pagination .page-numbers { display: inline-flex; justify-content: center; align-items: center; min-width: 2.5rem; min-height: 2.5rem; border: 1px solid var(--line); border-radius: 4px; padding: 0.3rem 0.75rem; text-decoration: none; }
.pagination .current { background: var(--green); color: var(--on-green); border-color: var(--green); }
.empty-state { padding-block: 5rem; text-align: center; }
.empty-state > .icon { margin-bottom: 1.5rem; width: 2rem; height: 2rem; color: var(--orange); }
.empty-state .eyebrow { margin-bottom: 1rem; color: var(--orange); }
.empty-state h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
.empty-state h3 { margin-bottom: 1rem; }
.empty-state p { color: var(--muted); }
.closing-note { display: flex; align-items: center; gap: 1.5rem; margin-block: 2rem 5rem; padding: 2.4rem; background: var(--soft); border-radius: 7px; }
.closing-icon { display: grid; place-items: center; flex-shrink: 0; width: 3.5rem; height: 3.5rem; border: 1px solid var(--line); border-radius: 50%; color: var(--green); }
.closing-icon .icon { width: 1.5rem; height: 1.5rem; }
.closing-note h2 { margin-bottom: 0.5rem; font-size: 1.75rem; }
.closing-note p { margin: 0; color: var(--muted); font-size: 1rem; }
.closing-note > a { margin-left: auto; font-size: 0.8125rem; white-space: nowrap; }
.site-footer { padding-block: 2.8rem; border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; width: min(1200px, calc(100% - 6rem)); margin-inline: auto; }
.footer-brand { font-size: 1.4rem; }
.footer-inner p { margin: 0; color: var(--muted); font-family: var(--serif); font-size: 0.9375rem; font-style: italic; }
.footer-inner > span { color: var(--muted); font-size: 0.75rem; }

/* A wide illustration gives way to an uncluttered, adjustable reading column. */
.reader-main { width: min(1120px, calc(100% - 6rem)); margin-inline: auto; padding-block: 3rem 4rem; }
.reader-header { max-width: 800px; margin: 0 auto 2.5rem; text-align: center; }
.back-link { display: inline-block; margin-bottom: 2rem; color: var(--muted); font-size: 0.875rem; }
.reader-header .card-tags { justify-content: center; margin-bottom: 1rem; }
.reader-header h1 { margin-bottom: 1.2rem; font-size: clamp(2.6rem, 4.8vw, 4rem); }
.reader-subtitle { max-width: 600px; margin: 0 auto 1.5rem; color: var(--muted); font-size: 1.1rem; line-height: 1.75; }
.reader-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.5rem; color: var(--muted); font-size: 0.75rem; }
.reader-meta > span:first-child { display: flex; align-items: center; gap: 0.4rem; }
.reader-meta .icon { width: 0.9rem; height: 0.9rem; }
.reader-art { height: 360px; border-radius: 8px; }
.reader-layout { display: grid; grid-template-columns: 210px minmax(0, 700px); justify-content: space-between; align-items: start; gap: 4rem; margin-top: 3.5rem; }
.reader-sidebar { position: sticky; top: 2rem; border-top: 1px solid var(--line); padding-top: 1.25rem; }
.reader-sidebar .eyebrow { color: var(--orange); font-size: 0.75rem; }
.reader-sidebar p { margin-block: 0.8rem 1.3rem; color: var(--muted); font-size: 1rem; line-height: 1.8; }
.reader-sidebar > a { display: inline-flex; gap: 0.5rem; align-items: center; color: var(--green); font-size: 0.875rem; }
.reader-sidebar > a .icon { width: 1rem; height: 1rem; }
.text-controls { display: flex; align-items: center; gap: 0.5rem; margin-top: 1.7rem; padding-top: 1.3rem; border-top: 1px solid var(--line); }
.text-controls > span { margin-right: auto; color: var(--muted); font-size: 0.875rem; }
.text-controls button { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--ink); font-family: var(--serif); }
.text-controls button:hover:not(:disabled) { background: var(--soft); border-color: var(--green); }
.story-prose { isolation: isolate; background: var(--illustration-paper); overflow-wrap: break-word; font-family: var(--serif); font-size: 1.2rem; line-height: 1.95; }
.story-prose p { margin-bottom: 1.65em; }
.story-prose > p:first-child::first-letter { float: left; margin: 0.09em 0.1em -0.05em 0; color: var(--orange); font-size: 3.25em; line-height: 0.9; }
.story-prose h2, .story-prose h3 { margin-block: 1.5em 0.6em; }
.story-prose a { color: var(--orange); }
.story-prose ul, .story-prose ol { padding-left: 1.5em; }
.story-prose blockquote { margin: 1.5em 0; padding-left: 1.5rem; border-left: 3px solid var(--orange); color: var(--muted); font-style: italic; }
.story-prose img { display: block; max-width: 100%; }
/* A local, opaque backdrop keeps blending intact inside transformed book pages. */
.story-prose figure, figure.wp-block-image { isolation: isolate; background: var(--illustration-paper); }
.story-prose .kk-story-illustration { margin: 2.2em auto; break-inside: avoid; }
.story-prose .kk-story-illustration img { width: 100%; height: auto; object-fit: contain; background: white; }
.story-prose .kk-story-illustration figcaption { margin-top: 0.65em; color: var(--muted); font-family: var(--sans); font-size: 0.875rem; line-height: 1.6; text-align: center; }
.story-prose iframe { max-width: 100%; }
.story-prose pre { overflow: auto; padding: 1rem; background: var(--soft); }
.story-prose table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.9375rem; }
.story-prose td, .story-prose th { border: 1px solid var(--line); padding: 0.65rem; text-align: left; }
.phrase-section { margin-top: 3.5rem; padding-top: 2.5rem; border-top: 1px solid var(--line); }
.phrase-section .eyebrow { margin-bottom: 0.8rem; color: var(--orange); }
.phrase-section h2 { margin-bottom: 1rem; font-size: 2.35rem; }
.phrase-section > p { margin-bottom: 1.7rem; color: var(--muted); font-size: 0.9375rem; line-height: 1.8; }
.phrase-list { margin: 0; }
.phrase-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; border-top: 1px solid var(--line); padding-block: 1.2rem; }
.phrase-row:last-child { border-bottom: 1px solid var(--line); }
.phrase-row dt { color: var(--green); font-family: var(--serif); font-size: 1.0625rem; line-height: 1.6; }
.phrase-row dd { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.8; }
.story-prose .kk-section-meanings { margin: 2rem 0 2.5rem; border: 1px solid var(--line); border-radius: 6px; padding: 1.3rem 1.5rem; background: var(--soft); font-family: var(--sans); font-size: 1rem; line-height: 1.75; }
.story-prose .kk-section-meanings .eyebrow { margin-bottom: .5rem; font-size: .75rem; }
.story-prose .kk-section-meanings h2, .story-prose .kk-section-meanings h3 { margin: 0 0 .8rem; font-size: 1.45rem; line-height: 1.35; }
.story-prose .kk-section-meanings > p { margin: 0 0 .8rem; font-size: .9375rem; }
.story-prose .kk-section-meanings .phrase-row { gap: 1rem; padding-block: .75rem; }
.story-prose .kk-section-meanings .phrase-row:last-child { border-bottom: 0; }
.story-prose .kk-phrase-trigger { display: inline; appearance: none; margin: 0; border: 0; border-radius: 2px; padding: 0; background: transparent; color: inherit; font: inherit; line-height: inherit; text-align: inherit; text-decoration: underline dotted var(--phrase-underline) 2px; text-underline-offset: 0.22em; cursor: pointer; touch-action: manipulation; }
.story-prose .kk-phrase-trigger:hover, .story-prose .kk-phrase-trigger[aria-expanded="true"] { color: var(--green); background: var(--phrase-highlight); text-decoration-style: solid; }
.story-prose .kk-phrase-trigger:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; background: var(--phrase-highlight); }
.reader-sidebar .kk-meaning-help { color: var(--green); font-size: 0.875rem; }
.kk-meaning-popover { position: fixed; z-index: 10000; width: min(360px, calc(100vw - 24px)); overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 1.25rem 1.3rem; background: var(--popover); color: var(--ink); box-shadow: 0 10px 40px #10251c40; }
.kk-meaning-popover[hidden] { display: none; }
.kk-meaning-close { display: block; min-height: 32px; margin: -0.5rem -0.55rem 0.5rem auto; border: 0; border-radius: 3px; padding: 0.2rem 0.55rem; background: transparent; color: var(--muted); font-size: 0.875rem; }
.kk-meaning-close:hover { background: var(--soft); color: var(--ink); }
.kk-meaning-label { display: block; margin-bottom: 0.55rem; color: var(--orange); font-size: 0.75rem; font-weight: 650; letter-spacing: 0.12em; }
.kk-meaning-phrase { margin: 0 0 0.65rem; overflow-wrap: anywhere; font-family: var(--serif); font-size: 1.3rem; line-height: 1.45; }
.kk-meaning-text { margin: 0; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.75; }

/* A book keeps the original story nodes and meanings together in one reading space. */
.kk-book-open[hidden] { display: none !important; }
.reader-header .kk-book-open { margin-top: 1.25rem; font-size: 0.875rem; }
.kk-book-reader { position: fixed; inset: 20px 24px; width: calc(100vw - 48px); max-width: 1360px; height: calc(100vh - 40px); height: calc(100dvh - 40px); max-height: none; margin: auto; border: 1px solid var(--book-line); border-radius: 10px; padding: 0; overflow: hidden; background: var(--book-cover); color: var(--ink); box-shadow: 0 24px 100px #10251c40; }
.kk-book-reader:not([open]) { display: none; }
.kk-book-reader[open] { display: flex; flex-direction: column; }
.kk-book-reader::backdrop { background: #172d246e; backdrop-filter: blur(4px); }
.kk-book-toolbar { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 1.5rem; padding: 16px 28px; }
.kk-book-ritual { color: var(--muted); font-size: 0.75rem; font-weight: 650; letter-spacing: 0.12em; }
.kk-book-preferences { display: flex; align-items: center; gap: 0.5rem; }
.kk-book-preferences button, .kk-book-navigation button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; border: 1px solid var(--book-line); border-radius: 4px; padding: 0.4rem 0.8rem; background: transparent; color: inherit; font: inherit; font-size: 0.875rem; }
.kk-book-preferences button:hover:not(:disabled), .kk-book-navigation button:hover:not(:disabled) { background: var(--book-hover); }
.kk-book-preferences .kk-book-font-smaller, .kk-book-preferences .kk-book-font-larger { min-width: 40px; padding-inline: 0.5rem; font-family: var(--serif); font-size: 1rem; }
.kk-book-preferences .kk-book-close { margin-left: 0.5rem; border-color: var(--green); background: var(--green); color: var(--on-green); }
.kk-book-preferences .kk-book-close:hover { background: var(--green-hover); }
.kk-book-viewport { position: relative; flex: 1; min-height: 120px; overflow: hidden; margin: 0 28px; border: 1px solid var(--book-line); border-radius: 3px 7px 7px 3px; padding: 36px 40px; background: var(--book-paper); box-shadow: 3px 4px 0 -1px var(--book-edge), 6px 7px 0 -2px var(--book-edge), 0 12px 30px #263c2510; }
.kk-book-viewport::before { content: ""; position: absolute; z-index: 1; top: 0; bottom: 0; left: 50%; width: 38px; transform: translateX(-50%); background: linear-gradient(90deg, transparent, var(--book-spine) 50%, transparent); pointer-events: none; }
.kk-book-pages { --illustration-paper: var(--book-paper); width: 100%; height: 100%; column-count: 2; column-gap: 64px; column-fill: auto; font-family: var(--serif); font-size: 19px; line-height: 1.85; transform: translateX(0); transform-origin: left top; overflow-wrap: anywhere; }
.kk-book-pages .kk-book-story-title { margin: 0 0 0.65em; font-size: 2.1em; line-height: 1.2; letter-spacing: -0.035em; break-after: avoid; }
.kk-book-subtitle { margin: 0 0 1.6em; color: var(--muted); font-family: var(--sans); font-size: 0.8em; line-height: 1.8; }
.kk-book-pages .story-prose { font-family: inherit; font-size: inherit; line-height: inherit; }
.kk-book-pages .story-prose p { margin-bottom: 1.25em; }
.kk-book-pages .story-prose h2, .kk-book-pages .story-prose h3 { margin: 1.25em 0 0.65em; font-size: 1.5em; line-height: 1.3; break-after: avoid; }
.kk-book-pages .story-prose .kk-story-illustration { margin: 1.4em 0; break-inside: avoid; }
.kk-book-pages .story-prose .kk-story-illustration img { width: 100%; max-height: min(280px, 38vh); height: auto; margin: 0 auto; object-fit: contain; background: white; }
.kk-book-pages .story-prose .kk-story-illustration figcaption { margin-top: 0.55em; color: var(--muted); font-size: 0.75em; line-height: 1.6; }
.kk-book-pages .phrase-section { margin: 0; border: 0; padding: 0; break-before: column; font-family: var(--sans); font-size: 0.85em; line-height: 1.75; }
.kk-book-pages .phrase-section .eyebrow { margin-bottom: 0.7em; font-size: 0.75em; }
.kk-book-pages .phrase-section h2 { margin: 0 0 0.7em; font-size: 1.8em; line-height: 1.25; }
.kk-book-pages .phrase-section > p { margin-bottom: 1.25em; font-size: 0.95em; line-height: 1.7; }
.kk-book-pages .phrase-row { display: block; padding: 0.85em 0; break-inside: avoid; }
.kk-book-pages .phrase-row dt { margin-bottom: 0.3em; font-size: 1.1em; line-height: 1.5; }
.kk-book-pages .phrase-row dd { font-size: 0.95em; line-height: 1.7; }
.kk-book-pages .story-prose .kk-section-meanings { margin: 1.25em 0 1.6em; border: 1px solid var(--line); padding: .9em 1em; background: var(--soft); break-before: auto; font-size: .85em; line-height: 1.6; }
.kk-book-pages .story-prose .kk-section-meanings h2, .kk-book-pages .story-prose .kk-section-meanings h3 { margin: 0 0 .6em; font-size: 1.35em; }
.kk-book-pages .story-prose .kk-section-meanings .phrase-row { padding-block: .65em; }
.kk-book-navigation { display: flex; width: min(440px, calc(100% - 48px)); align-items: center; justify-content: space-between; flex-shrink: 0; gap: 1rem; margin: 20px auto 0; }
.kk-book-navigation button { min-width: 90px; }
.kk-book-counter { color: var(--muted); font-family: var(--serif); font-size: 1rem; text-align: center; white-space: nowrap; }
.kk-book-hint { flex-shrink: 0; margin: 10px 20px 16px; color: var(--muted); font-size: 0.8125rem; line-height: 1.6; text-align: center; }
@media (max-width: 760px) {
  .kk-book-reader { inset: 0; width: 100%; max-width: none; height: 100vh; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .kk-book-toolbar { padding: 10px 12px; }
  .kk-book-ritual { display: none; }
  .kk-book-preferences { width: 100%; justify-content: space-between; gap: 0.25rem; }
  .kk-book-preferences button { min-height: 40px; padding: 0.4rem 0.55rem; font-size: 0.875rem; }
  .kk-book-preferences .kk-book-font-smaller, .kk-book-preferences .kk-book-font-larger { min-width: 36px; }
  .kk-book-preferences .kk-book-close { margin-left: auto; }
  .kk-book-viewport { margin: 0 12px; padding: 24px; }
  .kk-book-viewport::before { display: none; }
  .kk-book-pages { column-count: 1; column-gap: 36px; }
  .kk-book-pages .kk-book-story-title { font-size: 1.85em; }
  .kk-book-pages .story-prose .kk-story-illustration img { max-height: min(250px, 35vh); }
  .kk-book-navigation { margin-top: 16px; }
  .kk-book-hint { margin: 8px 18px 12px; font-size: 0.75rem; }
  .reader-sidebar .kk-book-open { flex-basis: 100%; margin-top: 0.25rem; }
}

@media print { .kk-book-reader { display: none !important; } }
.story-end { margin-top: 3.5rem; padding: 2.5rem; border-radius: 5px; background: var(--soft); text-align: center; }
.story-end > .icon { width: 1.5rem; height: 1.5rem; margin-bottom: 1rem; color: var(--orange); }
.story-end h2 { margin-bottom: 0.65rem; font-size: 2rem; }
.story-end p { margin-bottom: 1.5rem; color: var(--muted); font-size: 0.9375rem; }
.page-content { max-width: 800px; padding-block: 4rem; }
.page-content h1 { margin-bottom: 2rem; }
.alignleft { float: left; margin: 0.5rem 1.5rem 1rem 0; }
.alignright { float: right; margin: 0.5rem 0 1rem 1.5rem; }
.aligncenter { display: block; margin-inline: auto; }
.wp-caption { max-width: 100%; }
.wp-caption-text, .wp-element-caption { color: var(--muted); font-family: var(--sans); font-size: 0.875rem; }
.wp-block-image img { max-width: 100%; height: auto; }
.wp-block-embed__wrapper { overflow: hidden; }
.wp-block-columns { gap: 1.5rem; }

@media (min-width: 1500px) {
  .hero { padding-block: 6.5rem; }
}

@media (max-width: 1100px) {
  .hero { gap: 3rem; }
  .header-note { display: none; }
  .strip-inner { flex-wrap: wrap; justify-content: flex-start; gap: 0.8rem 2rem; padding-block: 1.2rem; }
  .strip-intro { flex-basis: 100%; }
  .story-grid { gap: 1.25rem; }
  .story-art { height: 195px; }
  .card-body { padding: 1.2rem; }
  .card-meta { align-items: flex-start; flex-direction: column; gap: 0.45rem; }
  .closing-note { padding: 2rem; }
  .closing-note > a { display: none; }
  .reader-layout { gap: 2.5rem; grid-template-columns: 190px minmax(0, 1fr); }
}

@media (max-width: 780px) {
  .page-width, .header-inner, .footer-inner, .reader-main { width: calc(100% - 3rem); }
  .header-inner { min-height: 82px; gap: 1rem; }
  .brand { font-size: 1.4rem; }
  .brand-icon .icon { width: 1.4rem; height: 1.4rem; }
  .main-nav { gap: 1.2rem; }
  .custom-nav { gap: 1.2rem; }
  .main-nav a { font-size: 0.875rem; }
  .kk-theme-toggle { width: 44px; padding: 0; }
  .kk-theme-toggle [data-kk-theme-label] { display: none; }
  .hero { gap: 2rem; padding-block: 3.5rem; }
  .hero h1 { font-size: 2.9rem; }
  .hero .eyebrow { font-size: 0.75rem; }
  .hero-description { font-size: 1rem; line-height: 1.8; }
  .hero-facts { flex-direction: column; }
  .hero-facts span + span::before { content: none; }
  .featured-story .featured-art, .hero-placeholder .story-art { height: 220px; }
  .featured-caption { padding: 1rem 0.7rem 0.5rem; }
  .featured-caption h2 { font-size: 1.5rem; }
  .featured-caption p { font-size: 1rem; }
  .featured-stamp { right: -0.6rem; font-size: 0.75rem; padding: 0.5rem; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 0.8rem; }
  .library { padding-top: 3.5rem; }
  .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .story-art { height: 205px; }
  .story-card:last-child:nth-child(odd) { grid-column: 1 / -1; max-width: calc(50% - 0.625rem); }
  .sort-field select { min-width: 155px; }
  .search-field input { font-size: 1rem; }
  .closing-note { margin-bottom: 3.5rem; }
  .closing-note h2 { font-size: 1.55rem; }
  .footer-inner { justify-content: center; flex-direction: column; text-align: center; }
  .reader-art { height: 300px; }
  .reader-layout { grid-template-columns: 1fr; gap: 2rem; margin-top: 2rem; }
  .reader-sidebar { position: static; display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
  .reader-sidebar .eyebrow, .reader-sidebar p { display: none; }
  .reader-sidebar .kk-meaning-help:not([hidden]) { display: block; flex-basis: 100%; margin: 0; }
  .reader-sidebar > a { margin-right: auto; }
  .text-controls { margin: 0; padding: 0; border: 0; }
  .text-controls > span { margin-right: 0.5rem; }
}

@media (max-width: 560px) {
  .page-width, .header-inner, .footer-inner, .reader-main { width: calc(100% - 2.5rem); }
  .header-inner { flex-wrap: wrap; justify-content: center; padding-block: 1.1rem; gap: 0.65rem; }
  .brand { margin-right: auto; }
  .main-nav { order: 1; width: 100%; justify-content: center; margin: 0; gap: 0.75rem 1.75rem; flex-wrap: wrap; }
  .custom-nav { justify-content: center; gap: 0.75rem 1.75rem; }
  .hero { grid-template-columns: 1fr; gap: 2.8rem; padding-block: 2.8rem 3.5rem; }
  .hero h1 { font-size: clamp(2.55rem, 10vw, 3.3rem); }
  .hero .eyebrow { margin-bottom: 1.25rem; font-size: 0.75rem; }
  .hero-description { max-width: none; font-size: 1rem; }
  .hero-facts { flex-direction: row; gap: 0.3rem 0.7rem; font-size: 0.75rem; }
  .hero-facts span + span::before { content: "·"; margin-right: 0.7rem; }
  .featured-story { width: calc(100% - 0.7rem); margin-inline: auto; transform: rotate(1.5deg); }
  .featured-story .featured-art, .hero-placeholder .story-art { height: 240px; }
  .featured-caption { padding: 1.25rem 0.85rem 0.65rem; }
  .featured-caption h2 { font-size: 1.8rem; }
  .featured-caption p { font-size: 1rem; }
  .featured-stamp { font-size: 0.75rem; }
  .strip-inner { display: grid; grid-template-columns: 1fr; gap: 0.65rem; padding-block: 1.5rem; }
  .strip-inner .strip-intro { margin-bottom: 0.3rem; font-size: 1.125rem; }
  .library { padding-block: 3rem 1rem; }
  .section-heading .eyebrow { font-size: 0.75rem; }
  .section-heading h2 { max-width: 290px; font-size: 2.15rem; }
  .section-heading > p { font-size: 0.9375rem; }
  .library-tools { flex-wrap: wrap; gap: 0.6rem; }
  .search-field { flex-basis: 100%; }
  .sort-field { flex: 1; }
  .sort-field select { width: 100%; }
  .search-button { min-height: 3rem; padding: 0.65rem 1.25rem; }
  .tag-filters { gap: 0.5rem; margin-bottom: 1.5rem; }
  .tag-filter { min-height: 2.5rem; padding: 0.4rem 0.85rem; font-size: 0.875rem; }
  .results-label > span { display: none; }
  .story-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .story-card:last-child:nth-child(odd) { max-width: none; }
  .story-art { height: 235px; }
  .card-body { padding: 1.4rem; }
  .card-body h3 { font-size: 1.8rem; }
  .card-meta { flex-direction: row; font-size: 0.75rem; }
  .closing-note { flex-direction: column; align-items: flex-start; gap: 1.2rem; padding: 1.75rem; margin-block: 2.5rem 3rem; }
  .closing-note h2 { font-size: 1.8rem; }
  .reader-main { padding-top: 1.7rem; }
  .reader-header { margin-bottom: 2rem; }
  .back-link { margin-bottom: 1.5rem; }
  .reader-header h1 { font-size: 2.7rem; }
  .reader-subtitle { font-size: 1rem; }
  .reader-meta { gap: 0.5rem 1rem; font-size: 0.75rem; }
  .reader-art { height: 240px; border-radius: 5px; }
  .reader-sidebar { gap: 0.7rem; }
  .reader-sidebar > a { font-size: 0.875rem; }
  .text-controls { gap: 0.3rem; }
  .text-controls > span { font-size: 0.875rem; margin-right: 0.25rem; }
  .text-controls button { width: 2rem; height: 2rem; }
  .story-prose { line-height: 1.85; }
  .phrase-section { margin-top: 2.5rem; padding-top: 2rem; }
  .phrase-section .eyebrow { font-size: 0.75rem; }
  .phrase-section h2 { font-size: 2rem; }
  .phrase-row { grid-template-columns: 1fr; gap: 0.4rem; padding-block: 1rem; }
  .phrase-row dt { font-size: 1.125rem; }
  .story-end { padding: 2rem 1.25rem; }
  .page-content { padding-block: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  body { background: white; color: black; }
  .site-header, .site-footer, .reader-sidebar, .story-end, .back-link, .reader-art { display: none; }
  .reader-main { width: 100%; padding: 0; }
  .reader-layout { display: block; }
  .story-prose { font-size: 12pt !important; line-height: 1.6; }
  .reader-header h1 { font-size: 28pt; }
  .phrase-row { break-inside: avoid; }
  .story-prose h2 { break-after: avoid; }
  .story-prose .kk-story-illustration img { max-height: 90mm; width: auto; margin-inline: auto; }
  .kk-meaning-popover { display: none !important; }
  .story-prose .kk-phrase-trigger { color: inherit; text-decoration: none; }
}

/* Section vocabulary and the final English Summary travel with the story. */
.story-prose .kk-section-phrases {
  margin: 1.6rem 0 2.2rem;
  padding: 1.1rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--section-paper);
  font-family: var(--sans);
  font-size: .85em;
  line-height: 1.65;
  break-inside: avoid;
}
.story-prose .kk-section-phrases h3 { margin: 0 0 .7rem; font-family: var(--sans); font-size: 1em; font-weight: 650; }
.story-prose .kk-section-phrases dl { margin: 0; }
.story-prose .kk-section-phrases .phrase-row { display: grid; grid-template-columns: minmax(80px, 1fr) 2fr; gap: .9rem; padding: .35rem 0; border: 0; }
.story-prose .kk-section-phrases dt { font-weight: 600; overflow-wrap: anywhere; }
.story-prose .kk-section-phrases dd { margin: 0; overflow-wrap: anywhere; }
.story-prose .kk-story-summary { margin: 2.2rem 0 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.story-prose .kk-story-summary h2 { margin: 0 0 1rem; }
.story-prose .kk-story-summary p { font-family: var(--sans); font-size: .95em; line-height: 1.8; }
@media print { .story-prose .kk-section-phrases { background: white; border-color: #aaa; } .story-prose .kk-story-summary { border-color: #aaa; } }

/* One shared pronunciation reference for every story. */
.pronunciation-guide { max-width: 1040px; padding-block: 3.5rem 5rem; }
.guide-header { max-width: 760px; margin-bottom: 1.8rem; }
.guide-header .back-link { display: inline-block; margin-bottom: 2.1rem; }
.guide-header .eyebrow { color: var(--orange); margin-bottom: 1rem; }
.guide-header h1 { margin-bottom: 1.2rem; }
.guide-header > p { color: var(--muted); font-size: 1.12rem; line-height: 1.85; }
.guide-jump-links { display: flex; gap: .6rem; flex-wrap: wrap; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.guide-jump-links a { border: 1px solid var(--line); border-radius: 5px; padding: .5rem .85rem; font-size: .88rem; text-decoration: none; background: var(--white); }
.guide-jump-links a:hover, .main-nav a[aria-current="page"] { color: var(--orange); text-decoration: underline; }
.guide-section { padding-top: 2.8rem; }
.guide-section > h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin-bottom: 1.1rem; }
.guide-section > p { max-width: 810px; }
.pronunciation-guide code { padding: .08em .3em; border-radius: 3px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .94em; background: var(--soft); color: var(--green); }
.guide-note, .guide-source-note { color: var(--muted); font-size: .88rem; }
.guide-table-wrap { overflow-x: auto; margin: 1.4rem 0; border: 1px solid var(--line); border-radius: 6px; background: var(--white); }
.guide-table { width: 100%; border-collapse: collapse; text-align: left; }
.guide-table caption { padding: .8rem 1rem; color: var(--muted); text-align: left; font-size: .85rem; border-bottom: 1px solid var(--line); }
.guide-table th, .guide-table td { padding: .85rem 1rem; vertical-align: top; border-bottom: 1px solid var(--line); }
.guide-table thead th { font-size: .8rem; background: var(--soft); }
.guide-table tbody th { white-space: nowrap; }
.guide-table tbody tr:last-child > * { border-bottom: 0; }
.guide-table td > span { color: var(--muted); font-size: .88em; }
.guide-pair-divider { padding-inline: .4rem; }
.guide-key-point { border-left: 3px solid var(--orange); padding: .8rem 1rem; background: var(--soft); }
.guide-example-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.guide-example-grid > p { margin: 0; padding: 1.2rem; border: 1px solid var(--line); border-radius: 6px; background: var(--white); }
.guide-example-grid > p > code { display: inline-block; font-size: 1.15rem; margin-bottom: .7rem; }
.guide-example-grid > p > span { display: block; font-size: .9rem; line-height: 1.8; }
.guide-sound-notes { margin: 1.5rem 0 0; }
.guide-sound-notes > div { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.guide-sound-notes dt { margin-bottom: .4rem; font-weight: 600; }
.guide-sound-notes dd { margin: 0; line-height: 1.8; }
.guide-practice-list { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.guide-practice-list li { margin-bottom: 1rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: 6px; background: var(--white); }
.guide-practice-list li > code { display: inline-block; margin-bottom: .7rem; font-size: 1.1rem; }
.guide-practice-list li > span { display: block; font-size: .92rem; }
.reader-sidebar .reader-pronunciation-link { display: block; margin-top: 1rem; font-size: .85rem; }
@media (max-width: 760px) {
  .main-nav { flex-wrap: wrap; gap: .65rem 1.1rem; }
  .pronunciation-guide { padding-block: 2.2rem 3.5rem; }
  .guide-table th, .guide-table td { padding: .7rem .65rem; font-size: .87rem; }
  .guide-example-grid { grid-template-columns: 1fr; }
}
@media print {
  .guide-jump-links, .guide-header .back-link, .guide-section > .button { display: none; }
  .pronunciation-guide { width: 100%; padding: 0; }
  .guide-table-wrap { overflow: visible; }
  .guide-table thead { display: table-header-group; }
  .guide-table tr, .guide-example-grid > p { break-inside: avoid; }
  .pronunciation-guide code { color: black; background: transparent; padding: 0; }
}

/* English and Roman-letter Hindi remain distinct inside one definition. */
.kk-definition-language + .kk-definition-language { margin-top: .55rem; }
.kk-language-label { display: block; margin-bottom: .1rem; font-family: var(--sans); font-size: .68em; font-weight: 650; letter-spacing: .06em; line-height: 1.5; color: var(--muted); }
.kk-meaning-en, .kk-meaning-hi { display: block; }
.kk-meaning-popover .kk-meaning-language { margin: .7rem 0 .15rem; font-size: .7rem; font-weight: 650; color: var(--muted); }
.kk-meaning-popover .kk-meaning-text, .kk-meaning-popover .kk-meaning-hindi { margin-top: 0; }

/* Printing always uses dark ink and the original artwork on white paper. */
@media print {
  :root, :root[data-theme] {
    color-scheme: light;
    --paper: white;
    --white: white;
    --ink: black;
    --muted: #444;
    --green: #213a32;
    --orange: #713c28;
    --line: #aaa;
    --soft: white;
    --on-green: white;
    --section-paper: white;
    --illustration-filter: none;
    --illustration-blend: normal;
  }
  img.story-art, .story-art > img, .story-art > svg, .story-prose img, .wp-block-image img { filter: none !important; mix-blend-mode: normal !important; }
}
