/* ============================================
   BRISE | Serra do Japi — Design System v1
   ============================================ */

/* --- Reset & Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Base escura (hue 140°) */
    --bg-primary: #0b1a0f;
    --bg-secondary: #0f2214;
    --bg-elevated: #132a18;
    --bg-light: #162e1c;
    --text-primary: #e2ebe4;
    --text-secondary: #9ab5a3;
    --text-muted: #4a6b50;
    --accent: #a6e22e;
    --accent-soft: rgba(166, 226, 46, 0.12);
    --accent-glow: rgba(166, 226, 46, 0.06);
    --border: #1e3a24;
    --border-light: #2a4d32;

    /* Terracota (hue 20°) */
    --terra: hsl(20, 70%, 55%);
    --terra-soft: hsla(20, 70%, 55%, 0.12);
    --terra-glow: hsla(20, 70%, 55%, 0.25);
    --terra-muted: hsl(20, 18%, 35%);
    --terra-border: hsl(20, 32%, 17%);
    --terra-border-light: hsl(20, 30%, 23%);

    /* Fonts */
    --font-logo: 'Montserrat Alternates', sans-serif;
    --font-display: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-body: 'IBM Plex Sans', sans-serif;
}

::selection {
    background: var(--accent-soft);
    color: #ffffff;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 300;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* --- Nav --- */
nav {
    background: rgba(11, 26, 15, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    transition: padding 300ms ease, background 300ms ease;
}

nav .logo-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

nav .logo {
    font-family: var(--font-logo);
    font-size: 1.56rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    color: var(--accent);
    text-decoration: none;
}

nav .logo-divider {
    width: 1px;
    height: 24px;
    background: var(--border-light);
}

nav .logo-subtitle {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

nav .tagline {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-muted);
}

nav .tagline .cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: var(--accent);
    margin-left: 2px;
    vertical-align: middle;
    animation: blink 1s step-end infinite;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

nav ul li a {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 300ms ease;
}

nav ul li a:hover,
nav ul li a.active {
    color: var(--accent);
}

@keyframes blink {
    50% { opacity: 0; }
}

/* --- Page Header --- */
.page-header {
    margin-top: 61px;
    padding: 120px 40px 80px;
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cline x1='39' y1='45' x2='51' y2='45' stroke='%23e2ebe4' stroke-width='1.2'/%3E%3Cline x1='45' y1='39' x2='45' y2='51' stroke='%23e2ebe4' stroke-width='1.2'/%3E%3C/svg%3E");
    background-size: 90px 90px;
    opacity: 0.06;
    pointer-events: none;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.15rem);
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    position: relative;
}

.page-header h1 strong {
    font-weight: 600;
    color: var(--accent);
}

.page-header .subtitle {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 300;
    color: var(--text-muted);
    max-width: 640px;
    position: relative;
}

/* --- Section Label --- */
.section-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 1rem;
}

.section-label::before {
    content: '// ';
    color: var(--text-muted);
}

/* --- Container --- */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 40px;
}

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

/* --- Section --- */
.section {
    padding: 80px 0;
    border-bottom: 1px solid var(--border);
}

.section:last-child {
    border-bottom: none;
}

/* --- Section Title (h2) --- */
h2 {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* --- Paragraphs --- */
p {
    margin-bottom: 20px;
    line-height: 1.85;
    font-size: 1rem;
    color: var(--text-secondary);
    text-align: left;
}

p:last-child { margin-bottom: 0; }

/* --- Links --- */
a { color: var(--accent); }

/* --- Card --- */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 32px;
    transition: border-color 300ms ease;
}

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

.card.accent-top {
    border-top: 2px solid var(--accent);
}

.card.terra-top {
    border-top: 2px solid var(--terra);
}

.card h4 {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 0.8rem;
}

.card.terra-top h4 {
    color: var(--terra);
}

.card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 24px;
    text-align: center;
}

.stat-card .number {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-card .label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.stat-card.accent {
    border-color: var(--accent);
}

.stat-card.accent .number {
    color: var(--accent);
}

.stat-card.terra {
    border-color: var(--terra);
}

.stat-card.terra .number {
    color: var(--terra);
}

/* --- Highlight Box --- */
.highlight-box {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    padding: 24px 32px;
    margin: 32px 0;
}

.highlight-box p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.highlight-box strong {
    color: var(--accent);
    font-weight: 500;
}

.highlight-box.terra {
    background: var(--terra-soft);
    border-left-color: var(--terra);
}

.highlight-box.terra strong {
    color: var(--terra);
}

/* --- Method / Card Grid --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

.card-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
    .card-grid-3 { grid-template-columns: 1fr; }
}

/* --- Tech Tag --- */
.tech-tag {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    margin: 2px 4px 2px 0;
}

/* --- Top List (Ranking) --- */
.top-list { margin: 32px 0; }

.top-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.top-rank {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.top-info { flex: 1; }

.top-info .name {
    font-family: var(--font-display);
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.top-info .detail {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.top-vol {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--accent);
    font-size: 0.85rem;
    text-align: right;
    min-width: 120px;
}

/* --- Quote --- */
.quote {
    font-style: italic;
    color: var(--text-muted);
    padding: 24px 32px;
    border-left: 2px solid var(--border-light);
    margin: 32px 0;
    font-size: 0.95rem;
    line-height: 1.7;
}

.quote .source {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: normal;
    display: block;
    margin-top: 8px;
}

/* --- List --- */
.brise-list {
    list-style: none;
    padding: 0;
    margin: 24px 0;
}

.brise-list li {
    padding: 10px 0 10px 20px;
    position: relative;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    line-height: 1.7;
}

.brise-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 18px;
    width: 6px;
    height: 6px;
    background: var(--accent);
}

/* --- Table --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
}

th {
    background: var(--bg-elevated);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

tr:hover td {
    background: var(--bg-secondary);
}

/* --- Map Section (images) --- */
.map-section {
    margin: 32px 0;
}

.map-section img {
    width: 100%;
    border: 1px solid var(--border);
    transition: opacity 300ms ease;
}

.map-section img:hover {
    opacity: 0.92;
}

.map-caption {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* --- Map Embed (iframe) --- */
.map-embed {
    margin: 32px 0;
}

.map-embed iframe {
    width: 100%;
    height: 520px;
    border: 1px solid var(--border);
    background: var(--bg);
}

.map-embed .map-caption a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 200ms ease;
}

.map-embed .map-caption a:hover {
    border-bottom-color: var(--accent);
}

/* --- Image (full width) --- */
.full-img {
    width: 100%;
    border: 1px solid var(--border);
    margin: 24px 0;
}

.img-caption {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 8px;
    letter-spacing: 0.04em;
}

/* --- Sensor Gallery --- */
.sensor-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

.sensor-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: border-color 300ms ease;
}

.sensor-card:hover {
    border-color: var(--accent);
}

.sensor-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

.sensor-card .info {
    padding: 20px;
}

.sensor-card .info h4 {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 8px;
}

.sensor-card .info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0 0 8px;
    text-align: left;
}

