/* ═══════════════════════════════════════════════════════════════════
   PACTIS — AI Deal Intelligence for Private Equity
   Design: Dark / Gold / Premium
   ═══════════════════════════════════════════════════════════════════ */

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

:root {
    --ink: #0a0e17;
    --ink-light: #111827;
    --ink-card: #0f1420;
    --paper: #f8f6f1;
    --paper-dim: rgba(248, 246, 241, 0.6);
    --paper-muted: rgba(248, 246, 241, 0.4);
    --paper-ghost: rgba(248, 246, 241, 0.08);
    --gold: #c9a227;
    --gold-bright: #d4b43a;
    --gold-dim: rgba(201, 162, 39, 0.15);
    --gold-glow: rgba(201, 162, 39, 0.25);
    --gold-border: rgba(201, 162, 39, 0.2);
    --slate: #4a5568;
    --mist: #e8e4dd;
    --green: #34d399;
    --green-dim: rgba(52, 211, 153, 0.15);
    --red: #f87171;
    --red-dim: rgba(248, 113, 113, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--ink);
    color: var(--paper);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

.noise {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

section, .view { position: relative; z-index: 1; }

/* ─── NAV ───────────────────────────────────────────── */

nav {
    padding: 1.5rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
    border-bottom: 1px solid var(--paper-ghost);
}

.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--paper);
    text-decoration: none;
}

.logo-accent { color: var(--gold); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    font-size: 0.875rem;
    color: var(--paper-muted);
    text-decoration: none;
    transition: color var(--transition);
}

.nav-link:hover { color: var(--paper); }

.nav-cta {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink);
    background: var(--gold);
    padding: 0.6rem 1.5rem;
    border-radius: 100px;
    text-decoration: none;
    transition: all var(--transition);
}

.nav-cta:hover {
    background: var(--gold-bright);
    transform: translateY(-1px);
}

/* ─── BUTTONS ───────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    border-radius: var(--radius);
}

.btn-gold {
    background: var(--gold);
    color: var(--ink);
}

.btn-gold:hover {
    background: var(--gold-bright);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--gold-glow);
}

.btn-outline {
    background: transparent;
    color: var(--paper);
    border: 1px solid var(--gold-border);
}

.btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.btn-lg {
    padding: 0.9rem 2rem;
    font-size: 1rem;
    border-radius: 100px;
}

.btn-sm {
    padding: 0.5rem 1.2rem;
    font-size: 0.8rem;
    border-radius: 100px;
}

.btn-arrow {
    font-size: 1.1em;
    transition: transform var(--transition);
}

.btn:hover .btn-arrow {
    transform: translateX(3px);
}

/* ─── VIEWS (SPA) ───────────────────────────────────── */

.view { display: none; }
.view.active { display: block; }

/* ─── HERO ──────────────────────────────────────────── */

.hero {
    padding: 6rem 4rem 5rem;
    max-width: 900px;
}

.hero-overline {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--gold);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.hero-overline::before {
    content: '';
    display: block;
    width: 2rem;
    height: 1px;
    background: var(--gold);
}

.hero h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.8rem, 6vw, 4.5rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
}

.hero h1 em {
    font-style: normal;
    color: var(--gold);
}

.hero-sub {
    font-size: 1.15rem;
    color: var(--paper-dim);
    max-width: 600px;
    line-height: 1.7;
    font-weight: 300;
    margin-bottom: 2.5rem;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.hero-note {
    font-size: 0.8rem;
    color: var(--paper-muted);
    font-weight: 300;
}

/* ─── DIVIDER ───────────────────────────────────────── */

.divider {
    width: 100%;
    padding: 0 4rem;
}

.divider-line {
    height: 1px;
    background: linear-gradient(90deg, var(--gold) 0%, rgba(201,162,39,0.05) 100%);
}

/* ─── SECTION LABEL ─────────────────────────────────── */

.section-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--gold);
    margin-bottom: 1rem;
}

/* ─── HOW IT WORKS ──────────────────────────────────── */

.how-it-works {
    padding: 5rem 4rem;
    max-width: 1100px;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    margin-top: 2rem;
}

.step {
    padding: 2rem 0;
}

.step-number {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gold);
    opacity: 0.4;
    margin-bottom: 1rem;
    line-height: 1;
}

.step-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.step-desc {
    font-size: 0.9rem;
    color: var(--paper-dim);
    line-height: 1.6;
    font-weight: 300;
}

/* ─── CAPABILITIES ──────────────────────────────────── */

.capabilities {
    padding: 4rem 4rem 6rem;
    max-width: 1100px;
}

.cap-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    background: var(--gold-dim);
    border: 1px solid rgba(201, 162, 39, 0.08);
}

.cap-item {
    background: var(--ink);
    padding: 3rem;
}

