/* In-house cookie consent: bottom bar, settings dialog, embed placeholders,
   status toast and floating settings button. Spec: docs/consent/CONTRACT.md §7.
   z-index: bar + backdrop 2147483646, dialog 2147483647 (site pop-ups defer). */

.oa-bar, .oa-dialog, .oa-backdrop, .oa-embed, .oa-fab, .oa-status {
  --oa-dark: #141008;
  --oa-gold: #C5973A;
  --oa-gold-hover: #D4A94E;
  --oa-cream: #FAF6EE;
  --oa-ink: #141008;
  --oa-ink-muted: #5C5746;   /* secondary text on cream, 6.6:1 */
  --oa-border: #D8D4C4;
  --oa-on-dark-muted: #CFC8B4; /* secondary text on dark, 11:1 */
  --oa-link-on-cream: #7A5B1E; /* 6.2:1 on cream */
  --oa-font-body: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --oa-font-head: "Fraunces", Georgia, serif;
}
.oa-bar, .oa-dialog, .oa-bar *, .oa-dialog *, .oa-embed__ph, .oa-embed__ph *,
.oa-fab, .oa-fab *, .oa-status { box-sizing: border-box; }
.oa-bar[hidden], .oa-dialog[hidden], .oa-backdrop[hidden],
.oa-bar [hidden], .oa-dialog [hidden] { display: none !important; }

/* ── Shared button: Accept / Reject / Customize / Save are identical ── */
.oa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 16px;
  border-radius: 8px;
  border: 2px solid var(--oa-gold);
  background: var(--oa-gold);
  color: var(--oa-dark);              /* 7.0:1 on gold */
  font-family: var(--oa-font-body);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
  text-transform: none;
  white-space: normal;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 0.15s, border-color 0.15s;
}
.oa-btn:hover { background: var(--oa-gold-hover); border-color: var(--oa-gold-hover); color: var(--oa-dark); }

.oa-link { text-decoration: underline; text-underline-offset: 2px; }

/* Footer "Cookie settings" / "Do Not Sell or Share" buttons styled as links */
.oa-linklike, .linklike {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit;
  text-decoration: inherit; cursor: pointer; line-height: inherit;
  -webkit-appearance: none; appearance: none;
}
.oa-linklike:hover, .linklike:hover { text-decoration: underline; text-underline-offset: 2px; }
.oa-linklike:focus-visible, .linklike:focus-visible { outline: 2px solid var(--oa-gold); outline-offset: 2px; border-radius: 2px; }

/* ── First layer: bottom bar (mobile first) ── */
.oa-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2147483646;
  max-height: 75vh;
  overflow-y: auto;
  background: var(--oa-dark);
  color: var(--oa-cream);
  border-top: 2px solid var(--oa-gold);
  box-shadow: 0 -12px 32px rgba(11, 9, 4, 0.28);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  font-family: var(--oa-font-body);
  font-size: 16px;
  text-align: left;
}
.oa-bar__inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.oa-bar__copy { min-width: 0; }
.oa-bar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 6px;
}
.oa-bar__title {
  margin: 0;
  font-family: var(--oa-font-head);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--oa-cream);
}
.oa-bar__body {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--oa-cream);
  overflow-wrap: break-word;
}
.oa-bar__gpc {
  margin: 8px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--oa-gold-hover);       /* 8.9:1 on dark */
}
.oa-bar .oa-link { color: var(--oa-gold-hover); }
.oa-bar .oa-link:hover { color: var(--oa-cream); }

