/* ============================================================
   The Erewhon Smoothie Archive
   Light, plain, Apple-leaning chrome. The serif masthead and
   the wobbling illustrations are the only flourishes.
   ============================================================ */

:root {
  --bg: #ffffff;
  --tile: #f5f5f7;
  --text: #1d1d1f;
  --secondary: #6e6e73;
  --tertiary: #86868b;
  --hairline: #d2d2d7;
  --link: #0066cc;
  --green-bg: rgba(52, 199, 89, 0.14);
  --green-fg: #1d7d3f;
  --orange-bg: rgba(255, 149, 0, 0.14);
  --orange-fg: #b25000;
  --gray-bg: #ececef;
  --gray-fg: #6e6e73;
  --serif: 'Young Serif', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.filter-defs { position: absolute; width: 0; height: 0; }

/* the boil: app.js flips data-frame at ~7fps */
html[data-frame="0"] .wob { filter: url(#wob-a-0); }
html[data-frame="1"] .wob { filter: url(#wob-a-1); }
html[data-frame="2"] .wob { filter: url(#wob-a-2); }
html[data-frame="3"] .wob { filter: url(#wob-a-3); }

/* ---- nav ---------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(22px, calc(50vw - 540px));
  height: 52px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.brand {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}

.nav nav { display: flex; gap: 26px; }
.nav nav a {
  font-size: 14px;
  color: var(--secondary);
  text-decoration: none;
  padding: 4px 0;
}
.nav nav a:hover { color: var(--text); }
.nav nav a[aria-current="true"] { color: var(--text); font-weight: 600; }

/* ---- layout ------------------------------------------------- */

main { max-width: 1080px; margin: 0 auto; padding: 0 22px; }

.hero { text-align: center; padding: 64px 0 8px; }

.hero .serif {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(36px, 7vw, 76px);
  line-height: 1.02;
  margin: 0;
  letter-spacing: -0.01em;
}

.hero-line {
  font-size: 15px;
  color: var(--secondary);
  margin: 18px 0 0;
}

/* ---- toolbar ------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 34px 0 8px;
}

.segmented {
  display: inline-flex;
  background: var(--tile);
  border-radius: 11px;
  padding: 3px;
}
.segmented button {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] {
  background: #fff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.segmented button .count { color: var(--tertiary); font-weight: 400; margin-left: 4px; }

.sort-select {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--text);
  background: var(--tile);
  border: none;
  border-radius: 11px;
  padding: 8px 12px;
  cursor: pointer;
}
.sort-select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.3);
}

/* ---- catalog grid -------------------------------------------- */

.catalog {
  list-style: none;
  margin: 18px 0 70px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  grid-auto-rows: auto;
  gap: 14px;
}

.catalog > li:not(.year-head) { content-visibility: auto; contain-intrinsic-size: auto 330px; }

.year-head {
  grid-column: 1 / -1;
  font-size: 19px;
  font-weight: 700;
  margin: 26px 2px 0;
}
.year-head:first-child { margin-top: 8px; }

.catalog-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--tertiary);
  padding: 60px 0;
  font-size: 14px;
}

.card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--tile);
  border: none;
  border-radius: 18px;
  padding: 26px 16px 22px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.09);
}
.card:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

.card .cup { height: 96px; width: auto; margin-bottom: 14px; }

.card-photo {
  width: 116px;
  height: 116px;
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}
.card-photo img { width: 100%; height: 100%; object-fit: contain; display: block; }

.card-name {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
  min-height: 2.5em;          /* two lines, keeps every card equal */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-collab {
  font-size: 12.5px;
  color: var(--secondary);
  margin-top: 3px;
  min-height: 1.4em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.card-meta {
  font-size: 12.5px;
  color: var(--tertiary);
  margin-top: 8px;
}

.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 10px;
  margin-top: 10px;
}
.pill.green { background: var(--green-bg); color: var(--green-fg); }
.pill.orange { background: var(--orange-bg); color: var(--orange-fg); }
.pill.gray { background: var(--gray-bg); color: var(--gray-fg); }

/* ---- ingredients page ----------------------------------------- */

.ing-most h2, #ing-categories h2 {
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 14px;
}

.most-list { list-style: none; margin: 0; padding: 0; }
.most-list li { margin: 0 0 6px; }

.most-row {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 150px 1fr 38px;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background: none;
  border: none;
  border-radius: 10px;
  padding: 5px 8px;
  cursor: pointer;
  text-align: left;
}
.most-row:hover { background: var(--tile); }
.most-row .icon { width: 30px; height: 30px; }
.most-row .bar-track { display: block; height: 8px; border-radius: 4px; background: var(--tile); overflow: hidden; }
.most-row .bar { display: block; height: 100%; border-radius: 4px; background: var(--text); }
.most-row .n { color: var(--tertiary); text-align: right; font-variant-numeric: tabular-nums; }

#ing-categories { margin: 28px 0 70px; }

.ing-toolbar { justify-content: flex-start; gap: 10px; margin: 30px 0 0; }
.ing-sort-label { font-size: 13.5px; color: var(--secondary); margin-left: auto; }

.ing-search {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--text);
  background: var(--tile);
  border: none;
  border-radius: 11px;
  padding: 8px 12px;
  width: 220px;
}
.ing-search::placeholder { color: var(--tertiary); }
.ing-search:focus { outline: none; box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.3); }

.ing-empty {
  text-align: center;
  color: var(--tertiary);
  font-size: 14px;
  padding: 50px 0;
}

.ing-most { max-width: 640px; margin: 0 auto 70px; }

.ing-band { margin-bottom: 50px; }
.band-intro {
  font-size: 14px;
  color: var(--secondary);
  margin: 0 0 20px;
  max-width: 560px;
}

.ing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 14px;
}

.ing-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  color: var(--text);
  background: var(--tile);
  border: none;
  border-radius: 16px;
  padding: 24px 14px 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ing-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08); }
