/* Consent UI: first-visit banner, persistent reopen control, preference dialog, and motion states. */
.consent-layer {
  --consent-max: 1600px;
  position: fixed;
  z-index: 10000;
  right: var(--space-4);
  bottom: var(--space-4);
  left: var(--space-4);
  width: auto;
  min-width: 0;
  grid-template-columns: minmax(0, var(--consent-max));
  display: grid;
  justify-content: center;
  place-items: center;
  pointer-events: none;
}

.consent-layer[hidden],
.consent-dialog[hidden],
.consent-reopen[hidden] {
  display: none;
}

.consent-layer.is-minimizing .consent-banner {
  transform-origin: right bottom;
  animation: consent-banner-minimize 420ms var(--motion-ease) both;
}

/* First-visit choices are visually distinct from the preferences dialog; cookie-consent.js controls their lifecycle. */
.consent-banner {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: var(--consent-max);
  padding: clamp(18px, 1.7vw, 24px) clamp(24px, 3.2vw, 48px);
  border: 1px solid color-mix(in srgb, var(--color-brand) 22%, var(--color-border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-surface) 96%, var(--color-surface-warm));
  box-shadow: var(--shadow-lg);
  color: var(--color-text);
  display: grid;
  justify-items: stretch;
  text-align: center;
  pointer-events: auto;
  animation: consent-banner-rise 520ms var(--motion-ease) both;
}

.consent-banner__close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: var(--close-control-size);
  height: var(--close-control-size);
  display: grid;
  padding: 0;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--color-brand) 28%, transparent);
  border-radius: var(--radius-round);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
  color: var(--color-brand);
  cursor: pointer;
  transition:
    color var(--motion-fast) var(--motion-ease),
    background var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease);
}

.consent-banner__close span,
.consent-dialog__close span {
  position: relative;
  width: var(--close-control-mark);
  height: var(--close-control-mark);
  display: block;
  overflow: hidden;
  font-size: 0;
  line-height: 0;
  transform: none;
}

.consent-banner__close span::before,
.consent-banner__close span::after,
.consent-dialog__close span::before,
.consent-dialog__close span::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--close-control-mark);
  height: var(--close-control-stroke);
  border-radius: var(--radius-pill);
  background: currentColor;
  content: "";
  transform-origin: center;
}

.consent-banner__close span::before,
.consent-dialog__close span::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.consent-banner__close span::after,
.consent-dialog__close span::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.consent-banner__close:hover {
  background: var(--color-brand-accent);
  color: var(--color-text-inverse);
}

.consent-banner__close:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

.consent-banner__eyebrow {
  display: none;
}

.consent-banner h2,
.consent-dialog h2 {
  margin: 0;
  color: #6e9c56;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: var(--leading-heading);
  overflow-wrap: anywhere;
}

.consent-banner h2 {
  justify-self: center;
  color: #2e7d52;
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
}

