/*
Theme Name: EB
Theme URI: https://evertonbarreiro.com
Author: EB
Description: Custom block (Full Site Editing) theme for evertonbarreiro.com — arts consultancy & cultural production.
Version: 0.1.0
Requires at least: 6.5
Tested up to: 6.7
Requires PHP: 8.1
License: GPL-2.0-or-later
Text Domain: eb
*/

/* ---------------------------------------------------------------------------
   Component styles. Global tokens (color, type, spacing) live in theme.json;
   this file holds the things blocks can't express on their own (the hero
   slideshow, the overlay header, footer treatment).
--------------------------------------------------------------------------- */

/* --- Header ------------------------------------------------------------- */
.eb-header {
	align-items: center;
	/* Equal padding all round so the logo sits ~20px from both top and left. */
	padding: clamp(1rem, 2vw, 1.25rem);
}
.eb-header .wp-block-site-logo img {
	width: 40px;
	height: auto;
}
.eb-nav a,
.eb-nav .wp-block-navigation-item__content {
	text-transform: lowercase;
	letter-spacing: 0.25em;
	font-size: 0.8rem;
	font-weight: 400;
	font-family: var(--wp--preset--font-family--body);
}

/* --- Language switcher -------------------------------------------------- */
.eb-lang-switcher {
	display: flex;
	align-items: center;
	gap: 0.4em;
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.8rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}
.eb-lang-switcher .eb-lang {
	color: inherit;
	text-decoration: none;
	opacity: 0.55;
	transition: opacity 0.2s ease;
}
.eb-lang-switcher .eb-lang.is-current,
.eb-lang-switcher a.eb-lang:hover {
	opacity: 1;
}
.eb-lang-switcher .eb-lang-sep {
	opacity: 0.35;
}

/* On the front page (and article/project "featured" pages) the header floats
   over the full-bleed hero in white. */
.home .eb-header,
.eb-featured .eb-header {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 10;
	background: transparent;
}
.home .eb-header a,
.home .eb-header .wp-block-navigation-item__content,
.home .eb-header .eb-lang-switcher,
.eb-featured .eb-header a,
.eb-featured .eb-header .wp-block-navigation-item__content,
.eb-featured .eb-header .eb-lang-switcher {
	color: #fff;
}
/* White hamburger icon over the hero. */
.home .eb-header .wp-block-navigation__responsive-container-open,
.eb-featured .eb-header .wp-block-navigation__responsive-container-open {
	color: #fff;
}

/* The overlay header is out of flow, so the block-gap margin lands on <main>
   and pushes the hero down. Remove it so the hero sits flush against the top. */
.home main,
.eb-featured main {
	margin-top: 0;
}

/* Inner pages get a solid dark header bar with white logo/nav (the home and
   featured pages override this above with their transparent overlay). */
body:not(.home):not(.eb-featured) .eb-header {
	background: var(--wp--preset--color--contrast);
}
body:not(.home):not(.eb-featured) .eb-header a,
body:not(.home):not(.eb-featured) .eb-header .wp-block-navigation-item__content,
body:not(.home):not(.eb-featured) .eb-header .eb-lang-switcher,
body:not(.home):not(.eb-featured) .eb-header .wp-block-navigation__responsive-container-open {
	color: #fff;
}
/* Dim the current page's nav item, like the original. */
.eb-nav [aria-current] {
	opacity: 0.5;
}

/* --- Inner page shell --------------------------------------------------- */
.eb-page {
	padding-top: clamp(2.5rem, 5vw, 4.5rem);
	padding-bottom: clamp(3rem, 8vw, 6rem);
	/* Side gutters so content never touches the screen edge on mobile. */
	padding-left: clamp(1.25rem, 4vw, 2rem);
	padding-right: clamp(1.25rem, 4vw, 2rem);
}
.eb-page-title {
	text-align: center;
	text-transform: lowercase;
	font-family: var(--wp--preset--font-family--display);
	font-weight: 400;
	letter-spacing: 0.08em;
	font-size: clamp(1.6rem, 3vw, 2.2rem);
	margin: 0 0 clamp(3rem, 7vw, 6rem);
}

/* --- Featured (article / project) pages --------------------------------- */
/* The hero (a Cover block in the content) supplies the title, so hide the
   template's page title and let the hero sit flush under the overlay header. */
.eb-featured .eb-page-title {
	display: none;
}
/* No page padding so the hero is full-bleed; the text column gets its own gutters. */
.eb-featured .eb-page {
	padding: 0 0 clamp(3rem, 8vw, 6rem);
}
/* Drop the post-content block-gap so the hero sits flush under the overlay
   header (the hidden page title would otherwise leave its top margin behind). */
