/* Tapelogs web app. The Android app's dark theme: ink, paper and indigo, Bricolage Grotesque for
   headings and numbers, Hanken Grotesk for text, square tape-case corners. Built for a phone first;
   on a wide screen it is a centred column. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-grotesque-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/fonts/hanken-grotesk.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
}

:root {
  --bg: #262626;
  --raised: #1c1c1e;
  --surface-2: #2e2e30;
  --line: #3d3d40;
  --text: #f2f2f2;
  --text-2: #a9a9ac;
  --text-3: #7c7c80;
  --accent: #a09ee6;
  --accent-ink: #262626;
  --silver: #d8d9d7;
  --danger: #e6a09e;
  --radius: 2px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
  --nav-h: 64px;
  --top-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.boot {
  min-height: 100vh; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 24px; color: var(--text-3);
}

/* ---------- shell ---------- */
.shell { max-width: 640px; margin: 0 auto; min-height: 100vh; position: relative; }
.page { padding: calc(var(--top-h) + var(--safe-t) + 16px) 16px calc(var(--nav-h) + var(--safe-b) + 24px); }
.page.no-nav { padding-bottom: calc(var(--safe-b) + 32px); }
@media (min-width: 700px) {
  .shell { border-inline: 1px solid var(--line); }
}

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  padding-top: var(--safe-t);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 640px; margin: 0 auto; height: var(--top-h);
  display: flex; align-items: center; gap: 4px; padding: 0 8px 0 16px;
}
.topbar h1 {
  flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 600; font-size: 20px;
  letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .back { margin-left: -8px; }

.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: var(--radius);
  color: var(--text); position: relative;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 24px; height: 24px; }
.dot {
  position: absolute; top: 9px; right: 9px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  font-size: 10px; font-weight: 600; line-height: 16px; text-align: center;
}

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: var(--raised); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.bottomnav-inner { max-width: 640px; margin: 0 auto; display: flex; height: var(--nav-h); }
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-2); font-size: 11px; font-weight: 500;
}
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a.active { color: var(--accent); }

/* ---------- type ---------- */
.h-display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }
.h2 { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: -0.01em; }
.h3 { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.num { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 15px;
  transition: opacity 160ms var(--ease);
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--text-3); }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.link { color: var(--accent); font-weight: 500; }
.link-btn { color: var(--accent); font-weight: 500; font-size: 14px; padding: 8px 0; }

.field { display: block; margin-top: 16px; }
.field > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.input, .textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--raised); border: 1px solid var(--line); font-size: 16px;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); }
.textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.hint { font-size: 13px; color: var(--text-3); margin-top: 6px; }
.error { color: var(--danger); font-size: 14px; margin-top: 12px; }
.ok { color: var(--accent); font-size: 14px; margin-top: 12px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -16px -16px 16px; padding: 0 16px; }
.profile-tabs { margin-top: 24px !important; }
.tabs button {
  padding: 12px 12px; color: var(--text-2); font-weight: 600; font-size: 15px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

.switch-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.switch-row > div { flex: 1; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i {
  position: absolute; inset: 0; border-radius: 14px; background: var(--line); transition: background 160ms var(--ease);
  pointer-events: none;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--text); transition: transform 160ms var(--ease);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); background: var(--accent-ink); }

.search-box { position: relative; }
.search-box svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; color: var(--text-3); }
.search-box .input { padding-left: 44px; }

/* ---------- covers, avatars ---------- */
.cover {
  aspect-ratio: 1; width: 100%; background: var(--surface-2); border-radius: var(--radius);
  object-fit: cover; overflow: hidden;
}
.cover.ph { display: grid; place-items: center; color: var(--text-3); font-family: var(--font-display); font-size: 20px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--surface-2); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; color: var(--text-2);
}

/* ---------- wave rating ---------- */
.wave { display: inline-flex; align-items: center; gap: 8px; }
.wave svg { width: 52px; height: 12px; }
.wave .num { font-size: 15px; color: var(--accent); }

.w-track { stroke: var(--line); }
.w-fill { stroke: var(--accent); }
.full-review .clamp-3 { -webkit-line-clamp: unset; display: block; }
.rate-big { text-align: center; padding: 8px 0 4px; }
.rate-big .value { font-family: var(--font-display); font-weight: 600; font-size: 56px; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.rate-big .value.empty { color: var(--text-3); }
.rate-slider { position: relative; height: 56px; margin: 8px 0; touch-action: none; cursor: pointer; }
.rate-slider svg { width: 100%; height: 100%; display: block; }
.rate-slider input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; margin: 0; }

