/* ─────────────────────────────────────────────────────────────────────────────
   webapp.css — version web publique consultable SANS compte (fil + cours).
   Reprend la charte du site (assets/style.css).
   ───────────────────────────────────────────────────────────────────────────── */

.app-main { background: var(--paper); min-height: 100vh; }

/* Bandeau de tête de section */
.app-head {
  background:
    radial-gradient(900px 360px at 50% -40%, rgba(200,162,76,0.14), transparent 65%),
    var(--forest-2);
  color: #fff;
  padding: 40px 0 34px;
  text-align: center;
}
.app-head .ar { font-family: 'Noto Kufi Arabic','Inter',sans-serif; color: var(--gold-soft); font-size: 14px; letter-spacing: .04em; }
.app-head h1 { font-family: 'Fraunces',serif; font-size: clamp(26px,4vw,40px); margin: 10px 0 6px; }
.app-head p { color: rgba(255,255,255,0.78); font-size: 15px; margin: 0; }

/* Onglets de navigation interne */
.app-tabs {
  display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
  margin-top: 22px;
}
.app-tab {
  color: rgba(255,255,255,0.85); font: 600 14px/1 'Inter',sans-serif;
  padding: 10px 18px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.25);
}
.app-tab.active { background: var(--gold); color: #1c2118; border-color: var(--gold); }

/* Grille de cartes */
.app-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px; padding: 32px 0 60px;
}

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-cover { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--paper-2); display: block; }
.card-cover.placeholder {
  display: flex; align-items: center; justify-content: center;
}
.card-cover.placeholder img { width: 56px; height: 56px; opacity: .5; }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-kicker { font: 700 11px/1 'Inter',sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.card-title { font-family: 'Fraunces',serif; font-size: 19px; line-height: 1.3; color: var(--text); margin: 0; }
.card-title[dir="rtl"] { font-family: 'Noto Kufi Arabic','Fraunces',serif; }
.card-author { font: 500 13px/1.3 'Inter',sans-serif; color: var(--text-soft); display: flex; align-items: center; gap: 6px; }
.card-author .verif { color: var(--forest-2); }
.card-excerpt { font: 400 14px/1.6 'Inter',sans-serif; color: #4a574f; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-audio { width: 100%; margin-top: 6px; }
.card-foot { margin-top: auto; padding-top: 10px; }
.card-link { color: var(--forest-2); font: 600 13px/1 'Inter',sans-serif; }

/* États */
.app-state { text-align: center; padding: 70px 0; color: var(--text-soft); }
.app-state .spin {
  width: 32px; height: 32px; margin: 0 auto 14px;
  border: 3px solid var(--line); border-top-color: var(--gold);
  border-radius: 50%; animation: appspin .8s linear infinite;
}
@keyframes appspin { to { transform: rotate(360deg); } }

.app-cta-bottom { text-align: center; padding: 0 0 56px; }

.hidden { display: none !important; }

@media (max-width: 560px) {
  .app-grid { grid-template-columns: 1fr; gap: 16px; padding: 22px 0 48px; }
  .app-head { padding: 30px 0 26px; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Page « L'application en aperçu » (app.html) — réplique l'accueil de l'app.
   Colonne centrée façon application (responsive : plein écran sur mobile).
   ───────────────────────────────────────────────────────────────────────────── */
.app-col { max-width: 620px; margin: 0 auto; padding: 22px 16px 10px; }
.home-sec { margin-bottom: 30px; }
.home-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.home-sec-head h2 { font-family: 'Fraunces',serif; font-size: 22px; color: var(--text); margin: 0; }
.voir-tout {
  color: var(--forest-2); font: 600 14px/1 'Inter',sans-serif;
  background: none; border: none; cursor: pointer; padding: 6px 2px;
}
.voir-tout:hover { text-decoration: underline; }

/* ── Stories ── */
.stories-row { display: flex; gap: 14px; padding: 4px 0 24px; overflow-x: auto; }
.story-add { background: none; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 0; }
.story-add-ring {
  width: 74px; height: 74px; border-radius: 50%;
  border: 2.5px solid var(--gold); background: var(--paper-2);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 3px var(--surface);
}
.story-add-plus { font-size: 34px; font-weight: 300; color: var(--forest-2); line-height: 1; }
.story-add-label { font: 600 13px/1 'Inter',sans-serif; color: var(--text-soft); }

/* ── À découvrir (carrousel) ── */
.disc-row {
  display: flex; gap: 12px; overflow-x: auto; padding: 2px 0 8px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.disc-card {
  flex: 0 0 auto; width: 210px; scroll-snap-align: start; cursor: pointer;
  background: none; border: none; padding: 0; text-align: left;
}
.disc-img {
  width: 210px; height: 260px; border-radius: 16px; object-fit: cover; display: block;
  background: var(--paper-2); border: 1px solid var(--line);
}
.disc-img.placeholder { display: flex; align-items: center; justify-content: center; }
.disc-img.placeholder img { width: 56px; height: 56px; opacity: .5; }
.disc-cap { font: 600 13px/1.35 'Inter',sans-serif; color: var(--text); margin: 8px 2px 0; }
.disc-cap[dir="rtl"] { font-family: 'Noto Kufi Arabic','Inter',sans-serif; }

/* ── Playlists récentes (carrousel) ── */
.pl-row {
  display: flex; gap: 14px; overflow-x: auto; padding: 4px 0 6px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.pl-row::-webkit-scrollbar, .disc-row::-webkit-scrollbar, .stories-row::-webkit-scrollbar { height: 6px; }
.pl-row::-webkit-scrollbar-thumb, .disc-row::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.pl-card { flex: 0 0 auto; width: 150px; scroll-snap-align: start; text-decoration: none; }
.pl-cover-wrap { position: relative; width: 150px; height: 150px; }
.pl-cover {
  width: 150px; height: 150px; border-radius: 18px; object-fit: cover; display: block;
  background: var(--paper-2); border: 1px solid var(--line);
}
.pl-cover.placeholder { display: flex; align-items: center; justify-content: center; }
.pl-cover.placeholder img { width: 46px; height: 46px; opacity: .5; }
.pl-count {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: rgba(20,28,22,0.72); color: #fff; font: 700 12px/1 'Inter',sans-serif;
  padding: 5px 9px; border-radius: 999px;
}
.pl-play {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%; background: rgba(20,28,22,0.55);
  display: flex; align-items: center; justify-content: center;
}
.pl-title { font: 600 14px/1.3 'Inter',sans-serif; color: var(--text); margin: 10px 2px 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pl-title[dir="rtl"] { font-family: 'Noto Kufi Arabic','Inter',sans-serif; }
.pl-meta { font: 500 12px/1 'Inter',sans-serif; color: var(--text-soft); margin: 0 2px; }
.pl-empty { color: var(--text-soft); font: 500 14px/1 'Inter',sans-serif; padding: 20px 2px; }

/* ── Fil de publications (cartes façon l'app) ── */
.pub-feed { display: flex; flex-direction: column; gap: 16px; }
.post {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-sm);
}
.post-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; }
.post-avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: var(--paper-2); flex: 0 0 auto; }
.post-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--forest-2); color: #fff; font: 800 18px/1 'Inter',sans-serif;
}
.post-hinfo { flex: 1; min-width: 0; }
.post-namerow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-name { font: 800 15px/1.2 'Inter',sans-serif; color: var(--text); }
.post-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(200,162,76,0.16); color: #9a7b1f;
  font: 700 11px/1 'Inter',sans-serif; padding: 4px 9px 4px 7px; border-radius: 999px;
}
.post-meta { font: 500 12px/1.3 'Inter',sans-serif; color: var(--text-soft); margin-top: 3px; }
.post-title {
  display: block; text-decoration: none;
  font-family: 'Fraunces',serif; font-size: 18px; line-height: 1.35; color: var(--text);
  padding: 0 16px 10px;
}
.post-title[dir="rtl"] { font-family: 'Noto Kufi Arabic','Fraunces',serif; text-align: right; }
.post-media { display: block; position: relative; }
.post-img { width: 100%; max-height: 520px; object-fit: cover; display: block; background: var(--paper-2); }
.post-img.placeholder { height: 220px; display: flex; align-items: center; justify-content: center; }
.post-img.placeholder img { width: 60px; height: 60px; opacity: .5; }
.post-counter {
  position: absolute; top: 12px; right: 12px;
  background: rgba(20,28,22,0.72); color: #fff; font: 700 12px/1 'Inter',sans-serif;
  padding: 5px 10px; border-radius: 999px;
}
.post-audio {
  display: flex; align-items: center; gap: 12px; width: calc(100% - 32px); margin: 0 16px 4px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; cursor: pointer;
}
.post-audio-play { width: 40px; height: 40px; border-radius: 50%; background: var(--forest-2); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.post-audio-label { display: inline-flex; align-items: center; gap: 6px; font: 700 14px/1 'Inter',sans-serif; color: var(--forest-2); }
.post-text-wrap { padding: 12px 16px 4px; }
.post-text { font: 400 15px/1.65 'Inter',sans-serif; color: #37423b; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.post-text[dir="rtl"] { font-family: 'Noto Kufi Arabic','Inter',sans-serif; text-align: right; }
.post-more { display: inline-block; margin-top: 4px; color: var(--text-soft); font: 500 14px/1 'Inter',sans-serif; text-decoration: none; }
.post-actions {
  display: flex; border-top: 1px solid var(--line); margin-top: 12px;
}
.post-action {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: none; border: none; cursor: pointer; padding: 13px 6px;
  font: 600 14px/1 'Inter',sans-serif; color: var(--text-soft);
}
.post-action:hover { background: var(--paper); color: var(--forest-2); }
.post-action + .post-action { border-left: 1px solid var(--line); }

/* ── Modale « continuer dans l'application » ── */
.dl-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.dl-backdrop { position: absolute; inset: 0; background: rgba(20,28,22,0.55); }
.dl-card {
  position: relative; background: var(--surface); border-radius: var(--r-lg);
  max-width: 380px; width: 100%; padding: 28px 24px 24px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.28);
}
.dl-close { position: absolute; top: 10px; right: 14px; background: none; border: none;
  font-size: 26px; line-height: 1; color: var(--text-soft); cursor: pointer; }
.dl-seal { display: inline-flex; margin-bottom: 10px; }
.dl-seal img { width: 54px; height: 54px; }
.dl-card h3 { font-family: 'Fraunces',serif; font-size: 20px; color: var(--text); margin: 4px 0 8px; }
.dl-card p { font: 400 14px/1.6 'Inter',sans-serif; color: var(--text-soft); margin: 0 0 18px; }
.dl-btn { display: block; width: 100%; margin-top: 10px; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--forest-2); }

@media (max-width: 560px) {
  .app-col { padding: 16px 12px 8px; }
  .home-sec-head h2 { font-size: 19px; }
  .disc-card, .disc-img { width: 168px; }
  .disc-img { height: 210px; }
  .pl-card, .pl-cover, .pl-cover-wrap { width: 132px; }
  .pl-cover, .pl-cover-wrap { height: 132px; }
  .post-title { font-size: 17px; }
}
