/* International Phonetic Alphabet input method downloads. */
.ime-download {
  position: relative;
  z-index: 10;
  width: 100%;
  margin: 14px 0 0;
  color: var(--ink, #271331);
  font-family: inherit;
}

.ime-download[open] {
  z-index: 22;
}

.ime-download > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 11px 16px;
  border: 1.5px solid #cbb7dd;
  border-radius: 16px;
  background: #f5eefb;
  box-shadow: 0 2px 0 #ddd0eb;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  color: #362047;
  transition: background 0.16s, border-color 0.16s, transform 0.16s;
}

.ime-download > summary::-webkit-details-marker {
  display: none;
}

.ime-download > summary > svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.ime-download > summary .ime-expand {
  margin-left: auto;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  transition: transform 0.18s;
}

.ime-download[open] > summary .ime-expand {
  transform: rotate(45deg);
}

.ime-download > summary:hover {
  background: #ece0f7;
  border-color: #9e82b9;
  transform: translateY(-1px);
}

.ime-download > summary:focus-visible,
.ime-download a:focus-visible {
  outline: 3px solid #6f4e94;
  outline-offset: 3px;
}

.ime-download-body {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 16px;
  z-index: var(--z-popover, 30);
  max-height: var(--ime-panel-height, calc(100dvh - 24px));
  overflow: auto;
  overscroll-behavior: contain;
  border: 1.5px solid #d5c4e3;
  border-radius: 18px;
  background: #fffdf8;
  box-shadow: 0 12px 32px rgba(45, 24, 62, 0.16);
  animation: ime-popover-in 0.16s ease-out;
}

.ime-download[open]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 12px;
}

.ime-download[data-placement="above"] .ime-download-body {
  top: auto;
  bottom: calc(100% + 10px);
}

.ime-download[data-placement="above"][open]::after {
  top: auto;
  bottom: 100%;
}

.ime-download-intro {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted, #5d4d68);
}

.ime-download-intro strong {
  color: var(--ink, #271331);
  font-weight: 700;
}

.ime-platforms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ime-platform {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 44px;
  padding: 12px 13px;
  border: 1px solid #e2d7c7;
  border-radius: 12px;
  background: #fff9ec;
  color: var(--ink, #271331);
  text-decoration: none;
  min-width: 0;
  transition: background 0.16s, border-color 0.16s, transform 0.16s;
}

.ime-platform:nth-child(2) {
  background: #f2eafb;
}

.ime-platform:nth-child(3) {
  background: #fff2eb;
}

.ime-platform:nth-child(4) {
  background: #edf3ea;
}

.ime-platform:hover {
  border-color: #8b6aa6;
  transform: translateY(-1px);
}

.ime-platform strong {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.ime-platform strong svg {
  margin-left: auto;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.ime-platform span {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted, #5d4d68);
  overflow-wrap: anywhere;
}

.ime-download-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.ime-download-footer a {
  color: #5b3d7a;
  text-underline-offset: 3px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.ime-download-footer .ime-guide-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: 44px;
  padding: 8px 14px;
  border: 1.5px solid #9b80b5;
  border-radius: 10px;
  background: #eee4fa;
  color: #392348;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 0 #d8c9e6;
  transition: background 0.16s, border-color 0.16s, transform 0.16s;
}

.ime-guide-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}

.ime-download-footer .ime-guide-button:hover {
  background: #e4d7f6;
  border-color: #725295;
  transform: translateY(-1px);
}

@keyframes ime-popover-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile renders inline in normal document flow so it never covers hero art or jumps on scroll. */
@media (max-width: 600px) {
  .ime-download {
    margin-top: 12px;
  }

  .ime-download > summary {
    padding: 11px 14px;
    font-size: 15px;
  }

  .ime-download[open]::after {
    display: none;
  }

  .ime-download-body {
    position: static;
    max-height: none;
    overflow: visible;
    margin-top: 10px;
    padding: 14px;
    box-shadow: 0 4px 14px rgba(45, 24, 62, 0.08);
    animation: none;
  }
}

@media (max-width: 380px) {
  .ime-platforms {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ime-download > summary,
  .ime-download > summary .ime-expand,
  .ime-platform,
  .ime-download-footer .ime-guide-button {
    transition: none;
  }

  .ime-platform:hover,
  .ime-download > summary:hover,
  .ime-download-footer .ime-guide-button:hover {
    transform: none;
  }

  .ime-download-body {
    animation: none;
  }
}
