/*
Theme Name: Ubikwit
Theme URI: https://ubikwit.net
Author: Maxime Lenglet
Description: Photos de concert et comptes rendus. Accueil en carrés alternés avec scroll infini, articles en deux colonnes au défilement indépendant (texte / photos), mode sombre, sans commentaires.
Version: 1.1.2
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ubikwit
*/

/* ==========================================================================
   Variables
   ========================================================================== */

body {
	--bg: #000;
	--fg: #fff;
	--muted: #b9b9b9;
	--line: rgba(255, 255, 255, 0.4);
	--panel: #1a1a1a;

	--font-body: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-display: "Alumni Sans", "Roboto Condensed", "Arial Narrow", sans-serif;

	--pad: clamp(1.25rem, 3vw, 2.75rem);
	--bar-h: 82px;
	/* Fond de la barre du haut sur les articles : noir légèrement transparent. */
	--bar-bg: rgba(0, 0, 0, 0.8);

	/* Hauteur réellement visible (barre d'admin WordPress déduite). */
	--ab: 0px;
	--vh: calc(100vh - var(--ab));
	/* Les blocs d'accueil occupent toute la largeur du navigateur. */
	--grid-w: 100%;
	/* Hauteur d'un bloc : celle de l'écran (limitée sur les fenêtres étroites). */
	--trio-h: min(var(--vh), 66.6vw);
}

@supports (height: 100dvh) {
	body {
		--vh: calc(100dvh - var(--ab));
	}
}

body.admin-bar {
	--ab: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar {
		--ab: 46px;
	}
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html {
	background: #000;
	color-scheme: dark;
	-webkit-text-size-adjust: 100%;
	scrollbar-color: #3a3a3a #000;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--font-body);
	font-size: 1.0625rem;
	font-weight: 300;
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
}

img,
video,
iframe {
	max-width: 100%;
}

img {
	height: auto;
}

a {
	color: inherit;
}

button {
	font: inherit;
	color: inherit;
	cursor: pointer;
}

:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

[hidden] {
	display: none !important;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.skip-link:focus {
	z-index: 1000;
	top: 0.5rem;
	left: 0.5rem;
	width: auto;
	height: auto;
	padding: 0.75rem 1rem;
	clip-path: none;
	background: #fff;
	color: #000;
}

.button {
	display: inline-block;
	margin: 0 0.5rem 0.5rem 0;
	padding: 0.8rem 1.4rem;
	border: 2px solid var(--line);
	background: none;
	font-size: 0.85rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-decoration: none;
	text-transform: uppercase;
	transition: border-color 0.2s;
}

.button:hover {
	border-color: #fff;
}

/* ==========================================================================
   Barre logo / recherche / menu
   ========================================================================== */

.site-header-slot {
	position: relative;
	z-index: 50; /* reste au-dessus des calques plein écran */
	height: var(--bar-h);
}


.site-header {
	display: flex;
	align-items: center;
	gap: clamp(0.75rem, 2.5vw, 2.5rem);
	height: var(--bar-h);
	padding: 0 var(--pad);
}

/* Articles et pages : logo à gauche, menu à droite, recherche centrée entre les deux. */
.is-article .site-header {
	justify-content: space-between;
}

.site-branding {
	flex: 0 1 auto;
	min-width: 0;
	line-height: 0;
}

.custom-logo-link {
	display: block;
}

.custom-logo {
	display: block;
	width: auto;
	max-width: min(180px, 100%);
	height: auto;
	max-height: calc(var(--bar-h) - 24px);
}

.site-title {
	display: block;
	overflow: hidden;
	font-family: var(--font-display);
	font-size: 1.75rem;
	font-weight: 600;
	line-height: 1.1;
	text-overflow: ellipsis;
	white-space: nowrap;
	text-decoration: none;
	text-transform: uppercase;
}

.search-toggle,
.menu-toggle {
	flex: none;
	background: none;
	font-size: 0.85rem;
	font-weight: 500;
	letter-spacing: 0.16em;
	line-height: 1;
	text-transform: uppercase;
}

.search-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.75rem 0.25rem;
	border: 0;
	opacity: 0.85;
	transition: opacity 0.2s;
}

.search-toggle:hover,
.search-toggle[aria-expanded="true"] {
	opacity: 1;
}

.menu-toggle {
	min-width: 6.5rem;
	padding: 0.9rem 1.25rem;
	border: 2px solid var(--line);
	transition: border-color 0.2s;
}

.menu-toggle:hover,
.menu-toggle[aria-expanded="true"] {
	border-color: #fff;
}

.site-header__label {
	min-width: 0;
	margin: 0;
	overflow: hidden;
	font-family: var(--font-display);
	font-size: 1.75rem;
	font-weight: 500;
	line-height: 1;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ==========================================================================
   Accueil, archives, recherche : blocs de 3 carrés
   ========================================================================== */

.grid-header {
	position: fixed;
	z-index: 50;
	top: var(--ab);
	right: 0;
	left: 0;
	pointer-events: none;
}

.grid-header__inner {
	width: var(--grid-w);
	margin: 0 auto;
	background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
}

.overlay-open .grid-header__inner {
	background: none;
}

.grid-header .site-header > * {
	pointer-events: auto;
}

.trios {
	width: var(--grid-w);
	margin: 0 auto;
}

/* Grand carré à gauche, deux petits à droite… */
.trio {
	display: grid;
	/* Deux petits carrés empilés ; la grande image prend toute la largeur restante. */
	grid-template-columns: minmax(0, 1fr) calc(var(--trio-h) / 2);
	grid-template-rows: 1fr 1fr;
	height: var(--trio-h);
}

.trio .tile--large {
	grid-column: 1;
	grid-row: 1 / 3;
}

.trio .tile--small {
	grid-column: 2;
}

/* …puis l'inverse un bloc sur deux. */
.trio:nth-child(even) {
	grid-template-columns: calc(var(--trio-h) / 2) minmax(0, 1fr);
}

.trio:nth-child(even) .tile--large {
	grid-column: 2;
}

.trio:nth-child(even) .tile--small {
	grid-column: 1;
}

.tile {
	position: relative;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
	background: #111;
}

.tile__link {
	display: block;
	width: 100%;
	height: 100%;
	text-decoration: none;
}

.tile__link:focus-visible {
	outline-offset: -4px;
}

.tile__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s ease;
}

.tile__link:hover .tile__img {
	transform: scale(1.03);
}

.tile__text {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	padding: 5rem var(--pad) var(--pad);
	background: linear-gradient(to top, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0.5) 55%, rgba(0, 0, 0, 0));
}

