/* ============================================================
   Blog — blog.html, /blog/<slug> (blog/index.php), blog-write.html
   Loaded only on blog pages, after styles.css. Uses its colour
   tokens, so light and dark themes both work.
   ============================================================ */

:root {
  --blog-measure: 700px;
  --post-size: 1.13rem;
  --hdr: 66px;                     /* sticky header height; js/blog*.js measures it */
  --chip-bg: var(--cream-deep);
  --gold-tint: rgba(217, 154, 43, 0.14);
}
:root[data-theme="dark"] { --gold-tint: rgba(232, 182, 87, 0.16); }

/* ---------- Shared bits ---------- */
.cat-chip {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.28rem 0.75rem; border-radius: 999px;
  background: var(--gold-tint); color: var(--accent-text); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.01em;
  white-space: nowrap;
}
a.cat-chip:hover { text-decoration: none; background: var(--gold); color: var(--navy-deep); }
.cat-chip--sm { font-size: 0.72rem; padding: 0.18rem 0.6rem; }
.lang-chip {
  display: inline-flex; align-items: center; padding: 0.22rem 0.7rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  background: var(--navy); color: var(--gold-soft);
}
.avatar {
  --size: 32px;
  width: var(--size); height: var(--size); flex: 0 0 var(--size); border-radius: 50%; overflow: hidden;
  display: inline-grid; place-items: center; background: radial-gradient(circle at 35% 30%, #2a4180, var(--navy-deep));
  color: var(--gold-soft); font-family: var(--serif); font-weight: 700; font-size: calc(var(--size) * 0.4);
  box-shadow: 0 0 0 2px var(--surface);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.blog-toast {
  position: fixed; left: 50%; bottom: 1.4rem; z-index: 120; transform: translate(-50%, 140%); transition: transform .3s cubic-bezier(.2,.9,.3,1.2);
  background: var(--navy); color: #fff; padding: 0.75rem 1.2rem; border-radius: 14px; box-shadow: var(--shadow); max-width: min(92vw, 520px);
  display: flex; gap: 0.8rem; align-items: center; font-size: 0.95rem;
}
.blog-toast.show { transform: translate(-50%, 0); }
.blog-toast button { background: var(--gold); color: var(--navy-deep); border: 0; border-radius: 999px; padding: 0.35rem 0.9rem; font-weight: 700; cursor: pointer; }
.blog-toast .toast-x { background: transparent; color: #c9d2e6; padding: 0.2rem 0.4rem; font-size: 1.1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Blog page hero ---------- */
.blog-hero { position: relative; overflow: hidden; background: radial-gradient(1200px 500px at 85% -10%, #2c4580 0%, transparent 60%), var(--navy); color: #eef1f7; padding-block: clamp(2.6rem, 6vw, 4.4rem); }
.blog-hero::after {
  content: ""; position: absolute; inset: auto -80px -120px auto; width: 420px; height: 420px; opacity: 0.18; pointer-events: none;
  background: radial-gradient(circle, var(--gold) 2.2px, transparent 2.6px) 0 0 / 28px 28px;
  -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%);
}
.blog-hero-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(1.4rem, 4vw, 3rem); align-items: center; position: relative; z-index: 1; }
@media (max-width: 860px) { .blog-hero-grid { grid-template-columns: 1fr; } }
.blog-hero h1 { color: #fff; margin: 0.2rem 0 0.4rem; }
.blog-hero h1 .tamil { display: block; font-size: 0.5em; color: var(--gold-soft); margin-top: 0.3rem; letter-spacing: 0; }
.blog-hero .lead { color: #c9d2e6; font-size: 1.12rem; max-width: 50ch; }
.blog-hero .eyebrow { color: var(--gold-soft); }
.hero-stats { display: flex; gap: 1.6rem; margin-top: 1.4rem; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-family: var(--serif); font-size: 1.7rem; color: var(--gold-soft); line-height: 1; }
.hero-stats span { font-size: 0.8rem; color: #9fb0d8; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 0.3rem; }

.prompt-card {
  position: relative; padding: 1.5rem 1.5rem 1.3rem; border-radius: 20px; overflow: hidden;
  background: linear-gradient(140deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)); border: 1px solid rgba(232,182,87,0.45);
  box-shadow: 0 20px 40px -24px rgba(0,0,0,0.6); backdrop-filter: blur(6px);
}
.prompt-card::before { content: "✍️"; position: absolute; right: 1rem; top: 0.8rem; font-size: 2.4rem; opacity: 0.9; transform: rotate(-8deg); }
.prompt-card .eyebrow { margin: 0; }
.prompt-card h2 { color: #fff; font-size: 1.55rem; margin: 0.3rem 3rem 0.4rem 0; }
.prompt-card p { color: #d6ddee; margin: 0 0 1rem; font-size: 0.98rem; }
.prompt-card .btn { padding: 0.6rem 1.2rem; }

/* ---------- Featured story ---------- */
.featured-wrap { margin-top: calc(-1 * clamp(1.4rem, 3vw, 2.2rem)); position: relative; z-index: 2; }
.featured-card {
  display: grid; grid-template-columns: 1.35fr 1fr; background: var(--surface); border-radius: 22px; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line); color: inherit; transition: transform .25s, box-shadow .25s;
}
.featured-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: 0 24px 48px -24px rgba(19,31,61,0.45); }
.featured-card .card-cover { aspect-ratio: auto; min-height: 320px; height: 100%; border-radius: 0; }
.featured-card .card-body { padding: clamp(1.4rem, 3vw, 2.4rem); display: flex; flex-direction: column; justify-content: center; gap: 0.2rem; }
.featured-card h3 { font-size: clamp(1.5rem, 3vw, 2.15rem); margin: 0.7rem 0 0.5rem; }
.featured-card .card-sub { -webkit-line-clamp: 3; font-size: 1.05rem; }
.featured-ribbon { display: inline-flex; gap: 0.4rem; align-items: center; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
@media (max-width: 760px) { .featured-card { grid-template-columns: 1fr; } .featured-card .card-cover { min-height: 0; aspect-ratio: 16/9; } }

/* ---------- Filters ---------- */
.blog-controls {
  position: sticky; top: var(--hdr); z-index: 30; background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-block: 0.8rem;
}
.controls-row { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; }
.blog-search { position: relative; flex: 1 1 280px; min-width: 220px; }
.blog-search svg { position: absolute; left: 0.9rem; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
.blog-search input {
  width: 100%; padding: 0.72rem 2.6rem 0.72rem 2.6rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); font: inherit; font-size: 0.98rem; transition: border-color .2s, box-shadow .2s;
}
.blog-search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-tint); }
.blog-search kbd {
  position: absolute; right: 0.9rem; top: 50%; transform: translateY(-50%); font: 600 0.72rem var(--sans); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.05rem 0.4rem; background: var(--cream);
}
.blog-search .clear-q { position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%); border: 0; background: var(--cream-deep); color: var(--ink); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 1rem; }
.blog-select {
  appearance: none; padding: 0.68rem 2.2rem 0.68rem 1rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23999' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 0.9rem center / 12px;
  color: var(--ink); font: 600 0.9rem var(--sans); cursor: pointer;
}
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--ink-soft); font: 600 0.86rem var(--sans); padding: 0.42rem 0.8rem; border-radius: 999px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--gold-soft); }
.chips { display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: none; padding: 0.7rem 0 0.1rem; -webkit-mask: linear-gradient(90deg, #000 92%, transparent); mask: linear-gradient(90deg, #000 92%, transparent); }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 0.4rem; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); padding: 0.42rem 0.9rem; border-radius: 999px; font: 600 0.88rem var(--sans); cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--gold); }
.chip .n { font-size: 0.75rem; color: var(--ink-soft); font-weight: 700; }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip[aria-pressed="true"] .n { color: var(--gold-soft); }
:root[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--navy-deep); }
:root[data-theme="dark"] .chip[aria-pressed="true"] .n { color: var(--navy); }
.result-line { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin: 1.6rem 0 1rem; color: var(--ink-soft); font-size: 0.95rem; }
.result-line b { color: var(--heading); }
.result-line .link-btn { border: 0; background: none; color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.author-filter { display: inline-flex; align-items: center; gap: 0.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.4rem 0.3rem 0.35rem; color: var(--heading); font-weight: 600; }
.author-filter button { border: 0; background: var(--cream-deep); color: var(--ink); border-radius: 50%; width: 26px; height: 26px; cursor: pointer; }

/* ---------- Cards ---------- */
.blog-grid { display: grid; gap: clamp(1rem, 2.4vw, 1.6rem); grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.blog-grid--3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.blog-card {
  position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; color: inherit; box-shadow: var(--shadow-sm); transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
  animation: card-in .45s both;
}
.blog-card:hover { text-decoration: none; transform: translateY(-4px); box-shadow: 0 20px 40px -22px rgba(19,31,61,0.45); }
.card-link { color: inherit; }
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }   /* the whole card opens the story */
.card-link:hover { text-decoration: none; }
.blog-card:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.card-link:focus { outline: none; }
@keyframes card-in { from { opacity: 0; transform: translateY(14px); } }
.card-cover { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--navy); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.blog-card:hover .card-cover img, .featured-card:hover .card-cover img { transform: scale(1.05); }
.card-badges { position: absolute; top: 0.7rem; left: 0.7rem; right: 0.7rem; display: flex; gap: 0.4rem; align-items: flex-start; }
.card-badges .cat-chip { background: rgba(255,255,255,0.92); color: var(--navy); backdrop-filter: blur(4px); }
:root[data-theme="dark"] .card-badges .cat-chip { background: rgba(14,21,38,0.85); color: var(--gold-soft); }
.card-badges .lang-chip { margin-left: auto; }
.save-btn {
  position: absolute; z-index: 2; right: 0.7rem; bottom: 0.7rem; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,0.92); color: var(--navy); display: grid; place-items: center; font-size: 1rem;
  opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s, background .2s; box-shadow: var(--shadow-sm);
}
.blog-card:hover .save-btn, .save-btn:focus-visible, .save-btn[aria-pressed="true"] { opacity: 1; transform: none; }
.save-btn[aria-pressed="true"] { background: var(--gold); }
@media (hover: none) { .save-btn { opacity: 1; transform: none; } }
.card-body { padding: 1rem 1.15rem 1.1rem; display: flex; flex-direction: column; gap: 0.45rem; flex: 1; }
.card-body h3 { margin: 0; font-size: 1.24rem; line-height: 1.25; color: var(--heading); }
.card-body h3.tamil { font-size: 1.12rem; line-height: 1.5; }
.card-sub { margin: 0; color: var(--ink-soft); font-size: 0.94rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin-top: auto; padding-top: 0.6rem; display: flex; align-items: center; gap: 0.55rem; font-size: 0.84rem; color: var(--ink-soft); }
.card-foot .who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.card-foot .who b { color: var(--heading); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot .stats { margin-left: auto; display: flex; gap: 0.7rem; white-space: nowrap; }
.card-meta { font-size: 0.84rem; color: var(--ink-soft); }
mark.hit { background: var(--gold-tint); color: inherit; border-radius: 3px; padding: 0 1px; box-shadow: 0 -2px 0 var(--gold) inset; }
.blog-more { display: flex; justify-content: center; margin-top: 2rem; }
.blog-empty { text-align: center; padding: 3rem 1rem; }
.blog-empty .kolam-art { width: 120px; height: 120px; margin: 0 auto 1rem; opacity: 0.8; }
.skeleton { background: linear-gradient(90deg, var(--cream-deep) 25%, var(--line) 50%, var(--cream-deep) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 18px; min-height: 330px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Story page ---------- */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; pointer-events: none; }
.read-progress span { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--gold), var(--clay)); }
.story { --wrap-narrow: 820px; }
.post-head { padding-top: clamp(1.4rem, 4vw, 2.6rem); }
.post-head-inner { max-width: var(--wrap-narrow); }
.post-head .breadcrumb, .post-head .breadcrumb a { color: var(--ink-soft); }
.post-kicker { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.6rem 0 0.9rem; }
.post-title { font-size: clamp(2rem, 5.2vw, 3.3rem); line-height: 1.08; letter-spacing: -0.015em; margin: 0 0 0.6rem; }
.post-title.tamil { font-size: clamp(1.7rem, 4.4vw, 2.7rem); line-height: 1.35; }
.post-sub { font-family: var(--serif); font-size: clamp(1.1rem, 2.4vw, 1.35rem); color: var(--ink-soft); margin: 0 0 1.2rem; line-height: 1.45; font-weight: 400; }
.post-byline { display: flex; align-items: center; gap: 0.8rem; padding: 1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.byline-avatar { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #2a4180, var(--navy-deep)); color: var(--gold-soft); font: 700 1.2rem var(--serif); box-shadow: 0 0 0 3px var(--gold-tint); }
.byline-avatar img { width: 100%; height: 100%; object-fit: cover; }
.byline-avatar:hover { text-decoration: none; }
.byline-name { font-weight: 700; color: var(--heading); }
.byline-meta { font-size: 0.88rem; color: var(--ink-soft); }
.post-tools { margin-left: auto; display: flex; gap: 0.35rem; }
.tool-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--heading);
  font: 700 0.95rem var(--serif); cursor: pointer; display: grid; place-items: center; transition: background .15s, transform .15s;
}
.tool-btn:hover { background: var(--cream-deep); transform: translateY(-1px); }
.tool-btn[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); }
.tool-btn:disabled { opacity: 0.4; cursor: default; }
.size-pop { position: absolute; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0.4rem; box-shadow: var(--shadow); display: flex; gap: 0.3rem; }
.size-pop button { border: 0; background: var(--cream); color: var(--heading); border-radius: 10px; width: 46px; height: 40px; cursor: pointer; font-family: var(--serif); font-weight: 700; }
.size-pop button[aria-pressed="true"] { background: var(--navy); color: var(--gold-soft); }
.post-cover { margin: clamp(1.2rem, 3vw, 2rem) auto 0; max-width: 1180px; padding-inline: var(--gap); }
.post-cover img { width: 100%; max-height: 640px; object-fit: cover; border-radius: 22px; box-shadow: var(--shadow); background: var(--navy); }
.post-cover--kolam img { aspect-ratio: 21 / 8; max-height: 420px; }
.post-layout { display: grid; grid-template-columns: 190px minmax(0, var(--blog-measure)); gap: clamp(1.5rem, 4vw, 3.5rem); justify-content: center; padding-block: clamp(1.8rem, 4vw, 3rem) clamp(2rem, 5vw, 4rem); }
@media (max-width: 1000px) { .post-layout { grid-template-columns: minmax(0, var(--blog-measure)); } .story .post-rail { display: none; } }
.post-rail { position: sticky; top: calc(var(--hdr) + 1.5rem); align-self: start; display: flex; flex-direction: column; gap: 1.4rem; }
.post-toc b { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-soft); margin-bottom: 0.6rem; }
.post-toc ol, .post-toc-mobile ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.post-toc li a, .post-toc-mobile li a { display: block; padding: 0.3rem 0 0.3rem 0.9rem; margin-left: -2px; border-left: 2px solid transparent; color: var(--ink-soft); font-size: 0.88rem; line-height: 1.35; }
.post-toc li.toc-l3 a, .post-toc-mobile li.toc-l3 a { padding-left: 1.7rem; font-size: 0.83rem; }
.post-toc li a:hover { color: var(--heading); text-decoration: none; }
.post-toc li a.active { color: var(--heading); border-left-color: var(--gold); font-weight: 600; }
.post-toc-mobile { margin-bottom: 1.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0.8rem 1rem; }
.post-toc-mobile summary { cursor: pointer; font-weight: 700; color: var(--heading); }
.post-toc-mobile ol { margin-top: 0.6rem; }
@media (min-width: 1001px) { .post-toc-mobile { display: none; } }
.rail-share { display: flex; gap: 0.5rem; }
.share-ico { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--heading); cursor: pointer; transition: transform .15s, background .15s, color .15s; }
.share-ico svg { width: 20px; height: 20px; }
.share-ico:hover { transform: translateY(-2px); text-decoration: none; }
.share-wa:hover { background: #25d366; color: #fff; border-color: #25d366; }
.share-fb:hover { background: #1877f2; color: #fff; border-color: #1877f2; }

/* Story text */
.post-body { font-size: var(--post-size); line-height: 1.8; color: var(--ink); overflow-wrap: anywhere; }
.post-body > * { margin-block: 0; }
.post-body > * + * { margin-top: 1.15em; }
.post-body li > p { margin: 0; }
.post-body > p:first-child::first-letter {
  float: left; font-family: var(--serif); font-weight: 700; font-size: 3.6em; line-height: 0.82; margin: 0.08em 0.12em 0 0; color: var(--gold);
}
.story[lang="ta"] .post-body > p:first-child::first-letter { float: none; font: inherit; color: inherit; margin: 0; }
.post-body :lang(ta), .story[lang="ta"] .post-body { font-family: "Noto Serif Tamil", var(--tamil); line-height: 1.95; }
.post-body h2 { font-size: 1.65em; margin-top: 1.8em; scroll-margin-top: calc(var(--hdr) + 1rem); }
.post-body h3 { font-size: 1.3em; margin-top: 1.5em; scroll-margin-top: calc(var(--hdr) + 1rem); }
.post-body h2 + *, .post-body h3 + * { margin-top: 0.6em; }
.post-body a { color: var(--accent-text); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 3px; }
.post-body a:hover { text-decoration-color: currentColor; }
.post-body ul, .post-body ol { padding-left: 1.4em; }
.post-body li + li { margin-top: 0.35em; }
.post-body li::marker { color: var(--gold); font-weight: 700; }
.post-body blockquote {
  position: relative; margin: 1.8em 0; padding: 0.2em 0 0.2em 1.6em; border-left: 4px solid var(--gold);
  font-family: var(--serif); font-size: 1.22em; font-style: italic; line-height: 1.55; color: var(--heading);
}
.post-body blockquote::before { content: "“"; position: absolute; left: 0.18em; top: -0.32em; font-size: 2.6em; color: var(--gold); opacity: 0.3; font-style: normal; line-height: 1; pointer-events: none; }
.post-body hr { border: 0; height: 22px; margin: 2.2em auto; background: radial-gradient(circle, var(--gold) 2.5px, transparent 3px) center / 22px 22px repeat-x; width: 110px; opacity: 0.8; }
.post-body figure { margin: 2em calc(-1 * clamp(0px, 4vw, 60px)); }
.post-body figure img { display: block; width: auto; max-width: 100%; height: auto; max-height: min(78vh, 720px); margin-inline: auto; border-radius: 16px; box-shadow: var(--shadow-sm); cursor: zoom-in; }
.post-body figcaption { text-align: center; font-size: 0.85em; color: var(--ink-soft); margin-top: 0.6em; font-style: italic; }
.post-body mark { background: var(--gold-tint); color: inherit; padding: 0 0.15em; border-radius: 4px; box-shadow: 0 -0.45em 0 var(--gold-tint) inset; }
.post-body s { color: var(--ink-soft); }
.ta-word { border-bottom: 2px dotted var(--gold); cursor: help; position: relative; outline: none; }
.ta-word::after {
  content: attr(data-meaning); position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translate(-50%, 6px); width: max-content; max-width: 260px;
  background: var(--navy); color: #fff; font: 500 0.82rem/1.4 var(--sans); padding: 0.5rem 0.75rem; border-radius: 10px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 5; white-space: normal; text-align: center;
}
.ta-word::before { content: ""; position: absolute; left: 50%; bottom: calc(100% + 4px); border: 6px solid transparent; border-top-color: var(--navy); transform: translateX(-50%); opacity: 0; transition: opacity .18s; }
.ta-word:hover::after, .ta-word:focus::after, .ta-word.open::after { opacity: 1; transform: translate(-50%, 0); }
.ta-word:hover::before, .ta-word:focus::before, .ta-word.open::before { opacity: 1; }
.kural-card {
  position: relative; margin: 2em 0 !important; padding: 1.4em 1.5em 1.2em; border-radius: 18px; overflow: hidden;
  background: linear-gradient(135deg, var(--navy) 0%, #24386b 100%); color: #eef1f7; box-shadow: var(--shadow);
}
.kural-card::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 170px; height: 170px; opacity: 0.25;
  background: radial-gradient(circle, var(--gold-soft) 2px, transparent 2.6px) 0 0 / 18px 18px; border-radius: 50%;
}
.kural-label { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-soft); }
.kural-ta { font-size: 1.28em; font-weight: 600; line-height: 1.7; margin: 0.5em 0 0.4em !important; color: #fff; }
.kural-tr { font-size: 0.82em; color: #9fb0d8; font-style: italic; margin: 0 !important; }
.kural-en { font-family: var(--serif); font-size: 0.98em; color: #dfe5f2; margin: 0.7em 0 0 !important; }
.quote-hint { font-size: 0.85rem; margin: 2rem 0 0; }
@media (hover: none) { .quote-hint { display: none; } }
.post-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.45rem; padding: 0; margin: 1.6rem 0 0; }
.post-tags a { display: inline-block; padding: 0.3rem 0.75rem; border-radius: 999px; background: var(--cream-deep); color: var(--ink-soft); font-size: 0.85rem; font-weight: 600; }
.post-tags a:hover { background: var(--gold-tint); color: var(--heading); text-decoration: none; }

/* Reactions */
.react-bar { margin-top: 2.4rem; padding: 1.4rem; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); text-align: center; box-shadow: var(--shadow-sm); }
.react-q { margin: 0 0 0.9rem; font-family: var(--serif); font-size: 1.12rem; color: var(--heading); }
.react-row { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.react-btn {
  position: relative; display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.55rem 1rem 0.55rem 0.7rem; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--cream); color: var(--ink); cursor: pointer; font: 600 0.9rem var(--sans);
  transition: transform .15s, border-color .15s, background .15s;
}
.react-btn:hover { border-color: var(--gold); transform: translateY(-2px); }
.react-ico { font-size: 1.3rem; line-height: 1; transition: transform .3s cubic-bezier(.3,1.8,.5,1); }
.react-btn[aria-pressed="true"] { background: var(--gold-tint); border-color: var(--gold); color: var(--heading); }
.react-btn[aria-pressed="true"] .react-ico { transform: scale(1.18); }
.react-n { font-variant-numeric: tabular-nums; color: var(--ink-soft); min-width: 1ch; }
.react-btn[aria-pressed="true"] .react-n { color: var(--heading); }
.burst { position: absolute; left: 50%; top: 50%; pointer-events: none; font-size: 1.1rem; animation: burst .9s ease-out forwards; }
@keyframes burst { from { opacity: 1; transform: translate(-50%, -50%) scale(0.6); } to { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.3); } }

/* Author card */
.author-card { margin-top: 2.4rem; display: grid; grid-template-columns: 96px 1fr; gap: 1.3rem; padding: 1.5rem; border-radius: 20px; background: var(--cream-deep); border: 1px solid var(--line); }
@media (max-width: 560px) { .author-card { grid-template-columns: 1fr; text-align: center; justify-items: center; } }
.author-photo { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #2a4180, var(--navy-deep));
  color: var(--gold-soft); font: 700 2.2rem var(--serif); box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--gold); }