.ing-tile .icon { width: 68px; height: 68px; }
.ing-tile .t-name { font-size: 15px; font-weight: 600; line-height: 1.25; text-align: center; }
.ing-tile .t-count { font-size: 12.5px; color: var(--tertiary); }

/* ---- sheet (smoothie + ingredient modals) ---------------------- */

.sheet {
  border: none;
  background: transparent;
  padding: 20px;
  max-width: min(720px, 94vw);
  width: 100%;
}
.sheet::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
}

.sheet-inner {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 30px 34px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--tile);
  color: var(--secondary);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.sheet-close:hover { background: #e8e8ed; color: var(--text); }

.sheet-eyebrow { font-size: 12px; color: var(--tertiary); }

.sheet-head { display: flex; gap: 28px; align-items: flex-start; margin-top: 8px; }
.sheet-head .cup { height: 140px; flex-shrink: 0; }
.sheet-photo {
  width: 150px;
  height: 150px;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
}
.sheet-photo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sheet-head .icon-lg { width: 110px; height: 110px; flex-shrink: 0; }

.sheet-title {
  font-size: clamp(22px, 3.6vw, 30px);
  font-weight: 700;
  line-height: 1.12;
  margin: 2px 0 4px;
  letter-spacing: -0.01em;
}

.sheet-sub { font-size: 14px; color: var(--secondary); margin: 0 0 10px; }

.sheet-metaline { font-size: 13.5px; color: var(--tertiary); margin: 2px 0 0; }

.sheet-notes { font-size: 14.5px; line-height: 1.6; color: var(--text); margin: 20px 0 0; }

.sheet h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 26px 0 10px;
}

.ing-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 4px 16px;
}
.ing-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--sans);
  color: var(--text);
  background: none;
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
}
.ing-row:hover { background: var(--tile); }
.ing-row .icon { width: 38px; height: 38px; flex-shrink: 0; }
.ing-row .r-name { font-size: 15px; font-weight: 600; line-height: 1.25; }
.ing-row .r-raw { font-size: 12.5px; color: var(--tertiary); line-height: 1.3; }

