/*
Theme Name: Charlotta Westergren
Theme URI: https://charlottawestergren.com/
Author: Charlotta Westergren
Description: Portfolio theme for charlottawestergren.com. The front page shows three square sections (Selected Works, All Paintings, Installation/Photo/Video); each section is a grid of square thumbnails on desktop and full, uncropped works on phones, ending with links to the other sections. Section images and text are editable under Appearance → Customize → Front Page Sections. Tick "Selected" on a work (in the editor or in Posts → All Posts) to show it in Selected Works, or "Hide" to keep it off the site. Each work's Square crop panel sets how its thumbnail is cropped. Posts → Order sets the order of each section by drag and drop.
Version: 1.8
Requires at least: 6.0
Requires PHP: 7.4
License: GPLv2 or later
Text Domain: charlotta
*/

:root {
	--ink: #1d1c1a;
	--muted: #6f6b66;
	--rule: #e4e0da;
	--paper: #ffffff;
	--serif: "Cormorant Garamond", "Times New Roman", Georgia, serif;
	--sans: "Lato", "Helvetica Neue", Arial, sans-serif;
	--display: "Jost", "Futura", "Helvetica Neue", Arial, sans-serif;
	--gutter: clamp(16px, 4vw, 60px);
	--measure: 900px;
	--wide: 1320px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--sans);
	font-weight: 300;
	font-size: 16px;
	line-height: 1.6;
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

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

/* ---------- Header: name left, menu right ---------- */

.site-header {
	max-width: calc(var(--wide) + 2 * var(--gutter));
	margin: 0 auto;
	padding: 34px var(--gutter) 30px;
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px 40px;
	flex-wrap: wrap;
}

.site-title {
	margin: 0;
	font-family: var(--display);
	font-weight: 300;
	font-size: clamp(24px, 2.6vw, 32px);
	letter-spacing: 0.05em;
	line-height: 1.15;
}

.site-title a:hover { text-decoration: none; }

.site-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 6px 26px;
}

.site-nav a {
	font-family: var(--display);
	font-weight: 400;
	font-size: 12px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--muted);
}

.site-nav .current-menu-item > a,
.site-nav .current-menu-parent > a,
.site-nav .current_page_item > a,
.site-nav .current_page_parent > a,
.site-nav a:hover { color: var(--ink); }

/* ---------- Main ---------- */

.site-main {
	padding: 8px var(--gutter) 64px;
}

.page-heading {
	max-width: var(--wide);
	margin: 0 auto 28px;
	font-family: var(--serif);
	font-weight: 400;
	font-size: 30px;
	line-height: 1.2;
}

/* ---------- Front page sections ---------- */

.front-sections {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: clamp(20px, 3vw, 44px);
	max-width: var(--wide);
	margin: 12px auto 0;
}

.front-section a { display: block; }
.front-section a:hover { text-decoration: none; }

.front-section .square {
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #f3f1ee;
}

.front-section .square img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .6s ease;
}

.front-section a:hover .square img { transform: scale(1.025); }

.front-section h2 {
	font-family: var(--serif);
	font-weight: 400;
	font-size: 26px;
	margin: 16px 0 4px;
	line-height: 1.2;
}

.front-section a:hover h2 { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

.front-section .blurb {
	margin: 0;
	color: var(--muted);
	font-size: 15px;
	max-width: 34em;
}

/* Phones only: CV / Email / Instagram at the foot of the front page, and
   links to the other sections at the end of each section. */
.home-links,
.section-links { display: none; }

.home-links ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px 30px;
}

.home-links a {
	font-family: var(--display);
	font-size: 13px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

/* Each other section as its square image with the name in a white, black-edged box over it. */
.section-links ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 14px;
}

.section-links a {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #f3f1ee;
}

.section-links a:hover { text-decoration: none; }

