:root {
  --background: #f5f0e7;
  --background-soft: #fbf8f2;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --text: #252820;
  --text-soft: #687066;
  --primary: #324f43;
  --primary-dark: #243d34;
  --primary-soft: #e7eee9;
  --gold: #a77c3d;
  --gold-soft: #f4ead8;
  --border: #ded8cc;
  --border-soft: #ebe6dc;
  --danger: #9f3939;
  --success: #326849;
  --shadow: 0 22px 60px rgba(38, 48, 40, 0.12);
  --shadow-soft: 0 10px 30px rgba(38, 48, 40, 0.08);
  --radius-large: 28px;
  --radius-medium: 18px;
  --radius-small: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.65;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.page-background {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(
      circle at 15% 5%,
      rgba(167, 124, 61, 0.14),
      transparent 32%
    ),
    radial-gradient(
      circle at 85% 20%,
      rgba(50, 79, 67, 0.12),
      transparent 32%
    ),
    linear-gradient(180deg, #f8f4ec 0%, #f1ece2 100%);
}

.hero {
  max-width: 900px;
  margin: 0 auto;
  padding: 72px 24px 42px;
  text-align: center;
}

.hero-symbol {
  width: 66px;
  height: 66px;
  display: grid;
  margin: 0 auto 20px;
  border: 1px solid rgba(167, 124, 61, 0.35);
  border-radius: 50%;
  place-items: center;
  color: var(--gold);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  font-size: 34px;
}

.eyebrow,
.step-label {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  color: var(--primary-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 8vw, 5rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.hero-description {
  max-width: 680px;
  margin: 22px auto 0;
  color: var(--text-soft);
  font-size: 1.05rem;
}

.container {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
}

.panel,
.result-section,
.disclaimer {
  border: 1px solid rgba(222, 216, 204, 0.9);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel {
  padding: clamp(22px, 5vw, 42px);
}

.panel-heading,
.result-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
}

.panel h2,
.result-header h2,
.disclaimer h2 {
  margin: 0;
  color: var(--primary-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 5vw, 2.35rem);
  font-weight: 600;
}

.panel-description {
  max-width: 700px;
  margin: 12px 0 28px;
  color: var(--text-soft);
}

.selection-count {
  flex-shrink: 0;
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 0.84rem;
  font-weight: 750;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.category-option {
  position: relative;
  min-height: 94px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 17px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-medium);
  background: var(--background-soft);
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.category-option:hover {
  transform: translateY(-2px);
  border-color: rgba(50, 79, 67, 0.35);
  box-shadow: var(--shadow-soft);
}

.category-option.selected {
  border-color: rgba(50, 79, 67, 0.6);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px rgba(50, 79, 67, 0.1);
}

.category-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.details-link {
  width: fit-content;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--primary);
  background: var(--background-soft);
  font-size: 0.82rem;
  font-weight: 750;
  text-decoration: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.details-link:hover {
  transform: translateX(3px);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.category-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: grid;
  border-radius: 14px;
  place-items: center;
  color: var(--gold);
  background: var(--gold-soft);
  font-size: 1.25rem;
}

.category-text {
  min-width: 0;
}

.category-title {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 760;
  line-height: 1.3;
}

.category-description {
  display: block;
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 0.76rem;
  line-height: 1.35;
}

.primary-button,
.secondary-button,
.language-button {
  border: 0;
  cursor: pointer;
  transition:
    transform 160ms ease,
    opacity 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.primary-button {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: 26px;
  padding: 16px 20px;
  border-radius: 15px;
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 12px 26px rgba(50, 79, 67, 0.22);
  font-weight: 800;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--primary-dark);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary-button.compact {
  width: auto;
  min-width: 230px;
  margin: 0;
}

.secondary-button {
  min-width: 190px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 15px;
  color: var(--primary-dark);
  background: var(--surface-solid);
  font-weight: 750;
}

.secondary-button:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.loading-message {
  margin: 13px 0 0;
  color: var(--text-soft);
  text-align: center;
  font-size: 0.82rem;
}

.result-section {
  margin-top: 26px;
  padding: clamp(22px, 5vw, 42px);
}

.result-header {
  margin-bottom: 26px;
}

.language-switcher {
  display: flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--background-soft);
}

.language-button {
  padding: 9px 13px;
  border-radius: 10px;
  color: var(--text-soft);
  background: transparent;
  font-size: 0.83rem;
  font-weight: 760;
}

.language-button.active {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 5px 12px rgba(50, 79, 67, 0.2);
}

.invocation-flow {
  position: relative;
  display: grid;
  gap: 15px;
}

.invocation-card {
  position: relative;
  padding: clamp(20px, 4vw, 30px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-medium);
  background: var(--surface-solid);
  box-shadow: var(--shadow-soft);
  animation: cardReveal 420ms ease both;
}

.invocation-card::before {
  position: absolute;
  top: 25px;
  bottom: 25px;
  left: 0;
  width: 4px;
  border-radius: 0 8px 8px 0;
  background: var(--gold);
  content: "";
}

.invocation-card.salawat-card::before {
  background: #a3a097;
}

.invocation-card.tawakkul-card {
  border-color: rgba(167, 124, 61, 0.28);
  background:
    linear-gradient(
      145deg,
      rgba(244, 234, 216, 0.62),
      rgba(255, 255, 255, 0.96)
    );
}

.card-title {
  margin: 0 0 14px;
  color: var(--primary-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.32rem;
  font-weight: 600;
}

.card-content {
  color: #353a34;
  white-space: pre-line;
}

.card-content.arabic-content {
  direction: rtl;
  text-align: right;
  font-family: "Noto Naskh Arabic", "Geeza Pro", serif;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 2;
}

.card-source {
  display: block;
  margin-top: 17px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-soft);
  font-size: 0.76rem;
}

.tawakkul-content h4 {
  margin: 22px 0 7px;
  color: var(--primary-dark);
  font-size: 1.04rem;
}

.tawakkul-content h4:first-child {
  margin-top: 0;
}

.tawakkul-content p {
  margin: 0 0 12px;
}

.tawakkul-content .dhikr {
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid rgba(167, 124, 61, 0.25);
  border-radius: var(--radius-small);
  color: var(--primary-dark);
  background: rgba(244, 234, 216, 0.55);
  font-weight: 750;
  text-align: center;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 22px;
}

.message {
  margin-top: 15px;
  padding: 12px 15px;
  border-radius: var(--radius-small);
  font-size: 0.88rem;
  text-align: center;
}

.message-error {
  color: var(--danger);
  background: rgba(159, 57, 57, 0.08);
}

.message-success {
  color: var(--success);
  background: rgba(50, 104, 73, 0.08);
}

.disclaimer {
  margin-top: 26px;
  padding: 24px 28px;
  box-shadow: var(--shadow-soft);
}

.disclaimer h2 {
  font-size: 1.35rem;
}

.disclaimer p {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 0.87rem;
}

.site-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 42px 24px 55px;
  color: var(--text-soft);
  text-align: center;
  font-size: 0.86rem;
}

.hidden {
  display: none !important;
}

@keyframes cardReveal {
  from {
    transform: translateY(12px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 820px) {
  .categories-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-header {
    flex-direction: column;
  }

  .language-switcher {
    width: 100%;
  }

  .language-button {
    flex: 1;
  }
}

@media (max-width: 570px) {
  .hero {
    padding-top: 48px;
  }

  .container {
    width: min(100% - 20px, 1040px);
  }

  .panel-heading {
    display: block;
  }

  .selection-count {
    display: inline-block;
    margin-top: 13px;
  }

  .categories-grid {
    grid-template-columns: 1fr;
  }

  .category-option {
    min-height: 80px;
  }

  .language-switcher {
    display: grid;
    grid-template-columns: 1fr;
  }

  .result-actions {
    flex-direction: column;
  }

  .secondary-button,
  .primary-button.compact {
    width: 100%;
    min-width: 0;
  }
}

.detail-page {
  padding-top: 44px;
  padding-bottom: 60px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 750;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.detail-panel {
  padding: clamp(24px, 6vw, 50px);
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-header {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-soft);
}

.detail-header h1 {
  max-width: 760px;
  margin: 0;
  color: var(--primary-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 7vw, 3.7rem);
  font-weight: 600;
  line-height: 1.1;
}

.detail-source {
  margin: 14px 0 0;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.detail-text-card,
.detail-section {
  margin-top: 15px;
  padding: clamp(19px, 4vw, 28px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-medium);
  background: var(--surface-solid);
}

.detail-text-card h2,
.detail-section h2 {
  margin: 0 0 12px;
  color: var(--primary-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.3rem;
}

.detail-text-card p,
.detail-section p {
  margin: 0;
}

.detail-section ul {
  margin: 0;
  padding-left: 21px;
}

.detail-section li + li {
  margin-top: 7px;
}

.detail-return-button {
  width: fit-content;
  margin: 28px 0 0;
  text-decoration: none;
}

@media (max-width: 570px) {
  .detail-page {
    padding-top: 22px;
  }

  .detail-return-button {
    width: 100%;
  }
}

/* AccessibilitÃ© clavier */
button:focus-visible,
a:focus-visible,
.category-option:focus-within {
  outline: 3px solid rgba(167, 124, 61, 0.42);
  outline-offset: 3px;
}

/* La fiche reste lisible mÃªme avec de trÃ¨s longues invocations */
.detail-text-card,
.detail-section,
.invocation-card {
  overflow-wrap: anywhere;
}

/* Meilleur rendu de l'arabe dans la fiche dÃ©taillÃ©e */
.detail-text-card .arabic-content {
  direction: rtl;
  text-align: right;
  font-family: "Noto Naskh Arabic", "Geeza Pro", serif;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 2;
}

/* Bouton de retour correctement centrÃ© */
.detail-return-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* RÃ©duction des animations pour les personnes qui le demandent */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