.eb-featured .wp-block-post-content {
	margin-top: 0;
}
.eb-featured .eb-article-hero {
	margin-top: 0;
}
.eb-featured .eb-article-meta,
.eb-featured .eb-article-body {
	padding-left: clamp(1.25rem, 4vw, 2rem);
	padding-right: clamp(1.25rem, 4vw, 2rem);
}

.eb-article-hero.wp-block-cover {
	min-height: clamp(60vh, 70vh, 88vh);
	margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}
.eb-article-hero .wp-block-cover__inner-container {
	width: min(90%, 60rem);
}
.eb-hero-eyebrow {
	color: #fff;
	font-family: var(--wp--preset--font-family--body);
	text-transform: lowercase;
	letter-spacing: 0.35em;
	font-size: clamp(1.05rem, 1.6vw, 1.3rem);
	margin: 0 0 1rem;
}
.eb-hero-title {
	color: #fff;
	font-family: var(--wp--preset--font-family--display);
	font-weight: 400;
	letter-spacing: 0.01em;
	line-height: 1.15;
	font-size: clamp(2rem, 5vw, 3.4rem);
	margin: 0;
}

/* Author · date line below the hero. */
.eb-article-meta {
	color: var(--wp--preset--color--muted);
	font-weight: 300;
	font-size: 0.95rem;
	margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

/* Imported article body (HTML from the Squarespace export). */
.eb-article-body {
	font-weight: 300;
	line-height: 1.8;
}
.eb-article-body h1 {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 400;
	font-size: clamp(1.6rem, 3.2vw, 2.3rem);
	line-height: 1.2;
	margin: 0 0 0.5rem;
}
.eb-article-body h2 {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 400;
	font-size: clamp(1.3rem, 2.4vw, 1.7rem);
	margin: clamp(2.5rem, 5vw, 3.5rem) 0 1rem;
}
.eb-article-body p {
	margin: 0 0 1.4rem;
}
.eb-article-body img {
	width: 100%;
	height: auto;
	display: block;
	margin: clamp(1.5rem, 4vw, 2.5rem) auto;
}
.eb-article-body iframe {
	width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
	display: block;
	margin: clamp(1.5rem, 4vw, 2.5rem) 0;
	border: 0;
}
.eb-article-body blockquote {
	border-left: 2px solid var(--wp--preset--color--slate);
	margin: clamp(1.5rem, 4vw, 2.5rem) 0;
	padding-left: clamp(1rem, 3vw, 1.75rem);
	font-style: italic;
	color: var(--wp--preset--color--slate);
}
.eb-article-body blockquote p:last-child {
	margin-bottom: 0;
}
.eb-article-body a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}
/* Image captions (WordPress [caption] shortcode). */
.eb-article-body .wp-caption {
	max-width: 100% !important;
	margin: clamp(1.5rem, 4vw, 2.5rem) auto;
}
.eb-article-body .wp-caption img {
	margin: 0;
}
.eb-article-body .wp-caption-text,
.eb-article-body figcaption {
	color: var(--wp--preset--color--muted);
	font-weight: 300;
	font-size: 0.85rem;
	line-height: 1.5;
	margin-top: 0.6rem;
	text-align: center;
}

/* Footnotes / bibliography lists. */
.eb-article-body .eb-footnotes {
	padding-left: 1.5rem;
	font-size: 0.9rem;
	color: var(--wp--preset--color--slate);
}
.eb-article-body .eb-footnotes li {
	margin-bottom: 0.6rem;
	line-height: 1.6;
}

/* Squarespace wraps text in these; keep them transparent to layout. */
.eb-article-body .sqs-html-content {
	display: contents;
}

/* --- About page --------------------------------------------------------- */
.eb-about-page {
	gap: clamp(2rem, 5vw, 4rem);
}
.eb-about-page .eb-portrait img {
	width: 100%;
	height: auto;
}
.eb-about-page p {
	font-weight: 300;
	line-height: 1.8;
}
.eb-about-page .wp-element-caption {
	color: var(--wp--preset--color--muted);
	font-weight: 300;
	font-size: 0.85rem;
	margin-top: 0.75rem;
}

