/* Discover (the archive). Scoped under .wijdan-dive and the page head in the template.
   Colours and fonts come from the theme's Editor presets (theme.json) with plain fallbacks.
   Phone first: filters stacked on top (writer + language folded away), results as rows with
   a small cover. Desktop (900px+): filters in a sticky left column, results as a grid of 3:4 covers. */

.wijdan-dive, .wijdan-dive-head {
  --paper: var(--wp--preset--color--paper, #fbfaf7);
  --surface: var(--wp--preset--color--surface, #ffffff);
  --mint: var(--wp--preset--color--mint, #e4f4ed);
  --mint-2: var(--wp--preset--color--mint-deep, #cfe9de);
  --mint-ink: var(--wp--preset--color--mint-ink, #2e6b58);
  --ink: var(--wp--preset--color--ink, #1d2623);
  --muted: var(--wp--preset--color--muted, #5f6c67);
  --line: var(--wp--preset--color--line, #dbe3df);
  --t-pink: #ffbcc5;
  --t-mint: #dbefee;
  --t-yellow: #fceaa0;
  --latin: var(--wp--preset--font-family--newsreader, "Newsreader", Georgia, serif);
  --arabic: var(--wp--preset--font-family--noto-naskh-arabic, "Noto Naskh Arabic", "Newsreader", serif);
  --gutter: var(--wp--style--root--padding-left, 20px);
  --radius: 4px;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
}
.wijdan-dive *, .wijdan-dive *::before, .wijdan-dive *::after { box-sizing: border-box; }
.wijdan-dive a { color: inherit; text-decoration: none; }
.wijdan-dive button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; border-radius: 0; line-height: inherit; }
.wijdan-dive ol, .wijdan-dive ul { list-style: none; margin: 0; padding: 0; }
.wijdan-dive li, .wijdan-dive p { margin: 0; }
.wijdan-dive img { display: block; max-width: 100%; height: auto; }
.wijdan-dive [hidden] { display: none !important; }

/* ---------- the page head (blocks in the template: eyebrow, title, lead) ---------- */
.wijdan-dive-head { padding-top: 28px; }
.wijdan-dive-head > * { margin: 0; }
.wijdan-dive-head > * + * { margin-top: 10px; }
.wijdan-dive-head .wijdan-eyebrow { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--mint-ink); }
.wijdan-dive-head .wijdan-dive-title { font-size: clamp(32px, 8.5vw, 52px); line-height: 1.12; letter-spacing: -.01em; }
.wijdan-dive-head .wijdan-lead { font-size: 19px; line-height: 1.6; color: var(--muted); max-width: 34em; }

/* ---------- small type pieces ---------- */
.wijdan-dive .kicker { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--mint-ink); }
.wijdan-dive .meta, .wijdan-dive .by { font-size: 15px; color: var(--muted); }
.wijdan-dive .by i { font-style: italic; white-space: nowrap; }
.wijdan-dive .text-link { font-style: italic; color: var(--mint-ink); border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.wijdan-dive .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 22px; border-radius: 99px; border: 1px solid var(--ink); font-size: 16px; line-height: 1; transition: background .2s, color .2s, border-color .2s; }
.wijdan-dive .btn:hover { background: var(--ink); color: var(--paper); }
.wijdan-dive .poster { display: block; width: 100%; height: 100%; }
/* the tint is the category's colour (--tone, set inline from her palette); the three classes are the pre-colour fallback */
.wijdan-dive .tone-pink { background: var(--t-pink); }
.wijdan-dive .tone-mint { background: var(--t-mint); }
.wijdan-dive .tone-yellow { background: var(--t-yellow); }
.wijdan-dive [style*="--tone"] { background: var(--tone); }
.wijdan-dive [lang="ar"] { font-family: var(--arabic); }

/* ---------- filters ---------- */
.wijdan-dive .dv-filters { display: grid; gap: 18px; margin: 0; padding: 24px 0 8px; }

.wijdan-dive .dv-search {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--surface);
  transition: border-color .2s; cursor: text;
}
.wijdan-dive .dv-search:focus-within { border-color: var(--mint-ink); }
.wijdan-dive .dv-search svg { flex: none; width: 17px; height: 17px; color: var(--muted); }
.wijdan-dive .dv-search input {
  flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: none;
  font: inherit; font-size: 17px; color: var(--ink); -webkit-appearance: none; appearance: none;
}
.wijdan-dive .dv-search input:focus { outline: none; box-shadow: none; }
.wijdan-dive .dv-search input::placeholder { color: var(--muted); font-style: italic; }
.wijdan-dive .dv-search input::-webkit-search-cancel-button, .wijdan-dive .dv-search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.wijdan-dive .dv-search input[lang="ar"] { font-family: var(--arabic); }
.wijdan-dive .dv-x { flex: none; width: 28px; height: 28px; margin-right: -6px; border-radius: 50%; font-size: 12px; color: var(--muted); transition: background .2s, color .2s; }
.wijdan-dive .dv-x:hover { background: var(--mint); color: var(--ink); }

.wijdan-dive .dv-group { display: grid; gap: 8px; min-width: 0; }
.wijdan-dive .dv-label { font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* chips: one sideways-scrolling line on phones, fading out at the right edge */
.wijdan-dive .dv-chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0;
  position: relative; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.wijdan-dive .dv-chips::-webkit-scrollbar { display: none; }
.wijdan-dive .dv-chips::after { content: ""; flex: none; width: 12px; }
.wijdan-dive .chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 15px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: 15px; white-space: nowrap;
  transition: background .2s, border-color .2s, color .2s;
}
.wijdan-dive .chip small { font-size: 12px; font-style: italic; color: var(--muted); font-variant-numeric: tabular-nums; transition: color .2s; }
.wijdan-dive .chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.wijdan-dive .chip.on small { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.wijdan-dive .chip:not(.on):hover { border-color: var(--mint-ink); }
.wijdan-dive .chip.none:not(.on) { opacity: .45; }

/* writer + language: folded under "More filters" on phones once the script runs */
.wijdan-dive .dv-fold { display: none; align-items: center; gap: 10px; justify-self: start; font-style: italic; color: var(--mint-ink); font-size: 16px; padding: 2px 0; }
.wijdan-dive .dv-fold::before { content: "+"; font-style: normal; width: 22px; height: 22px; display: inline-grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: 15px; line-height: 1; }
.wijdan-dive .dv-fold[aria-expanded="true"]::before { content: "–"; }
.wijdan-dive .dv-fold small { font-size: 12px; font-style: normal; letter-spacing: .1em; text-transform: uppercase; }
.wijdan-dive .dv-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.wijdan-dive .dv-apply { justify-self: start; }
.wijdan-dive[data-js] .dv-apply { display: none; }
@media (max-width: 899px) {
  .wijdan-dive[data-js] .dv-fold { display: inline-flex; }
  .wijdan-dive[data-js] .dv-pair:not(.open) { display: none; }
}

/* writer: a native select dressed as a pill */
.wijdan-dive .dv-select { position: relative; display: block; }
.wijdan-dive .dv-select select {
  appearance: none; -webkit-appearance: none; width: 100%; height: 42px; margin: 0; padding: 0 40px 0 16px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--surface);
  font: inherit; font-size: 16px; color: var(--ink); cursor: pointer; transition: border-color .2s, background .2s;
}
.wijdan-dive .dv-select select:focus-visible { outline: none; border-color: var(--mint-ink); }
.wijdan-dive .dv-select > span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted); pointer-events: none; }
.wijdan-dive .dv-select.on select { border-color: var(--ink); background: var(--mint); }

/* language: a three-way segmented switch with a sliding marker */
.wijdan-dive .dv-seg { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); height: 42px; padding: 3px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); }
.wijdan-dive .dv-seg a { position: relative; z-index: 1; display: grid; place-items: center; border-radius: 99px; font-size: 15px; color: var(--muted); transition: color .25s; }
.wijdan-dive .dv-seg a[lang="ar"] { font-size: 16px; }
.wijdan-dive .dv-seg a.on { color: var(--paper); }
.wijdan-dive .dv-seg::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 3);
  border-radius: 99px; background: var(--ink); transition: transform .35s cubic-bezier(.3, .7, .2, 1);
}
.wijdan-dive .dv-seg:has(.on[data-lang="en"])::before { transform: translateX(100%); }
.wijdan-dive .dv-seg:has(.on[data-lang="ar"])::before { transform: translateX(200%); }

