/**
 * Moira Cookie Consent banner.
 *
 * Colours and type mirror the Moira Blacach theme. The variables fall back to
 * the theme's own values when the plugin runs on a different theme, so the
 * banner still looks deliberate rather than broken.
 */

.moira-cc {
  --cc-green-deep: var(--green-deep, #122f24);
  --cc-green: var(--green, #1f4635);
  --cc-gold: var(--gold, #c8a24c);
  --cc-gold-light: var(--gold-light, #e3ca8b);
  --cc-gold-deep: var(--gold-deep, #a67f2e);
  --cc-parchment: var(--parchment, #f7f2e6);
  --cc-ink-soft: var(--ink-soft, #3a3a36);
  --cc-display: 'Cinzel', Georgia, serif;
  --cc-body: 'EB Garamond', Georgia, serif;
  --cc-accent: 'Cormorant Garamond', Georgia, serif;
}

/* ---------- Shell ---------- */
.moira-cc {
  position: fixed;
  z-index: 99999;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(12px);
  width: min(940px, calc(100% - 32px));
  background: linear-gradient(160deg, rgba(31, 70, 53, .97), rgba(18, 47, 36, .98));
  border: 1px solid rgba(200, 162, 76, .55);
  border-radius: 18px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .75);
  color: var(--cc-parchment);
  font-family: var(--cc-body);
  padding: 26px 30px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, transform .35s ease, visibility .35s;
}

.moira-cc.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* A soft gold hairline at the top, echoing the site's dividers */
.moira-cc::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(600px 200px at 12% 0%, rgba(200, 162, 76, .16), transparent 62%);
  pointer-events: none;
}

.moira-cc > * { position: relative; }

/* ---------- Text ---------- */
.moira-cc h2 {
  font-family: var(--cc-display);
  font-weight: 600;
  color: var(--cc-parchment);
  font-size: 1.28rem;
  line-height: 1.25;
  margin: 0 0 8px;
  letter-spacing: .02em;
}

.moira-cc p {
  margin: 0;
  color: #ddd6c3;
  font-size: 1rem;
  line-height: 1.6;
}

.moira-cc a.moira-cc-policy {
  color: var(--cc-gold-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.moira-cc a.moira-cc-policy:hover { color: #fff; }

/* ---------- Layout ---------- */
.moira-cc-main {
  display: flex;
  gap: 28px;
  align-items: center;
}

.moira-cc-copy { flex: 1; min-width: 0; }

.moira-cc-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: center;
}

/* ---------- Buttons ----------
   Accept and Reject are deliberately the same size and weight: consent is not
   freely given if refusing is made harder than agreeing. */
.moira-cc button {
  font-family: var(--cc-display);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: .72rem;
  padding: 13px 24px;
  border-radius: 30px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: .22s;
  white-space: nowrap;
  line-height: 1;
}

.moira-cc .cc-accept {
  background: linear-gradient(150deg, var(--cc-gold-light), var(--cc-gold));
  color: var(--cc-green-deep);
  box-shadow: 0 10px 24px -12px rgba(166, 127, 46, .9);
}

.moira-cc .cc-accept:hover { transform: translateY(-1px); }

.moira-cc .cc-reject {
  background: transparent;
  border-color: var(--cc-gold-light);
  color: var(--cc-parchment);
}

.moira-cc .cc-reject:hover {
  background: var(--cc-gold);
  border-color: var(--cc-gold);
  color: var(--cc-green-deep);
}

.moira-cc .cc-prefs {
  background: none;
  border: 0;
  color: var(--cc-gold-light);
  text-transform: none;
  letter-spacing: .04em;
  font-family: var(--cc-accent);
  font-size: 1.02rem;
  font-style: italic;
  padding: 13px 6px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.moira-cc .cc-prefs:hover { color: #fff; }

.moira-cc button:focus-visible,
.moira-cc a:focus-visible,
.moira-cc input:focus-visible {
  outline: 2px solid var(--cc-gold-light);
  outline-offset: 3px;
}

/* ---------- Preferences panel ---------- */
.moira-cc-panel { display: none; }
.moira-cc.is-choosing .moira-cc-main { display: none; }
.moira-cc.is-choosing .moira-cc-panel { display: block; }

.moira-cc.is-choosing {
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}

.moira-cc-panel h2 { margin-bottom: 16px; }

.moira-cc-cat {
  border-top: 1px solid rgba(200, 162, 76, .28);
  padding: 16px 0;
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.moira-cc-cat:last-of-type { border-bottom: 1px solid rgba(200, 162, 76, .28); }

.moira-cc-cat-text { flex: 1; }

.moira-cc-cat-label {
  font-family: var(--cc-display);
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cc-gold-light);
  display: block;
  margin-bottom: 5px;
}

.moira-cc-cat p { font-size: .95rem; color: #cfc8b5; }

.moira-cc-always {
  font-family: var(--cc-accent);
  font-style: italic;
  color: var(--cc-gold-light);
  font-size: .98rem;
  white-space: nowrap;
  padding-top: 2px;
}

/* Switch */
.moira-cc-switch {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
}

.moira-cc-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}

.moira-cc-switch .track {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(200, 162, 76, .5);
  border-radius: 30px;
  transition: .22s;
}

.moira-cc-switch .thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--cc-gold-light);
  transition: .22s;
}

.moira-cc-switch input:checked ~ .track {
  background: var(--cc-gold);
  border-color: var(--cc-gold);
}

.moira-cc-switch input:checked ~ .thumb {
  left: 28px;
  background: var(--cc-green-deep);
}

.moira-cc-switch input:focus-visible ~ .track {
  outline: 2px solid var(--cc-gold-light);
  outline-offset: 3px;
}

.moira-cc-panel-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ---------- Re-open link ---------- */
.moira-cc-open { cursor: pointer; }

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  .moira-cc {
    bottom: 0;
    left: 0;
    transform: translateY(14px);
    width: 100%;
    border-radius: 18px 18px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  }

  .moira-cc.is-visible { transform: translateY(0); }

  .moira-cc-main {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }

  .moira-cc-actions {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .moira-cc-actions button { flex: 1 1 auto; }
  .moira-cc .cc-prefs { flex-basis: 100%; text-align: center; }
  .moira-cc-cat { gap: 12px; }
}

/* ---------- Respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .moira-cc,
  .moira-cc button,
  .moira-cc-switch .track,
  .moira-cc-switch .thumb { transition: none; }
}
