/* ═══════════════════════════════════════════════════
   MATHS EN DIRECT — Design System v1
   Fichier : med-style.css
   À inclure dans chaque page : <link rel="stylesheet" href="med-style.css">
═══════════════════════════════════════════════════ */

/* ── Fond crème forcé en priorité absolue (avant variables CSS) ── */
html, body { background-color: #f5f0e8 !important; }

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400;1,700&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,300&family=DM+Mono&display=swap');

/* ── Variables ── */
:root {
  --cream:    #f5f0e8;
  --cream2:   #ede8de;
  --cream3:   #e4ddd2;
  --ink:      #1a1510;
  --ink2:     #3d3628;
  --muted:    #8c7f6e;
  --muted2:   #b5a898;
  --accent:   #c8400a;   /* rouge-orangé */
  --accent2:  #1a6e4a;   /* vert */
  --accent3:  #1a3a6e;   /* bleu foncé */
  --gold:     #b8860b;
  --rule:     rgba(26,21,16,0.1);
  --rule2:    rgba(26,21,16,0.06);
  --shadow:   0 2px 20px rgba(26,21,16,0.08);
  --shadow-lg: 0 8px 40px rgba(26,21,16,0.12);
  --radius:   6px;
  --radius-lg: 12px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background-color: #f5f0e8; /* fallback hex — les variables CSS ne sont pas toujours résolues au premier paint mobile */
  background-color: var(--cream);
  min-height: 100%;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

/* ── Base ── */
body {
  background-color: #f5f0e8;
  background-color: var(--cream);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Grain texture */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9999;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ══════════════════════════════════════
   NAVIGATION
══════════════════════════════════════ */
.med-nav {
  position: sticky; top: 0; z-index: 500;
  background: var(--cream);
  border-bottom: 1px solid var(--rule);
  padding: 0 32px;
}
.med-nav-inner {
  max-width: 1040px; margin: 0 auto;
  display: flex; align-items: center;
  height: 60px; gap: 0;
}
.med-logo {
  font-family: 'DM Mono', monospace;
  font-size: 13px; letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  flex-shrink: 0; margin-right: 40px;
  transition: color .2s;
}
.med-logo span { color: var(--accent); }
.med-logo:hover { color: var(--ink); }
.med-nav-links {
  display: flex; align-items: center;
  gap: 4px; flex: 1; list-style: none;
}
.med-nav-links a {
  display: block; padding: 6px 12px;
  font-size: 13px; font-weight: 400;
  color: var(--muted); text-decoration: none;
  border-radius: var(--radius);
  transition: all .2s; white-space: nowrap;
}
.med-nav-links a:hover { color: var(--ink); background: var(--cream2); }
.med-nav-links a.active { color: var(--accent); font-weight: 500; }
.med-nav-cta {
  margin-left: auto; flex-shrink: 0;
  padding: 8px 18px;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 500;
  border-radius: var(--radius); text-decoration: none;
  transition: all .2s;
  box-shadow: 0 2px 8px rgba(200,64,10,0.25);
}
.med-nav-cta:hover {
  background: #a83308;
  box-shadow: 0 4px 14px rgba(200,64,10,0.35);
  transform: translateY(-1px);
}

/* Mobile nav */
.med-nav-toggle {
  display: none; margin-left: auto;
  background: none; border: none;
  cursor: pointer; padding: 8px;
  color: var(--ink); font-size: 20px;
}
@media (max-width: 700px) {
  .med-nav { padding: 0 16px; }
  .med-nav-toggle { display: block; }
  .med-nav-links {
    display: none; position: absolute;
    top: 60px; left: 0; right: 0;
    background: var(--cream);
    border-bottom: 1px solid var(--rule);
    flex-direction: column; padding: 12px 16px; gap: 2px;
  }
  .med-nav-links.open { display: flex; }
  .med-nav-cta { display: none; }
}

/* ══════════════════════════════════════
   PAGE WRAPPER
══════════════════════════════════════ */
.med-page { max-width: 1040px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 600px) { .med-page { padding: 0 16px; } }

/* Stats bar accueil */
.med-stats {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 72px;
  background: var(--cream);
}
.med-stats-cell {
  flex: 1;
  padding: 28px 20px;
  text-align: center;
  position: relative;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.med-stats-cell + .med-stats-cell::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 1px;
  background: var(--rule);
}
.med-stats-num {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  white-space: nowrap;
}
.med-stats-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}
@media (max-width: 420px) {
  .med-stats-cell { padding: 20px 10px; }
  .med-stats-num { font-size: 26px; }
  .med-stats-label { font-size: 9px; letter-spacing: 0.5px; }
}

/* ══════════════════════════════════════
   TYPOGRAPHY
══════════════════════════════════════ */
.med-serif { font-family: 'Playfair Display', serif; }
.med-mono  { font-family: 'DM Mono', monospace; }

h1, h2, h3, h4 { font-family: 'Playfair Display', serif; font-weight: 700; line-height: 1.15; color: var(--ink); }

.med-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 4px;
  text-transform: uppercase; color: var(--accent);
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.med-label::before {
  content: ''; display: inline-block;
  width: 20px; height: 1px; background: var(--accent);
}

/* ══════════════════════════════════════
   HERO — page header
══════════════════════════════════════ */
.med-hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 64px;
}
.med-hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(36px, 5.5vw, 62px);
  font-weight: 900; line-height: 1.08;
  max-width: 700px; margin-bottom: 20px;
}
.med-hero-title em { font-style: italic; color: var(--accent); }
.med-hero-desc {
  font-size: 17px; font-weight: 300;
  color: var(--ink2); max-width: 540px;
  line-height: 1.8;
}
@media (max-width: 600px) {
  .med-hero { padding: 48px 0 40px; margin-bottom: 40px; }
}

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.med-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  text-decoration: none; border: none; cursor: pointer;
  transition: all .2s; font-family: 'DM Sans', sans-serif;
}
.med-btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 3px 12px rgba(200,64,10,0.25);
}
.med-btn-primary:hover {
  background: #a83308; transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(200,64,10,0.35);
}
.med-btn-outline {
  background: transparent; color: var(--ink2);
  border: 1px solid var(--rule2);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.med-btn-outline:hover { border-color: var(--ink2); background: var(--cream2); }
.med-btn-discord {
  background: #5865f2; color: #fff;
  box-shadow: 0 3px 12px rgba(88,101,242,0.3);
}
.med-btn-discord:hover {
  background: #4752c4; transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(88,101,242,0.4);
}
.med-btn-lg { padding: 16px 32px; font-size: 16px; }

/* ══════════════════════════════════════
   CARDS
══════════════════════════════════════ */
.med-card {
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all .25s;
}
.med-card:hover {
  border-color: var(--muted2);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.med-card-img {
  aspect-ratio: 16/9; overflow: hidden;
  background: var(--cream2);
}
.med-card-img img { width: 100%; height: 100%; object-fit: cover; }
.med-card-body { padding: 24px; }
.med-card-tag {
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 10px;
}
.med-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px; font-weight: 700;
  line-height: 1.25; margin-bottom: 10px;
  color: var(--ink);
}
.med-card-excerpt {
  font-size: 14px; color: var(--muted);
  line-height: 1.7; margin-bottom: 16px;
}
.med-card-meta {
  font-size: 12px; color: var(--muted2);
  font-family: 'DM Mono', monospace;
  display: flex; gap: 12px; align-items: center;
}
.med-card-link {
  display: block; text-decoration: none; color: inherit;
}

/* ══════════════════════════════════════
   ARTICLE GRID
══════════════════════════════════════ */
.med-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.med-grid-featured {
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
@media (max-width: 700px) {
  .med-grid, .med-grid-featured { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════
   SIDEBAR LAYOUT
══════════════════════════════════════ */
.med-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px; align-items: start;
}
@media (max-width: 800px) {
  .med-layout { grid-template-columns: 1fr; }
}
.med-sidebar { display: flex; flex-direction: column; gap: 28px; }
.med-sidebar-block {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.med-sidebar-block-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
  background: var(--cream2);
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 3px;
  text-transform: uppercase; color: var(--muted);
}
.med-sidebar-block-body { padding: 18px; }

/* ══════════════════════════════════════
   DIVIDER
══════════════════════════════════════ */
.med-divider {
  height: 1px; background: var(--rule);
  margin: 48px 0;
}
.med-divider-sm { margin: 24px 0; }

/* ══════════════════════════════════════
   SECTION HEADER
══════════════════════════════════════ */
.med-section-header {
  display: flex; align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px; padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.med-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px; font-weight: 700;
}
.med-section-link {
  font-size: 13px; color: var(--muted);
  text-decoration: none; font-weight: 400;
  transition: color .2s;
}
.med-section-link:hover { color: var(--accent); }

/* ══════════════════════════════════════
   DISCORD CTA BLOCK
══════════════════════════════════════ */
.med-discord-block {
  background: #5865f2;
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  color: #fff; text-align: center;
}
.med-discord-block h3 {
  font-family: 'Playfair Display', serif;
  font-size: 22px; color: #fff;
  margin-bottom: 10px;
}
.med-discord-block p {
  font-size: 14px; opacity: .85;
  margin-bottom: 20px; line-height: 1.7;
}
.med-discord-block .med-btn {
  background: #fff; color: #5865f2;
  font-weight: 700;
}
.med-discord-block .med-btn:hover { background: #e8eaff; transform: translateY(-2px); }
.med-discord-stat {
  font-family: 'Playfair Display', serif;
  font-size: 36px; font-weight: 900;
  color: #fff; display: block;
  margin-bottom: 4px;
}
.med-discord-stat-label { font-size: 12px; opacity: .7; }

/* ══════════════════════════════════════
   RESOURCE LINK
══════════════════════════════════════ */
.med-resource {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
  transition: all .2s; background: var(--cream);
  margin-bottom: 10px;
}
.med-resource:hover {
  border-color: var(--muted2);
  background: var(--cream2);
  transform: translateX(4px);
}
.med-resource-icon {
  font-size: 24px; flex-shrink: 0;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--cream2); border-radius: var(--radius);
}
.med-resource-title { font-weight: 500; font-size: 14px; }
.med-resource-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.med-resource-arrow { margin-left: auto; color: var(--muted2); font-size: 16px; }

/* ══════════════════════════════════════
   COMING SOON
══════════════════════════════════════ */
.med-coming-soon {
  text-align: center; padding: 80px 20px;
}
.med-coming-soon-icon {
  font-size: 56px; margin-bottom: 20px;
  opacity: .5;
}
.med-coming-soon h2 {
  font-family: 'Playfair Display', serif;
  font-size: 28px; margin-bottom: 12px;
}
.med-coming-soon p {
  color: var(--muted); max-width: 400px;
  margin: 0 auto 28px; font-size: 15px;
}

/* ══════════════════════════════════════
   FOOTER
══════════════════════════════════════ */
.med-footer {
  margin-top: 80px;
  border-top: 1px solid var(--rule);
  background: var(--cream2);
}
.med-footer-inner {
  max-width: 1040px; margin: 0 auto;
  padding: 48px 32px 32px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
}
@media (max-width: 700px) {
  .med-footer-inner { grid-template-columns: 1fr; gap: 32px; padding: 32px 16px 24px; }
}
.med-footer-brand {}
.med-footer-logo {
  font-family: 'DM Mono', monospace;
  font-size: 13px; letter-spacing: 3px;
  color: var(--muted); text-transform: uppercase;
  text-decoration: none; display: block; margin-bottom: 14px;
}
.med-footer-logo span { color: var(--accent); }
.med-footer-tagline {
  font-size: 14px; color: var(--muted);
  line-height: 1.7; max-width: 280px;
}
.med-footer-col-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 3px;
  text-transform: uppercase; color: var(--muted2);
  margin-bottom: 14px;
}
.med-footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.med-footer-links a {
  font-size: 14px; color: var(--muted);
  text-decoration: none; transition: color .2s;
}
.med-footer-links a:hover { color: var(--ink); }
.med-footer-bottom {
  border-top: 1px solid var(--rule);
  padding: 16px 32px;
  max-width: 1040px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted2);
}
@media (max-width: 600px) { .med-footer-bottom { padding: 16px; flex-direction: column; gap: 6px; text-align: center; } }
.med-footer-social { display: flex; gap: 14px; }
.med-footer-social a { color: var(--muted2); text-decoration: none; transition: color .2s; font-size: 13px; }
.med-footer-social a:hover { color: var(--ink); }

/* ══════════════════════════════════════
   UTILITIES
══════════════════════════════════════ */
.med-mt-sm  { margin-top: 12px; }
.med-mt     { margin-top: 24px; }
.med-mt-lg  { margin-top: 48px; }
.med-mb-sm  { margin-bottom: 12px; }
.med-mb     { margin-bottom: 24px; }
.med-mb-lg  { margin-bottom: 48px; }
.med-text-muted { color: var(--muted); }
.med-text-center { text-align: center; }
.med-flex   { display: flex; }
.med-gap    { gap: 12px; }
.med-gap-lg { gap: 24px; }

/* Scroll reveal */
.med-reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity .55s ease, transform .55s ease;
}
.med-reveal.visible { opacity: 1; transform: translateY(0); }
