/* Base styles shared by both documents (PLAN 7.5, 7.7, research/ui.md 3, 9). Component styles live in the
   per-package files: shell.css (U-SHELL), player.css (U-PLAYER), home.css (U-HOME), library.css (U-LIBRARY),
   tool.css (U-ACCOUNT), dashboard.css (U-DASHBOARD). No inline styles anywhere (CSP style-src 'self'). */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-ext-wght.woff2?v=34b9c504ca") format("woff2-variations"), url("/fonts/inter-latin-ext-wght.woff2?v=34b9c504ca") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-wght.woff2?v=3100e775e8") format("woff2-variations"), url("/fonts/inter-latin-wght.woff2?v=3100e775e8") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: var(--fw-body);
  line-height: var(--lh-body);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: max(16px, 1em); }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:where(a) { color: var(--accent); text-underline-offset: .15em; }
:where(a:hover) { color: var(--accent-ink); }
p { margin: 0 0 var(--s-4); }
ul, ol { margin: 0 0 var(--s-4); padding-left: 1.25em; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-5) 0; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }

h1, h2, h3, h4 { margin: 0 0 var(--s-3); color: var(--ink); text-wrap: balance; }
h1, .t-h1 { font-size: var(--fs-h1); font-weight: var(--fw-h1); line-height: var(--lh-h1); letter-spacing: var(--ls-h1); }
h2, .t-h2 { font-size: var(--fs-h2); font-weight: var(--fw-h2); line-height: var(--lh-h2); letter-spacing: var(--ls-h2); }
h3, .t-h3 { font-size: var(--fs-h3); font-weight: var(--fw-h3); line-height: var(--lh-h3); letter-spacing: -0.01em; }
.t-display { font-size: var(--fs-display); font-weight: var(--fw-display); line-height: var(--lh-display); letter-spacing: var(--ls-display); }
.t-label { font-size: var(--fs-label); font-weight: var(--fw-label); line-height: 1.3; }
.t-small { font-size: var(--fs-small); font-weight: var(--fw-small); line-height: 1.4; color: var(--ink-3); }
.t-micro { font-size: var(--fs-micro); font-weight: var(--fw-micro); line-height: 1.2; letter-spacing: var(--ls-micro); text-transform: uppercase; }
.t-num { font-variant-numeric: tabular-nums; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* accessibility helpers */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: var(--z-toast);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: var(--s-3); color: var(--bg); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:focus, main:focus-visible, [tabindex="-1"]:focus { outline: none; }

/* page frame */
#view {
  position: relative;
  z-index: var(--z-content);
  display: block;
  min-height: 60vh;
  padding: 0 var(--gutter) calc(var(--mini-h) + var(--bottomnav-h) + var(--s-6) + env(safe-area-inset-bottom, 0px));
}

.boot-note { padding: var(--s-6) var(--gutter); color: var(--ink-3); }

/* buttons and chips (research/ui.md 5.10) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-5);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-ui) var(--ease-out);
}
.btn:hover { color: #FFFFFF; filter: brightness(1.05); }
.btn:active { transform: scale(.97); }
.btn--soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn--soft:hover { color: var(--accent-ink); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn--danger { background: var(--danger); }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: inherit;
}
.icon-btn:hover { background: var(--surface-2); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 2px var(--s-2);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--fs-micro);
  font-weight: var(--fw-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
}

/* form controls */
.field { display: grid; gap: var(--s-1); margin-bottom: var(--s-4); }
.field label { font-weight: 600; }
.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
}
.textarea { min-height: 120px; resize: vertical; }
.field-error { color: var(--danger); font-size: var(--fs-small); }

/* surfaces */
.card {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--sh-1);
  padding: var(--s-5);
}

/* placeholder views (W0 skeleton; each UI package replaces its own views) */
.view { padding-top: var(--s-6); }
.view-placeholder { padding: var(--s-7) 0; }
.view-placeholder p { color: var(--ink-2); max-width: 60ch; }

/* motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--dur-route); animation-timing-function: var(--ease-out); }

/* skeleton chrome: low-specificity defaults the shell and tool packages override in their own files */
:where(.topbar), :where(.tool-top) {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: 64px;
  padding: var(--s-3) var(--gutter);
}
:where(.topbar nav ul), :where(.bottomnav ul), :where(.tool-top ul) { display: flex; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
:where(.topbar nav a), :where(.bottomnav a) {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--s-4);
  border-radius: var(--r-pill);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
:where(.topbar nav a[aria-current="page"]), :where(.bottomnav a[aria-current="page"]) { background: var(--tab-pill); color: #FFFFFF; }
:where(.topbar .brand) { font-weight: 800; font-size: var(--fs-h3); color: var(--ink); text-decoration: none; margin-right: auto; }
:where(.tool-top .brand) { font-weight: 800; font-size: var(--fs-h3); color: var(--ink); text-decoration: none; margin-right: auto; }
:where(.bottomnav) { display: none; }
@media (max-width: 599px) {
  :where(.topbar nav) { display: none; }
  :where(.bottomnav) {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: var(--z-bottomnav);
    display: block;
    padding: var(--s-1) var(--s-2) env(safe-area-inset-bottom, 0px);
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  :where(.bottomnav ul) { justify-content: space-around; }
}
:where(.player-dock:not(:empty)) {
  position: fixed; left: 0; right: 0;
  bottom: var(--bottomnav-h);
  z-index: var(--z-player);
  min-height: var(--mini-h);
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--gutter);
  background: var(--surface);
  box-shadow: var(--sh-player);
}
:where(.sheet-backdrop) {
  position: fixed; inset: 0; z-index: var(--z-sheet);
  display: grid; place-items: center;
  background: rgba(8, 8, 12, .45);
}
:where(.sheet) {
  width: min(560px, calc(100vw - 2 * var(--gutter)));
  max-height: 85vh; overflow: auto;
  padding: var(--s-5);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-3);
}
@media (max-width: 599px) {
  :where(.sheet-backdrop) { place-items: end stretch; }
  :where(.sheet) { width: 100%; border-radius: 16px 16px 0 0; }
}
:where(.toasts) {
  position: fixed; left: 50%; bottom: calc(var(--mini-h) + var(--bottomnav-h) + var(--s-4));
  z-index: var(--z-toast);
  display: grid; gap: var(--s-2);
  transform: translateX(-50%);
}
:where(.toast) {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-ctl);
  background: var(--ink); color: var(--bg);
  box-shadow: var(--sh-2);
}
:where(.toast button) { border: 0; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; }