.cap-number {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    color: var(--gold);
    letter-spacing: 0.15em;
    margin-bottom: 1.5rem;
}

.cap-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    letter-spacing: -0.01em;
}

.cap-desc {
    font-size: 0.95rem;
    color: var(--paper-dim);
    line-height: 1.6;
    font-weight: 300;
}

/* ─── METRICS ───────────────────────────────────────── */

.metrics {
    padding: 4rem 4rem 6rem;
    display: flex;
    gap: 4rem;
    max-width: 1100px;
}

.metric { flex: 1; }

.metric-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--paper-muted);
    font-weight: 300;
}

/* ─── CLOSING ───────────────────────────────────────── */

.closing {
    padding: 6rem 4rem 4rem;
    max-width: 750px;
}

.closing h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
}

.closing p {
    font-size: 1.05rem;
    color: var(--paper-dim);
    line-height: 1.7;
    font-weight: 300;
    margin-bottom: 2rem;
}

.closing-cta {
    padding-bottom: 4rem;
}

/* ─── FOOTER ────────────────────────────────────────── */

footer {
    padding: 3rem 4rem;
    border-top: 1px solid var(--paper-ghost);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.footer-brand {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    color: rgba(248, 246, 241, 0.3);
}

.footer-note {
    font-size: 0.75rem;
    color: rgba(248, 246, 241, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════
   SCREEN FORM
   ═══════════════════════════════════════════════════════════════════ */

.screen-section {
    padding: 4rem 4rem 6rem;
    max-width: 800px;
}

.screen-header {
    margin-bottom: 3rem;
}

.screen-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.screen-subtitle {
    font-size: 1rem;
    color: var(--paper-dim);
    font-weight: 300;
}

.screen-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-full {
    grid-column: 1 / -1;
}

.form-group label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--paper-dim);
}

.label-optional {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--paper-muted);
    font-size: 0.75rem;
}

.form-group select,
.form-group input,
.form-group textarea {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: var(--paper);
    background: var(--ink-light);
    border: 1px solid var(--paper-ghost);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    transition: border-color var(--transition);
    outline: none;
    width: 100%;
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--gold-border);
    box-shadow: 0 0 0 2px var(--gold-dim);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23c9a227' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

.form-group select option {
    background: var(--ink-light);
    color: var(--paper);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--paper-muted);
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.range-inputs input {
    flex: 1;
}

.range-sep {
    font-size: 0.8rem;
    color: var(--paper-muted);
    flex-shrink: 0;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.form-note {
    font-size: 0.8rem;
    color: var(--paper-muted);
    font-weight: 300;
}

/* ═══════════════════════════════════════════════════════════════════
   LOADING
   ═══════════════════════════════════════════════════════════════════ */

.loading-section {
    padding: 10rem 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.loading-animation {
    margin-bottom: 2.5rem;
}

.loading-ring {
    width: 60px;
    height: 60px;
    position: relative;
}

.ring-segment {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.ring-segment:nth-child(1) { animation-delay: -0.3s; opacity: 1; }
.ring-segment:nth-child(2) { animation-delay: -0.15s; opacity: 0.6; }
.ring-segment:nth-child(3) { animation-delay: 0s; opacity: 0.3; }

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-status {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    min-height: 2rem;
    transition: opacity 0.3s ease;
}

.loading-sub {
    font-size: 0.9rem;
    color: var(--paper-muted);
    font-weight: 300;
    margin-bottom: 2rem;
}

.loading-progress {
    width: 300px;
    height: 3px;
    background: var(--paper-ghost);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gold), var(--gold-bright));
    border-radius: 3px;
    transition: width 0.5s ease;
}

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

.results-section {
    padding: 3rem 4rem 6rem;
    max-width: 1000px;
}

.results-header {
    margin-bottom: 2rem;
}

.results-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.results-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.results-count {
    font-size: 0.9rem;
    color: var(--paper-dim);
}

.criteria-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.criteria-tag {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gold);
    background: var(--gold-dim);
    padding: 0.35rem 0.8rem;
    border-radius: 100px;
    border: 1px solid var(--gold-border);
}

.criteria-tag-focus {
    background: var(--gold-glow);
    border-color: var(--gold);
    color: var(--paper);
    font-style: italic;
}

.criteria-tag-focus::before {
    content: '\1F3AF  ';
}

.results-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

/* ─── Result Cards ─────────────────────────────────── */

.result-card {
    background: var(--ink-card);
    border: 1px solid var(--paper-ghost);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.25rem;
    transition: border-color var(--transition);
}

.result-card:hover {
    border-color: var(--gold-border);
}

.result-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.result-rank {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gold);
    background: var(--gold-dim);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 1rem;
    border: 1px solid var(--gold-border);
}

.result-company-info {
    flex: 1;
}

.result-company-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 0.2rem;
}

