/* TuMents design tokens: the single source of truth for colour, type, shape, spacing, depth and motion.
   Spec and Flutter mapping: docs/style-guide.md. Raw colour values belong in this file only. */
@font-face { font-family: "Pretendard Brand"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/pretendard-std-variable.woff2") format("woff2"); }

@font-face { font-family: "Big Shoulders"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/big-shoulders-latin.woff2") format("woff2"); }

:root {
    color-scheme: light;

    /* Colour: surfaces and text */
    --tm-bg: #ecedef;
    --tm-surface: #ffffff;
    --tm-surface-2: #e0e2e6;
    --tm-surface-3: #d5d8dc;
    --tm-ink: #1d1e20;
    --tm-ink-2: #5c6168;
    --tm-ink-3: #5c6168;
    --tm-line: #d5d8dc;
    --tm-line-strong: #a9aeb5;

    /* Colour: brand and accent */
    --tm-primary: #1d1e20;
    --tm-primary-hover: #36383c;
    --tm-on-primary: #ffffff;
    --tm-primary-soft: #e0e2e6;
    --tm-on-primary-soft: #1d1e20;
    --tm-accent: #d7261e;
    --tm-accent-ink: #a3170f;
    --tm-accent-soft: #fce7e4;
    --tm-focus: #2350c2;

    --tm-red: #d7261e;
    --tm-red-soft: #fce7e4;
    --tm-blue: #2350c2;
    --tm-blue-soft: #e5ebfa;

    /* Colour: meaning */
    --tm-success: #1c7a4c;
    --tm-success-soft: #dcf1e4;
    --tm-warning: #8a5a00;
    --tm-warning-soft: #fbeecb;
    --tm-danger: #a3170f;
    --tm-on-danger: #ffffff;
    --tm-danger-soft: #fbe3e1;
    --tm-info: #1c5f8c;
    --tm-info-soft: #dfeef8;
    --tm-plum: #6d3f62;
    --tm-plum-soft: #f4e6ef;

    /* Colour: overlays */
    --tm-scrim: #1d1e2080;
    --tm-scrim-light: #1d1e201f;
    --tm-on-scrim: #ffffff;
    --tm-glass: color-mix(in srgb, var(--tm-surface) 86%, transparent);
    --tm-media-bg: #e0e2e6;
    --tm-ink-rgb: 29, 30, 32;
    --tm-primary-rgb: 29, 30, 32;

    /* Type */
    --tm-font: "Pretendard Brand", "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
    --tm-font-num: "Big Shoulders", "Arial Narrow", "Roboto Condensed", sans-serif;
    --tm-text-display: clamp(2.25rem, 6vw, 3.5rem);
    --tm-text-h1: clamp(1.5rem, 3.4vw, 1.75rem);
    --tm-text-h2: 1.375rem;
    --tm-text-h3: 1.125rem;
    --tm-text-body: 1rem;
    --tm-text-sm: .875rem;
    --tm-text-label: .8125rem;
    --tm-text-caption: .75rem;

    /* Shape */
    --tm-r-leaf: 6px;
    --tm-r-xs: 8px;
    --tm-r-sm: 12px;
    --tm-r-md: 16px;
    --tm-r-lg: 24px;
    --tm-r-full: 999px;

    /* Space: 4pt grid */
    --tm-s-1: 4px;
    --tm-s-2: 8px;
    --tm-s-3: 12px;
    --tm-s-4: 16px;
    --tm-s-5: 20px;
    --tm-s-6: 24px;
    --tm-s-8: 32px;
    --tm-s-10: 40px;
    --tm-s-14: 56px;

    /* Depth */
    --tm-leaf-shadow: 0 1px 0 var(--tm-line), 0 5px 0 -1px var(--tm-surface), 0 6px 0 -1px var(--tm-line), 0 10px 0 -2px var(--tm-surface), 0 11px 0 -2px var(--tm-line);
    --tm-stamp-ring: inset 0 0 0 3px var(--tm-surface), inset 0 0 0 4px var(--tm-red);
    --tm-e-1: 0 1px 2px #1d1e200f;
    --tm-e-2: 0 6px 20px #1d1e2014;
    --tm-e-3: 0 18px 48px #1d1e2024;

    /* Motion */
    --tm-ease: cubic-bezier(.2, .8, .2, 1);
    --tm-fast: 150ms;
    --tm-base: 250ms;

    /* Layout */
    --tm-page-max: 1120px;
    --tm-gutter: 1.5rem;
    --tm-touch: 44px;
    --tm-control-h: 48px;
    --tm-header-h: 64px;
    --tm-bottom-nav-h: 64px;
    --tm-z-header: 50;
    --tm-z-nav: 60;
    --tm-z-flyout: 100;
    --tm-z-alert: 1000;
    --tm-z-modal: 1100;

    /* Icons: used as CSS masks so they take the current text colour */
    --tm-icon-home: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10.5 12 4l8 6.5V19a1 1 0 0 1-1 1h-4.5v-5.5h-5V20H5a1 1 0 0 1-1-1z'/%3E%3C/svg%3E");
    --tm-icon-bell: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 10a5.5 5.5 0 0 1 11 0c0 4 1.5 5.5 1.5 5.5H5S6.5 14 6.5 10z'/%3E%3Cpath d='M10 18.5a2 2 0 0 0 4 0'/%3E%3C/svg%3E");
    --tm-icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --tm-icon-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='9' rx='2.5'/%3E%3Cpath d='M8.5 11V8a3.5 3.5 0 0 1 7 0v3'/%3E%3C/svg%3E");
    --tm-icon-sliders: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h10M18 7h2M4 17h2M10 17h10'/%3E%3Ccircle cx='16' cy='7' r='2'/%3E%3Ccircle cx='8' cy='17' r='2'/%3E%3C/svg%3E");
    --tm-check-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3E%3C/svg%3E");
    --tm-select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%235c6168' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");

    /* Bootstrap bridge: Bootstrap components read the same tokens */
    --bs-body-bg: var(--tm-bg);
    --bs-body-color: var(--tm-ink);
    --bs-body-color-rgb: var(--tm-ink-rgb);
    --bs-emphasis-color-rgb: var(--tm-ink-rgb);
    --bs-primary-rgb: var(--tm-primary-rgb);
    --bs-link-color-rgb: var(--tm-primary-rgb);
    --bs-body-font-family: var(--tm-font);
    --bs-emphasis-color: var(--tm-ink);
    --bs-secondary-color: var(--tm-ink-2);
    --bs-tertiary-color: var(--tm-ink-3);
    --bs-secondary-bg: var(--tm-surface-2);
    --bs-tertiary-bg: var(--tm-surface-2);
    --bs-border-color: var(--tm-line);
    --bs-border-color-translucent: var(--tm-line);
    --bs-primary: var(--tm-primary);
    --bs-link-color: var(--tm-primary);
    --bs-link-hover-color: var(--tm-primary-hover);
    --bs-heading-color: var(--tm-ink);
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --tm-bg: #141517;
        --tm-surface: #1f2124;
        --tm-surface-2: #2a2d31;
        --tm-surface-3: #35383e;
        --tm-ink: #f1f2f3;
        --tm-ink-2: #a9aeb5;
        --tm-ink-3: #969ba3;
        --tm-line: #3a3e44;
        --tm-line-strong: #555b62;
        --tm-primary: #f1f2f3;
        --tm-primary-hover: #ffffff;
        --tm-on-primary: #141517;
        --tm-primary-soft: #34383e;
        --tm-on-primary-soft: #f1f2f3;
        --tm-accent: #ff6b5e;
        --tm-accent-ink: #ff9a90;
        --tm-accent-soft: #3d1d1a;
        --tm-focus: #8ea9ff;
        --tm-red: #ff6b5e;
        --tm-red-soft: #3d1d1a;
        --tm-blue: #8ea9ff;
        --tm-blue-soft: #1e2a4a;
        --tm-success: #77d3a0;
        --tm-success-soft: #173b29;
        --tm-warning: #f0c561;
        --tm-warning-soft: #3f3110;
        --tm-danger: #ff8a80;
        --tm-on-danger: #4a0d08;
        --tm-danger-soft: #3f1a17;
        --tm-info: #8cc8f0;
        --tm-info-soft: #15344a;
        --tm-plum: #e3b3d6;
        --tm-plum-soft: #42263b;
        --tm-scrim: #00000099;
        --tm-scrim-light: #00000066;
        --tm-on-scrim: #ffffff;
        --tm-media-bg: #2a2d31;
        --tm-ink-rgb: 241, 242, 243;
        --tm-primary-rgb: 241, 242, 243;
        --tm-e-1: 0 1px 2px #00000066;
        --tm-e-2: 0 6px 20px #00000073;
        --tm-e-3: 0 18px 48px #00000099;
        --tm-check-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='%23141517' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3E%3C/svg%3E");
        --tm-select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23a9aeb5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
    }
}

@media (max-width: 599.98px) {
    :root { --tm-gutter: 1rem; --tm-header-h: 56px; }
}
