/*
Theme Name: Stream 1000
Description: A newspaper-style blog theme. Centered masthead with the site title, date line and page links, then a single column of stories with serif headlines, bylines and multi-column text. Every image is shown at 1000px wide (adjustable in Appearance > Customize > Stream look), shrinking only if the screen is narrower.
Version: 1.1.0
Requires at least: 5.8
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: stream100
*/

:root {
	--img: 1000px;
	--col: 1032px;
	--masthead: "EB Garamond", Garamond, "Times New Roman", serif;
	--media: 1000px; /* fixed width for YouTube embeds and the top image of a post */
	--bg: #ebe9e3;
	--ink: #151515;
	--accent: #7a1f1f;
	--muted: #5b5b57;
	--rule: #c9c6bc;
	--display: Didot, "Bodoni 72", "Bodoni MT", "Playfair Display", Georgia, "Times New Roman", serif;
	--text: Georgia, "Times New Roman", Times, serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 17px/1.6 var(--text);
	-webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* ---------- masthead ---------- */
.masthead {
	max-width: calc(var(--col) + 32px);
	margin: 0 auto;
	padding: 16px 16px 0;
	text-align: center;
}
.masthead-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 0;
	border-top: 5px double var(--ink);
	border-bottom: 1px solid var(--ink);
	font-size: 14px;
	font-style: italic;
}
.masthead-date { margin: 0; }
.masthead .search-form { display: flex; margin: 0; }
.masthead .search-field {
	width: 160px;
	padding: 2px 4px;
	border: 0;
	border-bottom: 1px solid var(--ink);
	background: transparent;
	color: var(--ink);
	font: italic 14px var(--text);
}
.masthead .search-field::placeholder { color: var(--muted); }
.masthead .search-submit { display: none; }

.site-title {
	margin: 24px 0 6px;
	font-family: var(--masthead);
	font-weight: 400;
	font-size: clamp(44px, 9vw, 96px);
	line-height: 1.05;
	letter-spacing: -0.01em;
	text-rendering: optimizeLegibility;
}
.site-title a { color: var(--ink); text-decoration: none; }
.masthead .custom-logo { display: block; max-width: 100%; height: auto; margin: 22px auto 6px; }
.site-tagline { margin: 0 0 20px; font-style: italic; color: var(--muted); }

.site-nav {
	padding: 10px 0;
	border-top: 1px solid var(--ink);
	border-bottom: 5px double var(--ink);
}
.site-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px 0;
}
.site-nav li + li { margin-left: 16px; padding-left: 16px; border-left: 1px solid #8d8a80; }
.site-nav a {
	color: var(--ink);
	font-variant: small-caps;
	font-size: 17px;
	letter-spacing: 0.08em;
	text-decoration: none;
}
.site-nav a:hover { color: var(--accent); text-decoration: underline; }
.site-nav .current-menu-item > a,
.site-nav .current_page_item > a,
.site-nav .current-menu-ancestor > a { border-bottom: 2px solid var(--ink); }

/* ---------- stream ---------- */
.stream {
	max-width: calc(var(--col) + 32px);
	margin: 28px auto 40px;
	padding: 0 16px;
}
.stream-heading {
	margin: 0 0 28px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--ink);
	text-align: center;
}
.stream-heading h1 { margin: 0; font: 700 32px/1.15 var(--display); }
.stream-heading p { margin: 6px 0 0; font-style: italic; color: var(--muted); }

.post {
	margin: 0 0 32px;
	padding-bottom: 28px;
	border-bottom: 1px solid var(--ink);
}
.post-header { text-align: center; margin-bottom: 18px; }
.post-date { margin: 0 0 6px; font-size: 14px; font-style: italic; color: var(--muted); }
.post-date a { color: inherit; text-decoration: none; }
.post-date a:hover { text-decoration: underline; }
.post-title {
	margin: 0 0 10px;
	font: 700 clamp(28px, 4.2vw, 44px) / 1.1 var(--display);
	text-wrap: balance;
}
.post-title a { color: var(--ink); text-decoration: none; }
.post-title a:hover { color: var(--accent); }
.post-byline {
	margin: 0;
	padding: 8px 0;
	border-top: 1px solid var(--rule);
	border-bottom: 1px solid var(--rule);
	font-variant: small-caps;
	font-size: 15px;
	letter-spacing: 0.08em;
	color: var(--muted);
}
.post-byline a { color: inherit; text-decoration: none; }
.post-byline a:hover { color: var(--accent); text-decoration: underline; }

