/* F72 — the sticker page. Categories on the left, the chosen category's
   stickers on the right, the running total above both. Type and the dark pill
   CTA follow home.css; borders and accents are the brand purple from
   shared/brand.css, so the page reads as part of learnisl. */

:root {
  /* A light tint of --brand-primary (#9245e3) for the card outlines. */
  --stk-border: #dcc8f6;
}

/* width: 100% is load-bearing. The body is a flex column and auto margins on a
   flex item switch off stretching, so without it the page sizes to its widest
   content and runs off a phone screen. */
.stk-page {
  width: 100%;
  box-sizing: border-box;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.stk-header {
  margin-bottom: 16px;
}

.stk-title {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
  color: #111827;
}

.stk-lede {
  margin: 0 0 2px;
  font-size: 16px;
  color: #374151;
}

.stk-sub {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
}

/* --- The running total --------------------------------------------------- */

.stk-summary {
  position: sticky;
  top: 54px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--stk-border);
  border-radius: 12px;
}

.stk-summary-count {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.stk-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-primary);
  cursor: pointer;
}

.stk-link:hover {
  text-decoration: underline;
}

.stk-link[hidden] {
  display: none;
}

/* The dark pill: home.css's .v2-tile-cta, as a button. */
.stk-send {
  padding: 10px 20px;
  border: none;
  border-radius: 999px;
  background: #1f2937;
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.stk-send:hover {
  background: #111827;
}

/* Send to WhatsApp is home's .v2-wa-btn, the site's one WhatsApp button;
   this only adds its disabled look, which home never needs. */
.stk-wa-send {
  font-family: inherit;   /* home uses it on links, which inherit; a button does not */
  white-space: nowrap;
}

.stk-wa-send:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: default;
  transform: none;
}

/* --- Categories | stickers ----------------------------------------------- */

.stk-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}

.stk-cats {
  position: sticky;
  top: 130px;
  background: #fff;
  border: 1px solid var(--stk-border);
  border-radius: 12px;
  padding: 6px;
}

.stk-cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stk-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 15px;
  color: #374151;
  text-align: left;
  cursor: pointer;
}

.stk-cat:hover {
  background: #f3f4f6;
}

.stk-cat:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: -2px;
}

.stk-cat.is-active {
  background: var(--brand-primary-light);
  color: var(--brand-primary-dark);
  font-weight: 600;
}

.stk-cat-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 400;
  color: #9ca3af;
}

/* Some picked from this category: "3 of 10", in the accent colour. */
.stk-cat-count.has-picked {
  color: var(--brand-primary);
  font-weight: 600;
}

.stk-panel {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--stk-border);
  border-radius: 12px;
  padding: 16px;
}

.stk-panel[hidden] {
  display: none;
}

.stk-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.stk-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

/* A grid item's min-width defaults to its content, and the poster's intrinsic
   512 px would otherwise stop the columns shrinking on a phone. */
.stk-grid > li {
  min-width: 0;
}

/* A tile is a pack card: white, hairline border, lift on hover. Picked takes
   the recommended-pack treatment, the one accented card state home uses. */
.stk-tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--stk-border);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.stk-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  border-color: var(--brand-primary);
}

.stk-tile:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.stk-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stk-tile[aria-pressed="true"] {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-primary-light);
}

/* Shown only on a picked tile, shaped like home's completed-pack badge. */
.stk-badge {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.stk-tile[aria-pressed="true"] .stk-badge {
  display: inline-flex;
}

/* --- What will be sent --------------------------------------------------- */

.stk-dialog {
  box-sizing: border-box;   /* the padding sits inside the width, or a phone clips it */
  max-width: 440px;
  width: calc(100% - 32px);
  border: 1px solid var(--stk-border);
  border-radius: 12px;
  padding: 20px;
}

.stk-dialog::backdrop {
  background: rgba(17, 24, 39, 0.4);
}

/* The claim instructions, transcribed from profile.css's Connect WhatsApp
   block (.v2-wa-help, -code, -alt, -qr). Copied under this page's prefix
   because home.css, which this page loads, already means something else by
   .v2-wa-body. */
.stk-send-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 16px;
}
.stk-send-body .v2-wa-btn { align-self: flex-start; }
.stk-help { margin: 0; font-size: 13px; color: #4b5563; line-height: 1.45; }
.stk-code { margin: 0; font-size: 13px; color: #374151; }
.stk-code strong { letter-spacing: 1px; }
.stk-alt { margin: 0; font-size: 12px; }
.stk-alt a { color: var(--brand-primary); }
.stk-note { margin: 0; font-size: 12px; color: #6b7280; }
.stk-qr {
  align-self: center;
  padding: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  line-height: 0;
}
.stk-qr svg { width: 200px; height: 200px; display: block; }

.stk-soon {
  font-size: 13px;
  color: #6b7280;
}

.stk-dialog-actions {
  display: flex;
  justify-content: flex-end;
}

/* --- Phones: the category list becomes a row of tabs, as on Profile ------- */

@media (max-width: 720px) {
  .stk-page {
    padding: 16px 12px 48px;
  }
  .stk-title {
    font-size: 22px;
  }
  /* The header wraps to two rows here and its height varies, so the summary
     scrolls with the page rather than sticking under it. */
  .stk-summary {
    position: static;
    padding: 10px 12px;
    gap: 12px;
  }
  .stk-wa-send {
    padding: 10px 16px;
  }
  .stk-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .stk-cats {
    position: static;
    padding: 0;
    background: none;
    border: none;
    border-bottom: 1px solid var(--stk-border);
    border-radius: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .stk-cats::-webkit-scrollbar {
    display: none;
  }
  .stk-cat-list {
    display: flex;
  }
  .stk-cat {
    width: auto;
    padding: 10px 12px;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
  }
  .stk-cat:hover {
    background: none;
  }
  .stk-cat.is-active {
    background: none;
    border-bottom-color: var(--brand-primary);
  }
  .stk-panel {
    padding: 12px;
  }
  .stk-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .stk-tile {
    padding: 2px;
  }
}
