/* Idioms — reader layout (meaning + example · by use) */

body.reader.idiom-page {
  height: auto;
  min-height: 100dvh;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
}

body.reader.idiom-page .reader-flow {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
}

body.reader.idiom-page .reader-foot {
  flex-shrink: 0;
}

.idiom-dock {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 8px;
  padding: 10px clamp(12px, 3vw, 28px);
  background: rgba(245, 243, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.idiom-dock a {
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.idiom-dock a:hover {
  color: var(--ink);
  border-color: #c9c3b8;
  background: var(--paper);
}

.idiom-dock a[aria-current="page"] {
  color: var(--paper);
  background: #5b21b6;
  border-color: #5b21b6;
}

.idiom-article {
  width: 100%;
  max-width: 44rem;
  margin-inline: auto;
  padding: clamp(16px, 3vw, 28px) var(--reader-inset);
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.idiom-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--paper);
  background: linear-gradient(90deg, #6d28d9, #7c3aed);
  padding: 4px 12px;
  border-radius: 999px;
}

.idiom-lede {
  margin: 0 0 18px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.idiom-toc {
  margin: 0 0 22px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.idiom-toc h2 {
  margin: 0 0 10px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
  direction: rtl;
  text-align: right;
}

.idiom-toc ul {
  margin: 0;
  padding: 0 1.1rem 0 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  direction: rtl;
}

.idiom-toc li {
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
}

.idiom-toc a {
  color: #5b21b6;
  text-decoration: none;
  border-bottom: 1px dashed rgba(91, 33, 182, 0.35);
}

.idiom-toc a:hover {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.idiom-block {
  margin: 0 0 26px;
  scroll-margin-top: 5rem;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.idiom-block h3 {
  margin: 0 0 8px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ink);
  direction: rtl;
  text-align: right;
}

.idiom-block__en {
  display: block;
  margin: 0 0 12px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  direction: ltr;
  text-align: left;
}

.idiom-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* One idiom per block (full width), phrase on its own prominent line */
.idiom-item {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(250, 245, 255, 0.95);
  border: 1px solid rgba(139, 92, 246, 0.28);
}

.idiom-phrase {
  margin: 0 0 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(124, 58, 237, 0.35);
  font-family: var(--font-ui);
  font-size: 0.98rem;
  font-weight: 800;
  font-style: italic;
  line-height: 1.4;
  color: #4c1d95;
  direction: ltr;
  text-align: left;
}

.idiom-mean {
  margin: 0 0 10px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.55;
  color: var(--accent-name);
  direction: rtl;
  text-align: right;
}

.idiom-explain {
  margin: 0 0 12px;
  padding: 11px 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(196, 181, 253, 0.55);
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.58;
  color: #475569;
  direction: rtl;
  text-align: right;
}

.idiom-explain strong {
  color: #4c1d95;
}

.idiom-examples {
  margin: 0;
}

.idiom-examples__head {
  margin: 0 0 8px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #5b21b6;
  direction: rtl;
  text-align: right;
  text-transform: uppercase;
}

.idiom-ex-pair {
  margin: 0 0 12px;
  padding: 10px 0 12px;
  border-top: 1px dashed rgba(203, 213, 225, 0.9);
}

.idiom-ex-pair:first-of-type {
  border-top: none;
  padding-top: 0;
}

.idiom-ex-pair:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
}

.idiom-ex-pair .idiom-ex {
  margin: 0 0 5px;
  padding-top: 0;
  border-top: none;
  font-family: var(--font-ui);
  font-size: 0.77rem;
  font-weight: 600;
  line-height: 1.45;
  direction: ltr;
  text-align: left;
  color: var(--ink);
}

.idiom-ex-pair .idiom-ex-ar {
  margin: 0;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.48;
  direction: rtl;
  text-align: right;
  color: var(--ink-soft);
}

/* Legacy: single .idiom-ex / .idiom-ex-ar outside pairs */
.idiom-ex {
  margin: 0 0 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(203, 213, 225, 0.55);
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.42;
  direction: ltr;
  text-align: left;
  color: var(--ink);
}

.idiom-ex-ar {
  margin: 0;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.45;
  direction: rtl;
  text-align: right;
  color: var(--ink-soft);
}

.idiom-item > .idiom-ex:first-of-type {
  margin-top: 0;
}

.idiom-use {
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px dashed rgba(167, 139, 250, 0.45);
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
  color: #5b21b6;
  direction: rtl;
  text-align: right;
}

.idiom-use strong {
  color: #4c1d95;
}

.idiom-footnote {
  margin: 22px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(139, 92, 246, 0.08);
  border: 1px dashed rgba(109, 40, 217, 0.35);
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #334155;
  direction: rtl;
}