/* --- Work-history logo grid --------------------------------------------- */
/* Two large columns; each logo sits in an equal cell and is contained. */
.eb-logos {
	display: grid !important;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: clamp(2.5rem, 6vw, 4.5rem) clamp(2rem, 6vw, 5rem);
	margin-top: clamp(1rem, 3vw, 2.5rem);
	align-items: center;
	justify-items: center;
}
.eb-logos .eb-logo {
	margin: 0;
	width: 100%;
	display: flex;
	justify-content: center;
}
/* A lone logo on the final row (odd count) spans both columns and stays centered. */
.eb-logos .eb-logo:last-child:nth-child(odd) {
	grid-column: 1 / -1;
}
.eb-logos .eb-logo img {
	width: 100%;
	max-width: 460px;
	height: clamp(150px, 22vw, 260px);
	object-fit: contain;
}

/* --- Hero slideshow ----------------------------------------------------- */
.eb-hero {
	position: relative;
	/* Fixed-height banner like the original (caps on tall/maximised windows). */
	height: 700px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}
.eb-hero .eb-hero__slide {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	/* Negative delays so the cycle starts mid-stream: slide 1 is already fully
	   visible at load (no blank flash) and exactly one slide shows at all times. */
	animation: ebHeroFade 18s infinite;
}
.eb-hero .eb-hero__slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.eb-hero .eb-hero__slide:nth-of-type(1) { animation-delay: 0s; }
.eb-hero .eb-hero__slide:nth-of-type(2) { animation-delay: -12s; }
.eb-hero .eb-hero__slide:nth-of-type(3) { animation-delay: -6s; }
@keyframes ebHeroFade {
	0%   { opacity: 1; }
	27%  { opacity: 1; }
	33%  { opacity: 0; }
	94%  { opacity: 0; }
	100% { opacity: 1; }
}
/* Subtle wash so the white tagline stays legible over bright artwork. */
.eb-hero::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.18);
	z-index: 1;
}
.eb-hero__tagline {
	position: relative;
	z-index: 2;
}
.eb-tagline {
	color: #fff;
	font-family: var(--wp--preset--font-family--display);
	font-weight: 400;
	text-transform: lowercase;
	letter-spacing: 0.18em;
	line-height: 1.5;
	font-size: clamp(1.2rem, 2.2vw, 1.75rem);
	margin: 0;
}

@media (prefers-reduced-motion: reduce) {
	.eb-hero .eb-hero__slide { animation: none; opacity: 0; }
	.eb-hero .eb-hero__slide:first-of-type { opacity: 1; }
}

/* --- About -------------------------------------------------------------- */
.eb-about {
	/* Modest gap under the full-bleed hero (was clamp(4rem,9vw,8rem), too tall).
	   Bottom padding is 0 so the gap down to the credit is owned by .eb-credit. */
	padding: clamp(2.25rem, 5vw, 4rem) clamp(1.25rem, 4vw, 2rem) 0;
	gap: clamp(2rem, 5vw, 4rem);
	align-items: center;
}
.eb-about p {
	font-weight: 300;
	line-height: 1.8;
}
.eb-credit {
	font-weight: 300;
	color: var(--wp--preset--color--muted);
	font-size: 0.95rem;
	/* Gap up from the bio matches the portrait<->text column gap (both
	   clamp(2rem,5vw,4rem)); margin:0 removes the default flow block-gap so the
	   padding-top is the whole gap. The gap down to the "content" title is set
	   on the title's margin-top (.eb-rule + .eb-section-title) instead. */
	margin: 0;
	padding: clamp(2rem, 5vw, 4rem) 1.5rem 0;
}
/* Home showcase: give every block its own side gutters so content never touches
   the screen edge (most visible on mobile). The full-bleed hero opts out.
   border-box so the gutters stay INSIDE the width (no box-sizing reset in this
   theme, else the padding overflows the viewport → stray horizontal scroll).
   NOTE: don't set max-width here — it would override the constrained layout's
   content-size cap and make the body full width. */
.home .wp-block-post-content > * {
	box-sizing: border-box;
}
.home .wp-block-post-content > :not(.eb-hero):not(.alignfull) {
	padding-left: clamp(1.25rem, 4vw, 2rem);
	padding-right: clamp(1.25rem, 4vw, 2rem);
}
/* Within a section the image/gallery sits flush UNDER its video, but every video
   keeps a gap above it (even mid-section). Section spacing comes from the headings. */
