:root {
  --green: #0f3b2e;
  --green-2: #164d3c;
  --gold: #c9a54c;
  --gold-2: #e3c77d;
  --sand: #f7f1e3;
  --sand-2: #efe5cd;
  --ink: #1f2a24;
  --muted: #5b6b62;
  --card: #fffdf7;
  --line: #e2d6b5;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(15, 59, 46, .10);
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23c9a54c' stroke-opacity='.18' stroke-width='1'%3E%3Cpath d='M40 8l9 13 15-3-3 15 13 9-13 9 3 15-15-3-9 13-9-13-15 3 3-15-13-9 13-9-3-15 15 3z'/%3E%3Ccircle cx='40' cy='40' r='10'/%3E%3C/g%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--sand);
  overflow-x: hidden;
}
h1, h2, h3 { font-family: "Cormorant Garamond", Georgia, serif; line-height: 1.15; color: var(--green); }
h2 { font-size: clamp(2rem, 4vw, 2.8rem); margin: 0 0 .4em; text-align: center; }
h2::after { content: ""; display: block; width: 64px; height: 3px; margin: .35em auto 0; background: var(--gold); border-radius: 2px; }
h3 { font-size: 1.45rem; margin: 0 0 .5em; }
a { color: var(--green-2); }
.arabic { font-family: "Amiri", serif; direction: rtl; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 680px; }
.lead { text-align: center; max-width: 760px; margin: 0 auto 2rem; color: var(--muted); font-size: 1.1rem; }
.note, .small { color: var(--muted); font-size: .92rem; }
.note { text-align: center; margin-top: 1.5rem; }

