/* ==========================================================================
   FLOREX.LAB — Base Styles (Retro Edition)
   Reset, typography, global elements, retro swatches bar
   ========================================================================== */

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Noise texture overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
  background-image: url('../assets/noise.svg');
  background-repeat: repeat;
  mix-blend-mode: overlay;
}

/* Retro Scanlines Effect (Subtle) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.015;
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0),
    rgba(255,255,255,0) 50%,
    rgba(0,0,0,0.3) 50%,
    rgba(0,0,0,0.3)
  );
  background-size: 100% 4px;
}

/* ── Retro Swatches Bar ── */
.retro-color-bar {
  display: flex;
  height: 3px;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: calc(var(--z-sticky) + 10);
}

.retro-color-bar span {
  flex: 1;
  height: 100%;
}

.retro-swatches-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.retro-swatches-inline span {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

/* Theme transition */
body.theme-transitioning,
body.theme-transitioning * {
  transition: background-color var(--duration-slow) var(--ease-out),
              color var(--duration-slow) var(--ease-out),
              border-color var(--duration-slow) var(--ease-out),
              box-shadow var(--duration-slow) var(--ease-out) !important;
}

/* Scroll lock for modals */
body.scroll-locked {
  overflow: hidden;
  padding-right: var(--scrollbar-width, 0px);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

a {
  color: var(--retro-teal);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--retro-red);
}

code, pre, kbd {
  font-family: var(--font-mono);
}

code {
  font-size: 0.9em;
  padding: 0.15em 0.4em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--retro-orange);
}

pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: 1.7;
  tab-size: 2;
  color: var(--text-primary);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  font-family: var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-bottom: 2px solid var(--text-muted);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  line-height: 1;
}

/* ── Selection ── */
::selection {
  background: var(--retro-orange);
  color: var(--bg-primary);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--surface-hover);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-hover) var(--bg-secondary);
}

/* ── Focus ── */
:focus-visible {
  outline: 2px solid var(--retro-yellow);
  outline-offset: 2px;
}

/* ── Lists ── */
ul, ol {
  list-style: none;
}

/* ── Images ── */
img, svg {
  display: block;
  max-width: 100%;
}

/* ── Button reset ── */
button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ── Input reset ── */
input, select, textarea {
  font: inherit;
  color: inherit;
}

/* ── Utility classes ── */
.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;
}

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mono {
  font-family: var(--font-mono);
}

.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

/* Retro Badge Tag */
.retro-tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--retro-yellow);
  background: rgba(255, 193, 59, 0.1);
  border: 1px solid rgba(255, 193, 59, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
