/* ============================================================================
   PHISHBLASTERS LEARNING PLATFORM — CSS DESIGN SYSTEM
   ============================================================================
   A typography-first, accessibility-focused stylesheet for educational content.
   
   Design Direction: Warm, approachable, quietly confident
   References: Khan Academy + Wikipedia + Gwern.net
   
   Table of Contents:
   1. Variables & Design Tokens
   2. Reset & Base Styles
   3. Typography System
   4. Layout & Containers
   5. Navigation Components
   6. Content Components
   7. Interactive Elements
   8. Dithering Patterns
   9. Utility Classes
   10. Responsive Breakpoints
   11. Accessibility
   12. Dark Mode
   13. Animations & Modernization
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&display=swap');


/* ============================================================================
   1. VARIABLES & DESIGN TOKENS
   ============================================================================ */

:root {
    /* --- Color Palette (Strict Greyscale) --- */

    /* Greyscale Scale */
    --color-white: #FFFFFF;
    --color-grey-50: #FAFAFA;
    --color-grey-100: #F5F5F5;
    --color-grey-200: #E5E5E5;
    --color-grey-300: #D4D4D4;
    --color-grey-400: #A3A3A3;
    --color-grey-500: #737373;
    --color-grey-600: #525252;
    --color-grey-700: #404040;
    --color-grey-800: #262626;
    --color-grey-900: #171717;
    --color-black: #0A0A0A;

    /* Backgrounds */
    --color-bg-page: var(--color-grey-50);
    --color-bg-surface: var(--color-white);
    --color-bg-muted: var(--color-grey-100);
    --color-bg-code: var(--color-grey-100);

    /* Text */
    --color-text-primary: var(--color-grey-900);
    --color-text-secondary: var(--color-grey-600);
    --color-text-tertiary: var(--color-grey-500);
    --color-text-inverse: var(--color-white);

    /* Single Accent (subdued blue) */
    --color-accent-primary: #3B82F6;
    --color-accent-hover: #2563EB;

    /* Semantic Colors (only for true warnings/errors) */
    --color-success: #059669;
    --color-warning: #d97706;
    --color-error: #dc2626;
    --color-info: #3B82F6;

    /* Borders & Lines */
    --color-border: var(--color-grey-200);
    --color-border-strong: var(--color-grey-300);
    --color-border-focus: var(--color-accent-primary);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

    /* --- Typography --- */

    /* Font Stacks */
    --font-heading: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-ui: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

    /* Type Scale (based on 18px base) */
    --text-xs: 0.75rem;
    /* 13.5px */
    --text-sm: 0.875rem;
    /* 15.75px */
    --text-base: 1.125rem;
    /* 18px - optimal reading size */
    --text-lg: 1.25rem;
    /* 22.5px */
    --text-xl: 1.5rem;
    /* 27px */
    --text-2xl: 1.875rem;
    /* 33.75px */
    --text-3xl: 2.25rem;
    /* 40.5px */
    --text-4xl: 3rem;
    /* 54px */

    /* Line Heights */
    --leading-tight: 1.25;
    --leading-snug: 1.4;
    --leading-normal: 1.65;
    /* Optimal for body text */
    --leading-relaxed: 1.8;

    /* Font Weights */
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* --- Spacing Scale (4px base unit) --- */
    --space-1: 0.25rem;
    /* 4px */
    --space-2: 0.5rem;
    /* 8px */
    --space-3: 0.75rem;
    /* 12px */
    --space-4: 1rem;
    /* 16px */
    --space-5: 1.25rem;
    /* 20px */
    --space-6: 1.5rem;
    /* 24px */
    --space-8: 2rem;
    /* 32px */
    --space-10: 2.5rem;
    /* 40px */
    --space-12: 3rem;
    /* 48px */
    --space-16: 4rem;
    /* 64px */
    --space-20: 5rem;
    /* 80px */

    /* --- Layout --- */
    --max-width-content: 42rem;
    /* ~672px = ~65ch at 18px */
    --max-width-wide: 72rem;
    /* 1152px */
    --max-width-full: 90rem;
    /* 1440px */

    /* --- Borders --- */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;

    /* --- Transitions --- */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* --- Header --- */
    --header-height: 56px;
    --header-bg: #0f172a;
}


