/*
Theme Name: KASIS Media
Theme URI: https://kasis.eu
Author: KASIS
Description: Thème de démonstration pour éditeurs (automobile / voyage) avec emplacements publicitaires intégrés, compatible Polylang (FR/NL). Fonctionne avec le plugin KASIS AdStack.
Version: 1.0.1
Requires at least: 6.4
Requires PHP: 7.4
License: GPLv2 or later
Text Domain: kasis-media
*/

/* ---------- Tokens ---------- */
:root {
	--wrap: 1200px;
	--gutter: 16px;
	--gap: 40px;
	--side: 300px;
	--radius: 3px;

	/* automotive (default) */
	--ink: #15191e;
	--muted: #5d6772;
	--paper: #ffffff;
	--surface: #f0f2f4;
	--line: #d9dee3;
	--head-bg: #232a31;
	--head-ink: #f4f6f8;
	--accent: #f2c230;
	--accent-ink: #15191e;
	--link: #15191e;
	--link-hover: #8a6a00;

	--font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
	--font-body: "Barlow", "Helvetica Neue", Arial, sans-serif;
	--display-weight: 700;
	--display-tracking: 0;
}

body.vertical-travel {
	--ink: #13262e;
	--muted: #557079;
	--paper: #ffffff;
	--surface: #eef6f7;
	--line: #d3e4e7;
	--head-bg: #0e3e4f;
	--head-ink: #f2fafb;
	--accent: #f2a65a;
	--accent-ink: #13262e;
	--link: #0b5f67;
	--link-hover: #0e7c86;

	--font-display: "Fraunces", Georgia, "Times New Roman", serif;
	--font-body: "Work Sans", "Helvetica Neue", Arial, sans-serif;
	--display-weight: 600;
	--display-tracking: -0.01em;
}

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

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

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 1rem;
	line-height: 1.55;
	overflow-x: hidden;
}

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

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.screen-reader-text,
.skip-link:not(:focus) {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap;
}
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 1000; background: var(--paper); padding: 8px 12px; }

.wrap {
	max-width: var(--wrap);
	margin: 0 auto;
	padding: 0 var(--gutter);
}

h1, h2, h3 {
	font-family: var(--font-display);
	font-weight: var(--display-weight);
	letter-spacing: var(--display-tracking);
	line-height: 1.12;
	margin: 0;
}

/* ---------- Top bar & masthead ---------- */
.topbar {
	background: var(--head-bg);
	color: var(--head-ink);
	font-size: .8125rem;
	border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.topbar__inner { display: flex; justify-content: space-between; align-items: center; min-height: 34px; }
.topbar__date { opacity: .75; }

.lang-switch { display: flex; gap: 2px; }
.lang-switch a {
	color: inherit;
	text-decoration: none;
	padding: 3px 8px;
	border-radius: var(--radius);
	font-weight: 600;
	letter-spacing: .04em;
	opacity: .7;
}
.lang-switch a:hover { opacity: 1; color: inherit; }
.lang-switch a.is-current { background: var(--accent); color: var(--accent-ink); opacity: 1; }

.masthead { background: var(--head-bg); color: var(--head-ink); position: relative; }
.masthead__inner {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 24px;
	padding-top: 22px;
	padding-bottom: 18px;
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand:hover { color: inherit; }
.brand__name {
	font-family: var(--font-display);
	font-weight: var(--display-weight);
	font-size: 2.25rem;
	line-height: 1;
	letter-spacing: var(--display-tracking);
}
.brand__mark { width: 30px; height: 30px; flex: none; }

/* Automotive: a lane-marking slab. */
body.vertical-automotive .brand__mark {
	background: var(--accent);
	transform: skewX(-18deg);
	width: 14px;
	height: 32px;
	box-shadow: 22px 0 0 var(--accent);
	margin-right: 22px;
}
/* Travel: a low sun over the sea line. */
body.vertical-travel .brand__mark {
	border-radius: 50%;
	background: radial-gradient(circle at 50% 50%, var(--accent) 0 58%, transparent 60%);
	box-shadow: inset 0 -9px 0 -3px var(--head-bg);
	border-bottom: 3px solid #5fc3c9;
}

.masthead__tagline { margin: 0; opacity: .7; font-size: .9375rem; }

.search input {
	width: 230px;
	font: inherit;
	font-size: .875rem;
	color: var(--ink);
	background: var(--paper);
	border: 0;
	border-radius: var(--radius);
	padding: 9px 12px;
}

/* Signature divider: dashed lane marking (automotive) / perforated ticket edge (travel). */
.masthead::after {
	content: "";
	display: block;
	height: 6px;
	background: var(--head-bg);
}
body.vertical-automotive .masthead::after {
	background:
		repeating-linear-gradient(90deg, var(--accent) 0 46px, transparent 46px 78px) center / auto 4px no-repeat,
		var(--head-bg);
	height: 14px;
}
body.vertical-travel .masthead::after {
	height: 12px;
	background:
		radial-gradient(circle at 8px 12px, var(--paper) 5px, transparent 5.5px) 0 0 / 16px 12px repeat-x,
		var(--head-bg);
}

.nav { background: var(--head-bg); border-top: 1px solid rgba(255, 255, 255, .08); }
.nav__list {
	list-style: none;
	margin: 0 auto;
	display: flex;
	gap: 4px;
	overflow-x: auto;
	scrollbar-width: none;
}
.nav__list::-webkit-scrollbar { display: none; }
.nav__list a {
	display: block;
	white-space: nowrap;
	color: var(--head-ink);
	text-decoration: none;
	padding: 12px 12px 11px;
	font-weight: 500;
	border-bottom: 3px solid transparent;
}
.nav__list a:hover { color: var(--head-ink); border-bottom-color: rgba(255, 255, 255, .35); }
.nav__list a[aria-current="page"] { border-bottom-color: var(--accent); }
body.vertical-automotive .nav__list a { font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; }

/* ---------- Ad bands ---------- */
.ad-band { background: var(--surface); padding: 14px 0; }
.ad-band .wrap { display: flex; justify-content: center; }
.ad-band--footer { margin-top: 48px; }
.ad-inline { margin: 8px 0 40px; display: flex; justify-content: center; }
.ad-inline--grid { grid-column: 1 / -1; margin: 4px 0 12px; }

/* ---------- Layout ---------- */
.layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--side);
	gap: var(--gap);
	padding-top: 32px;
	align-items: start;
}
.sidebar { display: flex; flex-direction: column; gap: 32px; }
.sidebar__sticky { position: sticky; top: 16px; }

