/* ==========================================================================
   Almureed Journal (almureed-journal.php)
   Lists: topic links, a lead article with two beside it, then a grid.
   Article: centred header, wide image, a reading column of about 70 characters,
   and a rail for the contents list and sharing.
   Colours and the .alm-c container come from components.css.
   ========================================================================== */

/* Sizes include padding and borders, as the theme assumes. */
.alm-jwrap,
.alm-journal,
.alm-journal *,
.alm-jcta { box-sizing: border-box; }

/* Image rules carry .alm-c so they outrank Elementor's reset (.elementor img), which loads later. */

/* Page width for the templates (the blog page's Elementor container sets its own). */
.alm-jwrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(48px, 6vw, 88px);
  width: 100%;
  max-width: 1320px;
  margin-inline: auto;
  padding: clamp(40px, 5vw, 72px) 20px clamp(56px, 7vw, 104px);
}

.alm-journal { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(28px, 3.5cqi, 44px); }

/* The theme gives list items a bottom margin; these lists space themselves with gap. */
.alm-c :is(ul.alm-jgrid, ul.alm-jside) > li,
.alm-jtopics li,
.alm-share li,
.alm-toc li { margin: 0; }

/* Shared heading face, without the font's decorative ligatures. */
.alm-c :is(.alm-jcard__title, .alm-jmore__title, .alm-article__title, .alm-article__deck),
.alm-article__body :is(h2, h3, h4, blockquote),
.alm-article__body > p:first-child::first-letter {
  font-family: var(--heading-font-family, "Gallery", serif);
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "clig" 0, "dlig" 0, "calt" 0, "swsh" 0;
  letter-spacing: 0;
}

/* Line icons in this file: stroke drawn here so one SVG works at every size. */
:is(.alm-jtopics__icon, .alm-jcard__icon, .alm-jchip__icon) svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   Topic links
   ----------------------------------------------------------------------- */
.alm-jtopics ul {
  position: relative; /* Keeps the hidden count labels inside the scrolling row. */
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 2px 2px 6px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.alm-jtopics li { flex: none; }
.alm-jtopics a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 5px 14px 5px 5px;
  border: 1px solid var(--alm-line);
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--alm-ink);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.alm-jtopics__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #EEF3D0;
  color: var(--alm-green);
}
.alm-jtopics__icon svg { width: 24px; height: 24px; stroke-width: 2.4; }
.alm-jtopics__count {
  min-width: 1.9em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--alm-bone);
  color: var(--alm-body);
  font-size: 0.8125rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.alm-jtopics a:hover { border-color: var(--alm-green); }
.alm-jtopics a:focus-visible { outline: 3px solid var(--alm-green); outline-offset: 3px; }
.alm-jtopics a[aria-current] { background: var(--alm-green); border-color: var(--alm-green); color: #FFFFFF; }
.alm-jtopics a[aria-current] .alm-jtopics__icon { background: var(--alm-lime); color: var(--alm-on-lime); }
.alm-jtopics a[aria-current] .alm-jtopics__count { background: rgba(255, 255, 255, 0.16); color: #FFFFFF; }

/* --------------------------------------------------------------------------
   Article card
   Regions are direct children: image, header (topic, title, date), summary, footer.
   The card is its own size container, so it lays itself out by its own width.
   ----------------------------------------------------------------------- */
.alm-jcard {
  position: relative;
  container: jcard / inline-size;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  align-content: start;
  gap: 14px;
  height: 100%;
  padding: 12px 12px 22px;
  background: #FFFFFF;
  border: 1px solid var(--alm-line);
  border-radius: 28px;
  color: var(--alm-ink);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.alm-jcard > * { grid-column: 1 / -1; }
.alm-c .alm-jcard > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 20px;
  background: var(--alm-bone);
}
.alm-jcard > :is(header, p, footer) { padding-inline: 12px; }
.alm-jcard > header { display: grid; gap: 10px; padding-top: 6px; }
.alm-jcard__topic {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--alm-green);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.alm-jcard__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #EEF3D0;
}
.alm-jcard__icon svg { width: 20px; height: 20px; stroke-width: 2.6; }
.alm-c .alm-jcard__title {
  margin: 0;
  color: inherit;
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.25;
  text-wrap: balance;
}
.alm-jcard__title a { color: inherit; text-decoration: none; }
.alm-jmeta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  color: var(--alm-body);
  font-size: 0.875rem;
  line-height: 1.4;
}
.alm-jcard__excerpt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--alm-body);
  font-size: 0.9375rem;
  line-height: 1.65;
  text-wrap: pretty;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.alm-jcard > footer { align-self: end; }
