/* Artigos: the list of articles and the reading page.
   Loaded after bathos.css and reuses its palette, type and header/footer. The
   reading page carries one device from the Home: a sounding line in the margin
   that descends as the article is read, with a knot for each section. */

:root {
  --read: #CFDCDA;      /* long-form body text, a little brighter than --text-soft */
  --measure: 36rem;     /* reading column, about 66 characters */
  --sheet: 58rem;       /* article width: the column plus room for figures */
}

.site-nav a[aria-current="page"] { color: var(--surface); }

/* ---------- list of articles ---------- */
.articles { padding: clamp(6.5rem, 12vw, 8rem) 0 clamp(4rem, 9vw, 7rem); }
.articles-head h1 {
  font-size: var(--step-4); font-weight: 750; letter-spacing: -.035em; line-height: .95;
}
.articles-head p {
  margin-top: 1.25rem; max-width: 30rem;
  font-size: var(--step-1); line-height: 1.45; color: var(--text-soft);
}

.article-list { list-style: none; margin: clamp(2.5rem, 5vw, 3.5rem) 0 0; padding: 0; }
.entry { border-top: 1px solid var(--rule); }
.entry:last-child { border-bottom: 1px solid var(--rule); }
.entry-link {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  gap: clamp(1.25rem, 4vw, 3rem); align-items: start;
  padding: clamp(1.5rem, 4vw, 2.5rem) 0;
  text-decoration: none;
}
.entry-cover {
  margin: 0; aspect-ratio: 4 / 3; overflow: hidden; background: var(--deep);
}
.entry-cover img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  filter: saturate(.75) brightness(.86);
  transition: filter .5s, transform .9s cubic-bezier(.2, .7, .1, 1);
}
.entry-link:hover .entry-cover img { filter: saturate(.9) brightness(1); transform: scale(1.02); }
.entry h2 {
  font-size: var(--step-2); font-weight: 650; letter-spacing: -.02em; line-height: 1.08;
  text-decoration: underline; text-decoration-color: transparent;
  text-decoration-thickness: 2px; text-underline-offset: .18em;
  transition: text-decoration-color .3s;
}
.entry-link:hover h2 { text-decoration-color: var(--tide); }
.entry-sub { margin-top: .5rem; font-family: var(--font-head); font-size: 1.15rem; line-height: 1.3; color: var(--tide); }
.entry-dek { margin-top: 1rem; max-width: 34rem; color: var(--text-soft); font-style: italic; }
.entry-meta { margin-top: 1.25rem; font-family: var(--font-head); font-size: var(--step--1); color: var(--tide); }
.entry-link:focus-visible { outline-offset: 6px; }

/* The newest article sits at the surface: full width, the largest title on the page */
.entry-lead .entry-link { grid-template-columns: 1fr; gap: clamp(1.5rem, 3vw, 2.25rem); padding-top: 0; }
.entry-lead { border-top: 0; }
.entry-lead .entry-cover { aspect-ratio: 5 / 2; }
.entry-lead .entry-cover img { filter: saturate(.8) brightness(.9); }
.entry-lead .entry-text { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem clamp(2rem, 6vw, 5rem); }
.entry-lead h2 { font-size: var(--step-4); font-weight: 700; letter-spacing: -.03em; }
.entry-lead .entry-sub { font-size: var(--step-1); }
.entry-lead .entry-dek { margin-top: 0; font-size: var(--step-0); }
.entry-lead .entry-aside { padding-top: .4rem; }

@media (max-width: 760px) {
  .entry-link, .entry-lead .entry-text { grid-template-columns: 1fr; }
  .entry-lead .entry-cover { aspect-ratio: 3 / 2; }
  .entry-lead .entry-aside { padding-top: 0; }
}

/* ---------- reading page ---------- */
.sheet { max-width: var(--sheet); margin: 0 auto; padding: 0 var(--gutter); }

/* Cover: the painting or photograph, sinking into the page colour */
.article-cover { position: relative; height: min(72svh, 46rem); min-height: 20rem; overflow: hidden; background: var(--deep); }
.article-cover img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.8); }
.article-cover::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to top, var(--abyss) 0%, rgba(15, 37, 49, .7) 30%, rgba(15, 37, 49, 0) 65%),
    linear-gradient(rgba(8, 24, 32, .55), rgba(8, 24, 32, 0) 25%);
}

