/* Debt-clock microsite panel chrome only (logo + flag flanks).
 *
 * Clock colours, red outlines, and digit sizing live in the shared React
 * bundle. On this site the panel uses the same white card treatment as the
 * petition block (page background stays light grey).
 *
 * Loaded in the footer so nested-panel resets can beat the React root's own
 * padding when the clock sits inside .debt-clocksite-clock-panel.
 */

body.debt-clock-site .debt-clocksite-clock-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  margin-bottom: 1.75rem;
  padding: 2.5rem clamp(0.85rem, 2.5vw, 2.25rem) clamp(1.75rem, 4.5cqi, 2.75rem);
  border-radius: 12px;
  background: #fff !important;
  border: 1px solid #d4dce6 !important;
  box-shadow: 0 1px 3px rgba(16, 32, 46, 0.06) !important;
  overflow: visible;
  width: 100%;
  max-width: 1060px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  container-type: inline-size;
  container-name: debt-panel;
}

/* Bank card variant: no truck chrome; React card owns the red look. */
body.debt-clock-site .debt-clocksite-clock-panel--card {
  display: block;
  padding: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  max-width: min(100%, 540px);
}

body.debt-clock-site .debt-clocksite-clock-panel--card .debt-clocksite-clock-panel__clock {
  padding-left: 0;
  padding-right: 0;
}

body.debt-clock-site .debt-clocksite-clock-panel:not(.debt-clocksite-clock-panel--card) {
  --debt-flank-width: clamp(72px, 20cqi, 200px);
  --debt-flank-max-height: clamp(56px, 15cqi, 140px);
  /* Smaller flag so full 2:1 maple-leaf flag fits without side crop. */
  --debt-flag-height: clamp(40px, 9cqi, 72px);
  --debt-flag-width: calc(var(--debt-flag-height) * 2);
  --debt-flank-bottom-gap: clamp(0.65rem, 2.5cqi, 1.25rem);
  --debt-flank-inset-x: clamp(0.35rem, 4cqi, 3.5rem);
}

body.debt-clock-site .debt-clocksite-clock-panel__brand,
body.debt-clock-site .debt-clocksite-clock-panel__flag {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  grid-column: 1;
  grid-row: 1;
  z-index: 0;
  align-self: end;
  margin-bottom: var(--debt-flank-bottom-gap);
  pointer-events: none;
}

body.debt-clock-site .debt-clocksite-clock-panel__brand {
  width: var(--debt-flank-width);
  max-width: var(--debt-flank-width);
  justify-self: start;
  margin-left: var(--debt-flank-inset-x);
  justify-content: flex-start;
  /* Match flag: sit above clock layer so the plate + wordmark stay visible. */
  z-index: 2;
}

/* Explicit small 2:1 flag — height-driven so red bars stay fully visible. */
body.debt-clock-site .debt-clocksite-clock-panel__flag {
  width: var(--debt-flag-width);
  height: var(--debt-flag-height);
  max-width: var(--debt-flag-width);
  max-height: var(--debt-flag-height);
  justify-self: end;
  margin-right: max(var(--debt-flank-inset-x), 1rem);
  justify-content: flex-end;
  align-items: center;
  z-index: 2;
  overflow: visible;
}

body.debt-clock-site .debt-clocksite-clock-panel__brand .debt-clocksite-clock-panel__img {
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: var(--debt-flank-max-height);
  object-fit: contain;
  display: block;
}

body.debt-clock-site .debt-clocksite-clock-panel__flag .debt-clocksite-clock-panel__img {
  width: var(--debt-flag-width) !important;
  height: var(--debt-flag-height) !important;
  max-width: var(--debt-flag-width) !important;
  max-height: var(--debt-flag-height) !important;
  aspect-ratio: 2 / 1;
  object-fit: contain;
  object-position: center;
  display: block;
}

