/* Dexapp Studio design tokens.
   Two inputs drive every colour: the mode (<html data-theme="light|dark">) and the accent
   (--dx-accent, set by dex-theme.js together with the readable --dx-on-accent).
   Components must use these tokens only; no component carries its own fixed colours. */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    /* Inputs */
    --dx-accent: #1f4e8c;
    --dx-on-accent: #ffffff;

    /* Typography */
    --dx-font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --dx-text-xs: 12px;
    --dx-text-sm: 13px;
    --dx-text-md: 14px;
    --dx-text-lg: 16px;

    /* Shape */
    --dx-radius-sm: 8px;
    --dx-radius-md: 12px;
    --dx-radius-lg: 18px;
    --dx-radius-xl: 28px;
    --dx-ease: cubic-bezier(.2, .7, .2, 1);

    /* Light mode surfaces */
    --dx-bg: #f4f7fb;
    --dx-surface: #ffffff;
    --dx-surface-2: #edf2f8;
    --dx-text: #0b1626;
    --dx-muted: #546579;
    --dx-line: #dae3ee;
    --dx-shadow: 0 24px 60px -24px rgba(20, 40, 80, .25);
    --dx-shadow-sm: 0 8px 24px -12px rgba(20, 40, 80, .22);
    --dx-danger: #c8314a;
    --dx-success: #13875a;
    --dx-info: #2463c7;
    --dx-warning: #b7791f;
    --dx-grid-strength: 7%;

    /* Accent family, derived from the accent */
    --dx-accent-2: color-mix(in srgb, var(--dx-accent) 55%, #7c5cff);
    --dx-accent-strong: color-mix(in srgb, var(--dx-accent) 82%, #000);
    --dx-accent-text: color-mix(in srgb, var(--dx-accent) 80%, var(--dx-text));
    --dx-accent-soft: color-mix(in srgb, var(--dx-accent) 12%, var(--dx-surface));
    --dx-accent-line: color-mix(in srgb, var(--dx-accent) 36%, var(--dx-line));
    --dx-accent-gradient: linear-gradient(120deg, var(--dx-accent), var(--dx-accent-2));
    --dx-focus-ring: 0 0 0 3px color-mix(in srgb, var(--dx-accent) 24%, transparent);


    /* Logo ("Dengeli", shared with the web site): a seven-step ramp of --dx-logo-base, dark
       bottom-left (k0) to light top-left (k6). The base is the accent with its OKLCH lightness held
       inside a per-mode band (--dx-logo-l-min/max) and its chroma capped, so a deep accent (Kurumsal,
       Mürdüm) does not sink into dark surfaces and a vivid one (Mandalina, Fuşya) does not glare.
       Browsers without relative colour syntax use the plain accent. */
    /* Printer inks (consumable colour dots): data colours, the same in both themes. */
    --dx-ink-k: #262b33;
    --dx-ink-c: #00a0d6;
    --dx-ink-m: #d81b7a;
    --dx-ink-y: #f1c40f;

    --dx-logo-l-min: 0.46;
    --dx-logo-l-max: 0.6;
    --dx-logo-c-max: 0.23;
    --dx-logo-base: var(--dx-accent);
    --dx-logo-k0: color-mix(in oklab, var(--dx-logo-base) 88%, #000);
    --dx-logo-k1: color-mix(in oklab, var(--dx-logo-base) 94%, #000);
    --dx-logo-k2: var(--dx-logo-base);
    --dx-logo-k3: color-mix(in oklab, var(--dx-logo-base) 92%, #fff);
    --dx-logo-k4: color-mix(in oklab, var(--dx-logo-base) 84%, #fff);
    --dx-logo-k5: color-mix(in oklab, var(--dx-logo-base) 76%, #fff);
    --dx-logo-k6: color-mix(in oklab, var(--dx-logo-base) 68%, #fff);

    color-scheme: light;
}

/* Dark mode: explicit choice, or system preference before dex-theme.js runs. */
:root[data-theme="dark"] {
    --dx-bg: #060b14;
    --dx-surface: #0c1422;
    --dx-surface-2: #111b2d;
    --dx-text: #eaf0fa;
    --dx-muted: #8a9bb4;
    --dx-line: #1b2940;
    --dx-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
    --dx-shadow-sm: 0 10px 28px -14px rgba(0, 0, 0, .7);
    --dx-danger: #f0677d;
    --dx-success: #3fcf8e;
    --dx-info: #6ea8ff;
    --dx-warning: #f2b14c;
    --dx-grid-strength: 6%;
    --dx-accent-text: color-mix(in srgb, var(--dx-accent) 70%, #fff);
    --dx-accent-soft: color-mix(in srgb, var(--dx-accent) 16%, var(--dx-surface));
    --dx-logo-l-min: 0.6;
    --dx-logo-l-max: 0.7;
    --dx-logo-c-max: 0.21;
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --dx-bg: #060b14;
        --dx-surface: #0c1422;
        --dx-surface-2: #111b2d;
        --dx-text: #eaf0fa;
        --dx-muted: #8a9bb4;
        --dx-line: #1b2940;
        --dx-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
        --dx-shadow-sm: 0 10px 28px -14px rgba(0, 0, 0, .7);
        --dx-danger: #f0677d;
        --dx-success: #3fcf8e;
        --dx-info: #6ea8ff;
        --dx-warning: #f2b14c;
        --dx-grid-strength: 6%;
        --dx-accent-text: color-mix(in srgb, var(--dx-accent) 70%, #fff);
        --dx-accent-soft: color-mix(in srgb, var(--dx-accent) 16%, var(--dx-surface));
        --dx-logo-l-min: 0.6;
        --dx-logo-l-max: 0.7;
        --dx-logo-c-max: 0.21;
        color-scheme: dark;
    }
}

@supports (color: oklch(from red l c h)) {
    :root {
        --dx-logo-base: oklch(from var(--dx-accent) clamp(var(--dx-logo-l-min), l, var(--dx-logo-l-max)) min(c, var(--dx-logo-c-max)) h);
    }
}

/* ---- Shared primitives ---- */

.dx-logo {
    display: block;
    aspect-ratio: 1033 / 1052;
    height: auto;
    overflow: visible;
}

.dx-icon-button {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--dx-line);
    border-radius: var(--dx-radius-md);
    background: var(--dx-surface);
    color: var(--dx-text);
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s, transform .2s var(--dx-ease);
}

.dx-icon-button:hover {
    border-color: var(--dx-accent-line);
    color: var(--dx-accent-text);
}

.dx-icon-button:focus-visible {
    outline: 0;
    box-shadow: var(--dx-focus-ring);
    border-color: var(--dx-accent);
}

.dx-icon-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Light/dark toggle: show the icon of the mode you would switch to. */
.dx-mode-toggle__sun { display: none; }
:root[data-theme="dark"] .dx-mode-toggle__sun { display: block; }
:root[data-theme="dark"] .dx-mode-toggle__moon { display: none; }

.dx-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: var(--dx-radius-md);
    font: 600 var(--dx-text-md)/1 var(--dx-font);
    text-decoration: none;
    cursor: pointer;
    transition: transform .2s var(--dx-ease), box-shadow .2s, opacity .2s, background .2s, border-color .2s;
}

.dx-button--block { width: 100%; }

.dx-button--primary {
    background: var(--dx-accent-gradient);
    color: var(--dx-on-accent);
    box-shadow: 0 12px 28px -12px var(--dx-accent);
}

.dx-button--primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px -12px var(--dx-accent);
}

.dx-button--secondary {
    background: var(--dx-surface);
    border-color: var(--dx-line);
    color: var(--dx-text);
}

.dx-button--secondary:hover:not(:disabled) {
    border-color: var(--dx-accent-line);
    color: var(--dx-accent-text);
}

.dx-button:focus-visible {
    outline: 0;
    box-shadow: var(--dx-focus-ring);
}

.dx-button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.dx-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--dx-accent-text);
    font: 600 var(--dx-text-sm) var(--dx-font);
    text-decoration: none;
    cursor: pointer;
}

.dx-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.dx-link:focus-visible { outline: 0; border-radius: 4px; box-shadow: var(--dx-focus-ring); }

.dx-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--dx-muted);
    font-size: var(--dx-text-sm);
    cursor: pointer;
    user-select: none;
}

.dx-check input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--dx-accent);
}

