/* =========================================================================
   TLC Base — Cookie consent (banner + preferences modal)
   Ported from the TLC-2026 public site. THE shared copy: every hub loads this
   one file from TLC Base (see inc/setup.php), so a change here changes the
   widget everywhere.

   Self-contained: the brand colours and the typeface are declared here on
   #cc-root, so the widget looks the same on every hub regardless of which
   stylesheet — or which font — a given page happens to load.
   ========================================================================= */

/* Inter, the hub page's face. Imported rather than left to the host page: the
   hubs do not share a typeface, and the widget is meant to read as one piece of
   TLC furniture on all of them. Must stay above every rule below — an @import
   after a rule is ignored. Weights match the ones the widget actually uses. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
#cc-root,
.cc-embed-blocked {
  --navy:        #005695;
  --navy-deep:   #0a3050;
  --green:       #74bc4a;
  --green-deep:  #5fa238;
  --green-dark:  #5fa238;
  --teal:        #1D6F73;
  --text:        #1f2a37;
  --text-muted:  #5a6776;
  --line:        #e3e8ee;
  --bg:          #f4f6f8;
  --white:       #ffffff;
  --radius-md:   18px;
  --radius-lg:   28px;
  --radius-pill: 999px;
  /* Inter — the hub's own face (--font in css/style.css), used here on every
     hub so the popup is one recognisable thing wherever it appears rather than
     changing shape from site to site. The hubs do not share a face (Staffnet,
     AdminHub, Knowledge and Guides are Poppins), so it cannot be left to the
     page: the @import above brings Inter with the widget, which is why this is
     a real stack and not 'inherit'. */
  --font-sans:   'Inter', ui-sans-serif, system-ui, -apple-system, Helvetica, Arial, sans-serif;
}

/* ---- Baseline: the widget starts from the same place on every hub --------
   It lands on nine sites with nine stylesheets, and some of them style BARE
   ELEMENTS hard. Staffnet is the extreme: every h1-h6 is "Visby-light" at
   line-height 1em, every <p> is 1.2rem/300 with 1.8rem lines and extra
   letter-spacing, and every <label> carries `margin: 20px 0 10px` and
   `width: 100%` — and the consent toggles ARE labels. A bare element rule
   beats inheritance, so the popup wore the host's type and the host's spacing
   no matter what the container said. TLC Base and Guides disagreed the other
   way: TLC Base opens with `*{margin:0;padding:0}` and Guides resets only
   box-sizing, so the same panel came out ~150px taller on Guides.

   Hence an ID-scoped baseline: #cc-root wins (1,0,1) over anything a host
   does with bare elements, and every widget rule that overrides part of it
   carries #cc-root too — same specificity, later in the file, so it wins.
   ANY RULE ADDED BELOW that targets one of these tags must be #cc-root-scoped
   as well, or the baseline will quietly flatten it. */
#cc-root :is(h1, h2, h3, h4, h5, h6, p, a, ul, ol, li, label, strong, b),
.cc-embed-blocked :is(h1, h2, h3, h4, h5, h6, p, a, ul, ol, li, label, strong, b) {
  margin: 0;
  padding: 0;
  width: auto;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
  color: inherit;
  list-style: none;
}
/* Bold survives the baseline: it zeroes font-weight so a host cannot impose
   its own (Staffnet puts every heading at 200), and these two are the only
   places the widget relies on the browser's default bold. */
#cc-root :is(strong, b),
.cc-embed-blocked :is(strong, b) { font-weight: 700; }
.cc-banner, .cc-modal, .cc-embed-blocked { line-height: 1.5; }

.cc-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Banner ---- */
.cc-banner {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, calc(100% + 40px));
  width: min(1100px, calc(100% - 32px));
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 50px rgba(10, 48, 80, 0.22);
  z-index: 9000;
  opacity: 0;
  visibility: hidden;
  transition: transform .4s cubic-bezier(.16,1,.3,1), opacity .3s ease, visibility .3s;
  font-family: var(--font-sans);
}
.cc-banner.is-open { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.cc-banner__inner {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 22px 26px;
}
#cc-root .cc-banner__title { font-size: 1.05rem; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
#cc-root .cc-banner__text p { font-size: .9rem; line-height: 1.55; color: var(--text-muted); margin: 0; }
#cc-root .cc-banner__text a { color: var(--green-dark); font-weight: 600; text-decoration: underline; }
#cc-root .cc-banner__text a:hover { color: var(--navy); }
.cc-banner__actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: center;
}

