/* ═══════════════════════════════════════════════════════
   CAÑITAS — pagina pubblica del gruppo
   Concept: "la cuenta" — il conto del bar, tenuto in diretta.
   Verde bottiglia, schiuma, cifre in ambra. Una colonna sola.
   ═══════════════════════════════════════════════════════ */

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

:root {
    --ground:    #10271f;
    --ground-up: #16332a;
    --foam:      #f3efe2;
    --foam-dim:  #a9b8ae;
    --amber:     #e8a13a;
    --amber-data:#c98500;
    --rule:      rgba(243, 239, 226, 0.14);
    --rule-soft: rgba(243, 239, 226, 0.07);

    --measure: 40rem;
    --step: clamp(1.75rem, 4vw, 2.75rem);
}

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

body {
    background: var(--ground);
    color: var(--foam);
    font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 1rem;
    line-height: 1.65;
    font-variant-numeric: tabular-nums;
    padding: clamp(1.25rem, 4vw, 3rem) 1.25rem clamp(3rem, 8vw, 5rem);
    min-height: 100vh;
}

.sheet {
    max-width: var(--measure);
    margin: 0 auto;
}

/* ── Testata ──────────────────────────────────────────── */
.masthead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--rule);
}

.wordmark {
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.wordmark .glass { color: var(--amber); }

.langs {
    display: flex;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.langs button {
    background: none;
    border: none;
    color: var(--foam-dim);
    font: inherit;
    cursor: pointer;
    padding: 0.125rem 0.25rem;
    border-radius: 2px;
    transition: color 0.15s;
}

.langs button:hover { color: var(--foam); }
.langs button[aria-pressed="true"] { color: var(--amber); font-weight: 600; }
.langs button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ── Il conto ─────────────────────────────────────────── */
.tab { margin-top: clamp(2rem, 6vw, 3.25rem); }

.tab-line {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.tab-line .what {
    font-size: 0.9375rem;
    color: var(--foam-dim);
    white-space: nowrap;
}

/* I puntini di guida sono la struttura: dicono "questo è un conto" */
.tab-line .leader {
    flex: 1;
    border-bottom: 1px dotted var(--rule);
    transform: translateY(-0.28em);
    min-width: 1.5rem;
}

.tab-line .amount {
    font-weight: 600;
    font-size: 1.0625rem;
    white-space: nowrap;
}

.tab-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.tab-total .count {
    font-size: clamp(3.25rem, 13vw, 5.5rem);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.035em;
    color: var(--amber);
    font-variant-numeric: tabular-nums;
}

.tab-total .count.bump { animation: bump 0.5s cubic-bezier(0.2, 0, 0.1, 1); }

@keyframes bump {
    0%   { transform: translateY(0.12em); opacity: 0.5; }
    100% { transform: translateY(0); opacity: 1; }
}

.tab-total .what {
    font-size: 0.9375rem;
    color: var(--foam-dim);
    max-width: 12rem;
    line-height: 1.35;
}

.tab-rule {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 0.875rem 0;
}

.tab-rule.heavy { border-top-width: 2px; border-color: var(--foam); opacity: 0.25; }

/* ── Barra di avanzamento ─────────────────────────────── */
.rail-wrap { margin-top: 1.75rem; }

.rail {
    height: 6px;
    background: var(--rule-soft);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.rail .fill {
    height: 100%;
    background: var(--amber);
    border-radius: 3px;
    min-width: 3px;
    transition: width 0.8s cubic-bezier(0.2, 0, 0.1, 1);
}

.rail.pulse::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--foam);
    opacity: 0;
    animation: sweep 0.9s ease-out;
}

@keyframes sweep {
    0%   { opacity: 0.35; transform: translateX(-100%); }
    100% { opacity: 0;    transform: translateX(100%); }
}

.rail-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.625rem;
    font-size: 0.8125rem;
    color: var(--foam-dim);
}

.livedot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--amber);
    margin-right: 0.4rem;
    vertical-align: 0.05em;
}

.livedot.on { animation: breathe 2.4s ease-in-out infinite; }
.livedot.off { background: var(--foam-dim); }

@keyframes breathe {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* ── Sezioni ──────────────────────────────────────────── */
.block { margin-top: clamp(2.5rem, 7vw, 3.75rem); }

.block > h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.875rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--rule);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.block > h2 .aside {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--foam-dim);
}

/* ── Classifica ───────────────────────────────────────── */
.rank { list-style: none; }

.rank li {
    display: flex;
    align-items: baseline;
    gap: 0.625rem;
    padding: 0.4375rem 0;
    border-bottom: 1px solid var(--rule-soft);
}

.rank li:last-child { border-bottom: none; }

.rank .pos {
    width: 1.5rem;
    color: var(--foam-dim);
    font-size: 0.875rem;
    flex: none;
}

.rank li:nth-child(-n+3) .pos { color: var(--amber); font-weight: 600; }

.rank .who {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.rank .leader {
    flex: 1;
    border-bottom: 1px dotted var(--rule);
    transform: translateY(-0.28em);
    min-width: 1rem;
}

.rank .n { font-weight: 600; flex: none; }
.rank .n small { color: var(--foam-dim); font-weight: 400; margin-left: 0.2rem; }

/* ── Grafico del ritmo ────────────────────────────────── */
.chart { margin-top: 0.25rem; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: var(--amber-data); }
.chart .bar:hover, .chart .bar:focus { fill: var(--amber); outline: none; }
.chart .base { stroke: var(--rule); stroke-width: 1; }
.chart .tick { fill: var(--foam-dim); font-size: 10px; }

.chart-tip {
    position: fixed;
    pointer-events: none;
    background: var(--ground-up);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    font-size: 0.8125rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.12s;
    z-index: 10;
}

.chart-tip.on { opacity: 1; }

details.numbers {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: var(--foam-dim);
}

details.numbers summary { cursor: pointer; }
details.numbers summary:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

details.numbers table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

details.numbers td {
    padding: 0.15rem 0;
    border-bottom: 1px solid var(--rule-soft);
}

details.numbers td:last-child { text-align: right; color: var(--foam); }

/* ── Ultime cañas ─────────────────────────────────────── */
.stream { list-style: none; }

.stream li {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.4375rem 0;
    border-bottom: 1px solid var(--rule-soft);
    font-size: 0.9375rem;
}

.stream li:last-child { border-bottom: none; }
.stream li.fresh { animation: land 0.6s ease-out; }

@keyframes land {
    0%   { background: rgba(232, 161, 58, 0.14); }
    100% { background: transparent; }
}

.stream .num { color: var(--amber); font-weight: 600; flex: none; min-width: 4.5rem; }
.stream .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream .plus { color: var(--foam-dim); flex: none; }
.stream .when { color: var(--foam-dim); font-size: 0.8125rem; flex: none; }

/* ── Come funziona ────────────────────────────────────── */
.explainer p {
    max-width: 34rem;
    margin-bottom: 0.75rem;
    color: var(--foam);
}

.explainer p:last-child { margin-bottom: 0; }
.explainer .quiet { color: var(--foam-dim); font-size: 0.9375rem; }

.steps {
    list-style: none;
    counter-reset: step;
    margin: 1rem 0;
}

.steps li {
    counter-increment: step;
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--rule-soft);
}

.steps li::before {
    content: counter(step);
    color: var(--amber);
    font-weight: 600;
    flex: none;
    width: 1.25rem;
}

.foot {
    margin-top: clamp(2.5rem, 7vw, 3.75rem);
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
    font-size: 0.8125rem;
    color: var(--foam-dim);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.empty { color: var(--foam-dim); padding: 1rem 0; }

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