/* ==========================================================================
   Le Ratier Bretonnien — Base CSS
   Journal Papier Theme — Design Tokens & Global Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
	/* Fonds — papier journal, parchemin */
	--rb-bg:              #f5f0e8;
	--rb-surface:         #ede7d9;
	--rb-card:            #e6dfc8;
	--rb-elevated:        #ddd5bc;
	--rb-border:          rgba(100, 75, 30, 0.22);
	--rb-border-light:    rgba(100, 75, 30, 0.12);

	/* Bronze doré — ornements, décors */
	--rb-gold:            #7a5c1e;    /* WCAG AA 5:1 sur fond crème */
	--rb-gold-light:      #9a7830;
	--rb-gold-dark:       #523c14;
	--rb-gold-glow:       rgba(122, 92, 30, 0.16);

	/* Encre sombre — titres */
	--rb-heading:         #1a1208;
	--rb-heading-dim:     #3a2e18;

	/* Sang & Hérésie — accent principal de l'interface */
	--rb-crimson:         #8a1515;    /* structural (bordures, ornements) */
	--rb-crimson-light:   #b02020;    /* WCAG AA 6:1 sur fond #f5f0e8 */
	--rb-crimson-dim:     #5a0e0e;
	--rb-crimson-glow:    rgba(138, 21, 21, 0.14);

	/* Texte — encre patinée */
	--rb-text:            #2a2010;    /* WCAG AAA 14.6:1 */
	--rb-text-sepia:      #4a3820;    /* WCAG AA 10:1 */
	--rb-text-muted:      #6a5535;    /* WCAG AA 6.3:1 */

	/* Typographie */
	--rb-font-display:    'Cinzel Decorative', Georgia, 'Times New Roman', serif;
	--rb-font-heading:    'Cinzel', Georgia, 'Times New Roman', serif;
	--rb-font-body:       'EB Garamond', Georgia, 'Times New Roman', serif;
	--rb-font-mono:       'Courier Prime', 'Courier New', monospace;

	/* Effets */
	--rb-shadow-card:     0 2px 12px rgba(80, 55, 20, 0.14);
	--rb-shadow-gold:     0 0 16px rgba(122, 92, 30, 0.22);
	--rb-shadow-crimson:  0 0 20px rgba(138, 21, 21, 0.16);
	--rb-shadow-deep:     0 4px 32px rgba(80, 55, 20, 0.22);
	--rb-transition:      0.25s ease;

	/* Layout */
	--rb-content-width:   860px;
	--rb-wide-width:      1200px;
	--rb-sidebar-width:   280px;
}

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

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

body {
	margin: 0;
	padding: 0;
	background-color: var(--rb-bg);
	color: var(--rb-text);
	font-family: var(--rb-font-body);
	font-size: clamp(1rem, 1.5vw, 1.125rem);
	line-height: 1.85;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Texture de fond — grain papier journal sur fond crème */
body::before {
	content: '';
	position: fixed;
	inset: 0;
	z-index: -1;
	opacity: 0.045;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23noise)'/%3E%3C/svg%3E");
	pointer-events: none;
}

/* --------------------------------------------------------------------------
   Typographie globale
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
	font-family: var(--rb-font-display);
	font-weight: 700;
	line-height: 1.25;
	color: var(--rb-heading);
	letter-spacing: 0.03em;
	margin-top: 0;
}

/* Site title keeps a large size; article headings are reduced below */
h1 { font-size: clamp(1.26rem, 2.7vw, 1.8rem); }
h2 { font-family: var(--rb-font-heading); font-size: clamp(0.95rem, 1.8vw, 1.22rem); letter-spacing: 0.05em; }
h3 { font-family: var(--rb-font-heading); font-size: clamp(0.86rem, 1.6vw, 1.04rem); }
h4 { font-family: var(--rb-font-heading); font-size: 0.9rem; color: var(--rb-text-sepia); }
h5 { font-family: var(--rb-font-heading); font-size: 0.8rem; color: var(--rb-text-sepia); text-transform: uppercase; letter-spacing: 0.08em; }
h6 { font-family: var(--rb-font-heading); font-size: 0.75rem; color: var(--rb-text-muted); text-transform: uppercase; letter-spacing: 0.1em; }

/* Site header title — inside hero it gets a large size via components.css;
   keep a fallback here but don't fight the hero's !important rules */
.wp-block-site-title,
.wp-block-site-title a {
	font-family: var(--rb-font-display) !important;
	font-size: clamp(1.5rem, 3.5vw, 2.2rem);
}

/* Article post title — clearly distinct from section headings but not huge */
.wp-block-post-title {
	font-family: var(--rb-font-display) !important;
	font-size: clamp(1.17rem, 2.7vw, 1.58rem) !important;
	line-height: 1.3 !important;
	letter-spacing: 0.03em !important;
}

p {
	margin-top: 0;
	margin-bottom: 1.25em;
	color: var(--rb-text);
}

a {
	color: var(--rb-gold);
	text-decoration: none;
	transition: color var(--rb-transition);
}

a:hover,
a:focus {
	color: var(--rb-gold-light);
	text-decoration: underline;
}

a:focus-visible {
	outline: 2px solid var(--rb-gold);
	outline-offset: 3px;
	border-radius: 2px;
}

strong, b {
	font-weight: 600;
	color: var(--rb-text);
}

em, i {
	font-style: italic;
}

