#main-nav { padding-bottom: 15px; }
#main-nav .navgroup { padding-top: 16px; }
#main-nav .navlink { padding-top: 9px; padding-bottom: 9px; }
.brand,.sidefoot { flex: none; }
.library, .library-profile { --accent: #76520d; --tint: #fff0c9; }
.grower { --accent: #76520d; --tint: #fff0c9; }
.finisher { --accent: #76520d; --tint: #fff0c9; }
.library-heading { padding: 21px 0 18px; }
.library-heading h1,.library-profile h1 { font-size: clamp(28px,3vw,42px); }
.library-heading p,.product-overview p { font-size: 16px; line-height: 1.75; color: #66583e; margin-top: 10px; }
.stage-links { display: inline-flex; gap: 4px; flex-wrap: wrap; border: 1px solid var(--border); padding: 4px; border-radius: 9px; background: white; }
.stage-links a { display: inline-flex; align-items: baseline; gap: 6px; padding: 8px 13px; font-weight: 620; border-radius: 6px; font-size: 15px; }
.stage-links a span { font-size: 13px; color: #66583e; font-weight: 450; }
.stage-links a:hover { background: #fff7e4; }
.stage-links a[aria-current] { background: #fff0c9; color: #76520d; }
.stage-links a[aria-current] span { color: #76520d; }
.stage-cover {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: white;
}
.stage-photo { display: block; width: 100%; height: auto; }
.stage-cover-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 11px 22px;
  padding: 16px clamp(14px,2vw,28px);
}
.stage-cover-caption h1 { margin: 0; font-size: clamp(25px,2.4vw,37px); }
.stage-gallery { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.stage-gallery a { display: block; overflow: hidden; background: white; border: 1px solid var(--border); border-radius: 10px; }
.stage-gallery a:hover { border-color: #c9a452; }
.stage-gallery .stage-photo { aspect-ratio: 2.5; object-fit: cover; }
.stage-gallery span { display: flex; align-items: baseline; gap: 9px; padding: 10px 14px; font-size: 14px; color: var(--muted); }
.stage-gallery strong { color: var(--forest); font-size: 18px; }
@media (max-width: 600px) {
  .stage-cover-caption { padding: 13px; }
  .stage-gallery { gap: 6px; }
  .stage-gallery span { display: grid; gap: 1px; padding: 5px 8px; }
}
.library-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin: 28px 0 14px; }
.library-toolbar h2 { font-size: 21px; }
.library-toolbar small { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.library-toolbar .searchbox { background: white; max-width: 290px; min-width: 180px; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,245px),1fr)); gap: 15px; align-items: stretch; }
.library-card { background: white; border: 1px solid var(--border); border-radius: 13px; padding: 19px; display: flex; flex-direction: column; align-items: start; transition: border-color .14s,box-shadow .14s; }
.library-card:hover { border-color: #c9a452; box-shadow: 0 3px 13px #684c240d; }
.topic-mark { display: inline-grid; place-items: center; width: 46px; height: 46px; background: var(--tint); color: var(--accent); border-radius: 12px; }
.topic-mark svg { width: 26px; height: 26px; }
.card-content { min-width: 0; width: 100%; }
.topic-card .card-content { margin-top: 15px; }
.card-type { display: block; color: var(--accent); font-size: 13px; font-weight: 600; }
.library-card h2 { font-size: 20px; line-height: 1.5; margin: 4px 0 6px; }
.library-card p { color: #66583e; font-size: 15px; line-height: 1.7; }
.product-card { padding: 0; overflow: hidden; }
.product-image { position:relative; width: 100%; aspect-ratio: 1.85; background: #fff7e4; }
.product-image small { position:absolute; bottom:7px; right:8px; background:#ffffffe6; padding:2px 6px; border-radius:4px; font-size:12px; color:#66583e; }
.product-image img,.product-overview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.product-card .card-content { display:flex; flex:1; flex-direction:column; padding: 17px 19px; }
.product-card p { margin-bottom: 14px; }
.card-price { margin-top: auto; padding-top: 11px; border-top: 1px solid #f1e5ca; color: var(--forest); font-size: 15px; font-weight: 650; }
.card-price span { color: var(--muted); font-size: 13px; font-weight: 400; margin-right: 4px; }
.back-link,.batch-shortcut,.related a { display: inline-flex; align-items:center; gap:7px; font-weight:600; color:#76520d; font-size: 15px; }
.back-link,.batch-shortcut { margin: 5px 0 18px; }
.back-link:hover,.batch-shortcut:hover,.related a:hover { text-decoration: underline; }
.library-profile { border-radius:14px; overflow:hidden; border:1px solid var(--border); background:white; max-width: 1020px; }
.profile-header,.product-overview { padding:26px clamp(16px,3vw,34px); background:#fff7e4; border-bottom:1px solid var(--border); }
.profile-header { display:flex; align-items:center; gap:16px; }
.profile-header .topic-mark { background:white; border:1px solid var(--border); }
.profile-header h1,.product-overview h1 { line-height:1.3; margin-top:5px; }
.profile-body { padding: 3px clamp(16px,3vw,34px) 20px; }
.text-section { padding: 20px 0; border-bottom:1px solid #f1e5ca; }
.text-section h2,.vet-call h2 { font-size:19px; margin-bottom:9px; }
.text-section p,.text-section li,.vet-call p,.drug-field dd { font-size:16px; line-height:1.8; color:#66583e; }
.text-section ul { margin:0; padding-left:1.5em; }
.text-section li+li { margin-top:6px; }
.vet-call { padding:16px 18px; margin-top:18px; border-radius:8px; background:#faf1df; color:#684c28; }
.vet-call h2 { display:flex; gap:6px; align-items:center; }
.vet-call p { color:#684c28; }
.related { display:flex; flex-wrap:wrap; gap:10px; }
.related a { padding:7px 10px; border-radius:7px; background:#fff7e4; }
.profile-source { display:flex; gap:15px; flex-wrap:wrap; margin-top:18px; font-size:14px; }
.reference-link { color:#76520d; text-decoration:underline; text-underline-offset:3px; }
.product-overview { display:grid; align-items:center; grid-template-columns:minmax(160px,30%) 1fr; gap:25px; }
.product-overview figure { margin:0; background:white; border:1px solid var(--border); border-radius:12px; overflow:hidden; text-align:center; }
.product-overview img { max-height:240px; }
.product-overview figcaption { padding:8px; color:var(--muted); font-size:12px; }
.product-overview dl,.product-facts { margin:15px 0 0; }
.drug-field { display:grid; grid-template-columns:minmax(84px,8em) minmax(0,1fr); gap:12px; align-items:baseline; padding:12px 0; }
.drug-field + .drug-field { border-top:1px solid var(--border); }
.drug-field dt { font-size:15px; font-weight:650; }
.drug-field dd { margin:0; }
.drug-field small { display:block; font-size:14px; color:var(--muted); margin-top:3px; }
.product-overview .drug-field { grid-template-columns:5em 1fr; padding:6px 0; }
.purchase-box { margin:12px 0; padding:13px 15px; border:1px solid var(--border); border-radius:8px; }
.purchase-box summary { cursor:pointer; font-weight:600; }
.purchase-box p { color:var(--muted); font-size:14px; margin:10px 0; }
.purchase-fields { display:flex; flex-wrap:wrap; align-items:end; gap:12px; }
.purchase-fields label { display:grid; gap:5px; font-size:14px; }
.purchase-fields input { max-width:170px; padding:8px; border:1px solid var(--border); border-radius:5px; font-size:16px; }
.purchase-fields button { background:var(--forest); color:white; border-radius:6px; padding:10px 16px; }
.saved-note:empty { display:none; }
@media(max-width:730px){
 .library-heading { padding-top:10px; }
 .stage-links a { padding:7px 9px; }
 .library-toolbar { margin-top:20px; }
 .library-grid { grid-template-columns: repeat(auto-fill,minmax(min(100%,215px),1fr)); gap:10px; }
 .library-card h2 { font-size:19px; }
 .topic-card { flex-direction:row; padding:14px; gap:13px; }
 .topic-card .card-content { margin:0; }
 .topic-card .topic-mark,.profile-header .topic-mark { flex:none; }
 .product-overview { grid-template-columns:1fr; gap:15px; }
 .product-overview figure { justify-self:start; width:min(100%,240px); }
 .drug-field { grid-template-columns:1fr; gap:3px; }
 .crumb { min-width:0; }
 #crumb { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
 .today { flex:none; }
}
/* Topic cards use the same full-bleed image layout as the medicine catalog. */
.library-card.topic-card { padding:0; gap:0; flex-direction:column; align-items:stretch; overflow:hidden; }
.topic-card .product-image { aspect-ratio:1.6; width:100%; background:#fff5db; }
.topic-card .product-image img { width:100%; height:100%; display:block; object-fit:cover; }
.library-card.topic-card .card-content { margin:0; padding:12px 15px; }
.library-card.topic-card .card-content h2 { margin:0; font-size:18px; line-height:1.45; }
.mange-image { display:block; width:min(100%,640px); max-height:340px; object-fit:cover; border-radius:10px; margin:20px 0 0; }
@media(max-width:730px) {
  .library:is(.piglet,.grower,.finisher,.health) .library-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .library-card.topic-card .card-content { padding:10px; }
  .library-card.topic-card .card-content h2 { font-size:16px; }
}
.topic-detail-photo { display:block; width:min(100%,700px); margin:20px 0 0; border-radius:10px; overflow:hidden; }
img.topic-detail-photo,.topic-detail-photo img { display:block; width:100%; max-height:380px; object-fit:contain; object-position:center; background:#fff7e7; }
.medicine .product-image img,.medicine .product-overview figure img { filter:sepia(.44) saturate(.93); }