/* ============================================================================
   2. RESET & BASE STYLES
   ============================================================================ */

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

* {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + var(--space-8));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    /* Base for rem calculations */
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg-page);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Main content pushes footer down */
main {
    flex: 1;
}

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

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

/* --- Custom Scrollbar (Greyscale Theme) --- */

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

::-webkit-scrollbar-track {
    background: var(--color-grey-100);
}

::-webkit-scrollbar-thumb {
    background: var(--color-grey-400);
    border-radius: 5px;
    border: 2px solid var(--color-grey-100);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-grey-500);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-grey-400) var(--color-grey-100);
}


/* ============================================================================
   3. TYPOGRAPHY SYSTEM
   ============================================================================ */

/* --- Headings --- */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: var(--weight-bold);
    line-height: var(--leading-tight);
    color: var(--color-text-primary);
    margin-top: 0;
}

h1 {
    font-size: var(--text-3xl);
    letter-spacing: -0.02em;
    margin-bottom: var(--space-6);
}

h2 {
    font-size: var(--text-2xl);
    letter-spacing: -0.01em;
    margin-top: var(--space-12);
    margin-bottom: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

/* First h2 after h1 shouldn't have top border */
h1+h2,
.article-header+h2 {
    border-top: none;
    margin-top: var(--space-8);
}

h3 {
    font-size: var(--text-xl);
    margin-top: var(--space-8);
    margin-bottom: var(--space-3);
}

h4 {
    font-size: var(--text-lg);
    margin-top: var(--space-6);
    margin-bottom: var(--space-2);
}

h5,
h6 {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    margin-top: var(--space-4);
    margin-bottom: var(--space-2);
}

/* --- Body Text --- */

p {
    margin-bottom: var(--space-5);
    max-width: var(--max-width-content);
}

/* Last paragraph in a container shouldn't have bottom margin */
p:last-child {
    margin-bottom: 0;
}

/* --- Links --- */

a {
    color: var(--color-accent-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-accent-secondary);
}

a:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* --- Lists --- */

ul,
ol {
    margin-bottom: var(--space-5);
    padding-left: var(--space-6);
    max-width: var(--max-width-content);
}

li {
    margin-bottom: var(--space-2);
    line-height: var(--leading-normal);
}

li::marker {
    color: var(--color-text-secondary);
}

/* Nested lists */
li>ul,
li>ol {
    margin-top: var(--space-2);
    margin-bottom: 0;
}

/* --- Blockquotes --- */

blockquote {
    margin: var(--space-6) 0;
    padding: var(--space-4) var(--space-6);
    border-left: 3px solid var(--color-accent-warm);
    background-color: var(--color-bg-muted);
    font-style: italic;
    max-width: var(--max-width-content);
}

blockquote p {
    margin-bottom: var(--space-3);
}

blockquote cite {
    display: block;
    font-style: normal;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-top: var(--space-3);
}

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

/* --- Code --- */

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background-color: var(--color-bg-code);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    background-color: var(--color-bg-code);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    overflow-x: auto;
    margin-bottom: var(--space-6);
}

pre code {
    background: none;
    padding: 0;
    border: none;
    font-size: inherit;
}

/* --- Horizontal Rules --- */

hr {
    border: none;
    height: 1px;
    background-color: var(--color-border);
    margin: var(--space-10) 0;
}

/* --- Small Text & Captions --- */

small,
.text-sm {
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
}

.text-xs {
    font-size: var(--text-xs);
}

.text-muted {
    color: var(--color-text-secondary);
}

/* --- Strong & Emphasis --- */

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

mark {
    background-color: #fef3c7;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}


/* ============================================================================
   4. LAYOUT & CONTAINERS
   ============================================================================ */

/* --- Page Shell --- */

.shell {
    width: 100%;
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.shell-narrow {
    max-width: var(--max-width-content);
}

.shell-full {
    max-width: var(--max-width-full);
}

/* --- Article Layout (with TOC sidebar) --- */

.article-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-10);
    margin-top: var(--space-6);
    padding-bottom: var(--space-16);
}

