/*
Theme Name:   Blocksy Child — Photography
Template:     blocksy
Description:  Quiet-gallery child theme for a photography portfolio. Colours and fonts live in theme.json; this file only polishes typography, spacing and gallery behaviour.
Version:      1.0.0
Requires at least: 6.6
Text Domain:  blocksy-child
*/

/* ---------- 1. Tokens ---------- */
/* Colours come from Blocksy's Global Color Palette (Customizer → Colors), which
   provision.sh fills with the site palette: 1 accent, 2 link hover, 3 text,
   4 headings, 5 hairlines, 6 alternate background, 7 site background,
   8 header/footer/menu background.
   Change a colour there and the whole site, including these rules, follows. */
:root {
	--ph-bg:      var(--theme-palette-color-7, #F7F4F0);
	--ph-bg-alt:  var(--theme-palette-color-6, #EFEAE3);
	--ph-text:    var(--theme-palette-color-3, #1E1E1E);
	--ph-accent:  var(--theme-palette-color-1, #8A7B6C);
	--ph-line:    var(--theme-palette-color-5, #DDD5CB);
	--ph-serif:   var(--wp--preset--font-family--cormorant, "Cormorant Garamond", Georgia, serif);
	--ph-sans:    var(--wp--preset--font-family--jost, "Jost", system-ui, sans-serif);
	--ph-gap:     clamp(8px, 1.2vw, 18px);
}
:root:root { /* outranks Blocksy's own :root rules, which are printed after this file */
	--theme-button-border-radius: 0;
	--theme-border-radius: 0;
}

body {
	background-color: var(--ph-bg);
	color: var(--ph-text);
	font-family: var(--ph-sans);
	font-size: clamp(16px, 0.95rem + 0.2vw, 18px);
	font-weight: 300;
	line-height: 1.7;
}

/* ---------- 2. Typography ---------- */
h1, h2, h3, h4, h5, h6,
.wp-block-heading {
	font-family: var(--ph-serif);
	font-weight: 300;
	letter-spacing: 0.04em;
	line-height: 1.15;
	color: var(--ph-text);
}
h1 { font-size: clamp(2.4rem, 1.6rem + 3vw, 4.2rem); }
h2 { font-size: clamp(1.9rem, 1.4rem + 2vw, 3rem); }
h3 { font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.9rem); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--ph-accent); }

/* Small uppercase label above headings: add CSS class "ph-eyebrow" to a paragraph */
.ph-eyebrow {
	font-size: 0.75rem;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: var(--ph-accent);
	margin-bottom: 0.5em;
}

/* Wordmark and menu */
.site-title,
.site-title a {
	font-family: var(--ph-serif);
	font-weight: 400;
	font-size: clamp(1.1rem, 1rem + 0.5vw, 1.5rem);
	letter-spacing: 0.32em;
	text-transform: uppercase;
	color: var(--ph-text);
}
.ct-menu-link,
.ct-header [data-id="menu"] a {
	font-family: var(--ph-sans);
	font-size: 0.78rem;
	font-weight: 400;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}
.ct-header,
.ct-header [data-row] { background-color: var(--ph-bg); box-shadow: none; border: 0; }

/* ---------- 3. Buttons: outline only, square, small caps ---------- */
.wp-block-button__link,
.wp-element-button,
.ct-button,
.ff-btn-submit,
button[type="submit"],
input[type="submit"] {
	background: transparent !important;
	color: var(--ph-text) !important;
	border: 1px solid currentColor !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	font-family: var(--ph-sans);
	font-size: 0.75rem;
	font-weight: 400;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	padding: 1.05em 2.4em;
	transition: background-color 0.3s ease, color 0.3s ease;
}
.wp-block-button__link:hover,
.wp-element-button:hover,
.ct-button:hover,
.ff-btn-submit:hover,
button[type="submit"]:hover,
input[type="submit"]:hover {
	background: var(--ph-text) !important;
	color: var(--ph-bg) !important;
}

/* ---------- 4. Images: no borders, shadows or rounded corners ---------- */
img,
.wp-block-image img { border-radius: 0; box-shadow: none; }

/* Full-bleed hero: image block with CSS class "ph-hero" */
.wp-block-image.ph-hero { margin-top: 0; margin-bottom: 0; }
.wp-block-image.ph-hero img {
	width: 100%;
	height: min(88vh, 62vw);
	min-height: 420px;
	object-fit: cover;
}
@media (max-width: 689px) {
	.wp-block-image.ph-hero img { height: 72svh; min-height: 0; }
}
/* Pull a hero that opens the page right up under the header */
.entry-content > .wp-block-image.ph-hero:first-child {
	margin-top: calc(var(--theme-content-vertical-spacing, 0px) * -1);
}

/* Pages carry their own headings, so Blocksy's automatic page title is hidden */
body.page .hero-section[data-type="type-1"] { display: none; }

/* Soft alternating section background: group block with CSS class "ph-section" */
.ph-section { padding-block: clamp(3rem, 2rem + 5vw, 7rem); }

/* Portfolio index cards and price packages */
.ph-cats img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.ph-cats .wp-block-heading { margin-top: 1rem; font-size: 1.5rem; }
.ph-cats .wp-block-heading a { text-decoration: none; }
.ph-price {
	font-family: var(--ph-serif);
	font-size: 1.6rem;
	color: var(--ph-accent);
	margin-block: 0.25rem 1.25rem;
}
.ph-packages .wp-block-column { border: 1px solid var(--ph-line); padding: 2rem 1.75rem; }
.ph-packages .wp-block-list { padding-left: 1.1em; }

/* ---------- 5. Galleries ---------- */
/* Masonry style (Gallery block → Styles → Masonry) */
.wp-block-gallery.has-nested-images.is-style-masonry {
	display: block;
	column-count: 3;
	column-gap: var(--ph-gap);
}
.wp-block-gallery.has-nested-images.is-style-masonry figure.wp-block-image:not(#individual-image) {
	display: block;
	width: 100%;
	margin: 0 0 var(--ph-gap);
	break-inside: avoid;
}
.wp-block-gallery.has-nested-images.is-style-masonry figure.wp-block-image img {
	width: 100%;
	height: auto;
	object-fit: initial;
}
.wp-block-gallery.is-style-masonry.columns-2 { column-count: 2; }
.wp-block-gallery.is-style-masonry.columns-4 { column-count: 4; }
@media (max-width: 999px) {
	.wp-block-gallery.has-nested-images.is-style-masonry { column-count: 2; }
}
@media (max-width: 599px) {
	.wp-block-gallery.has-nested-images.is-style-masonry { column-count: 1; }
	/* images edge to edge on phones */
	.wp-block-gallery.is-style-masonry.alignfull { padding-inline: 0; }
}
.wp-block-gallery figcaption { display: none; }

/* Lightbox: warm off-white backdrop instead of the default */
.wp-lightbox-overlay .scrim { background-color: var(--ph-bg) !important; }

/* ---------- 6. Motion: slow hover zoom + fade in on scroll ---------- */
.wp-block-gallery .wp-block-image,
.ph-zoom { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
	.wp-block-gallery .wp-block-image img,
	.ph-zoom img { transition: transform 1.4s cubic-bezier(0.2, 0.6, 0.2, 1); }
	.wp-block-gallery .wp-block-image:hover img,
	.ph-zoom:hover img { transform: scale(1.035); }

	/* Pure CSS, no script: browsers without scroll timelines simply show everything */
	@supports (animation-timeline: view()) {
		.entry-content > :not(.ph-hero):not(.ph-links):not(.wp-block-gallery),
		.wp-block-gallery .wp-block-image {
			animation: ph-fade-in linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 35%;
		}
	}
}
@keyframes ph-fade-in {
	from { opacity: 0; transform: translateY(28px); }
	to   { opacity: 1; transform: none; }
}

/* ---------- 7. Quotes (Reviews page) ---------- */
.wp-block-quote {
	border: 0;
	padding: 0;
	margin-block: 3rem;
	text-align: center;
}
.wp-block-quote p {
	font-family: var(--ph-serif);
	font-style: italic;
	font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.8rem);
	line-height: 1.45;
}
.wp-block-quote cite {
	font-style: normal;
	font-size: 0.75rem;
	letter-spacing: 0.25em;
	text-transform: uppercase;
	color: var(--ph-accent);
}

.wp-block-separator { border: 0; border-top: 1px solid var(--ph-line); opacity: 1; }

/* ---------- 8. Link-in-bio page (group with CSS class "ph-links") ---------- */
body:has(.ph-links) .ct-header,
body:has(.ph-links) .ct-footer,
body:has(.ph-links) .ct-drawer-canvas { display: none; }
body:has(.ph-links) [data-vertical-spacing] { padding-block: 0; }
.ph-links {
	min-height: 100svh;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 2rem 1.25rem 3rem;
	color: #fff;
	text-align: center;
	position: relative;
}
.ph-links::before { /* darken the bottom of the portrait so text stays readable */
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to bottom, rgba(30, 30, 30, 0) 35%, rgba(30, 30, 30, 0.65));
	pointer-events: none;
}
.ph-links::before { z-index: 1; }
.ph-links > * { position: relative; z-index: 2; width: 100%; max-width: 420px; margin-inline: auto; }
.ph-links > .wp-block-image.ph-links-bg { /* the portrait behind everything; "Replace" it in the editor */
	position: absolute;
	inset: 0;
	z-index: 0;
	max-width: none;
	margin: 0;
}
.ph-links > .ph-links-bg img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.ph-links h1,
.ph-links p { color: #fff; }
.ph-links .wp-block-buttons { flex-direction: column; align-items: stretch; gap: 0.75rem; }
.ph-links .wp-block-button { width: 100%; }
.ph-links .wp-block-button__link {
	display: block;
	width: 100%;
	color: #fff !important;
	border-color: rgba(255, 255, 255, 0.85) !important;
	backdrop-filter: blur(4px);
}
.ph-links .wp-block-button__link:hover { background: #fff !important; color: var(--ph-text) !important; }

/* ---------- 9. Footer ---------- */
.ct-footer { background-color: var(--ph-bg); font-size: 0.8rem; letter-spacing: 0.08em; }
