/* Explain: Styles for the global consent banner and preferences panel. */
/* =========================================================
   DMA — CONSENT SYSTEM
   Banner + preferences panel, shared by every page.
   Every show/hide state is defined here only, so no utility
   class and no project class fight over `display`.
   ========================================================= */

/* ---------- language visibility ---------- */
html:not([data-consent-active-lang="ar"]) [data-consent-lang="ar"] {
  display: none;
}

html[data-consent-active-lang="ar"] [data-consent-lang="en"] {
  display: none;
}

html[data-consent-active-lang="ar"] [data-consent-lang="ar"] {
  letter-spacing: normal;
  text-transform: none;
}

/* ---------- banner ---------- */
.dma-consent {
  display: none;
}

.dma-consent.is-open {
  display: block;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: var(--paper);
  color: var(--ink);
  border-top: 1px solid var(--line);
  box-shadow: 0 -14px 40px rgba(10, 10, 10, .12);
  padding-bottom: env(safe-area-inset-bottom);
  animation: dma-consent-in .35s ease both;
}

@keyframes dma-consent-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dma-consent.is-open { animation: none; }
}

.dma-consent__inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px var(--pad) 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 900px) {
  .dma-consent__inner {
    flex-direction: row;
    align-items: center;
    gap: 40px;
    padding-top: 20px;
    padding-bottom: 22px;
  }

  .dma-consent__text {
    flex: 1 1 auto;
    min-width: 0;
  }

  .dma-consent__actions {
    flex: 0 0 auto;
  }
}

.dma-consent__title {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .55;
}

.dma-consent__copy {
  margin: 8px 0 0;
  max-width: 80ch;
  font-size: 13px;
  line-height: 1.65;
  opacity: .8;
}

.dma-consent__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 640px) {
  .dma-consent__actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
  }
}

.dma-consent__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 22px;
  border-radius: 2px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .22s ease, border-color .22s ease, color .22s ease, opacity .22s ease;
}

.dma-consent__btn--solid {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
}

.dma-consent__btn--solid:hover {
  background: #333;
  border-color: #333;
}

.dma-consent__btn--outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.dma-consent__btn--outline:hover {
  border-color: var(--ink);
}

.dma-consent__btn--quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding-left: 4px;
  padding-right: 4px;
}

.dma-consent__btn--quiet:hover {
  border-bottom-color: var(--ink);
  opacity: .75;
}

.dma-consent__btn:focus-visible,
.dma-prefs__close:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@media (max-width: 639px) {
  .dma-consent__btn--solid,
  .dma-consent__btn--outline {
    width: 100%;
  }

  .dma-consent__btn--quiet {
    align-self: flex-start;
  }
}

/* ---------- preferences panel ---------- */
.dma-prefs {
  display: none;
}

.dma-prefs.is-open {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 70;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.dma-prefs__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, .55);
}

.dma-prefs__card {
  position: relative;
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 30px 80px rgba(10, 10, 10, .3);
}

@media (min-width: 640px) {
  .dma-prefs__card {
    padding: 32px;
  }
}

.dma-prefs__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.dma-prefs__title {
  margin: 0;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.dma-prefs__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .2s ease, opacity .2s ease;
}

.dma-prefs__close:hover {
  border-color: var(--ink);
  opacity: .7;
}

.dma-prefs__intro {
  margin: 16px 0 0;
  font-size: 13px;
  line-height: 1.65;
  opacity: .8;
}

.dma-prefs__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.dma-prefs__row--locked {
  cursor: default;
}

.dma-prefs__rowtext {
  min-width: 0;
}

.dma-prefs__name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.dma-prefs__desc {
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  opacity: .72;
}

.dma-switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
  margin-top: 2px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(10, 10, 10, .2);
  cursor: pointer;
  transition: background-color .2s ease;
}

.dma-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}

.dma-switch:checked {
  background: var(--ink);
}

.dma-switch:checked::after {
  transform: translateX(20px);
}

.dma-prefs[dir="rtl"] .dma-switch:checked::after {
  transform: translateX(-20px);
}

.dma-switch:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.dma-switch:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.dma-prefs__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

@media (min-width: 640px) {
  .dma-prefs__actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
  }
}