/* CSS Reset - Modernized for Cross-Browser Consistency */

/* Box-sizing reset for all elements */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Remove default margins and paddings for all elements */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

/* Ensure HTML5 elements are displayed as block by default */
article, aside, details, figcaption, figure,
footer, header, hgroup, main, menu, nav, section {
    display: block;
}

/* Normalize HTML root element */
html {
    line-height: 1.15; /* Improve readability */
    -webkit-text-size-adjust: 100%; /* Prevent iOS text size adjust */
    -ms-text-size-adjust: 100%; /* Prevent IE text size adjust */
    -webkit-font-smoothing: antialiased; /* Smooth fonts on Webkit browsers */
    -moz-osx-font-smoothing: grayscale; /* Smooth fonts on Firefox macOS */
}

/* Normalize body */
body {
    line-height: 1;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

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

/* Remove quotes for blockquotes and q elements */
blockquote, q {
    quotes: none;
}

blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}

/* Normalize tables */
table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* Reset links */
a {
    text-decoration: none;
    color: inherit;
}

/* Reset images */
img {
    max-width: 100%;
    height: auto;
    border: 0;
    display: block; /* Remove extra space below inline images */
}

/* Reset form elements */
input, button, textarea, select {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

button {
    background: transparent;
    cursor: pointer;
    padding: 0;
}

textarea {
    resize: vertical;
    overflow: auto; /* Ensure scrollbars appear when needed */
}

/* Reset fieldsets and legends */
fieldset, legend {
    border: 0;
    padding: 0;
    margin: 0;
}

/* Reset horizontal rules */
hr {
    border: 0;
    height: 1px;
    background: #000;
    margin: 0;
    padding: 0;
}

/* Reset code and preformatted text */
pre, code, kbd, samp {
    font-family: monospace, monospace;
    font-size: 1em;
}

/* Reset sub and sup elements */
sub, sup {
    position: relative;
    vertical-align: baseline;
    line-height: 0;
    font-size: 75%; /* Smaller font size for sub/sup */
}

sub {
    bottom: -0.25em;
}

sup {
    top: -0.5em;
}

/* Additional Modern Resets */

/* Remove default focus outlines for better accessibility control */
:focus {
    outline: 0;
}

/* Ensure hidden elements are not focusable */
[hidden] {
    display: none;
}

/* Reset main element for older browsers */
main {
    display: block;
}

/* Remove default tap highlight on mobile */
html {
    -webkit-tap-highlight-color: transparent;
}

/* Reset caption for tables */
caption {
    text-align: left;
    padding: 0;
}

/* Reset details and summary for better accordion behavior */
details {
    display: block;
}

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

/* Reset media elements */
audio, video {
    display: inline-block;
    vertical-align: baseline;
}

/* Remove default marker for summary */
summary::-webkit-details-marker {
    display: none;
}

/* Ensure placeholder text inherits styles */
input::placeholder,
textarea::placeholder {
    color: inherit;
    opacity: 1; /* Ensure placeholder is fully visible */
}

/* Reset disabled elements */
[disabled] {
    cursor: not-allowed;
}

/* Reset progress element */
progress {
    vertical-align: baseline;
}

/* Reset dialog element */
dialog {
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
}
