/* ================================================
   CMInsight design system
   Control & Measure Insight – Industrial Tech + AI
   ================================================ */

:root {
    --cm-primary: #0A2540;
    --cm-primary-2: #1E3A5F;
    --cm-primary-3: #11304F;
    --cm-accent: #00D4FF;
    --cm-accent-2: #2EB8C8;
    --cm-bg: #FFFFFF;
    --cm-bg-alt: #F5F8FB;
    --cm-bg-dark: #07182B;
    --cm-text: #1A2332;
    --cm-text-muted: #5A6477;
    --cm-border: #E1E7EE;
    --cm-radius: 14px;
    --cm-radius-sm: 8px;
    --cm-shadow-sm: 0 2px 8px rgba(10, 37, 64, 0.06);
    --cm-shadow: 0 8px 24px rgba(10, 37, 64, 0.08);
    --cm-shadow-lg: 0 24px 56px rgba(10, 37, 64, 0.18);
    --cm-grad: linear-gradient(135deg, #0A2540 0%, #11304F 50%, #1E3A5F 100%);
    --cm-grad-accent: linear-gradient(135deg, #00D4FF 0%, #2EB8C8 100%);
}

html, body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
                 'Noto Sans KR', 'Segoe UI', Roboto, sans-serif;
    color: var(--cm-text);
    background: var(--cm-bg);
    scroll-behavior: smooth;
}

a { color: var(--cm-primary-2); text-decoration: none; }
a:hover { color: var(--cm-accent-2); }

h1, h2, h3, h4, h5 { font-weight: 700; letter-spacing: -0.01em; color: var(--cm-text); }

/* ---------- Buttons ---------- */
.cm-btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.7rem 1.25rem; border-radius: 999px; font-weight: 600;
    border: 1px solid transparent; transition: all .2s ease;
    line-height: 1.2; font-size: .95rem;
}
.cm-btn-primary { background: var(--cm-primary); color: #fff; }
.cm-btn-primary:hover { background: var(--cm-primary-2); color: #fff; transform: translateY(-1px); }
.cm-btn-accent { background: var(--cm-grad-accent); color: var(--cm-primary); }
.cm-btn-accent:hover { filter: brightness(1.05); color: var(--cm-primary); transform: translateY(-1px); }
.cm-btn-outline { background: transparent; color: var(--cm-primary); border-color: var(--cm-border); }
.cm-btn-outline:hover { background: var(--cm-primary); color: #fff; border-color: var(--cm-primary); }
.cm-btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.cm-btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ---------- Header ---------- */
.cm-header {
    position: sticky; top: 0; z-index: 1030;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--cm-border);
}
.cm-header-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.cm-brand { display: flex; align-items: center; gap: .65rem; color: var(--cm-primary); font-weight: 800; }
.cm-brand:hover { color: var(--cm-primary-2); }
.cm-brand-mark {
    width: 36px; height: 36px; border-radius: 9px; background: var(--cm-grad);
    display: grid; place-items: center; color: #fff; font-weight: 800; letter-spacing: -0.04em;
    box-shadow: 0 4px 14px rgba(10, 37, 64, 0.25);
}
.cm-brand-logo { height: 38px; width: auto; display: block; }
.cm-brand-logo--footer { background: transparent; padding: 0; border-radius: 0; }
.cm-brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.cm-brand-text strong { font-size: 1.05rem; }
.cm-brand-text small { font-size: .68rem; color: var(--cm-text-muted); letter-spacing: 0.02em; }

.cm-nav { display: none; gap: 1.6rem; align-items: center; }
.cm-nav a { color: var(--cm-text); font-weight: 600; font-size: .95rem; padding: .35rem 0; border-bottom: 2px solid transparent; }
.cm-nav a:hover, .cm-nav a.active { color: var(--cm-primary); border-bottom-color: var(--cm-accent); }

/* Dropdown (desktop only) */
.cm-nav-dropdown { position: relative; }
.cm-nav-dropdown-toggle { display: inline-flex; align-items: center; gap: .25rem; }
.cm-nav-dropdown-menu {
    position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(8px);
    background: #fff; border: 1px solid var(--cm-border); border-radius: var(--cm-radius-sm);
    box-shadow: var(--cm-shadow); padding: .5rem 0; min-width: 180px;
    opacity: 0; visibility: hidden; transition: all .18s ease;
    z-index: 1040;
}
.cm-nav-dropdown-menu a {
    display: block; padding: .55rem 1rem; border-bottom: 0; font-weight: 500; font-size: .92rem;
}
.cm-nav-dropdown-menu a:hover { background: var(--cm-bg-alt); border-bottom: 0; color: var(--cm-primary); }
.cm-nav-dropdown:hover .cm-nav-dropdown-menu,
.cm-nav-dropdown:focus-within .cm-nav-dropdown-menu {
    opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}

.cm-header-actions { display: flex; align-items: center; gap: .5rem; }
.cm-burger { background: transparent; border: 0; color: var(--cm-primary); font-size: 1.5rem; padding: .25rem .5rem; }

@media (min-width: 992px) {
    .cm-nav { display: flex; }
    .cm-burger { display: none; }
}

/* Offcanvas custom */
.offcanvas .cm-nav { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.offcanvas .cm-nav a { padding: .9rem 0; border-bottom: 1px solid var(--cm-border); }

/* ---------- Hero ---------- */
.cm-hero { position: relative; color: #fff; overflow: hidden; }
.cm-hero-bg {
    position: absolute; inset: 0;
    background: var(--cm-grad);
}
.cm-hero-bg::after {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(60% 60% at 70% 40%, rgba(0,212,255,.18) 0%, transparent 60%),
                radial-gradient(40% 60% at 20% 80%, rgba(46,184,200,.15) 0%, transparent 60%);
}
.cm-hero-inner { position: relative; padding: 6rem 0 5rem; min-height: 540px; display: flex; align-items: center; }
.cm-hero--compact .cm-hero-inner { padding: 3.5rem 0 3rem; min-height: auto; }
.cm-hero--compact h1 { font-size: clamp(1.5rem, 3vw, 2.4rem); }
.cm-hero h1 {
    color: #fff; font-size: clamp(1.85rem, 4vw, 3.2rem); font-weight: 800;
    line-height: 1.18; letter-spacing: -0.02em;
}
.cm-hero h1 .accent { color: var(--cm-accent); }
.cm-hero p.lead { color: rgba(255,255,255,.85); font-size: clamp(1rem, 1.5vw, 1.15rem); max-width: 640px; }
.cm-hero-tag {
    display: inline-flex; align-items: center; gap: .4rem;
    background: rgba(0,212,255,.12); border: 1px solid rgba(0,212,255,.4);
    color: var(--cm-accent); padding: .3rem .8rem; border-radius: 999px;
    font-size: .82rem; font-weight: 600; letter-spacing: .02em;
}

/* Carousel inside hero */
.cm-hero .carousel-indicators [data-bs-target] {
    width: 28px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.4);
    border-top: 0; border-bottom: 0;
}
.cm-hero .carousel-indicators .active { background: var(--cm-accent); }
.cm-carousel-img {
    width: 100%; aspect-ratio: 16 / 10; object-fit: cover;
    border-radius: var(--cm-radius); box-shadow: var(--cm-shadow-lg);
}

/* ---------- Sections ---------- */
.cm-section { padding: 5rem 0; }
.cm-section-tight { padding: 3.5rem 0; }
.cm-section-alt { background: var(--cm-bg-alt); }
.cm-section-dark { background: var(--cm-bg-dark); color: #fff; }
.cm-section-dark h1, .cm-section-dark h2, .cm-section-dark h3 { color: #fff; }
.cm-section-dark p { color: rgba(255,255,255,.78); }

.cm-eyebrow {
    display: inline-block; font-size: .82rem; font-weight: 700;
    color: var(--cm-accent-2); letter-spacing: .15em; text-transform: uppercase;
    margin-bottom: .8rem;
}
.cm-section-title { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1rem; }
.cm-section-sub { color: var(--cm-text-muted); font-size: 1.05rem; max-width: 760px; }

/* ---------- KPI ---------- */
.cm-kpi {
    background: #fff; border: 1px solid var(--cm-border);
    border-radius: var(--cm-radius); padding: 1.6rem 1.25rem;
    text-align: center; height: 100%; transition: all .25s ease;
}
.cm-kpi:hover { transform: translateY(-4px); box-shadow: var(--cm-shadow); border-color: transparent; }
.cm-kpi-num {
    font-size: clamp(1.8rem, 3.5vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em;
    background: var(--cm-grad-accent); -webkit-background-clip: text; background-clip: text;
    color: transparent; line-height: 1;
}
.cm-kpi-num small { font-size: 0.6em; }
.cm-kpi-label { color: var(--cm-text-muted); font-size: .92rem; margin-top: .4rem; }

/* ---------- Cards ---------- */
.cm-card {
    background: #fff; border: 1px solid var(--cm-border);
    border-radius: var(--cm-radius); padding: 1.75rem;
    height: 100%; transition: all .25s ease;
    display: flex; flex-direction: column;
}
.cm-card:hover { transform: translateY(-4px); box-shadow: var(--cm-shadow); border-color: transparent; }
.cm-card-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: grid; place-items: center; font-size: 1.5rem;
    background: var(--cm-grad); color: var(--cm-accent);
    margin-bottom: 1.1rem;
}
.cm-card h3 { font-size: 1.2rem; margin-bottom: .5rem; }
.cm-card p { color: var(--cm-text-muted); font-size: .95rem; margin-bottom: 1rem; }
.cm-card .cm-card-link {
    margin-top: auto; font-weight: 600; color: var(--cm-primary);
    display: inline-flex; align-items: center; gap: .35rem;
}
.cm-card .cm-card-link:hover { color: var(--cm-accent-2); gap: .55rem; }
.cm-card-title-link {
    color: inherit;
    text-decoration: none;
    transition: color .2s ease;
}
.cm-card-title-link:hover {
    color: var(--cm-accent-2);
}

/* Image card variant */
.cm-card-img { padding: 0; overflow: hidden; }
.cm-card-img .cm-card-cover {
    width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block;
}
.cm-card-img .cm-card-body { padding: 1.5rem 1.5rem 1.75rem; display: flex; flex-direction: column; flex: 1; }

/* ---------- Feature blocks ---------- */
.cm-feature { display: grid; grid-template-columns: 44px 1fr; gap: 1rem; align-items: start; }
.cm-feature-icon {
    width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
    background: rgba(0,212,255,.1); color: var(--cm-primary); font-size: 1.2rem;
}
.cm-feature h4 { font-size: 1.05rem; margin-bottom: .25rem; }
.cm-feature p { color: var(--cm-text-muted); font-size: .92rem; margin: 0; }

/* ---------- Footer ---------- */
.cm-footer { background: var(--cm-bg-dark); color: rgba(255,255,255,.72); padding: 3.5rem 0 1.75rem; }
.cm-footer h5 { color: #fff; font-size: 1rem; margin-bottom: 1rem; }
.cm-footer a { color: rgba(255,255,255,.72); }
.cm-footer a:hover { color: var(--cm-accent); }
.cm-footer-bottom {
    margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.1);
    display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
    font-size: .85rem;
}

/* ---------- Image utilities ---------- */
.cm-img-frame {
    background: #fff; border: 1px solid var(--cm-border); border-radius: var(--cm-radius);
    padding: .5rem; box-shadow: var(--cm-shadow-sm);
}
.cm-img-frame img { width: 100%; display: block; border-radius: calc(var(--cm-radius) - 4px); }
.cm-img-portrait { aspect-ratio: 3 / 4; object-fit: contain; background: #f7f9fc; }
.cm-img-landscape-sm { aspect-ratio: 16 / 10; object-fit: cover; max-height: 220px; }
.cm-img-landscape-md { aspect-ratio: 16 / 10; object-fit: cover; max-height: 320px; }
.cm-img-square-sm { aspect-ratio: 1 / 1; object-fit: cover; max-height: 220px; }

/* ---------- Auth pages ---------- */
.cm-auth-shell { background: var(--cm-bg-alt); padding: 4rem 0; min-height: calc(100vh - 72px); }
.cm-auth-card {
    background: #fff; border-radius: var(--cm-radius); padding: 2.25rem 2rem;
    box-shadow: var(--cm-shadow); max-width: 480px; margin: 0 auto;
}
.cm-auth-card h1 { font-size: 1.5rem; margin-bottom: .35rem; }
.cm-auth-card .text-muted { font-size: .92rem; }
.cm-auth-card .form-floating > label { color: var(--cm-text-muted); }
.cm-auth-divider { display: flex; align-items: center; gap: 1rem; color: var(--cm-text-muted); font-size: .82rem; margin: 1.4rem 0; }
.cm-auth-divider::before, .cm-auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--cm-border); }
.cm-auth-link { font-weight: 600; }

/* Override the legacy /Account default form sizing */
section h1 { color: var(--cm-text); }

/* ---------- Case card + collapsible detail ---------- */
.cm-case-card { cursor: pointer; }
.cm-case-card[aria-expanded="true"] {
    border-color: var(--cm-accent);
    box-shadow: var(--cm-shadow);
}
.cm-case-toggle i { transition: transform .25s ease; display: inline-block; }
.cm-case-card[aria-expanded="true"] .cm-case-toggle i { transform: rotate(180deg); }

.cm-case-detail { width: 100%; }
.cm-case-detail-inner {
    background: #fff;
    border: 1px solid var(--cm-border);
    border-radius: var(--cm-radius);
    padding: 1.5rem 1.5rem 1.75rem;
    box-shadow: var(--cm-shadow-sm);
    margin-top: .25rem;
}
.cm-case-detail-item {
    background: var(--cm-bg-alt);
    border: 1px solid var(--cm-border);
    border-radius: var(--cm-radius-sm);
    padding: 1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.cm-case-detail-img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    background: #fff;
    border-radius: 6px;
    margin-bottom: .75rem;
}
.cm-case-detail-item h5 {
    font-size: .95rem;
    font-weight: 700;
    margin: 0 0 .35rem;
    color: var(--cm-primary);
}
.cm-case-detail-item p {
    font-size: .82rem;
    color: var(--cm-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ---------- Scroll reveal ---------- */
.cm-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity .7s cubic-bezier(.22,.61,.36,1),
                transform .7s cubic-bezier(.22,.61,.36,1);
    will-change: opacity, transform;
}
.cm-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}
/* Stagger sibling cards/features within a row for a wave effect */
.row > [class*="col-"] > .cm-reveal { transition-delay: 0s; }
.row > [class*="col-"]:nth-child(2) > .cm-reveal { transition-delay: .08s; }
.row > [class*="col-"]:nth-child(3) > .cm-reveal { transition-delay: .16s; }
.row > [class*="col-"]:nth-child(4) > .cm-reveal { transition-delay: .24s; }
.row > [class*="col-"]:nth-child(5) > .cm-reveal { transition-delay: .32s; }
.row > [class*="col-"]:nth-child(6) > .cm-reveal { transition-delay: .40s; }

@media (prefers-reduced-motion: reduce) {
    .cm-reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Misc ---------- */
.cm-divider { height: 1px; background: var(--cm-border); margin: 3rem 0; }
.cm-shape-bg {
    position: absolute; pointer-events: none; opacity: .08;
    background: radial-gradient(closest-side, var(--cm-accent), transparent);
}

/* Account / Identity pages — keep them clean inside the new layout */
.cm-account-shell { background: var(--cm-bg-alt); padding: 3rem 0; min-height: calc(100vh - 72px); }
.cm-account-card {
    background: #fff; border-radius: var(--cm-radius); padding: 2rem;
    box-shadow: var(--cm-shadow-sm); max-width: 520px; margin: 0 auto;
}
