/* ==========================================================================
   ALPHA ENGLISH SHOP — /shop/
   Loaded after alpha-english.css, which supplies the tokens, type, hero,
   pills and buttons. Only the shop's own pieces live here.
   ========================================================================== */

.ae-shop-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Hero: the Alpha English hero, centred and compact, with no logo column --- */

.ae-shop-hero { padding: 24px 0 52px; text-align: center; }
.ae-shop-hero__inner { position: relative; }
/* My downloads + Language: pinned to the top right so they add no height. */
.ae-shop-tools {
  position: absolute;
  z-index: 6;
  top: 18px;
  left: 0;
  right: 0;
  max-width: var(--ae-wrap);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 10px;
}
.ae-shop-tools .ae-lang { max-width: none; margin: 0; padding: 0; }
.ae-shop-tools .ae-lang__panel { right: 0; }
.ae-shop-account {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
  padding: 6px 14px;
  border-radius: 999px;
  border: 2px solid var(--ae-ink);
  background: var(--ae-paper);
  text-decoration: none;
  white-space: nowrap;
}
.ae-shop-account:hover { background: var(--ae-yellow-soft); }
.ae-shop-hero .ae-blend__chips { gap: 12px; margin-bottom: 16px; }
.ae-shop-hero .ae-tile { width: 62px; height: 62px; font-size: 34px; border-radius: 17px; }
.ae-shop-hero .ae-kicker { margin-bottom: 10px; }
.ae-shop-hero h1 { font-size: clamp(34px, 4.8vw, 54px); margin-bottom: 12px; }
.ae-shop-hero .ae-hero__lede { font-size: 18px; margin: 0 auto; }

/* On narrower screens they would sit on the letter tiles, so they go back in the flow. */
@media (max-width: 900px) {
  .ae-shop-hero { padding-top: 16px; }
  .ae-shop-tools { position: relative; top: auto; margin-bottom: 14px; }
}
@media (max-width: 480px) {
  .ae-shop-hero { padding: 14px 0 70px; }
  .ae-shop-hero .ae-tile { width: 54px; height: 54px; font-size: 30px; border-radius: 15px; }
  .ae-shop-hero .ae-hero__lede { font-size: 16.5px; }
}

/* --- Section heads --- */

.ae-shop-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px 24px;
  margin-bottom: 16px;
}
.ae-shop-head .ae-h2 { margin-bottom: 0; }
.ae-shop-head p { font-size: 15px; color: var(--ae-text-soft); }

/* --- Trending panel --- */

.ae-shop-trending { padding-top: 22px; padding-bottom: 14px; }

.ae-shop-browse { padding-top: 26px; }
.ae-shop-panel {
  background: var(--ae-yellow-soft);
  border: 3px solid var(--ae-ink);
  border-radius: 28px;
  box-shadow: 8px 10px 0 var(--ae-ink);
  padding: 22px 24px 24px;
}
.ae-shop-panel .ae-pill { margin-bottom: 10px; }
.ae-shop-panel .ae-shop-head { margin-bottom: 30px; }

/* --- Grid --- */

.ae-shop-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px 18px;
}
.ae-shop-item { position: relative; display: flex; min-width: 0; }

/* Rank badges on the trending row: 1, 2, 3, 4. */
.ae-shop-grid--ranked { counter-reset: rank; }
.ae-shop-grid--ranked > .ae-shop-item { counter-increment: rank; }
.ae-shop-grid--ranked > .ae-shop-item::before {
  content: counter(rank);
  position: absolute;
  z-index: 2;
  top: -16px;
  left: -12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--ae-yellow);
  background: var(--ae-ink);
  color: var(--ae-yellow);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Tile --- */

.ae-shop-tile {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ae-paper);
  border: 2px solid var(--ae-ink);
  border-radius: 18px;
  box-shadow: var(--ae-chunky);
  color: inherit;
  text-decoration: none;
}
/* Tiles are not links yet. Once a tile becomes <a class="ae-shop-tile">,
   it lifts on hover like the cards on the Alpha English page. */
