/* =========================================================
   MahjongSolitaireOnline.com — Refined East Asian Luxury
   ========================================================= */

/* ---------------------------------------------------------
   Design tokens
   --------------------------------------------------------- */
:root {
  --color-jade-900: #064e3b;
  --color-jade-800: #065f46;
  --color-jade-700: #047857;
  --color-jade-600: #059669;
  --color-jade-100: #d1fae5;
  --color-ivory: #fffbf0;
  --color-cream: #f5f0e6;
  --color-gold: #c5a572;
  --color-gold-light: #e8d5a3;
  --color-charcoal: #1f2937;
  --color-stone: #57534e;
  --color-paper: #ffffff;
  --shadow-soft: 0 4px 20px rgba(6, 78, 59, 0.08);
  --shadow-card: 0 8px 32px rgba(6, 78, 59, 0.12);
}

/* ---------------------------------------------------------
   Typography
   --------------------------------------------------------- */
.font-display {
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
}

.font-body {
  font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ---------------------------------------------------------
   Page canvas
   --------------------------------------------------------- */
html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: linear-gradient(180deg, var(--color-ivory) 0%, var(--color-cream) 100%);
  color: var(--color-charcoal);
  font-family: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
}

/* ---------------------------------------------------------
   Layout
   --------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* ---------------------------------------------------------
   Color utilities
   --------------------------------------------------------- */
.bg-ivory { background-color: var(--color-ivory); }
.bg-cream { background-color: var(--color-cream); }
.bg-paper { background-color: var(--color-paper); }
.bg-jade-900 { background-color: var(--color-jade-900); }
.bg-jade-800 { background-color: var(--color-jade-800); }
.bg-jade-700 { background-color: var(--color-jade-700); }
.bg-jade-600 { background-color: var(--color-jade-600); }
.bg-jade-100 { background-color: var(--color-jade-100); }
.bg-gold { background-color: var(--color-gold); }

.h-40 { height: 10rem; }

.text-jade-900 { color: var(--color-jade-900); }

/* ---------------------------------------------------------
   Mobile navigation
   --------------------------------------------------------- */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-ivory);
  cursor: pointer;
  padding: 0.5rem;
}

.mobile-menu-toggle svg {
  width: 1.5rem;
  height: 1.5rem;
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: block;
  }

  header nav[aria-label="Primary"] {
    display: none;
  }
}

.mobile-menu {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-top: 1px solid rgba(197, 165, 114, 0.3);
}

.mobile-menu.open {
  display: block;
}

.mobile-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: center;
}

.mobile-menu a {
  color: var(--color-ivory);
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  min-height: 24px;
  line-height: 24px;
  transition: color 0.2s ease;
}

.mobile-menu a:hover {
  color: var(--color-gold);
}

/* ---------------------------------------------------------
   Breadcrumb navigation
   --------------------------------------------------------- */
.breadcrumb {
  font-size: 0.875rem;
  color: var(--color-stone);
}

.breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.breadcrumb li:not(:last-child)::after {
  content: '/';
  margin-left: 0.5rem;
  color: var(--color-gold);
}

.breadcrumb a {
  color: var(--color-jade-700);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb a:hover {
  color: var(--color-jade-900);
  text-decoration: underline;
}

.breadcrumb [aria-current="page"] {
  color: var(--color-stone);
}

/* Blog hero — used on list and article pages */
.hero {
  text-align: center;
}

.hero .max-w-3xl {
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}

/* Blog card header with centered category tag */
.card-header {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Card category tag shown in blog card headers */
.card-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--color-gold);
  border-radius: 9999px;
  color: var(--color-gold-light);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background-color: rgba(255, 251, 240, 0.08);
}
.text-jade-800 { color: var(--color-jade-800); }
.text-jade-700 { color: var(--color-jade-700); }
.text-gold { color: var(--color-gold); }
.text-gold-light { color: var(--color-gold-light); }
.text-gold-light-soft { color: rgba(232, 213, 163, 0.85); }
.text-charcoal { color: var(--color-charcoal); }
.text-stone { color: var(--color-stone); }
.text-paper { color: var(--color-paper); }
.text-ivory { color: var(--color-ivory); }

.border-gold { border-color: var(--color-gold); }
.border-jade-900 { border-color: var(--color-jade-900); }
.border-gold-20 { border-color: rgba(197, 165, 114, 0.2); }

/* ---------------------------------------------------------
   Shadows
   --------------------------------------------------------- */
.shadow-soft { box-shadow: var(--shadow-soft); }
.shadow-card { box-shadow: var(--shadow-card); }

/* ---------------------------------------------------------
   Decorative patterns
   --------------------------------------------------------- */
.pattern-lattice {
  background-image:
    linear-gradient(var(--color-gold) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-gold) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.06;
}

.pattern-dots {
  background-image: radial-gradient(var(--color-gold) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  opacity: 0.08;
}

.pattern-lattice-strong {
  position: relative;
  isolation: isolate;
}

.pattern-lattice-strong::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--color-gold) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-gold) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.2;
  z-index: -1;
  border-radius: inherit;
}

