/*
Theme Name: James Roberts Quiet
Theme URI: https://jamesroberts.art/
Author: OpenAI with James Roberts
Description: A quiet native WordPress block theme for an interdisciplinary practice across image, place, film and writing.
Version: 1.5.0
Requires at least: 6.9
Text Domain: james-roberts-quiet
*/

/* --------------------------------------------------------------------------
   Single writing / post layout
   -------------------------------------------------------------------------- */

.single-post .quiet-single {
	box-sizing: border-box;
}

.single-post .quiet-post-header {
	text-align: center;
}

.single-post .quiet-post-kicker {
	margin: 0 0 18px;
	font-family: var(--wp--preset--font-family--quiet-sans);
	font-size: 10px;
	font-weight: 500;
	letter-spacing: 0.18em;
	line-height: 1.2;
}

.single-post .quiet-post-title {
	max-width: 860px;
	margin: 0 auto;
	font-family: var(--wp--preset--font-family--quiet-serif);
	font-size: clamp(38px, 4.6vw, 64px);
	font-weight: 400;
	letter-spacing: -0.015em;
	line-height: 1.05;
}

.single-post .quiet-post-deck {
	max-width: 720px;
	margin: 19px auto 0;
	font-family: var(--wp--preset--font-family--quiet-serif);
	font-size: clamp(18px, 2vw, 22px);
	font-style: italic;
	line-height: 1.45;
	color: var(--wp--preset--color--muted);
}

.single-post .quiet-post-deck .wp-block-post-excerpt__excerpt {
	margin: 0;
}

.single-post .quiet-post-date {
	margin-top: 22px;
	font-family: var(--wp--preset--font-family--quiet-sans);
	font-size: 10px;
	font-weight: 500;
	letter-spacing: 0.15em;
	line-height: 1.2;
	text-transform: uppercase;
}

.single-post .quiet-post-featured {
	max-width: 1060px;
	margin-right: auto !important;
	margin-left: auto !important;
}

.single-post .quiet-post-featured img {
	display: block;
	width: 100%;
	height: auto;
}

.single-post .quiet-reading-wrap,
.single-post .quiet-post-content,
.single-post .quiet-post-content p,
.single-post .quiet-post-content li,
.single-post .quiet-post-content strong,
.single-post .quiet-post-content em,
.single-post .quiet-post-content blockquote {
	font-family: var(--wp--preset--font-family--quiet-serif) !important;
}

.single-post .quiet-reading-wrap,
.single-post .quiet-post-content {
	font-size: 18px;
	line-height: 1.72;
}

.single-post .quiet-post-content > p,
.single-post .quiet-post-content > ul,
.single-post .quiet-post-content > ol,
.single-post .quiet-post-content > blockquote,
.single-post .quiet-post-content > h2,
.single-post .quiet-post-content > h3,
.single-post .quiet-post-content > h4 {
	max-width: 700px;
	margin-right: auto;
	margin-left: auto;
}

.single-post .quiet-post-content p {
	margin-top: 0;
	margin-bottom: 1.45em;
}

.single-post .quiet-post-content h2 {
	margin-top: 2.6em;
	margin-bottom: 0.7em;
	font-size: clamp(27px, 3vw, 36px);
	line-height: 1.18;
}

.single-post .quiet-post-content h3 {
	margin-top: 2.3em;
	margin-bottom: 0.65em;
	font-size: 24px;
	line-height: 1.25;
}

.single-post .quiet-post-content blockquote,
.single-post .quiet-post-content .wp-block-quote {
	box-sizing: border-box;
	margin-top: 2.1em;
	margin-bottom: 2.1em;
	padding: 0 0 0 26px;
	border-left: 1px solid var(--wp--preset--color--line);
	font-size: 20px;
	font-style: italic;
	line-height: 1.55;
	color: #5f5b54;
}

.single-post .quiet-post-content blockquote p:last-child {
	margin-bottom: 0;
}

.single-post .quiet-post-content figure,
.single-post .quiet-post-content .wp-block-image,
.single-post .quiet-post-content .wp-block-gallery,
.single-post .quiet-post-content .wp-block-video,
.single-post .quiet-post-content .wp-block-embed {
	box-sizing: border-box;
	width: 100% !important;
	max-width: 700px !important;
	margin: 2.8em auto !important;
	transform: none !important;
	float: none !important;
}

/* Imported Substack images often arrive marked alignwide. For articles we
   deliberately neutralise that: only the featured image above the article
   is wide. Inline images belong to the reading column. */
.single-post .quiet-post-content .alignwide,
.single-post .quiet-post-content .alignfull {
	width: 100% !important;
	max-width: 700px !important;
	margin-right: auto !important;
	margin-left: auto !important;
	transform: none !important;
}

.single-post .quiet-post-content img {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	margin-right: auto;
	margin-left: auto;
}

