/*    HYPIXOR — CSS Reset & Base */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
  /* Windows/Chrome layout shift fix */
}

@media (min-width: 2560px) {
  html {
    font-size: 20px;
    /* 4K Ultra-wide global REM scale injection */
  }
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background: var(--color-bg);
  min-height: 100dvh;
  /* iOS Safari viewport jump safety */
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  /* Notch fix */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--brand-primary-dark);
}

img,
svg {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  object-fit: cover;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 400px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

h1 {
  font-size: clamp(1.75rem, 5vw, var(--text-4xl));
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 4vw, var(--text-3xl));
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.25rem, 3.5vw, var(--text-2xl));
}

h4 {
  font-size: clamp(1.125rem, 3vw, var(--text-xl));
}

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

::selection {
  background: var(--brand-primary-subtle);
  color: var(--brand-primary-dark);
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

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

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* Screen reader only */
.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;
}

/* Hidden */
.hidden {
  display: none !important;
}

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

/* ——— Skeleton Engine ——— */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
  pointer-events: none;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  animation: shimmerSweep 1.6s ease-in-out infinite;
}

.skeleton-text {
  height: 16px;
  border-radius: 6px;
  margin-bottom: var(--space-2);
  width: 85%;
}

.skeleton-text.title {
  height: 24px;
  width: 50%;
  margin-bottom: var(--space-3);
}

.skeleton-text.short {
  width: 35%;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-btn {
  height: 44px;
  width: 120px;
  border-radius: var(--radius-md);
}

.skeleton-card {
  height: 160px;
  border-radius: var(--radius-lg);
}

@keyframes shimmerSweep {
  100% {
    transform: translateX(100%);
  }
}

@keyframes skeletonPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after {
    display: none !important;
  }

  .skeleton {
    animation: skeletonPulse 2s ease-in-out infinite !important;
  }

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

/* Print CSS */
@media print {

  .nav-toggle,
  .navbar-nav,
  .dashboard-grid,
  .footer-bottom,
  button,
  .btn {
    display: none !important;
  }

  body,
  .main-content {
    background: #FFF !important;
    color: #000 !important;
    padding: 0 !important;
    min-height: auto !important;
  }

  * {
    box-shadow: none !important;
    border-color: #CCC !important;
  }

  a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }

  .card,
  .card-static {
    page-break-inside: avoid;
    border: 1px solid #CCC !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: more) {
  :root {
    --color-text-secondary: var(--color-text-primary);
    --color-text-muted: var(--color-text-primary);
    --color-border: var(--color-text-primary);
    --brand-primary-subtle: transparent;
  }

  .card,
  .btn,
  .form-input,
  .form-select {
    border-width: 2px;
  }
}