/* =========================================================
   EMIFORMULA
   GLOBAL WEBSITE DESIGN SYSTEM
   STEP 1.2 — COMPLETE
   ========================================================= */

/* =========================================================
   1. DESIGN TOKENS
   ========================================================= */

:root {

    /* ---------- Brand ---------- */

    --brand-primary: #2563eb;
    --brand-primary-dark: #1d4ed8;
    --brand-primary-light: #eff6ff;


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

    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --text-disabled: #9ca3af;
    --text-on-brand: #ffffff;


    /* ---------- Background ---------- */

    --background: #ffffff;
    --surface: #f8fafc;
    --surface-alt: #f1f5f9;
    --surface-hover: #f3f4f6;


    /* ---------- Borders ---------- */

    --border: #e5e7eb;
    --border-strong: #d1d5db;


    /* ---------- Status ---------- */

    --success: #15803d;
    --success-bg: #f0fdf4;

    --warning: #b45309;
    --warning-bg: #fffbeb;

    --danger: #dc2626;
    --danger-bg: #fef2f2;

    --info: #0369a1;
    --info-bg: #f0f9ff;


    /* ---------- Layout ---------- */

    --container-max: 1200px;
    --content-max: 900px;
    --reading-max: 760px;


    /* ---------- Spacing ---------- */

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;


    /* ---------- Radius ---------- */

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --radius-full: 999px;


    /* ---------- Shadows ---------- */

    --shadow-sm:
        0 1px 3px rgba(0, 0, 0, 0.08);

    --shadow-md:
        0 4px 12px rgba(0, 0, 0, 0.10);

    --shadow-lg:
        0 10px 30px rgba(0, 0, 0, 0.12);


    /* ---------- Typography ---------- */

    --font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    --font-size-4xl: 2.5rem;

    --line-height-tight: 1.2;
    --line-height-normal: 1.6;
    --line-height-relaxed: 1.75;


    /* ---------- Motion ---------- */

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}


/* =========================================================
   2. GLOBAL RESET
   ========================================================= */

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

html {
    margin: 0;
    padding: 0;

    font-size: 16px;

    scroll-behavior: smooth;

    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;

    min-width: 320px;

    background: var(--background);
    color: var(--text-primary);

    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);

    text-rendering: optimizeLegibility;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* =========================================================
   3. MEDIA ELEMENTS
   ========================================================= */

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

img {
    height: auto;
}


/* =========================================================
   4. LINKS
   ========================================================= */

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

a:hover {
    text-decoration: none;
}


/* =========================================================
   5. FORM NORMALIZATION
   ========================================================= */

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

button {
    cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}


/* =========================================================
   6. TYPOGRAPHY
   ========================================================= */

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    margin-bottom: var(--space-4);

    color: var(--text-primary);

    line-height: var(--line-height-tight);

    font-weight: 700;
}

h1 {
    font-size: var(--font-size-4xl);
}

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

h3 {
    font-size: var(--font-size-2xl);
}

h4 {
    font-size: var(--font-size-xl);
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-base);
}

p {
    margin-top: 0;
    margin-bottom: var(--space-4);
}

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

strong {
    font-weight: 700;
}


/* =========================================================
   7. CONTAINERS
   ========================================================= */

.container {
    width: min(
        calc(100% - 2rem),
        var(--container-max)
    );

    margin-inline: auto;
}

.content-container {
    width: min(
        calc(100% - 2rem),
        var(--content-max)
    );

    margin-inline: auto;
}

.reading-container {
    width: min(
        calc(100% - 2rem),
        var(--reading-max)
    );

    margin-inline: auto;
}


/* =========================================================
   8. SECTIONS
   ========================================================= */

.section {
    padding-block: var(--space-12);
}

.section-sm {
    padding-block: var(--space-8);
}

.section-lg {
    padding-block: var(--space-16);
}


/* =========================================================
   9. CARDS / SURFACES
   ========================================================= */

.card {
    background: var(--background);

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-sm);
}

.card-hover {
    transition:
        transform var(--transition-normal),
        box-shadow var(--transition-normal),
        border-color var(--transition-normal);
}

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

.surface {
    background: var(--surface);
}

.surface-alt {
    background: var(--surface-alt);
}


/* =========================================================
   10. BUTTONS
   ========================================================= */

.button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: var(--space-2);

    min-height: 44px;

    padding:
        0.65rem
        1rem;

    border: 1px solid transparent;
    border-radius: var(--radius-md);

    background: var(--brand-primary);
    color: var(--text-on-brand);

    font-size: var(--font-size-base);
    font-weight: 600;

    line-height: 1.2;

    transition:
        background-color var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast),
        box-shadow var(--transition-fast);
}

.button:hover {
    background: var(--brand-primary-dark);
}

.button:active {
    transform: translateY(1px);
}

.button-secondary {
    background: var(--background);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.button-secondary:hover {
    background: var(--surface);
}

.button-block {
    width: 100%;
}


/* =========================================================
   11. FORM CONTROLS
   ========================================================= */

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

label {
    display: block;

    margin-bottom: var(--space-2);

    color: var(--text-primary);

    font-size: var(--font-size-sm);
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;

    min-height: 44px;

    padding:
        0.65rem
        0.75rem;

    border:
        1px solid
        var(--border-strong);

    border-radius: var(--radius-md);

    background: var(--background);
    color: var(--text-primary);

    outline: none;

    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast);
}

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

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand-primary);

    box-shadow:
        0 0 0 3px
        rgba(37, 99, 235, 0.12);
}


/* =========================================================
   12. GRID
   ========================================================= */

.grid {
    display: grid;
}

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

.grid-3 {
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
}


/* =========================================================
   13. FLEX
   ========================================================= */

.flex {
    display: flex;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.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-end {
    justify-content: flex-end;
}


/* =========================================================
   14. GAP
   ========================================================= */

.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-5 {
    gap: var(--space-5);
}

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

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


/* =========================================================
   15. WIDTH
   ========================================================= */

.w-full {
    width: 100%;
}

.max-content {
    width: min(
        100%,
        var(--content-max)
    );
}


/* =========================================================
   16. TEXT UTILITIES
   ========================================================= */

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

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

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

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

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

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}


/* =========================================================
   17. SPACING UTILITIES
   ========================================================= */

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

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


/* =========================================================
   18. VISIBILITY
   ========================================================= */

.hidden {
    display: none !important;
}


/* =========================================================
   19. ACCESSIBILITY
   ========================================================= */

:focus-visible {
    outline:
        3px solid
        rgba(37, 99, 235, 0.35);

    outline-offset: 2px;
}


/* =========================================================
   20. RESPONSIVE SYSTEM
   ========================================================= */

@media (max-width: 900px) {

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

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


@media (max-width: 768px) {

    :root {
        --font-size-4xl: 2rem;
        --font-size-3xl: 1.6rem;
        --font-size-2xl: 1.3rem;
    }

    .container,
    .content-container,
    .reading-container {
        width: min(
            calc(100% - 1.25rem),
            var(--container-max)
        );
    }

    .section {
        padding-block: var(--space-8);
    }
}


@media (max-width: 600px) {

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .flex-mobile-column {
        flex-direction: column;
    }

    h1 {
        font-size: 1.9rem;
    }

    h2 {
        font-size: 1.55rem;
    }
}


@media (max-width: 480px) {

    .container,
    .content-container,
    .reading-container {
        width: min(
            calc(100% - 1rem),
            var(--container-max)
        );
    }

    .section {
        padding-block: var(--space-6);
    }

    .button {
        min-height: 46px;
    }
}


/* =========================================================
   21. REDUCED MOTION
   ========================================================= */

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