/* valuator.dev - Neubrutalist Valuation Tool */

:root {
    --bg: #f5f0e8;
    --surface: #ffffff;
    --border-strong: #111111;
    --shadow-color: #111111;
    --accent-primary: #0052cc;
    --accent-secondary: #ffab00;
    --negative: #de350b;
    --positive: #006644;
    --muted: #42526e;
    --font-display: 'Space Grotesk', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.7;
    background-color: var(--bg);
    color: var(--border-strong);
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
    /* Grid background at 8px intervals */
    background-image:
        linear-gradient(rgba(17,17,17,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17,17,17,0.03) 1px, transparent 1px);
    background-size: 8px 8px;
}

/* Formula background decorative elements */
.formula-bg {
    position: fixed;
    font-family: var(--font-mono);
    font-size: 4rem;
    font-weight: 400;
    color: var(--border-strong);
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
    white-space: nowrap;
    user-select: none;
}

.formula-bg-1 {
    top: 15%;
    left: 5%;
    transform: rotate(-8deg);
    font-size: 3.5rem;
}

.formula-bg-2 {
    top: 50%;
    right: 2%;
    transform: rotate(5deg);
    font-size: 3rem;
}

.formula-bg-3 {
    bottom: 20%;
    left: 10%;
    transform: rotate(-3deg);
    font-size: 2.8rem;
}

/* Monospace for numbers */
.mono-value {
    font-family: var(--font-mono);
    font-weight: 400;
}

/* Top Bar */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 2px solid var(--border-strong);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar-domain {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.top-bar-sep {
    color: var(--muted);
}

.top-bar-label {
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar-score-label {
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.top-bar-score {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-primary);
    min-width: 3ch;
    text-align: right;
}

/* Thick horizontal rules */
.thick-rule {
    border: none;
    height: 4px;
    background: var(--border-strong);
    margin: 0;
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 65% 35%;
    gap: 0;
    position: relative;
    z-index: 1;
}

.col-left {
    border-right: 2px solid var(--border-strong);
}

.col-right {
    display: flex;
    flex-direction: column;
}

/* Card Style */
.card {
    background: var(--surface);
    border: 2px solid var(--border-strong);
    box-shadow: 4px 4px 0 var(--shadow-color);
    padding: 24px;
    margin: 20px;
    position: relative;
}

.card-muted {
    background: var(--bg);
    box-shadow: 2px 2px 0 var(--shadow-color);
}

.card-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.85rem;
    line-height: 1.4;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}

.section-rule {
    border: none;
    height: 2px;
    background: var(--border-strong);
    margin-bottom: 20px;
    opacity: 0.15;
}

/* Input Panel */
.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-label {
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.input-field {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    padding: 10px 12px;
    border: 2px solid var(--border-strong);
    border-radius: 0;
    background: var(--surface);
    color: var(--border-strong);
    outline: none;
    transition: box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.input-field:hover {
    box-shadow: 2px 2px 0 var(--shadow-color);
}

select.input-field {
    cursor: pointer;
}

.btn-primary {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 14px 28px;
    background: var(--accent-primary);
    color: var(--surface);
    border: 2px solid var(--border-strong);
    border-radius: 0;
    box-shadow: 4px 4px 0 var(--shadow-color);
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.btn-primary:hover {
    box-shadow: 2px 2px 0 var(--shadow-color);
    transform: translate(2px, 2px);
}

.btn-primary:active {
    box-shadow: 0 0 0 var(--shadow-color);
    transform: translate(4px, 4px);
}

/* Valuation Output */
.valuation-hero {
    display: flex;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
}

.gauge-container {
    flex: 0 0 280px;
}

.gauge-svg {
    width: 100%;
    height: auto;
}

.gauge-label {
    font-family: var(--font-mono);
    font-size: 11px;
    fill: var(--muted);
}

#gaugeNeedle {
    transition: transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.valuation-numbers {
    flex: 1;
    min-width: 200px;
}

.valuation-primary {
    display: flex;
    align-items: baseline;
    margin-bottom: 12px;
}

.valuation-dollar {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--muted);
    margin-right: 4px;
}

.valuation-amount {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    line-height: 1;
    letter-spacing: -0.02em;
}

.valuation-confidence {
    margin-bottom: 16px;
}

.confidence-label {
    display: block;
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 2px;
}

.confidence-range {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--muted);
}

.valuation-score-display {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.score-label {
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.score-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.score-max {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--muted);
}

/* Factor Breakdown */
.factors-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.factor-row {
    display: grid;
    grid-template-columns: 160px 1fr 50px;
    align-items: center;
    gap: 16px;
}

.factor-name {
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.factor-bar-container {
    height: 20px;
    background: var(--bg);
    border: 2px solid var(--border-strong);
    position: relative;
}

.factor-bar {
    height: 100%;
    width: var(--bar-width);
    background: var(--accent-primary);
    transition: width 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.factor-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    text-align: right;
    font-weight: 700;
}

/* History Chart */
.history-chart-container {
    width: 100%;
    overflow: hidden;
}

.history-chart {
    width: 100%;
    height: auto;
}

.chart-label {
    font-family: var(--font-mono);
    font-size: 10px;
    fill: var(--muted);
}

.chart-label-vert {
    font-family: var(--font-mono);
    font-size: 9px;
    fill: var(--muted);
}

/* Comparables */
.comparables-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comparable-item {
    padding: 12px;
    border: 2px solid var(--border-strong);
    background: var(--bg);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.comparable-item:hover {
    box-shadow: 2px 2px 0 var(--shadow-color);
    transform: translate(-1px, -1px);
}

.comparable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.comparable-name {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
}

.comparable-score {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 2px 8px;
    border: 2px solid var(--border-strong);
    background: var(--surface);
}

.comparable-score.positive {
    color: var(--positive);
}

.comparable-score.negative {
    color: var(--negative);
}

.comparable-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comparable-meta .mono-value {
    font-size: 0.8rem;
    color: var(--border-strong);
}

.comparable-tag {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Scatter Chart */
.scatter-container {
    width: 100%;
}

.scatter-chart {
    width: 100%;
    height: auto;
}

/* Range Indicator */
.range-indicator {
    padding: 8px 0;
}

.range-bar {
    position: relative;
    height: 24px;
    background: var(--bg);
    border: 2px solid var(--border-strong);
    margin-bottom: 8px;
}

.range-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--negative), var(--accent-secondary), var(--positive));
    width: 0%;
    transition: width 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.range-marker {
    position: absolute;
    top: -4px;
    width: 4px;
    height: calc(100% + 8px);
    background: var(--accent-primary);
    border: 2px solid var(--border-strong);
    left: 0%;
    transition: left 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

.range-current {
    font-weight: 700;
    color: var(--accent-primary);
}

/* Methodology */
.method-text {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--muted);
    margin-bottom: 8px;
}

.method-text:last-child {
    margin-bottom: 0;
    font-style: italic;
}

/* Footer */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--surface);
    border-top: 2px solid var(--border-strong);
}

.footer-text {
    font-size: 0.8rem;
    color: var(--muted);
    letter-spacing: 0.05em;
}

/* Responsive */
@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .col-left {
        border-right: none;
        border-bottom: 2px solid var(--border-strong);
    }

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

    .valuation-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .gauge-container {
        flex: 0 0 auto;
        width: 100%;
        max-width: 300px;
    }

    .factor-row {
        grid-template-columns: 120px 1fr 40px;
    }

    .top-bar {
        flex-direction: column;
        height: auto;
        padding: 12px 24px;
        gap: 8px;
    }
}