/* ---------- Titles ---------- */
.block-title {
	font-size: 1.5rem;
	display: flex;
	align-items: center;
	gap: 10px;
}
.block-title a { color: inherit; text-decoration: none; }
.block-title a:hover { color: var(--link-hover); }
body.vertical-automotive .block-title::before {
	content: "";
	width: 8px; height: 22px;
	background: var(--accent);
	transform: skewX(-18deg);
}
body.vertical-travel .block-title::before {
	content: "";
	width: 10px; height: 10px;
	border-radius: 50%;
	background: var(--accent);
}

.section-tag {
	display: inline-block;
	font-size: .8125rem;
	font-weight: 600;
	color: var(--accent-ink);
	background: var(--accent);
	text-decoration: none;
	padding: 1px 8px;
	border-radius: var(--radius);
	margin-bottom: 8px;
}
.section-tag:hover { color: var(--accent-ink); filter: brightness(.95); }
body.vertical-travel .section-tag { border-radius: 999px; padding: 1px 10px; }

/* ---------- Cards ---------- */
.card { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card__media { display: block; overflow: hidden; border-radius: var(--radius); background: var(--surface); aspect-ratio: 16 / 9; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__placeholder { display: block; width: 100%; height: 100%; background: var(--surface); }
.card__title { font-size: 1.3rem; }
.card__title a { color: var(--ink); text-decoration: none; }
.card__title a:hover { color: var(--link-hover); text-decoration: underline; }
.card__excerpt { margin: 6px 0 0; color: var(--muted); }
.card__meta { margin: 6px 0 0; color: var(--muted); font-size: .8125rem; }

.card--lead .card__title { font-size: clamp(1.75rem, 3.4vw, 2.6rem); }
.card--lead .card__excerpt { font-size: 1.0625rem; }
body.vertical-automotive .card--lead .card__title { font-size: clamp(2rem, 4vw, 3rem); }

.card--compact {
	display: grid;
	grid-template-columns: 112px minmax(0, 1fr);
	gap: 12px;
	align-items: start;
}
.card--compact .card__title { font-size: 1.05rem; line-height: 1.2; }
body.vertical-travel .card--compact .card__title { font-family: var(--font-body); font-weight: 600; font-size: 1rem; letter-spacing: 0; }
.card--compact .card__media { aspect-ratio: 3 / 2; }

/* ---------- Home ---------- */
.front-top {
	display: grid;
	grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
	gap: 28px;
	padding-bottom: 36px;
	margin-bottom: 36px;
	border-bottom: 1px solid var(--line);
}
.front-top__latest { display: flex; flex-direction: column; gap: 18px; }
.front-top__latest .block-title { font-size: 1.2rem; }

.block { margin-bottom: 40px; }
.block__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	padding-bottom: 10px;
	margin-bottom: 18px;
	border-bottom: 2px solid var(--ink);
}
.block__more { font-size: .875rem; font-weight: 600; white-space: nowrap; }
.block__grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; }
.block__stack { display: flex; flex-direction: column; gap: 18px; }

.block--video { background: var(--head-bg); color: var(--head-ink); padding: 20px; border-radius: var(--radius); }
.block--video .block__head { border-bottom-color: rgba(255, 255, 255, .25); }

/* ---------- Archive ---------- */
.page-head { padding-bottom: 18px; margin-bottom: 28px; border-bottom: 2px solid var(--ink); }
.page-head__title { font-size: clamp(2rem, 4vw, 3rem); }
.page-head__desc { color: var(--muted); max-width: 62ch; margin-top: 8px; }
.page-head__desc p { margin: 0; }

