/* wilco.io reading pages: the story (/story/) and every year review (/review-YYYY/).
   Ported from the round 7 artboards R7-story and R7-review ("super easy to read"): one calm column of about
   680px, body 21px/1.6 (19px on phones), a quiet contents list at the left on wide screens, pictures in the column
   or wider (960px), a thin reading-progress line in the top bar. Uses the tokens from site.css. */

/* the reading grid: contents (240) + gap (96) + the column. The column starts at the same x on every page. */
.lay { display: grid; grid-template-columns: 240px 96px minmax(0, 1fr); }
.lay > .c { grid-column: 3; min-width: 0; }

/* ---------- opening ---------- */
.open { padding-top: 72px; }
.ttl { margin: 0; font-weight: 700; letter-spacing: -.02em; }
/* review: "This happened to me in" + the year, big */
.ohead { display: flex; align-items: flex-end; justify-content: space-between; gap: 48px; }
.ohead .ttl { flex: none; }
.kick { display: block; font-weight: 500; font-size: 40px; line-height: 1.1; letter-spacing: -.015em; }
.year { display: block; font-size: 208px; line-height: .84; letter-spacing: -.04em; margin: 16px 0 0 -6px; }
/* the cover as a tilted print */
.print {
  flex: 0 1 448px; min-width: 300px; display: block; margin: 4px 8px 0 0; background: var(--white); padding: 14px;
  border-radius: 4px; transform: rotate(2deg);
  box-shadow: 0 1px 2px rgba(16, 20, 24, .06), 0 14px 32px -14px rgba(16, 20, 24, .26);
}
.print img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 2px; background: #E9EBEE; }
/* story: the title as on the home door, "twice" with the hand-drawn stroke */
.st { font-size: 128px; line-height: .94; letter-spacing: -.03em; }
.st .l { display: block; }
.sub { margin: 36px 0 0; font-size: 30px; line-height: 1.26; font-weight: 500; letter-spacing: -.012em; max-width: 680px; text-wrap: balance; }

/* ---------- body ---------- */
.read { padding-top: 56px; }
.toc { position: relative; }
.toc nav { position: sticky; top: calc(var(--bar-h) + 48px); }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a {
  position: relative; display: block; padding: 7px 0 7px 20px; font-size: 16px; line-height: 1.3; font-weight: 500;
  color: var(--ink-soft); text-decoration: none; transition: color .2s ease;
}
.toc a::before {
  content: ''; position: absolute; left: 0; top: calc(50% - 1px); width: 8px; height: 2px; border-radius: 2px;
  background: rgba(16, 20, 24, .18); transition: background-color .2s ease, width .2s ease;
}
.toc a:hover, .toc a[aria-current] { color: var(--ink); }
.toc a[aria-current]::before { background: var(--marker-deep); width: 12px; }

.txt > * { max-width: 680px; }
.txt p, .txt li { font-size: 21px; line-height: 1.6; font-weight: 400; letter-spacing: 0; text-wrap: pretty; }
.txt p { margin: 0 0 1em; }
.txt ul, .txt ol { margin: 0 0 1em; padding-left: 1.2em; }
.txt li { margin: 0 0 .4em; }
.txt li::marker { color: var(--ink-soft); }
.txt a { text-decoration-line: underline; text-decoration-color: var(--marker-deep); text-decoration-thickness: 3px; text-underline-offset: .16em; text-decoration-skip-ink: none; transition: text-decoration-color .3s ease; }
.txt a:hover { text-decoration-color: var(--ink); }
.txt .lede { font-size: 28px; line-height: 1.38; font-weight: 500; letter-spacing: -.01em; margin: 0 0 32px; }
.txt h2 { margin: 136px 0 0; font-size: 44px; line-height: 1.08; font-weight: 700; letter-spacing: -.022em; text-wrap: balance; }
.txt h3 { margin: 80px 0 20px; font-size: 30px; line-height: 1.18; font-weight: 700; letter-spacing: -.015em; text-wrap: balance; }
.txt h2 + h3 { margin-top: 48px; }
.txt h2 + p, .txt h2 + figure { margin-top: 28px; }
.txt h4 { margin: 48px 0 8px; font-size: 21px; line-height: 1.4; font-weight: 700; letter-spacing: 0; }
.txt h3 + h4 { margin-top: 24px; }
.txt strong { font-weight: 700; }
.txt blockquote { margin: 40px 0; padding-left: 24px; border-left: 3px solid var(--marker-deep); }
.txt hr { border: 0; border-top: 1px solid var(--hairline); margin: 64px 0; }
.txt table { border-collapse: collapse; margin: 0 0 1em; font-size: 18px; }
.txt th, .txt td { text-align: left; padding: 8px 16px 8px 0; border-bottom: 1px solid var(--hairline); }
.txt code { font-size: .9em; }
/* a pull line: one of his own sentences, set larger, with the marker */
.txt .pull { margin: 56px 0; font-size: 32px; line-height: 1.3; font-weight: 500; letter-spacing: -.012em; text-wrap: balance; }

