/*
Theme Name: Thibault Rivier
Description: Site de Thibault Rivier, triathlète suisse. Logo arche, parcours raconté comme une course de triathlon.
Version: 3.0.1
Requires at least: 6.5
Requires PHP: 7.4
Text Domain: thibault-rivier
*/

/* Concept : la page se lit comme une course. Titres en italique (la vitesse), angles nets,
   ligne d'eau rouge et blanche comme fil conducteur, une couleur par discipline. */
:root {
	--tr-red: #E1251B;
	--tr-red-deep: #9F1A13;
	--tr-red-pale: #FAD3D1;
	--tr-ink: #1C1F24;
	--tr-muted: #5B6169;
	--tr-glacier: #F2F4F5;
	--tr-lake: #0E4C6E;
	--tr-line: #E1E3E5;
	--tr-paper: #FFFFFF;
	--tr-display: "Barlow Condensed", "Arial Narrow", sans-serif;
	--tr-body: "Work Sans", system-ui, sans-serif;
	--tr-mono: "IBM Plex Mono", ui-monospace, monospace;
	--tr-content: var(--wp--style--global--content-size, 1120px);
	--tr-rope: repeating-linear-gradient(90deg, var(--tr-red) 0 18px, var(--tr-paper) 18px 30px);
}

html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body { margin: 0; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.wp-site-blocks { padding: 0; }
.wp-site-blocks > * + * { margin-block-start: 0; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { text-wrap: balance; }
:focus-visible { outline: 3px solid var(--tr-red); outline-offset: 3px; }

/* Colonne de contenu commune à toutes les sections */
.tr-block > *, .tr-hero > *, .tr-numbers > * { max-width: var(--tr-content) !important; margin-left: auto !important; margin-right: auto !important; }

/* ---------- En-tête ---------- */
.wp-site-blocks > .wp-block-template-part:first-child { position: sticky; top: 0; z-index: 50; }
.admin-bar .wp-site-blocks > .wp-block-template-part:first-child { top: 32px; }
@media (max-width: 782px) { .admin-bar .wp-site-blocks > .wp-block-template-part:first-child { top: 46px; } }
.tr-header {
	height: 76px; padding: 0 clamp(16px, 4vw, 40px);
	align-items: center; gap: 16px;
	background: rgba(255, 255, 255, .94);
	backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
	border-bottom: 1px solid var(--tr-line);
}
.tr-header p { margin: 0; }
.tr-header a { color: var(--tr-ink); text-decoration: none; }
.tr-brand a { display: inline-flex; align-items: center; gap: 12px; }
.tr-logo { display: inline-block; width: 46px; height: 46px; background: url("assets/img/logo-arche.svg") center / contain no-repeat; flex: none; }
.tr-brand-name { font-family: var(--tr-display); font-style: italic; font-weight: 800; font-size: 1.55rem; text-transform: uppercase; letter-spacing: .01em; line-height: 1; }
.tr-nav { display: flex; gap: clamp(16px, 2.4vw, 32px); align-items: center; }
.tr-nav a { position: relative; font-weight: 500; font-size: .95rem; padding: 6px 0; }
.tr-nav a:not(.tr-nav-cta)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--tr-rope); transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
.tr-nav a:not(.tr-nav-cta):hover::after { transform: scaleX(1); }
.tr-nav .tr-nav-cta { background: var(--tr-red); color: #fff; padding: 10px 18px; border-radius: 2px; font-weight: 600; }
.tr-nav .tr-nav-cta:hover { background: var(--tr-red-deep); }
@media (max-width: 820px) { .tr-nav a:not(.tr-nav-cta) { display: none; } }

/* ---------- Boutons ---------- */
.wp-block-button__link { border-radius: 2px !important; transition: background-color .2s ease, color .2s ease, transform .2s ease; }
.wp-block-button__link:hover { transform: translateY(-2px); }
.tr-btn-ghost .wp-block-button__link { background: transparent; color: var(--tr-ink); box-shadow: inset 0 0 0 2px var(--tr-ink); }
.tr-btn-ghost .wp-block-button__link:hover { background: var(--tr-ink); color: #fff; }

/* ---------- Libellés et titres ---------- */
.tr-label { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-weight: 600; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--tr-red); }
.tr-label::before { content: ""; width: 30px; height: 4px; background: var(--tr-rope); }
.tr-title { font-style: italic; font-weight: 800 !important; font-size: clamp(2.6rem, 5.4vw, 4rem) !important; line-height: .92 !important; margin: 0 0 16px; letter-spacing: -.005em; }
.tr-intro { color: var(--tr-muted); font-size: 1.12rem; line-height: 1.6; max-width: 58ch; }

/* ---------- Hero ---------- */
.tr-hero { position: relative; background: var(--tr-paper); padding-top: clamp(40px, 6vw, 88px); padding-bottom: clamp(72px, 9vw, 120px); overflow: hidden; }
.tr-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: var(--tr-rope); }
.tr-hero-grid { gap: clamp(36px, 5vw, 80px) !important; margin-top: 0 !important; margin-bottom: 0 !important; }
.tr-timing { display: flex; flex-wrap: wrap; gap: 0; margin: 0; font-family: var(--tr-mono); font-size: .8rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.tr-timing span { padding: 7px 12px; background: var(--tr-glacier); color: var(--tr-ink); }
.tr-timing span:last-child { background: var(--tr-red); color: #fff; }
.tr-hero-title { margin: 26px 0 22px !important; font-style: italic; font-weight: 800 !important; font-size: clamp(4rem, 10.5vw, 8.4rem) !important; line-height: .84 !important; letter-spacing: -.01em; }
.tr-hero-title span { display: block; }
.tr-hero-title .tr-l2 { color: var(--tr-red); padding-left: .42em; }
.tr-hero-lead { font-size: 1.18rem; line-height: 1.6; color: #3A3F47; max-width: 44ch; margin: 0 0 30px; }
.tr-hero-visual { position: relative; }
.tr-hero-photo { margin: 0; position: relative; }
.tr-hero-photo::before { content: ""; position: absolute; inset: 26px -26px -26px 26px; background: var(--tr-lake); }
.tr-hero-photo img { position: relative; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.tr-bib { position: absolute; z-index: 2; left: -30px; bottom: -44px; width: 156px; background: #fff; overflow: hidden; text-align: center; border-radius: 3px; box-shadow: 0 18px 36px rgba(28, 31, 36, .25); transform: rotate(-5deg); }
.tr-bib::before, .tr-bib::after { content: ""; position: absolute; top: 42px; width: 7px; height: 7px; border-radius: 50%; background: #C3C8CE; }
.tr-bib::before { left: 10px; } .tr-bib::after { right: 10px; }
.tr-bib p { margin: 0; }
.tr-bib-top { background: var(--tr-red); color: #fff; font-family: var(--tr-mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; padding: 7px 4px; }
.tr-bib-num { font-family: var(--tr-display); font-style: italic; font-weight: 800; font-size: 5.4rem; line-height: 1; color: var(--tr-ink); padding-top: 4px; }
.tr-bib-bottom { font-family: var(--tr-mono); font-size: .68rem; color: var(--tr-muted); padding: 2px 4px 12px; }
@media (max-width: 781px) {
	.tr-hero-visual { order: -1; margin: 0 14px 34px 0; }
	.tr-bib { width: 112px; left: -4px; bottom: -32px; }
	.tr-bib-num { font-size: 3.8rem; }
	.tr-hero-photo::before { inset: 14px -14px -14px 14px; }
	.tr-hero-title .tr-l2 { padding-left: .3em; }
}

/* Mouvement d'arrivée : une seule séquence, désactivée si l'utilisateur limite les animations */
@media (prefers-reduced-motion: no-preference) {
	.tr-hero-title .tr-l1, .tr-hero-title .tr-l2 { animation: tr-dash .8s cubic-bezier(.2, .8, .2, 1) both; }
	.tr-hero-title .tr-l2 { animation-delay: .12s; }
	.tr-bib { animation: tr-pin .7s .45s cubic-bezier(.3, 1.4, .5, 1) both; }
	@keyframes tr-dash { from { transform: translateX(-40px) skewX(-8deg); opacity: .2; } to { transform: none; opacity: 1; } }
	@keyframes tr-pin { from { transform: translateY(-18px) rotate(-14deg); opacity: 0; } to { transform: rotate(-5deg); opacity: 1; } }
}

/* ---------- Chiffres ---------- */
.tr-numbers { background: var(--tr-ink); color: #fff; padding-top: 44px; padding-bottom: 44px; }
.tr-numbers-grid { margin-top: 0 !important; margin-bottom: 0 !important; gap: 0 !important; }
.tr-numbers-grid > .wp-block-column { padding: 4px 26px; border-left: 1px solid rgba(255, 255, 255, .16); }
.tr-numbers-grid > .wp-block-column:first-child { border-left: 0; padding-left: 0; }
.tr-numbers p { margin: 0; }
.tr-num { font-family: var(--tr-display); font-style: italic; font-weight: 800; font-size: clamp(2.6rem, 5vw, 3.6rem); line-height: 1; }
.tr-num sup { font-size: .42em; }
.tr-numbers-grid > .wp-block-column:first-child .tr-num { color: #FF5A50; }
.tr-num-label { font-size: .92rem; color: #B9BEC5; margin-top: 8px !important; max-width: 22ch; }
@media (max-width: 781px) {
	.tr-numbers-grid { display: grid !important; grid-template-columns: 1fr 1fr; row-gap: 26px !important; }
	.tr-numbers-grid > .wp-block-column { border-left: 0; padding: 0; }
}

/* ---------- Sections ---------- */
.tr-block { padding-top: clamp(72px, 9vw, 120px); padding-bottom: clamp(72px, 9vw, 120px); }
.tr-tint { background: var(--tr-glacier); }

/* À la une */
.tr-news { gap: clamp(28px, 5vw, 72px) !important; margin-top: 0 !important; margin-bottom: 0 !important; }
.tr-news-body { border-left: 3px solid var(--tr-red); padding-left: clamp(20px, 3vw, 36px); }
.tr-news-lead { font-size: clamp(1.3rem, 2vw, 1.55rem); line-height: 1.4; font-weight: 500; margin-top: 0; color: var(--tr-ink); }
.tr-news-body p { max-width: 62ch; }
.tr-link a { font-weight: 600; color: var(--tr-red-deep); text-decoration: none; background: linear-gradient(var(--tr-red), var(--tr-red)) 0 100% / 100% 2px no-repeat; padding-bottom: 2px; transition: background-size .25s ease, color .25s ease; }
.tr-link a:hover { background-size: 100% 100%; color: #fff; }
.tr-link a::after { content: "  ↗"; }

/* Parcours : quatre segments d'une course */
.tr-race { background: var(--tr-glacier); }
.tr-race-head { margin-top: 0 !important; margin-bottom: 48px !important; gap: 32px !important; }
.tr-portrait { margin: 0 0 0 auto; max-width: 250px; position: relative; }
.tr-portrait::before { content: ""; position: absolute; inset: 14px -14px -14px 14px; background: var(--tr-red); }
.tr-portrait img { position: relative; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 15%; }
@media (max-width: 781px) { .tr-portrait { margin: 0; max-width: 180px; } }
.tr-legs { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 !important; }
.tr-leg { position: relative; margin: 0 !important; background: var(--tr-paper); border-right: 1px solid var(--tr-line); display: flex; flex-direction: column; }
.tr-leg:last-child { border-right: 0; }
.tr-leg > * { margin-left: 24px !important; margin-right: 24px !important; }
.tr-leg > .tr-leg-band { margin: 0 0 22px !important; padding: 14px 24px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; color: #fff; font-family: var(--tr-display); font-style: italic; font-weight: 800; font-size: 1.5rem; text-transform: uppercase; line-height: 1; }
.tr-leg-band span:last-child { font-family: var(--tr-mono); font-style: normal; font-weight: 500; font-size: .74rem; letter-spacing: .04em; opacity: .9; }
.tr-leg-swim .tr-leg-band { background: var(--tr-lake); }
.tr-leg-bike .tr-leg-band { background: var(--tr-ink); }
.tr-leg-run .tr-leg-band { background: var(--tr-red); }
.tr-leg-finish .tr-leg-band { background: repeating-conic-gradient(var(--tr-ink) 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.tr-leg-finish .tr-leg-band span { background: var(--tr-ink); padding: 4px 8px; opacity: 1; }
.tr-leg h3 { margin-top: 0; margin-bottom: 10px; font-style: italic; font-size: 1.65rem; line-height: 1; }
.tr-leg p:last-child { margin-top: 0; margin-bottom: 28px; color: #3A3F47; font-size: .98rem; }
/* Zones de transition entre deux disciplines */
.tr-leg-swim::after, .tr-leg-bike::after { position: absolute; z-index: 2; top: 25px; right: -17px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--tr-ink); font-family: var(--tr-mono); font-size: .72rem; font-weight: 500; color: var(--tr-ink); transform: translateY(-50%); }
.tr-leg-swim::after { content: "T1"; }
.tr-leg-bike::after { content: "T2"; }
@media (max-width: 960px) {
	.tr-legs { grid-template-columns: 1fr 1fr; gap: 14px !important; }
	.tr-leg { border-right: 0; }
	.tr-leg-swim::after, .tr-leg-bike::after { display: none; }
}
@media (max-width: 560px) { .tr-legs { grid-template-columns: 1fr; } }

/* Résultats */
.tr-medals { display: grid !important; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 14px !important; margin-top: 32px !important; }
.tr-medal { border: 1px solid var(--tr-line); padding: 24px; margin: 0 !important; display: flex; flex-direction: column; gap: 6px; transition: border-color .2s ease, transform .2s ease; }
.tr-medal:hover { border-color: var(--tr-ink); transform: translateY(-3px); }
.tr-medal p { margin: 0; }
.tr-medal-rank { font-family: var(--tr-display); font-style: italic; font-weight: 800; font-size: 3.2rem; line-height: 1; color: var(--tr-ink); margin-bottom: 8px !important; }
.tr-medal-rank sup { font-size: .4em; }
.tr-medal-name { font-family: var(--tr-display); font-weight: 700; font-size: 1.4rem; line-height: 1.05; text-transform: uppercase; }
.tr-medal-meta { color: var(--tr-muted); font-size: .9rem; margin-top: auto !important; padding-top: 8px; }
.tr-medal-top { background: var(--tr-ink); color: #fff; border-color: var(--tr-ink); }
.tr-medal-top .tr-medal-rank { color: #FF5A50; font-size: 5.2rem; }
.tr-medal-top .tr-medal-name { font-size: 1.9rem; }
.tr-medal-top .tr-medal-meta { color: #B9BEC5; }
@media (max-width: 900px) { .tr-medals { grid-template-columns: 1fr 1fr; } .tr-medal-top { grid-column: 1 / -1; } }
.tr-more { margin-top: 30px !important; border-top: 1px solid var(--tr-line); padding-top: 18px; }
.tr-more summary { cursor: pointer; font-weight: 600; color: var(--tr-red-deep); }
.tr-list { margin-top: 14px; }
.tr-list table { width: 100%; border-collapse: collapse; }
.tr-list td { border: 0; border-bottom: 1px solid var(--tr-line); padding: 11px 6px; }
.tr-list td:first-child { width: 70px; font-family: var(--tr-mono); color: var(--tr-muted); font-variant-numeric: tabular-nums; }

/* Bandeau photos + citation */
.tr-strip { display: grid !important; grid-template-columns: 1fr 1.2fr 1fr; min-height: 360px; }
.tr-strip figure { margin: 0 !important; overflow: hidden; }
.tr-strip img { width: 100%; height: 100%; object-fit: cover; }
.tr-strip-quote { background: var(--tr-red); color: #fff; padding: clamp(28px, 4vw, 52px); display: flex; flex-direction: column; justify-content: center; margin: 0 !important; }
.tr-strip-quote p { margin: 0; font-family: var(--tr-display); font-style: italic; font-weight: 800; font-size: clamp(1.8rem, 2.9vw, 2.5rem); line-height: 1.02; text-transform: uppercase; }
.tr-strip-quote .tr-strip-cite { font-family: var(--tr-body); font-style: normal; font-weight: 500; text-transform: none; font-size: .95rem; margin-top: 16px; opacity: .9; }
@media (max-width: 781px) { .tr-strip { grid-template-columns: 1fr 1fr; } .tr-strip-quote { grid-column: 1 / -1; grid-row: 1; } .tr-strip figure { aspect-ratio: 1; } }

/* Partenaires */
.tr-offers { margin-top: 36px !important; margin-bottom: 0 !important; gap: 14px !important; }
.tr-offer { background: var(--tr-paper); padding: 28px; border-top: 4px solid var(--tr-line); }
.tr-offer p { margin: 0; }
.tr-offer h3 { margin: 12px 0 10px; font-style: italic; font-size: 1.9rem; line-height: 1; }
.tr-offer-tag { font-family: var(--tr-mono); font-size: .8rem; color: var(--tr-muted); }
.tr-offer-main { background: var(--tr-ink); color: #ECEEF0; border-top-color: var(--tr-red); }
.tr-offer-main .tr-offer-tag { color: #FF5A50; }
.tr-note { color: var(--tr-muted); font-size: .95rem; margin-top: 18px; max-width: 70ch; }
.tr-thanks-title { font-family: var(--tr-display); font-style: italic; font-weight: 800; font-size: 1.6rem; text-transform: uppercase; margin: 48px 0 12px; }
.tr-thanks { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.tr-thanks span { background: var(--tr-paper); border: 1px solid var(--tr-line); padding: 9px 14px; font-weight: 500; font-size: .93rem; }

/* Presse */
.tr-press { margin-top: 26px !important; border-top: 2px solid var(--tr-ink); }
.tr-press-item { display: grid; grid-template-columns: 220px 1fr; gap: 16px; margin: 0 !important; padding: 20px 0; border-bottom: 1px solid var(--tr-line); font-family: var(--tr-display); font-style: italic; font-weight: 800; font-size: 1.55rem; line-height: 1.08; text-transform: uppercase; }
.tr-press-item span { font-family: var(--tr-mono); font-style: normal; font-weight: 400; font-size: .8rem; text-transform: none; color: var(--tr-muted); padding-top: 6px; }
.tr-press-item a { color: var(--tr-ink); text-decoration: none; }
.tr-press-item a:hover { color: var(--tr-red); }
.tr-press-item a::after { content: " ↗"; color: var(--tr-red); }
@media (max-width: 600px) { .tr-press-item { grid-template-columns: 1fr; gap: 4px; } }

/* Contact */
.tr-contact { position: relative; background: var(--tr-ink); color: #ECEEF0; }
.tr-contact::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 8px; background: var(--tr-rope); }
.tr-contact-grid { margin-top: 0 !important; margin-bottom: 0 !important; gap: 40px !important; }
.tr-contact-title { font-style: italic; font-size: clamp(2.8rem, 6.4vw, 5rem) !important; font-weight: 800 !important; line-height: .9 !important; color: #fff; margin: 0 0 16px; }
.tr-contact .wp-block-buttons { align-items: stretch; }
.tr-contact .wp-block-button__link { width: 100%; text-align: center; }
.tr-contact .tr-btn-ghost .wp-block-button__link { color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6); }
.tr-contact .tr-btn-ghost .wp-block-button__link:hover { background: #fff; color: var(--tr-ink); }

/* Pied de page */
.tr-footer { background: #111317; color: #9AA0A8; padding: 26px clamp(16px, 4vw, 40px); font-size: .88rem; align-items: center; }
.tr-footer p { margin: 0; display: flex; align-items: center; gap: 12px; }
.tr-footer .tr-logo { width: 34px; height: 34px; background-image: url("assets/img/logo-arche-blanc.svg"); }

/* Pages simples */
.tr-page { padding-top: 60px; padding-bottom: 80px; }

/* 3.0.1 : bandes de discipline de même hauteur */
.tr-leg > .tr-leg-band { height: 54px; padding-top: 0; padding-bottom: 0; align-items: center; box-sizing: border-box; }
.tr-leg-finish .tr-leg-band span { padding: 3px 8px; line-height: 1.1; }
