/* The protein shelf. Loaded after /style.css and /home.css, on
   body.home.shelf-page, so it inherits the home page's Linen tokens,
   fonts, nav, closing card and footer. Light only, like the home page.
   Written phone first: everything here is sized for a thumb on a 375px
   screen, and widens from 760px. */

.shelf-page {
  /* The app's word colours (Band.color in ProteinScannerUI). */
  --worth: #4f8a5b;
  --fine: #7f9a4f;
  --fine-ink: #5f7a33;
  --nottoday: #d99a3f;
  --nottoday-ink: #a8691a;
  --skip: #c85a4f;
  color-scheme: light;
}

/* The soft plum glow sits on the whole page, not on the header, so it
   fades out into the list instead of stopping at a hard edge. */
.shelf-page main {
  overflow-x: clip;
  background:
    radial-gradient(760px 620px at 96% 60px, rgba(234, 223, 230, 0.95), rgba(234, 223, 230, 0) 70%),
    radial-gradient(620px 560px at -4% 560px, rgba(234, 223, 230, 0.6), rgba(234, 223, 230, 0) 70%),
    var(--bg);
  background-repeat: no-repeat;
}

/* ---------- hero ---------- */

.shelf-hero { position: relative; padding: 30px 0 8px; }
.hero-wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.hero-text { text-align: center; }
.shelf-hero .eyebrow { margin-bottom: 14px; }
.shelf-hero .eyebrow a { color: inherit; }
.shelf-hero h1 {
  font-size: clamp(44px, 12.5vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
}
.shelf-hero h1 em { display: block; }
.shelf-hero .lede { margin: 0 auto; max-width: 24em; font-size: 17px; line-height: 1.5; color: var(--text-secondary); }
.hero-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 22px 0 0; }
.hero-actions span { color: var(--text-tertiary); font-size: 14px; }
.btn-find {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 28px;
  border-radius: 999px;
  background: var(--button); color: #fff;
  font: 700 17px/1 var(--sans);
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(110, 63, 98, 0.28);
}
.btn-find::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.btn-find:hover { text-decoration: none; opacity: 0.94; }
.hero-proof {
  list-style: none; padding: 0; margin: 20px 0 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.hero-proof li {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13.5px; color: var(--text-secondary);
}
.hero-proof b { color: var(--accent); font-family: var(--serif); font-weight: 600; font-size: 16px; }

/* Three real products fanned out like cards in a hand: the top bar, shake
   and powder on the list. */
.hero-fan {
  position: relative;
  height: 290px;
  margin: 26px auto 0;
  max-width: 420px;
}
.fan-card {
  position: absolute;
  bottom: 10px;
  width: 32%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 10px 12px;
  box-shadow: 0 18px 34px rgba(43, 38, 34, 0.14), 0 3px 8px rgba(43, 38, 34, 0.06);
}
.fan-0 { left: 0; transform: rotate(-6deg); z-index: 1; }
.fan-1 { left: 34%; bottom: 40px; z-index: 3; }
.fan-2 { right: 0; transform: rotate(6deg); z-index: 2; }
.fan-pic { position: relative; height: 118px; border-radius: 14px; overflow: hidden; background: #f3eee8; }
.fan-pic .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fan-pic .ph.wide { object-fit: contain; background: #fff; }
.fan-label { margin: 9px 0 0; font: 700 11px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.fan-name { margin: 4px 0 0; font: 600 17px/1.15 var(--serif); font-variation-settings: "opsz" 28; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fan-sub { margin: 2px 0 0; font-size: 12.5px; line-height: 1.25; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.fan-line { margin: 4px 0 8px; font-size: 12.5px; line-height: 1.3; color: var(--text-secondary); }
.fan-line b { color: var(--text); }
.fan-card .word { min-height: 26px; font-size: 12.5px; padding: 0 10px; }
.hero-fan .spark { z-index: 4; }
.shelf-hero.small { text-align: left; padding-bottom: 8px; }
.shelf-hero.small h1 { font-size: clamp(34px, 8.5vw, 56px); }
.shelf-hero.small .lede { margin: 0; }

/* ---------- the three questions ---------- */

.finder { padding: 4px 0 8px; }
.finder-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px 0 6px;
  box-shadow: 0 10px 30px rgba(43, 38, 34, 0.06);
}
.q { padding: 0 18px 14px; }
.q + .q { border-top: 1px solid var(--border); padding-top: 14px; }
.q-label {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.2;
}

.shelf-page .chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* The store row has the most choices, so on a phone it scrolls sideways
   instead of stacking four rows deep. */
.search-row + .q .chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -18px;
  padding: 2px 18px 4px;
  scroll-padding: 18px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 28px), transparent);
}
.search-row + .q .chips::-webkit-scrollbar { display: none; }

.pick { position: relative; flex-shrink: 0; }
.pick input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.pick span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font: 600 15px/1 var(--sans);
  white-space: nowrap;
  user-select: none;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.pick input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.pick input[type="checkbox"]:checked + span::before {
  content: "";
  width: 9px; height: 5px;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(-45deg);
}
.pick input:focus-visible + span { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

.more { border-top: 1px solid var(--border); }
.more summary {
  list-style: none;
  cursor: pointer;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
}
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "+"; font-size: 24px; font-weight: 400; line-height: 1; transition: transform 0.15s ease; }
.more[open] summary::after { transform: rotate(45deg); }
.more .chips { padding: 0 18px 16px; }
.more .pick span { min-height: 40px; font-size: 14px; padding: 0 14px; }

/* ---------- back to the top ---------- */

.totop {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px 0 14px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #fff;
  color: var(--accent);
  font: 700 14px/1 var(--sans);
  box-shadow: 0 8px 22px rgba(43, 38, 34, 0.14);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.totop::before {
  content: "";
  width: 8px; height: 8px;
  border-left: 2px solid currentColor; border-top: 2px solid currentColor;
  transform: translateY(2px) rotate(45deg);
}
.totop.on { opacity: 1; transform: none; pointer-events: auto; }
.totop:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

/* ---------- results ---------- */

.results { padding: 18px 0 8px; }
.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.count { margin: 0; font-size: 15px; color: var(--text-secondary); }
.count b { font-family: var(--serif); font-size: 22px; color: var(--text); font-weight: 600; margin-right: 2px; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); }
.sort select {
  appearance: none;
  -webkit-appearance: none;
  font: 600 14px/1 var(--sans);
  color: var(--text);
  min-height: 40px;
  padding: 0 32px 0 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237b4b6e' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center;
}

.queasy-note {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--accent-faint);
  color: var(--plum-deep);
  font-size: 14.5px;
  line-height: 1.45;
}

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }

.pc {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px 16px 4px;
}
.pc[hidden] { display: none; }

.pc-top { display: flex; align-items: flex-start; gap: 14px; }
.pc-pic {
  position: relative;
  flex: 0 0 88px;
  height: 104px;
  border-radius: 14px;
  background: #f3eee8;
}
.pc-pic .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }
.pc-pic .ph.wide { object-fit: contain; background: #fff; border: 1px solid var(--border); }
.pc-pic .ph.none { display: grid; place-items: center; text-align: center; padding: 8px; font-size: 12px; line-height: 1.3; color: var(--text-tertiary); }
.pc-rank {
  position: absolute;
  top: -7px; left: -7px;
  min-width: 28px; height: 28px;
  padding: 0 6px;
  border-radius: 14px;
  background: var(--button);
  color: #fff;
  font: 700 13px/28px var(--sans);
  text-align: center;
  box-shadow: 0 0 0 3px var(--card);
}
.pc-words { margin: 8px 0 0; }
.pc-title { flex: 1; min-width: 0; }
.pc-brand { margin: 0; font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); }
.shelf-page .pc-name { margin: 2px 0 0; font-size: 20px; line-height: 1.2; letter-spacing: -0.005em; font-variation-settings: "opsz" 28; }
.shelf-page .q-label, .shelf-page .note-card h3, .shelf-page .stat b, .shelf-page .count b { font-variation-settings: "opsz" 28; }