@container debt-panel (max-width: 720px) {
  body.debt-clock-site .debt-clocksite-clock-panel {
    --debt-flank-width: clamp(64px, 18cqi, 130px);
    --debt-flank-max-height: clamp(52px, 14cqi, 115px);
    --debt-flag-height: clamp(36px, 8cqi, 60px);
    --debt-flag-width: calc(var(--debt-flag-height) * 2);
    --debt-flank-bottom-gap: clamp(0.55rem, 2cqi, 1rem);
    --debt-flank-inset-x: clamp(0.25rem, 2.5cqi, 1.25rem);
    padding-bottom: clamp(1.35rem, 4cqi, 2rem);
  }
}

@container debt-panel (max-width: 640px) {
  body.debt-clock-site .debt-clocksite-clock-panel__brand,
  body.debt-clock-site .debt-clocksite-clock-panel__flag {
    display: none !important;
  }

  body.debt-clock-site .debt-clocksite-clock-panel {
    padding-bottom: clamp(1.25rem, 3.5cqi, 1.75rem);
  }

  body.debt-clock-site .debt-clocksite-clock-panel__clock {
    padding-left: 0;
    padding-right: 0;
  }
}

@container debt-panel (max-width: 480px) {
  body.debt-clock-site .debt-clocksite-clock-panel {
    --debt-flank-width: clamp(52px, 16cqi, 96px);
    --debt-flank-max-height: clamp(46px, 13cqi, 96px);
    --debt-flank-bottom-gap: clamp(0.45rem, 1.75cqi, 0.85rem);
    --debt-flank-inset-x: clamp(0.15rem, 2cqi, 0.75rem);
    padding: 1.5rem 0.5rem clamp(1.15rem, 3.5cqi, 1.65rem);
    border-radius: 14px;
  }
}

@container debt-panel (max-width: 360px) {
  body.debt-clock-site .debt-clocksite-clock-panel {
    --debt-flank-width: clamp(44px, 14cqi, 72px);
    --debt-flank-max-height: clamp(40px, 12cqi, 80px);
    --debt-flank-bottom-gap: clamp(0.4rem, 1.5cqi, 0.75rem);
  }
}

body.debt-clock-site .debt-clocksite-clock-panel__clock {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  min-width: 0;
  text-align: center;
  position: relative;
  z-index: 1;
  isolation: isolate;
  /* Keep Your Share / counters from covering logo + flag flanks. */
  padding-left: calc(var(--debt-flank-width) + var(--debt-flank-inset-x));
  padding-right: calc(var(--debt-flag-width) + var(--debt-flank-inset-x));
  box-sizing: border-box;
}

/* Standalone embed on this site: match the white petition card. */
body.debt-clock-site .ctf-debt-clock-root:not([data-variant="card"]) {
  background: #fff !important;
  border: 1px solid #d4dce6 !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 3px rgba(16, 32, 46, 0.06) !important;
}

/* Nested truck panel: drop the embed's own chrome (panel owns the white card).
   Do NOT apply to bank-card variant — that wipes the red #d81f27 face. */
