/* ==========================================================================
   프라임 마켓 데스크
   ========================================================================== */

:root {
    --bg-page: #101114;
    --bg-panel: #18191d;
    --bg-panel-soft: #202127;
    --bg-paper: #f7f8fa;
    --ink: #101216;
    --ink-muted: #5d6470;
    --text-primary: #f4f1e8;
    --text-secondary: #c9c4b8;
    --text-muted: #8f908d;
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.2);
    --gold: #c8a45d;
    --green: #3ecf8e;
    --red: #ee6352;
    --steel: #7ea6c8;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
    --radius: 8px;
    --font-main: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", "Consolas", monospace;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background:
        linear-gradient(180deg, rgba(200, 164, 93, 0.08), transparent 260px),
        var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.55;
}

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

img {
    display: block;
    max-width: 100%;
}

::selection {
    background: rgba(200, 164, 93, 0.38);
    color: #ffffff;
}

.page-shell {
    min-height: 100vh;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    min-height: 72px;
    padding: 0 32px;
    background: rgba(16, 17, 20, 0.88);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--gold);
    background: linear-gradient(145deg, #252116, #15161a);
    border: 1px solid rgba(200, 164, 93, 0.34);
    border-radius: var(--radius);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-mark svg {
    width: 24px;
    height: 24px;
}

.brand-copy {
    display: grid;
    gap: 1px;
}

.brand-copy strong {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-copy span {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero {
    position: relative;
    min-height: clamp(330px, 46vh, 500px);
    overflow: hidden;
    border-bottom: 1px solid var(--line);
}

.hero-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(16, 17, 20, 0.95) 0%, rgba(16, 17, 20, 0.72) 34%, rgba(16, 17, 20, 0.14) 70%),
        linear-gradient(180deg, rgba(16, 17, 20, 0.2) 0%, rgba(16, 17, 20, 0.9) 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1180px;
    min-height: clamp(330px, 46vh, 500px);
    margin: 0 auto;
    padding: 56px 32px;
}

.hero-subtitle {
    width: 100%;
    max-width: 960px;
    margin: 0 0 14px;
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero h1 {
    width: 100%;
    max-width: 960px;
    margin: 0;
    font-size: 4.7rem;
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: 0;
    word-break: keep-all;
}

.reports-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    width: min(1480px, calc(100vw - 48px));
    margin: 28px auto 48px;
}

.report-panel {
    --report-font-size: 16px;
    --report-line-height: 1.85;
    min-width: 0;
    overflow: hidden;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.report-heading {
    display: flex;
    flex-direction: column;
    min-height: 232px;
    padding: 24px 26px 20px;
    background:
        linear-gradient(135deg, rgba(126, 166, 200, 0.12), transparent 54%),
        var(--bg-panel-soft);
    border-bottom: 1px solid var(--line);
}

.report-kicker {
    margin: 0 0 8px;
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.report-warning {
    margin: 0 0 12px;
    color: var(--red);
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.45;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.report-heading h2 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.15;
    letter-spacing: 0;
    word-break: keep-all;
}

.report-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: auto;
    padding-top: 20px;
}

.control-field {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 10px;
    min-width: 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.control-field span,
.control-field output {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
}

.control-field output {
    color: var(--gold);
    font-family: var(--font-mono);
}

.control-field input {
    grid-column: 1 / -1;
    width: 100%;
    accent-color: var(--gold);
}

.report-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 54px;
    padding: 0 26px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    background: #121318;
    border-bottom: 1px solid var(--line);
}

.file-modified-date {
    color: var(--steel);
    font-size: 0.72rem;
    white-space: nowrap;
}

.sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 0 12px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    white-space: nowrap;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--gold);
    box-shadow: 0 0 0 4px rgba(200, 164, 93, 0.12);
}

.sync-dot.is-ok {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(62, 207, 142, 0.12);
}

.sync-dot.is-error {
    background: var(--red);
    box-shadow: 0 0 0 4px rgba(238, 99, 82, 0.12);
}

.report-content {
    min-height: 620px;
    padding: 36px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.94)),
        var(--bg-paper);
    color: var(--ink);
}

.document-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    color: var(--ink);
    font-family: var(--font-main);
    font-size: var(--report-font-size);
    line-height: var(--report-line-height);
}

.loading-state,
.empty-state,
.error-state {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 14px;
    min-height: 420px;
    color: var(--ink-muted);
    text-align: center;
}

.loading-state p,
.empty-state p,
.error-state p {
    margin: 0;
}

.spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(16, 18, 22, 0.16);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}

.error-state {
    color: #8b2c22;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 960px) {
    .site-header {
        padding: 0 20px;
    }

    .hero h1 {
        font-size: 3.4rem;
    }

    .reports-grid {
        grid-template-columns: 1fr;
        width: min(calc(100vw - 32px), 720px);
        gap: 20px;
    }

    .report-panel {
        width: min(calc(100vw - 32px), 720px);
    }
}

@media (max-width: 640px) {
    .site-header {
        min-height: 64px;
    }

    .brand-mark {
        width: 36px;
        height: 36px;
    }

    .brand-copy strong {
        font-size: 0.92rem;
    }

    .brand-copy span {
        font-size: 0.62rem;
    }

    .hero {
        min-height: 360px;
    }

    .hero-overlay {
        background:
            linear-gradient(180deg, rgba(16, 17, 20, 0.5) 0%, rgba(16, 17, 20, 0.94) 100%),
            linear-gradient(90deg, rgba(16, 17, 20, 0.9), rgba(16, 17, 20, 0.42));
    }

    .hero-content {
        min-height: 360px;
        padding: 48px 20px 34px;
    }

    .hero h1 {
        font-size: 2.35rem;
        line-height: 1.1;
    }

    .report-toolbar {
        padding: 12px 18px;
        align-items: flex-start;
        flex-direction: column;
    }

    .report-heading {
        min-height: auto;
        padding: 20px 18px 18px;
    }

    .report-heading h2 {
        font-size: 1.65rem;
    }

    .report-controls {
        grid-template-columns: 1fr;
    }

    .report-content {
        min-height: 460px;
        padding: 24px 18px;
    }
}
