:root {
  /* --- brand variables --- */
  --blue: #0a3323;    /* deep ink green — grounds the page */
  --green: #d3968c;   /* dusty rose — the one accent we spend */
  --pink: #839958;    /* olive — tags, dividers */
  --white: #f8f7f5;   /* warm paper */
  --yellow: rgb(198, 201, 200); /* warm grey — quiet text, rules */
  --red: #105666;     /* deep teal — links, secondary accent */

  /* --- semantic aliases used throughout this file --- */
  --ink: var(--blue);
  --paper: var(--white);
  --accent: var(--green);
  --tag-a: var(--pink);
  --tag-b: var(--red);
  --muted: var(--yellow);

  --display: "Mondwest", "Fraunces", Georgia, serif;
 /* --script-urdu: "Noto Nastaliq Urdu", serif;
  --script-deva: "Noto Sans Devanagari", sans-serif;
  --script-beng: "Noto Sans Bengali", sans-serif;
  --script-guru: "Noto Sans Gurmukhi", sans-serif;
  --script-tamil: "Noto Sans Tamil", sans-serif; */
  --body: "Inter", sans-serif;

  --radius: 3px;
  --border: 1px solid rgba(248, 247, 245, 0.16);
}

@font-face {
  font-family: "Mondwest";
  src: url("/static/fonts/ppmondwest-regular.woff") format("woff");
}

* { box-sizing: border-box; }

html {
  scrollbar-width: thin;
  scrollbar-color: var(--green) var(--paper);
}
html::-webkit-scrollbar { width: 10px; }
html::-webkit-scrollbar-track { background: var(--paper); }
html::-webkit-scrollbar-thumb {
  background-color: var(--green);
  border-radius: 10px;
  border: 2px solid var(--paper);
}
html::-webkit-scrollbar-thumb:hover { background-color: #c07d70; }

body {
  background-color: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; }
p { margin: 0; }
button { font-family: var(--body); cursor: pointer; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* script-family helpers — pair with dir="rtl"/"ltr" set from the server */
.script-devanagari { font-family: var(--script-deva); }
.script-bengali { font-family: var(--script-beng); }
.script-gurmukhi { font-family: var(--script-guru); }
.script-tamil { font-family: var(--script-tamil); }
.script-latin { font-family: inherit; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--ink); border-bottom: var(--border); }
.header-inner {
  max-width: 1120px; margin: 0 auto; padding: 18px 32px;
  display: flex; align-items: center; gap: 28px;
}
.logo { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--paper); flex-shrink: 0; }
.logo-mark { font-family: var(--script-urdu); font-size: 1.5rem; color: var(--green); line-height: 1; }
.logo-word { font-family: var(--display); font-size: 1.35rem; letter-spacing: 0.01em; }
.search { 
  flex: 1; 
  display: flex; 
  align-items: stretch; 
  background: var(--paper); 
  border-radius: var(--radius); 
  overflow: hidden; 
  max-width: 480px; 
}

.search select { 
  border: none; 
  background: rgba(10,51,35,0.06); 
  color: var(--ink); 
  font-family: var(--body); 
  font-size: 0.85rem; 
  padding: 0 10px; 
  border-right: 1px solid rgba(10,51,35,0.12); 
}

.search input { 
  flex: 1; 
  border: none; 
  padding: 10px 12px; 
  font-family: var(--body); 
  font-size: 0.95rem; 
  color: var(--ink); 
  background: transparent; 
  min-width: 0; 
}

.search input:focus, .search select:focus { 
  outline: none; 
}

