/*
 * URSY Estate Runtime 2.0.0 — consent bar styles ONLY.
 * The /under-the-hood/ page styles live in assets/uth.css (another module).
 *
 * Revision notes (Lee: never hide a value change):
 *  - 4 Sep 2026, 2.0.0: first estate-wide sheet. Light by default (Lee's
 *    ruling), dark only under prefers-color-scheme: dark. Fixed bottom-centre,
 *    max-width 560px, one plain sentence, one big Yes, a quieter No. Motion is
 *    dropped under prefers-reduced-motion; keyboard focus is always visible.
 *    Served as a same-origin file, so ursy.fm's style-src 'self' CSP is kept.
 */

.ueb-consent {
  --ueb-bg: #ffffff;
  --ueb-ink: #0f172a;
  --ueb-muted: #475569;
  --ueb-line: rgba(15, 23, 42, 0.14);
  --ueb-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  --ueb-yes-bg: #0f172a;
  --ueb-yes-ink: #ffffff;
  --ueb-no-bg: #f4f6fa;
  --ueb-no-ink: #0f172a;
  --ueb-focus: #2563eb;

  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 9500;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: space-between;
  width: calc(100vw - 24px);
  max-width: 560px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--ueb-line);
  border-radius: 12px;
  background: var(--ueb-bg);
  color: var(--ueb-ink);
  box-shadow: var(--ueb-shadow);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-align: left;
  animation: ueb-consent-in 260ms ease-out both;
}

.ueb-consent[hidden] {
  display: none;
}

.ueb-consent__text {
  flex: 1 1 260px;
  margin: 0;
  color: var(--ueb-ink);
}

.ueb-consent__link {
  color: var(--ueb-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.ueb-consent__link:hover {
  color: var(--ueb-ink);
}

.ueb-consent__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}

.ueb-consent__yes,
.ueb-consent__no {
  margin: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.ueb-consent__yes {
  min-height: 44px;
  padding: 10px 20px;
  background: var(--ueb-yes-bg);
  color: var(--ueb-yes-ink);
  border-color: var(--ueb-yes-bg);
}

.ueb-consent__yes:hover {
  filter: brightness(1.12);
}

.ueb-consent__no {
  min-height: 44px;
  padding: 10px 14px;
  background: var(--ueb-no-bg);
  color: var(--ueb-no-ink);
  border-color: var(--ueb-line);
  font-weight: 500;
}

.ueb-consent__no:hover {
  background: var(--ueb-line);
}

.ueb-consent__yes:focus-visible,
.ueb-consent__no:focus-visible,
.ueb-consent__link:focus-visible {
  outline: 3px solid var(--ueb-focus);
  outline-offset: 2px;
}

/* Admin readout: plain tables, no inline styles anywhere. */
.ueb-admin-table {
  max-width: 720px;
  margin-bottom: 16px;
}

.ueb-admin-table td:nth-child(n + 2),
.ueb-admin-table th:nth-child(n + 2) {
  text-align: right;
}

/* 4 Sep 2026 (fix pass): the mint panel on the Tools page — the two rules that
   used to be style="" attributes in mint.php (CSP forbids inline styles). */
.ueb-mint-table {
  max-width: 720px;
}

.ueb-mint-form {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 4 Sep 2026 (fix pass): the estate advert plate's placement rule. It used to be an
   inline <style> block after the plate in ads.php; the plate's own skin is
   assets/estate-ad.css (the canonical v3 sheet, unchanged). */
.ursy-estate-plate {
  margin: 28px auto 36px;
  position: relative;
  z-index: 5;
}

/* 4 Sep 2026 (2.2.3): the text card — a site whose CSP allows no remote images and hosts no copy of
   the creatives (ursy.id) renders the plate without the picture column; copy takes the full width. */
.estate-ad-noimg.estate-ad-300x250 .estate-ad-link {
  grid-template-columns: minmax(0, 1fr);
}

.estate-ad-noimg.estate-ad-300x250 .estate-ad-copy,
.estate-ad-noimg.estate-ad-300x250 .estate-ad-ctarow {
  grid-column: 1;
}

@keyframes ueb-consent-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 480px) {
  .ueb-consent {
    bottom: 8px;
    width: calc(100vw - 16px);
    padding: 12px 14px;
  }

  .ueb-consent__actions {
    width: 100%;
  }

  .ueb-consent__yes {
    flex: 1 1 auto;
  }
}

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

@media (prefers-color-scheme: dark) {
  .ueb-consent {
    --ueb-bg: #101418;
    --ueb-ink: #e6e9ee;
    --ueb-muted: #aab3bf;
    --ueb-line: rgba(230, 233, 238, 0.18);
    --ueb-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    --ueb-yes-bg: #e6e9ee;
    --ueb-yes-ink: #0f172a;
    --ueb-no-bg: #1a2027;
    --ueb-no-ink: #e6e9ee;
    --ueb-focus: #7cb4ff;
  }
}
