/* Wide screens. The pages are built phone-first as one narrow column; from tablet width up they open out:
   two columns on the home page, grids on the info pages, and a side panel in the members area. */

/* ---------- members area: resource cards (all sizes) ---------- */
.home-top { display: grid; gap: 16px; }
.thanks-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.thanks-card .thanks-label { margin: 0 !important; }
.thanks-card video { display: block; width: 100%; height: auto; border-radius: 12px; background: #000; }
.sec-h { font-size: clamp(1.3rem, 4.6vw, 1.6rem); color: #f2f5f3; }
.lib { display: grid; grid-template-columns: 1fr; gap: 12px; }
.lib-card { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 14px; align-items: start; text-decoration: none; color: inherit; background: linear-gradient(180deg, #121c16, #0b120e); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
a.lib-card:hover, a.lib-card:focus-visible { border-color: var(--emerald); outline: none; }
.lib-card.story { border-color: rgba(217,180,74,.55); background: linear-gradient(180deg, rgba(217,180,74,.12), #0b120e 60%); }
.lib-ic { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.5rem; background: rgba(0,0,0,.4); border: 1px solid var(--line); }
.lib-body { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.lib-body h3 { margin: 0; font: 600 1.05rem/1.3 var(--body); color: #f6f8f6; text-wrap: balance; }
.lib-meta { margin: 0; font-size: .85rem; color: var(--muted); }
.lib-go { color: var(--emerald); font-weight: 600; font-size: .9rem; }
.lib-card .pill-btn { text-decoration: none; }
.lib-card .msg { min-height: 0; margin: 0; }
.side { display: flex; flex-direction: column; gap: 16px; }
.main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

@media (min-width: 720px) {
  .lib { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lib-card.story { grid-column: 1 / -1; }
  .lounge .chapters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .lounge .chapters .part, .lounge .chapters .chapter[open], .lounge .chapters .empty-box { grid-column: 1 / -1; }
  .home-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; }
  .home-top .welcome { justify-content: center; }
  .home-top:has(#thanks[hidden]) { grid-template-columns: 1fr; }
}

@media (min-width: 1000px) {
  /* ---- members: side panel + wide main area ---- */
  .lounge .wrap { max-width: 1240px; }
  .room { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
  .side { position: sticky; top: 16px; }
  .lounge .stats { grid-template-columns: 1fr; }
  .lounge .stats > div { flex-direction: row-reverse; justify-content: space-between; align-items: center; text-align: start; padding: 10px 14px; }
  .lounge .stats dt { font-size: .82rem; }
  .lounge .mtabs { position: static; grid-template-columns: 1fr; padding: 6px; }
  .lounge .mtabs button { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; font-size: .98rem; min-height: 48px; }
  .lounge .side .foot-out { text-align: start; margin: 0; padding-inline-start: 6px; }
  .lib { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lib-card.story { grid-column: 1 / -1; }
  .lounge #pane-posts, .lounge #pane-rank { max-width: 860px; }
  .lounge .ch-text { max-width: 70ch; font-size: calc(1.15rem * var(--read, 1)); }

  /* ---- home: story on the left, live ranking on the right ---- */
  .wrap.home { max-width: 1200px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 36px; row-gap: 28px; align-items: start; }
  .wrap.home > .langbar, .wrap.home > #donate, .wrap.home > #videos, .wrap.home > .foot { grid-column: 1 / -1; }
  .wrap.home .vids { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .wrap.home > .hero { grid-column: 1; grid-row: 2; }
  .wrap.home > #prizes { grid-column: 1; grid-row: 3; }
  .wrap.home > #ranking { grid-column: 2; grid-row: 2; }
  .wrap.home > .home-thanks { grid-column: 2; grid-row: 3; }   /* fills the space under the ranking, next to the prizes */
  .wrap.home > .home-thanks video { max-width: none; }
  .wrap.home .amounts { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .wrap.home .amount:last-child { grid-column: auto; }
  .wrap.home .hero-links { flex-direction: row; justify-content: center; }

  /* ---- book and courses pages ---- */
  .bookpage .wrap { max-width: 1120px; }
  .bookpage .hero { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); column-gap: 40px; text-align: start; align-items: center; justify-items: start; }
  .bookpage .hero .logo { grid-row: 1 / span 5; width: 100%; }
  .bookpage .hero:not(:has(.logo)) { display: flex; text-align: center; align-items: center; }
  .bookpage .hero .lede { max-width: none; }
  .bookpage .facts { justify-content: flex-start; }
  .bookpage .hero:not(:has(.logo)) .facts { justify-content: center; }
  .unlock { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bookpage .amounts { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .bookpage .amount:last-child { grid-column: auto; }
  .bookpage .prizes ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bookpage .prizes li.all, .bookpage .prizes li.ever { grid-column: span 3; }
  .faq { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 24px; }
  .faq dt { grid-row: 1; margin-top: 0; }
  .faq dd { grid-row: 2; }
  .bookpage .letter { max-width: 820px; margin-inline: auto; padding: 30px 34px; }
  .bookpage .taste { max-width: 820px; margin-inline: auto; width: 100%; }
  .bookpage .toc { max-width: 820px; margin-inline: auto; width: 100%; }
  .bookpage .toc ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
  .bookpage .toc .toc-part { grid-column: 1 / -1; }

  /* ---- supporter pack, start, courses, entry form ---- */
  body.pack:not(.bookpage):not(.guide) .wrap { max-width: 1080px; }
  body.pack:not(.bookpage):not(.guide) .items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.pack:not(.bookpage):not(.guide) .items .item:first-child { grid-column: 1 / -1; }
  .guide .wrap { max-width: 900px; }
  .wrap.joinpage { max-width: 1080px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); column-gap: 32px; row-gap: 24px; align-items: start; }
  .wrap.joinpage > .langbar, .wrap.joinpage > .hero { grid-column: 1 / -1; }
  .wrap.joinpage > #already { grid-column: 1 / -1; }
  .wrap.joinpage:has(#join[hidden]) > #rules { grid-column: 1 / -1; grid-row: auto; max-width: 640px; margin-inline: auto; }
  .wrap.joinpage > #quick { grid-column: 1 / -1; grid-row: 3; max-width: 640px; width: 100%; margin-inline: auto; }
  .wrap.joinpage > #join { grid-column: 1; grid-row: 4 / span 2; }
  .wrap.joinpage > #paybox { grid-column: 2; grid-row: 4; }
  .wrap.joinpage > #rules { grid-column: 2; grid-row: 5; }
  .wrap.joinpage { grid-template-rows: auto auto auto auto 1fr; }   /* the rules sit right under the pay box, not at the bottom */
}
