/* Crate — beige ground, the current cover bleeding through as a soft wash, one card at a time. */

@font-face {
  font-family: 'Bricolage';
  src: url('../fonts/bricolage.woff2') format('woff2');
  font-weight: 300 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #F6F1EA;
  --ink: #2A241E;
  --ink-2: #544A40;
  --muted: #72675B;
  --line: rgba(42, 36, 30, .09);
  --glass: rgba(255, 255, 255, .5);
  --glass-hi: rgba(255, 255, 255, .74);
  --glass-edge: rgba(255, 255, 255, .72);
  --blur: 26px;
  --shadow: 0 1px 2px rgba(60, 44, 28, .05), 0 14px 34px rgba(60, 44, 28, .09);
  --shadow-lift: 0 2px 6px rgba(60, 44, 28, .07), 0 26px 56px rgba(60, 44, 28, .16);
  --accent: #C8663A;
  --accent-ink: #A64B22;
  --accent-soft: rgba(200, 102, 58, .16);
  --keep: #3A7236;
  --display: 'Bricolage', ui-rounded, -apple-system, system-ui, sans-serif;
  --text: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --card-w: min(calc(100vw - 32px), 400px, calc((100dvh - 300px) * .82));
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  overscroll-behavior: none;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100dvh;
}
::selection { background: var(--accent-soft); color: var(--ink); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-underline-offset: .2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
.num { font-variant-numeric: tabular-nums; }
svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.fill { fill: currentColor; stroke: none; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  box-shadow: inset 0 0 0 1px var(--glass-edge), var(--shadow);
}

/* ---------- the wash: the current cover, out of focus, behind everything ---------- */

.wash { position: fixed; inset: -12%; z-index: -1; pointer-events: none; }
.wash .w {
  position: absolute; inset: 0;
  background: center / cover no-repeat;
  filter: blur(70px) saturate(1.25);
  opacity: 0; transform: scale(1.15);
  transition: opacity 1.1s var(--ease), transform 1.6s var(--ease);
}
.wash .w.on { opacity: .42; transform: scale(1); }
.wash::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(246, 241, 234, .25), rgba(246, 241, 234, .7)); }

/* ---------- header ---------- */

.head {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-t) + 14px) 20px 6px;
}
.mark { font: 700 23px/1 var(--display); letter-spacing: -.03em; }
.liked {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 15px 0 12px;
  border-radius: 99px; font-weight: 600; font-size: 15px;
  transition: transform .5s var(--ease);
}
.liked svg { width: 18px; height: 18px; color: var(--accent); }
.liked:active { transform: scale(.94); }
.moodchip {
  height: 32px; padding: 0 13px; border-radius: 99px; font-size: 14px; font-weight: 600; color: var(--ink-2);
  transition: transform .5s var(--ease);
}
.moodchip:empty { display: none; }
.moodchip:active { transform: scale(.94); }
.liked.bump svg { animation: bump .6s var(--ease-out); }
@keyframes bump { 30% { transform: scale(1.45); } }

/* ---------- the stack ---------- */

.stage { position: relative; z-index: 1; display: grid; place-items: center; min-height: 0; }
.card {
  grid-area: 1 / 1;
  width: var(--card-w);
  border-radius: 32px; padding: 12px 12px 18px;
  touch-action: none; user-select: none; -webkit-user-select: none;
  transform-origin: 50% 90%;
  will-change: transform;
  background: rgba(251, 248, 243, .94);   /* frosted look, but the card behind must not read through */
}
.card.back {
  --p: 0;
  transform: translateY(calc(16px - 16px * var(--p))) scale(calc(.93 + .07 * var(--p)));
  opacity: calc(.6 + .4 * var(--p));
  transition: transform .3s var(--ease-out), opacity .3s var(--ease-out);
}
.card.top { transition: transform .6s var(--ease), opacity .6s var(--ease), scale .35s var(--ease-out), box-shadow .35s var(--ease-out); }
/* while a finger or the physics drives it, only the lift animates */
.card.held, .card.phys, .card.gone { transition: scale .35s var(--ease-out), box-shadow .35s var(--ease-out); }
.card.held { scale: 1.03; cursor: grabbing; box-shadow: inset 0 0 0 1px var(--glass-edge), var(--shadow-lift); }
.card.enter { animation: rise .7s var(--ease-out) both; }
@keyframes rise { from { transform: translateY(34px) scale(.92); opacity: 0; } }

