/* "How it works" button and panel. Uses the HUD's variables from style.css. */

#brand .brand-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#guide-btn { height: 26px; padding: 0 8px; font: 12px/1 "Silkscreen", "Sprout", monospace; color: #fbecc9; background: var(--tag); border: 0; border-radius: 3px; box-shadow: 0 2px 0 rgba(60, 38, 30, .45); white-space: nowrap; }
#guide-btn:hover { background: var(--accent); }
#guide-btn .gd-short { display: none; }
#guide-btn:focus-visible, .gd-back :focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.gd-back { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-rows: minmax(0, 1fr); justify-items: center; align-items: center; padding: calc(28px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); background: rgba(72, 49, 41, .5); }
.gd-back[hidden] { display: none; }
.gd-modal { position: relative; display: flex; flex-direction: column; width: min(500px, 100%); max-height: 100%; min-height: 0; padding: 14px 14px 12px; }
.gd-modal:focus-visible { outline: none; }
.gd-modal h2 { flex: none; margin-right: 34px; }
.gd-x { position: absolute; top: 6px; right: 8px; width: 30px; height: 30px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 24px; line-height: 1; }
.gd-x:hover { color: var(--hurt); }

/* The scroller is the body, not the panel: a scrolling panel would clip the h2 tag hung on its frame. */
.gd-body { min-height: 0; overflow: auto; padding: 2px 4px 0 2px; overscroll-behavior: contain; }
.gd-body p { line-height: 1.15; }
.gd-lead { font-size: 20px; color: var(--title); }
.gd-step { margin-top: 12px; padding-top: 10px; border-top: 2px dashed var(--line); }
.gd-step h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 5px; font: 14px/1 "Silkscreen", "Sprout", monospace; font-weight: 400; color: var(--title); }
.gd-step h3 i { display: grid; place-items: center; flex: none; width: 20px; height: 20px; font-style: normal; color: #fbecc9; background: var(--tag); border-radius: 3px; }
.gd-step p + p { margin-top: 5px; }
.gd-step b { color: var(--accent); font-weight: 400; }
.gd-list { margin: 0; padding: 0 0 0 4px; list-style: none; }
.gd-list li { position: relative; padding-left: 14px; line-height: 1.15; }
.gd-list li + li { margin-top: 3px; }
.gd-list li::before { content: ""; position: absolute; left: 0; top: .45em; width: 6px; height: 6px; background: var(--good); }
.gd-shares { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px 10px; margin: 6px 0; padding: 0; list-style: none; }
.gd-shares li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 7px; background: var(--track); border-radius: 3px; font-variant-numeric: tabular-nums; }
.gd-shares li:first-child { background: var(--on); }
.gd-shares li:last-child:nth-child(odd) { grid-column: 1 / -1; }
.gd-muted { color: var(--muted); }
.gd-foot { display: flex; gap: 8px; margin: 14px 0 2px; }
.gd-foot button { flex: 1; height: 40px; border-radius: 3px; font-size: 20px; }
.gd-buy { color: #fbecc9; background: var(--chip-ready); border: 2px solid var(--frame); box-shadow: 0 3px 0 rgba(60, 38, 30, .45); }
.gd-buy:hover { filter: brightness(1.1); }
.gd-buy[hidden] { display: none; }
.gd-later { color: var(--title); background: var(--inner); border: 2px solid var(--frame); }
.gd-later:hover { background: var(--hover); }

body.clean #guide-btn { display: none; }

@media (max-width: 820px) {
  #brand .brand-row { justify-content: flex-start; }
  #guide-btn { width: 24px; height: 24px; padding: 0; font-size: 14px; }
  #guide-btn .gd-long { display: none; }
  #guide-btn .gd-short { display: inline; }
  .gd-shares { grid-template-columns: 1fr; }
  .gd-lead { font-size: 18px; }
}

@media (prefers-reduced-motion: no-preference) {
  .gd-back:not([hidden]) .gd-modal { animation: gd-in .18s ease-out; }
  @keyframes gd-in { from { transform: translateY(8px); opacity: 0; } }
}
