/* storefront.css: a school's public CATALOG and OFFERS listing pages (src/lib/render-storefront.js, Andrew 10/19).
   Linked ONLY from those two pages, after styles.css, with its own ?v= (STOREFRONT_ASSET_VERSION in src/lib/config.js),
   so no other page's bytes change. Colours come from the school's brand variables that layout() puts on <body>
   (--primary, --primary-deep, --accent, --accent-soft, --sage), so every school's storefront wears its own brand.
   No web fonts, no JS. */

.sf-shell {
  display: grid;
  gap: 30px;
}

.sf-shell > .catalog-hero,
.sf-shell > .public-offers-hero {
  margin: 0;
}

/* Jump chips: plain anchor links to the sections below. */
.sf-shell .sf-chips {
  margin: -8px 0 0;
}

.sf-chip-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--sage);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}

.sf-section {
  display: grid;
  gap: 16px;
  min-width: 0;
  scroll-margin-top: 16px;
}

.sf-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.sf-section-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(19px, 2.1vw, 23px);
  font-weight: 650;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.sf-section-head h2::before {
  content: "";
  flex: none;
  width: 4px;
  height: 1.05em;
  border-radius: 4px;
  background: var(--accent);
}

.sf-section-head > span {
  flex: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.sf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

/* The card: picture on top, copy below, the action pinned to the bottom so a row of cards lines up. */
.cf-public .sf-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(20, 25, 35, 0.05);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.cf-public .sf-card:hover {
  border-color: #d4dae2;
  box-shadow: 0 10px 26px rgba(23, 33, 38, 0.09);
  transform: translateY(-2px);
}

/* Every picture sits in the same 16:9 frame, so every card in a row is the same height. */
.cf-public .sf-media {
  position: relative;
  display: block;
  flex: none;
  aspect-ratio: 16 / 9;
  min-height: 0;
  overflow: hidden;
  border-radius: 0;
  background: var(--sage);
  text-decoration: none;
}

.cf-public .sf-media .sf-img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.cf-public .sf-img-cover {
  object-fit: cover;
  transition: transform 0.35s ease;
}

.cf-public .sf-card:hover .sf-img-cover {
  transform: scale(1.03);
}

/* Books (2:3 portrait covers) and tools (near-square sheet shots) are shown WHOLE on a soft panel in the school's
   tints: nothing is cropped, and the frame is the same height as a course cover. */
.cf-public .sf-media-contain {
  padding: 14px;
  background:
    radial-gradient(120% 90% at 50% 100%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 70%),
    linear-gradient(160deg, var(--sage), var(--accent-soft));
}

.cf-public .sf-img-contain {
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(23, 33, 38, 0.2));
  transition: transform 0.25s ease;
}

.cf-public .sf-card:hover .sf-img-contain {
  transform: translateY(-2px);
}

/* No picture: the school's brand colour with the item's initials, never a broken image. */
.cf-public .sf-media-fallback {
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 60%),
    linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
}

.sf-fallback-mark {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0.04em;
  opacity: 0.92;
}

.sf-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 16px 18px 18px;
}

.cf-public .sf-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.1px;
  line-height: 1.3;
}

.cf-public .sf-card h3 a {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
}

.cf-public .sf-card h3 a:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cf-public .sf-card .sf-summary {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.cf-public .sf-card .course-card-actions {
  margin-top: auto;
  padding-top: 4px;
}

/* Offers: price beside the title, the facts as quiet pills. */
.sf-offer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sf-price {
  flex: none;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.cf-public .sf-card .sf-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cf-public .sf-card .sf-facts li {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-tint);
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  line-height: 1.3;
}

/* Phones: one column, a 16px gutter, nothing wider than the screen. */
@media (max-width: 640px) {
  .page-shell.sf-shell {
    width: calc(100% - 32px);
    padding: 28px 0 40px;
    gap: 24px;
  }

  .sf-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .sf-section-head h2 {
    font-size: 19px;
  }

  .sf-card-body {
    padding: 14px 16px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cf-public .sf-card,
  .cf-public .sf-img-cover,
  .cf-public .sf-img-contain {
    transition: none;
  }

  .cf-public .sf-card:hover,
  .cf-public .sf-card:hover .sf-img-cover,
  .cf-public .sf-card:hover .sf-img-contain {
    transform: none;
  }
}
