/* ============================================================
   THE DIGITAL MARKETING HQ
   Base Styles — base.css
   
   Global reset + foundational typography + accessibility
   Depends on: variables.css (must be loaded FIRST)
   ============================================================ */


/* ============================================================
   MODERN CSS RESET
   ============================================================ */

*,
*::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;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
    scroll-padding-top: var(--navbar-height);
    tab-size: 4;
    line-height: 1.15;
    height: 100%;
}

body {
    min-height: 100%;
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-text-body);
    background-color: var(--color-bg-primary);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* Prevent horizontal scroll on mobile */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}


/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--color-text-heading);
    text-wrap: balance;
}

h1 {
    font-size: clamp(2rem, 5vw + 1rem, var(--font-size-6xl));
    font-weight: var(--font-weight-extrabold);
    letter-spacing: -0.03em;
}

h2 {
    font-size: clamp(1.75rem, 4vw + 0.5rem, var(--font-size-5xl));
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.025em;
}

h3 {
    font-size: clamp(1.5rem, 3vw + 0.25rem, var(--font-size-4xl));
    font-weight: var(--font-weight-bold);
}

h4 {
    font-size: clamp(1.25rem, 2vw + 0.25rem, var(--font-size-3xl));
    font-weight: var(--font-weight-semibold);
}

h5 {
    font-size: clamp(1.125rem, 1.5vw + 0.25rem, var(--font-size-2xl));
    font-weight: var(--font-weight-semibold);
}

h6 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
}

p {
    margin: 0;
    line-height: var(--line-height-relaxed);
    text-wrap: pretty;
}

small {
    font-size: var(--font-size-sm);
}

strong, b {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-heading);
}

em, i {
    font-style: italic;
}

mark {
    background-color: var(--color-warning-100);
    color: var(--color-warning-900);
    padding: 0.1em 0.3em;
    border-radius: var(--radius-sm);
}

[data-theme="dark"] mark {
    background-color: var(--color-warning-900);
    color: var(--color-warning-100);
}


/* ============================================================
   LINKS
   ============================================================ */

a {
    color: var(--color-text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
    cursor: pointer;
}

a:hover {
    color: var(--color-text-link-hover);
}

a:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}


/* ============================================================
   LISTS
   ============================================================ */

ul, ol {
    list-style: none;
}

ul.list-styled,
ol.list-styled {
    padding-left: var(--space-6);
}

ul.list-styled { list-style: disc; }
ol.list-styled { list-style: decimal; }

ul.list-styled li,
ol.list-styled li {
    margin-bottom: var(--space-2);
    line-height: var(--line-height-relaxed);
}


/* ============================================================
   MEDIA (Images, Video, Iframe)
   ============================================================ */

img, picture, video, canvas, svg, iframe {
    display: block;
    max-width: 100%;
    height: auto;
}

img {
    -webkit-user-drag: none;
    user-select: none;
}

svg {
    fill: currentColor;
    flex-shrink: 0;
}


/* ============================================================
   FORMS
   ============================================================ */

input, button, textarea, select {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

input, textarea, select {
    background-color: var(--color-bg-input);
    border: 1px solid var(--color-border-input);
    color: var(--color-text-primary);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    width: 100%;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px rgba(59, 92, 248, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--color-text-tertiary);
    opacity: 1;
}

textarea {
    resize: vertical;
    min-height: 100px;
    font-family: var(--font-primary);
}

label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}


/* ============================================================
   CODE
   ============================================================ */

code, kbd, samp, pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

code {
    background-color: var(--color-bg-code);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    color: var(--color-primary-700);
}

[data-theme="dark"] code {
    color: var(--color-primary-300);
}

pre {
    background-color: var(--color-bg-code);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    line-height: var(--line-height-normal);
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}


/* ============================================================
   TABLES
   ============================================================ */

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

th, td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border-primary);
}

th {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-heading);
    background-color: var(--color-bg-secondary);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
}


/* ============================================================
   HORIZONTAL RULE
   ============================================================ */

