/* wp-content/plugins/notts-osteo-articles/assets/articles.css
 *
 * The articles archive and the single article.
 *
 * NO RAW BRAND COLOUR IN HERE. Every value reads the custom property the rest of the site uses, so
 * this follows tokens.css instead of drifting from it. Each falls back to the brand value so the
 * pages are still right if the elements plugin has not enqueued its tokens.
 *
 * Author: Sean Burn
 */

.nosteo-archive,
.nosteo-article {
  --na-ink:     var(--nosteo-ink, #323e48);
  --na-accent:  var(--nosteo-accent, #fc7e00);
  --na-tint:    var(--nosteo-tint, #ecf4df);
  --na-white:   var(--nosteo-white, #ffffff);
  --na-muted:   var(--nosteo-muted, #69737d);
  --na-hair:    var(--nosteo-hair, rgba(50, 62, 72, 0.16));
  --na-ease:    var(--nosteo-ease, cubic-bezier(0.22, 0.61, 0.36, 1));

  /* The site is 1440 wide with 72 gutters. Articles are narrower on purpose: prose past about
     70 characters a line is measurably harder to read, and this page is nothing but prose. */
  --na-wide:    var(--nosteo-site-w, 1440px);
  --na-pad:     var(--nosteo-site-pad, 72px);

  font-family: var(--nosteo-font, inherit);
  color: var(--na-ink);
}

/* ---------------------------------------------------------------- archive */

.nosteo-archive__hero {
  background: var(--na-tint);
  padding: 72px 0 64px;
}

.nosteo-archive__hero-inner,
.nosteo-archive__body,
.nosteo-article__hero-inner,
.nosteo-article__grid,
.nosteo-article__more-inner {
  max-width: var(--na-wide);
  margin: 0 auto;
  padding-left: var(--na-pad);
  padding-right: var(--na-pad);
}

.nosteo-archive__eyebrow {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: var(--nosteo-weight-semibold, 600);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--na-muted);
}

.nosteo-archive__title {
  margin: 0 0 16px;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.01em;
}

.nosteo-archive__lede {
  max-width: 62ch;
  margin: 0;
  font-size: 19px;
  line-height: 1.55;
  color: var(--na-muted);
}

.nosteo-archive__body { padding-top: 56px; padding-bottom: 96px; }

/* A three-column grid, not CSS multi-column.
   Columns were the original choice for a masonry look, and they misbehaved: the browser balances
   column HEIGHTS, and with four cards it packed them two-and-two and left the third column empty,
   so a full-width page showed a two-column list.
   Grid also fixes something multi-column was always going to get wrong here — columns fill
   top-to-bottom, so a list sorted newest-first read down the left before crossing to the right.
   Rows read left-to-right, which is the order the dates are actually in.
   The cards are near-uniform in height, so nothing is lost by dropping the staggered look. */
.nosteo-archive__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  align-items: start;
}

.nosteo-acard {
  margin: 0;
}

.nosteo-acard__link {
  display: block;
  overflow: hidden;
  border: 1px solid var(--na-hair);
  border-radius: 14px;
  background: var(--na-white);
  color: inherit;
  text-decoration: none;
  transition: box-shadow 200ms var(--na-ease), transform 200ms var(--na-ease), border-color 200ms var(--na-ease);
}

/* Doubled class: this theme's reset styles bare links and would otherwise win the tie. */
.nosteo-archive .nosteo-acard__link:hover,
.nosteo-archive .nosteo-acard__link:focus-visible {
  border-color: transparent;
  box-shadow: 0 16px 40px rgba(50, 62, 72, 0.16);
  transform: translateY(-3px);
}

.nosteo-acard__media img {
  display: block;
  width: 100%;
  height: auto;
}

.nosteo-acard__text { padding: 22px 24px 26px; }

.nosteo-acard__date {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--na-muted);
}

.nosteo-acard__title {
  margin: 0 0 10px;
  font-size: 23px;
  line-height: 1.2;
}

.nosteo-acard__excerpt {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--na-muted);
}

.nosteo-acard__go {
  font-weight: var(--nosteo-weight-semibold, 600);
  color: var(--na-accent);
}

.nosteo-acard__go::after { content: " \2192"; }

.nosteo-archive__empty { padding: 40px 0 90px; color: var(--na-muted); }

/* ---------------------------------------------------------------- single */

.nosteo-article__hero {
  position: relative;
  overflow: hidden;
  background: var(--na-tint);
  padding: 72px 0 0;
}

.nosteo-article__hero-inner {
  position: relative;
  display: grid;
  /* The right column is decoration, not content, so it gives way first and disappears entirely
     before the headline has to compete with it. */
  grid-template-columns: minmax(0, 1fr) clamp(180px, 22vw, 320px);
  gap: 48px;
  align-items: end;
}

.nosteo-article__hero-text { padding-bottom: 72px; }

/* The angled motif.
   The featured image used to sit here, and it is a TITLE CARD — the headline is printed across
   it — so the hero showed the same words twice, in two different sizes, on the same background.
   The cover still does the jobs it is good at: the archive grid and the link preview.
   Drawn rather than generated: no second file per article, nothing to download, no layout shift. */
.nosteo-article__hero-motif {
  position: relative;
  align-self: stretch;

  /* Bleeds off the right edge instead of stopping at the gutter. Boxed into the container it read
     as a stray graphic floating in the corner; running off the page makes it a panel the hero is
     sitting on, which is the same device the page heroes use elsewhere on the site. */
  margin-right: calc(var(--na-pad) * -1);

  background:
    repeating-linear-gradient(
      -14deg,
      color-mix(in srgb, var(--na-ink) 22%, transparent) 0 1px,
      transparent 1px 11px
    );
  clip-path: polygon(30% 0, 100% 0, 100% 100%, 0 100%);
}

/* A single accent edge along the shear, rather than the orange wedge that used to sit here — that
   was a shape with no reason to be that shape, and it clipped awkwardly at the fold. */
.nosteo-article__hero-motif::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--na-accent);
  clip-path: polygon(30% 0, 30.9% 0, 0.9% 100%, 0 100%);
}