/* story text runs in newspaper columns; images and embeds span them */
.post-body {
	column-count: 2;
	column-gap: 36px;
	column-rule: 1px solid var(--rule);
	text-align: left;
	hyphens: manual;
	overflow-wrap: break-word;
}
.post-body p { margin: 0 0 0.9em; orphans: 2; widows: 2; }
.post-body h2, .post-body h3, .post-body h4 { margin: 0.4em 0 0.4em; font-family: var(--display); line-height: 1.2; break-after: avoid; }
.post-body blockquote { margin: 0 0 0.9em; padding-left: 14px; border-left: 3px solid var(--ink); font-style: italic; }
.post-body pre { overflow-x: auto; background: rgba(0, 0, 0, .05); padding: 10px; font-size: 13px; }
.post-body iframe, .post-body video, .post-body embed { max-width: 100%; }

.post-body > .s100-media,
.post-body > .foogallery,
.post-body > :has(.foogallery),
.post-body > .post-thumb,
.post-body > figure,
.post-body > .wp-block-image,
.post-body > .wp-block-gallery,
.post-body > .wp-block-embed,
.post-body > .wp-block-video,
.post-body > .gallery,
.post-body > iframe,
.post-body > video,
.post-body > a:has(> img),
.post-body > p:has(img),
.post-body > p:has(iframe),
.post-body > p:has(video) {
	column-span: all;
}

/* ---------- THE 1000px RULE ----------
   Every image in a post, gallery or featured thumbnail is held to --img,
   and only shrinks if the screen is narrower. !important is deliberate:
   it beats width/height attributes, inline styles and block-editor sizes. */
.post img:not(.fg-image),
.page-card img,
.comments img:not(.avatar) {
	width: var(--img) !important;
	max-width: 100% !important;
	height: auto !important;
}
.comments .avatar { width: auto !important; max-width: none !important; }

.post-body img:not(.fg-image) { display: block; margin: 0 auto 10px; }
.s100-media { margin: 0 0 14px; }
.s100-media br { display: none; }
.post-thumb { margin: 0 0 14px; }
.post-thumb img { margin: 0 auto; }
.post-body figure:not(.fg-item-inner), .post-body .wp-block-image { display: block; max-width: 100%; margin: 0 auto 14px; text-align: center; }
.post-body figure:not(.fg-item-inner) img:not(.fg-image) { margin: 0 auto; }
.post-body figcaption:not(.fg-caption) {
	max-width: var(--img);
	margin: 5px auto 0;
	font-size: 13px;
	font-style: italic;
	line-height: 1.35;
	color: var(--muted);
	text-align: left;
}
.post-body .alignleft, .post-body .alignright, .post-body .aligncenter { float: none; margin-left: auto; margin-right: auto; }

.post-body .gallery,
.post-body .wp-block-gallery { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0 0 14px; padding: 0; list-style: none; }
.post-body .gallery .gallery-item,
.post-body .wp-block-gallery .wp-block-image,
.post-body .wp-block-gallery figure { width: auto !important; flex: none !important; margin: 0; }
.post-body .gallery img { margin: 0; }
.post-body .gallery-caption { display: none; }

/* ---------- YouTube embeds: always 1000px wide, 16:9 ----------
   Covers pasted-URL embeds, the Embed block and raw <iframe> code.
   Overrides the width/height attributes and WordPress's own embed
   ratio padding so nothing can squash or stretch the video. */
.post-body iframe[src*="youtube.com"],
.post-body iframe[src*="youtube-nocookie.com"],
.post-body iframe[src*="youtu.be"] {
	display: block;
	position: static !important;
	width: var(--media) !important;
	max-width: 100% !important;
	height: auto !important;
	aspect-ratio: 16 / 9 !important;
	margin: 0 auto 14px !important;
	border: 0;
}
.post-body .wp-block-embed-youtube,
.post-body .wp-block-embed-youtube .wp-block-embed__wrapper {
	width: 100%;
	max-width: 100%;
	margin: 0 auto 14px;
}
.post-body .wp-block-embed.wp-has-aspect-ratio .wp-block-embed__wrapper::before {
	content: none !important;
	display: none !important;
	padding: 0 !important;
}

/* ---------- Top image: always 1000px wide ----------
   The featured image, or whatever image opens the post body. */
