/* ==========================================================================
   Base CSS (Reset + Modern Defaults)
   - Based on Tailwind CSS Preflight, with project-independent adjustments
   - Tailwind dependency removed
   - Provides consistent, modern cross-browser defaults
   - License: MIT
   ========================================================================== */

/* 1. Box model & border defaults */
*, ::before, ::after {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: currentColor;
}

/* 2. HTML root defaults */
html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
}

html:focus-within {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  line-height: inherit;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 3. Media elements */
img, svg, video, canvas, audio, iframe, embed, object {
  display: block;
  vertical-align: middle;
}

img, video {
  max-width: 100%;
  height: auto;
}

/* 4. Typography */
h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
  margin: 0;
}

p, figure, blockquote, dl, dd {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: inherit;
}

code, kbd, samp, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
}

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

/* 5. Lists */
ol, ul, menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* 6. Tables */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

caption {
  text-align: left;
  caption-side: bottom;
}

/* 7. Forms */
button, input, optgroup, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
  background: transparent;
}

button, [type="button"], [type="reset"], [type="submit"] {
  -webkit-appearance: button;
  appearance: button;
  cursor: pointer;
}

button:disabled, [type="button"]:disabled, [type="reset"]:disabled, [type="submit"]:disabled,
input:disabled, select:disabled, textarea:disabled {
  cursor: not-allowed;
}

textarea {
  resize: vertical;
}

input::placeholder, textarea::placeholder {
  opacity: 1;
  color: currentColor;
}

[type="search"] {
  -webkit-appearance: textfield;
  outline-offset: -2px;
}

::-webkit-search-decoration {
  -webkit-appearance: none;
}

::-webkit-file-upload-button {
  -webkit-appearance: button;
  font: inherit;
}

/* 8. Interactive elements */
summary {
  display: list-item;
}

details[open] > summary {
  list-style: none;
}

dialog {
  padding: 0;
  border: none;
  background: transparent;
}

/* 9. Focus styles */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* 10. Misc elements */
hr {
  height: 0;
  color: inherit;
  border-top-width: 1px;
  margin: 0;
}

abbr[title] {
  text-decoration: underline dotted;
}

b, strong {
  font-weight: bolder;
}

small {
  font-size: 80%;
}

sub, sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub { bottom: -0.25em; }
sup { top: -0.5em; }

progress { vertical-align: baseline; }

[hidden] { display: none !important; }

/* 11. Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 12. Dark mode minimal adjustments */
@media (prefers-color-scheme: dark) {
  hr { opacity: 0.3; }
}