hr {
    border: none;
    border-top: 1px solid var(--color-border-primary);
    margin: var(--space-8) 0;
}


/* ============================================================
   BLOCKQUOTE
   ============================================================ */

blockquote {
    border-left: 4px solid var(--color-primary-500);
    padding-left: var(--space-4);
    margin: var(--space-6) 0;
    color: var(--color-text-secondary);
    font-style: italic;
}


/* ============================================================
   SELECTION
   ============================================================ */

::selection {
    background-color: var(--color-primary-500);
    color: white;
}

::-moz-selection {
    background-color: var(--color-primary-500);
    color: white;
}


/* ============================================================
   SCROLLBAR
   ============================================================ */

/* Webkit browsers */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--color-neutral-300);
    border-radius: var(--radius-full);
    border: 2px solid var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-neutral-400);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--color-neutral-700);
    border-color: var(--color-bg-secondary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--color-neutral-600);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-neutral-300) var(--color-bg-secondary);
}

[data-theme="dark"] * {
    scrollbar-color: var(--color-neutral-700) var(--color-bg-secondary);
}


/* ============================================================
   ACCESSIBILITY
   ============================================================ */

/* Focus visible for keyboard users */
:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

/* Remove default focus from mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* 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;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--color-primary-600);
    color: white;
    padding: var(--space-3) var(--space-4);
    z-index: var(--z-max);
    text-decoration: none;
    font-weight: var(--font-weight-semibold);
}

.skip-to-content:focus {
    top: 0;
}

/* 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;
    }
}


/* ============================================================
   UTILITY CLASSES
   ============================================================ */

/* Layout */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.container-narrow {
    max-width: var(--container-narrow);
}

.container-wide {
    max-width: var(--container-wide);
}

@media (min-width: 640px) {
    .container,
    .container-narrow,
    .container-wide {
        padding-left: var(--space-6);
        padding-right: var(--space-6);
    }
}

@media (min-width: 1024px) {
    .container,
    .container-narrow,
    .container-wide {
        padding-left: var(--space-8);
        padding-right: var(--space-8);
    }
}

/* Display */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Flexbox */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Text colors */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-muted { color: var(--color-text-muted); }
.text-brand { color: var(--color-primary-600); }
.text-success { color: var(--color-accent-600); }
.text-warning { color: var(--color-warning-600); }
.text-danger { color: var(--color-danger-600); }

/* Font weights */
.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* Backgrounds */
.bg-primary { background-color: var(--color-bg-primary); }
.bg-secondary { background-color: var(--color-bg-secondary); }
.bg-card { background-color: var(--color-bg-card); }

/* Spacing (margin) */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Width / Height */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* Rounded */
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* Truncate text */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(59, 92, 248, 0.3); }
    50%      { box-shadow: 0 0 40px rgba(59, 92, 248, 0.5); }
}

.animate-fadeIn     { animation: fadeIn var(--transition-slow) ease-out; }
.animate-fadeInUp   { animation: fadeInUp var(--transition-slow) ease-out; }
.animate-fadeInDown { animation: fadeInDown var(--transition-slow) ease-out; }
.animate-slideInLeft  { animation: slideInLeft var(--transition-slow) ease-out; }
.animate-slideInRight { animation: slideInRight var(--transition-slow) ease-out; }
.animate-scaleIn    { animation: scaleIn var(--transition-normal) ease-out; }
.animate-pulse      { animation: pulse 2s ease-in-out infinite; }
.animate-spin       { animation: spin 1s linear infinite; }
.animate-float      { animation: float 3s ease-in-out infinite; }
.animate-glow       { animation: glow 2s ease-in-out infinite; }


/* ============================================================
   LOADING STATES
   ============================================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-secondary) 0%,
        var(--color-bg-tertiary) 50%,
        var(--color-bg-secondary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border-primary);
    border-top-color: var(--color-primary-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}


/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    body {
        background: white;
        color: black;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    .no-print,
    nav,
    footer,
    button {
        display: none !important;
    }
}