/*
 * css/drawer.css · The Long Game — Menu drawer (occasional zone, v21)
 * Purpose: the edge slide-in dialog opened by the bottom-bar Menu button. Holds the
 *   periodic surfaces + settings + help. Backdrop dims everything; the panel slides
 *   from the handedness side so close gestures land under the active thumb.
 *   References tokens from css/styles.css (no token declarations here).
 * Related: js/app.js (openDrawer, _drawerRowHtml), js/nav-model.js (drawerItems)
 */

/* Full-screen layer: a dimming backdrop + the sliding panel. Above the bars (z 60)
   and at the overlay tier so the backdrop covers the inert tab bar (a tap there =
   backdrop tap = close). */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: flex;
  justify-content: flex-start;      /* panel hugs the left edge by default */
}
.drawer-overlay--right { justify-content: flex-end; }   /* lefty: right edge */

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 34, 26, 0.42);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.drawer-overlay.is-open .drawer-backdrop { opacity: 1; }

/* The panel itself. Slides in from the matching edge. */
.drawer {
  position: relative;
  width: min(86vw, 360px);
  max-width: 360px;
  height: 100%;
  background: var(--bg);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(14px, env(safe-area-inset-top)) 0 calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-100%);
  transition: transform 0.24s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.drawer-overlay--right .drawer {
  border-right: none;
  border-left: 1px solid var(--line);
  transform: translateX(100%);
}
.drawer-overlay.is-open .drawer { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px 6px 20px;
}
.drawer-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--ink);
}
.drawer-close {
  /* reuses .overlay-back sizing (≥44²); just ensure it stays put on the trailing edge */
  flex-shrink: 0;
}
.drawer-since {
  margin: 0 20px 6px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  opacity: 0.85;
}

.drawer-band { margin-top: 10px; }
.drawer-band-head {
  margin: 0;
  padding: 8px 20px 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
}

.drawer-row {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 20px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.14s;
}
.drawer-row:hover  { background: var(--surface-2); }
.drawer-row:active { background: var(--surface-2); }
.drawer-row:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

.drawer-row-ic {
  flex-shrink: 0;
  width: 24px; height: 24px;
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.drawer-row-ic svg { width: 22px; height: 22px; display: block; }

.drawer-row-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.drawer-row-label {
  font-size: 0.98rem;
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.drawer-row-sub {
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

/* Arrival badge — a small accent pill beside the Letters label. */
.drawer-row-badge {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
}

.drawer-footer {
  margin: 20px 20px 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-soft);
}

/* Reduced motion: no slide, just a gentle crossfade. */
@media (prefers-reduced-motion: reduce) {
  .drawer { transition: none; transform: none; opacity: 0; }
  .drawer-overlay.is-open .drawer { opacity: 1; }
  .drawer-backdrop { transition: none; }
}