.tile__title {
	margin: 0;
	font-family: var(--font-display);
	font-weight: 600;
	line-height: 0.95;
	text-transform: uppercase;
	text-wrap: balance;
}

.tile--large .tile__title {
	max-width: 16em;
	font-size: clamp(2.25rem, 4.6vw, 4.5rem);
}

.tile--small .tile__title {
	font-size: clamp(1.5rem, 2.3vw, 2.25rem);
}

.tile__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	margin: 0.6rem 0 0;
	font-size: 0.8rem;
	font-weight: 400;
	letter-spacing: 0.12em;
	line-height: 1.4;
	text-transform: uppercase;
}

.tile__cat::before {
	content: "—";
	margin-right: 1rem;
	opacity: 0.6;
}

.tile__excerpt {
	display: -webkit-box;
	max-width: 38em;
	margin: 0.9rem 0 0;
	overflow: hidden;
	font-size: 1rem;
	line-height: 1.5;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
}

/* Pagination : visible sans JavaScript, discrète en scroll infini. */
.pagination {
	padding: 2rem var(--pad);
	text-align: center;
}

.pagination__next {
	display: inline-block;
	padding: 0.9rem 1.5rem;
	border: 2px solid var(--line);
	font-size: 0.85rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-decoration: none;
	text-transform: uppercase;
}

.pagination.is-infinite .pagination__next {
	display: none;
}

.pagination__status {
	margin: 0;
	color: var(--muted);
	font-size: 0.9rem;
}

.pagination__status:empty {
	display: none;
}

.empty {
	width: var(--grid-w);
	margin: 0 auto;
	padding: calc(var(--bar-h) + 4rem) var(--pad) 4rem;
}

.empty__title {
	margin: 0 0 0.5rem;
	font-family: var(--font-display);
	font-size: clamp(3rem, 8vw, 6rem);
	font-weight: 600;
	line-height: 1;
	text-transform: uppercase;
}

