/* ═══════════════════════════════════════════
   THE-LAG — Minimal White Theme v2
   ═══════════════════════════════════════════ */

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

:root {
    --white: #ffffff;
    --bg: #fafafa;
    --surface: #ffffff;
    --border: #e8e8e8;
    --border-hover: #d0d0d0;
    --text: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-tertiary: #999999;
    --accent: #1a1a1a;
    --accent-soft: #f5f5f5;
    --green: #16a34a;
    --green-soft: #f0fdf4;
    --red: #dc2626;
    --red-soft: #fef2f2;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Space Mono', 'SF Mono', monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
    scroll-padding-top: 72px;
}

body {
    font-family: var(--font-body);
    background: var(--white);
    color: var(--text);
    line-height: 1.6;
}

.hidden { display: none !important; }

/* ═══════════════ NAVBAR ═══════════════ */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 64px;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: height 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease;
}

.navbar.scrolled {
    height: 52px;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

.nav-logo {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text);
    text-decoration: none;
    flex-shrink: 0;
    transition: font-size 0.3s ease;
}

.navbar.scrolled .nav-logo {
    font-size: 0.95rem;
}


.nav-links {
    display: flex;
    list-style: none;
    gap: 4px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-link {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.01em;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 16px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
    color: var(--text);
    background: var(--accent-soft);
}

.nav-link.active {
    color: var(--text);
    background: var(--accent-soft);
}

.nav-link.active::after {
    transform: translateX(-50%) scaleX(1);
}

/* Language Switcher */
.nav-lang {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    background: none;
    border: 1.5px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.03em;
}

.lang-btn:hover {
    color: var(--text-secondary);
    border-color: var(--border);
}

.lang-btn.active {
    color: var(--text);
    border-color: var(--border);
    background: var(--accent-soft);
}

.lang-btn svg {
    border-radius: 2px;
    flex-shrink: 0;
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.1);
}

/* Hamburger */
.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 4px;
    background: none;
    border: none;
    cursor: pointer;
}

.nav-hamburger span {
    display: block;
    width: 20px;
    height: 1.5px;
    background: var(--text);
    border-radius: 1px;
    transition: all var(--transition);
}

.nav-hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}
.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}
.nav-hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 999;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px 20px;
}

.mobile-menu.open {
    display: block;
}

.mobile-menu ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-link {
    display: block;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all var(--transition);
}

.mobile-link:hover {
    background: var(--accent-soft);
    color: var(--text);
}

/* ═══════════════ HERO ═══════════════ */

.hero {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 64px 32px 80px;
    text-align: center;
}

.hero-content {
    max-width: 680px;
}

.hero-tag {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin-bottom: 20px;
    color: var(--text);
}

.hero h1 em {
    font-style: italic;
    font-weight: 300;
    color: var(--text-secondary);
}

.hero-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 36px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.hero-btn {
    text-decoration: none;
    display: inline-flex;
    padding: 13px 32px;
    font-size: 0.92rem;
}

/* ═══════════════ SECTIONS ═══════════════ */

.section {
    padding: 80px 32px;
}

.section-alt {
    background: var(--bg);
}

.section-inner {
    max-width: 900px;
    margin: 0 auto;
}

.section-title {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.section-desc {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 520px;
    line-height: 1.65;
}

/* ═══════════════ ABOUT CARDS ═══════════════ */

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 32px;
}

.about-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    transition: all var(--transition);
}

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

.about-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border-radius: 10px;
    color: var(--text);
    margin-bottom: 16px;
}

.about-card h3 {
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.about-card p {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Expandable About Cards */
.about-detail {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease,
                margin 0.4s ease;
    margin-top: 0;
}

.about-card.expanded .about-detail {
    max-height: 600px;
    opacity: 1;
    margin-top: 14px;
}

.about-detail ul {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.about-detail ul li {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.55;
    padding: 5px 0 5px 14px;
    position: relative;
}

.about-detail ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--border-hover);
}

.about-detail ul li strong {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text);
}

.formula {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    background: var(--accent-soft);
    padding: 12px 18px;
    border-radius: 8px;
    margin: 12px 0;
    text-align: center;
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
}

.about-toggle {
    display: inline-flex;
    align-items: center;
    margin-top: 12px;
    padding: 0;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    transition: color var(--transition);
    border-bottom: 1px dashed var(--border);
    padding-bottom: 1px;
}

.about-toggle:hover {
    color: var(--text);
    border-bottom-color: var(--text);
}

/* ═══════════════ DATASET REQUIREMENTS ═══════════════ */

.dataset-req {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-bottom: 28px;
}

.dataset-req h3 {
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.dataset-req-desc {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    margin-bottom: 18px;
}

.col-groups {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.col-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.col-group-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.col-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.col-tags code {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 3px 8px;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    white-space: nowrap;
}

/* ═══════════════ UPLOAD / ANALYZE ═══════════════ */

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 44px 24px;
    cursor: pointer;
    transition: all var(--transition);
    max-width: 520px;
    text-align: center;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--text);
    background: var(--accent-soft);
}

