/* Public portal pages. Component primitives live in platform.css. */

/* ------------------------------------------------------------------ hero */
.hero { position: relative; overflow: hidden; padding: clamp(56px, 9vw, 120px) 0 clamp(40px, 6vw, 80px); }
.hero-bg { position: absolute; inset: -20% -10% auto; height: 140%; z-index: 0; pointer-events: none; }
.hero-bg span { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; animation: float 18s ease-in-out infinite; }
.hero-bg span:nth-child(1) { width: 46vw; height: 46vw; left: -6vw; top: 0; background: rgba(236, 0, 140, 0.32); }
.hero-bg span:nth-child(2) { width: 38vw; height: 38vw; right: -4vw; top: 8%; background: rgba(99, 102, 241, 0.30); animation-delay: -6s; }
.hero-bg span:nth-child(3) { width: 30vw; height: 30vw; left: 40%; top: 55%; background: rgba(163, 35, 142, 0.26); animation-delay: -12s; }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(3%, -6%) scale(1.08); } }
.hero-inner { position: relative; z-index: 1; text-align: center; }
.hero h1 { margin-bottom: var(--sp-4); }
.grad { background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { max-width: 620px; margin: 0 auto var(--sp-5); font-size: clamp(1rem, 2vw, 1.2rem); color: var(--c-text-2); }
.hero-actions { justify-content: center; margin-bottom: var(--sp-6); }
.hero-stats { display: flex; gap: clamp(20px, 5vw, 56px); justify-content: center; flex-wrap: wrap; margin: 0; }
.hero-stats div { text-align: center; }
.hero-stats dt { font-family: var(--display); font-size: clamp(1.5rem, 3.5vw, 2.2rem); font-weight: 700; letter-spacing: -0.03em; color: var(--brand); }
.hero-stats dd { margin: 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--c-text-3); }

.section-alt { background: linear-gradient(180deg, transparent, var(--c-bg-2) 12%, var(--c-bg-2) 88%, transparent); }
.mt-6 { margin-top: var(--sp-6); }

/* ------------------------------------------------------------------ game cards */
.game-card .thumb { background: linear-gradient(135deg, rgba(236, 0, 140, .16), rgba(99, 102, 241, .14)); }
.play-badge { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-primary); color: #fff; font-size: 1.3rem; box-shadow: var(--shadow-glow); transform: scale(0.85); transition: transform var(--t-med) var(--ease); }
.game-card:hover .play-badge { transform: scale(1); }
.thumb-tag { position: absolute; left: 10px; top: 10px; padding: 4px 10px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--text); border: 1px solid var(--border); backdrop-filter: blur(6px); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; }
.game-card[style*="--card-accent"] .body { border-top: 2px solid var(--card-accent); }

/* ------------------------------------------------------------------ filters */
.filters { margin-bottom: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); }
.filters-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.filters-row .input { flex: 1 1 240px; }
.filters-row .select { flex: 0 0 auto; min-width: 150px; }
.chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.results-count { margin: 0 0 var(--sp-4); }

/* ------------------------------------------------------------------ occasions + campaigns */
.occasion-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-6); }
.occasion-chip {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, color-mix(in srgb, var(--o1) 22%, transparent), color-mix(in srgb, var(--o2) 16%, transparent));
  border: 1px solid color-mix(in srgb, var(--o1) 35%, transparent);
  color: var(--c-text); font-weight: 600; text-decoration: none !important;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast);
}
.occasion-chip:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.occasion-dot { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(135deg, var(--o1), var(--o2)); flex: none; }
.campaign-card { display: flex; flex-direction: column; gap: var(--sp-3); align-items: flex-start; border-top: 3px solid var(--brand); text-decoration: none !important; color: inherit; }
.campaign-logo { max-height: 38px; max-width: 180px; object-fit: contain; }

/* ------------------------------------------------------------------ enterprise block */
.enterprise-card {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(24px, 5vw, 56px); align-items: center;
  padding: clamp(28px, 5vw, 56px); border-radius: var(--r-xl);
  background: var(--grad-hero), var(--c-surface); border: 1px solid var(--c-border-strong); box-shadow: var(--shadow-2);
}
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-4); }
.steps li { counter-increment: step; display: flex; flex-direction: column; gap: 2px; padding-left: 52px; position: relative; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; font-family: var(--display);
}
.steps span { color: var(--c-text-2); font-size: 0.92rem; }
@media (max-width: 860px) { .enterprise-card { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ detail page */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; color: var(--c-text-3); margin-bottom: var(--sp-4); }
.crumbs a { color: var(--c-text-2); }
.detail { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(24px, 4vw, 48px); align-items: center; }
.detail-media { border-radius: var(--r-xl); overflow: hidden; border: 1px solid var(--c-border); box-shadow: var(--shadow-2); background: var(--c-surface-2); }
.detail-media img, .detail-media svg { width: 100%; height: auto; display: block; }
.detail-body .lead { font-size: 1.15rem; color: var(--c-text-2); }
.detail-body .meta { margin-bottom: var(--sp-4); }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }

.variant-card { display: flex; flex-direction: column; gap: var(--sp-3); align-items: flex-start; }
.variant-swatch { width: 100%; height: 8px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--v1), var(--v2)); }

/* ------------------------------------------------------------------ campaign page */
.campaign-scope .btn-brand { background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary)); color: #fff; }
.campaign-scope .badge-primary { background: color-mix(in srgb, var(--brand-primary) 20%, transparent); color: var(--brand-primary); border-color: color-mix(in srgb, var(--brand-primary) 40%, transparent); }
.campaign-hero { padding: clamp(48px, 8vw, 96px) 0; background-size: cover; background-position: center; text-align: center; border-bottom: 1px solid var(--c-border); }
.brand-header { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: var(--sp-4); }
/* The TENANT's logo on a campaign/game page — not the Tribastion lockup (platform.css). */
.brand-header .brand-logo, .board-logo { max-height: 60px; max-width: 260px; object-fit: contain; }
.brand-name { font-family: var(--font-display); font-size: 1.3rem; }
.share-row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; margin-top: var(--sp-5); justify-content: center; }

/* ------------------------------------------------------------------ leaderboard + share */
.board-card { border-top: 3px solid var(--v1); }
.board-logo { max-height: 40px; max-width: 200px; object-fit: contain; margin-bottom: 10px; }
.rank { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--c-surface-2); font-weight: 700; font-size: 0.8rem; }
.rank-1 { background: linear-gradient(135deg, #f7d774, #d4a017); color: #3a2a00; }
.rank-2 { background: linear-gradient(135deg, #dfe4ea, #a4b0be); color: #2f3542; }
.rank-3 { background: linear-gradient(135deg, #e0a878, #b06f3c); color: #2b1608; }
.table tbody tr.is-top td { background: var(--brand-tint); }
.share-card { display: flex; flex-direction: column; gap: var(--sp-3); align-items: center; border-top: 3px solid var(--v1); }
.share-preview { border-radius: var(--r-lg); border: 1px solid var(--c-border); width: 100%; height: auto; }

@media (max-width: 640px) {
  .hero-stats { gap: var(--sp-4); }
  .filters-row .select, .filters-row .btn { flex: 1 1 100%; }
}

/* ------------------------------------------------------------------ certificate */
.cert-frame {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); background: #fff;
}
.cert-image { width: 100%; height: auto; display: block; }
.cert-facts { display: grid; gap: 8px; margin: 0; }
.cert-facts > div { display: flex; justify-content: space-between; gap: var(--sp-4); align-items: baseline; border-bottom: 1px dashed var(--border); padding-bottom: 6px; }
.cert-facts > div:last-child { border-bottom: 0; }
.cert-facts dt { color: var(--text-faint); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.cert-facts dd { margin: 0; font-weight: 600; text-align: right; }
#cert-caption { min-height: 120px; font-size: 0.88rem; }

/* ------------------------------------------------------------------ multiplayer badges */
.mp-tag { display: inline-flex; align-items: center; gap: 5px; }
.mp-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------------ learning */
.learn-card { border-left: 3px solid var(--brand); }
.learn-card .lead { font-size: 1.05rem; line-height: 1.5; }
.topic-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: var(--r-pill); background: var(--secondary-tint); color: var(--secondary);
  font-size: 0.72rem; font-weight: 600;
}
.cert-learning { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.cert-learning-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; font-size: 0.85rem; }


/* ==========================================================================
   Motion
   Self-hosted (the site's CSP is script-src 'self'); the classes below are what
   public/js/motion.js toggles. Every one of them is a no-op until it is added, so a
   page with JavaScript off, or a visitor who asked for less motion, sees the finished
   layout rather than a blank one.
   ========================================================================== */
[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 620ms cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0ms),
              transform 620ms cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
[data-reveal].is-shown { opacity: 1; transform: none; will-change: auto; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

[data-tilt] {
  transform: perspective(900px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-reduced-motion: reduce) { [data-tilt] { transform: none; } }

/* ==========================================================================
   The answerable teaching item
   The product's core loop on a marketing page. It has to look like the thing it is a
   sample of, so it borrows the game's colour language exactly.
   ========================================================================== */
.try-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  /* Stretch, not start: cards of different lengths in one row looked broken rather than
     deliberate, and the choices belong on the same line across the row. */
  align-items: stretch;
}
.try-card {
  display: grid; gap: 12px;
  /* The prompt takes the slack so the buttons line up across the row. */
  grid-template-rows: auto 1fr auto auto;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color 220ms ease, box-shadow 220ms ease;
}
.try-card.is-right { border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
.try-card.is-wrong { border-color: color-mix(in srgb, var(--bad) 55%, transparent); }

.try-head { display: flex; align-items: center; gap: 8px; }
.try-kind {
  font-size: 0.63rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--brand);
}
.try-topic {
  margin-left: auto;
  font-size: 0.63rem; font-weight: 700; letter-spacing: 0.05em;
  padding: 3px 9px; border-radius: 999px;
  color: var(--text-dim); background: var(--surface-2);
}

.try-body { align-self: start; }
.try-mail {
  border-radius: 9px; padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.try-mail-head { display: flex; gap: 10px; align-items: flex-start; }
.try-mail-icon { font-size: 1rem; line-height: 1.3; flex: none; opacity: 0.75; }
.try-mail-from {
  display: block; font-family: var(--mono);
  font-size: 0.74rem; color: var(--text-dim);
  overflow-wrap: anywhere;
}
.try-mail-subject { display: block; font-weight: 700; font-size: 0.92rem; margin-top: 2px; }
.try-mail-body { margin: 9px 0 0; font-size: 0.84rem; line-height: 1.5; color: var(--text-dim); }
.try-prompt { margin: 0; font-weight: 600; font-size: 0.98rem; line-height: 1.45; }
.try-detail { margin: 6px 0 0; font-size: 0.85rem; color: var(--text-dim); }

.try-choices { display: flex; flex-wrap: wrap; gap: 7px; }
.try-choice { flex: 1 1 auto; min-width: 92px; }
.try-choice-wide { flex: 1 1 100%; text-align: left; justify-content: flex-start; }
.try-choice:disabled { opacity: 1; cursor: default; }
/* After an answer the right one is always shown, whether or not it was chosen: a card
   that only says "wrong" is exactly the failure this platform exists to avoid. */
.try-choice.is-answer {
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  border-color: var(--ok); color: var(--ok); font-weight: 700;
}
.try-choice.is-chosen-wrong {
  background: color-mix(in srgb, var(--bad) 12%, transparent);
  border-color: color-mix(in srgb, var(--bad) 55%, transparent);
  color: var(--bad); text-decoration: line-through;
}

.try-reveal {
  overflow: hidden; height: 0;
  transition: height 320ms cubic-bezier(0.22, 1, 0.36, 1);
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.try-verdict { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.try-mark {
  display: grid; place-items: center; width: 19px; height: 19px; flex: none;
  border-radius: 50%; font-size: 0.66rem; font-weight: 800; color: #fff;
  background: var(--text-dim);
}
.is-right .try-mark { background: var(--ok); }
.is-wrong .try-mark { background: var(--bad); }
.try-verdict-text { font-family: var(--display); font-weight: 700; font-size: 0.92rem; }
.is-right .try-verdict-text { color: var(--ok); }
.is-wrong .try-verdict-text { color: var(--bad); }
.try-answer-line { margin: 0 0 6px; font-size: 0.92rem; }
.try-why { margin: 0; font-size: 0.86rem; line-height: 1.55; }
.try-takeaway {
  margin: 9px 0 0; padding: 9px 11px; border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.82rem; line-height: 1.45;
}
.try-takeaway span {
  display: block; font-size: 0.58rem; font-weight: 800; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 3px;
}
.try-foot { margin: 22px 0 0; text-align: center; color: var(--text-dim); font-size: 0.9rem; }
@media (prefers-reduced-motion: reduce) { .try-reveal { transition: none; } }

/* ==========================================================================
   Topics: the syllabus, in public
   ========================================================================== */
.measure { max-width: 62ch; }
.topic-hero, .topic-detail-hero { padding-bottom: 20px; }
.topic-stats { margin-top: 22px; }

.topic-card { display: grid; gap: 7px; align-content: start; }
.topic-cat {
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--brand);
}
.topic-count {
  justify-self: start; margin-top: 2px;
  font-size: 0.68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  color: var(--text-dim); background: var(--surface-2);
}
.why-card {
  margin-top: 18px; padding: 16px 18px;
  border-radius: var(--radius);
  border-left: 3px solid var(--brand);
  background: var(--surface-2);
}
.topic-strip { display: flex; flex-wrap: wrap; gap: 9px; }
.topic-pill {
  display: flex; align-items: baseline; gap: 8px;
  padding: 10px 15px; border-radius: 999px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border);
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), border-color 200ms ease;
}
.topic-pill:hover { transform: translateY(-2px); border-color: var(--brand); }
.topic-pill strong { font-size: 0.88rem; }
.topic-pill span { font-size: 0.7rem; color: var(--text-dim); }
@media (prefers-reduced-motion: reduce) { .topic-pill:hover { transform: none; } }

/* What a game teaches, on the card, because that is why you would open it here. */
.badge-teaches {
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 40%, transparent);
}
.card-learn {
  margin: 8px 0 0; font-size: 0.78rem; line-height: 1.45;
  color: var(--text-dim);
  padding-left: 9px; border-left: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
}

.cta-band {
  display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between;
  padding: 26px 28px; border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.cta-band p { max-width: 56ch; margin-top: 6px; }

.chips-label { align-self: center; margin-right: 2px; }