.single-post .quiet-post-content figcaption,
.single-post .quiet-post-content .wp-element-caption {
	margin-top: 9px;
	font-family: var(--wp--preset--font-family--quiet-sans);
	font-size: 11px;
	line-height: 1.45;
	color: var(--wp--preset--color--muted);
}

.single-post .quiet-post-content a {
	text-decoration-line: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.16em;
	text-decoration-color: #9a968e;
}

.single-post .quiet-post-content hr {
	width: 80px;
	margin: 4em auto;
	border: 0;
	border-top: 1px solid var(--wp--preset--color--line);
}

.single-post .quiet-post-navigation {
	font-family: var(--wp--preset--font-family--quiet-serif);
	font-size: 15px;
}

.single-post .quiet-post-navigation .wp-block-post-navigation-link {
	max-width: 42%;
}

.single-post .quiet-post-navigation a {
	line-height: 1.35;
}

@media (max-width: 720px) {
	.single-post .quiet-single {
		padding-top: 52px !important;
		padding-right: 20px !important;
		padding-left: 20px !important;
	}

	.single-post .quiet-post-title {
		font-size: clamp(36px, 11vw, 48px);
		line-height: 1.08;
	}

	.single-post .quiet-post-deck {
		font-size: 18px;
	}

	.single-post .quiet-post-featured {
		margin-top: 34px !important;
	}

	.single-post .quiet-reading-wrap {
		margin-top: 34px !important;
	}

	.single-post .quiet-reading-wrap,
	.single-post .quiet-post-content {
		font-size: 17px;
		line-height: 1.68;
	}

	.single-post .quiet-post-content blockquote,
	.single-post .quiet-post-content .wp-block-quote {
		padding-left: 18px;
		font-size: 18px;
	}

	.single-post .quiet-post-navigation {
		align-items: flex-start;
		gap: 28px;
	}

	.single-post .quiet-post-navigation .wp-block-post-navigation-link {
		max-width: 48%;
	}
}


/* --------------------------------------------------------------------------
   Editable native pages
   -------------------------------------------------------------------------- */

.quiet-home-page .wp-block-image img,
.page .wp-block-post-content .wp-block-image img {
	display: block;
	max-width: 100%;
	height: auto;
}

.page .wp-block-post-content p.has-body-font-size,
.page .wp-block-post-content p.has-lead-font-size {
	font-family: var(--wp--preset--font-family--quiet-serif);
}

@media (max-width: 720px) {
	.quiet-home-page {
		padding-top: 38px !important;
		padding-right: 20px !important;
		padding-left: 20px !important;
	}

	.quiet-home-page .wp-block-group[style*="margin-left:50%"],
	.quiet-home-page .wp-block-group[style*="margin-left:52%"] {
		margin-left: 0 !important;
	}
}


/* Remove the faint legacy frame from image-holder Groups on editable pages.
   These Groups were used as visual placeholders in the first Quiet Home layout;
   once a real image is inserted, the frame should disappear. */
.quiet-home-page .wp-block-group.has-border-color:has(.wp-block-image),
.page .wp-block-post-content .wp-block-group.has-border-color:has(.wp-block-image) {
	border: 0 !important;
	border-width: 0 !important;
}


/* --------------------------------------------------------------------------
   Quiet Carousel
   A deliberately restrained carousel for project/research sections.
   -------------------------------------------------------------------------- */

.quiet-carousel {
	position: relative;
	width: 100%;
	margin: 0;
}

.quiet-carousel__stage {
	position: relative;
	width: 100%;
	height: min(62vw, 650px);
	min-height: 420px;
	overflow: hidden;
	background: transparent;
}

.quiet-carousel__slide {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 260ms ease;
}

.quiet-carousel__slide.is-active {
	opacity: 1;
	visibility: visible;
}

.quiet-carousel__slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
}

.quiet-carousel__controls {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 14px;
	margin-top: 12px;
	font-family: var(--wp--preset--font-family--quiet-sans);
	font-size: 10px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

.quiet-carousel__button {
	appearance: none;
	border: 0;
	background: transparent;
	padding: 4px 2px;
	font: inherit;
	font-size: 18px;
	line-height: 1;
	color: currentColor;
	cursor: pointer;
}

.quiet-carousel__button:hover,
.quiet-carousel__button:focus-visible {
	color: var(--wp--preset--color--foreground);
}

.quiet-carousel__button:focus-visible {
	outline: 1px solid currentColor;
	outline-offset: 4px;
}

.quiet-carousel__counter {
	min-width: 42px;
	text-align: center;
}

/* Editor preview: simple, calm selection surface rather than a faux slideshow. */
.editor-styles-wrapper .quiet-carousel-editor {
	box-sizing: border-box;
	padding: 18px;
	border: 1px solid #d8d4ca;
}

.editor-styles-wrapper .quiet-carousel-editor__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 10px;
	margin-bottom: 16px;
}