.partial-note { font-size: 13px; color: var(--tertiary); font-style: italic; margin: 12px 0 0; }

.sheet-sources { font-size: 12.5px; color: var(--tertiary); margin-top: 8px; line-height: 1.8; }
.sheet-sources a { color: var(--secondary); text-decoration: none; border-bottom: 1px solid var(--hairline); margin-right: 12px; }
.sheet-sources a:hover { color: var(--text); }

/* ingredient profile */
.prof-stat { font-size: 13.5px; color: var(--secondary); margin: 14px 0 0; }
.prof-co { font-size: 13px; color: var(--tertiary); margin: 6px 0 0; }
.prof-colink {
  font: inherit;
  color: var(--secondary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-bottom: 1px solid var(--hairline);
}
.prof-colink:hover { color: var(--text); }
.prof-variants { font-size: 12.5px; color: var(--tertiary); margin: 6px 0 0; }

.smoothie-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 2px 14px;
}
.smoothie-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  color: var(--text);
  background: none;
  border: none;
  border-radius: 10px;
  padding: 7px 8px;
  cursor: pointer;
  text-align: left;
  font-size: 13.5px;
}
.smoothie-row:hover { background: var(--tile); }
.smoothie-row .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.12); }
.smoothie-row .s-name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.smoothie-row .s-year {
  color: var(--tertiary);
  margin-left: auto;
  padding-left: 10px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.smoothie-rows.compact .smoothie-row { font-size: 12.5px; padding: 5px 8px; }
.smoothie-rows.compact .dot { width: 10px; height: 10px; }

/* ---- footer ----------------------------------------------------- */

.footer {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin-top: 20px;
  padding: 26px 22px 44px;
}
.footer p {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  font-size: 12.5px;
  color: var(--tertiary);
  line-height: 1.7;
}

/* ---- small screens ---------------------------------------------- */

@media (max-width: 620px) {
  .nav { padding: 0 16px; }
  .brand { font-size: 12.5px; white-space: nowrap; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .nav nav { gap: 12px; flex-shrink: 0; padding-left: 10px; }
  .nav nav a { font-size: 13px; }
  .sheet-inner { padding: 24px 18px; }
  .sheet-head { gap: 18px; }
  .sheet-head .cup { height: 110px; }
  .sheet-photo { width: 110px; height: 110px; }
  .most-row { grid-template-columns: 30px 118px 1fr 32px; }
  .hero { padding-top: 44px; }
  .hero .serif { font-size: clamp(28px, 8vw, 40px); }
  .hero-line { font-size: 14px; }
  .segmented button { font-size: 12.5px; padding: 6px 10px; }
  .segmented .count { display: none; }
  .ing-search { width: 100%; }
  .ing-sort-label { margin-left: 0; }

  main { padding: 0 14px; }

  /* smoothie cards: two per row, scaled down */
  .catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 50px; }
  .catalog > li:not(.year-head) { contain-intrinsic-size: auto 230px; }
  .card { padding: 16px 10px; border-radius: 14px; }
  .card .cup { height: 72px; margin-bottom: 10px; }
  .card-photo { width: 86px; height: 86px; margin-bottom: 10px; border-radius: 10px; }
  .card-name { font-size: 13.5px; min-height: 2.4em; }
  .card-collab { font-size: 11px; margin-top: 2px; }
  .card-meta { font-size: 10.5px; margin-top: 5px; }
  .pill { font-size: 10.5px; padding: 3px 8px; margin-top: 8px; }
  .year-head { font-size: 17px; }

  /* ingredient tiles: two per row, scaled down */
  .ing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ing-tile { padding: 16px 8px 14px; border-radius: 14px; gap: 8px; }
  .ing-tile .icon { width: 46px; height: 46px; }
  .ing-tile .t-name { font-size: 13px; }
  .ing-tile .t-count { font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .ing-tile, .most-row { transition: none; }
}
