/* ============================================================
   MATIÈRE NOIRE — Mario Alonso
   Monochrome minimal portfolio
   ============================================================ */

:root {
	--c-bg: #ffffff;
	--c-fg: #000000;
	--c-muted: #6b6b6b;
	--c-line: #e5e5e5;
	--c-accent: #000000;

	--sidebar-w: 240px;
	--gutter: 24px;
	--maxw: 1280px;

	--ff-sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, "Segoe UI", system-ui, sans-serif;
	--fs-base: 14px;
	--lh-base: 1.55;
}

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

html, body { margin: 0; padding: 0; }

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

body {
	font-family: var(--ff-sans);
	font-size: var(--fs-base);
	line-height: var(--lh-base);
	color: var(--c-fg);
	background: var(--c-bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

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

a {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color .15s ease;
}
a:hover,
a:focus-visible { border-bottom-color: currentColor; }

button {
	font: inherit;
	color: inherit;
	background: none;
	border: 0;
	cursor: pointer;
	padding: 0;
}

/* ============================================================
   Layout : sidebar fixe + main content
   ============================================================ */

.site {
	display: grid;
	grid-template-columns: var(--sidebar-w) 1fr;
	min-height: 100vh;
}

.sidebar {
	border-right: 1px solid var(--c-line);
	padding: 32px 24px;
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
}

.brand {
	font-weight: 700;
	font-size: 14px;
	letter-spacing: .04em;
	margin: 0 0 48px 0;
	text-transform: uppercase;
}
.brand a { border: 0; }

.nav-primary {
	display: flex;
	flex-direction: column;
	gap: 14px;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: .03em;
}
.nav-primary a { border: 0; }
.nav-primary a[aria-current="page"] { font-weight: 700; }

.main {
	padding: 32px 40px 80px;
	max-width: var(--maxw);
	width: 100%;
}

/* ============================================================
   Header de page (haut du main)
   ============================================================ */

.page-head {
	display: flex;
	flex-wrap: wrap;
	gap: 24px 32px;
	align-items: baseline;
	margin-bottom: 32px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--c-line);
}
.page-head h1 {
	font-size: 14px;
	font-weight: 700;
	letter-spacing: .03em;
	margin: 0;
	text-transform: capitalize;
}

.filters {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 8px;
	font-size: 13px;
}
.filters a {
	padding: 4px 12px;
	border: 1px solid var(--c-line);
	border-radius: 0;
	transition: background .15s ease, color .15s ease;
}
.filters a[aria-current="true"],
.filters a:hover {
	background: var(--c-fg);
	color: var(--c-bg);
	border-color: var(--c-fg);
}

/* ============================================================
   Grille WORK
   ============================================================ */

.grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
}

.grid-item {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #f5f5f5;
}
.grid-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .4s ease, opacity .3s ease;
	opacity: 0;
}
.grid-item img.is-loaded { opacity: 1; }
.grid-item:hover img { transform: scale(1.03); }

.grid-item a {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.grid-item[hidden] { display: none; }

.work-video {
	margin-top: 16px;
}
.work-video video {
	display: block;
	width: 100%;
	height: auto;
	background: #000;
}
.work-video video[hidden] { display: none; }

/* ============================================================
   Pages texte (about, thoughts, books, contact, photo)
   ============================================================ */

.prose {
	max-width: 60ch;
	font-size: 14px;
	line-height: 1.65;
}
.prose p + p { margin-top: 1em; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }

.about-grid {
	display: grid;
	grid-template-columns: 200px 1fr;
	gap: 32px;
	align-items: start;
}
.about-grid img {
	width: 100%;
	aspect-ratio: 4/5;
	object-fit: cover;
}

.books-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 32px;
}
.books-list li { max-width: 60ch; }
.books-list h2 {
	font-size: 14px;
	font-weight: 700;
	margin: 0 0 4px 0;
}
.books-list .book-meta {
	font-size: 12px;
	color: var(--c-muted);
	margin-bottom: 8px;
}

.contact-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	font-size: 14px;
}

/* ============================================================
   Page photo individuelle
   ============================================================ */

