/* melody.games shared brand chrome — reset, body baseline, paper-grain,
   site header (brand mark + tagline), home button, footer. Markup is
   rendered by brand/chrome.js (see its header for the data-chrome contract).
   Apps link this AFTER tokens.css and BEFORE their own style.css. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
button { font: inherit; color: inherit; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  min-height: 100dvh;
  position: relative;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

.paper-grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: .45;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(0,0,0,.04) 1px, transparent 2px),
    radial-gradient(circle at 70% 55%, rgba(120,80,30,.03) 1px, transparent 2px),
    radial-gradient(circle at 40% 84%, rgba(0,0,0,.035) 1px, transparent 2px);
  background-size: 220px 220px, 180px 180px, 240px 240px;
  mix-blend-mode: multiply;
}

/* ====== Site header ====== */
.site-header {
  position: relative;
  z-index: 30;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(42,53,84,.10);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.brand-mark { width: 36px; height: 36px; display: block; flex: 0 0 36px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  font-family: var(--font-brand);
  font-size: 20px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: .2px;
}
.brand-tagline {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  line-height: 1.25;
  margin-top: 5px;
  max-width: 34ch;
}

/* ====== Site footer ====== */
.site-footer {
  position: relative;
  z-index: 5;
  margin-top: 40px;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0 20px 16px;
  font-family: var(--font-cn-body);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: .6px;
  text-align: center;
  color: var(--muted);
  text-transform: none;
}
.site-footer .dot { opacity: .6; }

/* ====== Header "?" help + dialog (wired by chrome.js) ====== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}
.help-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(42, 53, 84, .16);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-brand);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.help-toggle:hover { background: rgba(42, 53, 84, .06); color: var(--ink); border-color: rgba(42, 53, 84, .3); }
.help-toggle:active { transform: scale(0.94); }

.help-dialog {
  max-width: 40ch;
  width: calc(100% - 40px);
  margin: auto;
  border: none;
  border-radius: 16px;
  padding: 28px 30px;
  background: var(--paper-card);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(42, 53, 84, .28);
  font-family: var(--font-cn-body);
  line-height: 1.6;
}
.help-dialog::backdrop {
  background: rgba(42, 53, 84, .35);
  backdrop-filter: blur(2px);
}
.help-close {
  float: right;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: -4px -8px 0 8px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.help-close:hover { color: var(--ink); background: rgba(42, 53, 84, .08); }
.help-dialog h2 {
  font-family: var(--font-cn);
  font-size: 18px;
  margin: 0 0 12px;
  color: var(--ink);
}
.help-dialog p { margin: 0 0 10px; font-size: 14px; color: var(--ink-2); }

/* ====== Mobile: brand block compacts ====== */
@media (max-width: 480px) {
  .site-header { padding: 14px 18px; }
  .brand-mark { width: 30px; height: 30px; flex: 0 0 30px; }
  .brand-name { font-size: 18px; }
  .brand-tagline { font-size: 10px; letter-spacing: 1px; margin-top: 3px; max-width: 30ch; }
  .help-toggle { width: 28px; height: 28px; font-size: 14px; }
}
