/* Coffee log page. Builds on /styles.css (tokens, nav, hero, filters, footer). */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.coffee { padding-top: clamp(40px, 6vw, 80px); }

/* Stats strip */
.coffee-stats {
  margin: 0 0 clamp(36px, 5vw, 56px);
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-block: 1px solid var(--rule);
}
.coffee-stats > div { padding: 22px 20px 22px 0; }
.coffee-stats > div + div { border-left: 1px solid var(--rule); padding-left: 20px; }
.coffee-stats dt { font-size: 13px; color: var(--grey-3); margin-bottom: 6px; }
.coffee-stats dd { margin: 0; font-size: clamp(24px, 2.6vw, 36px); letter-spacing: -0.03em; line-height: 1.1; }

/* Controls */
.coffee-controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.coffee-controls .filters { margin: 0; }
.coffee-controls__right { display: flex; gap: 10px; flex-wrap: wrap; }
.coffee-search input, .coffee-sort select {
  font: inherit; font-size: 14px; color: var(--ink);
  background: transparent; border: 1px solid var(--rule); border-radius: 999px;
  padding: 8px 16px; outline: none; transition: border-color .2s;
}
.coffee-search input { width: min(280px, 70vw); }
.coffee-search input:focus, .coffee-sort select:focus { border-color: var(--ink); }
.coffee-sort select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat; }
.coffee-count { font-size: 13px; color: var(--grey-3); margin: 0 0 22px; }
.coffee-empty { color: var(--grey-4); padding: 40px 0; }

/* Grid + cards */
.coffee-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 2.5vw, 36px); }
.coffee-card {
  display: flex; flex-direction: column; gap: 10px;
  opacity: 0; transform: translateY(18px);
  animation: coffee-in .7s cubic-bezier(.2,.7,.2,1) forwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}
@keyframes coffee-in { to { opacity: 1; transform: none; } }

.coffee-card__art {
  position: relative; aspect-ratio: 4 / 5; border-radius: 4px; overflow: hidden;
  background: var(--grey-1); display: flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
}
/* Illustrated bag (coffee-art.js), drawn in the bag's real colours. Greyscale at
   rest like the rest of the site; full colour on hover/focus (or tap on phones). */
.coffee-art {
  width: 100%; height: 100%; display: block;
  filter: grayscale(1) contrast(1.05);
  transition: transform .9s cubic-bezier(.2,.7,.2,1), filter .6s ease;
}
.coffee-card:hover .coffee-art,
.coffee-card:focus-visible .coffee-art { transform: translateY(-6px) rotate(-1.5deg); filter: none; }
.coffee-card__badge {
  position: absolute; top: 12px; left: 12px;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 999px; padding: 4px 10px; color: var(--grey-4);
}

.coffee-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.coffee-card__roaster { font-size: 13px; color: var(--grey-3); }
.coffee-card__name { font-size: clamp(22px, 2vw, 28px); letter-spacing: -0.025em; line-height: 1.1; margin-top: 2px; }
.coffee-card__rating { margin: 0; white-space: nowrap; }
.coffee-card__rating span { font-family: var(--serif); font-style: italic; font-size: clamp(30px, 3vw, 40px); line-height: 1; }
.coffee-card__rating small { font-size: 13px; color: var(--grey-3); margin-left: 2px; }
.coffee-card__meta { margin: 0; font-size: 14px; color: var(--grey-4); }
.coffee-card__notes { margin: 0; font-size: 15px; color: var(--grey-4); }
.coffee-card__more { font-size: 14px; margin-top: 2px; }

/* Roast: 10 ticks, light → dark */
.roast { display: flex; align-items: center; gap: 12px; }
.roast__label { font-size: 13px; color: var(--grey-4); min-width: 92px; }
.roast__track { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; flex: 1; max-width: 220px; }
.roast__track i { height: 6px; border-radius: 2px; background: var(--grey-1); border: 1px solid var(--rule); }
.roast__track i.is-on { border-color: transparent; }
.roast__track i.is-on:nth-child(1)  { background: #c9c9c5; }
.roast__track i.is-on:nth-child(2)  { background: #b8b8b4; }
.roast__track i.is-on:nth-child(3)  { background: #a6a6a2; }
.roast__track i.is-on:nth-child(4)  { background: #939390; }
.roast__track i.is-on:nth-child(5)  { background: #7f7f7c; }
.roast__track i.is-on:nth-child(6)  { background: #6a6a67; }
.roast__track i.is-on:nth-child(7)  { background: #555552; }
.roast__track i.is-on:nth-child(8)  { background: #40403e; }
.roast__track i.is-on:nth-child(9)  { background: #2a2a29; }
.roast__track i.is-on:nth-child(10) { background: #0d0d0d; }

@media (min-width: 1300px) { .coffee-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1000px) { .coffee-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) {
  .coffee-grid { grid-template-columns: 1fr; }
  .coffee-stats { grid-template-columns: repeat(2, 1fr); }
  .coffee-stats > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .coffee-stats > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  /* phones: search on its own full-width row, then style switch + sort */
  .coffee-controls__right { width: 100%; flex-wrap: wrap; justify-content: space-between; }
  .coffee-search { order: -1; flex: 1 1 100%; }
  .coffee-search input { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .coffee-card { animation: none; opacity: 1; transform: none; }
}