.consent-banner__copy {
  justify-self: center;
  margin: 8px auto 16px;
  width: min(100%, 1120px);
  max-width: 100%;
  font-size: var(--type-small);
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.consent-banner__copy a,
.consent-dialog a {
  color: var(--color-brand);
  font-weight: 600;
  text-underline-offset: 3px;
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.consent-banner .consent-actions {
  width: 100%;
}

.consent-actions .button {
  flex: 1 1 160px;
}

.consent-banner .consent-actions .button {
  min-height: 48px;
  padding-block: 10px;
}

@keyframes consent-banner-rise {
  from {
    opacity: 0;
    transform: translateY(calc(100% + var(--space-4)));
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes consent-banner-minimize {
  to {
    opacity: 0;
    transform: translateY(34px) scale(0.08);
  }
}

/* Persistent preferences entry point remains available after the banner closes so visitors can revise consent. */
.consent-reopen {
  position: fixed;
  z-index: 10000;
  right: max(24px, calc((100vw - 1520px) / 2 - 70px));
  bottom: clamp(16px, 2vw, 28px);
  width: 46px;
  height: 46px;
  display: grid;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-round);
  background: var(--color-brand);
  box-shadow: var(--shadow-lg);
  color: var(--color-surface);
  cursor: pointer;
  animation: consent-reopen-arrive 300ms var(--motion-ease) backwards;
  transition:
    transform var(--motion-floating-control-lift-duration) var(--motion-ease),
    background var(--motion-floating-control-color-duration) var(--motion-ease);
}

.consent-reopen:hover,
.consent-reopen:focus-visible {
  background: var(--floating-control-hover-background);
  transform: translateY(var(--motion-floating-control-lift-distance));
}

.consent-reopen:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 4px;
}

.consent-reopen__mark {
  width: 22px;
  height: 22px;
  display: block;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.consent-reopen__mark circle {
  fill: currentColor;
  stroke: none;
}

@keyframes consent-reopen-arrive {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.75);
  }
}

.consent-actions [data-consent-manage] {
  border-color: var(--color-brand);
  background: var(--color-brand);
  color: var(--color-text-inverse);
}

.consent-actions [data-consent-manage]:hover {
  border-color: var(--color-brand-accent);
  background: var(--color-brand-accent);
}

.consent-actions [data-consent-dialog-accept] {
  border-color: var(--color-brand);
  background: var(--color-brand);
  color: var(--color-text-inverse);
}

.consent-actions [data-consent-dialog-accept]:hover {
  border-color: var(--color-brand-accent);
  background: var(--color-brand-accent);
}

/* Preference dialog and backdrop expose the shared consent categories; JavaScript owns focus and saved choices. */
.consent-dialog {
  position: relative;
  margin: auto;
  width: min(calc(100% - 32px), 820px);
  max-height: min(880px, calc(100dvh - 32px));
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--modal-surface);
  box-shadow: var(--shadow-lg);
  color: var(--color-text);
  overflow: hidden;
}

.consent-dialog::backdrop {
  background: var(--modal-backdrop-background);
  backdrop-filter: var(--modal-backdrop-filter);
}

.consent-dialog[open] {
  animation: nka-modal-panel-enter var(--modal-panel-enter) var(--modal-motion-ease) both;
}

.consent-dialog[open]::backdrop {
  animation: nka-modal-backdrop-enter var(--modal-backdrop-enter) var(--modal-motion-ease) both;
}

.consent-dialog[open].is-closing {
  pointer-events: none;
  animation: nka-modal-panel-exit var(--modal-panel-exit) var(--modal-motion-ease) both;
}

.consent-dialog[open].is-closing::backdrop {
  animation: nka-modal-backdrop-exit var(--modal-backdrop-exit) var(--modal-motion-ease) both;
}

.consent-dialog__inner {
  max-height: min(680px, calc(100dvh - 232px));
  overflow: auto;
  padding: clamp(24px, 5vw, 40px);
}

.consent-dialog__visual {
  height: clamp(130px, 20vw, 190px);
  /* Temporary shared artwork treatment until final cookie imagery is approved. */
  background: var(--nka-stage-field);
}

.consent-dialog__close {
  position: absolute;
  z-index: 5;
  top: var(--modal-close-inset);
  right: var(--modal-close-inset);
  display: grid;
  width: var(--close-control-size);
  height: var(--close-control-size);
  padding: 0;
  place-items: center;
  border: 1px solid var(--modal-close-border);
  border-radius: var(--radius-round);
  background: var(--modal-close-background);
  box-shadow: var(--shadow-sm);
  color: var(--modal-close-color);
  cursor: pointer;
  transition:
    transform var(--motion-fast) var(--motion-ease),
    background var(--motion-fast) var(--motion-ease);
}

.consent-dialog__close:hover {
  background: var(--modal-close-hover-background);
  color: var(--modal-close-hover-color);
}

.consent-dialog__close:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

.consent-dialog__intro {
  margin: var(--space-3) 0 var(--space-5);
  line-height: var(--leading-body);
}

.consent-category {
  padding: var(--space-4) 0;
  border-top: 1px solid var(--color-border);
}

.consent-category__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.consent-category__heading > div {
  flex: 1 1 auto;
  min-width: 0;
}

.consent-category h3 {
  margin: 0;
  color: #2e7d52;
  font-size: 1rem;
}