.editor-styles-wrapper .quiet-carousel-editor__thumb {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #ebe8df;
}

.editor-styles-wrapper .quiet-carousel-editor__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

@media (max-width: 720px) {
	.quiet-carousel__stage {
		height: 68vw;
		min-height: 240px;
		max-height: 420px;
	}

	/* Keep the visible image anchored to the top on phones. With mixed
	   portrait/landscape media, object-fit: contain otherwise centres a
	   landscape image inside the fixed carousel stage and creates what looks
	   like a large empty margin above it. */
	.quiet-carousel__slide img {
		object-position: center top;
	}

	.quiet-carousel__controls {
		margin-top: 9px;
	}

	.editor-styles-wrapper .quiet-carousel-editor__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* v1.2 — tighten the large desktop section gap on phones. The Home layout
   uses 170px bottom margins between major sections; on a narrow screen that
   creates too much empty vertical space before media such as the research
   carousel. Keep the desktop rhythm, but roughly halve it on mobile. */
@media (max-width: 720px) {
	.quiet-home-page .wp-block-columns[style*="margin-bottom:170px"] {
		margin-bottom: 82px !important;
	}
}


/* v1.3 — mobile research-to-carousel spacing. Previous builds kept the same
   stylesheet version, so browsers could continue serving cached CSS. This
   targets the research row immediately before a Quiet Carousel and gives it
   a deliberately smaller mobile gap. */
@media (max-width: 720px) {
    .quiet-home-page .wp-block-columns:has(+ .quiet-carousel) {
        margin-bottom: 68px !important;
    }
}


/* --------------------------------------------------------------------------
   Responsive large page statements
   Large editorial statement/quote blocks can be set generously on desktop,
   but should not overwhelm small screens.
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
	.page .wp-block-post-content > .wp-block-quote p,
	.page .wp-block-post-content > blockquote p {
		font-size: clamp(28px, 8vw, 32px) !important;
		line-height: 1.18 !important;
	}
}


/* --------------------------------------------------------------------------
   v1.5 — Quiet global typography
   These are the editorial defaults for ordinary blocks. Existing Home blocks
   keep their explicit sizes/layout; utility labels remain sans-serif.
   -------------------------------------------------------------------------- */

/* Small labels, metadata and footer text remain Quiet Sans even though ordinary
   paragraphs now default to the editorial serif face. */
.has-xs-font-size,
.has-sm-font-size,
.wp-block-post-date,
.wp-block-post-terms,
figcaption,
.wp-element-caption {
	font-family: var(--wp--preset--font-family--quiet-sans) !important;
}

/* Consistent heading rhythm on editable pages. Explicit Home font-size classes
   still win, so this does not redesign the finished homepage. */
.page .wp-block-post-content h1:not(.has-text-align-center),
.page .wp-block-post-content h2,
.page .wp-block-post-content h3,
.page .wp-block-post-content h4 {
	font-weight: 400;
	letter-spacing: -0.012em;
}

.page .wp-block-post-content h2 {
	margin-top: 2.2em;
	margin-bottom: 0.65em;
}

.page .wp-block-post-content h3 {
	margin-top: 2em;
	margin-bottom: 0.6em;
}

/* Lists should read like body copy, not UI. */
.page .wp-block-post-content ul,
.page .wp-block-post-content ol {
	padding-left: 1.2em;
}

.page .wp-block-post-content li {
	margin-bottom: 0.35em;
}

/* Reusable paragraph style: select Styles → Quiet Lead when a page needs an
   oversized opening statement. No manual font, line-height or mobile sizing. */
.wp-block-paragraph.is-style-quiet-lead {
	font-family: var(--wp--preset--font-family--quiet-serif) !important;
	font-size: clamp(36px, 4vw, 44px) !important;
	font-weight: 400;
	line-height: 1.16 !important;
	letter-spacing: -0.018em;
	margin-bottom: 0.7em;
}

/* Also tame existing manually-sized 44px introductory paragraphs on phones,
   so the About page already being built does not need to be recreated. */
@media (max-width: 720px) {
	.wp-block-paragraph.is-style-quiet-lead,
	.page:not(.home) .wp-block-post-content p[style*="font-size:44px"],
	.page:not(.home) .wp-block-post-content p.has-custom-font-size[style*="44px"] {
		font-size: 29px !important;
		line-height: 1.2 !important;
	}

	.page:not(.home) .wp-block-post-content h1 {
		font-size: 36px !important;
	}

	.page:not(.home) .wp-block-post-content h2 {
		font-size: 30px !important;
	}

	.page:not(.home) .wp-block-post-content h3 {
		font-size: 25px !important;
	}

	.page:not(.home) .wp-block-post-content p,
	.page:not(.home) .wp-block-post-content li {
		font-size: 17px;
		line-height: 1.62;
	}
}