.archive-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 28px; }
.archive-grid .card--lead { grid-column: 1 / -1; }

.pager { display: flex; justify-content: space-between; margin-top: 36px; font-weight: 600; }
.empty { color: var(--muted); }

/* ---------- Article ---------- */
.article { min-width: 0; }
.crumbs { font-size: .875rem; color: var(--muted); display: flex; gap: 8px; margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.article__title { font-size: clamp(2rem, 4.2vw, 3.1rem); max-width: 22ch; }
body.vertical-automotive .article__title { font-size: clamp(2.2rem, 4.8vw, 3.5rem); }
.article__standfirst { font-size: 1.25rem; line-height: 1.45; color: var(--muted); margin: 16px 0 0; max-width: 60ch; }
.article__byline {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	font-size: .875rem;
	color: var(--muted);
	margin: 18px 0 0;
	padding: 12px 0;
	border-top: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
}
.article__byline span:first-child { color: var(--ink); font-weight: 600; }
.article__figure { margin: 24px 0 28px; }
.article__figure img { width: 100%; border-radius: var(--radius); }
.article__figure figcaption { font-size: .8125rem; color: var(--muted); margin-top: 8px; }
.article__figure figcaption a { color: inherit; }

.prose { max-width: 68ch; font-size: 1.125rem; line-height: 1.68; }
.prose p { margin: 0 0 1.15em; }
.prose h2 { font-size: 1.65rem; margin: 1.6em 0 .55em; }
.prose ul { padding-left: 1.2em; margin: 0 0 1.2em; }
.prose li { margin-bottom: .35em; }
.prose li::marker { color: var(--link-hover); }
.prose .kasis-ad-wrap { margin: 2em 0; }

.article__tags ul { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.article__tags a {
	display: inline-block;
	font-size: .875rem;
	text-decoration: none;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--line);
	padding: 4px 10px;
	border-radius: 999px;
}
.article__tags a:hover { border-color: var(--ink); }

.related { margin-top: 48px; padding-top: 18px; border-top: 2px solid var(--ink); }
.related .block-title { margin-bottom: 18px; }
.related__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.related .card__title { font-size: 1.1rem; }
.related .card__excerpt { display: none; }

/* ---------- Sidebar panel ---------- */
.panel__title { font-size: 1.25rem; padding-bottom: 8px; border-bottom: 2px solid var(--ink); margin-bottom: 8px; }
.ranked { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.ranked li {
	counter-increment: rank;
	display: grid;
	grid-template-columns: 34px 1fr;
	gap: 8px;
	padding: 12px 0;
	border-bottom: 1px solid var(--line);
	line-height: 1.3;
}
.ranked li::before {
	content: counter(rank);
	font-family: var(--font-display);
	font-weight: var(--display-weight);
	font-size: 1.75rem;
	line-height: 1;
	color: var(--link-hover);
}
body.vertical-automotive .ranked li::before { color: var(--ink); -webkit-text-stroke: 0; text-shadow: 2px 2px 0 var(--accent); }
.ranked a { color: var(--ink); text-decoration: none; font-weight: 500; }
.ranked a:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer { background: var(--head-bg); color: var(--head-ink); padding: 40px 0 20px; font-size: .9375rem; }
.site-footer a, .site-footer .linklike { color: var(--head-ink); }
.site-footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer__title { font-size: 1.1rem; margin-bottom: 10px; }
.site-footer__note { opacity: .75; max-width: 46ch; }
.brand--footer .brand__name { font-size: 1.75rem; }
.site-footer__base {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 32px;
	padding-top: 16px;
	border-top: 1px solid rgba(255, 255, 255, .15);
	opacity: .85;
}
.linklike { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }

.button {
	display: inline-block;
	background: var(--ink);
	color: var(--paper);
	text-decoration: none;
	padding: 10px 16px;
	border-radius: var(--radius);
	font-weight: 600;
}
.button:hover { color: var(--paper); background: var(--link-hover); }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
	.layout { grid-template-columns: minmax(0, 1fr); }
	.sidebar { align-items: center; }
	.sidebar .panel { width: 100%; }
	.sidebar__sticky { position: static; }
	.masthead__inner { grid-template-columns: auto 1fr; }
	.masthead__tagline { display: none; }
	.search { justify-self: end; }
}

@media (max-width: 767px) {
	:root { --gap: 28px; }
	.masthead__inner { grid-template-columns: 1fr; gap: 12px; padding-top: 16px; padding-bottom: 12px; }
	.search { justify-self: stretch; }
	.search input { width: 100%; }
	.brand__name { font-size: 1.85rem; }
	.front-top, .block__grid { grid-template-columns: minmax(0, 1fr); }
	.archive-grid, .related__grid { grid-template-columns: minmax(0, 1fr); }
	.site-footer__grid { grid-template-columns: 1fr; }
	.prose { font-size: 1.0625rem; }
	.block--video { padding: 14px; margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
	* { scroll-behavior: auto !important; transition: none !important; }
}