.word {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 15px;
  font: 700 13.5px/1 var(--sans);
  white-space: nowrap;
}
.w-worth_it { background: #e3efe4; color: var(--worth); }
.w-fine { background: #edf2e1; color: var(--fine-ink); }
.w-not_today { background: #f8ead6; color: var(--nottoday-ink); }
.w-skip { background: #f6e1de; color: var(--skip); }

.pc-line { margin: 10px 0 0; font-size: 15px; line-height: 1.45; color: var(--text-secondary); }
.pc-line b { color: var(--text); font-weight: 600; }

.pc-stats {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 6px;
  margin: 12px 0 0;
}
.stat {
  background: var(--bg);
  border-radius: 12px;
  padding: 9px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat b { font-family: var(--serif); font-weight: 600; font-size: 20px; line-height: 1.05; }
.stat span { font-size: 12px; line-height: 1.25; color: var(--text-secondary); }
.stat.lead { background: var(--accent-faint); }
.stat.lead b { color: var(--accent); }

.pc-stores { margin: 10px 0 0; font-size: 14px; color: var(--text); }
.pc-stores span { color: var(--text-tertiary); font-size: 13px; }
.pc-stores.none { color: var(--text-tertiary); }

.pc-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 0; }
.pc-buy span { font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-right: 2px; }
.pc-buy a {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px; font-weight: 600;
  text-decoration: none;
}
.pc-buy a::after { content: "\2197"; font-size: 13px; line-height: 1; opacity: 0.5; }
.pc-buy a:hover { border-color: var(--accent-soft); text-decoration: none; }

.pc-more { margin-top: 4px; }
.pc-more summary {
  list-style: none;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 14.5px;
  font-weight: 600;
}
.pc-more summary::-webkit-details-marker { display: none; }
.pc-more summary::after { content: ""; width: 7px; height: 7px; margin-left: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform 0.15s ease; }
.pc-more[open] summary::after { transform: translateY(2px) rotate(-135deg); }

.why { border-top: 1px solid var(--border); padding: 12px 0 14px; font-size: 15px; line-height: 1.5; }
.why ul { margin: 6px 0 0; padding-left: 18px; }
.why li { margin: 2px 0; color: var(--text-secondary); }
.why-head { margin: 0; font-weight: 700; }
.why-sub { margin: 14px 0 0; font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.why-missing li { font-size: 14px; }
.why-missing b { color: var(--text); font-weight: 600; }
.why-source { margin: 12px 0 0; font-size: 13px; color: var(--text-tertiary); }
.why-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 12px;
  border-radius: 23px;
  background: var(--button);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  text-align: center;
  padding: 0 16px;
}
.why-cta:hover { text-decoration: none; opacity: 0.9; }

.pillars { display: grid; gap: 6px; margin: 12px 0 0; }
.pillar { display: grid; grid-template-columns: 8.6em 1fr 2em; align-items: center; gap: 10px; font-size: 14px; }
.pillar .bar { height: 7px; border-radius: 4px; background: var(--bg-subtle); overflow: hidden; }
.pillar .bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent-soft); }
.pillar b { text-align: right; font-weight: 700; }

/* The queasy switch: one class on <body> swaps every card. */
.q-only { display: none; }
.is-queasy .q-only { display: revert; }
.is-queasy .n-only { display: none; }
.is-queasy span.q-only, .is-queasy .word.q-only { display: inline-flex; }
.is-queasy .pc-line span.q-only { display: inline; }

.empty { text-align: center; padding: 28px 12px; }
.empty h3 { margin: 0 0 8px; }
.empty p { color: var(--text-secondary); margin: 0; }

/* Search sits first in the finder card, above the three questions. */
.search-row { padding: 0 18px 16px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.search-row input {
  width: 100%;
  min-height: 50px;
  padding: 0 16px 0 46px;
  border-radius: 25px;
  border: 1px solid var(--border);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%237b4b6e' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat 17px 50%;
  font: 400 16px var(--sans);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}
.search-row input::placeholder { color: var(--text-tertiary); }
.search-row input:focus { outline: 3px solid var(--accent-faint); border-color: var(--accent-soft); background-color: #fff; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- notes ---------- */

.shelf-page .closing { padding: 36px 0 28px; }
.notes { padding: 8px 0 48px; }
.notes-grid { display: grid; gap: 12px; }
.note-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
}
.note-card .eyebrow { margin-bottom: 8px; }
.note-card h3 { margin: 0 0 8px; }
.note-card p:not(.eyebrow) { margin: 0 0 12px; color: var(--text-secondary); font-size: 15.5px; line-height: 1.5; }
.note-card a { color: var(--accent); font-weight: 700; font-size: 15px; }
.held { margin: 16px 0 0; font-size: 13.5px; color: var(--text-tertiary); line-height: 1.5; }
.held b { color: var(--text-secondary); font-weight: 600; }


/* ---------- how we score ---------- */

.doc { padding: 16px 0 8px; }
.doc-inner { display: grid; gap: 12px; max-width: 760px; }
.doc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 20px;
  scroll-margin-top: 80px;
}
.doc-card .eyebrow { margin-bottom: 8px; }
.shelf-page .doc-card h2 { font-size: clamp(26px, 6vw, 34px); margin: 0 0 12px; }
.doc-card p:not(.eyebrow), .doc-card li { color: var(--text-secondary); font-size: 16px; line-height: 1.6; }
.doc-card p:not(.eyebrow) { margin: 0 0 12px; }
.doc-card ul { padding-left: 18px; margin: 0 0 12px; }
.doc-card li { margin: 6px 0; }
.doc-card b { color: var(--text); }
.doc-card a { color: var(--accent); }
.word-key { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 16px; }
.word-key div { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-secondary); }

/* ---------- wider screens ---------- */

@media (min-width: 760px) {
  .shelf-hero { padding: 56px 0 24px; }
  .hero-wrap { padding: 0 28px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 40px; align-items: center; }
  .hero-text { text-align: left; }
  .shelf-hero .lede { margin: 0; font-size: 19px; }
  .hero-actions { flex-direction: row; gap: 18px; margin-top: 28px; }
  .hero-proof { justify-content: flex-start; margin-top: 26px; }
  .hero-fan { height: 400px; max-width: 540px; margin: 0 0 0 auto; width: 100%; }
  .fan-card { padding: 12px 12px 14px; border-radius: 22px; }
  .fan-pic { height: 170px; }
  .fan-name { font-size: 20px; }
  .fan-line { font-size: 13.5px; }
  .finder-card { padding: 22px 0 6px; }
  .q { padding: 0 24px 18px; display: grid; grid-template-columns: 220px 1fr; align-items: center; gap: 16px; }
  .q + .q { padding-top: 18px; }
  .search-row { padding: 0 24px 20px; margin-bottom: 18px; }
  .q-label { margin: 0; }
  .search-row + .q .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; -webkit-mask-image: none; mask-image: none; }
  .more summary, .more .chips { padding-left: 24px; padding-right: 24px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
  .pc { padding: 20px 20px 6px; }
  .notes-grid { grid-template-columns: repeat(3, 1fr); }
  .totop { right: 24px; bottom: 24px; }
}

/* On the plum closing card the accent italic would vanish. */
.shelf-page .closing h2 em { color: #e3c4da; }
.shelf-page .closing-inner { overflow: hidden; }
.shelf-page .closing-try { font-family: var(--serif); font-weight: 600; font-size: 21px !important; opacity: 1 !important; margin: 0 auto 18px !important; font-variation-settings: "opsz" 28; }
.shelf-hero.small h1 em { display: inline; }
#controls { scroll-margin-top: 84px; }