@media (min-width: 1024px) {
    .article-layout {
        grid-template-columns: 220px 1fr;
        gap: var(--space-12);
    }
}

@media (min-width: 1280px) {
    .article-layout {
        grid-template-columns: 260px 1fr 200px;
    }
}

/* --- Content Area --- */

.article-content {
    max-width: var(--max-width-content);
    min-width: 0;
    /* Prevents overflow in grid */
}


/* ============================================================================
   5. NAVIGATION COMPONENTS
   ============================================================================ */

/* --- Header (Minimal, Non-Intrusive) --- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    background-color: var(--header-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-skeleton {
    height: var(--header-height);
    background-color: var(--header-bg);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 var(--space-6);
    max-width: var(--max-width-full);
    margin: 0 auto;
}

.brand {
    font-family: var(--font-heading);
    font-weight: var(--weight-bold);
    font-size: var(--text-lg);
    color: var(--color-text-inverse);
    text-decoration: none;
}

.brand:hover {
    color: var(--color-text-inverse);
    opacity: 0.9;
}

/* --- Scroll Progress Bar --- */

.scroll-progress {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent-primary), var(--color-accent-secondary));
    z-index: 99;
    transition: width 100ms linear;
}

/* --- Breadcrumbs --- */

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.breadcrumbs a {
    color: var(--color-text-secondary);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--color-accent-primary);
    text-decoration: underline;
}

.breadcrumbs-separator {
    color: var(--color-text-tertiary);
    user-select: none;
}

.breadcrumbs-separator::before {
    content: "›";
}

.breadcrumbs-current {
    color: var(--color-text-primary);
    font-weight: var(--weight-medium);
}

/* --- Table of Contents (Sidebar) --- */

.toc {
    position: sticky;
    top: calc(var(--header-height) + var(--space-6));
    max-height: calc(100vh - var(--header-height) - var(--space-12));
    overflow-y: auto;
    padding-right: var(--space-4);
}

.toc-title {
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-3);
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-link {
    display: block;
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: var(--space-2) var(--space-3);
    border-left: 2px solid transparent;
    margin-left: -2px;
    transition: all var(--transition-fast);
}

.toc-link:hover {
    color: var(--color-text-primary);
    background-color: var(--color-bg-muted);
}

.toc-link.active {
    color: var(--color-accent-primary);
    border-left-color: var(--color-accent-primary);
    background-color: rgba(37, 99, 235, 0.05);
    font-weight: var(--weight-medium);
}

/* Nested TOC items */
.toc-link[data-level="3"] {
    padding-left: var(--space-6);
    font-size: var(--text-xs);
}

/* --- Back to Top --- */

.back-to-top {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    color: var(--color-text-secondary);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    z-index: 50;
}

