/* Income Investing AI — cookie consent bar.

   Self-contained and loaded only by templates/_cookie_consent.html, which
   itself renders only when a decision is genuinely needed. Nothing here is a
   global class: everything is scoped under .ii-consent, so this file cannot
   change any other page even when it is loaded.

   Colours come entirely from the site variables, so the bar follows the light,
   dark and warm themes without a single hard-coded value. Layout is logical
   (inset-inline, margin-inline) so it flips correctly in Arabic.
*/

.ii-consent {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 95;                      /* above the .rails (90), below nothing else */
  background: var(--surface);
  border-top: 1px solid var(--border-strong, var(--border));
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px));
}

/* The bar ships hidden and is shown by consent.js only when no decision is
   recorded. Stated explicitly so the display rules below cannot beat [hidden]. */
.ii-consent[hidden] { display: none; }

.ii-consent-inner {
  max-width: var(--maxw, 1220px);
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px 28px;
  justify-content: space-between;
}

.ii-consent-copy { flex: 1 1 460px; min-width: 0; max-width: 74ch; }
.ii-consent-copy p { margin: 0 0 6px; color: var(--ink-soft); }
.ii-consent-copy p:last-child { margin-bottom: 0; }

.ii-consent-title {
  margin: 0 0 5px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.01em;
}

.ii-consent-own { color: var(--ink-mute); font-size: 13px; }

/* site.css pulls .guided-note up into the paragraph above it, which is right in
   a document and wrong inside a bar. Guided readers get the plain-language line
   here too — it is the difference between the two views on this surface. */
.ii-consent .guided-note { margin: 8px 0 0; font-size: 13px; }

.ii-consent-links { font-size: 13px; margin-top: 8px; }
.ii-consent-links a { color: var(--accent); text-decoration: underline; }
.ii-consent-links span { color: var(--ink-mute); margin-inline: 6px; }

/* Both real choices are one control with one appearance. Declining is never
   smaller, greyer, further away or harder to hit than accepting. */
.ii-consent-actions {
  flex: 0 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.ii-consent-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  min-width: 190px;
  padding: 11px 18px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-dark, var(--accent));
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.ii-consent-btn:hover { background: var(--accent-soft); }
.ii-consent-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Postponing is a third, quieter option — not a disguised decline. Decline is
   right there, at full weight, next to accept. */
.ii-consent-later {
  font: inherit;
  font-size: 13px;
  padding: 9px 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink-mute);
  text-decoration: underline;
  cursor: pointer;
}
.ii-consent-later:hover { color: var(--ink); }
.ii-consent-later:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The fixed rails (view / language / theme) share this corner. Lift them clear
   of the bar while it is open, and give the page enough bottom padding that the
   footer is still readable underneath it. --ii-consent-h is set by consent.js
   from the bar's real height; the fallback covers the moment before that. */
html.ii-consent-open .rails { bottom: calc(var(--ii-consent-h, 132px) + 16px); }
html.ii-consent-open body { padding-bottom: calc(var(--ii-consent-h, 132px) + 12px); }

@media (max-width: 860px) {
  .ii-consent { font-size: 13.5px; padding-top: 12px; max-height: 62vh; overflow-y: auto; }
  .ii-consent-inner { padding: 0 16px; gap: 12px; }
  .ii-consent-copy { flex-basis: 100%; }
  .ii-consent-actions { flex-basis: 100%; gap: 8px; }
  .ii-consent-btn { flex: 1 1 190px; min-width: 0; padding: 12px 14px; }
  .ii-consent-later { flex: 1 1 100%; text-align: center; }
  html.ii-consent-open .rails { bottom: calc(var(--ii-consent-h, 210px) + 10px); }
}

/* ---- Controls on /cookies ----------------------------------------------
   The bar itself may never render on that page (advertising can be off while a
   decision from an earlier visit is still recorded), but the withdraw controls
   and the live storage list are always there, so /cookies loads this file too.
   The buttons themselves use the site's own .btn classes; only their layout
   belongs here. */
.ii-consent-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 6px; }
.ii-consent-status { margin-top: 0; }
.ii-storage-list { margin: 12px 0 0; }
.ii-storage-list code {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px; font-size: 12.5px;
}
.ii-storage-list span { color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
  .ii-consent-btn { transition: none; }
}

@media print {
  .ii-consent { display: none !important; }
}
