/* ============================================================
   Music Tools — shared shell
   Base elements, header, nav, student chip, buttons, toast.
   Extracted from Aural Trainer so every tool in the toolkit gets
   the same chrome for free. Loaded AFTER tokens.css.
   ============================================================ */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}

h1, h2, h3 { font-family: var(--serif); line-height: 1.15; text-wrap: balance; margin: 0 0 0.4em; font-weight: 600; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); letter-spacing: -0.015em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; max-width: 70ch; text-wrap: pretty; }
a { color: var(--accent); }
ul { padding-left: 1.2em; }
li { margin-bottom: 0.35em; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 clamp(16px, 4vw, 40px);
  display: flex; align-items: center; gap: 20px;
  height: 58px;
}
.brand {
  font-family: var(--serif); font-size: 1.2rem; font-weight: 700;
  color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 9px;
}
.brand svg { flex: none; }

/* The toolkit crumb: a quiet link back up to the hub, sitting before
   the tool's own brand. Only rendered inside a tool, never on the hub. */
.up-link {
  color: var(--ink-2); text-decoration: none; font-size: 0.95rem;
  display: inline-flex; align-items: center; gap: 5px; flex: none;
}
.up-link:hover { color: var(--ink); }

.site-nav { display: flex; gap: 4px; margin-left: 8px; }
.site-nav a {
  text-decoration: none; color: var(--ink-2); padding: 6px 12px;
  border-radius: 999px; font-size: 0.95rem;
}
.site-nav a.active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.site-nav a:hover { color: var(--ink); }

.student-chip {
  margin-left: auto; border: 1px solid var(--line); background: none;
  border-radius: 999px; padding: 5px 14px; color: var(--ink);
  font-size: 0.9rem;
}
.student-chip:hover { background: var(--surface-2); }
.student-chip .cls { color: var(--ink-2); }

main { padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 40px) 80px; max-width: 1060px; margin: 0 auto; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: var(--radius);
  padding: 10px 18px; font-weight: 600; text-decoration: none; font-size: 0.98rem;
  transition: background 150ms cubic-bezier(0.22, 1, 0.36, 1), transform 150ms cubic-bezier(0.22, 1, 0.36, 1);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.985); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 6px 13px; font-size: 0.9rem; font-weight: 600; }

.section-label { font-family: var(--serif); font-size: 1.3rem; margin: 38px 0 14px; }
.field-hint { color: var(--ink-2); font-size: 0.85rem; margin-top: 3px; }

/* ---------- identity form ---------- */
.identity-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px 28px; max-width: 460px; margin: 6vh auto 0;
}
.identity-card label { display: block; font-weight: 600; font-size: 0.92rem; margin: 14px 0 4px; }
.identity-card input {
  width: 100%; font: inherit; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.identity-card .actions { margin-top: 20px; display: flex; gap: 10px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; translate: -50% 0; z-index: var(--z-toast);
  background: var(--ink); color: var(--bg); border-radius: 999px; padding: 9px 20px;
  font-size: 0.92rem; box-shadow: var(--shadow); opacity: 0;
  transition: opacity 250ms ease-out;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ---------- view transitions ---------- */
.view-enter { animation: viewIn 260ms cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes viewIn { from { opacity: 0.01; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- phone ---------- */
@media (max-width: 640px) {
  .site-header { height: auto; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; gap: 8px; }
  .site-nav { margin-left: 0; order: 3; width: 100%; overflow-x: auto; }
  .site-nav a { white-space: nowrap; }
}