a.ae-shop-tile { transition: transform .15s ease, box-shadow .15s ease; }
a.ae-shop-tile:hover { transform: translate(-2px, -3px); box-shadow: 6px 8px 0 var(--ae-ink); }

/* The cover is a square. Until its image is uploaded, the coloured label
   underneath shows instead (see shop.js). */
.ae-shop-tile__cover {
  position: relative;
  aspect-ratio: 1;
  border-bottom: 2px solid var(--ae-ink);
  background: var(--ae-yellow-soft);
}
.ae-shop-tile__cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ae-shop-tile__blank {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  padding: 16px;
}
.ae-shop-tile__blank small {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #3A3F55;
}
.ae-shop-tile__blank b {
  font-size: clamp(19px, 2.1vw, 25px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.4px;
  overflow-wrap: anywhere;
}
.ae-shop-tile__cover--thanksgiving { background: var(--ae-orange-soft); }
.ae-shop-tile__cover--halloween    { background: var(--ae-purple-soft); }
.ae-shop-tile__cover--everyday     { background: var(--ae-blue-soft); }
.ae-shop-tile__cover--holiday      { background: var(--ae-red-soft); }
.ae-shop-tile__cover--free         { background: var(--ae-green-soft); }
.ae-shop-tile__cover--bundle       { background: var(--ae-yellow); }

.ae-shop-tile__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px 13px;
}
.ae-shop-tile h3 { font-size: 16.5px; line-height: 1.3; font-weight: 700; }
.ae-shop-tile__meta { font-size: 13px; line-height: 1.4; color: var(--ae-text-soft); }

.ae-shop-tile__buy {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
.ae-shop-price { font-size: 20px; font-weight: 800; line-height: 1.2; }
.ae-shop-price--free { color: #1B6B27; }
.ae-shop-price--was {
  font-size: 14px;
  font-weight: 500;
  color: var(--ae-text-soft);
  text-decoration: line-through;
}
.ae-shop-tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 3px 10px 2px;
  border-radius: 999px;
  border: 2px solid var(--ae-ink);
  background: var(--ae-yellow);
  white-space: nowrap;
}

/* --- Filters: radio buttons, so browsing works with no script ---
   Three groups combine: type, holiday (a second row that appears while
   Holidays is picked) and grade. */

.ae-shop-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}
.ae-shop-filters:last-of-type { margin-bottom: 30px; }
.ae-shop-filters__label {
  flex: 0 0 76px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--ae-text-soft);
}
.ae-shop-chip { position: relative; display: inline-flex; cursor: pointer; }
.ae-shop-chip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.ae-shop-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 2px solid var(--ae-ink);
  background: var(--ae-paper);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}
.ae-shop-chip:hover span { background: var(--ae-yellow-soft); }
.ae-shop-chip input:checked + span { background: var(--ae-ink); color: var(--ae-yellow); }
.ae-shop-chip input:focus-visible + span { outline: 3px solid var(--ae-blue); outline-offset: 3px; }

/* The holiday row belongs to the Holidays chip. */
.ae-shop-filters--sub { display: none; }
.ae-shop-browse:has(input[value="holiday"]:checked) .ae-shop-filters--sub { display: flex; }
.ae-shop-filters--sub .ae-shop-chip span { background: var(--ae-orange-soft); }
.ae-shop-filters--sub .ae-shop-chip:hover span { background: var(--ae-yellow-soft); }
.ae-shop-filters--sub .ae-shop-chip input:checked + span { background: var(--ae-ink); }

/* Type. The rules for each holiday and each grade are written into
   shop/index.html by tools/build-shop.py, because they depend on the packs. */
.ae-shop-browse:has(input[value="free"]:checked)    .ae-shop-item:not(.ae-shop-item--free),
.ae-shop-browse:has(input[value="bundle"]:checked)  .ae-shop-item:not(.ae-shop-item--bundle),
.ae-shop-browse:has(input[value="holiday"]:checked) .ae-shop-item:not(.ae-shop-item--holiday) {
  display: none;
}