.article-head { position: relative; margin-top: clamp(-11rem, -18svh, -6rem); }
.article-head h1 {
  font-size: var(--step-5); font-weight: 750; line-height: .98; letter-spacing: -.035em;
  max-width: 15ch;
}
.article-sub {
  margin-top: .9rem; max-width: 30ch;
  font-family: var(--font-head); font-weight: 450; font-size: var(--step-2); line-height: 1.15; letter-spacing: -.015em;
  color: var(--tide);
}
.article-dek {
  margin-top: 1.75rem; max-width: var(--measure);
  font-size: var(--step-1); line-height: 1.45; font-style: italic; color: var(--surface);
}
.article-meta {
  margin-top: 1.5rem; padding-top: 1.25rem; max-width: var(--measure);
  border-top: 1px solid var(--rule);
  font-family: var(--font-head); font-size: .95rem; line-height: 1.5; color: var(--tide);
}
.article-meta strong { font-weight: 600; color: var(--surface); }

/* Body */
.article-body {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  font-size: clamp(1.125rem, 1.02rem + .35vw, 1.25rem); line-height: 1.75; color: var(--read);
}
.article-body > * { max-width: var(--measure); }
.article-body > p + p { margin-top: 1.15em; }
.article-body h2 {
  margin: 2.6em 0 .9em; scroll-margin-top: 6rem;
  font-size: clamp(1.5rem, 1.15rem + 1.4vw, 2rem); font-weight: 650; line-height: 1.15; letter-spacing: -.02em;
  color: var(--surface);
}
.article-body strong { font-weight: 600; color: var(--surface); }
.article-body em { font-style: italic; }

/* Lists use the knots of the sounding line as markers */
.article-body ul { list-style: none; margin: 1.5em 0; padding: 0; }
.article-body ul li { position: relative; padding-left: 1.75rem; }
.article-body ul li + li { margin-top: 1em; }
.article-body ul li::before {
  content: ""; position: absolute; left: .2rem; top: .62em;
  width: .55rem; height: .55rem; border-radius: 50%;
  border: 1px solid var(--tide); background: var(--deep);
}

/* A closing line the author set apart */
.article-body .article-pull {
  margin: 1.6em 0;
  font-family: var(--font-head); font-weight: 700; font-size: var(--step-3); line-height: 1.1; letter-spacing: -.025em;
  color: var(--surface);
}

/* Figures run past the reading column into the right margin */
.article-body figure { max-width: none; margin: 2.75em 0; }
.article-body figure img { display: block; width: 100%; height: auto; background: var(--deep); filter: saturate(.85) brightness(.92); }
.article-body figcaption {
  max-width: var(--measure); margin-top: .75rem;
  font-size: .9rem; line-height: 1.5; color: var(--tide);
}
.article-body figcaption cite { font-style: italic; }
.fig-tall { width: min(100%, 30rem); }

/* After the text: author, credits, what to read next */
.article-foot { margin-top: clamp(4rem, 9vw, 6rem); }
.author {
  max-width: var(--measure); padding: 1.75rem 0; border-top: 1px solid var(--tide);
}
.author h2 { font-size: var(--step--1); font-weight: 500; letter-spacing: 0; color: var(--tide); }
.author-name { margin-top: .5rem; font-family: var(--font-head); font-weight: 650; font-size: var(--step-1); line-height: 1.25; }
.author-bio { margin-top: .4rem; color: var(--text-soft); }
.author a { color: var(--surface); text-underline-offset: .2em; text-decoration-color: var(--tide); }

.credits { max-width: var(--measure); padding: 1.5rem 0 0; border-top: 1px solid var(--rule); font-size: .88rem; line-height: 1.55; color: var(--tide); }
.credits h2 { font-family: var(--font-head); font-size: var(--step--1); font-weight: 500; letter-spacing: 0; }
.credits ul { list-style: none; margin: .75rem 0 0; padding: 0; }
.credits li + li { margin-top: .5rem; }
.credits p { margin-top: 1rem; }
.credits a { color: var(--text-soft); text-underline-offset: .2em; text-decoration-color: var(--rule); }

