/*
 * ImageLab - Base Styles
 * Version: 4.2 - STRAY CHAR REMOVED, MENU-OPEN DEDUPED
 * Reset, typography, body, and core element styles
 * Updated: March 2026
 *
 * CHANGES FROM v4.1:
 * ✅ FIXED: Removed stray å character that was at the very start of the file,
 *           which caused silent parse failures in Safari and some CSS bundlers
 * ✅ FIXED: Removed body.menu-open / body.no-scroll block — now owned
 *           exclusively by 04-header.css to prevent duplicate rule drift
 * ✅ FIXED: Added h3::after { display: none } as a defensive default,
 *           preventing future h3 underlines if 02-base.css ever adds h3::after
 *
 * WCAG 2.1 AA Compliant
 */

/* ============================================
 * RESET
 * ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

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

/* ============================================
 * ACCESSIBILITY (Canonical definitions)
 * ============================================ */

/* Skip Link */
.skip-link {
    position: fixed;
    top: -100px;
    left: 0;
    z-index: 9999;
    padding: var(--space-md, 1rem) var(--space-lg, 1.5rem);
    background: var(--color-primary-600, #9333ea);
    color: #ffffff;
    text-decoration: none;
    font-weight: var(--font-weight-semibold, 600);
    border-radius: 0 0 var(--radius-base, 0.5rem) 0;
    transition: top var(--transition-fast, 0.15s);
}

.skip-link:focus {
    top: 0;
    outline: 3px solid var(--color-accent-500, #f97316);
    outline-offset: 2px;
}

/* Screen Reader Only (CANONICAL — only defined here) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Styles (WCAG 2.1 AA) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--color-accent-500, #f97316);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
 * BODY - DARK GLASSMORPHISM
 * ============================================ */
body {
    font-family: var(--font-family-body, 'Inter', sans-serif);
    font-size: var(--font-size-base, 1rem);
    line-height: var(--line-height-normal, 1.6);
    color: var(--text-secondary, #e0e4ea);
    background: var(--bg-darkest, #0a0e1a);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/*
 * NOTE: body.menu-open and body.no-scroll are defined in 04-header.css.
 * They are NOT duplicated here to prevent rule drift when one is patched
 * and the other is not. All scroll-lock styles live in one place.
 */

/* Ambient Background Effects */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(183, 148, 246, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(147, 51, 234, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(221, 214, 254, 0.015) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Main Content Area */
main {
    position: relative;
    z-index: 1;
}

/* ============================================
 * TYPOGRAPHY - HEADINGS
 * text-align is intentionally omitted — alignment is inherited from
 * parent containers as set up in 03-layout.css (do not add it back here
 * or in 11-utilities.css, which caused a regression in v4.1)
 * ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-heading, 'Poppins', sans-serif);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-md, 1rem);
}

/* H1 - Gradient Text (White to Lavender) */
h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: var(--space-lg, 1.5rem);
    background: var(--gradient-text, linear-gradient(135deg, #ffffff 0%, #ddd6fe 100%));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@supports not (background-clip: text) {
    h1 {
        color: var(--text-primary, #ffffff);
        background: none;
        -webkit-text-fill-color: initial;
    }
}

/* H2 - Gradient Text with Glowing Underline */
h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    background: var(--gradient-text, linear-gradient(135deg, #ffffff 0%, #ddd6fe 100%));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    position: relative;
}

h2::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: var(--gradient-lavender, linear-gradient(135deg, #b794f6 0%, #9333ea 100%));
    margin: var(--space-md, 1rem) auto 0;
    border-radius: var(--radius-full, 9999px);
    box-shadow: var(--shadow-glow-lavender, 0 0 20px rgba(183, 148, 246, 0.15));
}

h2.text-left::after {
    margin-left: 0;
    margin-right: auto;
}

h2.text-right::after {
    margin-left: auto;
    margin-right: 0;
}

/* Suppress h2::after inside components that don't want the underline */
.footer-column h2::after,
.modal h2::after,
nav h2::after,
.no-underline::after {
    display: none;
}

/*
 * DEFENSIVE: h3 has no ::after treatment now, but this suppresses any
 * that might be added in future without a deliberate opt-in per component.
 * Components that DO want an h3 underline should add it explicitly.
 */
h3::after {
    display: none;
}

@supports not (background-clip: text) {
    h2 {
        color: var(--text-primary, #ffffff);
        background: none;
        -webkit-text-fill-color: initial;
    }
}

/* H3–H6 - Lavender Accent Color */
h3 {
    font-size: clamp(1.5rem, 3vw, 1.75rem);
    color: var(--color-primary-400, #ddd6fe);
}

h4 {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    color: var(--color-primary-400, #ddd6fe);
}

h5 {
    font-size: 1.125rem;
    color: var(--color-primary-400, #ddd6fe);
}

h6 {
    font-size: 1rem;
    color: var(--color-primary-400, #ddd6fe);
}

/* ============================================
 * TYPOGRAPHY - PARAGRAPHS & TEXT
 * ============================================ */
p {
    font-family: var(--font-family-body, 'Inter', sans-serif);
    margin-bottom: var(--space-md, 1rem);
    line-height: 1.7;
    color: var(--text-secondary, #e0e4ea);
}

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

.section-lead {
    font-size: clamp(1.125rem, 2vw, 1.25rem);
    line-height: 1.7;
    color: var(--text-secondary, #e0e4ea);
    max-width: 800px;
    margin: 0 auto var(--space-xl, 3rem);
    text-align: center;
}

/* ============================================
 * LINKS
 * ============================================ */
a {
    color: var(--color-primary-400, #ddd6fe);
    text-decoration: none;
    transition: color var(--transition-fast, 0.15s);
    position: relative;
}

a:hover,
a:focus {
    color: var(--color-primary-500, #b794f6);
}

a.link-underline {
    text-decoration: underline;
    text-decoration-color: var(--color-primary-400, #ddd6fe);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

a.link-underline:hover {
    text-decoration-color: var(--color-primary-500, #b794f6);
}

/* ============================================
 * LISTS
 * ============================================ */
ul, ol {
    margin-bottom: var(--space-md, 1rem);
    padding-left: var(--space-lg, 2rem);
    color: var(--text-secondary, #e0e4ea);
}

li {
    margin-bottom: var(--space-xs, 0.5rem);
    line-height: 1.7;
}

ul li::marker {
    color: var(--color-primary-500, #b794f6);
}

ol li::marker {
    color: var(--color-primary-500, #b794f6);
    font-weight: 600;
}

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

img {
    border-radius: var(--radius-sm, 0.25rem);
}

/* ============================================
 * BLOCKQUOTE
 * ============================================ */
blockquote {
    margin: var(--space-lg, 2rem) 0;
    padding: var(--space-lg, 2rem);
    background: var(--glass-card-default, rgba(15, 22, 35, 0.6));
    backdrop-filter: var(--glass-blur-medium, blur(6px));
    -webkit-backdrop-filter: var(--glass-blur-medium, blur(6px));
    border-left: 4px solid var(--color-primary-500, #b794f6);
    border-radius: var(--radius-base, 0.5rem);
    font-style: italic;
    color: var(--text-secondary, #e0e4ea);
}

blockquote p {
    margin-bottom: var(--space-sm, 0.5rem);
}

blockquote cite {
    display: block;
    margin-top: var(--space-sm, 0.5rem);
    font-size: var(--font-size-sm, 0.875rem);
    font-style: normal;
    color: var(--color-primary-400, #ddd6fe);
}

blockquote cite::before {
    content: '— ';
}

/* ============================================
 * CODE & PRE
 * ============================================ */
code {
    padding: 0.2em 0.4em;
    background: var(--glass-card-default, rgba(15, 22, 35, 0.6));
    border: var(--glass-border, 1px solid rgba(183, 148, 246, 0.2));
    border-radius: var(--radius-sm, 0.25rem);
    font-family: var(--font-family-mono, 'Courier New', monospace);
    font-size: 0.9em;
    color: var(--color-primary-400, #ddd6fe);
}

pre {
    margin: var(--space-lg, 2rem) 0;
    padding: var(--space-lg, 2rem);
    background: var(--glass-card-default, rgba(15, 22, 35, 0.6));
    backdrop-filter: var(--glass-blur-medium, blur(6px));
    -webkit-backdrop-filter: var(--glass-blur-medium, blur(6px));
    border: var(--glass-border, 1px solid rgba(183, 148, 246, 0.2));
    border-radius: var(--radius-base, 0.5rem);
    overflow-x: auto;
}

pre code {
    padding: 0;
    background: none;
    border: none;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* ============================================
 * HORIZONTAL RULE
 * ============================================ */
hr {
    margin: var(--space-xl, 3rem) 0;
    border: none;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--color-primary-500, #b794f6) 50%,
        transparent 100%);
    opacity: 0.3;
}

/* ============================================
 * FADE-IN ANIMATION
 * ============================================ */
.fade-in-element {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-element.in-view {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .fade-in-element {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ============================================
 * SELECTION
 * ============================================ */
::selection {
    background: var(--color-primary-600, #9333ea);
    color: #ffffff;
    text-shadow: none;
}

::-moz-selection {
    background: var(--color-primary-600, #9333ea);
    color: #ffffff;
    text-shadow: none;
}

/* ============================================
 * SCROLLBAR (Webkit)
 * ============================================ */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark, #0f1623);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary-600, #9333ea);
    border-radius: var(--radius-full, 9999px);
    border: 2px solid var(--bg-dark, #0f1623);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-500, #b794f6);
}

/* ============================================
 * HIGH CONTRAST MODE
 * ============================================ */
@media (prefers-contrast: high) {
    h1, h2 {
        color: var(--text-primary, #ffffff);
        background: none;
        -webkit-text-fill-color: initial;
    }

    h2::after {
        background: var(--color-primary-500, #b794f6);
        box-shadow: none;
    }

    a {
        text-decoration: underline;
    }

    blockquote,
    pre {
        border-width: 2px;
    }

    ::selection,
    ::-moz-selection {
        background: var(--color-primary-700, #7e22ce);
        color: #ffffff;
        outline: 2px solid #ffffff;
    }
}