.home .wp-block-post-content > .wp-block-embed {
	margin-top: clamp(1.75rem, 4vw, 3rem);
	margin-bottom: 0;
}
.home .wp-block-post-content > .wp-block-image,
.home .wp-block-post-content > .wp-block-gallery {
	margin-top: 0;
	margin-bottom: 0;
}
/* Gallery images sit flush against each other — no gaps. */
.home .eb-gallery {
	gap: 0;
}
/* No separator line between the cover-art credit and the "content" title. */
.home .eb-rule {
	display: none;
}
/* The credit flows straight into the first ("content") title with a gap just
   slightly larger than the title->first-video gap below it. Only the first
   title is tightened; the rhythm between later showcase sections is unchanged
   (their .eb-section-title keeps its default larger top margin). */
.home .eb-rule + .eb-section-title {
	margin-top: clamp(2rem, 4.5vw, 3.5rem);
}
/* The centered "content" opener flows tightly into the first video's title
   (same rhythm as a title->video gap), rather than the wider between-sections
   gap used for the titles further down. */
.home .eb-section-title.has-text-align-center + .eb-section-title {
	margin-top: clamp(1.75rem, 4vw, 3rem);
}

/* --- Mobile nav drawer -------------------------------------------------- */
/* Turn the core full-screen overlay into a right-side drawer that slides in,
   matching the original's partial-width grey panel. */
@media (max-width: 781px) {
	.eb-nav .wp-block-navigation__responsive-container.is-menu-open {
		left: auto;
		right: 0;
		width: min(62vw, 320px);
		padding: 0;
		/* !important overrides core's :not(.has-background) white fallback. */
		background-color: #201a16 !important;
		box-shadow: -8px 0 30px rgba(0, 0, 0, 0.25);
		animation: ebDrawerIn 0.32s ease both;
	}
	.eb-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
		/* Top padding matches the close button's 1.5rem inset so "about" lines up with the X. */
		padding: 1.5rem 1.75rem 2rem;
		align-items: flex-start;
	}
	.eb-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:first-child {
		padding-top: 0;
	}
	/* Tight, even item rhythm (~35px) like the original, left-aligned, white. */
	.eb-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
		gap: 0;
		align-items: flex-start;
		justify-content: flex-start;
	}
	.eb-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
		padding: 0.6rem 0;
	}
	.eb-nav .wp-block-navigation__responsive-container.is-menu-open a,
	.eb-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
		color: #fff !important;
	}
	/* Give the close (X) breathing room from the top-right corner. */
	.eb-nav .wp-block-navigation__responsive-container-close {
		top: 1.5rem;
		right: 1.5rem;
		color: #fff !important;
	}
}
@keyframes ebDrawerIn {
	from { transform: translateX(100%); }
	to   { transform: translateX(0); }
}

/* --- Content ("arts & culture") page ------------------------------------ */
.eb-section-title {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 400;
	font-size: clamp(1.4rem, 2.6vw, 1.95rem);
	line-height: 1.2;
	margin: clamp(3rem, 6vw, 5rem) 0 1.5rem;
}
.eb-sub-title {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 400;
	font-size: clamp(1.05rem, 1.8vw, 1.25rem);
	color: var(--wp--preset--color--slate);
	margin: 2rem 0 1rem;
}
.eb-section-note {
	color: var(--wp--preset--color--muted);
	font-weight: 300;
	font-size: 0.9rem;
	margin: -0.5rem 0 1.25rem;
}
.eb-rule {
	border: 0;
	border-top: 1px solid rgba(0, 0, 0, 0.12);
	margin: clamp(2rem, 4vw, 3rem) auto;
	/* Span the content column (matching the text/buttons), overriding core's
	   short centered default — but not the full page width. */
	width: 100% !important;
	max-width: var(--wp--style--global--content-size, 780px) !important;
}
.eb-article .wp-block-embed,
.eb-page .wp-block-embed {
	margin: 0;
}
/* Dark, square, letter-spaced CTA buttons ("subscribe on youtube", etc.). */
.eb-cta-row {
	margin: 1.5rem 0;
	gap: 1rem;
}
/* "read the article" rows sit against the right edge of the content column. */
.eb-cta-right {
	justify-content: flex-end;
}
/* The top subscribe/follow pair share one width regardless of label length. */
.eb-cta-row:not(.eb-cta-right) .wp-block-button {
	flex: 1 1 0;
	max-width: 20rem;
}
.eb-cta-row:not(.eb-cta-right) .wp-block-button__link {
	display: block;
	width: 100%;
	text-align: center;
}
.eb-cta .wp-block-button__link {
	background-color: var(--wp--preset--color--contrast);
	color: #fff;
	border-radius: 0;
	padding: 0.85em 1.6em;
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.72rem;
	font-weight: 400;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}
