/*
 * Tianwu shared interaction language.
 * Loaded last on every public page so the approved compositions stay intact
 * while navigation, controls, cards and dialogs share one tactile rhythm.
 */

:root {
  --tw-ui-out: cubic-bezier(.23, 1, .32, 1);
  --tw-ui-move: cubic-bezier(.77, 0, .175, 1);
  --tw-ui-press: 120ms;
  --tw-ui-state: 180ms;
  --tw-ui-enter: 320ms;
  --tw-focus-gold: #ffe29a;
}

html body[data-page].site-interaction-v2 {
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 681px) {
  html body[data-page="draw"].home-landing-state.site-interaction-v2 .home-landing > .home-topbar {
    min-height: 74px !important;
    height: 74px !important;
  }

  /* Keep the selected wordmark underline clear of the Songti glyphs. */
  html body[data-page].site-interaction-v2 .home-topbar .home-brand {
    overflow: visible !important;
  }

  html body[data-page].site-interaction-v2 .home-topbar .home-brand::after {
    top: auto !important;
    bottom: -6px !important;
  }
}

/* Navigation: active, hover and keyboard focus now speak the same language. */
html body[data-page].site-interaction-v2 .home-topbar .home-brand,
html body[data-page].site-interaction-v2 .home-topbar .home-nav-link {
  transition:
    color var(--tw-ui-state) ease,
    opacity var(--tw-ui-state) ease,
    text-shadow var(--tw-ui-state) ease,
    transform var(--tw-ui-press) var(--tw-ui-out) !important;
}

html body[data-page].site-interaction-v2 .home-topbar .home-nav-link:focus-visible,
html body[data-page].site-interaction-v2 .home-topbar .home-brand:focus-visible {
  outline: 1px solid rgba(255, 226, 154, .92) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 3px rgba(242, 200, 108, .1) !important;
}

html body[data-page].site-interaction-v2 .home-topbar .home-nav-link:active,
html body[data-page].site-interaction-v2 .home-topbar .home-brand:active {
  transform: scale(.975) !important;
}

@media (hover: hover) and (pointer: fine) {
  html body[data-page].site-interaction-v2 .home-topbar .home-nav-link:hover,
  html body[data-page].site-interaction-v2 .home-topbar .home-brand:hover {
    text-shadow: 0 0 13px rgba(242, 200, 108, .24) !important;
  }
}

/* Press feedback is short and interruptible. Each rule preserves its base transform. */
html body[data-page].site-interaction-v2 .mode-button,
html body[data-page].site-interaction-v2 .filter-button,
html body[data-page].site-interaction-v2 .draw-mode-tab,
html body[data-page].site-interaction-v2 .spread-picker-option,
html body[data-page].site-interaction-v2 .spread-picker-start,
html body[data-page].site-interaction-v2 .primary-button,
html body[data-page].site-interaction-v2 .ghost-button,
html body[data-page].site-interaction-v2 .dialog-close,
html body[data-page].site-interaction-v2 .theme-segment,
html body[data-page].site-interaction-v2 .theme-redraw-button {
  transition:
    transform var(--tw-ui-press) var(--tw-ui-out),
    color var(--tw-ui-state) ease,
    border-color var(--tw-ui-state) ease,
    background-color var(--tw-ui-state) ease,
    box-shadow var(--tw-ui-state) ease,
    filter var(--tw-ui-state) ease,
    opacity var(--tw-ui-state) ease !important;
}

html body[data-page].site-interaction-v2 .mode-button:active,
html body[data-page].site-interaction-v2 .filter-button:active,
html body[data-page].site-interaction-v2 .draw-mode-tab:active,
html body[data-page].site-interaction-v2 .spread-picker-option:active,
html body[data-page].site-interaction-v2 .spread-picker-start:active,
html body[data-page].site-interaction-v2 .primary-button:active,
html body[data-page].site-interaction-v2 .ghost-button:active,
html body[data-page].site-interaction-v2 .dialog-close:active,
html body[data-page].site-interaction-v2 .theme-segment:active,
html body[data-page].site-interaction-v2 .theme-redraw-button:active {
  transform: translateY(1px) scale(.975) !important;
}

html body[data-page].site-interaction-v2 .home-start-button,
html body[data-page].site-interaction-v2 .theme-guide-button {
  transition:
    transform var(--tw-ui-press) var(--tw-ui-out),
    filter var(--tw-ui-state) ease,
    box-shadow var(--tw-ui-state) ease,
    opacity var(--tw-ui-state) ease !important;
}

html body[data-page].site-interaction-v2 .home-start-button:active,
html body[data-page].site-interaction-v2 .theme-guide-button:not(:disabled):active {
  transform: translateX(-50%) translateY(1px) scale(.975) !important;
}

/* Theme selector: state changes remain visible without extra ornament. */
html body[data-page].site-interaction-v2 .theme-segmented {
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 143, .05),
    0 9px 24px rgba(0, 0, 0, .2) !important;
}

