/**
 * CSS Reset
 *
 * Modern CSS reset with sensible defaults.
 * Based on Josh Comeau's custom reset with enhancements.
 *
 * @package CloveTheme
 * @since 1.0.0
 */

/* ==========================================================================
   BOX SIZING
   ========================================================================== */

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

/* ==========================================================================
   REMOVE DEFAULT MARGINS & PADDING
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   HTML & BODY
   ========================================================================== */

html {
    /* Prevent font size inflation */
    -moz-text-size-adjust: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;

    /* Smooth scrolling for anchor links */
    scroll-behavior: smooth;

    /* Better tab highlighting on iOS */
    -webkit-tap-highlight-color: transparent;
}

/* 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;
        scroll-behavior: auto !important;
    }
}

body {
    /* Minimum height fills viewport */
    min-height: 100vh;
    min-height: 100dvh;

    /* Base typography */
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text-primary);
    background-color: var(--color-surface-primary);

    /* Better text rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    text-wrap: balance;
    overflow-wrap: break-word;
}

p, li, figcaption {
    text-wrap: pretty;
    overflow-wrap: break-word;
}

/* ==========================================================================
   LISTS
   ========================================================================== */

ul, ol {
    list-style: none;
}

/* ==========================================================================
   LINKS
   ========================================================================== */

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

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

a:not([class]):hover {
    color: var(--color-text-link-hover);
}

/* ==========================================================================
   MEDIA
   ========================================================================== */

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

img {
    /* Remove border on images inside links in IE */
    border-style: none;
}

/* ==========================================================================
   FORMS
   ========================================================================== */

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

/* Remove inner border and padding in Firefox */
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
    border-style: none;
    padding: 0;
}

/* Textarea without resize (opt-in) */
textarea:not([rows]) {
    min-height: 10em;
}

/* ==========================================================================
   TABLES
   ========================================================================== */

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

/* ==========================================================================
   INTERACTIVE ELEMENTS
   ========================================================================== */

/* Anchor targets with proper offset for fixed header */
:target {
    scroll-margin-block-start: calc(var(--header-height) + var(--space-4));
}

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

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

/* Disabled elements */
[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Hidden attribute support */
[hidden] {
    display: none !important;
}

/* ==========================================================================
   SELECTION
   ========================================================================== */

::selection {
    background-color: var(--color-brand-primary);
    color: var(--color-text-inverse);
}

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

.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ==========================================================================
   SKIP LINK
   ========================================================================== */

.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    z-index: var(--z-max);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-inverse);
    color: var(--color-text-inverse);
    font-weight: var(--weight-medium);
    border-radius: var(--radius-md);
    transition: top var(--duration-200) var(--ease-out);
}

.skip-link:focus {
    top: var(--space-4);
}
