:root {
  --ink: #252220;
  --muted: #6d6863;
  --paper: #fffdf9;
  --canvas: #ebe7e1;
  --accent: #9f3f34;
  --accent-dark: #713027;
  --rule: #ddd5ca;
  --shadow: 0 18px 55px rgba(54, 43, 34, 0.14);
}

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  border-top: 4px solid var(--accent);
  background: var(--canvas) url("../images/bg.png");
  color: var(--ink);
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.75;
}

a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover, a:focus { color: var(--accent); }

.skip-link { position: fixed; z-index: 1000; top: .5rem; left: .5rem; padding: .65rem 1rem; background: #fff; color: #000; }

.site-shell {
  width: min(100% - 2rem, 68rem);
  margin: 2rem auto;
  overflow: hidden;
  border: 1px solid rgba(65, 52, 42, 0.12);
  border-radius: .5rem;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.site-header { border-bottom: 1px solid var(--rule); background: rgba(255, 253, 249, .96); }
.top-bar, .top-bar ul, .title-bar { background: transparent; }
.top-bar { max-width: 62rem; min-height: 5rem; margin: 0 auto; padding: .85rem 2rem; }
.site-logo, .title-bar-title { display: inline-flex; align-items: center; }
.site-logo img, .title-bar-title img { display: block; width: auto; height: 3.25rem; }

.dropdown.menu > li > a {
  padding: 1rem .9rem;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.dropdown.menu > li > a:hover, .dropdown.menu > li > a:focus { color: var(--accent); }
.dropdown.menu > li.is-dropdown-submenu-parent > a::after { border-top-color: var(--accent); }
.is-dropdown-submenu { min-width: 13rem; border: 1px solid var(--rule); border-radius: .25rem; background: var(--paper); box-shadow: 0 12px 28px rgba(54, 43, 34, .14); }
.is-dropdown-submenu a { padding: .8rem 1rem; color: var(--ink); }
.is-dropdown-submenu a:hover, .is-dropdown-submenu a:focus { background: #f5f0e9; color: var(--accent-dark); }

.page-title-wrap { padding: clamp(2.75rem, 8vw, 5.75rem) 2rem clamp(2rem, 5vw, 3.5rem); text-align: center; }
.page-title-wrap::after { display: block; width: 4rem; height: 2px; margin: 1.5rem auto 0; background: var(--accent); content: ""; }

h1, h2, h3, h4 { color: var(--ink); font-family: "Playfair Display", Georgia, serif; font-weight: 600; line-height: 1.2; }
.page-title-wrap h1 { max-width: 18ch; margin: 0 auto; font-size: clamp(2.4rem, 7vw, 4.75rem); letter-spacing: -.035em; }
.blog-post { max-width: 48rem; margin: 0 auto; padding: 0 2rem 4rem; }
.blog-post h2 { margin-top: 2.5rem; font-size: clamp(1.65rem, 4vw, 2.15rem); }
.blog-post h3 { margin-top: 1.75rem; color: var(--muted); font-size: 1.25rem; }
.blog-post p { margin-bottom: 1.25rem; }

.article-lead-image { display: block; max-width: min(100%, 24rem); height: auto; margin: 0 auto 1.5rem; border-radius: .35rem; }
.photo { margin: 2.25rem auto 0; padding: .6rem; border: 1px solid var(--rule); border-radius: .35rem; background: #fff; box-shadow: 0 8px 24px rgba(54, 43, 34, .12); }
.photo img { display: block; width: 100%; height: auto; }
.article-divider { width: 4rem; margin: 3rem auto; border: 0; border-top: 2px solid var(--accent); }

.site-footer { padding: 1.75rem 2rem 2rem; border-top: 1px solid var(--rule); background: #f6f1ea; color: var(--muted); text-align: center; }
.site-footer .menu { margin-bottom: .8rem; }
.site-footer p { margin: .15rem 0; font-size: .8rem; }
.site-footer .credits { font-size: .72rem; }

@media screen and (max-width: 39.99875em) {
  body { border-top: 0; }
  .site-shell { width: 100%; margin: 0; border: 0; border-radius: 0; }
  .title-bar { justify-content: space-between; min-height: 4.5rem; padding: .65rem 1rem; }
  .title-bar-title img { height: 2.75rem; }
  .menu-icon::after { background: var(--ink); box-shadow: 0 7px 0 var(--ink), 0 14px 0 var(--ink); }
  .top-bar { min-height: 0; padding: 0 1rem 1rem; }
  .top-bar-right, .top-bar-right .menu { width: 100%; }
  .drilldown a { color: var(--ink); }
  .page-title-wrap { padding-inline: 1.25rem; }
  .blog-post { padding-inline: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.mahjong-aside {
  position: relative;
  margin: 2rem 0;
  padding: 1.25rem 1.4rem 1.25rem 1.6rem;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: 0.35rem;
  background: #f8f4ee;
}

.mahjong-aside::after {
  position: absolute;
  right: -0.15rem;
  bottom: -1.2rem;
  color: rgba(113, 48, 39, 0.07);
  content: "麻將";
  font-family: Georgia, serif;
  font-size: 5rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.mahjong-aside__label {
  position: relative;
  z-index: 1;
  margin: 0 0 0.45rem;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mahjong-aside p:not(.mahjong-aside__label) {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Slightly different treatment for etiquette */
.mahjong-aside--etiquette {
  border-left-color: #3f6b64;
  background: #f0f6f4;
}

.mahjong-aside--etiquette .mahjong-aside__label {
  color: #315851;
}

.mahjong-aside--etiquette::after {
  color: rgba(49, 88, 81, 0.07);
  content: "禮";
}



@media print {
  @page {
    margin: 0.55in 0.65in;
  }

  html,
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 10pt;
    line-height: 1.4;
  }

  .site-header,
  .site-footer .menu ,
  .no-print,
  .skip-link {
    display: none !important;
  }

  .site-shell {
    width: 100%;
    margin: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .page-title-wrap {
    padding: 0 0 18pt;
  }

  .page-title-wrap::after {
    display: none;
  }

  .page-title-wrap h1 {
    margin: 0;
    font-size: 28pt;
    line-height: 1.1;
  }

  .blog-post {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  h2 {
    margin: 18pt 0 7pt;
    font-size: 17pt;
  }

  h3 {
    margin: 14pt 0 6pt;
    font-size: 13pt;
  }

  p,
  li {
    font-size: 10pt;
    line-height: 1.4;
  }

  p {
    margin-bottom: 8pt;
    orphans: 3;
    widows: 3;
  }

  h1,
  h2,
  h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  figure,
  table,
  .seat-map,
  .dragon-tiles,
  .scoring-notes {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .dragon-tiles {
    max-width: 4.5in;
    margin: 0 auto 16pt;
    padding: 8pt;
    box-shadow: none;
  }

  img {
    max-width: 100% !important;
  }

  a,
  a:visited {
    color: #000 !important;
    text-decoration: none;
  }
    .mahjong-aside {
    margin: 12pt 0;
    padding: 9pt 11pt;
    border: 1px solid #aaa;
    border-left-width: 3pt;
    background: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .mahjong-aside::after {
    display: none;
  }

  .mahjong-aside p:not(.mahjong-aside__label) {
    font-size: 9.5pt;
    line-height: 1.35;
  }
}