.eb-cta .wp-block-button__link:hover,
.eb-cta .wp-block-button__link:focus {
	background-color: var(--wp--preset--color--slate);
}

/* Placeholder copy on stubbed article/project subpages. */
.eb-stub {
	color: var(--wp--preset--color--muted);
	font-weight: 300;
	padding: clamp(2rem, 6vw, 5rem) 0;
}

/* --- Contact form (Contact Form 7) -------------------------------------- */
.wpcf7-form p {
	margin: 0;
}
.wpcf7-form label {
	display: block;
	margin-bottom: 1.5rem;
	font-weight: 300;
	font-size: 0.95rem;
	color: var(--wp--preset--color--contrast);
}
.wpcf7-form .eb-form-names {
	display: flex;
	gap: 1.5rem;
}
.wpcf7-form .eb-form-names label {
	flex: 1;
	/* Allow the side-by-side name fields to shrink below their intrinsic input
	   width on narrow screens instead of overflowing to the right. */
	min-width: 0;
}
.wpcf7-form-control:not(.wpcf7-submit):not(.wpcf7-checkbox) {
	display: block;
	width: 100%;
	/* Keep padding + border inside the 100% width (no global box-sizing reset
	   in this theme) so fields don't overflow the container on the right. */
	box-sizing: border-box;
	margin-top: 0.5rem;
	padding: 0.7rem 0.85rem;
	border: 1px solid rgba(0, 0, 0, 0.2);
	background: #fcfcfc;
	font-family: var(--wp--preset--font-family--body);
	font-size: 1rem;
	font-weight: 300;
	color: var(--wp--preset--color--contrast);
}
.wpcf7-form textarea.wpcf7-form-control {
	min-height: 9rem;
	resize: vertical;
}
.wpcf7-form .wpcf7-checkbox {
	font-weight: 300;
	font-size: 0.9rem;
}
.wpcf7-form .wpcf7-checkbox .wpcf7-list-item {
	margin: 0;
}
.wpcf7-form .wpcf7-submit {
	display: block;
	margin-top: 0.5rem;
	margin-left: auto; /* push the submit button to the right edge of the form */
	background: var(--wp--preset--color--contrast);
	color: #fff;
	border: 0;
	border-radius: 0;
	padding: 0.9em 2.4em;
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.72rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.2s ease;
}
.wpcf7-form .wpcf7-submit:hover {
	background: var(--wp--preset--color--slate);
}

/* --- YouTube facades (click-to-load) ------------------------------------ */
.eb-yt-facade {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background-color: #000;
	cursor: pointer;
	overflow: hidden;
}
/* The thumbnail is a real <img> (maxresdefault w/ hqdefault fallback) rather
   than a background so we can degrade gracefully; cover crops any 4:3 fallback
   to fill the 16:9 frame without letterbox bars. */
.eb-yt-thumb {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	margin: 0;
	border: 0;
}
.eb-yt-facade::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.12);
	transition: background 0.2s ease;
}
.eb-yt-facade:hover::after {
	background: rgba(0, 0, 0, 0);
}
.eb-yt-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 68px;
	height: 48px;
	background: #f00;
	border-radius: 14px;
	z-index: 1;
	transition: transform 0.2s ease;
}
.eb-yt-facade:hover .eb-yt-play {
	transform: translate(-50%, -50%) scale(1.06);
}
.eb-yt-play::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-40%, -50%);
	border-style: solid;
	border-width: 11px 0 11px 19px;
	border-color: transparent transparent transparent #fff;
}
.eb-yt-facade.is-playing {
	cursor: default;
}
.eb-yt-facade.is-playing::after,
.eb-yt-facade.is-playing .eb-yt-play {
	display: none;
}
.eb-yt-facade iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	margin: 0;
}
/* Inside the core embed wrapper (which already provides the 16:9 box), fill it
   rather than adding a second aspect ratio. */
.wp-block-embed__wrapper .eb-yt-facade {
	position: absolute;
	inset: 0;
	aspect-ratio: auto;
}

/* --- Footer ------------------------------------------------------------- */
.eb-footer {
	background: var(--wp--preset--color--slate);
	color: #fff;
	padding: clamp(3rem, 7vw, 5rem) 1.5rem;
	text-align: center;
}
.eb-footer .wp-block-social-link a { color: #fff; }
.eb-copyright {
	color: rgba(255, 255, 255, 0.6);
	font-weight: 300;
	font-size: 0.85rem;
	letter-spacing: 0.05em;
	margin-top: 1.5rem;
}