/* ---------- pictures ---------- */
.fig { margin: 56px 0; }
.fig img { width: 100%; height: auto; border-radius: 16px; background: #E9EBEE; }
.txt > .wide { max-width: 960px; }
.fig figcaption { margin-top: 14px; font-size: 17px; line-height: 1.45; font-weight: 400; color: var(--ink-soft); max-width: 680px; text-wrap: pretty; }
.pics { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.pics img { aspect-ratio: 4 / 3.3; object-fit: cover; }
.pics.n3, .pics.n6, .pics.n9 { grid-template-columns: repeat(3, 1fr); }
.pics.n3 img, .pics.n6 img, .pics.n9 img { aspect-ratio: 1 / 1; }

/* the video: a local poster; the YouTube player loads only after a click (reading.js) */
.yt { position: relative; display: block; border-radius: 16px; overflow: hidden; background: var(--ink); aspect-ratio: 16 / 9; color: var(--white); }
.yt img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; opacity: .92; transition: opacity .2s ease; }
.yt:hover img { opacity: 1; }
.yt-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); transition: transform .2s ease; filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .3)); }
.yt:hover .yt-play, .yt:focus-visible .yt-play { transform: translate(-50%, -50%) scale(1.08); }
.yt-play path:first-child { fill: var(--ink); }
.yt:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video figcaption { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.yt-label { font-weight: 600; color: var(--ink); }

/* a post on X: same poster and play button as the video; after a click X's own post loads in a frame (reading.js),
   which reports its height so the frame fits the post (no inner scrollbar). X draws posts 250 to 550px wide. */
.xp { position: relative; display: block; border-radius: 16px; overflow: hidden; background: var(--ink); aspect-ratio: 16 / 9; color: var(--white); }
.xp img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; opacity: .92; transition: opacity .2s ease; }
.xp:hover img { opacity: 1; }
.xp:hover .yt-play, .xp:focus-visible .yt-play { transform: translate(-50%, -50%) scale(1.08); }
.xp:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.xp-frame { max-width: 550px; margin: 0 auto; }
.xp-frame iframe { display: block; width: 100%; height: 640px; border: 0; border-radius: 12px; }
.xp-frame iframe:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.xp-link { color: inherit; text-underline-offset: .2em; }

/* the 404 and privacy pages */
.txt > .sub { margin: 36px 0 32px; }

/* the letter's ending (story) */
.letter .ps { margin-top: 56px; }

/* ---------- the end: year reviews, then the close ---------- */
.end { padding-top: 160px; }
.end > h2 { margin: 0; font-size: 44px; line-height: 1.08; font-weight: 700; letter-spacing: -.022em; }
/* plain fallback list (used only while src/partials/review-print.html does not exist) */
.end.c { max-width: none; }                          /* the prints may use the width right of the column */
.end .pr7-row { margin-top: 40px; padding-right: 24px; }
/* plain fallback prints (only while src/partials/review-print.html does not exist) */
.pr7-read .pr7-row:not(.pr7-on) { max-width: 980px; }
.pr7-row > li > .yp { width: 300px; }
.yp {
  --t: -2deg; display: block; text-decoration: none; color: inherit; background: var(--white); padding: 12px 12px 0;
  border-radius: 4px; transform: rotate(var(--t));
  box-shadow: 0 1px 2px rgba(16, 20, 24, .06), 0 10px 28px -12px rgba(16, 20, 24, .22);
  transition: transform .45s cubic-bezier(.3, 1.4, .5, 1), box-shadow .35s ease;
}
.pr7-row li:nth-child(2n) > .yp { --t: 1.5deg; }
.yp img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 2px; background: #E9EBEE; }
.yc { display: block; padding: 16px 4px 20px; }
.yc .s { display: block; font-size: 18px; font-weight: 500; line-height: 1.3; }
.yc .n { display: inline-block; margin-top: 4px; font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -.025em; text-decoration: underline; text-decoration-color: var(--marker-deep); text-decoration-thickness: 3px; text-underline-offset: .14em; text-decoration-skip-ink: none; }
.yp:hover, .yp:focus-visible { transform: rotate(0deg) translateY(-8px); box-shadow: 0 2px 4px rgba(16, 20, 24, .06), 0 22px 44px -16px rgba(16, 20, 24, .28); }

.close { padding-top: 144px; }
.cl { margin: 0; font-weight: 700; font-size: 72px; line-height: 1.02; letter-spacing: -.03em; max-width: 900px; text-wrap: balance; }
.cl .e { font-size: .7em; vertical-align: .06em; }
.close .btn { margin-top: 40px; }

