/*
  Getting from one piece of writing to the others (_writing-nav.php), on every read.* page:
  the shelf in the left margin while you read, and "Keep reading" polaroids at the end.
  Uses the page's own colours (--wx-fg, --wx-soft, --wx-rule, --wx-drop).
*/

.wn-shelf a, .wn-prints a { color: inherit; text-decoration: none; }
.wn-label { margin: 0 0 1rem; font-family: var(--font-body); font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--wx-soft); transition: color 900ms var(--ease-soft); }
.wn-part { margin-left: .35em; font-family: var(--font-body); font-style: normal; font-size: .62em; letter-spacing: .14em; text-transform: uppercase; opacity: .7; white-space: nowrap; }

/* ---- the shelf: wide screens only, beside the essay; it arrives once the essay begins and steps aside before the footer ---- */
.wn-shelf { display: none; }
@media (min-width: 1180px) {
  .wn-shelf {
    display: block;
    position: fixed;
    z-index: 30;
    left: calc(env(safe-area-inset-left, 0px) + clamp(22px, 4vw, 54px));
    top: 50%;
    width: min(14rem, calc((100vw - var(--text-measure)) / 2 - 5rem));
    transform: translateY(-50%);
    color: var(--wx-fg);
    opacity: 0;
    visibility: hidden;
    transition: opacity 420ms var(--ease-soft), visibility 0s linear 420ms, color 900ms var(--ease-soft);   /* it leaves a little quicker than it arrives */
  }
  html.wn-in .wn-shelf { opacity: 1; visibility: visible; transition: opacity 700ms var(--ease-soft), visibility 0s, color 900ms var(--ease-soft); }
}
.is-menu-open .wn-shelf { opacity: 0 !important; visibility: hidden !important; }
.wn-shelf .wn-label a { transition: color 500ms var(--ease-soft); }
.wn-shelf .wn-label a:hover { color: var(--wx-fg); }
.wn-shelf ol { margin: 0; padding: 0; list-style: none; }
.wn-shelf li + li { margin-top: 1.05rem; }
.wn-shelf a { display: grid; grid-template-columns: 14px 1fr; column-gap: .55rem; align-items: baseline; opacity: .62; transition: opacity 500ms var(--ease-soft); }
.wn-shelf a:hover, .wn-shelf .is-current a { opacity: 1; }
/* each piece a drop of light; the one you're reading glows */
.wn-shelf__dot { grid-row: 1 / 3; align-self: start; width: 7px; height: 7px; margin-top: .45em; border-radius: 50%; background: radial-gradient(circle, currentColor 0%, transparent 72%); opacity: .4; }
.wn-shelf .is-current .wn-shelf__dot { opacity: 1; box-shadow: 0 0 10px 2px rgb(var(--wx-drop) / .45); }
.wn-shelf__t { font-family: var(--font-display); font-size: var(--text-side); line-height: 1.3; }
.wn-shelf__m { grid-column: 2; margin-top: .15rem; font-family: var(--font-body); font-size: .68rem; letter-spacing: .03em; color: var(--wx-soft); }

/* ---- "Keep reading": the other pieces as polaroids, like the homepage's ---- */
.wa > .wn-prints { width: min(100% - 2 * var(--gutter), 56rem); margin: clamp(3rem, 8vh, 5rem) auto 0; }
/* the prints wrap in centred rows, so an uneven last row sits in the middle; four make two rows of two */
.wn-prints ul { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(1.5rem, 4vw, 3rem); margin: 0 auto; padding: 0; list-style: none; }
.wn-prints li { flex: 0 1 16.5rem; }
.wn-prints .wn-label { text-align: center; margin-bottom: 1.6rem; }
.wn-prints ul:has(> li:nth-child(4):last-child) { max-width: 38rem; }
.wn-print a {
  display: block;
  padding: .8rem .8rem 1.2rem;
  border-radius: 8px;
  background: #f6f1e8;
  color: var(--ink);
  box-shadow: 0 24px 60px rgb(10 14 18 / .35);
  rotate: var(--tilt);
  transition: rotate 900ms var(--ease-soft), translate 900ms var(--ease-soft), box-shadow 900ms var(--ease-soft);
}
:root[data-theme="light"] .wn-print a { box-shadow: 0 24px 60px rgb(40 50 60 / .18); }
.wn-print a:hover, .wn-print a:focus-visible { rotate: 0deg; translate: 0 -6px; }
.wn-print img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; margin-bottom: .8rem; }
.wn-print__t { display: block; font-family: var(--font-display); font-size: 1.45rem; line-height: 1.15; }
.wn-print__d { margin-top: .45rem; font-size: .9rem; line-height: 1.5; color: #4c5866; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }   /* three lines at most, then an ellipsis */

@media (prefers-reduced-motion: reduce) {
  .wn-shelf, .wn-print a { transition: none; }
}

/* ---- notes in the margin (wide screens), beside the line that calls them, set like About's side notes ---- */
.wa-side { display: none; }
@media (min-width: 1240px) {
  .wa-sided .wa-body p { position: relative; }
  .wa-sided .wa-side {
    display: inline;
    position: absolute;
    left: calc(100% + clamp(2rem, 3.5vw, 4rem));
    width: clamp(11rem, 16vw, 15rem);
    padding: .1em 0 .1em 1rem;
    border-left: 1px solid var(--wx-rule);
    font-family: var(--font-display);
    font-weight: 400;
    font-style: italic;
    font-size: var(--text-side);
    line-height: var(--text-side-lh);
    text-indent: 0;
    color: var(--wx-soft);
    transition: color 900ms var(--ease-soft);
  }
  .wa-side em { font-style: normal; }
  .wa-side__n { margin-right: .55em; font-family: var(--font-body); font-style: normal; font-size: .7em; vertical-align: .2em; }
  /* the list at the end, kept for screen readers */
  .wa-sided .wa-notes { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .wa-sided .wa-ref a { cursor: default; }
}
@media (min-width: 1240px) {
  .wa-side__body { display: block; }
  .wa-side__more { display: none; }
  /* a long note: its first four lines, then "more" */
  .wa-side.is-long:not(.is-open) .wa-side__body { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
  .wa-side.is-long .wa-side__more {
    display: inline-flex; align-items: center; gap: .4em; margin-top: .45rem; padding: .15rem 0; border: 0; background: none;
    font-family: var(--font-body); font-style: normal; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
    color: inherit; cursor: pointer; opacity: .8; transition: opacity 400ms var(--ease-soft);
  }
  .wa-side__more:hover { opacity: 1; }
  .wa-side__more svg { width: .8em; height: auto; transition: transform 500ms var(--ease-soft); }
  .wa-side.is-open .wa-side__more svg { transform: rotate(180deg); }
}
/* a link inside a note: the same fine, faint underline as About's links */
.wa-side a, .wa-notes li a:not(.wa-notes__back) { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .22em; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); transition: text-decoration-color 400ms var(--ease-soft); }
.wa-side a:hover, .wa-side a:focus-visible, .wa-notes li a:not(.wa-notes__back):hover { text-decoration-color: currentColor; }