.result-subsector {
    font-size: 0.85rem;
    color: var(--paper-dim);
    font-weight: 300;
}

.result-score {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}

.score-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--paper-muted);
    margin-bottom: 0.25rem;
}

.score-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gold);
    line-height: 1;
}

.score-bar {
    width: 60px;
    height: 3px;
    background: var(--paper-ghost);
    border-radius: 3px;
    margin-top: 0.4rem;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 3px;
    transition: width 0.6s ease;
}

.result-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.result-metric {
    font-size: 0.78rem;
    color: var(--paper);
    background: var(--ink-light);
    padding: 0.4rem 0.8rem;
    border-radius: 100px;
    border: 1px solid var(--paper-ghost);
}

.result-metric-label {
    color: var(--paper-muted);
    margin-right: 0.3rem;
}

.result-signals {
    margin-bottom: 1.25rem;
}

.result-signals-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--green);
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.result-signals-text {
    font-size: 0.85rem;
    color: var(--paper-dim);
    line-height: 1.5;
    font-weight: 300;
}

.result-thesis {
    border-top: 1px solid var(--paper-ghost);
    padding-top: 1.25rem;
}

.result-thesis-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gold);
    margin-bottom: 0.6rem;
    font-weight: 600;
}

.result-thesis-text {
    font-size: 0.9rem;
    color: var(--paper-dim);
    line-height: 1.7;
    font-weight: 300;
}

.result-thesis-text p {
    margin-bottom: 0.8rem;
}

.result-thesis-text p:last-child {
    margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   HISTORY
   ═══════════════════════════════════════════════════════════════════ */

.history-section {
    padding: 4rem 4rem 6rem;
    max-width: 900px;
}

.history-empty {
    text-align: center;
    padding: 4rem 0;
}

.history-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.history-empty-text {
    font-size: 1.1rem;
    color: var(--paper-muted);
    margin-bottom: 1.5rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ink-card);
    border: 1px solid var(--paper-ghost);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    color: var(--paper);
    transition: all var(--transition);
    cursor: pointer;
}

.history-item:hover {
    border-color: var(--gold-border);
    transform: translateX(4px);
}

.history-item-left {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.history-item-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 1rem;
}

.history-item-meta {
    font-size: 0.8rem;
    color: var(--paper-muted);
    font-weight: 300;
}

.history-item-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.history-item-count {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gold);
    background: var(--gold-dim);
    padding: 0.3rem 0.7rem;
    border-radius: 100px;
}

.history-item-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 100px;
    font-weight: 500;
}

.status-completed {
    color: var(--green);
    background: var(--green-dim);
}

.status-processing {
    color: var(--gold);
    background: var(--gold-dim);
}

.status-failed {
    color: var(--red);
    background: var(--red-dim);
}

.history-item-arrow {
    color: var(--paper-muted);
    font-size: 1.2rem;
    transition: transform var(--transition);
}

.history-item:hover .history-item-arrow {
    transform: translateX(3px);
    color: var(--gold);
}

/* ═══════════════════════════════════════════════════════════════════
   ERROR STATE
   ═══════════════════════════════════════════════════════════════════ */

.error-state {
    text-align: center;
    padding: 4rem 0;
}

.error-state-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.error-state-text {
    font-size: 1.1rem;
    color: var(--paper-muted);
    margin-bottom: 1.5rem;
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    nav {
        padding: 1rem 1.25rem;
    }

    .nav-links { gap: 1rem; }

    .nav-link { display: none; }

    .hero {
        padding: 3rem 1.25rem 3rem;
    }

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

    .hero-sub {
        font-size: 1rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .divider { padding: 0 1.25rem; }

    .how-it-works {
        padding: 3rem 1.25rem;
    }

    .steps-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .capabilities { padding: 2rem 1.25rem 4rem; }
    .cap-grid { grid-template-columns: 1fr; }
    .cap-item { padding: 2rem 1.25rem; }

    .metrics {
        padding: 2rem 1.25rem 4rem;
        flex-direction: column;
        gap: 2rem;
    }

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

    .closing { padding: 3rem 1.25rem 2rem; }

    .screen-section {
        padding: 2rem 1.25rem 4rem;
    }

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

    .form-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-section {
        padding: 2rem 1.25rem 4rem;
    }

    .result-card {
        padding: 1.5rem;
    }

    .result-card-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .result-score {
        align-items: flex-start;
        flex-direction: row;
        gap: 0.5rem;
    }

    .result-metrics {
        gap: 0.35rem;
    }

    .criteria-summary {
        gap: 0.35rem;
    }

    .results-actions {
        flex-direction: column;
    }

    .history-section {
        padding: 2rem 1.25rem 4rem;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .loading-section {
        padding: 6rem 1.25rem;
    }

    .loading-progress { width: 200px; }

    footer {
        padding: 2rem 1.25rem;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}
