/* CSS Reset and Normalize - Cuttack Shanti Committee */
/* Modern CSS Reset with accessibility and performance focus */

/* ===== BOX SIZING RESET ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ===== REMOVE DEFAULT MARGINS AND PADDINGS ===== */
* {
  margin: 0;
  padding: 0;
}

/* ===== HTML AND BODY FOUNDATION ===== */
html {
  font-size: 16px; /* Base font size for rem calculations */
  line-height: var(--line-height-normal);
  -webkit-text-size-adjust: 100%; /* Prevent font scaling in landscape */
  -ms-text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-relaxed);
  color: var(--neutral-black);
  background-color: var(--neutral-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100%;
  overflow-x: hidden;
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
/* Respect user's motion preferences */
@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;
  }
}

/* ===== TYPOGRAPHY RESET ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-secondary);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--neutral-black);
  margin: 0;
}

p, blockquote, dl, dd, figure {
  margin: 0;
}

/* ===== LIST RESET ===== */
ul, ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Restore list styles when explicitly needed */
.prose ul,
.content ul {
  list-style: disc;
  padding-left: var(--spacing-xl);
}

.prose ol,
.content ol {
  list-style: decimal;
  padding-left: var(--spacing-xl);
}

/* ===== LINK RESET ===== */
a {
  color: var(--primary-red);
  text-decoration: none;
  transition: var(--transition-all);
}

a:hover,
a:focus {
  color: var(--primary-maroon);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--primary-red);
  outline-offset: 2px;
}

/* ===== BUTTON RESET ===== */
button,
input[type="button"],
input[type="reset"],
input[type="submit"] {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  outline: inherit;
}

button:focus,
input[type="button"]:focus,
input[type="reset"]:focus,
input[type="submit"]:focus {
  outline: 2px solid var(--primary-red);
  outline-offset: 2px;
}

/* ===== FORM ELEMENTS RESET ===== */
input,
textarea,
select {
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
}

/* Remove default styling from form inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
input[type="url"],
textarea,
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* ===== MEDIA RESET ===== */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Improve image loading experience */
img {
  border-style: none;
  vertical-align: middle;
}

/* ===== TABLE RESET ===== */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

th,
td {
  padding: 0;
  text-align: left;
}

/* ===== MISC ELEMENT RESETS ===== */
hr {
  border: none;
  height: 1px;
  background-color: var(--neutral-light-gray);
  margin: var(--spacing-lg) 0;
}

blockquote {
  border-left: 4px solid var(--primary-red);
  padding-left: var(--spacing-lg);
  font-style: italic;
  color: var(--neutral-dark-gray);
}

code,
pre {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
  background-color: var(--neutral-light-gray);
  padding: 0.2em 0.4em;
  border-radius: var(--border-radius-sm);
}

pre {
  padding: var(--spacing-md);
  overflow-x: auto;
  white-space: pre-wrap;
}

/* ===== SELECTION STYLES ===== */
::selection {
  background-color: var(--primary-red);
  color: var(--neutral-white);
}

::-moz-selection {
  background-color: var(--primary-red);
  color: var(--neutral-white);
}

/* ===== SCROLLBAR STYLES (Webkit) ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--neutral-light-gray);
}

::-webkit-scrollbar-thumb {
  background: var(--neutral-gray);
  border-radius: var(--border-radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-red);
}

/* ===== FOCUS MANAGEMENT ===== */
/* Enhanced focus styles for better accessibility */
*:focus {
  outline: 2px solid var(--primary-red);
  outline-offset: 2px;
}

/* Remove focus outline for mouse users, keep for keyboard users */
*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--primary-red);
  outline-offset: 2px;
}

/* ===== HIDDEN UTILITY ===== */
.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;
}

/* ===== SKIP LINK ===== */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--neutral-black);
  color: var(--neutral-white);
  padding: 8px;
  text-decoration: none;
  z-index: var(--z-tooltip);
  border-radius: var(--border-radius-sm);
}

.skip-link:focus {
  top: 6px;
}

/* ===== PRINT STYLES ===== */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]:after {
    content: " (" attr(href) ")";
  }

  abbr[title]:after {
    content: " (" attr(title) ")";
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  img {
    max-width: 100% !important;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}