/* Text records share the photo grid rhythm without pretending to be images. */
.text-post-card,.text-post-card.announcement-card{background:#fff;border:1px solid var(--line);color:#273b32}
.text-post-card .text-post-open{display:flex;flex-direction:column;align-items:stretch;gap:18px;padding:clamp(16px,2vw,24px);text-align:left}
.text-post-kind,.reader-kind{display:inline-flex;align-items:center;gap:7px;align-self:flex-start;font-size:12px;line-height:1.5;font-weight:600;color:#41634d}
.text-post-kind{padding:6px 10px;background:transparent;border:1px solid #dde4d9;border-radius:100px;max-width:calc(100% - 34px)}
.text-post-kind .icon,.reader-kind .icon{width:16px;height:16px;flex:none}
.text-post-body{display:flex;flex-direction:column;justify-content:center;gap:12px;flex:1;min-height:0;min-width:0}
.text-post-card h3{font-size:clamp(16px,1.35vw,21px);font-weight:600;line-height:1.65;letter-spacing:.01em;margin:0;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:5;overflow:hidden;overflow-wrap:anywhere}
.text-post-summary{font-size:13px;line-height:1.8;color:#607066;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;overflow-wrap:anywhere}
.text-post-footer{display:grid;gap:4px;border-top:1px solid #dce2d8;padding-top:14px;font-size:12px;line-height:1.5;min-width:0}
.text-post-source{font-weight:600;overflow-wrap:anywhere}
.text-post-date{color:#68776d;font-size:11px}
.text-post-read{display:flex;align-items:center;justify-content:space-between;margin-top:8px;font-size:12px;color:#41634d;font-weight:600}
.text-post-read .icon{width:17px;height:17px;transition:transform .2s}
.text-post-card:hover{border-color:#9ab39e;box-shadow:0 5px 18px #2840320b}
.text-post-card:hover .text-post-read .icon{transform:translateX(3px)}
.text-post-card .text-post-save{top:14px;right:12px;bottom:auto;opacity:1;filter:none;color:#54715c;width:36px;height:36px;padding:8px;border-radius:50%}
.text-post-card .text-post-save:hover{background:#ffffffb3}
.text-post-card .text-post-save.saved .icon{fill:#54715c;stroke:#54715c}
.text-post-open:focus-visible{outline:3px solid #63856b;outline-offset:-4px;border-radius:inherit}
.text-post-card.text-post-feed{aspect-ratio:auto;border-radius:20px}
.text-post-feed .text-post-open{gap:20px;padding:28px}
.text-post-feed h3{-webkit-line-clamp:unset;font-size:24px;padding-right:8px}
.text-post-feed .text-post-summary{-webkit-line-clamp:4;font-size:15px}
.text-post-feed .text-post-footer{grid-template-columns:1fr auto;align-items:center;column-gap:20px}
.text-post-feed .text-post-date{grid-column:1}
.text-post-feed .text-post-read{grid-column:2;grid-row:1 / 3;gap:16px;margin:0}

/* A bounded single-column reader; its close button stays outside the scroller. */
.post-dialog.text-reader:not(.video-fullscreen){width:min(760px,calc(100vw - 64px));max-height:calc(100dvh - 96px);overflow:hidden}
.post-dialog.text-reader:not(.video-fullscreen) .post-detail{display:block;height:auto;max-height:calc(100dvh - 96px)}
.text-detail>.post-text{max-height:calc(100dvh - 96px);overflow:auto;scrollbar-width:thin}
.text-detail .post-author{padding:22px 66px 20px 32px}
.text-detail .post-author>div{min-width:0;overflow-wrap:anywhere}
.text-detail .post-copy{padding:30px 40px 28px;overflow:visible}
.reader-kind{margin-bottom:14px}
.text-detail .post-copy h2{font-size:28px;line-height:1.5;margin-bottom:12px}
.text-detail .post-copy>.reader-date{font-size:13px;color:#728175;margin:0 0 24px;line-height:1.5}
.text-detail .post-copy>p:not(.reader-date){font-size:16px;line-height:1.95;color:#384c3e}
.text-detail .post-bottom{padding:24px 40px 28px}
.text-detail .post-tools{flex-wrap:wrap;gap:12px 18px}
.text-detail .post-tools button{min-height:40px}
.post-source-details{border-top:1px solid var(--line);margin:22px 0 16px;padding-top:4px;color:#52694f}
.post-source-details>summary{display:flex;align-items:center;justify-content:space-between;gap:12px;list-style:none;cursor:pointer;min-height:44px;font-size:13px;font-weight:600;padding:8px 0}
.post-source-details>summary::-webkit-details-marker{display:none}
.post-source-details>summary::after{content:'＋';font-size:18px;font-weight:400}
.post-source-details[open]>summary::after{content:'−'}
.post-source-details .post-provenance{border-top:0;margin-top:0;padding-top:8px}
.post-source-details .image-availability{margin:0 0 8px;padding:12px 14px;border-radius:12px;background:#f2f5ee;color:#5e7259;font-size:13px;line-height:1.8}
.post-source-details>summary:focus-visible{outline:3px solid #63856b;outline-offset:3px;border-radius:6px}
@media(max-width:820px){
 .post-dialog.text-reader:not(.video-fullscreen){width:calc(100vw - 24px);max-height:calc(100dvh - 24px)}
 .post-dialog.text-reader:not(.video-fullscreen) .post-detail,.text-detail>.post-text{max-height:calc(100dvh - 24px)}
 .text-detail .post-author{padding:20px 60px 18px 22px}
 .text-detail .post-copy{padding:24px}
 .text-detail .post-copy h2{font-size:24px}
 .text-detail .post-bottom{padding:22px 24px 26px}
}
@media(max-width:760px){
 /* Saved text/media collections retain their existing single-column mobile layout. */
 body[data-archive-view="saved"] .photo-grid{grid-template-columns:minmax(0,1fr);gap:14px;margin-left:0;margin-right:0}
 body[data-archive-view="saved"] .photo-grid>.photo-tile{grid-column:1 / -1;width:100%;border-radius:16px}
 body[data-archive-view="saved"] .photo-tile:not(.text-post-card) .tile-caption{padding:54px 20px 22px}
 body[data-archive-view="saved"] .photo-tile:not(.text-post-card) .tile-caption h3{font-size:17px;line-height:1.6;-webkit-line-clamp:2;padding-right:32px}
 body[data-archive-view="saved"] .photo-tile:not(.text-post-card) .tile-caption>span{font-size:12px}
 body[data-archive-view="saved"] .photo-tile:not(.text-post-card) .tile-save{opacity:1;width:44px;height:44px;display:grid;place-items:center;right:12px;bottom:12px}
 .photo-grid>.text-post-card{grid-column:1 / -1;aspect-ratio:auto}
 .photo-grid>.text-post-card .text-post-open{padding:22px;gap:18px}
 .photo-grid>.text-post-card h3{font-size:21px;-webkit-line-clamp:3}
 .photo-grid>.text-post-card .text-post-summary{display:-webkit-box;-webkit-line-clamp:2;font-size:14px}
 .photo-grid>.text-post-card .text-post-footer{grid-template-columns:1fr auto;align-items:center;column-gap:16px}
 .photo-grid>.text-post-card .text-post-date{grid-column:1}
 .photo-grid>.text-post-card .text-post-read{grid-column:2;grid-row:1 / 3;gap:12px;margin:0}
}
@media(max-width:520px){
 .text-post-card .text-post-open{gap:12px;padding:16px}
 .text-post-kind{font-size:11px;padding:5px 7px;gap:5px;max-width:calc(100% - 26px)}
 .text-post-kind .icon{width:13px;height:13px}
 .text-post-card h3{font-size:15px;line-height:1.6;-webkit-line-clamp:4}
 .text-post-card:not(.text-post-feed) .text-post-summary{-webkit-line-clamp:2}
 .text-post-footer{padding-top:10px;font-size:11px}
 .text-post-read{font-size:11px;margin-top:5px}
 .text-post-card .text-post-save{top:11px;right:7px;width:32px;height:32px;padding:7px}
 .text-post-feed .text-post-open{padding:22px;gap:18px}
 .text-post-feed h3{font-size:21px;-webkit-line-clamp:unset}
 .text-post-feed .text-post-summary{font-size:14px}
 .text-post-feed .text-post-footer{column-gap:12px}
}
@media(prefers-reduced-motion:reduce){.text-post-read .icon{transition:none}}

:root[data-theme="dark"] .text-post-card,:root[data-theme="dark"] .text-post-card.announcement-card{background:#191d21;border-color:#465159;color:#f1f4f2}
:root[data-theme="dark"] .text-post-kind{background:transparent;border-color:#58675f;color:#b9ddc4}
:root[data-theme="dark"] :is(.text-post-read,.text-post-save,.reader-kind){color:#b9ddc4}
:root[data-theme="dark"] :is(.text-post-summary,.text-post-date,.text-detail .post-copy>.reader-date){color:#bdc7c1}
:root[data-theme="dark"] .text-post-footer{border-color:#46534b}
:root[data-theme="dark"] .text-post-card:hover{border-color:#86b99b;box-shadow:0 5px 18px #0002}
:root[data-theme="dark"] .text-post-card .text-post-save:hover{background:#ffffff14}
:root[data-theme="dark"] .text-post-card .text-post-save.saved .icon{fill:#b9ddc4;stroke:#b9ddc4}
:root[data-theme="dark"] .text-detail .post-copy>p:not(.reader-date){color:#e2e9e5}
:root[data-theme="dark"] .post-source-details{color:#c7d5cd;border-color:#46534b}
:root[data-theme="dark"] .post-source-details .image-availability{background:#26342b;color:#c7d5cd}

/* Mobile video thumbnails match the three-column photo library; desktop cards stay unchanged. */
@media(max-width:760px){
 body[data-archive-view="videos"] .video-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:0}
 body[data-archive-view="videos"] .video-card{position:relative;aspect-ratio:3/4;border:0;border-radius:12px;align-self:start}
 body[data-archive-view="videos"] .video-cover{height:100%;aspect-ratio:auto}
 body[data-archive-view="videos"] .video-cover>img{object-position:center 25%}
 body[data-archive-view="videos"] .video-storage{display:none}
 body[data-archive-view="videos"] .video-caption{position:absolute;inset:auto 0 0;padding:24px 8px 28px;background:linear-gradient(transparent,#17271988);color:#fff;pointer-events:none}
 body[data-archive-view="videos"] .video-caption h3{font-size:12px;line-height:1.45;margin:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-shadow:0 1px 4px #0005}
 body[data-archive-view="videos"] .video-caption h3 button{color:inherit;font:inherit;pointer-events:auto}
 body[data-archive-view="videos"] .video-caption p,body[data-archive-view="videos"] .video-caption>div>a{display:none}
 body[data-archive-view="videos"] .video-caption>div>button{position:absolute;right:4px;bottom:5px;width:28px;height:28px;display:grid;place-items:center;padding:0;color:#fff;filter:drop-shadow(0 1px 2px #0005);pointer-events:auto}
 body[data-archive-view="videos"] .video-caption>div>button .icon{width:16px;height:16px}
 body[data-archive-view="videos"] .video-caption>div>button.saved .icon{fill:#fff;stroke:#fff}
 body[data-archive-view="videos"] .video-card .play-overlay .icon{width:36px;height:36px;padding:9px}
 body[data-archive-view="videos"] .video-cover>.reference-cover{top:6px;left:6px;font-size:8px;padding:3px 4px;max-width:calc(100% - 12px)}
}
@media(max-width:520px){
 body[data-archive-view="videos"] .video-grid{gap:4px;margin-left:-2px;margin-right:-2px}
 body[data-archive-view="videos"] .video-caption h3{-webkit-line-clamp:1}
 body[data-archive-view="videos"] .video-caption>div>button .icon{width:12px;height:12px}
}