.nosteo-article__kicker {
  margin: 0 0 14px;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--na-muted);
}

.nosteo-article__kicker span { margin: 0 8px; }

.nosteo-article__title {
  margin: 0 0 18px;
  font-size: clamp(34px, 4.6vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.01em;
  /* Long single words in a heading this size otherwise push past the column. */
  overflow-wrap: break-word;
}

.nosteo-article__standfirst {
  max-width: 54ch;
  margin: 0;
  font-size: 20px;
  line-height: 1.55;
  color: var(--na-muted);
}

.nosteo-article__body { padding: 64px 0 96px; }

.nosteo-article__grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.nosteo-article__rail {
  position: sticky;
  /* Clears the sticky header rather than sliding under it. */
  top: calc(var(--nosteo-nav-h, 0px) + 24px);
}

.nosteo-article__meta {
  margin: 0 0 24px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--na-hair);
}

.nosteo-article__meta dt {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--na-muted);
}

.nosteo-article__meta dd {
  margin: 2px 0 16px;
  font-size: 16px;
}

.nosteo-article__meta dd:last-child { margin-bottom: 0; }

/* The one link in the meta rail.
   It was left unstyled, so it fell through to the browser default — and once visited that is the
   purple-pink every browser has shipped since 1994, which looked like a bug on a page otherwise
   built from two brand colours. :visited is pinned EXPLICITLY rather than relying on `a` alone,
   because that default is what was actually showing. */
.nosteo-article .nosteo-article__meta a,
.nosteo-article .nosteo-article__meta a:visited {
  color: var(--na-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  transition: text-decoration-color 160ms var(--na-ease);
}

.nosteo-article .nosteo-article__meta a:hover,
.nosteo-article .nosteo-article__meta a:focus-visible {
  text-decoration-color: currentColor;
}

.nosteo-article__cta { display: grid; gap: 10px; }

.nosteo-article .nosteo-article__btn {
  display: block;
  padding: 13px 18px;
  border: 1px solid var(--na-ink);
  border-radius: 300px;
  background: transparent;
  color: var(--na-ink);
  font-weight: var(--nosteo-weight-semibold, 600);
  text-align: center;
  text-decoration: none;
  transition: background-color 180ms var(--na-ease), color 180ms var(--na-ease);
}

.nosteo-article .nosteo-article__btn--primary {
  background: var(--na-accent);
  border-color: var(--na-accent);
  color: var(--na-white);
}

.nosteo-article .nosteo-article__btn:hover,
.nosteo-article .nosteo-article__btn:focus-visible {
  background: var(--na-ink);
  border-color: var(--na-ink);
  color: var(--na-white);
}

.nosteo-article__note {
  margin: 20px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--na-muted);
}

/* The prose itself. Measure capped in ch so it holds at any font size. */
.nosteo-article__prose { max-width: 68ch; font-size: 18px; line-height: 1.7; }

.nosteo-article__prose h2 {
  margin: 44px 0 14px;
  font-size: 29px;
  line-height: 1.2;
}

.nosteo-article__prose h2:first-child { margin-top: 0; }
.nosteo-article__prose p { margin: 0 0 20px; }

/* :visited pinned for the same reason as the meta rail — the default would show through. */
.nosteo-article__prose a,
.nosteo-article__prose a:visited { color: var(--na-accent); text-underline-offset: 3px; }

/* ---------------------------------------------------------------- more */

