/* =========================================================
   DOZNI — Global Design System
   File: /assets/css/global.css
   ========================================================= */

/* -------------------------
   1. Design Tokens
   ------------------------- */

:root {
    color-scheme: light;

    --color-bg: #ffffff;
    --color-bg-soft: #f8faff;
    --color-bg-muted: #f1f5f9;

    --color-surface: #ffffff;
    --color-surface-hover: #f8faff;

    --color-text: #111827;
    --color-text-soft: #475569;
    --color-text-muted: #64748b;
    --color-text-inverse: #ffffff;

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

    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-soft: #eff6ff;

    --color-focus: #3b82f6;

    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --color-info: #2563eb;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.12);

    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-pill: 999px;

    --container-width: 1180px;
    --container-wide: 1320px;

    --header-height: 68px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;
    --space-9: 48px;
    --space-10: 64px;
    --space-11: 80px;
    --space-12: 96px;

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

    --font-mono:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Monaco,
        Consolas,
        "Liberation Mono",
        monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.75rem;
    --text-5xl: 3.5rem;
    --text-6xl: 4.25rem;

    --line-tight: 1.1;
    --line-snug: 1.25;
    --line-normal: 1.6;
    --line-relaxed: 1.75;

    --transition-fast: 120ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 320ms ease;
}


/* -------------------------
   2. Dark Theme
   ------------------------- */

[data-theme="dark"] {
    color-scheme: dark;

    --color-bg: #0d0d0f;
    --color-bg-soft: #151518;
    --color-bg-muted: #1b1b1f;

    --color-surface: #151518;
    --color-surface-hover: #1b1b1f;

    --color-text: #f5f5f6;
    --color-text-soft: #c4c4ca;
    --color-text-muted: #92929b;
    --color-text-inverse: #111113;

    --color-border: #29292e;
    --color-border-strong: #39393f;

    --color-primary: #f5f5f6;
    --color-primary-hover: #ffffff;
    --color-primary-soft: #252529;

    --color-focus: #818cf8;

    --color-success: #4ade80;
    --color-warning: #fbbf24;
    --color-danger: #f87171;
    --color-info: #60a5fa;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);
}


/* -------------------------
   3. System Dark Mode
   ------------------------- */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --color-bg: #0d0d0f;
        --color-bg-soft: #151518;
        --color-bg-muted: #1b1b1f;

        --color-surface: #151518;
        --color-surface-hover: #1b1b1f;

        --color-text: #f5f5f6;
        --color-text-soft: #c4c4ca;
        --color-text-muted: #92929b;
        --color-text-inverse: #111113;

        --color-border: #29292e;
        --color-border-strong: #39393f;

        --color-primary: #f5f5f6;
        --color-primary-hover: #ffffff;
        --color-primary-soft: #252529;
    }
}


/* -------------------------
   4. Reset
   ------------------------- */

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

html {
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 20px);
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;

    min-width: 320px;

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

    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: 400;
    line-height: var(--line-normal);

    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    transition:
        background-color var(--transition-normal),
        color var(--transition-normal);
}

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

img {
    height: auto;
}

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

button {
    cursor: pointer;
}

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

textarea {
    resize: vertical;
}

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

a:hover {
    text-decoration: none;
}

ul,
ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

p,
h1,
h2,
h3,
h4,
h5,
h6,
figure,
blockquote {
    margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: var(--line-tight);
    letter-spacing: -0.025em;
}

p {
    color: var(--color-text-soft);
}

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


/* -------------------------
   5. Accessibility
   ------------------------- */

:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 3px;
}

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

.skip-link {
    position: fixed;
    z-index: 9999;

    top: 12px;
    left: 12px;

    padding: 10px 16px;

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

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

    transform: translateY(-150%);
    transition: transform var(--transition-fast);
}

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


/* -------------------------
   6. Layout
   ------------------------- */

.container {
    width: min(
        calc(100% - 40px),
        var(--container-width)
    );

    margin-inline: auto;
}

.container-wide {
    width: min(
        calc(100% - 40px),
        var(--container-wide)
    );

    margin-inline: auto;
}

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

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

.section-lg {
    padding-block: 120px;
}

.section-muted {
    background: var(--color-bg-soft);
}


/* -------------------------
   7. Typography
   ------------------------- */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.text-balance {
    text-wrap: balance;
}

.text-pretty {
    text-wrap: pretty;
}


/* -------------------------
   8. Page Heading
   ------------------------- */

.page-header {
    padding-block: var(--space-12) var(--space-9);
}

