/**
 * CSS Reset - Modern Normalize
 * 
 * Based on modern-normalize with custom additions
 * @see https://github.com/sindresorhus/modern-normalize
 */

/* ===========================================
 * Box sizing
 * =========================================== */

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

/* ===========================================
 * Root & Document
 * =========================================== */

html {
  /* Prevent font size inflation on mobile */
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  
  /* Smooth scrolling */
  scroll-behavior: smooth;
  
  /* Better line height */
  line-height: 1.5;
  
  /* Tab size */
  -moz-tab-size: 4;
  tab-size: 4;
  
  /* Ensure full height and background */
  height: 100%;
  background-color: var(--color-background, #ffffff);
}

/* Reduce motion for users who prefer it */
@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;
  }
}

/* ===========================================
 * Body
 * =========================================== */

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-primary, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  font-size: var(--font-size-base, 16px);
  line-height: 1.5;
  color: var(--color-text, #303030);
  background-color: var(--color-background, #ffffff);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Main content wrapper - grows to push footer down */
.site-main,
main,
#main {
  flex: 1 0 auto;
}

/* ===========================================
 * Typography
 * =========================================== */

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: var(--font-weight-medium, 500);
  line-height: 1.2;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

/* ===========================================
 * Links
 * =========================================== */

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

a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* ===========================================
 * Lists
 * =========================================== */

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ===========================================
 * Media
 * =========================================== */

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border-style: none;
}

/* ===========================================
 * Forms
 * =========================================== */

button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
  margin: 0;
  padding: 0;
}

button,
select {
  text-transform: none;
}

button,
[type='button'],
[type='reset'],
[type='submit'] {
  -webkit-appearance: button;
  appearance: button;
  background: none;
  border: none;
  cursor: pointer;
}

button::-moz-focus-inner,
[type='button']::-moz-focus-inner,
[type='reset']::-moz-focus-inner,
[type='submit']::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

input {
  border: none;
  background: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-placeholder, #878787);
  opacity: 1;
}

textarea {
  resize: vertical;
}

fieldset {
  margin: 0;
  padding: 0;
  border: none;
}

legend {
  padding: 0;
}

/* Remove default search styling */
[type='search'] {
  -webkit-appearance: textfield;
  appearance: textfield;
  outline-offset: -2px;
}

[type='search']::-webkit-search-decoration {
  -webkit-appearance: none;
}

/* ===========================================
 * Tables
 * =========================================== */

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ===========================================
 * Interactive
 * =========================================== */

summary {
  display: list-item;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* ===========================================
 * Accessibility
 * =========================================== */

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-primary, #6E4F95);
  outline-offset: 2px;
}

/* Remove focus outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary, #6E4F95);
  color: white;
  padding: 8px 16px;
  z-index: 9999;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
}

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

/* ===========================================
 * Selection
 * =========================================== */

::selection {
  background-color: var(--color-primary, #6E4F95);
  color: white;
}

/* ===========================================
 * Custom Scrollbar
 * Works in WebKit (Chrome, Safari, Edge) and Firefox
 * =========================================== */

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary, #6E4F95) var(--color-border-light, #F0F0F0);
}

/* WebKit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-border-light, #F0F0F0);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary, #6E4F95);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-dark, #5A3D7A);
}