html body[data-page].site-interaction-v2 .theme-segment.is-active {
  color: #ffe7aa !important;
  text-shadow: 0 0 12px rgba(255, 207, 99, .32) !important;
}

/* Selected desktop backs keep their black-gold detail and gain a clear seal. */
html body[data-page="theme-draw"].site-interaction-v2 .theme-deck-card.is-picked {
  opacity: .72 !important;
  filter: brightness(.72) saturate(1.04) contrast(1.05) !important;
  border-color: rgba(255, 220, 119, .82) !important;
  box-shadow:
    0 14px 30px rgba(0, 0, 0, .4),
    0 0 0 1px rgba(255, 224, 129, .22),
    0 0 22px rgba(242, 200, 108, .18) !important;
}

html body[data-page="theme-draw"].site-interaction-v2 .theme-deck-card.is-picked::after {
  opacity: 1 !important;
  transform: scale(1) !important;
  transition: transform 180ms var(--tw-ui-out), opacity 160ms ease !important;
}

html body[data-page="theme-draw"].site-interaction-v2 .theme-deck-card:disabled:not(.is-selected):not(.is-picked) {
  opacity: 1 !important;
  filter: none !important;
  cursor: default;
  pointer-events: none;
}

html body[data-page="theme-draw"].site-interaction-v2 .theme-selection-slot.is-filled {
  animation-duration: 300ms !important;
  animation-timing-function: var(--tw-ui-out) !important;
}

/* The primary action has three unmistakable states: dormant, ready and leaving. */
html body[data-page="theme-draw"].site-interaction-v2 .theme-guide-button:disabled {
  opacity: .54 !important;
  filter: brightness(.7) saturate(.72) !important;
  box-shadow:
    inset 0 0 0 3px #70430f,
    inset 0 0 0 5px rgba(255, 217, 112, .3),
    0 8px 22px rgba(0, 0, 0, .32) !important;
}

html body[data-page="theme-draw"].site-interaction-v2 .theme-guide-button.is-ready:not(:disabled) {
  opacity: 1 !important;
  filter: brightness(1.06) saturate(1.04) !important;
  animation: tw-guide-ready-settle 300ms var(--tw-ui-out) both;
}

html body[data-page="theme-draw"].site-interaction-v2.is-theme-leaving .theme-guide-button {
  pointer-events: none;
  filter: brightness(1.1) saturate(1.05) !important;
}

/* Result cards acknowledge touch as well as hover and stay interruptible. */
html body[data-page="theme-result"].site-interaction-v2 .theme-result-card {
  transition:
    transform 160ms var(--tw-ui-out),
    border-color var(--tw-ui-state) ease,
    box-shadow var(--tw-ui-state) ease,
    background-color var(--tw-ui-state) ease !important;
}

html body[data-page="theme-result"].site-interaction-v2 .theme-result-card:active {
  transform: scale(.992) !important;
}

html body[data-page="theme-result"].site-interaction-v2 .theme-result-card:focus-visible {
  outline: 2px solid var(--tw-focus-gold) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 4px rgba(242, 200, 108, .11) !important;
}

/* Reading cards do not keep an accidental hover state on touch screens. */
@media (hover: none), (pointer: coarse) {
  html body[data-page].site-interaction-v2 .home-topbar .home-nav-link:hover,
  html body[data-page].site-interaction-v2 .home-topbar .home-brand:hover,
  html body[data-page="meanings"].site-interaction-v2 .meaning-library-card:hover,
  html body[data-page="theme-result"].site-interaction-v2 .theme-result-card:hover {
    transform: none !important;
    text-shadow: inherit !important;
  }
}

html body[data-page].site-interaction-v2.is-document-hidden *,
html body[data-page].site-interaction-v2.is-document-hidden *::before,
html body[data-page].site-interaction-v2.is-document-hidden *::after {
  animation-play-state: paused !important;
}

@keyframes tw-guide-ready-settle {
  from {
    opacity: .72;
    filter: brightness(.88) saturate(.86);
    transform: translateX(-50%) translateY(4px) scale(.985);
  }
  to {
    opacity: 1;
    filter: brightness(1.06) saturate(1.04);
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  html body[data-page].site-interaction-v2 *,
  html body[data-page].site-interaction-v2 *::before,
  html body[data-page].site-interaction-v2 *::after {
    scroll-behavior: auto !important;
  }

  html body[data-page].site-interaction-v2 .theme-guide-button.is-ready:not(:disabled),
  html body[data-page].site-interaction-v2 .theme-selection-slot.is-filled,
  html body[data-page].site-interaction-v2 .theme-result-card {
    animation: none !important;
  }

  html body[data-page].site-interaction-v2 .home-topbar .home-brand,
  html body[data-page].site-interaction-v2 .home-topbar .home-nav-link,
  html body[data-page].site-interaction-v2 button,
  html body[data-page].site-interaction-v2 a {
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
  }
}