/* Shown by shop.js when a combination leaves no packs. */
.ae-shop-empty { margin-top: 4px; font-size: 16px; }

/* --- Smaller screens --- */

@media (max-width: 980px) {
  .ae-shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* The trending four stay on one row, as compact tiles, down to phones. */
  .ae-shop-grid--ranked { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 14px; }
  .ae-shop-grid--ranked .ae-shop-tile__blank { padding: 12px; }
  .ae-shop-grid--ranked .ae-shop-tile__body { padding: 12px 12px 14px; }
  .ae-shop-grid--ranked h3 { font-size: 15px; }
  .ae-shop-grid--ranked .ae-shop-tile__desc { font-size: 13px; }
}
@media (max-width: 700px) {
  .ae-shop-filters__label { flex-basis: 100%; }
  .ae-shop-chip span { height: 42px; padding: 0 15px; font-size: 14.5px; }
  .ae-shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .ae-shop-panel { padding: 22px 16px 24px; border-radius: 22px; box-shadow: 5px 6px 0 var(--ae-ink); }
  .ae-shop-grid--ranked > .ae-shop-item::before { top: -13px; left: -8px; width: 38px; height: 38px; font-size: 17px; }
  .ae-shop-tile { box-shadow: 3px 4px 0 var(--ae-ink); }
  .ae-shop-tile__blank { padding: 12px; }
  .ae-shop-tile__body { padding: 12px 12px 14px; }
  .ae-shop-tile h3 { font-size: 15px; }
  .ae-shop-tile__desc { font-size: 13px; }
  .ae-shop-price { font-size: 18px; }
}
@media (max-width: 360px) {
  .ae-shop-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   PACK PAGE — /shop/<name>/
   ========================================================================== */

.ae-pack { padding: 20px 0 76px; }
.ae-pack .ae-h2 { font-size: clamp(24px, 3vw, 30px); }

.ae-pack-top {
  position: relative;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 22px;
}
.ae-pack-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; }
.ae-pack-crumbs a {
  font-weight: 700;
  text-decoration-color: var(--ae-yellow);
  text-decoration-thickness: 3px;
  text-underline-offset: 3px;
}
.ae-pack-crumbs span { color: var(--ae-text-soft); }
.ae-pack-top .ae-shop-account { margin-left: auto; }
.ae-pack-top .ae-lang { flex: 0 0 auto; max-width: none; margin: 0; padding: 0; }
.ae-pack-top .ae-lang__panel { right: 0; }

/* --- Pictures + buy box --- */

.ae-pack-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 44px;
  align-items: start;
}
.ae-pack-gallery { display: flex; gap: 16px; min-width: 0; }
.ae-pack-thumbs { flex: 0 0 76px; display: flex; flex-direction: column; gap: 12px; }
.ae-pack-thumb {
  padding: 0;
  overflow: hidden;
  background: var(--ae-paper);
  border: 2px solid var(--ae-ink);
  border-radius: 14px;
  opacity: 0.7;
}
.ae-pack-thumb:hover { opacity: 1; }
.ae-pack-thumb[aria-pressed="true"] { opacity: 1; box-shadow: 3px 4px 0 var(--ae-ink); }
.ae-pack-thumb:focus-visible { outline: 3px solid var(--ae-blue); outline-offset: 3px; }
.ae-pack-thumb img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.ae-pack-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border: 3px solid var(--ae-ink);
  border-radius: 24px;
}
.ae-pack-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* A page-shaped picture does not fill the square: plain paper behind it, no label. */
.ae-pack-stage:has(img) { background: var(--ae-paper); }
.ae-pack-stage:has(img) .ae-shop-tile__blank { display: none; }
.ae-pack-stage .ae-shop-tile__blank { padding: 28px; }
.ae-pack-stage .ae-shop-tile__blank b { font-size: clamp(28px, 4vw, 44px); }