.back-to-top:hover {
    color: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* Arrow icon (CSS-only) */
.back-to-top::before {
    content: "";
    width: 10px;
    height: 10px;
    border-left: 2px solid currentColor;
    border-top: 2px solid currentColor;
    transform: rotate(45deg) translateY(2px);
}


/* ============================================================================
   6. CONTENT COMPONENTS
   ============================================================================ */

/* --- Cards (Generic Surface) --- */

.card {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
}

/* For backwards compatibility */
.dash-card,
.white-panel {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
}

/* --- Callout Boxes (No Emojis — CSS Icons) --- */

.callout {
    position: relative;
    margin: var(--space-6) 0;
    padding: var(--space-4) var(--space-5);
    padding-left: var(--space-12);
    border-radius: var(--radius-md);
    border-left: 4px solid;
    max-width: var(--max-width-content);
}

.callout::before {
    content: "";
    position: absolute;
    left: var(--space-4);
    top: var(--space-4);
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
}

/* Note (Info) */
.callout-note {
    background-color: #eff6ff;
    border-color: var(--color-info);
}

.callout-note::before {
    /* CSS info icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%232563eb'%3E%3Cpath fill-rule='evenodd' d='M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z' clip-rule='evenodd'/%3E%3C/svg%3E");
}

/* Tip (Success) */
.callout-tip {
    background-color: #ecfdf5;
    border-color: var(--color-success);
}

.callout-tip::before {
    /* CSS lightbulb icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23059669'%3E%3Cpath d='M11 3a1 1 0 10-2 0v1a1 1 0 102 0V3zM15.657 5.757a1 1 0 00-1.414-1.414l-.707.707a1 1 0 001.414 1.414l.707-.707zM18 10a1 1 0 01-1 1h-1a1 1 0 110-2h1a1 1 0 011 1zM5.05 6.464A1 1 0 106.464 5.05l-.707-.707a1 1 0 00-1.414 1.414l.707.707zM5 10a1 1 0 01-1 1H3a1 1 0 110-2h1a1 1 0 011 1zM8 16v-1h4v1a2 2 0 11-4 0zM12 14c.015-.34.208-.646.477-.859a4 4 0 10-4.954 0c.27.213.462.519.476.859h4.002z'/%3E%3C/svg%3E");
}

/* Warning */
.callout-warning {
    background-color: #fffbeb;
    border-color: var(--color-warning);
}

.callout-warning::before {
    /* CSS warning icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23d97706'%3E%3Cpath fill-rule='evenodd' d='M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z' clip-rule='evenodd'/%3E%3C/svg%3E");
}

/* Caution (Danger) */
.callout-caution {
    background-color: #fef2f2;
    border-color: var(--color-error);
}

.callout-caution::before {
    /* CSS error icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23dc2626'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z' clip-rule='evenodd'/%3E%3C/svg%3E");
}

.callout-title {
    font-family: var(--font-ui);
    font-weight: var(--weight-semibold);
    font-size: var(--text-sm);
    margin-bottom: var(--space-2);
}

.callout p {
    font-size: var(--text-sm);
    margin-bottom: var(--space-2);
}

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

/* --- Definition Blocks --- */

.definition {
    margin: var(--space-5) 0;
    padding: var(--space-4) var(--space-5);
    background-color: var(--color-bg-muted);
    border-left: 3px solid var(--color-accent-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    max-width: var(--max-width-content);
}

.definition-term {
    font-family: var(--font-ui);
    font-weight: var(--weight-semibold);
    font-size: var(--text-base);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.definition-text {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin: 0;
}

/* --- Example Blocks --- */

.example {
    margin: var(--space-6) 0;
    padding: var(--space-5);
    background-color: var(--color-bg-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    max-width: var(--max-width-content);
}

.example-label {
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-3);
}

/* --- Collapsible Sections (Progressive Disclosure) --- */

.collapsible {
    margin: var(--space-5) 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    max-width: var(--max-width-content);
    overflow: hidden;
}

.collapsible-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background-color: var(--color-bg-muted);
    border: none;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text-primary);
    text-align: left;
    transition: background-color var(--transition-fast);
}

.collapsible-trigger:hover {
    background-color: var(--color-bg-code);
}

.collapsible-trigger:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: -2px;
}

/* Chevron indicator */
.collapsible-trigger::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--color-text-secondary);
    border-bottom: 2px solid var(--color-text-secondary);
    transform: rotate(45deg);
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.collapsible-trigger[aria-expanded="true"]::after {
    transform: rotate(-135deg);
}

.collapsible-content {
    display: none;
    padding: var(--space-5);
    background-color: var(--color-bg-surface);
}

.collapsible-content[data-expanded="true"] {
    display: block;
}

/* --- Progress Indicator --- */

.progress-bar {
    height: 8px;
    background-color: var(--color-bg-muted);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent-primary), var(--color-accent-secondary));
    border-radius: var(--radius-sm);
    transition: width var(--transition-slow);
}

/* --- Metadata & Attribution --- */

.meta {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.meta-separator::before {
    content: "·";
    margin: 0 var(--space-2);
}

.last-updated {
    font-style: italic;
}


/* ============================================================================
   7. INTERACTIVE ELEMENTS
   ============================================================================ */

/* --- Buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    line-height: 1;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;

    /* Primary by default */
    background-color: var(--color-accent-primary);
    color: var(--color-text-inverse);
}

.btn:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-bg-page), 0 0 0 4px var(--color-accent-primary);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Secondary Button */
.btn.secondary {
    background-color: transparent;
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

.btn.secondary:hover {
    background-color: var(--color-bg-muted);
    border-color: var(--color-border-strong);
}

/* Danger Button */
.btn.danger {
    background-color: var(--color-error);
}

.btn.danger:hover {
    background-color: #b91c1c;
}

/* --- Form Inputs --- */

.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--color-text-primary);
    background-color: var(--color-bg-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:hover {
    border-color: var(--color-border-strong);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-input:disabled {
    background-color: var(--color-bg-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--text-sm);
    color: var(--color-error);
    margin-top: var(--space-2);
}

/* --- Anchor Links on Headings --- */

.heading-anchor {
    position: relative;
}

.heading-anchor-link {
    position: absolute;
    left: -1.5em;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    color: var(--color-text-tertiary);
    text-decoration: none;
    font-weight: normal;
    transition: opacity var(--transition-fast);
}

.heading-anchor-link::before {
    content: "#";
}

.heading-anchor:hover .heading-anchor-link,
.heading-anchor-link:focus {
    opacity: 1;
}


/* ============================================================================
   8. DITHERING PATTERNS (Bayer Pattern Motif)
   ============================================================================ */

/* 
   Bayer dithering creates a subtle, textured appearance using ordered patterns.
   We implement this with CSS gradients for performance and scalability.
*/

/* --- Dithered Divider --- */

.dither-divider {
    height: 8px;
    margin: var(--space-10) 0;
    background-image:
        repeating-linear-gradient(90deg,
            var(--color-border) 0px,
            var(--color-border) 2px,
            transparent 2px,
            transparent 4px),
        repeating-linear-gradient(0deg,
            var(--color-border) 0px,
            var(--color-border) 2px,
            transparent 2px,
            transparent 4px);
    background-size: 4px 4px;
    opacity: 0.5;
}

/* --- Dithered Background (Subtle Texture) --- */

.dither-bg {
    background-color: var(--color-bg-muted);
    background-image:
        repeating-linear-gradient(45deg,
            transparent 0px,
            transparent 1px,
            rgba(0, 0, 0, 0.02) 1px,
            rgba(0, 0, 0, 0.02) 2px);
    background-size: 4px 4px;
}

/* --- Dithered Border --- */

.dither-border {
    position: relative;
}

.dither-border::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background-image:
        linear-gradient(90deg,
            var(--color-border) 25%,
            transparent 25%,
            transparent 50%,
            var(--color-border) 50%,
            var(--color-border) 75%,
            transparent 75%);
    background-size: 8px 4px;
}

/* --- Dithered Fade (for images) --- */

.dither-fade {
    position: relative;
    overflow: hidden;
}

.dither-fade::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-image:
        repeating-linear-gradient(0deg,
            transparent 0px,
            transparent 2px,
            var(--color-bg-page) 2px,
            var(--color-bg-page) 4px),
        linear-gradient(to bottom,
            transparent 0%,
            var(--color-bg-page) 100%);
    background-size: 100% 4px, 100% 100%;
}