.nosteo-article__more { background: var(--na-tint); padding: 64px 0 80px; }
.nosteo-article__more h2 { margin: 0 0 28px; font-size: 30px; }

.nosteo-article__more ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nosteo-article__more a,
.nosteo-article__more a:visited {
  display: block;
  color: inherit;
  text-decoration: none;
}

.nosteo-article__more img {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 12px;
  border-radius: 12px;
}

.nosteo-article__more-title { display: block; font-size: 19px; font-weight: var(--nosteo-weight-semibold, 600); line-height: 1.25; }
.nosteo-article__more-date { display: block; margin-top: 6px; font-size: 14px; color: var(--na-muted); }

/* ---------------------------------------------------------------- narrower */

@media (max-width: 1100px) {
  .nosteo-archive__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nosteo-article__grid { grid-template-columns: 240px minmax(0, 1fr); gap: 44px; }
}

@media (max-width: 860px) {
  .nosteo-archive,
  .nosteo-article { --na-pad: 24px; }

  /* The motif is decoration; on a narrow screen the headline gets the whole width. */
  .nosteo-article__hero-inner { grid-template-columns: 1fr; gap: 0; }
  .nosteo-article__hero-text { padding-bottom: 44px; }
  .nosteo-article__hero-motif { display: none; }

  /* The rail stops being a rail: sticky meta above the article it describes is just a wall
     between the reader and the first sentence. */
  .nosteo-article__grid { grid-template-columns: 1fr; gap: 36px; }
  .nosteo-article__rail { position: static; order: 2; }
  .nosteo-article__prose { order: 1; }

  .nosteo-article__more ul { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nosteo-archive__grid { grid-template-columns: minmax(0, 1fr); }
  .nosteo-archive__hero { padding: 48px 0 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .nosteo-acard__link { transition: none; }
  .nosteo-archive .nosteo-acard__link:hover { transform: none; }
}

/* ---------------------------------------------------------------- rail on other pages
 *
 * The Articles Rail widget. It reuses the site's own rail and reveal from home-blocks.css, so
 * there is no second carousel implementation and no extra script — what is here is only the part
 * those two do not cover: the head, and the card at rail width.
 */

.nosteo-artrail__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.nosteo-artrail__eyebrow {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: var(--nosteo-weight-semibold, 600);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nosteo-muted, #69737d);
}

.nosteo-artrail__title {
  margin: 0;
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.nosteo-artrail .nosteo-artrail__all {
  flex: none;
  font-weight: var(--nosteo-weight-semibold, 600);
  color: var(--nosteo-accent, #fc7e00);
  text-decoration: none;
  white-space: nowrap;
}

.nosteo-artrail .nosteo-artrail__all:hover,
.nosteo-artrail .nosteo-artrail__all:focus-visible { text-decoration: underline; text-underline-offset: 4px; }

.nosteo-artrail__all::after { content: " \2192"; }

/* How many cards are in view.
   The rail sizes its columns from --per (see home-blocks.css); setting a width on the li did
   nothing, because grid-auto-columns decides the track. Left unset it inherits --per: 1, which is
   why the rail showed a single card and the rest only appeared on scroll.
   The values are FRACTIONAL on purpose: the remainder is the next card peeking, which is what
   tells a reader — and a thumb — that the row continues. With four articles or fewer they simply
   fit and nothing peeks, which is the correct behaviour rather than a special case. */
.nosteo-artrail__rail { --per: 1.15; }

@container nosteo-sec (min-width: 560px) { .nosteo-artrail__rail { --per: 2.25; } }
@container nosteo-sec (min-width: 900px) { .nosteo-artrail__rail { --per: 3.3; } }

/* The card fills its slot: without this a short article's card is shorter than its neighbours and
   the row of "Read" links stops lining up. */
.nosteo-artrail__card,
.nosteo-artrail .nosteo-acard__link {
  height: 100%;
}

.nosteo-artrail .nosteo-acard__link {
  display: flex;
  flex-direction: column;
}

.nosteo-artrail .nosteo-acard__text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

/* Pushes the link to the bottom of whatever height the card ends up. */
.nosteo-artrail .nosteo-acard__go { margin-top: auto; }

.nosteo-artrail .nosteo-acard__excerpt {
  /* Three lines, so one long standfirst cannot make every card in the rail tall. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

@media (max-width: 860px) {
  .nosteo-artrail__head { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* A phone number in the body copy.
   It inherits the prose link colour, but the underline is stated here rather than left to the
   theme: on a phone this is the one thing on the page somebody may want to TAP, and a number that
   does not look tappable does not get tapped. Addresses are deliberately not linked — see
   Linkify.php for why. */
.nosteo-article__prose .nosteo-tel,
.nosteo-article__prose .nosteo-tel:visited {
  color: var(--na-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  white-space: nowrap;
}