.oa-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Language switch */
.oa-lang { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.oa-lang__btn {
  min-width: 44px;
  min-height: 32px;
  margin: 0;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-family: var(--oa-font-body);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.oa-bar .oa-lang__btn { color: var(--oa-cream); }
.oa-bar .oa-lang__btn[aria-pressed="true"] { background: var(--oa-cream); color: var(--oa-dark); border-color: var(--oa-cream); }
.oa-dialog .oa-lang__btn { color: var(--oa-ink); border-color: var(--oa-border); }
.oa-dialog .oa-lang__btn[aria-pressed="true"] { background: var(--oa-dark); color: var(--oa-cream); border-color: var(--oa-dark); }

/* Focus rings: visible on both backgrounds */
.oa-bar .oa-btn:focus-visible,
.oa-bar .oa-link:focus-visible,
.oa-bar .oa-lang__btn:focus-visible {
  outline: 3px solid var(--oa-cream);
  outline-offset: 2px;
}

/* ── Settings dialog ── */
.oa-backdrop {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 2147483646;
  background: rgba(11, 9, 4, 0.6);
}
.oa-dialog {
  position: fixed;
  z-index: 2147483647;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  width: calc(100% - 24px);
  max-width: 560px;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--oa-cream);
  color: var(--oa-ink);
  border: 1px solid var(--oa-border);
  border-radius: 14px;
  padding: 20px 16px 16px;
  box-shadow: 0 24px 60px rgba(11, 9, 4, 0.35);
  font-family: var(--oa-font-body);
  font-size: 16px;
  text-align: left;
}
.oa-dialog:focus { outline: none; }
.oa-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.oa-dialog__title {
  margin: 0;
  font-family: var(--oa-font-head);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--oa-ink);
}
.oa-dialog__tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.oa-close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--oa-ink);
  font-family: var(--oa-font-body);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.oa-close:hover { border-color: var(--oa-border); }
.oa-dialog__intro {
  margin: 0 0 14px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--oa-ink-muted);
}
.oa-dialog .oa-link { color: var(--oa-link-on-cream); }
.oa-dialog .oa-link:hover { color: var(--oa-ink); }

.oa-cats { border-top: 1px solid var(--oa-border); margin-bottom: 16px; }
.oa-cat { padding: 14px 0; border-bottom: 1px solid var(--oa-border); }
.oa-cat--focus {
  background: rgba(197, 151, 58, 0.12);
  box-shadow: -8px 0 0 rgba(197, 151, 58, 0.12), 8px 0 0 rgba(197, 151, 58, 0.12);
}
.oa-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.oa-cat__name {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.35;
  color: var(--oa-ink);
  cursor: pointer;
  min-width: 0;
}
.oa-cat__ctl { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.oa-cat__always {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--oa-ink-muted);
  white-space: nowrap;
}
.oa-cat__desc {
  margin: 6px 0 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--oa-ink-muted);
}
.oa-cat__dnss {
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--oa-link-on-cream);
}
.oa-cat__note {
  margin: 8px 0 0;
  padding: 6px 10px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--oa-ink);
  background: rgba(197, 151, 58, 0.16);
  border-left: 3px solid var(--oa-gold);
  border-radius: 4px;
}

/* Switch: a real checkbox (role="switch") drawn with CSS */
.oa-switch {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  position: relative;
  width: 46px;
  height: 26px;
  margin: 0;
  border-radius: 999px;
  background: #8B8574;
  border: 1px solid #6E695B;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.oa-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(11, 9, 4, 0.3);
  transition: transform 0.15s;
}
.oa-switch:checked { background: var(--oa-dark); border-color: var(--oa-dark); }
.oa-switch:checked::after { transform: translateX(20px); background: var(--oa-gold); }
.oa-switch:disabled { cursor: not-allowed; opacity: 0.6; }

.oa-dialog .oa-btn:focus-visible,
.oa-dialog .oa-close:focus-visible,
.oa-dialog .oa-link:focus-visible,
.oa-dialog .oa-lang__btn:focus-visible,
.oa-switch:focus-visible,
.oa-cat__note:focus {
  outline: 3px solid var(--oa-dark);
  outline-offset: 2px;
}

html.oa-open { overflow: hidden; }

/* ── Embed placeholder ── */
.oa-embed { position: relative; }
.oa-embed.oa-embed--blocked { min-height: 200px; }
.oa-embed.oa-embed--blocked > iframe { visibility: hidden; }
.oa-embed__ph {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  overflow: auto;
  background: var(--oa-dark);
  color: var(--oa-cream);
  border: 1px solid var(--oa-gold);
  border-radius: inherit;
  font-family: var(--oa-font-body);
  text-align: center;
}
.oa-embed__text { margin: 0; max-width: 46ch; font-size: 0.9rem; line-height: 1.5; color: var(--oa-cream); }
.oa-embed__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; }
.oa-embed__ph .oa-btn { width: auto; min-width: 160px; }
.oa-embed__link { color: var(--oa-gold-hover); font-size: 0.9rem; text-decoration: underline; text-underline-offset: 2px; }
.oa-embed__link:hover { color: var(--oa-cream); }
.oa-embed__ph .oa-btn:focus-visible,
.oa-embed__link:focus-visible { outline: 3px solid var(--oa-cream); outline-offset: 2px; }

