/* tanso.day — daily carbon awareness
   Palette:
     #fafafa  Clean       (background)
     #1a1a1a  Carbon      (primary number / text)
     #ef4444  Trend Red   (upward / bad)
     #22c55e  Trend Green (downward / good)
     #9ca3af  Muted       (secondary text)
     #3b82f6  Accent      (links, sparkline)
     #e5e7eb  Hairline    (borders)

   Fonts:
     Space Grotesk  display / number
     Space Mono     data
     Inter          body
*/

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

html, body {
    height: 100%;
}

body {
    background: #fafafa;
    color: #1a1a1a;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

sub {
    font-size: 0.7em;
    line-height: 0;
    vertical-align: baseline;
    position: relative;
    bottom: -0.25em;
}

/* ---------------------------------------------------------------- */
/* Page shell                                                        */
/* ---------------------------------------------------------------- */

.page {
    max-width: 600px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 4.5rem;
    min-height: 100%;
}

/* ---------------------------------------------------------------- */
/* Masthead                                                          */
/* ---------------------------------------------------------------- */

.masthead {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1.25rem;
}

.brand {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand-mark {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
    color: #1a1a1a;
}

.brand-dot {
    color: #22c55e;
}

.brand-tag {
    font-family: "Space Mono", monospace;
    font-size: 0.75rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.meta-strip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-family: "Space Mono", monospace;
    font-size: 0.75rem;
    color: #9ca3af;
    letter-spacing: 0.04em;
}

.meta-sep {
    color: #e5e7eb;
}

/* ---------------------------------------------------------------- */
/* Hero — single number                                              */
/* ---------------------------------------------------------------- */

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    padding: 1.5rem 0 0.5rem;
}

.hero-label {
    font-family: "Space Mono", monospace;
    font-size: 0.75rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.hero-number {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: nowrap;
    line-height: 0.95;
    margin: 0.5rem 0 0.25rem;
}

.num-value {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: -0.045em;
    color: #1a1a1a;
    font-variant-numeric: tabular-nums;
    transition: color 600ms ease;
}

.hero-number.is-up .num-value {
    color: #ef4444;
}

.hero-number.is-down .num-value {
    color: #22c55e;
}

.num-unit {
    font-family: "Space Mono", monospace;
    font-size: 0.875rem;
    color: #9ca3af;
    text-transform: lowercase;
    letter-spacing: 0.06em;
}

.hero-delta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: "Space Mono", monospace;
    font-size: 0.8rem;
    color: #9ca3af;
    letter-spacing: 0.04em;
}

.delta-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 1px solid currentColor;
    font-size: 0.7rem;
    line-height: 1;
}

.hero-delta.is-up {
    color: #ef4444;
}

.hero-delta.is-down {
    color: #22c55e;
}

.delta-value {
    font-weight: 700;
    color: inherit;
}

.delta-suffix {
    color: #9ca3af;
    letter-spacing: 0.02em;
}

.hero-context {
    font-family: "Space Mono", monospace;
    font-size: 0.75rem;
    color: #9ca3af;
    letter-spacing: 0.04em;
    max-width: 480px;
    line-height: 1.6;
}

/* ---------------------------------------------------------------- */
/* Insight                                                           */
/* ---------------------------------------------------------------- */

.insight {
    text-align: center;
}

.insight-text {
    font-size: 1rem;
    line-height: 1.7;
    color: #1a1a1a;
    max-width: 520px;
    margin: 0 auto;
}

.insight-text strong {
    font-weight: 500;
    color: #1a1a1a;
    border-bottom: 1px solid #e5e7eb;
}

/* ---------------------------------------------------------------- */
/* Sparkline                                                         */
/* ---------------------------------------------------------------- */

