/*
 * Moyako Games — Info Drawer
 * ------------------------------------------------------------------
 * Overlay drawer used on every game page (About / Rules / Tips / FAQ).
 * Independent of moyako-components.css so it loads on the 6 non-v2
 * games as well as chess. The drawer must be position:fixed + high
 * z-index so opening it doesn't push the board or render inline.
 *
 * Opened state = .is-open on .info-drawer.
 * PR-7b-era markup lives in each game's HTML; this file only styles.
 */

.info-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(400px, 85vw);
  background: var(--bg-surface, #1A1F2E);
  color: var(--text-primary, #ECEFF4);
  border-left: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 300ms ease;
  z-index: 100;
  /* Always rendered — SSR content is read by the AdSense crawler even
     while the drawer is closed. visibility toggles with .is-open. */
  visibility: hidden;
  box-sizing: border-box;
}

.info-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.info-drawer .drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  flex: 0 0 auto;
}

.info-drawer .drawer-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #ECEFF4);
}

.info-drawer .drawer-close {
  background: transparent;
  border: 0;
  color: var(--text-primary, #ECEFF4);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  min-width: 44px;
  min-height: 44px;
}

.info-drawer .drawer-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px;
  color: var(--text-secondary, #C5CAD5);
  font-size: 14px;
  line-height: 1.5;
}

.info-drawer .drawer-section {
  margin-bottom: 24px;
}

.info-drawer .drawer-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #ECEFF4);
  margin: 0 0 8px 0;
}

.info-drawer .drawer-section p {
  margin: 0 0 8px 0;
}

/* Backdrop — renders only when the drawer is open. Tapping closes. */
.info-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.info-drawer.is-open + .info-drawer-backdrop,
body:has(.info-drawer.is-open) .info-drawer-backdrop {
  display: block;
}

/* Mobile — slide up from bottom, 85% height, rounded top corners. */
@media (max-width: 599px) {
  .info-drawer {
    top: auto;
    width: 100%;
    height: 85vh;
    transform: translateY(100%);
    border-left: 0;
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    border-radius: 16px 16px 0 0;
  }
  .info-drawer.is-open {
    transform: translateY(0);
  }
}

/* Light theme adjustments */
[data-theme="light"] .info-drawer {
  background: #FFFFFF;
  color: #1F2937;
  border-color: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .info-drawer .drawer-title,
[data-theme="light"] .info-drawer .drawer-close,
[data-theme="light"] .info-drawer .drawer-section h3 {
  color: #1F2937;
}
[data-theme="light"] .info-drawer .drawer-content {
  color: #4B5563;
}