.ae-pack-buy {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 2px 0 0;
}
.ae-pack-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.ae-shop-tag--plain { background: var(--ae-paper); }
.ae-pack-buy h1 {
  font-size: clamp(27px, 3.2vw, 36px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.8px;
}
.ae-pack-sub { font-size: 17px; line-height: 1.5; color: var(--ae-text-soft); }
.ae-pack-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin-top: 4px;
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}
.ae-pack-buy .ae-btn {
  flex: 1 1 200px;
  justify-content: center;
  font-family: inherit;
  font-size: 17px;
}
.ae-pack-buy .ae-btn,
.ae-pack-buy .ae-btn:hover,
.ae-pack-buy .ae-btn:active { box-shadow: none; transform: none; }
.ae-pack-buy .ae-btn[aria-busy="true"] { opacity: 0.6; }
.ae-pack-buy .ae-btn[aria-disabled="true"] { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }
.ae-pack-price--free { color: #1B6B27; }
.ae-pack-getnote { font-size: 15px; line-height: 1.5; color: var(--ae-text-soft); }
.ae-pack-getnote a {
  color: var(--ae-ink);
  font-weight: 700;
  text-decoration-color: var(--ae-yellow);
  text-decoration-thickness: 3px;
  text-underline-offset: 3px;
}

.ae-pack-ticks {
  list-style: none;
  margin: 6px 0 0;
  padding: 16px 0 0;
  border-top: 2px dashed var(--ae-line);
  display: grid;
  gap: 9px;
  font-size: 15px;
  line-height: 1.5;
}
.ae-pack-ticks li { display: flex; align-items: flex-start; gap: 10px; }
.ae-pack-ticks li::before {
  content: "\2713";
  flex: 0 0 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--ae-green-soft);
  color: #23812F;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ae-pack-ticks--plain { margin: 0; padding: 0; border: 0; font-size: 16px; }

/* --- About + facts --- */

.ae-pack-body {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 44px;
  align-items: start;
  margin-top: 60px;
}
.ae-pack-about h3 { font-size: 20px; font-weight: 700; margin: 28px 0 12px; }
.ae-pack-about .ae-prose p:last-child { margin-bottom: 0; }
.ae-pack-upsell { margin-top: 28px; }
.ae-pack-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ae-pack-level {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--ae-paper);
  border: 2px solid var(--ae-ink);
  border-radius: 18px;
  padding: 16px;
  font-size: 15px;
  line-height: 1.5;
}
.ae-pack-level b {
  align-self: flex-start;
  font-size: 13px;
  font-weight: 700;
  padding: 2px 12px;
  border-radius: 999px;
  border: 2px solid var(--ae-ink);
}
.ae-pack-level--easy b { background: var(--ae-green-soft); }
.ae-pack-level--mid b  { background: var(--ae-orange-soft); }
.ae-pack-level--hard b { background: var(--ae-purple-soft); }

.ae-pack-facts {
  background: var(--ae-paper);
  border: 2px solid var(--ae-ink);
  border-radius: var(--ae-radius);
  padding: 22px 24px 24px;
}
.ae-pack-facts h2 { font-size: 20px; font-weight: 800; margin-bottom: 12px; }
.ae-pack-facts dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 18px; font-size: 15px; }
.ae-pack-facts dt { font-weight: 700; }
.ae-pack-facts dd { margin: 0; color: var(--ae-text-soft); }
.ae-pack-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.ae-pack-chips span {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 12px;
  border-radius: 999px;
  border: 2px solid var(--ae-ink);
  background: var(--ae-cream);
}

.ae-pack-section { margin-top: 64px; }
.ae-pack-section .ae-h2 { margin-bottom: 22px; }

@media (max-width: 860px) {
  .ae-pack-hero, .ae-pack-body { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .ae-pack-body { margin-top: 44px; }
  .ae-pack-section { margin-top: 48px; }
}
@media (max-width: 620px) {
  .ae-pack-gallery { flex-direction: column-reverse; gap: 12px; }
  .ae-pack-thumbs { flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; }
  .ae-pack-thumb { width: 62px; }
  .ae-pack-stage { flex: 0 0 auto; border-radius: 20px; }
  .ae-pack-buy { padding: 0; }
  .ae-pack-levels { grid-template-columns: minmax(0, 1fr); }
}