.upload-icon {
    color: var(--text-tertiary);
    margin-bottom: 12px;
    transition: color var(--transition);
}

.upload-zone:hover .upload-icon {
    color: var(--text);
}

.upload-text {
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    max-width: 520px;
}

.file-name {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text);
}

.btn-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-tertiary);
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon:hover {
    color: var(--red);
    background: var(--red-soft);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 24px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--white);
    background: var(--text);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary:hover {
    background: #333;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-primary:disabled {
    background: var(--border);
    color: var(--text-tertiary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-run {
    margin-top: 16px;
    min-width: 180px;
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ═══════════════ PROGRESS ═══════════════ */

.progress-section {
    max-width: 520px;
    margin-top: 28px;
}

.progress-bar-track {
    height: 3px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--text);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.progress-text {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    margin-top: 8px;
    font-family: var(--font-mono);
}

/* ═══════════════ RESULTS ═══════════════ */

.results {
    margin-top: 40px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.results-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-download:hover {
    color: var(--text);
    border-color: var(--text);
    background: var(--accent-soft);
}

.btn-download:active {
    transform: scale(0.97);
}

.btn-download svg {
    flex-shrink: 0;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: all var(--transition);
}

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

.metric-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}

.reports-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.report-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.report-card h4 {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.report-pre {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre;
    overflow-x: auto;
}

.cm-container { overflow-x: auto; }

.cm-container table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.76rem;
}

.cm-container th,
.cm-container td {
    padding: 10px 14px;
    text-align: center;
    border: 1px solid var(--border);
}

.cm-container th {
    background: var(--accent-soft);
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.cm-diag {
    background: var(--green-soft);
    color: var(--green);
    font-weight: 700;
}

.cm-off {
    color: var(--text-tertiary);
}

.result-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
}

.result-panel h4 {
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.panel-desc {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

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

.result-img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.placeholder-text {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    padding: 32px 0;
    font-style: italic;
}

/* ═══════════════ FAQ ═══════════════ */

.faq-list {
    max-width: 640px;
    margin-top: 24px;
}

.faq-item {
    border-bottom: 1px solid var(--border);
}

.faq-item summary {
    padding: 18px 0;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text);
    transition: color var(--transition);
}

.faq-item summary:hover {
    color: var(--text-secondary);
}

.faq-item summary::after {
    content: '+';
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--text-tertiary);
    transition: transform var(--transition);
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item p {
    padding: 0 0 18px;
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

/* ═══════════════ CONTACT ═══════════════ */

.contact-inner {
    max-width: 640px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 28px;
}

.contact-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contact-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.contact-value {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text);
}

.contact-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.contact-link {
    font-family: var(--font-mono);
    font-size: 0.84rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: border-color var(--transition);
}

.contact-link:hover {
    border-color: var(--text);
}

/* ═══════════════ FOOTER ═══════════════ */

.footer {
    text-align: center;
    padding: 28px 32px;
    border-top: 1px solid var(--border);
    font-size: 0.76rem;
    color: var(--text-tertiary);
}

/* ═══════════════ RESPONSIVE ═══════════════ */

@media (max-width: 768px) {
    .navbar {
        padding: 0 20px;
    }

    .nav-links {
        display: none;
    }

    .nav-hamburger {
        display: flex;
    }

    .hero {
        padding: 64px 20px 60px;
    }

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

    .section {
        padding: 60px 20px;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr 1fr;
    }

    .reports-grid {
        grid-template-columns: 1fr;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .col-groups {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.6rem;
    }

    .metric-card {
        padding: 14px;
    }

    .metric-value {
        font-size: 1.1rem;
    }

    .nav-lang span {
        display: none;
    }
}

/* ═══════════════ SCROLL REVEAL ═══════════════ */

.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children inside revealed sections */
.reveal .about-card,
.reveal .faq-item,
.reveal .contact-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible .about-card,
.reveal.visible .faq-item,
.reveal.visible .contact-item {
    opacity: 1;
    transform: translateY(0);
}

.reveal.visible .about-card:nth-child(1),
.reveal.visible .faq-item:nth-child(1),
.reveal.visible .contact-item:nth-child(1) { transition-delay: 0.05s; }

.reveal.visible .about-card:nth-child(2),
.reveal.visible .faq-item:nth-child(2),
.reveal.visible .contact-item:nth-child(2) { transition-delay: 0.12s; }

.reveal.visible .about-card:nth-child(3),
.reveal.visible .faq-item:nth-child(3),
.reveal.visible .contact-item:nth-child(3) { transition-delay: 0.19s; }

.reveal.visible .about-card:nth-child(4),
.reveal.visible .faq-item:nth-child(4),
.reveal.visible .contact-item:nth-child(4) { transition-delay: 0.26s; }

.reveal.visible .faq-item:nth-child(5) { transition-delay: 0.33s; }

/* ═══════════════ BACK TO TOP ═══════════════ */

.back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 900;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--text);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
}

.back-to-top.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top:hover {
    background: #333;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.back-to-top:active {
    transform: translateY(0);
}