/*!
 * Signature CSS v0.3.0-beta
 * https://github.com/[your-username]/signature-css
 *
 * Created and maintained by Israele Bonsignore
 *
 * Released under the MIT license
 * https://opensource.org/licenses/MIT
 *
 * This CSS file provides a robust and customizable foundation for web projects,
 * combining modern reset techniques with accessibility enhancements,
 * performance optimizations, and print styles.
 *
 * It is designed to be modular, allowing developers to uncomment or modify
 * sections as needed to tailor it to their specific requirements.
 *
 * Note on `!important`: This reset uses `!important` in a few specific cases 
 * where it is deemed necessary (e.g., utility classes, essential accessibility 
 * fixes, and certain print styles). However, developers are encouraged to 
 * consider alternatives like using more specific selectors, reordering CSS 
 * rules, or refactoring their CSS architecture to avoid potential specificity 
 * conflicts.
 *
 * When to consider `!important`:
 *   - Overriding styles from third-party libraries.
 *   - Dealing with deeply nested selectors where increasing specificity 
 *     is impractical.
 *   - Enforcing critical accessibility styles.
 *
 * Example of refactoring to avoid `!important`:
 *   - Instead of:  `.my-element { color: red !important; }`
 *   - Consider:  `body .parent-element .my-element { color: red; }`
 *
 * Important: When uncommenting or modifying rules in this reset, 
 * carefully evaluate the use of `!important` and its potential impact 
 * on your CSS architecture. Regularly review and test your styles to 
 * maintain a clean and efficient CSS structure.
 */

/* --------------------------------------------------------------
  Root Design System
-------------------------------------------------------------- */

:root {
    /* Typography */
    --font-smoothing: antialiased; /* Default font smoothing */
    --font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
      "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
      "Segoe UI Symbol";
    --font-size-base: 1rem; /* 16px */
    --line-height-base: 1.5;
  
    /* Spacing */
    --spacing-unit: 1rem;
  
    /* Colors */
    --color-text-primary: #222;
    --color-text-secondary: #777;
    --color-background: #fff;
    --color-link: #007bff;
    --color-focus: #007bff;
    
    /* Borders and Outlines */
    --border-radius-sm: 0.25rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 1rem;
    --outline-width: 2px;
    --outline-offset: 2px;
  
    /* Accessibility */
    color-scheme: light dark;
    accent-color: var(--color-focus);
    
    /* Animation */
    --transition-speed: 0.2s;
    --transition-timing: ease-in-out;
}

/* --------------------------------------------------------------
  Common CSS Reset
-------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* overscroll-behavior: none; */
  /* overscroll-behavior-y: none; */
  /* overscroll-behavior-x: none; */
  /* overscroll-behavior-block: none; */
  /* overscroll-behavior-inline: none; */
}

/* --------------------------------------------------------------
  Meyer Reset (Modified)
-------------------------------------------------------------- */

html,
body {
  height: 100%; /* Ensure html and body take full viewport height */
  overscroll-behavior: none;
}

body {
  font-family: var(--font-family-sans-serif);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text-primary);
  background-color: var(--color-background);
  /* Remove duplicate declaration and use CSS variable */
  -webkit-font-smoothing: var(--font-smoothing);
  -moz-osx-font-smoothing: var(--font-smoothing);
  text-rendering: optimizeLegibility;
  
  /* Optional: content-visibility for performance */
  /* content-visibility: auto; */
}

/* Remove default margin on common elements */
blockquote,
dl,
dd,
h1,
h2,
h3,
h4,
h5,
h6,
figure,
p,
pre {
  margin: 0;
}

/* List Reset */
ol,
ul {
  list-style: none;
  /* Optional: For cases where you want to restore default list styles */
  /* list-style: revert; */ 
}

/* Image Reset */
img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block; /* Prevents media from overflowing its container */
  max-width: 100%;
  height: auto;
}