.consent-category p {
  margin: var(--space-2) 0 0;
  max-width: none;
  font-size: var(--type-small);
  line-height: 1.55;
}

.consent-always {
  color: var(--color-brand);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Category switches retain native input semantics; the adjacent visual track reflects checked and focus state. */
.consent-switch {
  position: relative;
  width: 50px;
  min-width: 50px;
  height: 28px;
}

.consent-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.consent-switch span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: #d8d8d2;
  cursor: pointer;
  transition: background var(--motion-fast) var(--motion-ease);
}

.consent-switch span::after {
  position: absolute;
  content: "";
  width: 20px;
  height: 20px;
  top: 3px;
  left: 3px;
  border-radius: var(--radius-round);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--motion-fast) var(--motion-ease);
}

.consent-switch input:checked + span {
  border-color: var(--color-brand);
  background: var(--color-brand);
}

.consent-switch input:checked + span::after {
  transform: translateX(22px);
}

.consent-switch input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--color-focus) 60%, transparent);
  outline-offset: 3px;
}

body.has-consent-dialog {
  overflow: hidden;
}

@media (min-width: 561px) and (max-width: 1024px) {
  .consent-reopen {
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
  }
}

/* Mobile consent layout prioritizes readable copy and full-width, equal-choice actions. */
@media (max-width: 560px) {
  .consent-reopen {
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
  }

  .consent-layer {
    right: var(--space-2);
    bottom: var(--space-2);
    left: var(--space-2);
    width: auto;
  }

  .consent-banner {
    padding: 22px var(--space-4) var(--space-4);
    text-align: left;
  }

  .consent-banner h2 {
    justify-self: stretch;
    max-width: calc(100% - 58px);
    font-size: clamp(1.55rem, 7vw, 1.9rem);
    line-height: 1.08;
    text-wrap: balance;
  }

  .consent-banner__copy {
    justify-self: stretch;
    margin-inline: 0;
    text-align: left;
    text-wrap: pretty;
  }

  .consent-actions {
    display: grid;
  }

  .consent-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .consent-banner {
    animation: none;
  }

  .consent-layer.is-minimizing .consent-banner,
  .consent-reopen {
    animation: none;
  }

  .consent-banner *,
  .consent-dialog * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .consent-dialog__visual:hover img {
    transform: none;
  }

  .consent-dialog[open],
  .consent-dialog[open]::backdrop,
  .consent-dialog[open].is-closing,
  .consent-dialog[open].is-closing::backdrop {
    animation: none;
  }
}

/* Shared cookie-preferences artwork. The centered editorial crop keeps both
   faces, hands, and the privacy artwork readable in the shallow banner. */
.consent-dialog__visual {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background-color: #e9dfcf;
}

.consent-dialog__visual-image {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 30%;
  transform: scale(1);
  transition: transform var(--card-media-zoom-duration) var(--card-media-zoom-ease);
  will-change: transform;
}

.consent-dialog__visual:hover .consent-dialog__visual-image,
.consent-dialog__visual:focus-within .consent-dialog__visual-image {
  transform: scale(var(--card-media-zoom-scale));
}

.consent-dialog__visual::before,
.consent-dialog__visual::after {
  position: absolute;
  content: "";
  inset: 0;
  pointer-events: none;
}

.consent-dialog__visual::before {
  z-index: 1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(30, 57, 49, 0.08));
}

.consent-dialog__visual::after {
  z-index: 2;
  background-image: var(--nka-grain);
  background-size: 160px 160px;
  mix-blend-mode: soft-light;
  opacity: 0.14;
}

@media (min-width: 561px) and (max-width: 1024px) {
  .consent-dialog__visual-image {
    object-position: center 30%;
  }
}

@media (max-width: 560px) {
  .consent-dialog__visual-image {
    object-position: center;
  }
}

/* Final cookie all-caps label pass. */
.consent-always {
  font-family: var(--font-body);
  font-size: var(--type-eyebrow-size);
  font-weight: var(--type-eyebrow-weight);
  letter-spacing: var(--type-eyebrow-letter-spacing);
  line-height: var(--type-eyebrow-line-height);
  text-transform: uppercase;
}