body.debt-clock-site .debt-clocksite-clock-panel:not(.debt-clocksite-clock-panel--card) .ctf-debt-clock-root,
body.debt-clock-site .debt-clocksite-clock-panel:not(.debt-clocksite-clock-panel--card) .ctf-debt-clock-root > div {
  background: transparent !important;
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
  width: 100% !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Bank card: keep mount clean, but leave the red React card face alone. */
body.debt-clock-site .debt-clocksite-clock-panel--card {
  max-width: min(100%, 720px);
}

body.debt-clock-site .debt-clocksite-clock-panel--card .ctf-debt-clock-root {
  background: transparent !important;
  margin: 0 0 1.25rem !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
  max-width: min(100%, 720px);
  width: 100%;
}

body.debt-clock-site .debt-clocksite-split .debt-clocksite-clock-panel--card {
  margin-top: 0;
  align-self: start;
}

body.debt-clock-site .debt-clocksite-clock-panel .debt-clocksite-hero-clock,
body.debt-clock-site .debt-clocksite-clock-panel .debt-clocksite-clock-lane {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  max-width: none;
  width: 100%;
}

/* Standalone lane (no flank panel): let the React embed provide the grey billboard. */
body.debt-clock-site .debt-clocksite-hero-clock:not(.debt-clocksite-clock-panel__clock),
body.debt-clock-site .debt-clocksite-single .debt-clocksite-clock-lane:not(.debt-clocksite-clock-panel__clock) {
  margin-bottom: 1.75rem;
  padding: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  text-align: center;
  width: 100%;
  max-width: 1060px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 768px) {
  body.debt-clock-site .debt-clocksite-clock-panel {
    padding: 2rem clamp(0.65rem, 2vw, 1rem) 1.75rem;
  }

  @supports not (container-type: inline-size) {
    body.debt-clock-site .debt-clocksite-clock-panel {
      --debt-flank-width: clamp(64px, 14vw, 130px);
      --debt-flank-max-height: clamp(52px, 12vw, 115px);
      --debt-flank-bottom-gap: clamp(0.55rem, 2vw, 1rem);
      --debt-flank-inset-x: clamp(0.25rem, 2vw, 1.25rem);
      padding-bottom: clamp(1.35rem, 3vw, 2rem);
    }
  }
}

@media (max-width: 680px) {
  body.debt-clock-site .debt-clocksite-clock-panel__brand,
  body.debt-clock-site .debt-clocksite-clock-panel__flag {
    display: none !important;
  }

  body.debt-clock-site .debt-clocksite-clock-panel {
    padding-bottom: clamp(1.25rem, 3vw, 1.75rem);
  }

  body.debt-clock-site .debt-clocksite-clock-panel__clock {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 480px) {
  @supports not (container-type: inline-size) {
    body.debt-clock-site .debt-clocksite-clock-panel {
      --debt-flank-width: clamp(48px, 12vw, 96px);
      --debt-flank-max-height: clamp(44px, 11vw, 96px);
      --debt-flank-bottom-gap: clamp(0.45rem, 1.5vw, 0.85rem);
      --debt-flank-inset-x: clamp(0.15rem, 1.5vw, 0.75rem);
      padding: 1.5rem 0.5rem clamp(1.15rem, 3vw, 1.65rem);
      border-radius: 14px;
    }
  }
}

/* Dark mode: clock panel card surface (keeps !important parity with light rules). */
html[data-theme="dark"] body.debt-clock-site .debt-clocksite-clock-panel:not(.debt-clocksite-clock-panel--card) {
  background: #1a222d !important;
  border-color: #2f3b4a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] body.debt-clock-site .ctf-debt-clock-root:not([data-variant="card"]) {
  background: #1a222d !important;
  border-color: #2f3b4a !important;
}

/* Soft muted plate behind flank CTF logo (black wordmark on dark panel) */
html[data-theme="dark"] body.debt-clock-site .debt-clocksite-clock-panel__brand {
  background: #c8ced6;
  border: 1px solid #aeb6c0;
  border-radius: 0.45rem;
  padding: 0.3rem 0.4rem;
  box-sizing: border-box;
}

/* Auto + OS dark: same color overrides as html[data-theme="dark"]. Keep in sync with the block above. */
@media (prefers-color-scheme: dark) {
html:is([data-theme="auto"], :not([data-theme])) body.debt-clock-site .debt-clocksite-clock-panel:not(.debt-clocksite-clock-panel--card) {
  background: #1a222d !important;
  border-color: #2f3b4a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35) !important;
}

html:is([data-theme="auto"], :not([data-theme])) body.debt-clock-site .ctf-debt-clock-root:not([data-variant="card"]) {
  background: #1a222d !important;
  border-color: #2f3b4a !important;
}

/* Soft muted plate behind flank CTF logo (black wordmark on dark panel) */
html:is([data-theme="auto"], :not([data-theme])) body.debt-clock-site .debt-clocksite-clock-panel__brand {
  background: #c8ced6;
  border: 1px solid #aeb6c0;
  border-radius: 0.45rem;
  padding: 0.3rem 0.4rem;
  box-sizing: border-box;
}
}
