.footer-theme-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  margin-top: 4px;
  padding-top: 28px;
  border-top: 1px solid #e1e4ec;
}

.footer-theme-row .footer-copyright {
  margin: 0;
}

.theme-switcher {
  display: inline-grid;
  grid-template-columns: repeat(3, 34px);
  flex: 0 0 auto;
  gap: 2px;
  padding: 4px;
  border: 1px solid #d9dde7;
  border-radius: 8px;
  background: #eceff5;
  box-shadow: inset 0 1px 2px rgba(17, 21, 39, 0.05);
}

.theme-switcher-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #687286;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.theme-switcher-button:hover {
  color: #20283a;
  background: rgba(255, 255, 255, 0.6);
}

.theme-switcher-button.is-active {
  background: #fff;
  color: #315ff4;
  box-shadow: 0 1px 4px rgba(25, 35, 58, 0.16);
}

.theme-switcher-button:focus-visible {
  outline: 2px solid #315ff4;
  outline-offset: 2px;
  z-index: 2;
}

.theme-switcher-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-switcher-button::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  z-index: 10;
  width: max-content;
  max-width: 150px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #161b27;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.theme-switcher-button:hover::after,
.theme-switcher-button:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.footer.footer--theme-only {
  display: block;
  margin-top: auto;
  padding-top: 24px;
  padding-bottom: 24px;
}

.footer--theme-only .footer-theme-row {
  justify-content: flex-end;
  margin: 0;
  padding: 0;
  border: 0;
}

body.theme-footer-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.theme-footer-page > main {
  flex: 1 0 auto;
}

body.theme-footer-page .reveal {
  opacity: 1;
  transform: none;
}

html[data-theme-effective='dark'] .footer-theme-row {
  border-top-color: #222d3e;
}

html[data-theme-effective='dark'] .theme-switcher {
  border-color: #303b4e;
  background: #111824;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.24);
}

html[data-theme-effective='dark'] .theme-switcher-button {
  color: #8794a8;
}

html[data-theme-effective='dark'] .theme-switcher-button:hover {
  color: #e8eef9;
  background: #1b2534;
}

html[data-theme-effective='dark'] .theme-switcher-button.is-active {
  color: #8eb7ff;
  background: #263246;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

html[data-theme-effective='dark'] .theme-switcher-button:focus-visible {
  outline-color: #8eb7ff;
}

@media (max-width: 560px) {
  .footer-theme-row {
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 24px;
  }

  .footer-theme-row .footer-copyright {
    min-width: 0;
  }

  .footer {
    padding-bottom: calc(42px + env(safe-area-inset-bottom, 0px));
  }

  .footer.footer--theme-only {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 560px), (pointer: coarse) {
  .theme-switcher {
    grid-template-columns: repeat(3, 44px);
    margin-left: auto;
  }

  .theme-switcher-button {
    width: 44px;
    height: 44px;
  }

  .theme-switcher-button::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-switcher-button,
  .theme-switcher-button::after {
    transition: none;
  }
}
