/**
 * Base CSS - Reset, Typography, Foundation
 *
 * @package Dix
 * @since 1.0.0
 */

/* ==========================================================================
   CSS RESET (Modern)
   ========================================================================== */

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

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    line-height: var(--line-height-normal);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    color: var(--color-text);
    background-color: var(--color-bg);
}

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

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

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

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

ul,
ol {
    list-style: none;
}

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

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

h1, .h1 {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-5xl);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
}

h2, .h2 {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
}

h3, .h3 {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-snug);
}

h4, .h4 {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-snug);
}

h5, .h5 {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
}

h6, .h6 {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
}

p {
    margin-bottom: var(--spacing-4);
}

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

strong, b {
    font-weight: var(--font-weight-semibold);
}

small {
    font-size: var(--font-size-sm);
}

/* Links */
a:not([class]) {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color var(--transition-fast);
}

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

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

.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;
}

.screen-reader-text:focus {
    background-color: var(--color-bg);
    clip: auto !important;
    clip-path: none;
    color: var(--color-text);
    display: block;
    font-size: var(--font-size-base);
    height: auto;
    left: 5px;
    line-height: normal;
    padding: var(--spacing-4);
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: var(--z-tooltip);
}

.skip-link {
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
    padding: var(--spacing-2) var(--spacing-4);
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    transition: transform var(--transition-fast);
    z-index: var(--z-tooltip);
}

.skip-link:focus {
    transform: translateX(-50%) translateY(0);
}

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

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Reduced motion */
@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;
    }
}

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

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

/* ==========================================================================
   CODE TAG STYLING
   ========================================================================== */

code,
.code {
    display: inline-block;
    background-color: var(--color-bg-tertiary, rgba(0, 0, 0, 0.1));
    color: var(--color-accent, #f59e0b);
    padding: 0.15em 0.5em;
    border-radius: var(--radius-md, 6px);
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.9em;
    font-weight: var(--font-weight-medium, 500);
    white-space: nowrap;
}

/* Code in light backgrounds (top-bar, buttons) */
.top-bar code,
.btn code {
    background-color: rgba(255, 255, 255, 0.2);
    color: inherit;
}

/* Code blocks (preformatted) */
pre code {
    display: block;
    padding: var(--spacing-4);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    white-space: pre;
}

/* ==========================================================================
   RESPONSIVE TYPOGRAPHY
   Note: Font sizes now use CSS clamp() for fluid scaling (see dix-dynamic-css)
   No media queries needed - sizes scale smoothly from 320px to 1200px viewport
   ========================================================================== */