/* ---------------------------------------------------------
   Links
   --------------------------------------------------------- */
.link-jade {
  color: var(--color-jade-700);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.link-jade:hover {
  color: var(--color-jade-900);
  border-bottom-color: var(--color-gold);
}

.link-paper {
  color: var(--color-paper);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.link-paper:hover {
  border-bottom-color: var(--color-gold);
}

/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  border-radius: 9999px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--color-jade-700) 0%, var(--color-jade-900) 100%);
  color: var(--color-paper);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 9999px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--color-gold-light) 0%, var(--color-gold) 100%);
  color: var(--color-jade-900);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, filter 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn-gold:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.btn-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 9999px;
  font-weight: 600;
  background-color: rgba(255, 255, 255, 0.12);
  color: var(--color-paper);
  border: 1px solid var(--color-gold);
  transition: background-color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.btn-subtle:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.btn-gold:disabled,
.btn-subtle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-gold:disabled:hover,
.btn-subtle:disabled:hover {
  transform: none;
  filter: none;
}

/* ---------------------------------------------------------
   Cards
   --------------------------------------------------------- */
.card {
  background-color: var(--color-paper);
  border-radius: 1rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(197, 165, 114, 0.2);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}

/* ---------------------------------------------------------
   Ad placeholders (must keep aria-labels intact)
   --------------------------------------------------------- */
.ad-placeholder {
  background: linear-gradient(135deg, var(--color-cream) 0%, #efe8da 100%);
  border: 1px dashed var(--color-gold);
  color: var(--color-stone);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 6rem;
  border-radius: 0.75rem;
  position: relative;
  overflow: hidden;
}

.ad-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--color-gold) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.08;
}

.ad-placeholder.h-64 { min-height: 16rem; }

@media (min-width: 768px) {
  .ad-placeholder { min-height: 8rem; }
}

/* ---------------------------------------------------------
   Decorative dividers
   --------------------------------------------------------- */
.divider-gold {
  width: 4rem;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
  margin: 1.25rem auto;
}

.divider-jade {
  width: 3rem;
  height: 3px;
  background-color: var(--color-jade-700);
  border-radius: 999px;
  margin: 1rem 0;
}

/* ---------------------------------------------------------
   Tip / pull-quote boxes
   --------------------------------------------------------- */
.tip-box {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.04) 0%, rgba(4, 120, 87, 0.06) 100%);
  border-left: 4px solid var(--color-jade-700);
  border-radius: 0 0.75rem 0.75rem 0;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.tip-box-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--color-jade-900);
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.pull-quote {
  background: var(--color-paper);
  border-top: 2px solid var(--color-gold);
  border-bottom: 2px solid var(--color-gold);
  padding: 1.5rem;
  margin: 2rem 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.25rem;
  color: var(--color-jade-900);
  text-align: center;
  box-shadow: var(--shadow-soft);
}

/* ---------------------------------------------------------
   Table of contents
   --------------------------------------------------------- */
.toc {
  background: linear-gradient(135deg, var(--color-cream) 0%, var(--color-ivory) 100%);
  border: 1px solid rgba(197, 165, 114, 0.25);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.toc a {
  color: var(--color-jade-700);
  text-decoration: none;
}

.toc a:hover {
  color: var(--color-jade-900);
  text-decoration: underline;
}

/* ---------------------------------------------------------
   Game page scoping
   --------------------------------------------------------- */
.game-stage {
  background: radial-gradient(circle at center, rgba(6, 78, 59, 0.95) 0%, var(--color-jade-900) 100%);
  border-radius: 1rem;
  border: 1px solid rgba(197, 165, 114, 0.3);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.game-board-bg {
  background-color: rgba(6, 95, 46, 0.5);
}

#gameStage {
  position: relative;
  width: 100%;
  aspect-ratio: 1000 / 700;
  overflow-x: auto;
  overflow-y: hidden;
}

#gameScaler {
  position: relative;
  margin: 0 auto;
  overflow: hidden;
}

#gameScaler #wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 1000px;
  transform-origin: top left;
}

/* Override game.css layout rules for our chrome */
#gameHeader { float: none; }
#statusText { float: none; }
#controls { float: none; }

/* ---------------------------------------------------------
   Skip link
   --------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sr-only:focus {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background-color: var(--color-paper);
  color: var(--color-charcoal);
  padding: 0.5rem;
  border-radius: 0.25rem;
  z-index: 50;
  width: auto;
  height: auto;
  clip: auto;
  white-space: normal;
}

/* ---------------------------------------------------------
   Mobile game board
   --------------------------------------------------------- */
@media (max-width: 768px) {
  .game-stage {
    padding: 0.75rem;
  }

  #gameStage {
    -webkit-overflow-scrolling: touch;
  }

  #gameHeader {
    flex-direction: column;
    align-items: stretch;
  }

  #controls,
  #zoomControls {
    justify-content: center;
  }

  #zoomControls button {
    min-height: 2.5rem;
    min-width: 2.75rem;
  }
}

/* ---------------------------------------------------------
   Reduced motion
   --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