/* --- Section Dither Accent --- */

.section-dither {
    position: relative;
    padding-top: var(--space-10);
}

.section-dither::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 6px;
    background-image:
        repeating-linear-gradient(90deg,
            var(--color-accent-warm) 0px,
            var(--color-accent-warm) 3px,
            transparent 3px,
            transparent 6px);
    background-size: 6px 6px;
    opacity: 0.6;
}


/* ============================================================================
   9. UTILITY CLASSES
   ============================================================================ */

/* --- Display --- */
.hidden {
    display: none !important;
}

.block {
    display: block;
}

.flex {
    display: flex;
}

.inline {
    display: inline;
}

.inline-flex {
    display: inline-flex;
}

.grid {
    display: grid;
}

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

.gap-2 {
    gap: var(--space-2);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

.gap-8 {
    gap: var(--space-8);
}

/* --- Spacing --- */
.mt-0 {
    margin-top: 0;
}

.mt-4 {
    margin-top: var(--space-4);
}

.mt-6 {
    margin-top: var(--space-6);
}

.mt-8 {
    margin-top: var(--space-8);
}

.mt-10 {
    margin-top: var(--space-10);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-6 {
    margin-bottom: var(--space-6);
}

.mb-8 {
    margin-bottom: var(--space-8);
}

.pt-4 {
    padding-top: var(--space-4);
}

.pt-6 {
    padding-top: var(--space-6);
}

.pb-4 {
    padding-bottom: var(--space-4);
}

.pb-6 {
    padding-bottom: var(--space-6);
}

.px-4 {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.px-6 {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
}

.py-4 {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
}

.py-6 {
    padding-top: var(--space-6);
    padding-bottom: var(--space-6);
}

/* --- Text Alignment --- */
.text-left {
    text-align: left;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* --- Font Weights --- */
.font-normal {
    font-weight: var(--weight-normal);
}

.font-medium {
    font-weight: var(--weight-medium);
}

.font-semibold {
    font-weight: var(--weight-semibold);
}

.font-bold {
    font-weight: var(--weight-bold);
}

/* --- Legacy Compatibility --- */
.center {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}


/* ============================================================================
   10. RESPONSIVE BREAKPOINTS
   ============================================================================ */

/* --- Mobile Navigation Styles --- */

/* Hamburger Menu Button */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1002;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--color-white);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.hamburger[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.hamburger[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Navigation Panel */
.mobile-nav-panel {
    position: fixed;
    top: 72px;
    right: -100%;
    width: 280px;
    max-width: 85vw;
    height: calc(100vh - 72px);
    background-color: var(--color-grey-900);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    overflow-y: auto;
    transition: right var(--transition-slow);
    padding: var(--space-6) 0;
}

.mobile-nav-panel.is-open {
    right: 0;
}

.mobile-nav-panel a,
.mobile-nav-panel button {
    display: block;
    width: 100%;
    padding: var(--space-4) var(--space-6);
    color: var(--color-white);
    text-decoration: none;
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    min-height: 48px;
    /* Touch target */
    transition: background-color var(--transition-fast);
}

.mobile-nav-panel a:hover,
.mobile-nav-panel a:focus,
.mobile-nav-panel button:hover,
.mobile-nav-panel button:focus {
    background-color: var(--color-grey-800);
}

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

.mobile-nav-divider {
    height: 1px;
    background-color: var(--color-grey-700);
    margin: var(--space-4) var(--space-6);
}

/* Mobile Menu Overlay */
.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    top: 72px;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.mobile-nav-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* --- Mobile Breakpoint (< 768px) --- */

@media (max-width: 768px) {
    :root {
        --text-base: 1rem;
        --text-3xl: 1.875rem;
        --text-2xl: 1.5rem;
    }

    /* Show hamburger, hide desktop nav */
    .hamburger {
        display: flex;
    }

    .nav-links,
    .desktop-nav {
        display: none;
    }

    /* Typography scaling */
    h1 {
        font-size: var(--text-2xl);
    }

    h2 {
        font-size: var(--text-xl);
    }

    /* Shell padding */
    .shell {
        padding: 0 var(--space-4);
    }

    /* Hide TOC on mobile */
    .toc {
        display: none;
    }

    /* Full-width components */
    .callout,
    .definition,
    .example,
    .collapsible,
    .form-group {
        max-width: 100%;
    }

    /* Stack grids vertically */
    .grid,
    .card-grid,
    .feature-grid {
        grid-template-columns: 1fr !important;
        gap: var(--space-4);
    }

    /* Full-width cards */
    .card {
        width: 100%;
    }

    /* Touch-friendly buttons */
    .btn {
        min-height: 48px;
        padding: var(--space-4) var(--space-5);
    }

    /* Full-width form inputs */
    .form-input,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
        /* Prevents iOS zoom */
    }

    /* Single column footer */
    footer .shell {
        grid-template-columns: 1fr !important;
        text-align: center;
        gap: var(--space-8);
    }

    footer h4 {
        margin-top: var(--space-4);
    }

    /* Stack hero content */
    .hero {
        padding: var(--space-10) var(--space-4);
        text-align: center;
    }

    .hero h1 {
        font-size: var(--text-2xl);
    }

    /* Progress bar adjustments */
    .progress-bar {
        height: 6px;
    }
}

/* --- Small Phones (< 480px) --- */

@media (max-width: 480px) {
    :root {
        --text-3xl: 1.5rem;
        --text-2xl: 1.25rem;
        --text-xl: 1.125rem;
    }

    .shell {
        padding: 0 var(--space-3);
    }

    /* Tighter callout padding */
    .callout {
        padding: var(--space-4);
    }

    /* Smaller header logo */
    .brand {
        font-size: 1.25rem !important;
    }
}

/* --- Tablet (769px - 1023px) --- */

@media (min-width: 769px) and (max-width: 1023px) {
    .article-layout {
        grid-template-columns: 1fr;
    }

    .toc {
        position: static;
        margin-bottom: var(--space-6);
        padding: var(--space-4);
        background-color: var(--color-bg-muted);
        border-radius: var(--radius-md);
    }

    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Desktop (> 1024px) --- */

@media (min-width: 1024px) {
    .hamburger {
        display: none;
    }

    .mobile-nav-panel,
    .mobile-nav-overlay {
        display: none;
    }
}


/* ============================================================================
   11. ACCESSIBILITY
   ============================================================================ */

/* --- Skip Link --- */

.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    padding: var(--space-3) var(--space-5);
    background-color: var(--color-accent-primary);
    color: var(--color-text-inverse);
    font-weight: var(--weight-semibold);
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: 1000;
    transition: top var(--transition-fast);
}

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

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

/* --- Focus Visible (Enhanced) --- */

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

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


/* ============================================================================
   12. DARK MODE
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg-page: #0f0f0f;
        --color-bg-surface: #1a1a1a;
        --color-bg-muted: #252525;
        --color-bg-code: #1f1f1f;

        --color-text-primary: #e5e5e5;
        --color-text-secondary: #a0a0a0;
        --color-text-tertiary: #707070;

        --color-border: #333;
        --color-border-strong: #444;

        --header-bg: #0a0a0a;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    /* Callout adjustments for dark mode */
    .callout-note {
        background-color: rgba(37, 99, 235, 0.1);
    }

    .callout-tip {
        background-color: rgba(5, 150, 105, 0.1);
    }

    .callout-warning {
        background-color: rgba(217, 119, 6, 0.1);
    }

    .callout-caution {
        background-color: rgba(220, 38, 38, 0.1);
    }

    mark {
        background-color: rgba(217, 119, 6, 0.3);
    }
}

/* Manual dark mode toggle class */
body.dark-mode {
    --color-bg-page: #0f0f0f;
    --color-bg-surface: #1a1a1a;
    --color-bg-muted: #252525;
    --color-bg-code: #1f1f1f;

    --color-text-primary: #e5e5e5;
    --color-text-secondary: #a0a0a0;
    --color-text-tertiary: #707070;

    --color-border: #333;
    --color-border-strong: #444;

    --header-bg: #0a0a0a;
}

body.dark-mode .callout-note {
    background-color: rgba(37, 99, 235, 0.1);
}

body.dark-mode .callout-tip {
    background-color: rgba(5, 150, 105, 0.1);
}

body.dark-mode .callout-warning {
    background-color: rgba(217, 119, 6, 0.1);
}

body.dark-mode .callout-caution {
    background-color: rgba(220, 38, 38, 0.1);
}

body.dark-mode mark {
    background-color: rgba(217, 119, 6, 0.3);
}


/* ============================================================================
   13. LOADING SKELETONS
   ============================================================================ */

@keyframes skeleton-pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            var(--color-grey-200) 0%,
            var(--color-grey-100) 50%,
            var(--color-grey-200) 100%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-text.medium {
    width: 70%;
}

.skeleton-text.long {
    width: 100%;
}

.skeleton-card {
    height: 200px;
    border-radius: var(--radius-lg);
}

.skeleton-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
}

.skeleton-stat {
    height: 3rem;
    width: 60px;
}

/* Dark mode skeletons */
body.dark-mode .skeleton {
    background: linear-gradient(90deg,
            var(--color-grey-800) 0%,
            var(--color-grey-700) 50%,
            var(--color-grey-800) 100%);
    background-size: 200% 100%;
}


/* ============================================================================
   14. SEARCH COMPONENT
   ============================================================================ */

.search-container {
    position: relative;
    max-width: 300px;
}

.search-input {
    width: 100%;
    padding: var(--space-2) var(--space-4);
    padding-right: 2.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: white;
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-kbd {
    position: absolute;
    right: var(--space-2);
    top: 50%;
    transform: translateY(-50%);
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    font-family: var(--font-ui);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    pointer-events: none;
}

.search-results {
    position: absolute;
    top: calc(100% + var(--space-2));
    left: 0;
    right: 0;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1002;
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: block;
    padding: var(--space-3) var(--space-4);
    color: var(--color-text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-fast);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item:focus {
    background: var(--color-bg-muted);
}

.search-result-item .title {
    font-weight: var(--weight-semibold);
    margin-bottom: 2px;
}

.search-result-item .description {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.search-no-results {
    padding: var(--space-4);
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: var(--text-sm);
}


/* ============================================================================
   15. BREADCRUMB NAVIGATION
   ============================================================================ */

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-6);
}

.breadcrumbs a {
    color: var(--color-accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs-separator::after {
    content: "/";
    color: var(--color-grey-400);
    margin: 0 var(--space-1);
}

.breadcrumbs-current {
    color: var(--color-text-primary);
    font-weight: var(--weight-medium);
}


/* ============================================================================
   16. PROGRESS SAVE INDICATOR (TOAST)
   ============================================================================ */

.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
}

.toast {
    background: var(--color-grey-900);
    color: var(--color-white);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-family: var(--font-ui);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.3s ease-out;
    pointer-events: auto;
}

.toast.success {
    background: var(--color-success);
}

.toast.error {
    background: var(--color-error);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

.toast.hiding {
    animation: toast-out 0.3s ease-in forwards;
}

body.dark-mode .toast {
    background: var(--color-grey-100);
    color: var(--color-grey-900);
}


/* ============================================================================
   17. KEYBOARD SHORTCUTS HINT
   ============================================================================ */

kbd {
    display: inline-block;
    padding: 2px 6px;
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    background: var(--color-bg-muted);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    box-shadow: 0 1px 0 var(--color-grey-300);
}


/* ============================================================================
   18. PAGE TRANSITIONS
   ============================================================================ */

/* Modern View Transitions API */
@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.2s;
}

::view-transition-old(root) {
    animation: fade-out 0.2s ease-out forwards;
}

::view-transition-new(root) {
    animation: fade-in 0.2s ease-in;
}

@keyframes fade-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Fallback for browsers without view transitions */
.page-transition-enter {
    opacity: 0;
    animation: fade-in 0.2s ease-in forwards;
}


/* ============================================================================
   19. LAZY LOADING PLACEHOLDER
   ============================================================================ */

img[loading="lazy"] {
    background: var(--color-grey-100);
}

img[loading="lazy"].loaded {
    background: transparent;
}


/* ============================================================================
   20. MODERN ANIMATIONS & POLISH
   ============================================================================ */

/* Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-5px);
    }

    100% {
        transform: translateY(0px);
    }
}

@keyframes pulse-subtle {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

/* Utility Classes for Animations */
.animate-enter {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.hover-scale {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: scale(1.02);
}

/* Gradient Text */
.text-gradient {
    background: linear-gradient(135deg, var(--color-grey-900) 0%, var(--color-grey-600) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.dark-mode .text-gradient {
    background: linear-gradient(135deg, var(--color-white) 0%, var(--color-grey-400) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Apply to common elements */
button,
.btn {
    transition: all 0.2s ease;
}

button:active,
.btn:active {
    transform: scale(0.96);
}

.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}