/* ---------- results ---------- */
.wijdan-dive .dv-results { min-width: 0; }
.wijdan-dive .dv-status { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; padding: 18px 0 14px; }
.wijdan-dive .dv-count { font-size: 16px; font-style: italic; color: var(--muted); }
.wijdan-dive .dv-count b { font-weight: 400; font-style: normal; color: var(--ink); }
.wijdan-dive .dv-count .dv-n { color: var(--ink); font-style: normal; }
.wijdan-dive .dv-clear, .wijdan-dive .dv-empty .text-link { font-size: 15px; }

.wijdan-dive .dv-list { transition: opacity .14s ease; }
.wijdan-dive .dv-list.out { opacity: 0; }
.wijdan-dive.is-loading .dv-results { cursor: progress; }
.wijdan-dive .dv-empty { padding: 48px 0; text-align: center; color: var(--muted); font-style: italic; }
.wijdan-dive .dv-empty p + p { margin-top: 6px; }
.wijdan-dive .dv-empty .text-link { font-size: inherit; }

.wijdan-dive .dv-more { display: grid; justify-items: center; gap: 12px; padding: 32px 0 8px; }

/* ---------- the card: a row on phones ---------- */
.wijdan-dive .dv-card { border-bottom: 1px solid var(--line); animation: dv-in .5s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(min(var(--i, 0), 11) * 40ms); }
.wijdan-dive .dv-card:first-child { border-top: 1px solid var(--line); }
@keyframes dv-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.wijdan-dive .dv-card a { display: grid; grid-template-columns: 64px 1fr; gap: 16px; align-items: center; padding: 16px 0; }
.wijdan-dive .dv-cover { position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 3px; background: var(--mint); }
.wijdan-dive .dv-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
/* the category's colour: a thin strip along the foot of the cover (3px on the small phone cover, 4px on desktop) */
.wijdan-dive .dv-tint { display: block; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.wijdan-dive .dv-text { display: grid; gap: 3px; min-width: 0; }
.wijdan-dive .dv-card .item-title { font-size: 20px; line-height: 1.3; transition: color .2s; overflow-wrap: anywhere; }
.wijdan-dive .dv-card a:hover .item-title { color: var(--mint-ink); }
/* Arabic rows: the title reads right-to-left in the Arabic font; the small Latin lines keep their direction */
.wijdan-dive .dv-card[dir="rtl"] .dv-text { text-align: right; }
.wijdan-dive .dv-card[dir="rtl"] .item-title { font-size: 21px; line-height: 1.55; }
.wijdan-dive .dv-card[dir="rtl"] :is(.kicker, .by) { font-family: var(--latin); direction: ltr; unicode-bidi: plaintext; }
.wijdan-dive .dv-card[dir="rtl"] .kicker[lang="ar"] { font-family: var(--arabic); direction: rtl; }
.wijdan-dive [lang="ar"] em, .wijdan-dive [lang="ar"] i { font-style: normal; }

@media (prefers-reduced-motion: reduce) {
  .wijdan-dive .dv-card { animation: none; }
  .wijdan-dive .dv-list, .wijdan-dive .dv-seg::before, .wijdan-dive .dv-cover img { transition: none; }
}

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  .wijdan-dive-head { padding-top: 56px; padding-bottom: 36px; border-bottom: 1px solid var(--line); }
  .wijdan-dive-head .wijdan-lead { margin-top: 14px; }

  .wijdan-dive { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 64px; align-items: start; padding-top: 40px; }

  .wijdan-dive .dv-filters { position: sticky; top: 104px; gap: 26px; padding: 0; }
  .wijdan-dive .dv-chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; -webkit-mask-image: none; mask-image: none; }
  .wijdan-dive .dv-chips::after { display: none; }
  .wijdan-dive .chip { height: 34px; padding: 0 14px; font-size: 14.5px; }
  .wijdan-dive .dv-pair { gap: 26px; }

  .wijdan-dive .dv-status { padding: 8px 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 30px; }
  .wijdan-dive .dv-count { font-size: 17px; }

  /* cover cards in a grid */
  .wijdan-dive .dv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 44px 28px; }
  .wijdan-dive .dv-card, .wijdan-dive .dv-card:first-child { border: 0; }
  .wijdan-dive .dv-card a { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; padding: 0; }
  .wijdan-dive .dv-cover { border-radius: var(--radius); box-shadow: 0 1px 0 rgba(29, 38, 35, .04); }
  .wijdan-dive .dv-card a:hover .dv-cover img { transform: scale(1.035); }
  .wijdan-dive .dv-tint { display: block; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; }
  .wijdan-dive .dv-text { gap: 5px; }
  .wijdan-dive .dv-card .item-title { font-size: 21px; line-height: 1.25; }
  .wijdan-dive .dv-card .by { font-size: 14.5px; }

  .wijdan-dive .dv-more { padding-top: 56px; }
}

@media (min-width: 1200px) {
  .wijdan-dive .dv-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