@media (max-width: 767px) {
	.trio,
	.trio:nth-child(even) {
		display: block;
		height: auto;
	}

	.tile {
		aspect-ratio: 1;
	}

	.tile--small .tile__title {
		font-size: 1.9rem;
	}

	.site-header__label {
		font-size: 1.25rem;
	}
}

/* ==========================================================================
   Article : texte à gauche, photos à droite
   ========================================================================== */

.article {
	--cols: minmax(0, 1fr) minmax(0, 2fr);
}

.article--half {
	--cols: minmax(0, 1fr) minmax(0, 1fr);
}

.article__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	min-width: 0;
	height: var(--bar-h);
	padding: 0 var(--pad);
	color: var(--muted);
	font-size: 0.95rem;
	font-weight: 400;
}

.breadcrumb {
	min-width: 0;
}

.breadcrumb ol {
	display: flex;
	flex-wrap: wrap;
	gap: 0.2rem 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.breadcrumb li + li::before {
	content: "›";
	margin: 0 1rem;
	opacity: 0.7;
}

.breadcrumb a {
	text-decoration: none;
}

.breadcrumb a:hover {
	color: #fff;
	text-decoration: underline;
}

.article__date {
	flex: none;
	color: #e6e6e6;
	font-size: 1.05rem;
}

.article__inner {
	padding: var(--pad) var(--pad) 4rem;
}

.article__title {
	margin: 0 0 1.5rem;
	font-family: var(--font-display);
	font-size: clamp(2.5rem, 4vw, 4rem);
	font-weight: 600;
	line-height: 0.95;
	text-transform: uppercase;
	text-wrap: balance;
}

.article__media {
	padding: 0 0 var(--pad);
}

.article__tabs {
	display: none;
}

/* Plusieurs galeries : un titre par groupe et des liens pour passer de l'une à l'autre. */
/* Les galeries (Modula positionne et empile ses vignettes) restent confinées dans
   leur propre plan : elles ne passent jamais au-dessus de la barre ni des onglets. */
.article__cols,
.gallery {
	isolation: isolate;
}

.gallery + .gallery {
	margin-top: calc(var(--pad) * 1.5);
}

.gallery__header {
	padding: 1.25rem calc(var(--pad) / 2) 1rem;
}

.gallery__title {
	margin: 0;
	font-family: var(--font-display);
	font-size: clamp(2rem, 3vw, 3rem);
	font-weight: 600;
	line-height: 1;
	text-transform: uppercase;
}

.gallery-nav {
	min-width: 0;
}

.gallery-nav ul {
	display: flex;
	gap: 1.5rem;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	list-style: none;
	scrollbar-width: none;
}

.gallery-nav a {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.4rem 0;
	border-bottom: 2px solid transparent;
	font-size: 0.8rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
}

.gallery-nav a:hover,
.gallery-nav a[aria-current="true"] {
	border-bottom-color: #fff;
	color: #fff;
}

.gallery-nav__icon {
	flex: none;
}

.gallery-nav--mobile {
	display: none;
}

/* Bureau : la page ne défile pas, chaque colonne a son propre défilement. */
@media (min-width: 900px) {
	.is-article {
		overflow: hidden;
	}

	.article {
		position: relative;
		height: var(--vh);
	}

	.article__top,
	.article__cols {
		display: grid;
		grid-template-columns: var(--cols);
	}

	/* Barre continue posée par-dessus les colonnes : le contenu défile dessous
	   et reste deviné à travers le fond noir légèrement transparent. */
	.article__top {
		position: absolute;
		top: 0;
		right: 0;
		left: 0;
	}

	.article__top .site-header-slot,
	.article__bar {
		background: var(--bar-bg);
	}

	.article__bar {
		position: relative;
		z-index: 1;
	}

	/* Barre étroite : le fil d'Ariane cède la place (fondu à droite) avant les liens de galeries et la date. */
	.article__bar .breadcrumb {
		flex: 0 100 auto;
		overflow: hidden;
		padding-right: 1.5rem; /* zone du fondu : vide tant que rien ne déborde */
		-webkit-mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
		mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
	}

	.article__bar .breadcrumb ol {
		flex-wrap: nowrap;
		white-space: nowrap;
	}

	.gallery-nav--bar {
		flex: 0 1 auto;
		margin-left: auto;
	}

	.article__cols {
		height: 100%;
	}

	.article--full .article__cols {
		grid-template-columns: minmax(0, 1fr);
	}

	.article__text,
	.article__media {
		min-height: 0;
		padding-top: var(--bar-h);
		overflow-y: auto;
		scroll-padding-top: var(--bar-h);
		overscroll-behavior: contain;
		scrollbar-color: #3a3a3a transparent;
		scrollbar-width: thin;
	}

	.article--full .article__inner {
		max-width: 48rem;
		margin: 0 auto;
		padding-top: calc(var(--pad) * 1.5);
	}
}

/* La barre s'adapte à la largeur réelle de la colonne texte (et non de l'écran) :
   loupe seule quand la place manque, puis boutons et marges resserrés. */
@media (min-width: 900px) {
	.article__top .site-header-slot {
		container-type: inline-size;
	}

	@container (max-width: 599px) {
		.search-toggle__label {
			display: none;
		}

		.site-header {
			gap: 1.25rem;
		}
	}

	@container (max-width: 379px) {
		.site-header {
			gap: 0.75rem;
		}

		.menu-toggle {
			min-width: 0;
			padding: 0.8rem 0.9rem;
		}
	}
}

/* Mobile et tablette : onglets Photos / Article en haut d'écran. */
@media (max-width: 899px) {
	.article {
		display: flex;
		flex-direction: column;
	}

	.article__top {
		display: contents;
	}

	.site-header-slot {
		order: 1;
	}

	.article__tabs {
		order: 2;
	}

	.article__bar {
		order: 3;
		background: #141414;
		height: auto;
		min-height: 3.25rem;
		padding-top: 0.6rem;
		padding-bottom: 0.6rem;
		font-size: 0.85rem;
	}

	.article__cols {
		order: 4;
	}

	.article__date {
		font-size: 0.85rem;
	}

	.breadcrumb li + li::before {
		margin: 0 0.5rem;
	}

	.gallery-nav--bar {
		display: none;
	}

	.gallery-nav--mobile {
		position: sticky;
		z-index: 9;
		top: calc(var(--ab) + 3.25rem);
		display: block;
		padding: 0.35rem var(--pad);
		background: rgba(0, 0, 0, 0.85);
		color: var(--muted);
	}

	.gallery {
		scroll-margin-top: 6.5rem;
	}

	.js .article__tabs {
		position: sticky;
		z-index: 10;
		top: var(--ab);
		display: grid;
		height: 3.25rem;
		grid-template-columns: 1fr 1fr;
		background: #000;
	}

	.article__tabs button {
		padding: 0 0.5rem;
		border: 0;
		border-bottom: 2px solid #333;
		background: none;
		color: var(--muted);
		font-size: 0.85rem;
		font-weight: 500;
		letter-spacing: 0.16em;
		text-transform: uppercase;
	}

	.article__tabs button[aria-selected="true"] {
		border-bottom-color: #fff;
		color: #fff;
	}

	.article__tabs button:focus-visible {
		outline-offset: -4px;
	}

	.js .article:not(.article--full) .article__cols[data-active="media"] .article__text,
	.js .article__cols[data-active="text"] .article__media {
		display: none;
	}

	/* Calque ouvert : l'en-tête reste accessible même si la page a défilé. */
	.overlay-open.is-article .site-header {
		position: fixed;
		top: var(--ab);
		right: 0;
		left: 0;
	}
}

@media (max-width: 420px) {
	.search-toggle__label {
		display: none;
	}

	.site-header {
		justify-content: space-between;
	}
}

/* ==========================================================================
   Contenu de l'article
   ========================================================================== */

.entry-content > * {
	margin-top: 0;
	margin-bottom: 1.4rem;
}

/* Chapeaux et intertitres. */
.entry-content h2 {
	margin-top: 2.5rem;
	margin-bottom: 1.25rem;
	font-family: var(--font-display);
	font-size: clamp(1.75rem, 2.2vw, 2.25rem);
	font-weight: 500;
	line-height: 1.1;
	text-wrap: balance;
}

.entry-content > h2:first-child {
	margin-top: 0;
}

.entry-content h3,
.entry-content h4 {
	margin-top: 2rem;
	margin-bottom: 0.75rem;
	font-family: var(--font-display);
	font-size: 1.6rem;
	font-weight: 600;
	line-height: 1.15;
}

.entry-content h4 {
	font-size: 1.35rem;
}

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

.entry-content a {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.entry-content a:hover {
	text-decoration-thickness: 2px;
}

.entry-content blockquote {
	margin-right: 0;
	margin-left: 0;
	padding-left: 1.25rem;
	border-left: 2px solid var(--line);
	font-style: italic;
}

.entry-content figure {
	margin-right: 0;
	margin-left: 0;
}

.entry-content figcaption {
	margin-top: 0.5rem;
	color: var(--muted);
	font-size: 0.85rem;
}

.entry-content hr {
	border: 0;
	border-top: 1px solid #333;
}

.entry-content ul,
.entry-content ol {
	padding-left: 1.25rem;
}

/* ==========================================================================
   Calques plein écran : recherche et menu
   ========================================================================== */

.overlay {
	position: fixed;
	z-index: 40;
	inset: 0;
	overflow-y: auto;
	background: #000;
	overscroll-behavior: contain;
}

.overlay-open {
	overflow: hidden;
}

/* Apparition en fondu de la recherche et du menu. */
.overlay:not([hidden]) {
	animation: ubikwit-fade-in 0.7s ease both;
}

/* Disparition en fondu (la classe est posée par main.js). */
.overlay.is-closing {
	animation: ubikwit-fade-out 0.5s ease both;
	pointer-events: none;
}

/* Passage direct de la recherche au menu : pas de fondu. */
.overlay.is-instant {
	animation: none;
}

@keyframes ubikwit-fade-in {
	from {
		opacity: 0;
	}
}

@keyframes ubikwit-fade-out {
	to {
		opacity: 0;
	}
}

.overlay__inner {
	padding: calc(var(--ab) + var(--bar-h) + clamp(2rem, 10vh, 7rem)) var(--pad) 4rem;
}

.is-grid .overlay__inner {
	width: var(--grid-w);
	margin: 0 auto;
}

.overlay-search input {
	display: block;
	width: 100%;
	padding: 0.25em 0 0.45em;
	border: 0;
	border-bottom: 2px solid #fff;
	border-radius: 0;
	outline: 0;
	background: none;
	color: #fff;
	font-family: var(--font-body);
	font-size: clamp(1.75rem, 4.5vw, 3rem);
	font-weight: 300;
	appearance: none;
}

.overlay-search input::placeholder {
	color: #8c8c8c;
	opacity: 1;
}

.overlay-search input:focus-visible {
	outline: 0;
	box-shadow: 0 2px 0 #fff;
}

.overlay-search input::-webkit-search-cancel-button {
	filter: invert(1);
}

.overlay-suggest {
	margin-top: clamp(2rem, 6vh, 4rem);
}

.overlay-suggest__label {
	margin: 0 0 1rem;
	color: var(--muted);
	font-size: 0.8rem;
	font-weight: 500;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.overlay-suggest ul {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
	gap: 1rem 2.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.overlay-suggest a {
	display: block;
	font-family: var(--font-display);
	font-size: 1.7rem;
	font-weight: 500;
	line-height: 1.05;
	text-decoration: none;
}

.overlay-suggest a:hover {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.15em;
}

.overlay-suggest time {
	display: block;
	margin-top: 0.3rem;
	color: var(--muted);
	font-family: var(--font-body);
	font-size: 0.8rem;
	font-weight: 400;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.overlay-menu,
.overlay-menu ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.overlay-menu {
	columns: 22rem auto;
	column-gap: 3rem;
}

.overlay-menu > li {
	margin-bottom: 1.25rem;
	break-inside: avoid;
}

.overlay-menu a {
	text-decoration: none;
}

.overlay-menu a:hover,
.overlay-menu .current-menu-item > a,
.overlay-menu .current-cat > a {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.12em;
}

.overlay-menu > li > a {
	font-family: var(--font-display);
	font-size: clamp(2.5rem, 6vw, 4.5rem);
	font-weight: 600;
	line-height: 1;
	text-transform: uppercase;
}

.overlay-menu ul {
	margin-top: 0.4rem;
}

.overlay-menu ul a {
	display: inline-block;
	padding: 0.2rem 0;
	color: var(--muted);
	font-size: 1.1rem;
}

.overlay-menu ul a:hover {
	color: #fff;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition: none !important;
		animation: none !important;
	}
}