.page-header h1 {
    max-width: 850px;

    font-size: clamp(
        2.5rem,
        6vw,
        4.25rem
    );

    letter-spacing: -0.045em;
}

.page-header p {
    max-width: 720px;
    margin-top: var(--space-5);

    font-size: var(--text-lg);
}


/* -------------------------
   9. Section Heading
   ------------------------- */

.section-heading {
    max-width: 720px;
    margin-bottom: var(--space-8);
}

.section-heading > span {
    display: inline-block;

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

    color: var(--color-text-muted);

    font-size: var(--text-sm);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.section-heading h2 {
    font-size: clamp(
        2rem,
        4vw,
        3rem
    );
}

.section-heading p {
    margin-top: var(--space-4);
    font-size: var(--text-lg);
}


/* -------------------------
   10. Links
   ------------------------- */

.link {
    color: var(--color-text);
    font-weight: 600;

    text-decoration: underline;
    text-decoration-color: var(--color-border-strong);
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;

    transition:
        color var(--transition-fast),
        text-decoration-color var(--transition-fast);
}

.link:hover {
    text-decoration-color: currentColor;
}


/* -------------------------
   11. Buttons
   ------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 46px;
    padding: 10px 18px;

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

    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1;

    white-space: nowrap;

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

.btn:hover {
    transform: translateY(-1px);
}

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

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

.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--color-text);

    border-color: var(--color-border-strong);
}

.btn-secondary:hover {
    background: var(--color-bg-soft);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-soft);
}

.btn-ghost:hover {
    background: var(--color-bg-soft);
    color: var(--color-text);
}

.btn-sm {
    min-height: 38px;
    padding: 8px 14px;
}

.btn-lg {
    min-height: 52px;
    padding: 12px 22px;
    font-size: var(--text-base);
}


/* -------------------------
   12. Cards
   ------------------------- */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);

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

.card:hover {
    border-color: var(--color-border-strong);
    box-shadow: var(--shadow-sm);
}

.card-body {
    padding: var(--space-7);
}


/* -------------------------
   13. Grid Utilities
   ------------------------- */

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

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

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


/* -------------------------
   14. Flex Utilities
   ------------------------- */

.flex {
    display: flex;
}

.flex-column {
    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;
}


/* -------------------------
   15. Visibility
   ------------------------- */

.hidden {
    display: none !important;
}

.invisible {
    visibility: hidden;
}


/* -------------------------
   16. Form Foundation
   ------------------------- */

.input,
.select,
.textarea {
    width: 100%;

    min-height: 46px;
    padding: 10px 14px;

    background: var(--color-bg);

    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);

    color: var(--color-text);

    outline: none;

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

.textarea {
    min-height: 120px;
}

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

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

    box-shadow:
        0 0 0 3px
        color-mix(
            in srgb,
            var(--color-focus) 15%,
            transparent
        );
}


/* -------------------------
   17. Badges
   ------------------------- */

.badge {
    display: inline-flex;
    align-items: center;

    min-height: 28px;
    padding: 5px 10px;

    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);

    background: var(--color-bg-soft);

    color: var(--color-text-soft);

    font-size: var(--text-xs);
    font-weight: 700;
}


/* -------------------------
   18. Dividers
   ------------------------- */

.divider {
    width: 100%;
    height: 1px;

    background: var(--color-border);
}


/* -------------------------
   19. Code
   ------------------------- */

code,
kbd,
pre,
samp {
    font-family: var(--font-mono);
}

code {
    padding: 2px 6px;

    background: var(--color-bg-soft);
    border: 1px solid var(--color-border);

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

    font-size: 0.9em;
}

pre {
    overflow-x: auto;

    padding: var(--space-6);

    background: var(--color-bg-soft);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);

    line-height: 1.6;
}


/* -------------------------
   20. Status Colors
   ------------------------- */

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

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

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

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


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


/* -------------------------
   22. Mobile Base
   ------------------------- */

@media (max-width: 767px) {

    :root {
        --header-height: 60px;

        --space-10: 48px;
        --space-11: 60px;
        --space-12: 72px;
    }

    .container,
    .container-wide {
        width: min(
            calc(100% - 32px),
            var(--container-width)
        );
    }

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

    .section-lg {
        padding-block: 80px;
    }

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

    .card-body {
        padding: var(--space-6);
    }

    .btn {
        min-height: 44px;
    }
}


/* -------------------------
   23. Small Phones
   ------------------------- */

@media (max-width: 420px) {

    .container,
    .container-wide {
        width: min(
            calc(100% - 24px),
            var(--container-width)
        );
    }

    .btn {
        width: 100%;
    }
}