.photo-view {
	display: grid;
	grid-template-columns: 1fr;
	gap: 24px;
	max-width: 1100px;
}
.photo-view figure {
	margin: 0;
}
.photo-view img {
	width: 100%;
	height: auto;
	background: #f5f5f5;
}
.photo-view figcaption {
	font-size: 13px;
	color: var(--c-muted);
	margin-top: 8px;
}
.photo-nav {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--c-line);
	font-size: 13px;
}

/* ============================================================
   Burger (mobile)
   ============================================================ */

.burger {
	display: none;
	position: fixed;
	top: 16px;
	right: 16px;
	z-index: 20;
	width: 40px;
	height: 40px;
	background: var(--c-bg);
	border: 1px solid var(--c-line);
}
.burger span,
.burger span::before,
.burger span::after {
	content: "";
	display: block;
	position: absolute;
	left: 8px;
	right: 8px;
	height: 1px;
	background: var(--c-fg);
}
.burger span { top: 50%; transform: translateY(-50%); }
.burger span::before { top: -8px; left: 0; right: 0; }
.burger span::after  { top:  8px; left: 0; right: 0; }

.burger[aria-expanded="true"] span { background: transparent; }
.burger[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); }
.burger[aria-expanded="true"] span::after  { top: 0; transform: rotate(-45deg); }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
	.site { grid-template-columns: 1fr; }
	.sidebar {
		position: fixed;
		inset: 0 auto 0 0;
		width: 80vw;
		max-width: 320px;
		height: 100vh;
		background: var(--c-bg);
		border-right: 1px solid var(--c-line);
		transform: translateX(-100%);
		transition: transform .25s ease;
		z-index: 15;
	}
	.sidebar[data-open="true"] { transform: translateX(0); }
	.burger { display: block; }
	.main { padding: 64px 20px 64px; }
	.grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
	.about-grid { grid-template-columns: 1fr; }
	.about-grid img { max-width: 240px; }
}

@media (max-width: 480px) {
	.grid { grid-template-columns: 1fr; gap: 8px; }
}

/* ============================================================
   Accessibilité
   ============================================================ */

:focus-visible {
	outline: 2px solid var(--c-fg);
	outline-offset: 2px;
}

.sr-only {
	position: absolute;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0,0,0,0);
	white-space: nowrap;
	border: 0;
}

/* ============================================================
   Page photo — viewer immersif
   ============================================================ */

body.photo-page .site { grid-template-columns: 1fr; }
body.photo-page .sidebar { display: none; }
body.photo-page .burger { display: none; }
body.photo-page .main { padding: 0; max-width: none; }

.viewer-bar {
	position: sticky;
	top: 0;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 16px;
	padding: 12px 24px;
	border-bottom: 1px solid var(--c-line);
	background: var(--c-bg);
	font-size: 12px;
	color: var(--c-muted);
	z-index: 10;
}
.viewer-bar a { border: 0; }
.viewer-bar .back { justify-self: start; }
.viewer-bar .title { justify-self: center; letter-spacing: .04em; text-transform: uppercase; }
.viewer-bar .nav { justify-self: end; display: flex; gap: 16px; }
.viewer-bar .nav a.disabled,
.viewer-bar .nav span.disabled { opacity: .25; pointer-events: none; }

.viewer-stage {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	min-height: calc(100vh - 60px);
}
.viewer-stage figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: 100%;
}
.viewer-stage img {
	max-width: 100%;
	max-height: calc(100vh - 140px);
	width: auto;
	height: auto;
	object-fit: contain;
	background: #f5f5f5;
}

.viewer-caption {
	max-width: 60ch;
	margin: 0 auto;
	padding: 0 24px 40px;
	text-align: center;
	color: var(--c-muted);
	font-size: 13px;
	line-height: 1.6;
}
.viewer-caption::before {
	content: "—";
	display: block;
	margin: 0 auto 16px;
	color: var(--c-line);
}

@media (max-width: 600px) {
	.viewer-bar { padding: 10px 16px; font-size: 11px; }
	.viewer-bar .back .label { display: none; }
	.viewer-stage { padding: 16px; min-height: calc(100vh - 50px); }
	.viewer-stage img { max-height: calc(100vh - 120px); }
}

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