.search button { 
  border: none; 
  background: var(--ink); 
  color: var(--paper); 
  width: 48px; /* Increased slightly to accommodate a larger icon */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

/* Target the Material Icon specifically */
.search button .material-symbols-outlined {
  font-size: 1.4rem; /* Controls the size of the search icon */
}

.main-nav { 
  display: flex; 
  align-items: center; 
  gap: 6px; 
  flex-shrink: 0; 
  margin-left: auto; /* Pushes the nav to the far right */
}
.nav-link { background: none; border: none; color: var(--paper); opacity: 0.8; font-size: 0.95rem; padding: 8px 12px; border-radius: var(--radius); text-decoration: none; }
.nav-link:hover, .nav-link.active { opacity: 1; background: rgba(248,247,245,0.08); }
.btn-submit { background: var(--green); color: var(--ink); border: none; font-weight: 600; font-size: 0.9rem; padding: 9px 16px; border-radius: var(--radius); margin-left: 4px; text-decoration: none; display: inline-block; }
.btn-submit:hover { background: #e0aca3; }

@media (max-width: 900px) {
  .header-inner {
    flex-wrap: wrap;          /* let things drop to a new row */
    padding: 12px 16px;
    gap: 10px 12px;
  }
  .logo { order: 1; }
  .main-nav {
    order: 2;
    margin-left: auto;
    flex-shrink: 1;           /* allow it to shrink now */
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 2px;
  }
  .search {
    order: 3;
    flex: 1 1 100%;           /* search gets its own full-width row */
    max-width: none;
  }
  .nav-link { padding: 10px; font-size: 0.9rem; }
  .btn-submit { padding: 10px 14px; }
}

@media (max-width: 480px) {
  .logo-word { font-size: 1.15rem; }
  .search select { max-width: 40%; }   /* stops long option text from stretching it */
  .nav-link { padding: 10px 8px; font-size: 0.85rem; }
}

/* ---------- generic components ---------- */
.section-label { font-family: var(--body); font-size: 0.85rem; color: var(--muted); margin: 0 0 14px; }
.btn-primary { background: var(--green); color: var(--ink); border: none; font-weight: 600; font-size: 0.95rem; padding: 12px 22px; border-radius: var(--radius); text-decoration: none; display: inline-block; }
.btn-primary:hover { background: #e0aca3; }
.btn-secondary { background: none; color: var(--paper); border: 1px solid rgba(248,247,245,0.35); font-size: 0.95rem; padding: 12px 22px; border-radius: var(--radius); text-decoration: none; display: inline-block; }
.btn-secondary:hover { border-color: var(--paper); }

.tag { display: inline-block; font-size: 0.78rem; color: var(--ink); background: var(--pink); padding: 3px 9px; border-radius: 2px; }
.tag.tag-teal { background: var(--red); color: var(--paper); }

.resonance { display: block; color: var(--muted); font-size: 0.85rem; }

/* ---------- hero ---------- */
.hero-eyebrow { font-size: 0.9rem; color: var(--green); margin: 0 0 18px; }
.hero-copy { padding-bottom: 6px; }
.mission { font-size: 1.05rem; color: rgba(248,247,245,0.88); max-width: 46ch; }
.hero-actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

/* Update .hero alignment */
.hero { 
  max-width: 1120px; 
  margin: 0 auto; 
  padding: 72px 32px 56px; 
  display: grid; 
  grid-template-columns: 1.1fr 1fr; 
  gap: 56px; 
  align-items: center; /* Changed from end to center */
}

/* Fix line height and spacing for large Arabic/Urdu scripts */
.hero-word-text { 
  display: block; 
  font-size: 4.4rem; 
  line-height: 1.6; /* Increased line-height to prevent vertical clipping */
  padding: 8px 0;   /* Gives room for tall ascenders/descenders */
  font-family: var(--display);
}

/* Ensure script-arabic specifically has breathing room across the site */
.script-arabic { 
  font-family: var(--script-urdu); 
  line-height: 1.6; 
}

/* Adjust top margin on the transliteration text for clear separation */
.hero-translit { 
  display: block; 
  font-family: var(--body); 
  font-size: 1.05rem; 
  color: var(--muted); 
  direction: ltr; 
  margin-top: 16px; /* Increased from 10px */
  letter-spacing: 0.02em; 
}

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 40px; }
  .hero-word-text { font-size: 3.2rem; }
}

/* ---------- word of the day ---------- */
.wotd { max-width: 1120px; margin: 0 auto; padding: 0 32px 64px; }
.wotd-card {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 36px 40px;
  display: grid;
  grid-template-columns: 500px 1fr;  /* was 260px 1fr */
  gap: 40px;
}.wotd-word-col { border-right: 1px solid rgba(10,51,35,0.12); padding-right: 32px; }
.wotd-script { font-size: 2.6rem; }
.wotd-translit { font-size: 1rem; color: #5b6b62; margin-top: 6px; }
.wotd-tags { margin-top: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.wotd-gloss { font-family: var(--display); font-size: 1.3rem; line-height: 1.4; max-width: 56ch; }
.voice { margin-top: 20px; padding-left: 16px; border-left: 3px solid var(--green); font-size: 0.98rem; color: #33443b; }
.voice cite { display: block; font-style: normal; font-size: 0.82rem; color: #6d7d74; margin-top: 8px; }
.wotd-foot { margin-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.link-btn { background: none; border: none; color: var(--red); font-weight: 600; font-size: 0.92rem; padding: 0; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }
.wotd-meta-details {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wotd-meta-item {
  font-size: 0.95rem;
  color: #33443b;
  line-height: 1.5;
  margin: 0;
}

.wotd-meta-item strong {
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 720px) {
  .wotd-card { grid-template-columns: 1fr; }
  .wotd-word-col { border-right: none; border-bottom: 1px solid rgba(10,51,35,0.12); padding-right: 0; padding-bottom: 20px; }
}

/* ---------- entry grid (home preview + browse) ---------- */
.browse-preview, .browse-full { max-width: 1120px; margin: 0 auto; padding: 0 32px 72px; }
.section-heading-row { 
  display: flex; 
  align-items: baseline; 
  justify-content: space-between; 
  margin-bottom: 14px; 
}

/* Ensure section-label inside heading row doesn't add extra bottom margin */
.section-heading-row .section-label { 
  margin-bottom: 0; 
}

.section-heading-row .link-btn { 
  color: var(--paper); 
}

.section-heading-row .link-btn:hover { 
  color: var(--green); 
}
.entry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 880px) { .entry-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .entry-grid { grid-template-columns: 1fr; } }

.entry-card { text-align: left; background: rgba(248,247,245,0.04); border: var(--border); border-radius: var(--radius); padding: 22px; color: var(--paper); display: flex; flex-direction: column; gap: 10px; text-decoration: none; }
.entry-card:hover { background: rgba(248,247,245,0.08); border-color: rgba(248,247,245,0.3); }
.entry-card .script { font-size: 1.5rem; line-height: 1.3; }
.entry-card .translit { font-size: 0.85rem; color: var(--muted); }
.entry-card .gloss { font-size: 0.92rem; color: rgba(248,247,245,0.8); flex: 1; }
.entry-card .card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.entry-card .card-foot { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--muted); margin-top: 6px; }
.empty-note { color: var(--muted); }
.empty-note a { color: var(--green); }
/* ---------- browse index (list layout) ---------- */
/* ---------- browse index (list layout) ---------- */

.browse-heading {
  padding: 8px 0 28px;
  margin-bottom: 24px;
}
.browse-title {
  font-size: 2.6rem;
  margin: 4px 0 14px;
  letter-spacing: -0.01em;
}
.browse-sub {
  max-width: 58ch;
  color: #b9c2bc;
  font-size: 1rem;
  line-height: 1.6;
}

.browse-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: var(--border);
}
.browse-toolbar .result-count {
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
}
.clear-filters { color: var(--green); text-decoration: underline; }

/* -- sort dropdown -- */.custom-dropdown { position: relative; }
.dropdown-button {
  background: #12442f;
  border: none;
  color: var(--paper);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  padding: 9px 14px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 8px;

}
.dropdown-button:hover,
.custom-dropdown.open .dropdown-button { background: #17573c; }
.dropdown-button .arrow { font-size: 0.7rem; color: var(--green); transition: transform 0.15s ease; }
.custom-dropdown.open .dropdown-button .arrow { transform: rotate(180deg); }

.dropdown-menu {
  list-style: none;
  margin: 0; padding: 6px;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  z-index: 20;
  display: none;
}
.custom-dropdown.open .dropdown-menu { display: block; }

.dropdown-menu li {
  padding: 10px 12px;
  font-size: 0.88rem;
  border-radius: 2px;
}
.dropdown-menu li:hover {
  background: var(--green);
  color: var(--ink);
  cursor: pointer;
}
.dropdown-menu li.active {
  background: var(--green);
  color: var(--ink);
  font-weight: 600;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* -- entry list -- */
.entry-index {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.entry-row {
  display: grid;
  grid-template-columns: 260px 1fr;  /* was 200px 1fr */
  gap: 28px;
  padding: 24px 24px;
  background: #12442f;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--paper);
  border-left: 3px solid transparent;
}

.entry-row:hover {
  background: #17573c;
  border-left-color: var(--green);
}
.entry-row:hover .entry-row-word .script { color: var(--green); }

.entry-row-word {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.entry-row-word .script {
  font-size: 1.7rem;
  line-height: 1.35;
}
.entry-row-word .translit {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.entry-row-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.entry-row-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.entry-row-snippet {
  font-size: 0.98rem;
  line-height: 1.55;
  color: #dcded9;
  max-width: 62ch;
}
.entry-row-foot {
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 720px) {
  .entry-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .browse-title { font-size: 2rem; }
}

/* ---------- notices ---------- */
.notice-banner {
  background: rgba(131,153,88,0.14);
  border-left: 3px solid var(--pink);
  color: var(--paper);
  padding: 14px 18px;
  font-size: 0.92rem;
  border-radius: var(--radius);
  margin: 20px 0 0;
}
/* =========================================================
   ENTRY DETAIL PAGE — redesign
   Replace everything from "entry detail extras" through
   "story cards" in your main stylesheet with the rules below.
   Nothing outside this range needs to change.
   ========================================================= */

/* ---------- entry detail extras ---------- */
.entry-source {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ---------- shared wrapper ---------- */
.entry-detail {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

.entry-back {
  display: inline-block;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
  margin-bottom: 28px;
}
.entry-back:hover { color: var(--green); }

/* ---------- hero: word card + at-a-glance ---------- */
.entry-hero {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 20px;
  margin-bottom: 32px;
}
@media (max-width: 820px) {
  .entry-hero { grid-template-columns: 1fr; }
}

.entry-word-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 40px 44px;
}
.entry-word-card .script {
  display: block;
  font-size: 3.4rem;
  line-height: 1.55;
  padding: 4px 0;
  font-family: var(--display);
  color: var(--ink);
}
.entry-word-card .translit {
  display: block;
  font-size: 1rem;
  color: #5b6b62;
  direction: ltr;
  margin-top: 6px;
  letter-spacing: 0.02em;
}
.entry-word-card .card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 18px;
}
@media (max-width: 560px) {
  .entry-word-card { padding: 32px 28px; }
  .entry-word-card .script { font-size: 2.5rem; }
}

/* icon-share needs a light-background variant inside the paper card */
.entry-word-card .icon-share {
  border-color: rgba(10,51,35,0.2);
  color: #5b6b62;
}
.entry-word-card .icon-share:hover,
.entry-word-card .icon-share.copied {
  border-color: var(--green);
  color: #a85f52;
}
.entry-word-card .icon-share-tooltip { background: var(--ink); color: var(--paper); }
.entry-word-card .icon-share-tooltip::after { border-top-color: var(--ink); }

.entry-facts-card {
  background: rgba(248,247,245,0.04);
  border: var(--border);
  border-radius: var(--radius);
  padding: 28px 26px;
}
.facts-label {
  font-family: var(--body);
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 10px;
}
.facts-list { margin: 0; }
.facts-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid rgba(248,247,245,0.1);
}
.facts-row:first-child { border-top: none; }
.facts-row dt {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
}
.facts-row dd {
  font-family: var(--display);
  font-size: 1.05rem;
  color: var(--paper);
  margin: 0;
  text-align: right;
}
.facts-row.facts-count dd { color: var(--green); }

/* ---------- word row + icon share (base, used on both dark & light bg) ---------- */
.entry-word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-share {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(248,247,245,0.25);
  background: none;
  color: var(--muted);
  flex-shrink: 0;
}
.icon-share svg { width: 14px; height: 14px; }
.icon-share:hover { border-color: var(--green); color: var(--paper); }
.icon-share.copied { border-color: var(--green); color: var(--green); }

.icon-share-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.icon-share-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--paper);
}
.icon-share:hover .icon-share-tooltip,
.icon-share.copied .icon-share-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- tabs: solid pill switcher ---------- */
.entry-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 28px;
  background: rgba(248,247,245,0.05);
  border: var(--border);
  border-radius: var(--radius);
  max-width: 100%;
  overflow-x: auto;
}
.entry-tab {
  background: none;
  border: none;
  border-radius: 2px;
  color: var(--muted);
  font-family: var(--body);
  font-size: 0.88rem;
  padding: 9px 16px;
  white-space: nowrap;
}
.entry-tab:hover { color: var(--paper); }
.entry-tab.active {
  background: var(--green);
  color: var(--ink);
  font-weight: 600;
}

/* ---------- panels ---------- */
.entry-panel {
  color: rgba(248,247,245,0.88);
  font-size: 1rem;
  line-height: 1.65;
  max-width: 68ch;
}
.entry-panel h3 {
  font-size: 1.05rem;
  color: var(--paper);
  margin: 24px 0 8px;
}
.entry-panel .voice {
  margin: 20px 0 0;
  color: rgba(248,247,245,0.85);
  font-size: 0.98rem;
}
.entry-panel .voice + .voice { margin-top: 16px; }
.entry-panel[data-panel="voices"] { max-width: none; }

.voice-empty {
  border: 1px dashed rgba(248,247,245,0.22);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
}
.voice-empty p { margin: 0; }
.voice-empty p:first-child { color: var(--paper); font-family: var(--display); font-size: 1.1rem; }
.voice-empty-sub { color: var(--muted); font-size: 0.92rem; margin-top: 6px !important; }

/* ---------- story cards ---------- */
.voice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 640px) { .voice-grid { grid-template-columns: 1fr; } }

.voice-card {
  position: relative;
  background: rgba(248,247,245,0.04);
  border: var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.15s ease, background 0.15s ease;
}
.voice-card:hover { transform: translateY(-2px); background: rgba(248,247,245,0.06); }
.voice-card-b { border-left-color: var(--pink); }
.voice-card-c { border-left-color: var(--red); }

.voice-quote-mark {
  font-family: var(--display);
  font-size: 2.6rem;
  line-height: 1;
  color: rgba(248,247,245,0.18);
  position: absolute;
  top: 6px;
  right: 18px;
}

.voice-content {
  font-size: 0.98rem;
  line-height: 1.6;
  color: rgba(248,247,245,0.9);
  position: relative;
  z-index: 1;
}

.voice-byline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}
.voice-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green);
  color: var(--ink);
  font-family: var(--display);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.voice-card-b .voice-avatar { background: var(--pink); }
.voice-card-c .voice-avatar { background: var(--red); color: var(--paper); }

.voice-name {
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ---------- bottom actions ---------- */
.entry-actions {
  margin-top: 36px;
  padding-top: 28px;
  border-top: var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.action-link {
  display: inline-flex;
  align-items: center;
  color: var(--paper);
  background: none;
  border: 1px solid rgba(248,247,245,0.25);
  font-family: var(--body);
  font-size: 0.9rem;
  padding: 11px 20px;
  border-radius: var(--radius);
  text-decoration: none;
}
.action-link:hover { border-color: var(--paper); }
.action-link-accent {
  background: var(--green);
  color: var(--ink);
  border-color: var(--green);
  font-weight: 600;
}
.action-link-accent:hover { background: #e0aca3; border-color: #e0aca3; }

/* ---------- shared on-page form fields (dark context) ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius);
  border: 1px solid rgba(248,247,245,0.22);
  background: rgba(248,247,245,0.06);
  color: var(--paper);
  font-family: var(--body);
  font-size: 0.95rem;
}
.field input::placeholder, .field textarea::placeholder { color: rgba(248,247,245,0.35); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--green);
  background: rgba(248,247,245,0.09);
}
.field textarea { resize: vertical; min-height: 90px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-hint { font-size: 0.78rem; color: var(--muted); margin-top: 6px; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 22px;
}
.btn-cancel {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}
.btn-cancel:hover { color: var(--paper); }

/* ---------- edit page head ---------- */
.edit-head { padding: 20px 0 8px; }
.edit-head h1 { font-size: 2rem; }
.edit-head .word-quote { color: var(--green); }

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
}


/* ---------- story cards ---------- */
.voice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 640px) { .voice-grid { grid-template-columns: 1fr; } }

.voice-card {
  position: relative;
  background: rgba(248,247,245,0.04);
  border: var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.voice-card-b { border-left-color: var(--pink); }
.voice-card-c { border-left-color: var(--red); }

.voice-quote-mark {
  font-family: var(--display);
  font-size: 2.4rem;
  line-height: 1;
  color: rgba(248,247,245,0.18);
  position: absolute;
  top: 8px;
  right: 18px;
}

.voice-content {
  font-size: 0.98rem;
  line-height: 1.6;
  color: rgba(248,247,245,0.9);
  position: relative;
  z-index: 1;
}

.voice-byline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}
.voice-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green);
  color: var(--ink);
  font-family: var(--display);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.voice-card-b .voice-avatar { background: var(--pink); }
.voice-card-c .voice-avatar { background: var(--red); color: var(--paper); }

.voice-name {
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ---------- submit word page ---------- */
.form-section {
  padding: 26px 0;
  border-bottom: var(--border);
}
.form-section:first-of-type { padding-top: 4px; }
.form-section:last-of-type { border-bottom: none; }

.form-section h3 {
  font-size: 1.05rem;
  color: var(--paper);
  margin-bottom: 18px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.optional-tag {
  font-family: var(--body);
  font-weight: 400;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* ---------- about page ---------- */
.about-hero {
  text-align: left;
  padding: 8px 0 12px;
}
.wallotext {
  max-width: 68ch;
  margin: 0;  
  padding: 8px 0 40px;
  color: rgba(248,247,245,0.85);
  font-size: 1.02rem;
  line-height: 1.75;
  text-align: left;
}
.wallotext p { margin-bottom: 22px; }
.wallotext p:last-child { margin-bottom: 0; }
.wallotext .closing-line { color: var(--paper); }

.wallotext img {
  display: block;
  max-width: 100%;
  height: auto;          /* keeps the aspect ratio */
  margin: 1.5rem auto;   /* optional: centres it with some breathing room */
}

.pull-quote {
  margin: 0 0 32px;
  padding: 24px 28px;
  background: rgba(248,247,245,0.04);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  font-family: var(--display);
  font-size: 1.15rem;
  line-height: 1.6;
  color: rgba(248,247,245,0.92);
}
.pull-quote p { margin: 0; }

footer { 
  width: 100%;                  /* Ensures full viewport width */
  border-top: var(--border); 
  padding: 40px 32px; 
  margin-top: 20px; 
  background-color: #d3968c; 
  text-align: center;
}

.footer-inner { 
  max-width: 1120px;            /* Constrains the content inner width */
  margin: 0 auto;               /* Centers the content block */
  display: flex; 
  justify-content: space-between; 
  flex-wrap: wrap; 
  gap: 20px; 
  color: #0a3323; 
  font-size: 0.88rem; 
}

.footer-inner a { 
  text-decoration: underline; 
  color: inherit; 
}

footer h1 {
  font-size: 1.5rem;
  color: white;
}

footer span {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.85rem;
}
footer span a {
  color: var(--white);
  text-decoration: none;
}
footer span a:hover {
  color: var(--blue);
  text-decoration: underline;
}


/* ---------- idiom rows: room for the edit button ---------- */
.idiom-row {
  grid-template-columns: 260px 1fr auto;
  align-items: start;
}
@media (max-width: 720px) {
  .idiom-row { grid-template-columns: 1fr; }
}

.btn-edit-idiom {
  background: none;
  border: 1px solid rgba(248,247,245,0.25);
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  padding: 7px 14px;
  border-radius: var(--radius);
}
.btn-edit-idiom:hover {
  border-color: var(--green);
  color: var(--green);
}

/* ---------- edit modal ---------- */
.edit-dialog {
  background: #12442f;
  color: var(--paper);
  border: var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
  width: min(680px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
}
.edit-dialog::backdrop {
  background: rgba(5, 24, 16, 0.75);
}
.edit-dialog h2 {
  font-size: 1.8rem;
  margin-bottom: 4px;
}
.edit-dialog .notice-banner {
  margin: 12px 0 24px;
}
/* .btn-cancel is styled as a link elsewhere; make it work as a <button> */
button.btn-cancel {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--body);
  cursor: pointer;
}

/* This block adds the chart / data-display components this report needs.
   It only reads the site's existing custom properties (--ink, --paper,
   --accent, --tag-a, --tag-b, --muted, --display, --body, --radius,
   --border) — no new colors are introduced. Female terms use --tag-a
   (olive), male terms use --tag-b (teal); --accent (rose) is reserved
   for single emphasis moments, per the "one accent we spend" comment
   in the stylesheet. */
.cx { --f: var(--tag-a); --f-on: var(--ink); --m: var(--tag-b); --m-on: var(--paper); --n: var(--muted); --n-on: var(--ink); --hi: var(--accent); --hi-on: var(--ink); --hair: rgba(248,247,245,0.14); --panel: rgba(248,247,245,0.04); }
.cx .ur { font-family: var(--script-urdu, "Noto Nastaliq Urdu", serif); line-height: 1.6; }
.cx-hero-title { font-size: clamp(2.6rem, 6vw, 4rem); max-width: 16ch; }
.cx-h2 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); letter-spacing: -0.01em; max-width: 22ch; }
.cx-sec { margin-top: clamp(3rem, 7vw, 5rem); scroll-margin-top: 1rem; }
.cx-sec > .cx-h2 + * { margin-top: 1.1rem; }

/* hero: twin headwords + facts */
.cx-wordrow { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cx-word { padding: 26px 28px; border-top: 3px solid var(--f); }
.cx-word.m { border-top-color: var(--m); }
.cx-word .script { font-size: clamp(2.6rem, 7vw, 3.6rem); }
.cx-word-count { margin-top: 6px; font-size: 0.92rem; color: #5b6b62; }
@media (max-width: 620px) { .cx-wordrow { grid-template-columns: 1fr; } }

.cx-lead { margin-top: 2.4rem; }
.cx-lead p:first-child { font-size: 1.12rem; }

.cx-measures { margin-top: 1.4rem; }
.cx-measure-title { display: block; font-family: var(--display); font-size: 1.25rem; line-height: 1.3; }

/* method list */
.cx-method { display: grid; grid-template-columns: 10rem 1fr; gap: 0.4rem 2rem; padding: 1.3rem 0; border-top: 1px solid var(--hair); }
.cx-method:last-child { border-bottom: 1px solid var(--hair); }
.cx-method h3 { font-size: 1.05rem; }
.cx-method .wallotext { padding: 0; max-width: 42rem; }
@media (max-width: 720px) { .cx-method { grid-template-columns: 1fr; } }

/* figure shell */
.cx-fig { margin-top: 1.8rem; padding: clamp(1rem, 3vw, 1.6rem) clamp(1rem, 3vw, 1.8rem); border-radius: var(--radius); background: var(--panel); border: var(--border); }
.cx-fig h3 { font-size: clamp(1.1rem, 2.2vw, 1.4rem); max-width: 34ch; }
.cx-fig-sub { margin-top: 0.35rem; font-size: 0.95rem; line-height: 1.45; color: var(--muted); max-width: 46rem; }
.cx-fig-note { margin-top: 1rem; font-size: 0.86rem; line-height: 1.5; color: var(--muted); max-width: 46rem; }
.cx-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.3rem; margin-top: 0.9rem; font-size: 0.88rem; }
.cx-sw { display: inline-flex; align-items: center; gap: 0.4rem; }
.cx-sw i { display: inline-block; width: 0.9rem; height: 0.9rem; border-radius: 2px; }
.cx-sw.f i { background: var(--f); } .cx-sw.m i { background: var(--m); } .cx-sw.n i { background: var(--n); } .cx-sw.hi i { background: var(--hi); }
.cx-sw.fp i { background: color-mix(in srgb, var(--f) 30%, transparent); box-shadow: inset 0 0 0 1px var(--f); }
.cx-sw.mp i { background: color-mix(in srgb, var(--m) 30%, transparent); box-shadow: inset 0 0 0 1px var(--m); }
.cx-sw.hatch i { background: repeating-linear-gradient(135deg, currentColor 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px currentColor; }

/* corpus stacked bar */
.cx-row-label { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.88rem; color: var(--muted); margin-bottom: 0.3rem; }
.cx-bar { display: flex; height: 2.5rem; border-radius: var(--radius); overflow: hidden; }
.cx-bar > span { display: flex; align-items: center; justify-content: center; font: 600 0.92rem/1 var(--body); white-space: nowrap; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(248,247,245,0.12); }
.cx-bar .rest { background: rgba(248,247,245,0.08); color: var(--muted); box-shadow: none; }
.cx-bar .hit { background: var(--hi); color: var(--hi-on); }
.cx-bar .f { background: var(--f); color: var(--f-on); } .cx-bar .m { background: var(--m); color: var(--m-on); } .cx-bar .n { background: var(--n); color: var(--n-on); }
.cx-zoom { display: block; width: 100%; height: 1.7rem; }
.cx-zoom polygon { fill: rgba(248,247,245,0.1); }
.cx-seglabels { display: flex; margin-top: 0.35rem; font: 500 0.85rem/1.25 var(--body); color: var(--muted); }
.cx-seglabels span { text-align: center; padding: 0 0.3rem; }

/* agency hbar */
.cx-hbar { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); align-items: center; gap: 0.2rem 1rem; margin-top: 1rem; }
.cx-hbar .lab { font-family: var(--display); font-size: 1.05rem; }
.cx-hbar .track { display: flex; height: 2.6rem; border-radius: var(--radius); overflow: hidden; }
.cx-hbar .track span { display: flex; align-items: center; padding-left: 0.7rem; font: 600 0.98rem/1 var(--body); white-space: nowrap; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(248,247,245,0.12); }
.cx-hbar .cnt { grid-column: 2; font-size: 0.86rem; color: var(--muted); }
.cx-hbar .f-solid { background: var(--f); color: var(--f-on); } .cx-hbar .f-pale { background: color-mix(in srgb, var(--f) 22%, transparent); color: var(--f); box-shadow: inset 0 0 0 1px var(--f); }
.cx-hbar .m-solid { background: var(--m); color: var(--m-on); } .cx-hbar .m-pale { background: color-mix(in srgb, var(--m) 22%, transparent); color: var(--m); box-shadow: inset 0 0 0 1px var(--m); }

/* doc-level facts + interval */
.cx-stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.1rem; }
.cx-stats3 .n { font-family: var(--display); font-size: clamp(1.8rem, 4.4vw, 2.5rem); }
.cx-stats3 p { font-size: 0.88rem; color: var(--muted); margin-top: 0.25rem; }
.cx-ci { position: relative; height: 5.4rem; margin: 2rem 1.5rem 0; }
.cx-ci .axis { position: absolute; left: 0; right: 0; top: 2.2rem; height: 1px; background: var(--muted); opacity: 0.5; }
.cx-ci .tick { position: absolute; top: 2.2rem; width: 1px; height: 0.5rem; background: var(--muted); opacity: 0.5; }
.cx-ci .tl { position: absolute; top: 2.85rem; transform: translateX(-50%); font-size: 0.78rem; color: var(--muted); }
.cx-ci .zero { position: absolute; top: 0.3rem; bottom: 1.4rem; width: 1px; background: var(--paper); opacity: 0.5; }
.cx-ci .zero-l { position: absolute; top: -1rem; transform: translateX(-50%); font: 600 0.78rem/1 var(--body); white-space: nowrap; color: var(--paper); }
.cx-ci .ci { position: absolute; top: 1.95rem; height: 0.6rem; border-radius: 2px; background: var(--f); opacity: 0.45; }
.cx-ci .pt { position: absolute; top: 2.25rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--hi); border: 3px solid var(--ink); transform: translate(-50%, -50%); box-shadow: 0 0 0 1px rgba(248,247,245,0.3); }
.cx-ci .pt-l { position: absolute; top: 0.55rem; transform: translateX(-50%); font: 600 0.98rem/1 var(--display); white-space: nowrap; color: var(--hi); }
.cx-ci .end-l { position: absolute; top: 4.15rem; font-size: 0.78rem; color: var(--muted); white-space: nowrap; }

/* modifiers */
.cx-cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.2rem, 4vw, 2.6rem); margin-top: 1.1rem; }
.cx-colhead { font-family: var(--display); font-size: 1.1rem; }
.cx-colhead small { display: block; margin-top: 0.15rem; font-family: var(--body); font-style: normal; font-size: 0.82rem; color: var(--muted); }
.cx-mods { margin-top: 0.6rem; }
.cx-mod { display: grid; grid-template-columns: 6.2rem minmax(0, 1fr); align-items: center; gap: 0 0.6rem; padding: 0.15rem 0; }
.cx-mod .ur { font-size: 1.7rem; line-height: 2.1; text-align: right; color: var(--paper); }
.cx-mod .gloss { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.25rem; }
.cx-mod .barrow { display: flex; align-items: center; gap: 0.5rem; height: 0.9rem; }
.cx-mod .barrow i { display: block; flex: none; height: 100%; border-radius: 2px; }
.cx-mod .n { font: 700 0.92rem/1 var(--body); color: var(--paper); }
.cx-mods.f .barrow i { background: var(--f); } .cx-mods.m .barrow i { background: var(--m); }
.cx-mods.f .agree .barrow i { background: repeating-linear-gradient(135deg, var(--f) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--f); }
.cx-mods.m .agree .barrow i { background: repeating-linear-gradient(135deg, var(--m) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--m); }
.cx-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; list-style: none; padding: 0; }
.cx-chips li.tag { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; }
.cx-chips .ur { font-size: 1.2rem; }