/* --- Flow Steps (Pipeline) --- */
.flow-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 32px 0;
}

.flow-step {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 24px 20px;
    text-align: center;
    flex: 1;
    min-width: 160px;
    position: relative;
}

.flow-step .num {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.flow-step .title {
    font-family: var(--font-display);
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.flow-step .desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* --- Anon Section --- */
.anon-section {
    background: var(--bg-secondary);
    border: 1px solid var(--terra-border);
    padding: 32px;
    margin: 32px 0;
}

.anon-section h3 {
    color: var(--terra);
}

.anon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.anon-stat {
    text-align: center;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--terra-border);
}

.anon-stat .num {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--terra);
}

.anon-stat .lbl {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--terra-muted);
    margin-top: 4px;
}

/* --- Two Columns --- */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin: 32px 0;
}

@media (max-width: 768px) {
    .two-col { grid-template-columns: 1fr; }
}

/* --- Area Stats --- */
.area-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 32px 0;
}

.area-stat {
    text-align: center;
    padding: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
}

.area-stat .val {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent);
}

.area-stat .lbl {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Hero section --- */
.hero {
    margin-top: 61px;
    background: var(--bg-secondary);
    padding: 120px 40px 80px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cline x1='39' y1='45' x2='51' y2='45' stroke='%23e2ebe4' stroke-width='1.2'/%3E%3Cline x1='45' y1='39' x2='45' y2='51' stroke='%23e2ebe4' stroke-width='1.2'/%3E%3C/svg%3E");
    background-size: 90px 90px;
    opacity: 0.04;
    pointer-events: none;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 7vw, 4rem);
    font-weight: 300;
    margin-bottom: 1rem;
    position: relative;
    color: var(--text-primary);
}

.hero h1 strong {
    font-weight: 600;
    color: var(--accent);
}

.hero p {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 680px;
    margin: 0 auto;
    line-height: 1.7;
    position: relative;
    text-align: center;
}

/* --- Stat Cards Detail (Consumidores) --- */
.stat-card-detail {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 24px;
}

.stat-card-detail h4 {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 12px;
}

.stat-card-detail .rank {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}

.stat-card-detail .rank .name {
    color: var(--text-secondary);
    max-width: 65%;
}

.stat-card-detail .rank .val {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

/* --- Methodology box --- */
.methodology-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 24px 32px;
    margin: 32px 0;
    line-height: 1.7;
    font-size: 0.9rem;
}

.methodology-box h3 {
    margin-bottom: 12px;
}

.methodology-box code {
    background: var(--bg-elevated);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 2px 8px;
}

/* --- Code --- */
code {
    background: var(--bg-elevated);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 2px 6px;
}

/* --- Section Divider --- */
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--terra), transparent);
    opacity: 0.4;
    margin: 0;
}

/* --- Chart section --- */
.chart-section {
    margin: 32px 0;
}

.chart-section img {
    width: 100%;
    border: 1px solid var(--border);
}

.chart-caption {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 12px;
    letter-spacing: 0.04em;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 40px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 80px;
}

/* --- Dispensa Section Stats --- */
.dispensa-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

.dispensa-stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 24px;
    text-align: center;
}

.dispensa-stat .number {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent);
}

.dispensa-stat .label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* --- Lightbox (fullscreen image modal) --- */
.img-zoomable {
    cursor: zoom-in;
    position: relative;
}

.img-zoomable::after {
    content: '⤢';
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--accent);
    font-size: 1rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 300ms ease;
    pointer-events: none;
}

.img-zoomable:hover::after {
    opacity: 1;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(11, 26, 15, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    opacity: 0;
    visibility: hidden;
    transition: opacity 300ms ease, visibility 300ms ease;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-overlay img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border: 1px solid var(--border);
    transition: transform 300ms ease;
}

.lightbox-close {
    position: absolute;
    top: 24px;
    right: 32px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 16px;
    cursor: pointer;
    transition: color 300ms ease, border-color 300ms ease;
}

.lightbox-close:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* --- Responsive Nav --- */
@media (max-width: 900px) {
    nav {
        padding: 16px 24px;
        flex-wrap: wrap;
        gap: 8px;
    }
    nav .logo-subtitle { display: none; }
    nav .tagline { display: none; }
    nav ul { gap: 1rem; }
    nav ul li a { font-size: 0.68rem; }
    .page-header { padding: 100px 24px 60px; }
    .hero { padding: 100px 24px 60px; }
}
