/* 2026-11 rhythm pass: staggered columns, crooked frames, a few spreads, the dark-tale chapter,
   paper grain and a closing page. Loaded after polish.css; remove this file to undo the look
   (gallery.js still works without it, the cards just fall back to the plain grid). */

/* Paper grain: one small tile, scrolls with the page, no fixed overlay. */
body{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .33 0 0 0 0 .25 0 0 0 .32 -.13'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")}

/* Masonry: gallery.js gives each card a row span; the gap lives here so JS and CSS agree. */
.gallery-grid{--rhythm-gap:46px}
@media(max-width:900px){.gallery-grid{--rhythm-gap:35px}}
@media(max-width:700px){.gallery-grid{--rhythm-gap:30px}}
@media(min-width:1001px){.gallery-grid{--rhythm-gap:56px}}
.gallery-grid.is-masonry{grid-auto-rows:4px;row-gap:0!important;align-items:start}
.gallery-grid.is-masonry>*{margin-top:0!important}
.gallery-grid.is-masonry .gallery-piece:not(.is-lead) .gallery-art img{aspect-ratio:var(--ar,1)!important;object-fit:contain}

/* Frames sit a little crooked and straighten when you reach for them. */
.gallery-piece:not(.is-lead) .gallery-art{transform:rotate(var(--tilt,0deg));transition:transform .35s cubic-bezier(.22,.7,.25,1),box-shadow .35s ease}
@media(hover:hover) and (pointer:fine){.gallery-piece:not(.is-lead) .gallery-art:hover{transform:rotate(0deg) translateY(-3px);box-shadow:0 18px 36px #5f4a3517}}

/* Tape: none, left, pink washi in the middle, right. Chosen per drawing, so it never jumps on refilter. */
.gallery-piece[data-tape] .gallery-art:before{content:'';position:absolute;top:-9px;left:22px;width:54px;height:18px;background:#d6bca36b;transform:rotate(-8deg);pointer-events:none;z-index:1}
.gallery-piece[data-tape="0"] .gallery-art:before{content:none}
.gallery-piece[data-tape="2"] .gallery-art:before{left:calc(50% - 30px);width:60px;background:#e4bcc07a;transform:rotate(2deg)}
.gallery-piece[data-tape="3"] .gallery-art:before{left:auto;right:18px;transform:rotate(9deg)}

/* Spreads: one drawing gets the whole width, with room for its note. */
.gallery-grid .gallery-piece.is-spread{grid-column:1/-1!important;display:grid;grid-template-columns:minmax(0,min(540px,52%)) minmax(0,1fr);gap:64px;align-items:center;padding:10px 0 6px}
.gallery-piece.is-spread .gallery-art{box-shadow:12px 14px 0 -1px #f1e8d8,12px 14px 0 0 #ddd0bf,0 10px 30px #5f4a350d}
.gallery-piece.is-spread .gallery-caption{padding:0;max-width:26em}
.gallery-piece.is-spread .gallery-caption h2{font-size:30px;line-height:1.5;letter-spacing:1px;margin:14px 0 12px}
.gallery-piece.is-spread .gallery-caption p{font-size:15px;line-height:2.1}
.gallery-piece.is-spread[data-tape="1"],.gallery-piece.is-spread[data-tape="3"]{grid-template-columns:minmax(0,1fr) minmax(0,min(540px,52%))}
.gallery-piece.is-spread[data-tape="1"] .gallery-caption,.gallery-piece.is-spread[data-tape="3"] .gallery-caption{order:-1;justify-self:end;text-align:right}
.gallery-piece.is-spread[data-tape="1"] .gallery-caption small,.gallery-piece.is-spread[data-tape="3"] .gallery-caption small{justify-content:flex-end}
@media(max-width:700px){
 .gallery-grid .gallery-piece.is-spread,.gallery-grid .gallery-piece.is-spread[data-tape]{grid-template-columns:1fr;gap:0;padding:0}
 .gallery-piece.is-spread[data-tape] .gallery-caption{order:0;justify-self:start;text-align:left;padding-top:16px}
 .gallery-piece.is-spread[data-tape] .gallery-caption small{justify-content:flex-start}
 .gallery-piece.is-spread .gallery-caption h2{font-size:23px}
 .gallery-piece.is-spread .gallery-art{box-shadow:7px 8px 0 -1px #f1e8d8,7px 8px 0 0 #ddd0bf}
}

/* The dark fairy tales are mounted on black card, and open with their own title page. */
.gallery-piece.is-tale .gallery-art{background:#2a2225;border-color:#3d3134;box-shadow:0 14px 30px #2a1d2026}
.gallery-piece.is-tale[data-tape] .gallery-art:before{content:'';background:#8a3e4a8c}
.gallery-piece.is-tale .gallery-caption small{color:#7d3a48}
.gallery-chapter{grid-column:1/-1;position:relative;margin:18px 0 0;padding:56px 32px 52px;text-align:center;color:#efe4da;background:#2a2225 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .95 0 0 0 0 .9 0 0 0 .5 -.25'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");border-radius:3px 2px 6px 2px;box-shadow:0 18px 40px #2a1d2030;transform:rotate(-.4deg)}
.gallery-chapter:before{content:'';position:absolute;top:-10px;left:calc(50% - 34px);width:68px;height:20px;background:#8a3e4a99;transform:rotate(-3deg)}
.gallery-chapter small{display:block;font:11px/1.8 Arial,sans-serif;letter-spacing:3px;color:#cdb0b4}
.gallery-chapter h2{font-size:42px;font-weight:400;line-height:1.3;letter-spacing:14px;margin:16px 0 12px;text-indent:14px}
.gallery-chapter p{font-size:15px;line-height:1.9;color:#ddcdc3;margin:0}
@media(max-width:700px){.gallery-chapter{padding:40px 20px 36px}.gallery-chapter h2{font-size:32px;letter-spacing:10px;text-indent:10px}.gallery-chapter small{font-size:10px;letter-spacing:2px}.gallery-chapter p{font-size:14px}}

/* Closing page: a small drawing, one line, a seal. */
#gallery .gallery-afterword{display:grid;grid-template-columns:minmax(0,1fr);justify-items:center;text-align:center;gap:0;margin:96px 0 12px;padding:30px 0 6px;border-top:0}
.afterword-tail{margin:0 0 26px}
.afterword-tail img{display:block;width:150px;height:auto;padding:10px;background:#fffcf6;border:1px solid #e2d8c9;box-shadow:0 10px 26px #5f4a3512;transform:rotate(-3deg)}
.afterword-line{font:24px/1.6 JournalSerif,'Songti SC',serif;letter-spacing:1px;color:#493e39;margin:0}
.afterword-sign{display:flex;align-items:center;gap:10px;margin:10px 0 8px;font-size:13px;letter-spacing:2px;color:#7d5660}
.afterword-seal{display:grid;place-items:center;width:28px;height:32px;border:1px solid #9d5158;border-radius:2px;color:#9d5158;font-size:16px;letter-spacing:0;transform:rotate(-6deg)}
@media(max-width:700px){#gallery .gallery-afterword{margin-top:64px}.afterword-tail img{width:120px}.afterword-line{font-size:20px}}

@media(prefers-reduced-motion:reduce){.gallery-piece .gallery-art{transition:none}}
@media(forced-colors:active),(prefers-contrast:more){
 body{background-image:none}
 .gallery-piece .gallery-art,.gallery-piece:not(.is-lead) .gallery-art:hover{transform:none;box-shadow:none}
 .gallery-chapter{background:Canvas;color:CanvasText;border:1px solid CanvasText;transform:none}
 .gallery-chapter small,.gallery-chapter p{color:CanvasText}
 .gallery-chapter:before,.gallery-piece[data-tape] .gallery-art:before{display:none}
}