/* word2vec share bars */
.cx-share { margin-top: 1.1rem; }
.cx-share .hdr, .cx-share .row { display: grid; grid-template-columns: 11rem minmax(0, 1fr) 8.5rem; align-items: center; gap: 0 1rem; }
.cx-share .hdr { font-size: 0.85rem; margin-bottom: 0.35rem; }
.cx-share .hdr .l { color: var(--f); } .cx-share .hdr .r { color: var(--m); text-align: right; }
.cx-share .hdr div:nth-child(2) { display: flex; justify-content: space-between; }
.cx-share .row { padding: 0.3rem 0; }
.cx-share .name { font-size: 0.96rem; }
.cx-share .bars { position: relative; display: flex; height: 2rem; border-radius: var(--radius); overflow: hidden; }
.cx-share .bars span { display: flex; align-items: center; font: 700 0.92rem/1 var(--body); padding: 0 0.6rem; }
.cx-share .bars .f { background: var(--f); color: var(--f-on); } .cx-share .bars .m { background: var(--m); color: var(--m-on); justify-content: flex-end; }
.cx-share .mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; margin-left: -0.5px; background: var(--ink); }
.cx-share .sig { font-size: 0.82rem; color: var(--muted); text-align: right; }
.cx-share .row.total { margin-top: 0.5rem; padding-top: 0.8rem; border-top: 1px solid var(--hair); }
.cx-share .row.total .name { font-family: var(--display); }

