/* graphers.dev - Dashboard Analytics Dark */
/* Palette: #0f172a, #1e293b, #3b82f6, #22c55e, #a855f7, #f1f5f9, #334155, #475569 */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #0f172a;
    color: #f1f5f9;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===================== HERO ZONE (0-100vh) ===================== */

.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(#334155 1px, transparent 1px),
        linear-gradient(90deg, #334155 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.08;
    pointer-events: none;
}

.brand {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 8vw, 4.5rem);
    color: #f1f5f9;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

.brand-dot {
    color: #3b82f6;
}

.gradient-accent {
    height: 3px;
    width: 140px;
    background: linear-gradient(to right, #3b82f6, #22c55e);
    margin: 1.2rem 0;
    border-radius: 2px;
    position: relative;
    z-index: 1;
}

.tagline {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: #94a3b8;
    letter-spacing: 0.02em;
    position: relative;
    z-index: 1;
}

/* Hero Line Chart */
.hero-chart {
    position: relative;
    width: min(400px, 80vw);
    height: 160px;
    margin-top: 3rem;
    z-index: 1;
}

.chart-axis-y {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    border-left: 1px dashed #334155;
}

.chart-axis-x {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    border-bottom: 1px dashed #334155;
}

.line-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.chart-line {
    fill: none;
    stroke: #3b82f6;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: drawLine 2s ease forwards 0.5s;
}

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

.chart-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #3b82f6;
    border-radius: 50%;
    transform: translate(-50%, 50%) scale(0);
    animation: dotAppear 0.3s ease forwards;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.chart-dot:nth-child(4) { animation-delay: 0.7s; }
.chart-dot:nth-child(5) { animation-delay: 0.95s; }
.chart-dot:nth-child(6) { animation-delay: 1.2s; }
.chart-dot:nth-child(7) { animation-delay: 1.45s; }
.chart-dot:nth-child(8) { animation-delay: 1.7s; }
.chart-dot:nth-child(9) { animation-delay: 1.95s; }
.chart-dot:nth-child(10) { animation-delay: 2.2s; }

@keyframes dotAppear {
    to { transform: translate(-50%, 50%) scale(1); }
}

.chart-y-label {
    position: absolute;
    left: -28px;
    font-family: 'Fira Code', monospace;
    font-size: 9px;
    color: #475569;
    transform: translateY(50%);
}

/* ===================== CHARTS SECTION (100-260vh) ===================== */

.charts {
    max-width: 900px;
    margin: 0 auto;
    padding: 6rem 1.5rem;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 2rem;
}

.panels-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

@media (max-width: 640px) {
    .panels-grid {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 8px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.panel:hover {
    border-color: #64748b;
}

.panel-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: #f1f5f9;
    margin-bottom: 1.25rem;
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    height: 180px;
    position: relative;
    padding-bottom: 24px;
}

.bar-grid-lines {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
    padding-bottom: 24px;
}

.grid-line {
    width: 100%;
    height: 1px;
    border-top: 1px dashed #334155;
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    position: relative;
    z-index: 1;
}

.v-bar {
    width: 100%;
    max-width: 36px;
    border-radius: 3px 3px 0 0;
    position: relative;
    overflow: hidden;
    height: 0;
    transition: height 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.v-bar.blue { background: #3b82f6; }
.v-bar.green { background: #22c55e; }
.v-bar.purple { background: #a855f7; }

.bar-fill {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, transparent, rgba(255,255,255,0.08));
}

.axis-label {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: #475569;
    margin-top: 6px;
    display: block;
    text-align: center;
}

/* Line Chart Panel */
.line-chart-panel {
    position: relative;
    height: 180px;
    padding-bottom: 24px;
}

.panel-line-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 24px);
}

.panel-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
}

.panel-line.blue-line { stroke: #3b82f6; }
.panel-line.green-line { stroke: #22c55e; }
.panel-line.purple-line { stroke: #a855f7; }

.panel-line.animate {
    animation: drawPanelLine 1.5s ease forwards;
}

@keyframes drawPanelLine {
    to { stroke-dashoffset: 0; }
}

.line-legend {
    display: flex;
    gap: 1rem;
    position: absolute;
    bottom: 0;
}

.legend-item {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-swatch {
    width: 8px;
    height: 3px;
    border-radius: 1px;
    display: inline-block;
}

.legend-swatch.blue { background: #3b82f6; }
.legend-swatch.green { background: #22c55e; }
.legend-swatch.purple { background: #a855f7; }

/* Scatter Plot */
.scatter-area {
    position: relative;
    height: 180px;
}

.scatter-grid {
    padding-bottom: 0;
}

.scatter-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scatter-dot.visible {
    transform: scale(1);
}

.scatter-dot.blue {
    background: #3b82f6;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.3);
}

.scatter-dot.green {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
}

.scatter-dot.purple {
    background: #a855f7;
    box-shadow: 0 0 6px rgba(168, 85, 247, 0.3);
}

/* Area Chart Panel */
.area-chart-panel {
    position: relative;
    height: 180px;
    padding-bottom: 0;
}

.panel-area-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.area-fill.blue-area {
    fill: url(#blueGrad);
    opacity: 0;
    transition: opacity 1s ease;
}

.area-fill.green-area {
    fill: url(#greenGrad);
    opacity: 0;
    transition: opacity 1s ease 0.3s;
}

.area-fill.animate {
    opacity: 1;
}

.area-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
}

.area-line.blue-area-line { stroke: #3b82f6; }
.area-line.green-area-line { stroke: #22c55e; }

.area-line.animate {
    animation: drawPanelLine 1.5s ease forwards;
}

/* ===================== METRICS STRIP (260-340vh) ===================== */

.metrics {
    max-width: 900px;
    margin: 0 auto;
    padding: 6rem 1.5rem;
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .stat-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stat-row {
        grid-template-columns: 1fr;
    }
}

.stat {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 8px;
    padding: 1.5rem;
    transition: border-color 0.3s ease, transform 0.2s ease;
}

.stat:hover {
    border-color: #64748b;
    transform: translateY(-2px);
}

.stat-val {
    font-family: 'Fira Code', monospace;
    font-size: 2rem;
    font-weight: 600;
    color: #f1f5f9;
    display: block;
    line-height: 1.1;
}

.stat-trend {
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 0.4rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.stat-trend.up {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.stat-trend.flat {
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
}

.trend-arrow {
    width: 12px;
    height: 12px;
}

.trend-arrow polyline,
.trend-arrow line {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.flat-arrow line {
    stroke: #94a3b8;
}

.stat-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    color: #475569;
    display: block;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-sparkline {
    margin-top: 0.75rem;
    height: 24px;
}

.stat-sparkline svg {
    width: 100%;
    height: 100%;
}

.sparkline {
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.blue-spark { stroke: #3b82f6; }
.green-spark { stroke: #22c55e; }
.purple-spark { stroke: #a855f7; }

/* ===================== CODE SECTION (340vh+) ===================== */

.code-section {
    max-width: 700px;
    margin: 0 auto;
    padding: 6rem 1.5rem;
}

.code-block {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 8px;
    overflow: hidden;
}

.code-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid #334155;
}

.code-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.code-dot.red { background: #ef4444; }
.code-dot.yellow { background: #eab308; }
.code-dot.green-dot { background: #22c55e; }

.code-filename {
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    color: #64748b;
    margin-left: 8px;
}

.code-text {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.9;
    padding: 1.5rem;
    display: block;
    white-space: pre;
    overflow-x: auto;
}

.code-keyword { color: #a855f7; }
.code-string { color: #22c55e; }
.code-fn { color: #3b82f6; }
.code-num { color: #f59e0b; }

.code-footer {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: #475569;
    text-align: center;
    margin-top: 3rem;
}

/* ===================== FOOTER ===================== */

.site-footer {
    padding: 4rem 1.5rem 2rem;
    text-align: center;
    position: relative;
}

.footer-gradient {
    width: 80px;
    height: 2px;
    background: linear-gradient(to right, #3b82f6, #22c55e);
    margin: 0 auto 1.5rem;
    border-radius: 1px;
}

.footer-text {
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    color: #334155;
}

/* ===================== ANIMATIONS ===================== */

.fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered fade delays */
.panels-grid .panel:nth-child(2).fade-in { transition-delay: 0.1s; }
.panels-grid .panel:nth-child(3).fade-in { transition-delay: 0.2s; }
.panels-grid .panel:nth-child(4).fade-in { transition-delay: 0.3s; }

.stat-row .stat:nth-child(2).fade-in { transition-delay: 0.1s; }
.stat-row .stat:nth-child(3).fade-in { transition-delay: 0.2s; }
.stat-row .stat:nth-child(4).fade-in { transition-delay: 0.3s; }
