/* The written guides: the Hong Kong mahjong rules page (scripts/generate-guide-pages.js).
   They build on the policy pages' layout (css/privacy.css), are as wide as the personality quiz (56rem), and borrow the
   Play Mahjong page's look: the felt hero with the floating cat, cards, 3D tiles and gold accents. */

/* A cream page with the text on white cards. */
main.guide {
  display: flow-root; /* keeps the article's margins inside, so the cream runs to the footer */
  background: var(--color-background);
}

.guide-inner {
  margin-top: 2rem;
}

/* Narrower than the nav on a desktop, the same width as the personality quiz and the Play page. */
.guide-inner.container {
  width: min(100% - 2rem, 56rem);
}

/* The body font is the single-weight "Avenir Medium", which has no bold, so bold text asks for the
   full Avenir family and shows up as bold. */
.guide-inner strong {
  font-family: Avenir, "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
}

.guide-inner > section,
.guide-inner > .guide-related {
  margin: 1.25rem 0;
  padding: 1.5rem 1.75rem;
  border-radius: 14px;
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}

/* The hero: the game's green table felt, light in the middle and dark at the edges, with the
   cat floating over it. */
.guide-hero {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 2rem 1.5rem 2.25rem;
  border: 0;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 35%, #127048 0%, #074029 85%);
  color: #FFF8F0;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.guide-cat {
  display: block;
  width: clamp(84px, 9vw, 120px);
  height: auto;
  animation: guide-float 4s ease-in-out infinite;
  -webkit-user-drag: none;
  user-select: none;
}

@keyframes guide-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
  .guide-cat { animation: none; }
}

.privacy .guide-hero .guide-eyebrow {
  margin: 0;
  color: #ffd27a;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-hero .privacy-title {
  margin: 0;
  color: #FFF8F0;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.1;
}

.privacy .guide-hero .privacy-updated,
.privacy .guide-hero .privacy-lead {
  margin: 0;
  color: rgba(255, 248, 240, 0.82);
}

.privacy .guide-hero .privacy-lead {
  max-width: 44rem;
}

.privacy .guide-hero a:not(.btn) {
  color: #ffd27a;
}

.guide-perks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

.privacy .guide-perks li {
  display: flex;
  color: #FFF8F0;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 248, 240, 0.12);
  font-size: 0.85rem;
  font-weight: 600;
}

.privacy .guide-perks li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffd27a;
}

.guide-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.guide .btn-white {
  background: #fff;
  color: var(--color-text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.guide .btn-white:hover {
  background: #f6f1ea;
  color: var(--color-text);
}

.guide .btn-gold {
  background: linear-gradient(180deg, #ffd98a 0%, #f4a020 100%);
  color: #3a1a00;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.guide .btn-gold:hover {
  filter: brightness(1.05);
  color: #3a1a00;
}

/* The contents: a soft box with a two-column list. */
.guide-toc {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: rgba(var(--color-secondary-rgb), 0.1);
}

.guide-toc p {
  margin: 0 0 0.5rem;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 1.15rem;
}

.guide-toc ol {
  margin: 0;
  padding-left: 1.25rem;
  columns: 2 16rem;
}

/* Section titles. */
.guide-inner h2 {
  margin: 0 0 1rem;
  color: var(--color-primary);
  font-size: clamp(1.3rem, 3.5vw, 1.7rem);
}

/* Tiles: an ivory face on a green back, as in the game. */
.guide-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1rem;
  margin: 1rem 0 1.5rem;
}

.guide-meld {
  display: inline-flex;
  gap: 4px;
}

.guide-meld img {
  box-sizing: border-box;
  width: 38px;
  height: 51px;
  padding: 4px 3px;
  border-radius: 6px;
  background: linear-gradient(180deg, #fffdf7 0%, #f3ead8 100%);
  object-fit: contain;
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.08),
    0 3px 0 #2f8a5b,
    0 4px 0 #1f6a43,
    0 6px 8px rgba(0, 0, 0, 0.18);
}

/* A whole suit, 1 to 9, on one row: the tiles shrink to fit a phone. */
.guide-tiles-suit {
  margin: 0.6rem 0 1.1rem;
}

.guide-tiles-suit .guide-meld {
  display: flex;
  width: 100%;
  max-width: 26rem;
  gap: 4px;
}

.guide-tiles-suit .guide-meld img {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  height: auto;
  aspect-ratio: 3 / 4;
}

/* Tables: a red header row on a rounded card. */
.guide .privacy-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.guide-table th,
.guide-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(var(--color-primary-rgb), 0.1);
  text-align: left;
  vertical-align: top;
}

.guide-table thead th {
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  border-bottom: 0;
}

.guide-table tbody tr:nth-child(even) {
  background: rgba(var(--color-secondary-rgb), 0.07);
}

.guide-table tbody tr:last-child td,
.guide-table tbody tr:last-child th {
  border-bottom: 0;
}

.guide-table-narrow th,
.guide-table-narrow td {
  text-align: center;
}

/* The play banner: the green felt again, with a gold title. */
.guide-cta {
  margin: 1.25rem 0;
  padding: 2rem 1.5rem;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 35%, #127048 0%, #074029 85%);
  color: #FFF8F0;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.privacy .guide-cta p {
  color: rgba(255, 248, 240, 0.85);
  margin: 0 0 1rem;
}

.privacy .guide-cta .guide-cta-title {
  margin-bottom: 0.4rem;
  color: #ffd27a;
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.guide-cta .btn {
  background: linear-gradient(180deg, #ffd98a 0%, #f4a020 100%);
  color: #3a1a00;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.privacy .guide-cta a {
  font-weight: 700;
}

.guide-related {
  border-top: 0;
}

.guide-related h2 {
  margin-bottom: 0.6rem;
}

/* The table diagram on the rules page (the same drawing as the printable rules sheet), on a
   soft card. On a phone the card runs edge to edge so the drawing is as big as it can be. */
.guide-figure {
  max-width: 34rem;
  margin: 1.5rem auto 1.75rem;
  padding: 1.25rem 1.25rem 1rem;
  border-radius: 16px;
  background: rgba(var(--color-secondary-rgb), 0.1);
  text-align: center;
}

.guide-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.guide-figure figcaption {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.45;
  opacity: 0.8;
}

@media (max-width: 600px) {
  .guide-inner > section,
  .guide-inner > .guide-related {
    padding: 1.25rem 1rem;
  }

  .guide-hero {
    padding: 1.5rem 1rem 1.75rem;
  }

  .guide-cat {
    width: 72px;
  }

  .privacy .guide-hero .privacy-lead {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .guide-hero-actions {
    width: 100%;
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  .guide-hero-actions .btn {
    flex: 1 1 0;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
    text-align: center;
  }

  .guide-figure {
    margin-inline: -1rem;
    padding: 0.75rem 0.5rem 0.85rem;
    border-radius: 0;
  }

  .guide-figure figcaption {
    padding-inline: 0.75rem;
  }
}