blockquote {
	margin: 2em 0;
	padding: 1.5em 2em;
	background: var(--rb-surface);
	border-left: 4px solid var(--rb-gold);
	border-right: 1px solid var(--rb-border);
	border-top: 1px solid var(--rb-border);
	border-bottom: 1px solid var(--rb-border);
	color: var(--rb-text-sepia);
	font-style: italic;
	font-size: 1.125em;
	position: relative;
}

blockquote::before {
	content: '\201C';
	position: absolute;
	top: -0.3em;
	left: 0.5em;
	font-size: 4em;
	font-family: var(--rb-font-display);
	color: var(--rb-gold-dark);
	line-height: 1;
	opacity: 0.5;
}

blockquote cite,
blockquote .wp-block-quote__citation {
	display: block;
	margin-top: 1em;
	font-size: 0.85em;
	font-style: normal;
	font-family: var(--rb-font-heading);
	color: var(--rb-text-muted);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

code {
	font-family: var(--rb-font-mono);
	font-size: 0.9em;
	background: var(--rb-surface);
	color: var(--rb-gold-light);
	padding: 0.15em 0.4em;
	border-radius: 2px;
	border: 1px solid var(--rb-border);
}

pre {
	background: var(--rb-surface);
	border: 1px solid var(--rb-border);
	border-radius: 2px;
	padding: 1.5em;
	overflow-x: auto;
	margin: 2em 0;
}

pre code {
	background: none;
	border: none;
	padding: 0;
	font-size: 0.875em;
	line-height: 1.7;
}

hr {
	border: none;
	border-top: 1px solid var(--rb-border);
	margin: 2em auto;
}

table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.5em 0;
	font-family: var(--rb-font-body);
	font-size: 0.95em;
}

th {
	background: var(--rb-surface);
	color: var(--rb-gold);
	font-family: var(--rb-font-heading);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 0.75em 1em;
	border: 1px solid var(--rb-border);
	text-align: left;
}

td {
	padding: 0.65em 1em;
	border: 1px solid var(--rb-border);
	color: var(--rb-text-sepia);
	vertical-align: top;
}

tr:nth-child(even) td {
	background: rgba(100, 75, 30, 0.04);
}

ul, ol {
	padding-left: 1.5em;
	margin-bottom: 1.25em;
}

li {
	margin-bottom: 0.35em;
	color: var(--rb-text);
}

li::marker {
	color: var(--rb-gold-dark);
}

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

figure {
	margin: 2em 0;
}

figcaption {
	margin-top: 0.5em;
	font-family: var(--rb-font-heading);
	font-size: 0.8125rem;
	color: var(--rb-text-muted);
	letter-spacing: 0.05em;
	text-align: center;
	font-style: italic;
}

/* --------------------------------------------------------------------------
   Formulaires
   -------------------------------------------------------------------------- */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
	width: 100%;
	background: var(--rb-surface);
	border: 1px solid var(--rb-border);
	color: var(--rb-text);
	font-family: var(--rb-font-body);
	font-size: 1rem;
	padding: 0.6em 0.9em;
	border-radius: 2px;
	transition: border-color var(--rb-transition), box-shadow var(--rb-transition);
	appearance: none;
	-webkit-appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: var(--rb-gold);
	box-shadow: 0 0 0 3px var(--rb-gold-glow);
}

input::placeholder,
textarea::placeholder {
	color: var(--rb-text-muted);
	font-style: italic;
}

button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
	cursor: pointer;
	font-family: var(--rb-font-heading);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	padding: 0.6em 1.6em;
	background: transparent;
	color: var(--rb-gold);
	border: 1px solid var(--rb-gold);
	border-radius: 2px;
	transition: background-color var(--rb-transition), color var(--rb-transition), box-shadow var(--rb-transition);
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
	background: var(--rb-gold);
	color: var(--rb-bg);
	box-shadow: var(--rb-shadow-gold);
}

label {
	display: block;
	font-family: var(--rb-font-heading);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--rb-text-sepia);
	margin-bottom: 0.4em;
}

/* --------------------------------------------------------------------------
   Utilitaires
   -------------------------------------------------------------------------- */
.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	background-color: var(--rb-surface);
	clip: auto;
	clip-path: none;
	color: var(--rb-gold);
	display: block;
	font-size: 0.875rem;
	height: auto;
	left: 5px;
	line-height: normal;
	padding: 0.75rem 1.5rem;
	text-decoration: none;
	top: 5px;
	width: auto;
	z-index: 100000;
	border: 1px solid var(--rb-gold);
}

/* --------------------------------------------------------------------------
   Alignements (WordPress core)
   -------------------------------------------------------------------------- */
.alignnone {
	margin: 1em 0;
}

.aligncenter {
	display: block;
	margin: 1.5em auto;
}

.alignleft {
	float: left;
	margin: 0.5em 1.5em 1em 0;
}

.alignright {
	float: right;
	margin: 0.5em 0 1em 1.5em;
}

@media (max-width: 600px) {
	.alignleft,
	.alignright {
		float: none;
		margin: 1em 0;
	}
}

/* --------------------------------------------------------------------------
   Skip Link
   -------------------------------------------------------------------------- */
.skip-link {
	position: absolute;
	top: -100%;
	left: 0;
	z-index: 9999;
	padding: 0.5em 1em;
	background: var(--rb-gold);
	color: var(--rb-bg);
	font-family: var(--rb-font-heading);
	font-weight: 600;
	text-decoration: none;
}

.skip-link:focus {
	top: 0;
}