/* Theme colour picker */
.dx-accent-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 14px 8px;
    border: 1px solid var(--dx-accent-line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--dx-surface) 74%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--dx-shadow-sm), 0 0 40px -18px var(--dx-accent);
}

.dx-accent-picker__icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: var(--dx-accent-text);
}

.dx-accent-picker__icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dx-accent-picker__swatch,
.dx-accent-picker__custom {
    position: relative;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 2px solid var(--dx-surface);
    border-radius: 50%;
    background: var(--swatch);
    box-shadow: 0 0 0 1px var(--dx-line);
    cursor: pointer;
    transition: transform .15s var(--dx-ease), box-shadow .15s;
}

.dx-accent-picker__custom {
    background: conic-gradient(#f43f5e, #f59e0b, #22c55e, #06b6d4, #6366f1, #d946ef, #f43f5e);
}

.dx-accent-picker__custom input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
}

.dx-accent-picker__swatch:hover,
.dx-accent-picker__custom:hover { transform: scale(1.15); }

.dx-accent-picker__swatch[aria-pressed="true"],
.dx-accent-picker__custom[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--dx-text); }

.dx-accent-picker__swatch:focus-visible,
.dx-accent-picker__custom:focus-within { outline: 0; box-shadow: 0 0 0 2px var(--dx-text), var(--dx-focus-ring); }

/* Name tooltip (pointer devices) */
@media (hover: hover) {
    .dx-accent-picker__swatch::after,
    .dx-accent-picker__custom::after {
        content: attr(data-name);
        position: absolute;
        left: 34px;
        top: 50%;
        transform: translateY(-50%);
        padding: 4px 10px;
        border: 1px solid var(--dx-line);
        border-radius: var(--dx-radius-sm);
        background: var(--dx-surface);
        color: var(--dx-text);
        font: 600 var(--dx-text-xs) var(--dx-font);
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity .15s;
    }

    .dx-accent-picker__swatch:hover::after,
    .dx-accent-picker__custom:hover::after { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