.cover { position: relative; aspect-ratio: 1; border-radius: 22px; overflow: hidden; background: var(--accent-soft); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .35); }
.bar i { display: block; height: 100%; width: 100%; background: #fff; transform-origin: left; transform: scaleX(0); }

.stamp {
  position: absolute; top: 24px; padding: 8px 16px 7px; border-radius: 14px;
  font: 800 34px/1 var(--display); letter-spacing: .01em; text-transform: uppercase;
  background: rgba(255, 255, 255, .9); border: 3.5px solid currentColor;
  opacity: var(--s, 0); pointer-events: none;
}
.stamp.add { left: 22px; color: var(--keep); transform: rotate(-12deg) scale(calc(.7 + .3 * var(--s, 0))); }
.stamp.skip { right: 22px; color: var(--ink-2); transform: rotate(12deg) scale(calc(.7 + .3 * var(--s, 0))); }

.flyheart { position: fixed; left: 0; top: 0; z-index: 8; width: 44px; height: 44px; color: var(--accent); pointer-events: none; }
.flyheart svg { width: 44px; height: 44px; filter: drop-shadow(0 6px 10px rgba(166, 75, 34, .28)); }

.meta { padding: 16px 8px 0; }
.title {
  font: 700 25px/1.08 var(--display); letter-spacing: -.025em; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-wrap: balance;
}
.artist { font-size: 17px; color: var(--ink-2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.why { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; color: var(--muted); min-height: 20px; }
.why b { font-weight: 600; color: var(--ink-2); }
.e { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 4px; background: rgba(42, 36, 30, .14); color: var(--ink-2); font-size: 10.5px; font-weight: 700; }

/* placeholder while the first cards load */
.card.wait .cover { animation: breathe 1.6s ease-in-out infinite alternate; }
.card.wait .ln { height: 16px; border-radius: 8px; background: rgba(42, 36, 30, .08); margin-top: 12px; }
.card.wait .ln:first-child { width: 72%; height: 24px; margin-top: 0; }
.card.wait .ln:nth-child(2) { width: 44%; }
@keyframes breathe { to { opacity: .55; } }

.msg { text-align: center; padding: 0 32px; color: var(--ink-2); }
.msg strong { display: block; font: 700 22px/1.15 var(--display); color: var(--ink); margin-bottom: 6px; letter-spacing: -.02em; }
.msg button { margin-top: 16px; height: 44px; padding: 0 22px; border-radius: 99px; background: var(--ink); color: #FFF8EF; font-weight: 600; }

/* ---------- controls ---------- */

.controls {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 10px 20px calc(var(--safe-b) + 22px);
}
.btn { display: grid; place-items: center; border-radius: 50%; transition: transform .45s var(--ease), opacity .3s; }
.btn:active:not(:disabled) { transform: scale(.9); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.sm { width: 46px; height: 46px; color: var(--ink-2); }
.btn.sm svg { width: 20px; height: 20px; }
.btn.md { width: 58px; height: 58px; }
.btn.lg { width: 70px; height: 70px; }
.btn.lg svg { width: 28px; height: 28px; }
.btn.like { background: var(--accent); color: #FFF8EF; box-shadow: 0 2px 4px rgba(166, 75, 34, .2), 0 14px 30px rgba(166, 75, 34, .26); }
.btn.spacer { visibility: hidden; }
#likeBtn { scale: calc(1 + .16 * var(--add, 0)); }
#skipBtn { scale: calc(1 + .16 * var(--skip, 0)); }
body:not(.live) #likeBtn, body:not(.live) #skipBtn { transition: transform .45s var(--ease), scale .45s var(--ease); }

/* ---------- the verdict: the whole screen leans toward Add or Skip as you drag ---------- */

.verdict { position: fixed; inset: 0; z-index: 0; pointer-events: none; transition: opacity .55s var(--ease); }
body.live .verdict { transition: none; }
.verdict.add {
  opacity: var(--add, 0);
  background: linear-gradient(270deg, rgba(78, 143, 74, .8), rgba(78, 143, 74, .44) 40%, rgba(78, 143, 74, .2) 75%, rgba(78, 143, 74, .1));
}
.verdict.skip {
  opacity: var(--skip, 0);
  background: linear-gradient(90deg, rgba(42, 36, 30, .66), rgba(42, 36, 30, .32) 40%, rgba(42, 36, 30, .14) 75%, rgba(42, 36, 30, .07));
}
@media (hover: hover) {
  .btn:hover:not(:disabled) { transform: translateY(-2px); }
  .liked:hover { transform: translateY(-1px); }
}

/* ---------- mood picker ---------- */

.intro {
  position: fixed; inset: 0; z-index: 5; overflow-y: auto;
  display: flex; justify-content: center; align-items: center;
  padding: calc(var(--safe-t) + 28px) 18px calc(var(--safe-b) + 28px);
  background: rgba(246, 241, 234, .76);
  -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px);
  transition: opacity .6s var(--ease), visibility .6s;
}
.intro.gone { opacity: 0; visibility: hidden; }
.pick { width: 100%; max-width: 440px; margin: auto 0; }
.intro h1 { font: 700 clamp(52px, 16vw, 76px)/.9 var(--display); letter-spacing: -.045em; margin: 0; }
.intro p { color: var(--ink-2); margin: 10px 0 0; font-size: 15px; }
.intro h2 { font: 700 15px/1 var(--display); letter-spacing: -.01em; color: var(--muted); margin: 28px 2px 10px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile {
  --t: #2A241E;
  height: 64px; border-radius: 20px; padding: 0 14px;
  display: flex; align-items: flex-end; padding-bottom: 12px;
  font: 700 17px/1.1 var(--display); letter-spacing: -.015em; text-align: left;
  color: color-mix(in srgb, var(--t) 78%, #000);
  background: color-mix(in srgb, var(--t) 13%, rgba(255, 255, 255, .62));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7), 0 1px 2px rgba(60, 44, 28, .05), 0 8px 20px rgba(60, 44, 28, .06);
  transition: transform .45s var(--ease), background .3s;
  opacity: 0; animation: tileIn .7s var(--ease-out) forwards; animation-delay: calc(var(--i) * 28ms + 120ms);
}
.tile:active { transform: scale(.95); }
@media (hover: hover) { .tile:hover { background: color-mix(in srgb, var(--t) 20%, rgba(255, 255, 255, .7)); } }
@keyframes tileIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.tile.any {
  grid-column: 1 / -1; height: 56px; margin-top: 22px; align-items: center; justify-content: center; padding: 0;
  background: var(--ink); color: #FFF8EF; font-size: 17px;
  box-shadow: 0 2px 4px rgba(42, 36, 30, .12), 0 14px 30px rgba(42, 36, 30, .18);
}
.tile.on { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--t) 70%, #000), 0 8px 20px rgba(60, 44, 28, .08); }

/* ---------- liked sheet ---------- */

.scrim { position: fixed; inset: 0; z-index: 6; background: rgba(42, 36, 30, .18); opacity: 0; transition: opacity .5s var(--ease); }
.scrim.on { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 7;
  max-height: 82dvh; display: flex; flex-direction: column;
  padding: 10px 0 calc(var(--safe-b) + 12px);
  border-radius: 30px 30px 0 0;
  background: rgba(248, 244, 238, .86);
  -webkit-backdrop-filter: blur(30px) saturate(1.4); backdrop-filter: blur(30px) saturate(1.4);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 -10px 40px rgba(60, 44, 28, .12);
  transform: translateY(100%); transition: transform .55s var(--ease);
}
.sheet.on { transform: none; }
@media (min-width: 640px) { .sheet { left: 50%; right: auto; width: 520px; margin-left: -260px; } }
.grab { width: 38px; height: 5px; border-radius: 3px; background: rgba(42, 36, 30, .18); margin: 0 auto 12px; }
.sheet h2 { font: 700 24px/1 var(--display); letter-spacing: -.025em; margin: 4px 20px 10px; }
.sheet h2 span { color: var(--muted); font-weight: 500; }
.rows { list-style: none; margin: 0; padding: 0 12px; overflow-y: auto; overscroll-behavior: contain; }
.row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 16px; }
.row + .row { border-top: 1px solid var(--line); border-radius: 0; }
.row img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; background: var(--accent-soft); }
.row .t { flex: 1; min-width: 0; }
.row .t b, .row .t span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t b { font-weight: 600; font-size: 15.5px; }
.row .t span { font-size: 13.5px; color: var(--ink-2); }
.am {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 13px; border-radius: 99px;
  font-size: 13.5px; font-weight: 600; text-decoration: none;
  background: var(--ink); color: #FFF8EF; transition: transform .4s var(--ease);
}
.am:active { transform: scale(.94); }
.am svg { width: 15px; height: 15px; }
.am.off { background: none; color: var(--muted); font-weight: 500; padding: 0 4px; }
.am.done { background: none; color: var(--keep); padding: 0 4px; gap: 5px; }
.am.done svg { width: 17px; height: 17px; stroke-width: 2.4; }
.none { color: var(--muted); text-align: center; padding: 18px 24px 26px; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
