/**
 * CommerceForge Base & Reset Styles (Phase UI-01: Premium Commerce OS)
 *
 * Modern reset, typography baseline, accessibility primitives, and focus management.
 *
 * @author Jyotirmay Ray <https://jyotirmayray.in/>
 */

/* -----------------------------------------------------------------------------
 * 1. Box-Sizing & Reset
 * -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--cf-color-ink);
}

body {
    font-family: var(--cf-font-sans);
    font-size: var(--cf-font-size-body);
    line-height: var(--cf-line-height-normal);
    letter-spacing: var(--cf-letter-spacing-normal);
    color: var(--cf-color-text-primary);
    background-color: var(--cf-color-ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

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

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

ul, ol {
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--cf-transition-color);
}

a:hover {
    color: var(--cf-color-primary);
}

/* -----------------------------------------------------------------------------
 * 2. Focus & Accessibility Primitives
 * -------------------------------------------------------------------------- */
:focus {
    outline: none;
}

:focus-visible {
    outline: none;
    box-shadow: var(--cf-focus-ring);
    border-radius: var(--cf-radius-sm);
}

.skip-link {
    position: absolute;
    top: -120px;
    left: var(--cf-space-16);
    background: var(--cf-color-primary);
    color: var(--cf-color-white);
    padding: var(--cf-space-12) var(--cf-space-20);
    border-radius: var(--cf-radius-sm);
    font-size: var(--cf-font-size-body-sm);
    font-weight: var(--cf-font-weight-medium);
    z-index: var(--cf-z-toast);
    transition: top var(--cf-duration-fast) var(--cf-ease-out);
    box-shadow: var(--cf-shadow-lg);
}

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

.sr-only,
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* -----------------------------------------------------------------------------
 * 3. Typography Scale & Heading Baseline
 * -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6,
.cf-display, .cf-hero-title, .cf-h1, .cf-h2, .cf-h3, .cf-h4 {
    font-family: var(--cf-font-sans);
    font-weight: var(--cf-font-weight-bold);
    letter-spacing: var(--cf-letter-spacing-tight);
    line-height: var(--cf-line-height-tight);
    color: var(--cf-color-text-primary);
}

.cf-display {
    font-size: var(--cf-font-size-display);
    letter-spacing: -0.04em;
}

.cf-hero-title {
    font-size: var(--cf-font-size-hero);
    letter-spacing: -0.035em;
}

h1, .cf-h1 {
    font-size: var(--cf-font-size-h1);
}

h2, .cf-h2 {
    font-size: var(--cf-font-size-h2);
}

h3, .cf-h3 {
    font-size: var(--cf-font-size-h3);
    font-weight: var(--cf-font-weight-semibold);
}

h4, .cf-h4 {
    font-size: var(--cf-font-size-body-lg);
    font-weight: var(--cf-font-weight-semibold);
}

p {
    margin-bottom: var(--cf-space-16);
    color: var(--cf-color-text-secondary);
}

p:last-child {
    margin-bottom: 0;
}

.cf-lead {
    font-size: var(--cf-font-size-body-lg);
    line-height: var(--cf-line-height-relaxed);
    color: var(--cf-color-text-secondary);
}

.cf-small {
    font-size: var(--cf-font-size-small);
    color: var(--cf-color-text-muted);
}

.cf-micro {
    font-size: var(--cf-font-size-micro);
    letter-spacing: var(--cf-letter-spacing-caps);
    text-transform: uppercase;
    color: var(--cf-color-text-muted);
}

.cf-mono {
    font-family: var(--cf-font-mono);
}

/* -----------------------------------------------------------------------------
 * 4. Selection & Scrollbar
 * -------------------------------------------------------------------------- */
::selection {
    background-color: var(--cf-color-primary-soft);
    color: var(--cf-color-primary);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--cf-color-ink);
}

::-webkit-scrollbar-thumb {
    background: var(--cf-color-border-strong);
    border-radius: var(--cf-radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--cf-color-text-muted);
}

/* -----------------------------------------------------------------------------
 * 5. Reduced Motion Override
 * -------------------------------------------------------------------------- */
@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;
    }
}
