/* public/assets/base.css
   Reset + element defaults. Pairs with tokens.css.
*/

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

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;                  /* body floor — never smaller */
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 107, 53, 0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(255, 166, 107, 0.04), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

/* Loading bar at top while SPA navigations resolve. */
html[data-loading="true"]::after {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-glow), var(--accent));
  background-size: 200% 100%;
  animation: barFlow 1s linear infinite;
  z-index: 9999;
}
@keyframes barFlow { from { background-position: 0 0; } to { background-position: 200% 0; } }

/* Headings */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
h1 { font-size: var(--t-3xl); }
h2 { font-size: var(--t-2xl); }
h3 { font-size: var(--t-xl);  }
h4 { font-size: var(--t-lg);  }
h5 { font-size: var(--t-body); }
p  { margin: 0; }

.serif {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.015em;
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Links */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a.link, .link {
  color: var(--accent);
  text-underline-offset: 3px;
}
a.link:hover, .link:hover { color: var(--accent-hi); text-decoration: underline; }

/* Form controls */
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }

input, textarea, select {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  color: var(--text);
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-mute); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-elev-2);
}
textarea { resize: vertical; min-height: 96px; }

/* Code */
code, pre, kbd { font-family: var(--font-mono); font-size: 15px; }
pre {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  overflow-x: auto;
}
kbd {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 13px;
}

img, video, svg { max-width: 100%; display: block; }
img { border-radius: var(--r-md); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-pill);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

/* Selection */
::selection { background: var(--accent-soft); color: var(--accent-glow); }

/* Focus ring — accessible, on-brand */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Utilities */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.row     { display: flex; gap: 12px; align-items: center; }
.col     { display: flex; flex-direction: column; gap: 12px; }
.spacer  { flex: 1; }
.center  { display: grid; place-items: center; }

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-elev), var(--bg-elev-2), var(--bg-elev));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-md);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 320ms var(--ease-out) both; }