.section-links img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.section-links .label {
	position: absolute;
	top: 50%;
	left: 12px;
	right: 12px;
	width: fit-content;
	margin: 0 auto;
	transform: translateY(-50%);
	padding: 7px 10px 6px;
	background: var(--paper);
	border: 1px solid var(--ink);
	font-family: var(--display);
	font-size: 11px;
	line-height: 1.35;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-align: center;
	color: var(--ink);
}

/* ---------- Grids (Selected Works, categories, tags) ---------- */

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: clamp(20px, 2.5vw, 36px);
	max-width: var(--wide);
	margin: 0 auto;
}

.grid-item a { display: block; }
.grid-item a:hover { text-decoration: none; }

.grid-item .thumb {
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #f3f1ee;
}

.grid-item .thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .5s ease;
}

.grid-item a:hover .thumb img { transform: scale(1.03); }

.grid-item .label {
	margin: 10px 0 0;
	font-size: 14px;
	line-height: 1.4;
}

.grid-item .label .meta { display: block; color: var(--muted); font-size: 13px; }

/* ---------- Single work ---------- */

.single-work {
	max-width: 1100px;
	margin: 0 auto;
}

.single-work .entry-content { max-width: var(--measure); margin: 0 auto; }

.entry-content .wp-block-image { margin: 0 0 14px; text-align: center; }

.entry-content .wp-block-image img {
	display: inline-block;
	margin: 0 auto;
	max-height: 88vh;
	width: auto;
}

.entry-content p {
	margin: 0 0 10px;
	font-size: 15px;
}

.entry-content b, .entry-content strong { font-weight: 700; }

.post-nav {
	max-width: var(--measure);
	margin: 26px auto 0;
	padding-top: 18px;
	border-top: 1px solid var(--rule);
	display: flex;
	justify-content: space-between;
	gap: 20px;
	font-size: 13px;
	letter-spacing: 0.06em;
}

/* ---------- Pages (CV) ---------- */

.page .page-heading { max-width: 760px; }

.page-content {
	max-width: 760px;
	margin: 0 auto;
	font-size: 15px;
}

.page-content h2 {
	font-family: var(--serif);
	font-weight: 400;
	font-size: 24px;
	margin: 36px 0 10px;
}

.page-content a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule); }
.page-content a:hover { text-decoration-color: currentColor; }

.page-content ul.cv { list-style: none; padding: 0; margin: 0; }
.page-content ul.cv li { display: grid; grid-template-columns: 4.2em 1fr; gap: 0 12px; margin: 0 0 6px; }
.page-content ul.cv li .yr { color: var(--muted); }

/* ---------- Pagination & footer ---------- */

.pagination {
	max-width: var(--measure);
	margin: 40px auto 0;
	display: flex;
	justify-content: center;
	gap: 18px;
	font-size: 13px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.pagination .page-numbers.current { color: var(--muted); }

.site-footer {
	padding: 28px var(--gutter) 40px;
	text-align: center;
	font-size: 12px;
	color: var(--muted);
	letter-spacing: 0.06em;
}

/* ---------- Phones ---------- */

@media (max-width: 760px) {
	.site-header { padding-top: 22px; padding-bottom: 18px; }
	.site-nav { display: none; }

	.front-sections { grid-template-columns: 1fr; gap: 36px; }

	.home-links {
		display: block;
		margin: 48px auto 0;
		padding-top: 26px;
		border-top: 1px solid var(--rule);
	}

	.section-links {
		display: block;
		max-width: var(--wide);
		margin: 56px auto 0;
		padding-top: 26px;
		border-top: 1px solid var(--rule);
	}

	.page-heading { font-size: 26px; margin-bottom: 20px; }

	/* Inside a section, show each work whole rather than as a square crop. */
	.grid { grid-template-columns: 1fr; gap: 44px; }
	.grid-item .thumb { aspect-ratio: auto; background: none; }
	.grid-item .thumb img { height: auto; object-fit: initial; }
	.grid-item a:hover .thumb img { transform: none; }
	.grid-item .label { font-size: 15px; }
	.grid-item .label .title { font-weight: 700; }
}