/* dumbbell */
.cx-dumb { margin-top: 1.1rem; }
.cx-dumb .grp { margin: 1.1rem 0 0.2rem; font-size: 0.9rem; }
.cx-dumb .row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 5.6rem; align-items: center; gap: 0 1rem; }
.cx-dumb .lab { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.cx-dumb .lab .ur { font-size: 1.5rem; line-height: 2.1; color: var(--paper); }
.cx-dumb .lab .en { font-size: 0.82rem; color: var(--muted); text-align: right; }
.cx-dumb .track { position: relative; height: 2.2rem; border-right: 1px solid var(--hair); background-image: linear-gradient(to right, var(--hair) 1px, transparent 1px); background-size: 25% 100%; }
.cx-dumb .link { position: absolute; top: 50%; height: 3px; margin-top: -1.5px; background: var(--muted); opacity: 0.6; }
.cx-dumb .dot { position: absolute; top: 50%; width: 1rem; height: 1rem; border-radius: 50%; transform: translate(-50%, -50%); border: 2px solid var(--ink); }
.cx-dumb .dot.f { background: var(--f); } .cx-dumb .dot.m { background: var(--m); }
.cx-dumb .d { font: 700 0.95rem/1 var(--body); text-align: right; white-space: nowrap; }
.cx-dumb .axis { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 5.6rem; gap: 0 1rem; margin-top: 0.3rem; }
.cx-dumb .axis .ticks { position: relative; height: 1.2rem; }
.cx-dumb .axis .ticks span { position: absolute; transform: translateX(-50%); font-size: 0.78rem; color: var(--muted); }
.cx-dumb .axis .ticks span:first-child { transform: none; } .cx-dumb .axis .ticks span:last-child { transform: translateX(-100%); }

/* topics */
.cx-themes { margin-top: 1.1rem; }
.cx-theme { display: grid; grid-template-columns: 12rem minmax(0, 1fr); align-items: center; gap: 0.3rem 1rem; padding: 0.6rem 0; border-top: 1px solid var(--hair); }
.cx-theme:first-of-type { border-top: 0; }
.cx-theme .name { font-size: 0.98rem; }
.cx-theme .bars { display: grid; gap: 0.25rem; }
.cx-theme .b { display: flex; align-items: center; gap: 0.5rem; }
.cx-theme .b i { display: block; height: 1rem; border-radius: 2px; }
.cx-theme .b.f i { background: var(--f); } .cx-theme .b.m i { background: var(--m); }
.cx-theme .b span { font: 700 0.9rem/1 var(--body); }
.cx-theme .b.f span { color: var(--f); } .cx-theme .b.m span { color: var(--m); }

/* discussion + lists */
.cx-signals { grid-template-columns: repeat(3, 1fr); margin-top: 1.4rem; }
.cx-signals b { display: block; font-family: var(--display); font-size: 1.1rem; margin-bottom: 0.2rem; }
@media (max-width: 820px) { .cx-signals { grid-template-columns: 1fr; } }
.cx-list { max-width: 42rem; margin-top: 1.2rem; list-style: none; padding: 0; }
.cx-list li { position: relative; padding: 0.85rem 0 0.85rem 1.4rem; border-top: 1px solid var(--hair); font-size: 1.01rem; line-height: 1.6; color: rgba(248,247,245,0.85); }
.cx-list li:last-child { border-bottom: 1px solid var(--hair); }
.cx-list li::before { content: ""; position: absolute; left: 0; top: 1.45rem; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--muted); }
.cx-list li b { font-family: var(--display); color: var(--paper); }