.author-photo img { width: 100%; height: 100%; object-fit: cover; }
.author-info .eyebrow { margin: 0; }
.author-info h2 { font-size: 1.45rem; margin: 0.15rem 0 0.4rem; }
.author-info p { margin: 0 0 0.6rem; color: var(--ink-soft); }
.badges { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; margin: 0.4rem 0 0; }
@media (max-width: 560px) { .badges { justify-content: center; } }
.badges li { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.7rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 0.8rem; font-weight: 600; color: var(--heading); }
.author-more { margin-top: 0.9rem; font-size: 0.92rem; }
.author-more ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }
@media (max-width: 560px) { .author-more ul { list-style: none; padding: 0; } }
.related { padding-block: clamp(2.4rem, 5vw, 3.6rem); }

/* Comments */
.comments { margin-top: 3rem; }
.comments h2 { font-size: 1.6rem; display: flex; align-items: center; gap: 0.6rem; }
.comments-n { font: 700 0.85rem var(--sans); background: var(--navy); color: var(--gold-soft); border-radius: 999px; padding: 0.1rem 0.6rem; }
.comments-n:empty { display: none; }
.c-form { display: grid; grid-template-columns: 44px 1fr; gap: 0.8rem; margin-bottom: 1.8rem; }
.c-form .avatar { --size: 44px; }
.c-box { background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; transition: border-color .2s, box-shadow .2s; }
.c-box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-tint); }
.c-box textarea { display: block; width: 100%; min-height: 54px; max-height: 320px; resize: none; border: 0; background: transparent; padding: 0.85rem 1rem; color: var(--ink); font: inherit; font-size: 1rem; line-height: 1.55; border-radius: 16px; }
.c-box textarea:focus { outline: none; }
.c-actions { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.6rem 0.6rem 1rem; }
.c-actions .count { font-size: 0.78rem; color: var(--ink-soft); margin-right: auto; }
.c-actions .count.over { color: var(--clay); font-weight: 700; }
.c-actions .btn { padding: 0.5rem 1.1rem; font-size: 0.9rem; }
.c-note { grid-column: 2; font-size: 0.82rem; color: var(--ink-soft); margin: -0.3rem 0 0; }
.c-error { grid-column: 2; font-size: 0.88rem; color: var(--clay); font-weight: 600; }
.c-hp { position: absolute !important; left: -5000px; width: 1px; height: 1px; opacity: 0; }
.c-login { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1.1rem 1.2rem; background: var(--surface); border: 1px dashed var(--line); border-radius: 16px; margin-bottom: 1.8rem; }
.c-login p { margin: 0; flex: 1; min-width: 200px; }
.c-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.3rem; }
.c-item { display: grid; grid-template-columns: 40px 1fr; gap: 0.75rem; animation: card-in .35s both; }
.c-item .avatar { --size: 40px; }
.c-replies { grid-column: 2; list-style: none; margin: 0.8rem 0 0; padding: 0 0 0 0.2rem; display: flex; flex-direction: column; gap: 1rem; border-left: 2px solid var(--line); padding-left: 0.9rem; }
.c-replies .c-item { grid-template-columns: 32px 1fr; }
.c-replies .avatar { --size: 32px; }
.c-head { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; font-size: 0.88rem; }
.c-head b { color: var(--heading); font-size: 0.95rem; }
.c-head time { color: var(--ink-soft); font-size: 0.8rem; }
.c-tag { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--navy); color: var(--gold-soft); }
.c-tag--pin { background: var(--gold); color: var(--navy-deep); }
.c-tag--held { background: var(--note-bg); color: var(--accent-text); border: 1px solid var(--gold); }
.c-text { margin: 0.2rem 0 0.3rem; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.c-deleted .c-text { color: var(--ink-soft); font-style: italic; }
.c-held { opacity: 0.85; }
.c-tools { display: flex; gap: 0.2rem; flex-wrap: wrap; }
.c-tools button { border: 0; background: none; color: var(--ink-soft); font: 600 0.8rem var(--sans); padding: 0.25rem 0.5rem; border-radius: 8px; cursor: pointer; }
.c-tools button:hover { background: var(--cream-deep); color: var(--heading); }
.c-reply-form { margin-top: 0.7rem; }
.c-pinned { background: var(--note-bg); border-radius: 14px; padding: 0.8rem; margin: -0.8rem; }
.c-closed { padding: 1rem 1.2rem; border-radius: 14px; background: var(--cream-deep); color: var(--ink-soft); }
.c-guide { font-size: 0.82rem; color: var(--ink-soft); margin-top: 1.6rem; }
.report-menu { position: absolute; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 0.35rem; display: flex; flex-direction: column; min-width: 190px; }
.report-menu b { padding: 0.4rem 0.6rem; font-size: 0.8rem; color: var(--ink-soft); }
.report-menu button { text-align: left; border: 0; background: none; padding: 0.5rem 0.6rem; border-radius: 8px; color: var(--ink); font: 500 0.9rem var(--sans); cursor: pointer; }
.report-menu button:hover { background: var(--cream-deep); }

/* Mobile action bar on stories */
.story-bar { display: none; }
@media (max-width: 1000px) {
  .story-bar {
    position: fixed; left: 50%; bottom: max(0.8rem, env(safe-area-inset-bottom)); z-index: 55; transform: translate(-50%, 0); transition: transform .3s, opacity .3s;
    display: flex; gap: 0.2rem; padding: 0.35rem; border-radius: 999px; background: var(--navy); box-shadow: 0 14px 30px -10px rgba(0,0,0,0.5);
  }
  .story-bar.hide { transform: translate(-50%, 140%); opacity: 0; }
  .story-bar button { border: 0; background: transparent; color: #fff; font: 600 0.88rem var(--sans); padding: 0.55rem 0.85rem; border-radius: 999px; display: inline-flex; gap: 0.35rem; align-items: center; cursor: pointer; }
  .story-bar button[aria-pressed="true"] { background: rgba(232,182,87,0.25); color: var(--gold-soft); }
}

/* Share-a-quote */
.quote-pop {
  position: absolute; z-index: 45; transform: translate(-50%, -100%); margin-top: -10px; background: var(--navy); color: #fff; border: 0; border-radius: 999px;
  padding: 0.5rem 0.9rem; font: 700 0.85rem var(--sans); box-shadow: var(--shadow); cursor: pointer; animation: card-in .2s both; white-space: nowrap;
}
.quote-pop::after { content: ""; position: absolute; left: 50%; top: 100%; border: 6px solid transparent; border-top-color: var(--navy); transform: translateX(-50%); }
.blog-dialog {
  width: min(560px, calc(100vw - 24px)); max-height: min(92vh, 900px); padding: 0; border: 0; border-radius: 20px; background: var(--surface);
  color: var(--ink); box-shadow: var(--shadow); outline: 1px solid rgba(255,255,255,0.06);
}
.blog-dialog--wide { width: min(760px, calc(100vw - 24px)); }
.blog-dialog::backdrop { background: rgba(8, 12, 24, 0.72); backdrop-filter: blur(3px); }
.blog-dialog[open] { display: flex; flex-direction: column; animation: dlg-in .25s cubic-bezier(.2,.9,.3,1.1); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.dlg-head { display: flex; align-items: center; gap: 0.6rem; padding: 1rem 1.2rem 0.4rem 1.4rem; }
.dlg-head h3 { margin: 0; flex: 1; font-size: 1.3rem; }
.dlg-x { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--cream-deep); color: var(--heading); font-size: 1.4rem; cursor: pointer; }
.dlg-body { padding: 0.6rem 1.4rem 1rem; overflow-y: auto; }
.dlg-foot { display: flex; gap: 0.6rem; justify-content: flex-end; flex-wrap: wrap; padding: 0.8rem 1.4rem 1.2rem; border-top: 1px solid var(--line); }
.dlg-foot .btn { padding: 0.6rem 1.2rem; }
.quote-canvas { width: 100%; height: auto; border-radius: 14px; box-shadow: var(--shadow-sm); display: block; }
.lightbox { position: fixed; inset: 0; z-index: 130; background: rgba(5,8,16,0.92); display: grid; place-items: center; padding: 1rem; cursor: zoom-out; animation: card-in .2s both; }
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 12px; box-shadow: 0 30px 60px rgba(0,0,0,0.5); }

/* ---------- Write page ---------- */
.write-page { padding-block: clamp(1.4rem, 3vw, 2.4rem) 4rem; }
.write-top { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.write-top h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0; flex: 1; }
.write-tabs { display: flex; gap: 0.3rem; border-bottom: 1px solid var(--line); margin-bottom: 1.4rem; }
.write-tabs button { border: 0; background: none; padding: 0.7rem 1rem; font: 600 0.95rem var(--sans); color: var(--ink-soft); border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; }
.write-tabs button[aria-selected="true"] { color: var(--heading); border-bottom-color: var(--gold); }
.dash-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.6rem; align-items: start; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.2rem 1.3rem; box-shadow: var(--shadow-sm); }
.panel + .panel { margin-top: 1rem; }
.panel h3 { font-size: 1.1rem; margin: 0 0 0.6rem; }
.panel--prompt { background: linear-gradient(140deg, var(--navy), #24386b); color: #e3e8f4; border: 0; }
.panel--prompt h3 { color: #fff; font-size: 1.3rem; }
.panel--prompt .eyebrow { color: var(--gold-soft); margin: 0; }
.panel--prompt p { color: #cdd5e8; font-size: 0.95rem; }
.me-card { display: flex; gap: 0.9rem; align-items: center; }
.me-card .avatar { --size: 64px; box-shadow: 0 0 0 3px var(--gold); }
.me-card b { display: block; color: var(--heading); font-size: 1.05rem; }
.me-card small { color: var(--ink-soft); }
.story-list { display: flex; flex-direction: column; gap: 0.8rem; }
.story-row { display: grid; grid-template-columns: 132px 1fr auto; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 0.7rem; transition: box-shadow .2s, transform .2s; }
.story-row:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.story-row .thumb { aspect-ratio: 16/10; border-radius: 10px; overflow: hidden; background: var(--navy); }
.story-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.story-row h4 { margin: 0 0 0.3rem; font-size: 1.08rem; font-family: var(--serif); color: var(--heading); }
.story-row .meta { font-size: 0.82rem; color: var(--ink-soft); display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.story-row .note { margin: 0.45rem 0 0; font-size: 0.86rem; padding: 0.45rem 0.7rem; border-radius: 10px; background: var(--note-bg); border-left: 3px solid var(--gold); }
.story-row .row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.story-row .row-actions .btn { padding: 0.45rem 0.9rem; font-size: 0.85rem; }
@media (max-width: 640px) { .story-row { grid-template-columns: 90px 1fr; } .story-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; } }
.status { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.15rem 0.55rem; border-radius: 999px; }
.status--draft { background: var(--cream-deep); color: var(--ink-soft); }
.status--pending { background: #fff1d6; color: #9a6400; }
.status--published { background: #dff3e1; color: #1f6b2a; }
.status--changes_requested { background: #fde4d4; color: #9c4a1a; }
.status--rejected { background: #f6dcdc; color: #8a2b2b; }
.status--hidden { background: var(--cream-deep); color: var(--ink-soft); }
:root[data-theme="dark"] .status--pending { background: #3a2e12; color: #f2c66b; }
:root[data-theme="dark"] .status--published { background: #173a1f; color: #7fd58c; }
:root[data-theme="dark"] .status--changes_requested { background: #3d2516; color: #f0a476; }
:root[data-theme="dark"] .status--rejected { background: #3d1c1c; color: #f09a9a; }
.empty-stories { text-align: center; padding: 2.4rem 1rem; border: 2px dashed var(--line); border-radius: 18px; }
.empty-stories .big { font-size: 3rem; }

/* Editor */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.8rem; align-items: start; }
@media (max-width: 1000px) { .editor-grid { grid-template-columns: 1fr; } }
.editor-main { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-sm); }
.cover-zone { position: relative; aspect-ratio: 21 / 9; border-radius: 22px 22px 0 0; overflow: hidden; background: var(--navy); }
.cover-zone img { width: 100%; height: 100%; object-fit: cover; }
.cover-zone .cover-actions { position: absolute; inset: auto 1rem 1rem auto; display: flex; gap: 0.5rem; }
.cover-zone .cover-actions .btn { padding: 0.5rem 1rem; font-size: 0.85rem; background: rgba(255,255,255,0.94); color: var(--navy); border: 0; }
.cover-zone .cover-hint { position: absolute; left: 1.2rem; bottom: 1rem; color: #fff; font-size: 0.85rem; text-shadow: 0 1px 6px rgba(0,0,0,0.5); }
.cover-zone.drag { outline: 3px dashed var(--gold); outline-offset: -10px; }
.cover-zone .uploading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10,16,32,0.55); color: #fff; font-weight: 700; }
.editor-pad { padding: clamp(1.2rem, 3vw, 2.2rem) clamp(1.1rem, 4vw, 3rem) 2rem; }
.title-input, .sub-input {
  display: block; width: 100%; border: 0; background: transparent; color: var(--heading); resize: none; overflow: hidden; padding: 0; outline: none;
}
.title-input { font: 700 clamp(1.8rem, 4.4vw, 2.7rem)/1.15 var(--serif); letter-spacing: -0.01em; }
.sub-input { font: 400 clamp(1.05rem, 2.2vw, 1.3rem)/1.45 var(--serif); color: var(--ink-soft); margin-top: 0.6rem; }
.title-input::placeholder, .sub-input::placeholder { color: color-mix(in srgb, var(--ink-soft) 55%, transparent); }
.toolbar {
  position: sticky; top: var(--hdr); z-index: 20; display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; gap: 0.1rem; align-items: center;
  margin: 1.4rem calc(-1 * clamp(0.4rem, 2vw, 1.4rem)) 1rem; padding: 0.4rem; border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.toolbar .sep { width: 1px; height: 24px; background: var(--line); margin: 0 0.25rem; }
.tb {
  flex: 0 0 auto; min-width: 34px; height: 36px; padding: 0 0.45rem; border: 0; border-radius: 9px; background: transparent; color: var(--heading);
  display: inline-grid; place-items: center; cursor: pointer; font: 700 0.9rem var(--sans); transition: background .12s;
}
.tb svg { width: 18px; height: 18px; }
.tb:hover { background: var(--cream-deep); }
.tb.is-active { background: var(--navy); color: var(--gold-soft); }
.tb:disabled { opacity: 0.35; cursor: default; background: transparent; }
.tb-ta { font-family: "Noto Sans Tamil", var(--sans); font-size: 1rem; }
.ProseMirror { outline: none; min-height: 360px; }
.ProseMirror p.is-editor-empty:first-child::before { content: attr(data-placeholder); float: left; height: 0; pointer-events: none; color: color-mix(in srgb, var(--ink-soft) 60%, transparent); }
.ProseMirror > p:first-child::first-letter { all: unset; }
.ProseMirror .ed-taword { border-bottom: 2px dotted var(--gold); background: var(--gold-tint); border-radius: 3px; }
.ProseMirror-selectednode { outline: 3px solid var(--gold); outline-offset: 4px; border-radius: 16px; }
.post-body .ed-figure { position: relative; margin: 1.6em 0; padding: 6px; border-radius: 18px; }   /* stays inside the editor card */
.post-body .ed-figure img { display: block; width: auto; max-width: 100%; height: auto; max-height: 60vh; margin-inline: auto; border-radius: 14px; box-shadow: none; cursor: default; }
.post-body .ed-figure.ProseMirror-selectednode { outline: 3px solid var(--gold); outline-offset: 0; }
.ed-caption { display: block; width: 100%; margin-top: 0.5rem; text-align: center; border: 0; border-bottom: 1px dashed transparent; background: transparent; color: var(--ink-soft); font: italic 0.92rem var(--sans); padding: 0.3rem; }
.ed-caption:hover, .ed-caption:focus { border-bottom-color: var(--line); outline: none; }
.ed-remove { position: absolute; top: 0.6rem; right: 0.6rem; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(10,16,32,0.7); color: #fff; font-size: 1.2rem; cursor: pointer; opacity: 0; transition: opacity .15s; }
.ed-kural:hover .ed-remove, .ProseMirror-selectednode .ed-remove { opacity: 1; }
/* A picture's bar in the editor: Small / Medium / Full width, Crop, remove. */
.ed-figbar {
  position: absolute; top: 14px; left: 0; right: 0; margin-inline: auto; width: max-content; z-index: 3; display: flex; gap: 2px; padding: 4px; border-radius: 12px;
  background: rgba(10, 16, 32, 0.86); backdrop-filter: blur(6px); box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  opacity: 0; pointer-events: none; transition: opacity .15s; white-space: nowrap; max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none;
}
.ed-figure:hover .ed-figbar, .ed-figure.ProseMirror-selectednode .ed-figbar, .ed-figure:focus-within .ed-figbar { opacity: 1; pointer-events: auto; }
@media (hover: none) { .ed-figbar { opacity: 1; pointer-events: auto; } }
.ed-figbar button { flex: 0 0 auto; border: 0; background: transparent; color: #fff; font: 600 0.8rem var(--sans); padding: 0.4rem 0.65rem; border-radius: 8px; cursor: pointer; }
.ed-figbar button:hover { background: rgba(255,255,255,0.14); }
.ed-figbar button[aria-pressed="true"] { background: var(--gold); color: var(--navy-deep); }
.ed-figbar .ed-figdel { font-size: 1.05rem; padding-inline: 0.6rem; }
.ed-figsep { flex: 0 0 1px; background: rgba(255,255,255,0.25); margin: 5px 3px; }
/* Picture sizes (editor and story page): small and medium sit centred in the text. */
.post-body figure[data-size] { margin-inline: 0; }
.post-body figure[data-size="medium"] img { max-width: 62%; }
.post-body figure[data-size="small"] img { max-width: 38%; }
@media (max-width: 600px) {
  .post-body figure[data-size="medium"] img { max-width: 88%; }
  .post-body figure[data-size="small"] img { max-width: 62%; }
}
@media (hover: none) { .ed-remove { opacity: 1; } }
.ed-kural { position: relative; margin: 1.6em 0; padding: 1.2em 1.4em; border-radius: 16px; background: linear-gradient(135deg, var(--navy), #24386b); color: #eef1f7; }
.ed-kural-label { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-soft); }
.ed-kural-ta { font-family: "Noto Serif Tamil", var(--tamil); font-size: 1.2em; font-weight: 600; margin: 0.4em 0 0 !important; color: #fff; }
.ed-kural-en { font-family: var(--serif); font-size: 0.95em; color: #dfe5f2; margin: 0.6em 0 0 !important; }
.bubble { position: absolute; top: 0; left: 0; z-index: 30; width: max-content; display: flex; gap: 0.1rem; padding: 0.3rem; border-radius: 12px; background: var(--navy); box-shadow: var(--shadow); }
.bubble .tb { color: #fff; min-width: 34px; height: 34px; }
.bubble .tb:hover { background: rgba(255,255,255,0.12); }
.bubble .tb.is-active { background: var(--gold); color: var(--navy-deep); }
.slash-menu { position: absolute; z-index: 50; width: 260px; max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 0.35rem; }
.slash-menu button { display: grid; grid-template-columns: 34px 1fr; gap: 0.6rem; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 0.45rem 0.5rem; border-radius: 10px; cursor: pointer; color: var(--ink); }
.slash-menu button .ic { width: 34px; height: 34px; border-radius: 9px; background: var(--cream-deep); display: grid; place-items: center; font-weight: 800; color: var(--heading); }
.slash-menu button b { display: block; font-size: 0.92rem; color: var(--heading); }
.slash-menu button small { color: var(--ink-soft); font-size: 0.78rem; }
.slash-menu button.on, .slash-menu button:hover { background: var(--gold-tint); }
.side-panel { position: sticky; top: calc(var(--hdr) + 1rem); display: flex; flex-direction: column; gap: 1rem; }
@media (max-width: 1000px) { .side-panel { position: static; } }
.save-state { display: flex; align-items: center; gap: 0.5rem; font-size: 0.86rem; color: var(--ink-soft); }
.save-state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.save-state.saving .dot { background: var(--gold); animation: pulse 1s infinite; }
.save-state.error .dot { background: var(--clay); }
@keyframes pulse { 50% { opacity: 0.3; } }
.side-label { display: block; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 0.5rem; }
.cat-pick { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.cat-pick button { border: 1.5px solid var(--line); background: var(--cream); color: var(--ink); border-radius: 999px; padding: 0.35rem 0.75rem; font: 600 0.84rem var(--sans); cursor: pointer; }
.cat-pick button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.tag-box { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.4rem; border: 1.5px solid var(--line); border-radius: 12px; background: var(--cream); }
.tag-box:focus-within { border-color: var(--gold); }
.tag-box span { display: inline-flex; align-items: center; gap: 0.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.3rem 0.15rem 0.6rem; font-size: 0.84rem; font-weight: 600; }
.tag-box span button { border: 0; background: none; color: var(--ink-soft); cursor: pointer; font-size: 1rem; line-height: 1; }
.tag-box input { flex: 1; min-width: 100px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 0.9rem; padding: 0.25rem; outline: none; }
.word-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.word-stats div { background: var(--cream); border-radius: 12px; padding: 0.6rem 0.8rem; }
.word-stats b { display: block; font: 700 1.4rem var(--serif); color: var(--heading); line-height: 1.1; }
.word-stats span { font-size: 0.78rem; color: var(--ink-soft); }
.side-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.side-actions .btn { text-align: center; }
.review-note { background: var(--note-bg); border: 1px solid var(--gold); border-radius: 14px; padding: 0.9rem 1rem; margin-bottom: 1.2rem; }
.review-note b { color: var(--heading); }
.check-list { list-style: none; padding: 0; margin: 0.6rem 0 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.check-list label { display: flex; gap: 0.6rem; align-items: flex-start; cursor: pointer; line-height: 1.45; }
.check-list input { margin-top: 0.25rem; width: 18px; height: 18px; accent-color: var(--navy); flex: 0 0 auto; }
.kural-search { width: 100%; padding: 0.7rem 1rem; border-radius: 12px; border: 1.5px solid var(--line); background: var(--cream); color: var(--ink); font: inherit; }
.kural-results { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.8rem; max-height: 50vh; overflow-y: auto; }
.kural-results button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 0.7rem 0.9rem; cursor: pointer; color: var(--ink); }
.kural-results button:hover { border-color: var(--gold); background: var(--gold-tint); }
.kural-results .n { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; color: var(--accent-text); }
.kural-results .ta { font-family: "Noto Serif Tamil", var(--tamil); font-weight: 600; color: var(--heading); line-height: 1.6; }
.kural-results .en { font-size: 0.85rem; color: var(--ink-soft); }
.dlg-field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.dlg-field label { font-weight: 600; font-size: 0.9rem; color: var(--heading); }
.dlg-field input, .dlg-field textarea { padding: 0.65rem 0.85rem; border-radius: 10px; border: 1.5px solid var(--line); background: var(--cream); color: var(--ink); font: inherit; }
.dlg-field input:focus, .dlg-field textarea:focus { outline: none; border-color: var(--gold); }
.dlg-field small { color: var(--ink-soft); font-size: 0.8rem; }
.photo-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.6rem; }
.photo-choice { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; padding: 0.7rem 0.4rem; border-radius: 14px; border: 2px solid var(--line); background: var(--cream); cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--heading); text-align: center; }
.photo-choice .avatar { --size: 58px; }
.photo-choice[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-tint); }
.name-styles { display: flex; flex-direction: column; gap: 0.4rem; }
.name-styles label { display: flex; gap: 0.6rem; align-items: center; padding: 0.55rem 0.8rem; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.name-styles label:has(input:checked) { border-color: var(--gold); background: var(--gold-tint); }
.sent-card { text-align: center; padding: 2.6rem 1.4rem; }
.sent-card .big { font-size: 3.6rem; animation: pop .6s cubic-bezier(.3,1.8,.5,1); }
@keyframes pop { from { transform: scale(0); } }
.sent-card h2 { margin: 0.6rem 0 0.4rem; }
.confetti { position: fixed; top: -20px; z-index: 140; pointer-events: none; font-size: 1.4rem; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.signin-card { max-width: 560px; margin: 2rem auto; text-align: center; }
.signin-card .big { font-size: 3rem; }
.mobile-submit { display: none; }
@media (max-width: 1000px) {
  .mobile-submit { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; gap: 0.6rem; padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -10px 24px -16px rgba(0,0,0,0.35); }
  .mobile-submit .btn { flex: 1; text-align: center; padding: 0.7rem 1rem; }
  .write-page.editing { padding-bottom: 6rem; }
}

.blog-dialog .cropper-rotate { color: var(--heading); border-color: var(--line); }

/* Home page: latest stories */
.home-stories .blog-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.write-page [hidden], .blog-controls [hidden], .blog-dialog [hidden] { display: none !important; }