.chart {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: "Space Mono", monospace;
    font-size: 0.75rem;
    color: #9ca3af;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chart-range {
    color: #1a1a1a;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}

.chart-frame {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem 1.25rem 0.75rem;
    background: #fafafa;
}

.sparkline {
    display: block;
    width: 100%;
    height: 80px;
    overflow: visible;
}

.chart-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-family: "Space Mono", monospace;
    font-size: 0.7rem;
    color: #9ca3af;
    letter-spacing: 0.04em;
}

.chart-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 0.875rem;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: left;
}

.stat dt {
    font-family: "Space Mono", monospace;
    font-size: 0.65rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.stat dd {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: #1a1a1a;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.stat.is-up dd {
    color: #ef4444;
}

.stat.is-down dd {
    color: #22c55e;
}

/* ---------------------------------------------------------------- */
/* Action card                                                       */
/* ---------------------------------------------------------------- */

.action {
    display: flex;
    justify-content: center;
}

.action-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 480px;
    width: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.action-eyebrow {
    font-family: "Space Mono", monospace;
    font-size: 0.7rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.action-title {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #1a1a1a;
}

.action-body {
    font-size: 0.9375rem;
    line-height: 1.65;
    color: #1a1a1a;
}

.action-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
    padding-top: 0.875rem;
    border-top: 1px solid #e5e7eb;
}

.action-impact {
    font-family: "Space Mono", monospace;
    font-size: 0.875rem;
    font-weight: 700;
    color: #22c55e;
    letter-spacing: 0.02em;
}

.action-link {
    font-family: "Space Mono", monospace;
    font-size: 0.8rem;
    color: #3b82f6;
    text-decoration: none;
    letter-spacing: 0.04em;
    border-bottom: 1px solid transparent;
    transition: border-color 200ms ease;
}

.action-link:hover {
    border-bottom-color: #3b82f6;
}

/* ---------------------------------------------------------------- */
/* Reference ledger                                                  */
/* ---------------------------------------------------------------- */

.ledger {
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    padding: 1.25rem 0;
}

.ledger-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ledger-row {
    display: grid;
    grid-template-columns: 4rem 1fr;
    align-items: baseline;
    gap: 1rem;
    font-family: "Space Mono", monospace;
    font-size: 0.8rem;
    color: #9ca3af;
}

.ledger-key {
    font-weight: 700;
    color: #1a1a1a;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.ledger-val {
    color: #9ca3af;
    letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------- */
/* Footer                                                            */
/* ---------------------------------------------------------------- */

.foot {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 1rem;
}

.foot-line {
    font-family: "Space Mono", monospace;
    font-size: 0.7rem;
    color: #9ca3af;
    letter-spacing: 0.06em;
}

.foot-mono {
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9ca3af;
}

.foot-sep {
    color: #e5e7eb;
    margin: 0 0.5rem;
}

/* ---------------------------------------------------------------- */
/* Number reveal animation                                           */
/* ---------------------------------------------------------------- */

@keyframes tanso-fade-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page > * {
    animation: tanso-fade-in 700ms ease-out both;
}

.page > *:nth-child(1) { animation-delay: 0ms; }
.page > *:nth-child(2) { animation-delay: 80ms; }
.page > *:nth-child(3) { animation-delay: 160ms; }
.page > *:nth-child(4) { animation-delay: 240ms; }
.page > *:nth-child(5) { animation-delay: 320ms; }
.page > *:nth-child(6) { animation-delay: 400ms; }
.page > *:nth-child(7) { animation-delay: 480ms; }

/* ---------------------------------------------------------------- */
/* Responsive                                                        */
/* ---------------------------------------------------------------- */

@media (max-width: 480px) {
    .page {
        padding: 2rem 1.25rem 3rem;
        gap: 3.25rem;
    }

    .chart-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem 0.5rem;
    }

    .ledger-row {
        grid-template-columns: 3.25rem 1fr;
    }

    .num-unit {
        font-size: 0.75rem;
    }
}

/* ---------------------------------------------------------------- */
/* Reduced motion                                                    */
/* ---------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    .page > * {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