.post .post-thumb img,
.post .post-body > :first-child img:not(.fg-image) {
	width: var(--media) !important;
	max-width: 100% !important;
	height: auto !important;
	margin-left: auto;
	margin-right: auto;
}
.post-body a:has(> img) { display: block; }

/* ---------- FooGallery: always 1000px across ----------
   Any FooGallery (shortcode or block) is held to the media width and
   centered; the gallery lays out its own items inside that width.
   Tip: set the gallery's thumbnail width to 1000+ in FooGallery so the
   images are sharp. */
.post-body .foogallery,
.post-body .foogallery-container {
	width: var(--media) !important;
	max-width: 100% !important;
	margin-left: auto !important;
	margin-right: auto !important;
	margin-bottom: 14px;
	text-align: left;
	hyphens: none;
}
.post-body .fg-image-viewer .fg-item,
.post-body .fg-image-viewer .fg-item-inner {
	width: 100% !important;
	max-width: 100% !important;
}
.post-body .fg-image-viewer .fg-image {
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
}

/* ---------- post formats ---------- */
.format-quote .post-body blockquote { margin: 0 0 0.9em; padding: 0; border: 0; font: italic 24px/1.35 var(--display); }
.format-quote .post-body cite { display: block; margin-top: 8px; font-size: 15px; font-style: normal; color: var(--muted); }
.format-aside .post-body, .format-status .post-body { font-size: 20px; }

/* ---------- story footer ---------- */
.post-foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px 22px;
	margin-top: 14px;
	font-size: 14px;
	font-style: italic;
	color: var(--muted);
}
.post-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.post-tags a, .post-foot a { color: var(--muted); }
.post-tags a:hover, .post-foot a:hover { color: var(--accent); }

/* ---------- pager ---------- */
.pager { display: flex; justify-content: space-between; gap: 12px; padding-top: 4px; font-size: 18px; }
.pager a { color: var(--ink); font-variant: small-caps; letter-spacing: 0.08em; }
.pager a:hover { color: var(--accent); }

/* ---------- pages, comments, 404 ---------- */
.page-card { margin: 0 auto 28px; padding-bottom: 24px; border-bottom: 1px solid var(--ink); }
.page-card h1 { margin: 0 0 14px; text-align: center; font: 700 clamp(28px, 4.2vw, 44px) / 1.1 var(--display); }
.page-card img { display: block; margin: 0 auto 10px; }

.comments { margin: 0 auto 28px; padding-top: 14px; border-top: 5px double var(--ink); }
.comments h2, .comments .comment-reply-title { margin: 0 0 12px; font: 700 22px/1.2 var(--display); }
.comment-list { list-style: none; margin: 0 0 18px; padding: 0; }
.comment-list .children { list-style: none; padding-left: 22px; }
.comment-body { padding: 12px 0; border-top: 1px solid var(--rule); font-size: 15px; }
.comment-author .avatar { vertical-align: middle; margin-right: 8px; }
.comment-metadata { font-size: 13px; font-style: italic; }
.comments input[type="text"], .comments input[type="email"], .comments input[type="url"], .comments textarea {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--ink);
	border-radius: 0;
	background: transparent;
	font: inherit;
}
.comments .submit {
	padding: 8px 20px;
	border: 1px solid var(--ink);
	border-radius: 0;
	background: var(--ink);
	color: var(--bg);
	font: inherit;
	cursor: pointer;
}
.comments .submit:hover { background: var(--accent); border-color: var(--accent); }
.post-navigation { margin: 0 auto 28px; }
.post-navigation .nav-links { display: flex; justify-content: space-between; gap: 16px; }
.post-navigation a { color: var(--ink); font-style: italic; }

/* ---------- site footer ---------- */
.site-footer {
	max-width: calc(var(--col) + 32px);
	margin: 0 auto;
	padding: 0 16px 36px;
	text-align: center;
	font-size: 14px;
	font-style: italic;
	color: var(--muted);
}
.site-footer p { margin: 0; padding-top: 12px; border-top: 5px double var(--ink); }
.site-footer a { color: var(--muted); }

.screen-reader-text {
	position: absolute !important;
	clip: rect(1px, 1px, 1px, 1px);
	width: 1px; height: 1px; overflow: hidden;
}

/* ---------- small screens ---------- */
@media (max-width: 760px) {
	.post-body { column-gap: 20px; }
	.masthead-top { flex-direction: column; gap: 6px; }
	.site-nav li + li { margin-left: 0; padding-left: 0; border-left: 0; }
	.site-nav li { margin: 0 9px; }
}