.read-next { margin-top: clamp(4rem, 9vw, 6rem); background: var(--deep); padding: clamp(3rem, 7vw, 4.5rem) 0; }
.read-next h2 { font-size: var(--step--1); font-weight: 500; letter-spacing: 0; color: var(--tide); }
.next-link { display: block; margin-top: 1rem; max-width: 40rem; text-decoration: none; }
.next-title {
  display: block; font-family: var(--font-head); font-weight: 650; font-size: var(--step-3); line-height: 1.08; letter-spacing: -.025em;
  text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 2px; text-underline-offset: .18em;
  transition: text-decoration-color .3s;
}
.next-link:hover .next-title { text-decoration-color: var(--tide); }
.next-sub { display: block; margin-top: .5rem; font-family: var(--font-head); font-size: 1.15rem; color: var(--tide); }
.all-link { display: inline-block; margin-top: 2.25rem; font-family: var(--font-head); font-weight: 500; color: var(--text-soft); text-underline-offset: .25em; text-decoration-color: var(--rule); }
.all-link:hover { color: var(--surface); }

/* ---------- sounding line ----------
   JS (artigo.js) sets --p (0..1, how far through the text) on .sonda and builds one
   knot per section heading at its depth (--at). On wide screens the line hangs in
   the left margin and the knots are links to their sections; on narrower screens
   only the rope shows, as a thin line at the edge of the screen. */
.sonda { display: none; }
.js .sonda {
  display: block; position: fixed; z-index: 10; pointer-events: none;
  left: 0; top: 0; bottom: 0; width: 3px;
}
.sonda::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px;
  background: repeating-linear-gradient(to bottom, var(--rule) 0 3px, transparent 3px 9px);
}
.sonda-rope {
  position: absolute; left: 0; top: 0; width: 100%;
  height: calc(var(--p, 0) * 100%); background: var(--tide);
}
.sonda-weight, .sonda ol { display: none; }

@media (min-width: 1200px) {
  .js .sonda {
    left: max(1.5rem, calc((100vw - var(--sheet)) / 2 - 3.5rem));
    top: 7rem; bottom: 3rem; width: 1.5rem;
  }
  .sonda-rope { left: 50%; width: 1px; }
  .sonda-weight {
    display: block; position: absolute; left: 50%; top: calc(var(--p, 0) * 100%);
    transform: translate(-50%, -1px); color: var(--surface);
    filter: drop-shadow(0 0 .5rem rgba(143, 179, 181, .35));
  }
  .sonda ol { display: block; list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; }
  .sonda li { position: absolute; left: 50%; top: calc(var(--at) * 100%); }
  .sonda a {
    pointer-events: auto; position: absolute; left: 0; top: 0;
    width: 1.5rem; height: 1.5rem; margin: -.75rem 0 0 -.75rem;
    display: grid; place-items: center; text-decoration: none;
  }
  /* The knot; it fills once the reader has passed its section heading */
  .sonda a::before {
    content: ""; width: .6rem; height: .6rem; border-radius: 50%;
    border: 1px solid var(--tide); background: var(--abyss);
    transition: background-color .25s, box-shadow .25s, border-color .25s;
  }
  .sonda li.passed a::before {
    background: var(--surface); border-color: var(--surface);
    box-shadow: 0 0 0 .3rem rgba(233, 239, 236, .12);
  }
  .sonda a:hover::before { border-color: var(--surface); }
  .sonda a:focus-visible { outline-offset: 0; border-radius: 50%; }
  /* The section's name, shown beside its knot on hover or keyboard focus */
  .sonda-label {
    position: absolute; left: 1.6rem; top: 50%; transform: translate(-.25rem, -50%);
    width: max-content; max-width: 17rem; padding: .45rem .7rem;
    background: var(--deep); border: 1px solid var(--rule);
    font-family: var(--font-head); font-size: .85rem; line-height: 1.3; color: var(--surface);
    opacity: 0; visibility: hidden; transition: opacity .2s, transform .2s, visibility 0s .2s;
  }
  .sonda a:hover .sonda-label, .sonda a:focus-visible .sonda-label {
    opacity: 1; visibility: visible; transform: translate(0, -50%); transition: opacity .2s, transform .2s;
  }
}
@media (prefers-reduced-motion: reduce) {
  .entry-cover img, .sonda a::before, .sonda-label { transition: none; }
  .entry-link:hover .entry-cover img { transform: none; }
}

@media print {
  .site-header, .sonda, .read-next, .site-footer, .article-cover { display: none; }
  body { background: #fff; color: #000; }
  .article-head { margin-top: 0; }
  .article-body, .article-body h2, .article-body strong, .article-dek, .article-head h1 { color: #000; }
}
