/* ============================================================
   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); }

/* ---- primary views ------------------------------------------ */

.view-tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--hairline);
}
.view-tabs a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 60px;
  padding: 14px 6px;
  color: var(--secondary);
  font-size: 16px;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.view-tabs a:hover { color: var(--text); }
.view-tabs a[aria-current="page"] { color: var(--text); font-weight: 600; border-color: var(--text); }
.view-count { color: var(--secondary); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }

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

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

.hero { text-align: center; padding: 48px 0 32px; }
.hero h1 a { color: inherit; text-decoration: none; }

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

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

.menu-note, .view-note { font-size: 13px; color: var(--secondary); margin: 24px 0 0; line-height: 1.6; }
.menu-note:empty { display: none; }

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin: 24px 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-color: var(--tile);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1.5l4 4 4-4' fill='none' stroke='%23292923' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: none;
  border-radius: 11px;
  box-sizing: border-box;
  padding: 8px 30px 8px 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.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;
  column-gap: 24px;
  row-gap: 28px;
}

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

.year-head {
  grid-column: 1 / -1;
  font-size: 19px;
  font-weight: 700;
  margin: 26px 2px 0;
}
.year-head:first-child { margin-top: 0; }
.year-head h2 { font-family: var(--serif); font-size: 24px; font-weight: 400; margin: 0; }

.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: flex-start;
  text-align: left;
  gap: 0;
  font-family: var(--sans);
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 0 16px;
  cursor: pointer;

}
.card:hover .card-name { text-decoration: underline; text-underline-offset: 3px; }
.card:hover .card-photo { background: #eceef0; }
.card:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

.card .cup { height: 184px; width: 100%; padding: 24px; margin-bottom: 14px; background: var(--tile); border-radius: 8px; }

.card-photo {
  width: 100%;
  height: 184px;
  margin-bottom: 14px;
  background: var(--tile);
  border: none;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.card-photo img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 14px; mix-blend-mode: multiply; }

.card-name {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
  min-height: 2.5em;          /* two lines, keeps every card equal */
  overflow-wrap: anywhere;
}

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

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

.card-price { font-size: 16px; font-weight: 600; 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-categories h2 {
  font-size: 21px;
  font-weight: 600;
  margin: 0 0 14px;
}
.category-count { color: var(--secondary); font-size: 13px; font-weight: 400; margin-left: 5px; }

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

.ing-toolbar { justify-content: flex-start; gap: 10px; margin: 30px 0 0; }
.ing-filter-label { font-size: 13.5px; color: var(--secondary); }
.ing-sort-label { font-size: 13.5px; color: var(--secondary); margin-left: auto; }
.ing-policy { max-width: 76ch; font-size: 13px; line-height: 1.6; color: var(--secondary); margin: 16px 0 0; }
.ing-category-note { font-size: 13px; line-height: 1.6; color: var(--secondary); margin: -4px 0 16px; }
#ing-category { max-width: 100%; }

.ing-search, .catalog-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, .catalog-search::placeholder { color: var(--tertiary); }
.ing-search:focus, .catalog-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;
}

.catalog-search { flex: 1; min-width: 220px; min-height: 40px; }
.result-count { color: var(--secondary); font-size: 12px; margin: 14px 0 0; }

.ing-band { margin-bottom: 50px; }
.ing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0 28px;
}
.ing-tile {
  display: grid;
  grid-template-columns: 52px 1fr;
  grid-template-rows: 1fr 1fr;
  align-items: end;
  gap: 3px 14px;
  min-height: 94px;
  font-family: var(--sans);
  color: var(--text);
  background: transparent;
  border: none;
  border-bottom: 1px solid #e8e8eb;
  padding: 14px 6px;
  cursor: pointer;
  text-align: left;
}
.ing-tile:hover { background: var(--tile); }
.ing-tile .icon { width: 52px; height: 52px; grid-row: 1 / 3; align-self: center; }
.ing-tile .t-name { font-size: 15px; font-weight: 600; line-height: 1.25; }
.ing-tile .t-count { font-size: 12.5px; color: var(--secondary); align-self: start; }

/* ---- 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; }
.ing-row .r-raw { display: block; margin-top: 3px; }
div.ing-row { cursor: default; }
div.ing-row:hover { background: none; }

.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) {
  .sheet-inner { padding: 24px 18px; }
  .sheet-head { gap: 18px; }
  .sheet-head .cup { height: 110px; }
  .sheet-photo { width: 110px; height: 110px; }
  .hero { padding: 34px 8px 24px; }
  .view-tabs { gap: 0; padding: 0; }
  .view-tabs a { flex: 1; font-size: 13px; gap: 5px; padding: 12px 3px; min-height: 54px; }
  .view-count { font-size: 10.5px; }
  .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)); column-gap: 16px; row-gap: 20px; margin-bottom: 50px; }
  .catalog > li:not(.year-head) { contain-intrinsic-size: auto 230px; }
  .card { padding: 0 0 10px; }
  .card .cup { height: 150px; margin-bottom: 10px; padding: 20px; }
  .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: 56px; height: 56px; }
  .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; }
}