/* ---------- narrower: the contents list goes, the column centres, wide pictures bleed both ways ---------- */
@media (max-width: 1180px) {
  .lay { display: block; }
  .toc { display: none; }
  .lay > .c { max-width: 680px; margin: 0 auto; }
  .txt > .wide { max-width: none; width: min(960px, calc(100vw - 2 * var(--side))); margin-left: calc(50% - min(480px, 50vw - var(--side))); }
  .ohead { flex-direction: column; align-items: flex-start; gap: 40px; }
  .print { flex: none; width: min(480px, 100%); min-width: 0; margin: 0 0 0 4px; transform: rotate(1.5deg); }
  .end.c { max-width: 680px; }
  .cl { max-width: 680px; }
}
@media (max-width: 820px) {
  .kick { font-size: 34px; }
  .year { font-size: 176px; }
  .st { font-size: 104px; }
  .sub { font-size: 26px; }
  .cl { font-size: 56px; }
}
/* ---------- phone: a first-class reading size, not a shrink ---------- */
@media (max-width: 640px) {
  .open { padding-top: 32px; }
  .ohead { gap: 28px; }
  .kick { font-size: 24px; line-height: 1.15; }
  .year { font-size: 120px; margin: 8px 0 0 -3px; }
  .print { width: calc(100% - 8px); padding: 10px; transform: rotate(1.2deg); }
  .st { font-size: 56px; line-height: .98; }
  .sub { font-size: 22px; line-height: 1.3; margin-top: 20px; text-wrap: pretty; }
  .read { padding-top: 40px; }
  .txt p, .txt li { font-size: 19px; line-height: 1.6; }
  .txt .lede { font-size: 22px; line-height: 1.4; margin-bottom: 24px; }
  .txt h2 { margin-top: 96px; font-size: 32px; line-height: 1.1; }
  .txt h3 { margin: 64px 0 16px; font-size: 24px; line-height: 1.2; }
  .txt h2 + h3 { margin-top: 36px; }
  .txt h2 + p, .txt h2 + figure { margin-top: 20px; }
  .txt h4 { font-size: 19px; margin-top: 40px; }
  .txt .pull { margin: 48px 0; font-size: 25px; line-height: 1.32; }
  .fig { margin: 40px 0; }
  .fig figcaption { font-size: 16px; }
  .txt > .wide { width: auto; margin-left: 0; }
  .pics, .pics.n3, .pics.n6, .pics.n9 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .pics.n2 { grid-template-columns: 1fr; }
  .pics.n2 img { aspect-ratio: auto; }
  .pics img { border-radius: 12px; }
  .letter .ps { margin-top: 48px; }
  .end { padding-top: 128px; }
  .end > h2 { font-size: 32px; }
  .end .pr7-row { margin-top: 32px; }
  .yp { padding: 8px 8px 0; }
  .yc { padding: 12px 2px 14px; }
  .yc .s { font-size: 16px; }
  .yc .n { font-size: 30px; }
  .close { padding-top: 112px; }
  .cl { font-size: 40px; line-height: 1.06; }
  .close .btn { margin-top: 32px; }
}
@media (max-width: 360px) {
  .year { font-size: 108px; }
  .st { font-size: 50px; }
}

/* ---------- gallery: square thumbnails; each opens the bigger picture (reading.js shows it in a dialog) ---------- */
.gal { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 960px; }
.gal.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.txt .gal { padding: 0; margin: 0; }
.txt .gal li { margin: 0; }
.gl { display: block; border-radius: 10px; overflow: hidden; background: #E9EBEE; }
.gl img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 0; transition: transform .3s ease; }
.gl:hover img { transform: scale(1.03); }
.gl:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
@media (max-width: 640px) {
  .gal, .gal.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .gl { border-radius: 6px; }
}
.lb { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(16, 20, 24, .94); color: var(--white); }
.lb::backdrop { background: rgba(16, 20, 24, .6); }
.lb-in { position: absolute; inset: 64px 72px 72px; display: flex; align-items: center; justify-content: center; }
/* the picture box has a definite size (the area between the controls), so a tall photo is scaled down to fit */
.lb-in picture { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-width: 0; min-height: 0; }
.lb img { max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 8px; object-fit: contain; }
@media (max-height: 500px) { .lb-in { inset: 52px 72px 44px; } .lb-cap { bottom: 10px; font-size: 14px; } }
.lb-cap { position: absolute; left: 24px; right: 24px; bottom: 20px; margin: 0; font-size: 16px; line-height: 1.4; text-align: center; color: rgba(255, 255, 255, .8); }
.lb button {
  position: absolute; width: 48px; height: 48px; border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, .12); color: var(--white); font: 600 24px/1 var(--font); display: grid; place-items: center;
}
.lb button:hover { background: rgba(255, 255, 255, .22); }
.lb button:focus-visible { outline: 3px solid var(--marker); outline-offset: 2px; }
.lb-x { top: 12px; right: 12px; }
.lb-p { left: 12px; top: calc(50% - 24px); }
.lb-n { right: 12px; top: calc(50% - 24px); }
@media (max-width: 640px) { .lb-in { inset: 64px 8px 124px; } .lb-p, .lb-n { top: auto; bottom: 64px; } }

/* a plain text page (privacy): room between the big title and the first paragraph */
.txt > .ttl + p:not(.sub) { margin-top: var(--s-48); }
