/* stats screens (webApp/.../web/stats/): Stats, the share sheet and Settings. Uses the tokens and components in app.css. */

.no-margin { margin: 0; }
.center { text-align: center; }
.row.baseline { align-items: baseline; }
.primary-text { color: var(--primary); }
.weak-text { color: var(--accent); }
.balanced-text { color: var(--pin); font-weight: 700; }
.title-strong { font-weight: 700; }
.divider-line { border-top: 1px solid var(--line); }

/* Hero: the colour block at the top, edged with dial ticks like the share cards. */
.stats-hero {
  position: relative; overflow: hidden;
  background: var(--block); color: var(--block-ink);
  border-radius: var(--radius); padding: 24px 20px;
}
.stats-hero::before, .stats-hero::after {
  content: ""; position: absolute; left: 0; right: 0; height: 6px;
  background: repeating-linear-gradient(90deg, transparent 0 4px, currentColor 4px 6px, transparent 6px 12px);
  opacity: .28;
}
.stats-hero::before { top: 8px; }
.stats-hero::after { bottom: 8px; }
.stats-hero-kicker { font-family: var(--mono); font-weight: 700; font-size: 12px; letter-spacing: .14em; opacity: .8; }
.stats-hero-title { margin: 6px 0; font-family: var(--display); font-weight: 800; font-stretch: 78%; font-size: clamp(34px, 7vw, 46px); line-height: .95; letter-spacing: -.005em; }
.stats-hero-title .figure { opacity: .62; }
.stats-hero-line { margin: 0; font-weight: 600; opacity: .9; }

/* Summary tiles: two by two on phones, one row on wide screens. */
.stats-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
@media (min-width: 900px) { .stats-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat-tile { display: grid; gap: 4px; padding: 14px; }
.stat-value { font-family: var(--mono); font-weight: 700; font-size: 26px; line-height: 1.1; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Sections: one column on phones, two on wide screens. */
.stats-sections { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 18px; }
@media (min-width: 1100px) { .stats-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stats-section { min-width: 0; }
.ranked-row { min-width: 0; }
.ranked-label { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Daily: day bars, the day's title and its summary. */
.daily-card { display: grid; gap: 12px; padding: 16px 0; }
.daily-card > .stack { padding: 0 16px; }
.day-bars { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 4px; scrollbar-width: none; scroll-behavior: smooth; }
.day-bars::-webkit-scrollbar { display: none; }
.day-bar { flex: 0 0 32px; display: grid; justify-items: center; gap: 4px; padding: 6px 0; border: 0; border-radius: 10px; background: none; cursor: pointer; color: var(--ink-3); }
.day-bar[aria-selected="true"] { background: var(--primary-wash); color: var(--primary); }
.day-bar-count { font-family: var(--mono); font-weight: 700; font-size: 12px; height: 16px; }
.day-bar-track { height: 64px; display: flex; align-items: flex-end; }
.day-bar-fill { width: 14px; border-radius: 5px; background: color-mix(in srgb, var(--primary) 55%, transparent); }
.day-bar-fill.zero { background: var(--card-2); }
.day-bar[aria-selected="true"] .day-bar-fill { background: var(--primary); }
.day-bar-day { font-size: 11px; font-weight: 600; }
.day-nav { padding: 0 8px; }
.day-nav .icon-btn:disabled { opacity: .35; cursor: default; }
.day-title { flex: 1; text-align: center; font-weight: 700; }
.day-headline { font-family: var(--display); font-weight: 800; font-stretch: 82%; font-size: 24px; line-height: 1.1; }

/* Taste: a split bar of weak, balanced and bitter. */
.taste-bar { display: flex; gap: 2px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--card-2); }
.taste-bar .seg { flex-basis: 0; }
.seg.weak, .legend-dot.weak { background: var(--accent); }
.seg.balanced, .legend-dot.balanced { background: var(--primary); }
.seg.bitter, .legend-dot.bitter { background: var(--ink-2); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Activity heatmap: a column per week, Monday at the top. */
.heatmap { display: grid; gap: 4px; }
.heat-week { display: grid; grid-template-rows: repeat(7, auto); gap: 4px; }
.heat-cell { display: block; aspect-ratio: 1; width: 100%; border: 0; padding: 0; border-radius: 4px; background: var(--card-2); cursor: pointer; }
.heat-cell.none { background: transparent; cursor: default; }
.heat-cell.l1 { background: color-mix(in srgb, var(--primary) 35%, var(--card-2)); }
.heat-cell.l2 { background: color-mix(in srgb, var(--primary) 70%, var(--card-2)); }
.heat-cell.l3 { background: var(--primary); }
.heat-cell.picked { outline: 2px solid var(--ink); outline-offset: 0; }
.heat-cell.legend { width: 12px; height: 12px; cursor: default; }
.heat-legend { gap: 6px; }

/* Ratings: weekly averages as bars. */
.rating-bars { display: flex; align-items: flex-end; gap: 4px; height: 60px; }
.rating-bar { flex: 1; border-radius: 3px; background: color-mix(in srgb, var(--accent) 85%, transparent); }
.rating-bar.zero { background: var(--card-2); }

/* Share sheet: a strip of 4:5 previews, each with a tick. */
.share-carousel { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 10px; }
.share-loading { width: 100%; padding: 60px 0; text-align: center; color: var(--ink-3); font-family: var(--script); font-style: italic; font-size: 20px; }
.share-slide { position: relative; flex: 0 0 min(78%, 320px); scroll-snap-align: center; cursor: pointer; border-radius: 18px; transition: opacity .15s ease, transform .15s ease; }
.share-slide img { display: block; width: 100%; aspect-ratio: 4 / 5; border-radius: 18px; border: 1px solid var(--line); box-shadow: 0 10px 24px -14px rgba(20, 30, 10, .45); }
.share-slide.off { opacity: .45; transform: scale(.97); }
.share-slide:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.share-tick { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; border: 2px solid #fff; background: rgba(20, 10, 4, .35); color: var(--button-ink); }
.share-slide:not(.off) .share-tick { background: var(--button-bg); border-color: var(--button-bg); }
.share-tick svg { width: 18px; height: 18px; }

/* Settings */
.settings .card .row .settings-icon, .settings .settings-icon { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-wash); color: var(--primary); }
.settings-icon svg { width: 22px; height: 22px; }
.settings .well svg { width: 20px; height: 20px; color: var(--primary); }
.sync-line { gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: 0 0 8px; }
.dot.ok { background: var(--pin); }
.dot.bad { background: var(--accent); }
.dot.busy { background: var(--primary); animation: sb-pulse 1s ease-in-out infinite alternate; }
@keyframes sb-pulse { from { opacity: .35; } to { opacity: 1; } }
.static-item { cursor: default !important; }
.static-item:hover { background: none !important; }
.settings-version { margin-top: 8px; }
.list > a.item { color: inherit; }