@media (max-width: 860px) {
  .cx-cols2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .cx-stats3 { grid-template-columns: 1fr; gap: 0.7rem; }
  .cx-share .hdr, .cx-share .row { grid-template-columns: 1fr; gap: 0.2rem; }
  .cx-share .sig { text-align: left; }
  .cx-share .hdr > div:first-child, .cx-share .hdr > div:last-child { display: none; }
  .cx-theme { grid-template-columns: 1fr; }
  .cx-dumb .row, .cx-dumb .axis { grid-template-columns: 6.5rem minmax(0, 1fr) 4.6rem; gap: 0 0.6rem; }
  .cx-dumb .lab .en { display: none; }
  .cx-hbar { grid-template-columns: 1fr; }
  .cx-hbar .cnt { grid-column: 1; }
  .cx-ci { margin-inline: 1.1rem; }
}
@media (max-width: 480px) {
  .cx-mod { grid-template-columns: 5rem minmax(0, 1fr); }
}

/* appendix */
.cx-appendix-theme { margin-top: 1.6rem; }
.cx-appendix-theme:first-child { margin-top: 1rem; }
.cx-appendix-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 2rem; margin-top: 0.6rem; }
.cx-appendix-list { list-style: none; padding: 0; margin: 0; }
.cx-appendix-list li { display: grid; grid-template-columns: 2.6rem 1fr 3rem; align-items: baseline; gap: 0.5rem; padding: 0.4rem 0; border-top: 1px solid var(--hair); font-size: 0.88rem; }
.cx-appendix-list .tnum { color: var(--muted); font-variant-numeric: tabular-nums; }
.cx-appendix-list .kw { direction: rtl; text-align: right; color: rgba(248,247,245,0.85); }
.cx-appendix-list .kw .ur { font-size: 1.05rem; }
.cx-appendix-list .cnt { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .cx-appendix-cols { grid-template-columns: 1fr; } }