/* ── Floating privacy controls (pages without a footer link):
      Cookie settings · Do Not Sell or Share · Privacy ── */
.oa-fab {
  position: fixed;
  left: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483645;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 2px 6px;
  border-radius: 14px;
  border: 1px solid var(--oa-gold);
  background: var(--oa-dark);
  color: var(--oa-cream);
  font-family: var(--oa-font-body);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: 0 4px 14px rgba(11, 9, 4, 0.25);
}
/* legacy static <button class="oa-fab" data-consent-open> in page markup */
button.oa-fab { min-height: 28px; padding: 5px 12px; cursor: pointer; -webkit-appearance: none; appearance: none; }
button.oa-fab:hover { background: #2A2418; text-decoration: underline; text-underline-offset: 2px; }
button.oa-fab:focus-visible { outline: 3px solid var(--oa-gold); outline-offset: 2px; }
.oa-fab__item {
  display: inline-flex;
  align-items: center;
  min-height: 24px;                  /* WCAG 2.5.8 target size */
  margin: 0;
  padding: 3px 6px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--oa-cream);
  font: inherit;
  line-height: 1.2;
  text-decoration: none;
  white-space: normal;               /* long DNSS title wraps at phone width */
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.oa-fab__item ~ .oa-fab__item { border-left: 1px solid rgba(197, 151, 58, 0.5); border-radius: 0 8px 8px 0; }
.oa-fab__item:hover { background: #2A2418; text-decoration: underline; text-underline-offset: 2px; }
.oa-fab__item:focus-visible { outline: 3px solid var(--oa-gold); outline-offset: 1px; }
html.oa-bar-open .oa-fab { display: none; }

/* GPC honored: lasting status next to each Do Not Sell opener (consent.js) */
.oa-gpc-status { margin-left: 0.4em; font-size: 0.85em; font-weight: 600; }
.oa-fab .oa-gpc-status { margin: 0; padding: 3px 6px; font-size: inherit; color: var(--oa-on-dark-muted); }

/* Fixed bar must not hide focused content (WCAG 2.4.11): consent.js sets --oa-bar-h */
html.oa-bar-open { scroll-padding-bottom: var(--oa-bar-h, 0px); }

/* ── Status toast (role=status, aria-live=polite) ── */
.oa-status {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483645;
  max-width: calc(100% - 32px);
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--oa-gold);
  background: var(--oa-dark);
  color: var(--oa-cream);
  font-family: var(--oa-font-body);
  font-size: 0.875rem;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 8px 24px rgba(11, 9, 4, 0.3);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, visibility 0.2s;
}
.oa-status.oa-status--show { opacity: 1; visibility: visible; }
.oa-status:empty { padding: 0; border: 0; }
/* with the floating privacy controls, the toast sits above them (consent.js sets --oa-fab-h) */
html.oa-has-fab .oa-status { bottom: calc(var(--oa-fab-h, 32px) + 22px + env(safe-area-inset-bottom, 0px)); }

.oa-bar-spacer { height: 0; }

/* ── Wider screens ── */
@media (min-width: 560px) {
  .oa-actions { flex-direction: row; }
  .oa-actions .oa-btn { flex: 1 1 0; width: auto; min-width: 0; }
  .oa-dialog { padding: 24px 24px 20px; width: calc(100% - 32px); }
  .oa-cat__desc { padding-right: 56px; }
}
@media (min-width: 900px) {
  .oa-bar { padding-left: 24px; padding-right: 24px; }
  .oa-bar__inner { flex-direction: row; align-items: center; gap: 28px; }
  .oa-bar__copy { flex: 1 1 auto; }
  .oa-bar .oa-actions { flex: 0 0 auto; }
  .oa-bar .oa-actions .oa-btn { flex: 0 0 auto; width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  .oa-btn, .oa-switch, .oa-switch::after, .oa-status { transition: none; }
}

@media (forced-colors: active) {
  .oa-switch { border: 1px solid ButtonText; }
  .oa-switch:checked { background: Highlight; }
}

@media print {
  .oa-bar, .oa-dialog, .oa-backdrop, .oa-fab, .oa-status, .oa-bar-spacer { display: none !important; }
}