/* Boutons */
.btn {
  display: inline-block; border: 0; cursor: pointer; text-decoration: none;
  font: 600 1rem "Source Sans 3", sans-serif; padding: .75em 1.5em; border-radius: 999px;
  transition: transform .15s, background .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-gold { background: var(--gold); color: var(--green); }
.btn-gold:hover { background: var(--gold-2); }
.btn-ghost { background: transparent; color: var(--gold-2); border: 1.5px solid var(--gold); }
.btn-small { padding: .45em 1em; font-size: .9rem; }
.link-btn { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; opacity: .8; }
.icon-btn { background: none; border: 1.5px solid var(--gold); color: var(--gold-2); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; }
.icon-btn[aria-pressed="true"] { background: var(--gold); color: var(--green); }

/* Écran d'accueil */
.welcome {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: var(--pattern), radial-gradient(circle at 50% 40%, #1d5c48, var(--green) 70%);
  color: var(--sand); text-align: center; transition: opacity .6s;
}
.welcome.hide { opacity: 0; pointer-events: none; }
.welcome-ar { font-size: clamp(3.5rem, 12vw, 6.5rem); color: var(--gold); margin: 0; line-height: 1.3; }
.welcome h1 { color: var(--sand); font-size: clamp(2.4rem, 7vw, 4rem); margin: 0 0 .2em; letter-spacing: .04em; }
.welcome-sub { max-width: 520px; margin: 0 auto 1.5rem; opacity: .85; }
.lang-pick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 1.5rem; }
.lang-pick button { background: transparent; color: var(--sand); border: 1px solid rgba(227,199,125,.5); border-radius: 999px; padding: .4em 1em; cursor: pointer; font: inherit; }
.lang-pick button.active { background: var(--gold); color: var(--green); border-color: var(--gold); }
.welcome .btn { display: block; margin: 0 auto .8rem; font-size: 1.1rem; }

/* Barre du haut */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: var(--green); color: var(--sand); box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.brand { color: var(--sand); text-decoration: none; font: 700 1.3rem "Cormorant Garamond", serif; white-space: nowrap; }
.brand .arabic { color: var(--gold); font-size: 1.3rem; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav a { color: var(--sand); text-decoration: none; padding: .35em .7em; border-radius: 8px; font-size: .95rem; }
.nav a:hover { background: var(--green-2); color: var(--gold-2); }
.tools { display: flex; gap: 8px; align-items: center; }
#lang-select { background: var(--green-2); color: var(--sand); border: 1px solid var(--gold); border-radius: 8px; padding: .3em .4em; font: inherit; }
.menu-toggle { display: none; margin-left: auto; background: none; border: 0; color: var(--gold-2); font-size: 1.6rem; cursor: pointer; }

/* Hero */
.hero {
  background: var(--pattern), linear-gradient(160deg, var(--green) 0%, #1a5240 100%);
  color: var(--sand); text-align: center; padding: clamp(64px, 12vw, 130px) 16px;
}
.hero-ar { font-size: clamp(1.6rem, 4vw, 2.3rem); color: var(--gold); margin: 0; }
.hero-basmala { margin: .2em 0 1.2em; opacity: .75; font-style: italic; }
.hero-title { color: var(--sand); font-size: clamp(3rem, 9vw, 5.5rem); margin: 0; letter-spacing: .03em; }
.hero-lead { max-width: 640px; margin: .8em auto 2em; font-size: 1.2rem; opacity: .9; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Sections */
.section { padding: 72px 0; }
.section-alt { background: var(--sand-2); background-image: var(--pattern); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.verse {
  margin: 0 auto 2.5rem; max-width: 760px; text-align: center; padding: 28px 24px;
  background: var(--green); color: var(--sand); border-radius: var(--radius); border: 1px solid var(--gold);
}
.verse .arabic { font-size: 1.9rem; color: var(--gold); margin: 0 0 .3em; }
.verse p { margin: 0 0 .5em; font-size: 1.15rem; }
.verse cite { color: var(--gold-2); font-size: .9rem; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.pillars ol { margin: 0; padding-left: 1.3em; }
.pillars li { margin-bottom: .45em; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.theme-card { display: flex; flex-direction: column; }
.theme-card .icon { font-size: 2rem; }
.theme-card p { flex: 1; }
.theme-card .quote { border-left: 3px solid var(--gold); padding-left: 12px; font-style: italic; color: var(--green-2); }
.theme-card .quote cite { display: block; font-style: normal; font-size: .85rem; color: var(--muted); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.share-btn { text-decoration: none; background: transparent; border: 1.5px solid var(--green-2); color: var(--green-2); border-radius: 999px; padding: .35em .9em; cursor: pointer; font: 600 .88rem "Source Sans 3", sans-serif; }
.share-btn:hover { background: var(--green-2); color: var(--sand); }

.grid-links .card { display: flex; flex-direction: column; gap: 6px; padding: 20px; }
.grid-links h3 { font-size: 1.3rem; margin: 0; }
.grid-links p { margin: 0; flex: 1; color: var(--muted); font-size: .95rem; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; background: var(--sand-2); color: var(--green-2); border: 1px solid var(--line); padding: .1em .55em; border-radius: 6px; }
.tag.kind { background: var(--green); color: var(--gold-2); border-color: var(--green); }

.filter { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 24px; }
.filter button { background: var(--card); border: 1px solid var(--line); color: var(--green); padding: .4em 1em; border-radius: 999px; cursor: pointer; font: 600 .92rem "Source Sans 3", sans-serif; }
.filter button.active { background: var(--green); color: var(--gold-2); border-color: var(--green); }

/* Flyers */
.grid-flyers { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.flyer-card { padding: 16px; }
.flyer-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.flyer-thumbs a { display: block; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.flyer-thumbs img { width: 100%; display: block; aspect-ratio: 11 / 8.5; object-fit: cover; object-position: top; }
.flyer-thumbs span { display: block; text-align: center; font-size: .78rem; color: var(--muted); padding: 2px; }

/* Formulaire */
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 4px; font-weight: 600; color: var(--green); }
.form input, .form select, .form textarea {
  font: 400 1rem "Source Sans 3", sans-serif; padding: .7em .8em; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--ink);
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.form .btn { justify-self: start; }
.hp { position: absolute; left: -9999px; }
.form-status { margin: 0; font-weight: 600; }

/* Pied de page */
.footer { background: var(--green); color: var(--sand); text-align: center; padding: 48px 16px; }
.footer .arabic { font-size: 1.6rem; color: var(--gold); margin: 0; }
.footer .small { color: rgba(247,241,227,.7); max-width: 640px; margin: 1em auto 1.5em; }

/* Partage */
.share-sheet { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.5); display: grid; place-items: center; padding: 16px; }
.share-sheet[hidden] { display: none; }
.share-box { background: var(--card); border-radius: var(--radius); padding: 24px; width: min(420px, 100%); text-align: center; }
.share-targets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.share-targets a, .share-targets button {
  display: block; padding: .6em .3em; border-radius: 10px; background: var(--sand-2); color: var(--green);
  text-decoration: none; font: 600 .9rem "Source Sans 3", sans-serif; border: 1px solid var(--line); cursor: pointer;
}
.share-targets a:hover, .share-targets button:hover { background: var(--green); color: var(--gold-2); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--green); color: var(--gold-2); padding: .6em 1.2em; border-radius: 999px; z-index: 130; }

/* Mobile */
@media (max-width: 920px) {
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: var(--green); padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .tools { margin-left: 0; }
}
@media (max-width: 480px) {
  .brand > span:last-child { display: none; }
  .grid, .grid-flyers { grid-template-columns: 1fr; }
}

/* Impression : on n'imprime que le contenu utile */
@media print {
  .topbar, .welcome, .hero-actions, .card-actions, .filter, #contact, .footer button { display: none !important; }
  .section, .section-alt, .hero { background: none; color: #000; padding: 16px 0; }
}

/* Lecteur de musique YouTube (coin bas droit) */
.music-player { position: fixed; right: 16px; bottom: 16px; z-index: 90; background: var(--green); border: 1px solid var(--gold); border-radius: 12px; overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.music-player[hidden] { display: none; }
.music-bar { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 4px 12px; color: var(--gold-2); font-size: .85rem; font-weight: 600; }
.music-close { background: none; border: 0; color: var(--sand); font-size: 1.3rem; cursor: pointer; line-height: 1; padding: 0 6px; }
.music-player iframe { display: block; width: 300px; height: 200px; }
@media (max-width: 480px) { .music-player { right: 8px; bottom: 8px; } }

/* Bouton retour à l'accueil */
.back-top { position: fixed; left: 16px; bottom: 16px; z-index: 80; background: var(--green); color: var(--gold-2); border: 1px solid var(--gold); padding: .55em 1.1em; border-radius: 999px; text-decoration: none; font-weight: 600; box-shadow: var(--shadow); }
.back-top[hidden] { display: none; }
.back-top:hover { background: var(--gold); color: var(--green); }

/* Lecteur de flyer */
.flyer-thumbs button { all: unset; cursor: pointer; display: block; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.flyer-thumbs button:hover, .flyer-thumbs button:focus-visible { outline: 2px solid var(--gold); }
.flyer-thumbs img { width: 100%; display: block; aspect-ratio: 11 / 8.5; object-fit: cover; object-position: top; }
.flyer-thumbs span { display: block; text-align: center; font-size: .78rem; color: var(--muted); padding: 2px; }
.viewer { position: fixed; inset: 0; z-index: 140; background: #0a1f18; display: flex; flex-direction: column; color: var(--sand); }
.viewer[hidden] { display: none; }
.viewer-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; flex-wrap: wrap; border-bottom: 1px solid rgba(201,165,76,.3); }
.viewer-info { display: flex; flex-direction: column; }
.viewer-page { color: var(--gold-2); font-size: .9rem; }
.viewer-actions { display: flex; gap: 10px; align-items: center; }
.viewer-close { background: var(--sand); color: var(--green); border: 0; border-radius: 999px; padding: .5em 1.1em; font: 700 1rem "Source Sans 3", sans-serif; cursor: pointer; }
.viewer-close:hover { background: var(--gold-2); }
.viewer-stage { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 12px; }
.viewer-stage img { max-width: 100%; max-height: 100%; background: #fff; border-radius: 4px; box-shadow: 0 10px 40px rgba(0,0,0,.5); cursor: zoom-in; }
.viewer-stage.zoomed { display: block; }
.viewer-stage.zoomed img { max-width: none; max-height: none; width: 200%; cursor: zoom-out; }
.viewer-nav { display: flex; justify-content: center; align-items: center; gap: 16px; padding: 10px 16px 16px; flex-wrap: wrap; }
.viewer-nav button:disabled { opacity: .35; cursor: default; transform: none; }
.viewer-hint { font-size: .85rem; opacity: .7; }
@media (max-width: 600px) {
  .viewer-hint { order: 3; width: 100%; text-align: center; }
  .viewer-stage.zoomed img { width: 300%; }
}