.alm-jcard__go {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--alm-green);
  font-size: 0.9375rem;
  font-weight: 700;
}
.alm-jcard__go .alm-btn__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--alm-lime);
  color: var(--alm-on-lime);
}

/* The whole card opens the article: the heading link stretches over it; hover and focus style the card. */
.alm-jcard a.card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 28px; }
.alm-jcard a.card-link:focus-visible { outline: none; }
.alm-jcard:has(a.card-link:focus-visible) { outline: 3px solid var(--alm-green); outline-offset: 4px; }
.alm-jcard:has(a.card-link:hover) { border-color: rgba(16, 85, 31, 0.3); box-shadow: 0 22px 44px rgba(16, 85, 31, 0.12); }
.alm-jcard:has(a.card-link:hover) .alm-jcard__title a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

/* Wide cards (the lead article): the image sits beside the text. */
@container jcard (min-width: 640px) {
  .alm-jcard:not(.alm-jcard--compact):has(> img) > img {
    grid-column: 1;
    grid-row: 1 / span 3;
    height: 100%;
    min-height: 360px;
    aspect-ratio: auto;
    border-radius: 22px;
  }
  .alm-jcard:not(.alm-jcard--compact):has(> img) > :is(header, p, footer) { grid-column: 2; padding-inline: 20px 24px; }
  .alm-jcard:not(.alm-jcard--compact):has(> img) > header { align-self: end; padding-top: 24px; }
}

/* The lead article. */
.alm-jcard--lead { padding: 12px; row-gap: 18px; }
.alm-c .alm-jcard--lead .alm-jcard__title { font-size: clamp(1.5rem, 1rem + 1.6cqi, 2rem); line-height: 1.18; }
.alm-jcard--lead .alm-jcard__excerpt { font-size: 1rem; -webkit-line-clamp: 4; line-clamp: 4; }
.alm-jcard--lead > footer { padding-bottom: 12px; }

/* Compact cards beside the lead: a small arched thumbnail and the title. */
.alm-jcard--compact {
  grid-template-columns: 92px minmax(0, 1fr);
  align-content: center;
  column-gap: 16px;
  padding: 12px 18px 12px 12px;
  border-radius: 24px;
}
.alm-c .alm-jcard--compact > img {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  width: 92px;
  aspect-ratio: 92 / 108;
  border-radius: 46px 46px 14px 14px;
}
.alm-jcard--compact > header { grid-column: 2; grid-row: 1; align-self: center; gap: 8px; padding: 2px 0; }
.alm-c .alm-jcard--compact .alm-jcard__title { font-size: 1.1875rem; line-height: 1.28; }
.alm-jcard--compact a.card-link::after { border-radius: 24px; }

/* --------------------------------------------------------------------------
   List layout
   ----------------------------------------------------------------------- */