/* Table Reset */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%; /* Ensures tables are responsive by default */
  /* Optional: For better responsive tables */
  /* display: block; */
  /* overflow-x: auto; */
}

/* --------------------------------------------------------------
  Modern Reset
-------------------------------------------------------------- */

/* Reset button styles */
button {
  /* Less aggressive reset that preserves accessibility */
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer; /* Ensure buttons have a pointer cursor */
  
  /* Previous more aggressive reset - commented out */
  /* all: unset; */
  /* cursor: pointer; */
}

/* Reset appearance for form elements */
button,
input,
optgroup,
select,
textarea {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
  margin: 0;
}

/* Improve form element styling */
input,
textarea {
  border: 1px solid #ccc;
  border-radius: var(--border-radius-sm);
  padding: 0.5em;
}

/* Logical properties for better internationalization */
/* Uncomment to use logical properties instead of directional properties */
/*
p, h1, h2, h3, h4, h5, h6 {
  margin-block-start: 0;
  margin-block-end: 0;
  margin-inline-start: 0;
  margin-inline-end: 0;
  padding-block-start: 0;
  padding-block-end: 0;
  padding-inline-start: 0;
  padding-inline-end: 0;
}
*/

/* --------------------------------------------------------------
  Normalize.css (v8.0.1 -  Customized)
-------------------------------------------------------------- */

/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section,
main {
  display: block;
}

/* Correct the line height in all browsers. */
html {
  line-height: 1.15; /* From Normalize, but consider using var(--line-height-base) instead */
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* --------------------------------------------------------------
  Viewport & Responsive Base
-------------------------------------------------------------- */

html {
  /* Use viewport units for fluid typography */
  font-size: clamp(
    1rem,
    calc(1rem + (var(--font-size-base) * 0.25) * ((100vw - 20rem) / 60rem)), /* Added 'rem' unit here */
    calc(var(--font-size-base) * 1.25)
  );
  
  /* Container query support */
  container-type: inline-size;
}

/* --------------------------------------------------------------
  Accessibility Enhancements
-------------------------------------------------------------- */

/* Ensure keyboard focus is clearly visible */
:focus-visible {
  outline: var(--outline-width) solid var(--color-focus);
  outline-offset: var(--outline-offset);
}

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

/* Hide content visually, but keep it available for screen readers */
.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Skip to content link - accessible but hidden until focused */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-background);
  color: var(--color-text-primary);
  padding: 8px;
  z-index: 100;
  transition: top 0.2s ease;
}

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

/* --------------------------------------------------------------
  Interactive Element Styles
-------------------------------------------------------------- */

/* Improve the hit area for interactive elements */
/* 
 * Note: This is commented out as it might be too opinionated for a reset
 * Uncomment if you want default padding on all interactive elements
 */
/*
button,
a {
  padding: 0.5rem 1rem;
  display: inline-block;
  text-decoration: none;
}
*/

/* Default link styling */
a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  transition: color var(--transition-speed) var(--transition-timing);
}

a:hover {
  color: color-mix(in srgb, var(--color-link) 80%, black);
}

/* --------------------------------------------------------------
  Print Styles
-------------------------------------------------------------- */

@media print {
  *,
  *::before,
  *::after {
    text-shadow: none !important;
    box-shadow: none !important;
    background-color: transparent !important;
    color: #000 !important; /* Black prints faster */
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]:after {
    content: " (" attr(href) ")";
  }

  abbr[title]:after {
    content: " (" attr(title) ")";
  }

  /*
    Don't show links for images, or javascript/internal links
    Note: .ir class is somewhat outdated but kept for compatibility
  */
  .ir a:after,
  a[href^="javascript:"]:after,
  a[href^="#"]:after {
    content: "";
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  tr,
  img {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  img {
    max-width: 100% !important;
  }

  @page {
    margin: 0.5cm;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
    break-after: avoid;
  }
}