/* Frostpeak Panel — base: reset, typography, focus, utilities */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-md);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--foreground);
}

h1 { font-size: var(--text-3xl); line-height: 2.5rem; }
h2 { font-size: var(--text-xl); line-height: 2rem; }
h3 { font-size: var(--text-lg); line-height: var(--leading-lg); }
h4 { font-size: var(--text-md); line-height: var(--leading-md); }

p { margin: 0; }

a {
  color: var(--link);
  text-decoration: none;
  border-radius: 4px;
}

a:hover { color: var(--link-hover); text-decoration: underline; }

code, kbd, pre, samp {
  font-family: var(--font-mono);
  font-size: max(0.875em, var(--text-sm));
}

code {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--nav-selected-foreground);
}

kbd {
  display: inline-flex;
  align-items: center;
  min-height: 1.375rem;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: var(--text-sm);
  line-height: var(--leading-sm);
}

pre { margin: 0; white-space: pre-wrap; word-break: break-word; }

img, svg { display: block; }
svg { flex-shrink: 0; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

ul, ol { margin: 0; padding: 0; }
ul[role="list"], ol[role="list"] { list-style: none; }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-4) 0;
}

::selection { background: var(--selection); color: var(--foreground); }

/* Visible focus for keyboard users (AA) */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Headings/containers focused programmatically by the router after navigation. */
h1[tabindex="-1"]:focus,
h2[tabindex="-1"]:focus,
main[tabindex="-1"]:focus { outline: none; }

[hidden] { display: none !important; }

/* Scrollbars (WebKit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid var(--background);
}
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* Utilities */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mono { font-family: var(--font-mono); }
.text-muted { color: var(--muted-foreground); }
.text-sm { font-size: var(--text-sm); line-height: var(--leading-sm); }
/* .text-xs is kept for existing callers: the smallest interface text is 14px (DECISIONS). */
.text-xs { font-size: var(--text-xs); line-height: var(--leading-xs); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger-light); }
.text-info { color: var(--info); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.w-full { width: 100%; }

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-6); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row-sm { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

.grid { display: grid; gap: var(--space-4); }
.grid-2 { display: grid; gap: var(--space-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: var(--space-4); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: var(--space-4); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

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