.alm-jfeature { display: grid; gap: 24px; }
.alm-jside { display: grid; gap: 24px; margin: 0; padding: 0; list-style: none; align-content: start; }
@container almc (min-width: 980px) {
  .alm-jfeature { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: stretch; }
  .alm-jfeature--solo { grid-template-columns: minmax(0, 1fr); }
  .alm-jside { grid-auto-rows: 1fr; align-content: stretch; }
}
@container almc (min-width: 600px) and (max-width: 979.98px) {
  .alm-jside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.alm-jmore { display: grid; gap: 24px; }
.alm-c .alm-jmore__title { margin: 0; color: var(--alm-ink); font-size: clamp(1.75rem, 1.3rem + 1.4cqi, 2.25rem); font-weight: 500; line-height: 1.15; }
.alm-jgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.alm-jempty { margin: 0; color: var(--alm-body); font-size: 1.0625rem; }

/* Page links. */
.alm-jpages ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.alm-jpages li { margin: 0; }
.alm-jpages :is(a, span) {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--alm-line);
  border-radius: 999px;
  color: var(--alm-ink);
  font-weight: 600;
  text-decoration: none;
}
.alm-jpages a:hover { border-color: var(--alm-green); }
.alm-jpages .current { background: var(--alm-green); border-color: var(--alm-green); color: #FFFFFF; }
.alm-jpages .dots { border-color: transparent; }

/* --------------------------------------------------------------------------
   Slim page band on articles (the page hero with compact set)
   ----------------------------------------------------------------------- */
.alm-phero.alm-phero--text.alm-phero--compact { padding-block: clamp(28px, 3cqi, 40px); }
.alm-phero--compact::after { display: none; } /* The arch outline only shows as a stray line in a band this short. */
.alm-phero--compact .alm-phero__h1 { margin-top: 8px; font-size: clamp(26px, 2.8cqi, 34px); line-height: 1.15; }
.alm-phero--compact .alm-crumbs li:last-child span {
  display: inline-block;
  max-width: min(46ch, 60vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* --------------------------------------------------------------------------
   Article
   ----------------------------------------------------------------------- */
.alm-journal--article { gap: clamp(56px, 7cqi, 96px); }
.alm-article { display: grid; gap: clamp(28px, 4cqi, 48px); }
.alm-article__head {
  display: grid;
  justify-items: center;
  gap: 18px;
  max-width: 56rem;
  margin-inline: auto;
  text-align: center;
}
.alm-jchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 16px 4px 4px;
  border-radius: 999px;
  background: #EEF3D0;
  color: var(--alm-green);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.alm-jchip__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #FFFFFF;
}
.alm-jchip__icon svg { width: 20px; height: 20px; stroke-width: 2.5; }
.alm-jchip:hover { background: var(--alm-lime); color: var(--alm-on-lime); }
.alm-jchip:focus-visible { outline: 3px solid var(--alm-green); outline-offset: 3px; }
.alm-c .alm-article__title {
  margin: 0;
  color: var(--alm-ink);
  font-size: clamp(2rem, 1.2rem + 2.6cqi, 3.25rem);
  font-weight: 500;
  line-height: 1.12;
  text-wrap: balance;
}
.alm-c .alm-article__deck {
  max-width: 44rem;
  margin: 0;
  color: var(--alm-body);
  font-size: clamp(1.125rem, 1rem + 0.5cqi, 1.375rem);
  line-height: 1.5;
  text-wrap: pretty;
}
.alm-article__head .alm-jmeta { justify-content: center; font-size: 0.9375rem; }

.alm-article__figure { margin: 0; }
.alm-c .alm-article__figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 640px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 28px;
  background: var(--alm-bone);
}
.alm-article__figure figcaption { margin-top: 10px; color: var(--alm-body); font-size: 0.875rem; text-align: center; }

.alm-article__layout { display: grid; gap: 32px; }
.alm-article__aside {
  display: grid;
  gap: 28px;
  width: 100%;
  max-width: 42rem;
  margin-inline: auto;
  padding-top: 24px;
  border-top: 1px solid var(--alm-line);
}
@container almc (min-width: 1080px) {
  .alm-article__layout { grid-template-columns: minmax(0, 1fr) minmax(0, 42rem) minmax(0, 1fr); column-gap: 48px; align-items: start; }
  .alm-article__body { grid-column: 2; grid-row: 1; }
  .alm-article__aside {
    position: sticky;
    top: 120px;
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    width: min(100%, 220px);
    margin: 0;
    padding-top: 6px;
    border-top: 0;
  }
}

/* Reading column. */
.alm-article__body {
  width: 100%;
  max-width: 42rem;
  margin-inline: auto;
  color: #2E3530;
  font-size: 1.125rem;
  line-height: 1.8;
  overflow-wrap: break-word;
}
.alm-article__body > * { margin: 0 0 1.25em; }
.alm-article__body > :last-child { margin-bottom: 0; }
.alm-article__body p { font-size: inherit; line-height: inherit; color: inherit; text-wrap: pretty; }
.alm-article__body > p:first-child::first-letter {
  float: left;
  margin: 0.06em 0.12em 0 0;
  color: var(--alm-green);
  font-size: 3.6em;
  line-height: 0.8;
}
.alm-article__body :is(h2, h3, h4) {
  margin: 1.8em 0 0.6em;
  color: var(--alm-ink);
  font-weight: 500;
  line-height: 1.22;
  text-wrap: balance;
  scroll-margin-top: 120px;
}
.alm-article__body h2 { font-size: clamp(1.625rem, 1.4rem + 0.8cqi, 2rem); }
.alm-article__body h3 { font-size: 1.5rem; }
.alm-article__body h4 { font-size: 1.3125rem; }
.alm-article__body a { color: var(--alm-green); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.alm-article__body a:hover { text-decoration-thickness: 2px; }
.alm-article__body :is(ul, ol) { padding-left: 1.4em; }
.alm-article__body li { margin: 0.35em 0; }
.alm-article__body li::marker { color: var(--alm-green); }
.alm-article__body blockquote {
  margin: 1.8em 0;
  padding: 4px 0 4px 24px;
  border-left: 3px solid var(--alm-lime);
  color: var(--alm-ink);
  font-size: 1.375rem;
  line-height: 1.5;
}
.alm-article__body blockquote p { margin: 0 0 0.6em; }
.alm-c .alm-article__body :is(img, video, iframe) { max-width: 100%; height: auto; border-radius: 20px; }
.alm-article__body figure { margin: 2em 0; }
.alm-article__body figcaption { margin-top: 8px; color: var(--alm-body); font-size: 0.875rem; }
.alm-article__body hr { height: 1px; margin: 2.5em 0; border: 0; background: var(--alm-line); }

/* Contents list. */
.alm-share__title,
.alm-toc__title {
  margin: 0;
  color: var(--alm-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.alm-toc ol { display: grid; margin: 10px 0 0; padding: 0; list-style: none; border-left: 1px solid var(--alm-line); }
.alm-toc a {
  display: block;
  margin-left: -1px;
  padding: 6px 0 6px 14px;
  border-left: 2px solid transparent;
  color: var(--alm-body);
  font-size: 0.9375rem;
  line-height: 1.4;
  text-decoration: none;
}
.alm-toc a:hover { border-left-color: var(--alm-lime); color: var(--alm-green); }
.alm-toc__l3 a { padding-left: 26px; font-size: 0.875rem; }

/* Sharing. */
.alm-share { display: grid; gap: 12px; }
.alm-share ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.alm-share li { position: relative; }
.alm-share li[hidden] { display: none; }
.alm-share__btn {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--alm-line);
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--alm-green);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.alm-share__btn:hover { background: var(--alm-green); border-color: var(--alm-green); color: #FFFFFF; }
.alm-share__btn:focus-visible { outline: 3px solid var(--alm-green); outline-offset: 2px; }
.alm-share__btn .alm-i-check { display: none; }
.alm-share__btn[data-copied] { background: var(--alm-lime); border-color: var(--alm-lime); color: var(--alm-on-lime); }
.alm-share__btn[data-copied] .alm-i-link { display: none; }
.alm-share__btn[data-copied] .alm-i-check { display: block; }
.alm-share__btn[data-failed] { border-color: #B3261E; color: #B3261E; }
.alm-share__tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  translate: -50% 0;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--alm-ink);
  color: #FFFFFF;
  font-size: 0.8125rem;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.alm-share__tip:not(:empty) { opacity: 1; }

/* Related reading. */
.alm-jrelated { display: grid; gap: 32px; padding-top: clamp(40px, 5cqi, 72px); border-top: 1px solid var(--alm-line); }

@media (prefers-reduced-motion: reduce) {
  :is(.alm-jcard, .alm-jtopics a, .alm-jchip, .alm-share__btn, .alm-share__tip) { transition: none; }
}