/* ---------- lists ---------- */
.card { padding: 16px 0; border-bottom: 1px solid var(--line); }
.card:last-child { border-bottom: 0; }
.review-head { display: flex; gap: 12px; align-items: center; }
.review-head .who { flex: 1; min-width: 0; }
.review-head .who b { font-weight: 600; font-size: 15px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review-album { display: flex; gap: 12px; margin-top: 12px; align-items: center; }
.review-album .cover { width: 56px; flex: none; }
.review-album .t { min-width: 0; }
.review-album .t b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review-body { margin-top: 10px; font-size: 15px; }
.review-actions { display: flex; align-items: center; gap: 4px; margin-top: 8px; margin-left: -10px; }
.review-actions button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; color: var(--text-2); font-size: 14px; }
.review-actions button.on { color: var(--accent); }
.review-actions svg { width: 20px; height: 20px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 6px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text-2); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (min-width: 520px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.tile { min-width: 0; }
.tile .t { margin-top: 6px; font-size: 13px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .a { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.row-link { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.row-link .grow { flex: 1; min-width: 0; }
.row-link .grow b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tracks li { list-style: none; display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.tracks li span:first-child { width: 24px; color: var(--text-3); text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.tracks li span:nth-child(2) { flex: 1; min-width: 0; }
.tracks li span:last-child { color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- album ---------- */
.album-hero { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: end; }
.album-hero h2 { font-family: var(--font-display); font-weight: 600; font-size: 24px; line-height: 1.15; letter-spacing: -0.015em; }
.album-hero .artist { color: var(--text-2); margin-top: 4px; }
@media (min-width: 520px) { .album-hero { grid-template-columns: 200px 1fr; } .album-hero h2 { font-size: 30px; } }
.stat-row { display: flex; gap: 24px; margin-top: 24px; padding: 16px 0; border-block: 1px solid var(--line); }
.stat .label { font-size: 12px; color: var(--text-2); }
.stat .value { font-family: var(--font-display); font-weight: 600; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat .value.accent { color: var(--accent); }
.histo { display: flex; align-items: flex-end; gap: 3px; height: 40px; flex: 1; }
.histo i { flex: 1; background: var(--accent); opacity: 0.85; min-height: 2px; border-radius: 1px; }

/* ---------- profile ---------- */
.banner { height: 120px; margin: -16px -16px 0; background: var(--surface-2) center/cover no-repeat; }
.profile-head { display: flex; align-items: flex-end; gap: 16px; margin-top: -36px; }
.profile-head .avatar { width: 84px; height: 84px; border: 3px solid var(--bg); font-size: 28px; }
.profile-head .actions { margin-left: auto; display: flex; gap: 8px; padding-bottom: 4px; }
.profile-name { margin-top: 12px; }
.profile-name h2 { font-family: var(--font-display); font-weight: 600; font-size: 24px; letter-spacing: -0.015em; line-height: 1.2; }
.counts { display: flex; gap: 20px; margin-top: 12px; font-size: 14px; color: var(--text-2); }
.counts button, .counts span { color: var(--text-2); font-size: 14px; }
.counts b { color: var(--text); font-family: var(--font-display); font-weight: 600; margin-right: 4px; }

/* ---------- sheets ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 160ms var(--ease);
}
.sheet {
  width: 100%; max-width: 640px; max-height: 88vh; overflow: auto;
  background: var(--raised); border-top: 1px solid var(--line);
  padding: 20px 16px calc(24px + var(--safe-b));
  animation: rise 220ms var(--ease);
}
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sheet-head h3 { flex: 1; font-family: var(--font-display); font-weight: 600; font-size: 20px; }
@media (min-width: 700px) {
  .scrim { align-items: center; }
  .sheet { border: 1px solid var(--line); max-height: 80vh; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .scrim, .sheet { animation: none; } }

.menu button, .menu a { display: block; width: 100%; text-align: left; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.menu button.danger, .menu a.danger { color: var(--danger); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); translate: -50% 0; z-index: 60;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  max-width: calc(100vw - 32px); animation: rise 200ms var(--ease);
}

/* ---------- states ---------- */
.empty { padding: 48px 8px; text-align: center; color: var(--text-2); }
.empty .h2 { color: var(--text); margin-bottom: 8px; }
.loading { padding: 48px 0; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- auth ---------- */
.auth { max-width: 400px; margin: 0 auto; padding: calc(48px + var(--safe-t)) 24px 48px; }
.auth .logo { font-family: var(--font-display); font-weight: 600; font-size: 40px; letter-spacing: -0.025em; line-height: 1; }
.auth .lead { margin-top: 12px; color: var(--text-2); font-size: 17px; }
.auth form { margin-top: 32px; }
.auth .btn.block { margin-top: 24px; }
.auth .alt { margin-top: 24px; text-align: center; font-size: 15px; color: var(--text-2); }
.auth .foot { margin-top: 48px; font-size: 13px; color: var(--text-3); text-align: center; }
.auth .foot a { color: var(--text-2); text-decoration: underline; }