/* hidden on desktop */
.nav-toggle { display: none; }

@media (max-width: 820px) {
  .header-inner { padding: 12px 16px; }

  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    margin-left: auto;          /* pushes it to the right edge */
    width: 44px;
    height: 44px;
    padding: 0 11px;
    background: none;
    border: var(--border);
    border-radius: var(--radius);
    cursor: pointer;
  }
  .nav-toggle span {
    display: block;
    height: 2px;
    background: var(--paper);
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px 16px 20px;
    background: var(--ink);
    border-bottom: var(--border);
  }
  .main-nav.open { display: flex; }

  .nav-link { padding: 14px 12px; font-size: 1rem; }
  .btn-submit { margin: 8px 0 0; padding: 14px 16px; text-align: center; }
}

@media (max-width: 720px) {
  .browse-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .toolbar-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }
  .custom-dropdown { width: 100%; }
  .dropdown-button {
    width: 100%;
    justify-content: space-between;
    padding: 12px 14px;
  }
  .dropdown-menu {
    left: 0;
    right: 0;
    min-width: 0;
    max-height: 50vh;
    overflow-y: auto;
  }
  .dropdown-menu li { padding: 12px; }
}

@media (max-width: 560px) {
  .hero, .wotd, .browse-preview, .browse-full, .entry-detail {
    padding-left: 16px;
    padding-right: 16px;
  }
  .wotd-card { padding: 24px 20px; }
  footer { padding: 32px 16px; }
}

/* keep this AFTER the .dropdown-button width rule above */
.legend-toggle { display: none; position: absolute; top: 10px; left: 10px; z-index: 5; width: auto; }
@media (max-width: 720px) { .legend-toggle { display: flex; width: auto; } }
