/*
 * The banner's own styles. Plain CSS on purpose: a gem that only works if the
 * host application runs Tailwind is half a gem.
 *
 * Every rule is scoped under .consently, .consently-embed or .consently-policy
 * and driven by custom properties, so restyling means overriding a handful of
 * variables rather than forking the markup:
 *
 *   :root { --consently-accent: #4f46e5; --consently-radius: 0; }
 *
 * The defaults live on :root rather than on .consently because a blocked embed
 * is somewhere else on the page entirely, and its button wears the same
 * classes: scoped to the banner, those variables would not reach it.
 */

:root {
  --consently-background: #ffffff;
  --consently-text: #111827;
  --consently-muted: #4b5563;
  --consently-accent: #111827;
  --consently-accent-text: #ffffff;
  --consently-border: rgba(17, 24, 39, 0.1);
  --consently-radius: 0.75rem;
  --consently-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --consently-max-width: 36rem;
}

.consently {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 50;
  padding: 0 1.5rem 1.5rem;
  /* The strip itself must not swallow clicks meant for the page behind it. */
  pointer-events: none;
}

.consently__card {
  pointer-events: auto;
  box-sizing: border-box;
  margin-inline-start: auto;
  max-width: var(--consently-max-width);
  padding: 1.5rem;
  border-radius: var(--consently-radius);
  background: var(--consently-background);
  color: var(--consently-text);
  box-shadow: var(--consently-shadow);
  outline: 1px solid var(--consently-border);
}

.consently__text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5rem;
}

.consently__link {
  color: inherit;
  font-weight: 600;
}

/* Collapsed to a zero-height grid row rather than display:none, which cannot
   be animated. The inner wrapper does the clipping. */
.consently__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.2s ease-out;
}

.consently__panel--open {
  grid-template-rows: 1fr;
}

.consently__panel-inner {
  overflow: hidden;
}

.consently__options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 1rem;
}

.consently__option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5rem;
}

.consently__option input {
  margin: 0.3rem 0 0;
  width: 1rem;
  height: 1rem;
  accent-color: var(--consently-accent);
}

.consently__option-name {
  display: block;
  font-weight: 600;
}

.consently__option-description {
  display: block;
  color: var(--consently-muted);
}

.consently__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 1rem;
}

.consently__button {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5rem;
  color: var(--consently-text);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.consently__button:hover {
  opacity: 0.75;
}

.consently__button--primary {
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  color: var(--consently-accent-text);
  background: var(--consently-accent);
}

.consently__button--quiet {
  color: var(--consently-muted);
}

.consently__button:focus-visible,
.consently__link:focus-visible {
  outline: 2px solid var(--consently-accent);
  outline-offset: 2px;
}

.consently-hidden {
  display: none !important;
}

/* Embedded videos and maps. The placeholder keeps the same box as the iframe
   it replaces, so nothing on the page jumps when consent arrives. */
.consently-embed {
  position: relative;
  aspect-ratio: var(--consently-embed-ratio, 16 / 9);
  width: 100%;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #f3f4f6;
}

.consently-embed__frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.consently-embed__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  text-align: center;
}

.consently-embed__text {
  margin: 0;
  max-width: 28rem;
  font-size: 0.875rem;
  line-height: 1.5rem;
  color: #4b5563;
}

/* The generated cookie policy. Deliberately quiet: it lands inside someone
   else's page and should inherit its typography. */
.consently-policy {
  --consently-policy-muted: #4b5563;
  --consently-policy-border: rgba(17, 24, 39, 0.1);
}

.consently-policy__category {
  margin-top: 2.5rem;
}

.consently-policy__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.consently-policy__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.consently-policy__status {
  flex: none;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.06);
  color: var(--consently-policy-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.consently-policy__status--granted {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.consently-policy__description,
.consently-policy__empty {
  margin: 0.25rem 0 0;
  color: var(--consently-policy-muted);
  font-size: 0.875rem;
}

.consently-policy__vendor {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--consently-policy-border);
}

.consently-policy__vendor-name {
  margin: 0;
  font-weight: 600;
}

.consently-policy__vendor-id {
  margin-inline-start: 0.5rem;
  color: var(--consently-policy-muted);
  font-weight: 400;
  font-size: 0.875rem;
}

.consently-policy__table {
  width: 100%;
  margin-top: 0.5rem;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: start;
}

.consently-policy__table th {
  padding: 0.25rem 0.75rem 0.25rem 0;
  color: var(--consently-policy-muted);
  font-weight: 500;
  text-align: start;
}

.consently-policy__table td {
  padding: 0.25rem 0.75rem 0.25rem 0;
  vertical-align: top;
}

.consently-policy__footer {
  margin-top: 2rem;
  font-size: 0.875rem;
}

@media (max-width: 40rem) {
  .consently {
    padding: 0 1rem 1rem;
  }

  .consently__card {
    max-width: none;
  }
}

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