/* ============================================================
   RESET.CSS — Modern Reset + PWA Base
   PWA CSS Library by CSTRSK
   ============================================================ */

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

/* Remove defaults */
* {
  margin: 0;
  padding: 0;
}

/* Document */
html {
  font-size: 16px;
  line-height: var(--leading-normal);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: light dark;

  /* PWA: prevent overscroll bounce on iOS */
  overscroll-behavior: none;
}

/* Body */
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-weight-regular);
  color: var(--text-primary);
  background-color: var(--bg-base);
  line-height: var(--leading-normal);
  min-height: 100svh;
  min-height: -webkit-fill-available;

  /* Prevent horizontal scroll */
  overflow-x: hidden;

  /* Font rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

h1 { font-size: var(--text-3xl); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--text-2xl); letter-spacing: var(--tracking-tight); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); font-weight: var(--font-weight-semibold); }

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

/* Links */
a {
  color: var(--text-brand);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-default);
}
a:hover { text-decoration: underline; }
a:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

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

/* Form elements */
button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* Button reset */
button {
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Input reset */
input, textarea, select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}

/* Tables */
table { border-collapse: collapse; }

/* HR */
hr {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: var(--space-6) 0;
}

/* Code */
code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

pre {
  overflow-x: auto;
  background: var(--bg-subtle);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
}

code {
  background: var(--bg-subtle);
  padding: 0.15em 0.35em;
  border-radius: var(--radius-sm);
}

/* Selection */
::selection {
  background: var(--color-brand-100);
  color: var(--color-brand-900);
}

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

/* Scrollbar (Webkit) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-neutral-300);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-neutral-400); }

@media (prefers-color-scheme: dark) {
  ::-webkit-scrollbar-thumb { background: var(--color-neutral-700); }
  ::-webkit-scrollbar-thumb:hover { background: var(--color-neutral-600); }
}

/* PWA: Disable text selection on interactive elements */
button, [role="button"], nav, .no-select {
  user-select: none;
  -webkit-user-select: none;
}

/* Reduced motion */
@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;
  }
}

/* SVH fix for mobile browsers */
.full-height {
  height: 100vh;
  height: 100svh;
}

/* Safe area padding helpers */
.safe-top    { padding-top:    var(--safe-top); }
.safe-bottom { padding-bottom: var(--safe-bottom); }
.safe-left   { padding-left:   var(--safe-left); }
.safe-right  { padding-right:  var(--safe-right); }
.safe-x      { padding-left:   var(--safe-left); padding-right: var(--safe-right); }
.safe-y      { padding-top:    var(--safe-top);  padding-bottom: var(--safe-bottom); }
.safe-all    { padding:        var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); }