/* ---- Shared buttons (Accept / Reject equal prominence) ---- */
.cc-btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: .88rem;
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .15s ease;
  border: 2px solid transparent;
  cursor: pointer;
}
.cc-btn:hover { transform: translateY(-1px); }
.cc-btn:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.cc-btn--solid { background: var(--green); color: var(--white); }
.cc-btn--solid:hover { background: var(--green-deep); }
.cc-btn--ghost { background: var(--white); color: var(--navy); border-color: var(--navy); }
.cc-btn--ghost:hover { background: var(--navy); color: var(--white); }

/* ---- Overlay + modal ---- */
.cc-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 48, 80, 0.5);
  z-index: 9100;
  opacity: 0;
  transition: opacity .25s ease;
}
.cc-overlay.is-open { opacity: 1; }
/* When closed the [hidden] attr must win over the author display rules below,
   otherwise the invisible full-screen modal keeps intercepting clicks. */
.cc-modal[hidden], .cc-overlay[hidden] { display: none; }
.cc-modal {
  position: fixed; inset: 0;
  z-index: 9200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .25s ease;
  font-family: var(--font-sans);
}
.cc-modal.is-open { opacity: 1; }
.cc-modal__panel {
  background: var(--white);
  width: min(620px, 100%);
  max-height: min(85vh, 760px);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(10, 48, 80, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(14px) scale(.98);
  transition: transform .3s cubic-bezier(.16,1,.3,1);
}
.cc-modal.is-open .cc-modal__panel { transform: none; }
.cc-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
}
#cc-root .cc-modal__head h2 { font-size: 1.3rem; font-weight: 700; color: var(--navy); }
.cc-modal__close {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  color: var(--navy);
  cursor: pointer;
  transition: background .2s ease;
}
.cc-modal__close:hover { background: var(--bg); }
.cc-modal__body { padding: 22px 26px; overflow-y: auto; overflow-x: hidden; }
#cc-root .cc-modal__body > p { font-size: .92rem; color: var(--text-muted); margin-bottom: 20px; }
#cc-root .cc-modal__body > p a { color: var(--green-dark); font-weight: 600; text-decoration: underline; }
.cc-modal__foot {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end;
  padding: 18px 26px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

/* ---- Category rows ---- */
.cc-cat { padding: 16px 0; border-top: 1px solid var(--line); }
.cc-cat:first-of-type { border-top: 0; }
.cc-cat__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
#cc-root .cc-cat__title { font-size: 1rem; font-weight: 700; color: var(--navy-deep); }
#cc-root .cc-cat__desc { font-size: .86rem; color: var(--text-muted); margin-top: 6px; }
.cc-cat__always { font-size: .8rem; font-weight: 600; color: var(--green-dark); flex-shrink: 0; }

/* ---- Toggle switch ---- */
#cc-root .cc-toggle { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; cursor: pointer; }
.cc-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.cc-toggle > span[aria-hidden],
.cc-toggle--locked > span {
  width: 46px; height: 26px; border-radius: var(--radius-pill);
  background: #c7d0da; position: relative; transition: background .2s ease; display: block;
}
.cc-toggle > span[aria-hidden]::after,
.cc-toggle--locked > span::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s ease;
}
.cc-toggle input:checked + span { background: var(--green); }
.cc-toggle input:checked + span::after { transform: translateX(20px); }
.cc-toggle input:focus-visible + span { outline: 3px solid var(--green); outline-offset: 2px; }
.cc-toggle--locked > span { background: var(--green); opacity: .55; cursor: not-allowed; }
.cc-toggle--locked > span::after { transform: translateX(20px); }

/* ---- Gated embed placeholder ---- */
.cc-embed-blocked {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center;
  width: 100%; min-height: 320px; height: 100%;
  padding: 32px;
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-sans);
}
.cc-embed-blocked p { font-size: .95rem; max-width: 420px; }

/* ---- Floating "Cookie settings" button (bottom-left) ---- */
.cc-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 8900;          /* below banner (9000) / overlay (9100) / modal (9200) */
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(10, 48, 80, 0.28);
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.cc-fab[hidden] { display: none; }
.cc-fab svg { width: 28px; height: 28px; display: block; }
.cc-fab:hover {
  background: var(--green-deep);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(10, 48, 80, 0.35);
}
.cc-fab:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .cc-fab { transition: none; }
}

/* Below 570px lift the button above the fixed bottom nav bar (60px tall) */
@media (max-width: 569px) {
  .cc-fab { bottom: 76px; }
}

@media (max-width: 860px) {
  .cc-banner__inner { flex-direction: column; align-items: stretch; gap: 16px; padding: 20px; }
  .cc-banner__actions { flex-wrap: wrap; }
  .cc-banner__actions .cc-btn { flex: 1 1 auto; text-align: center; }
  .cc-modal__foot { justify-content: stretch; }
  .cc-modal__foot .cc-btn { flex: 1 1 auto; }
}
