/* region-fix.css — high specificity rules to override any parse-error fallback in site.css */
body main .region-card .region-card-photo,
body .region-card .region-card-photo {
  position: absolute !important;
  inset: 0 !important;
  top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important;
  z-index: 0 !important;
  background-size: cover !important;
  background-position: center !important;
  opacity: 0.55 !important;
  transition: opacity 500ms cubic-bezier(0.22,1,0.36,1) !important;
  filter: saturate(0.45) contrast(1.02) brightness(0.95) !important;
  pointer-events: none !important;
}
body .region-card .region-card-photo::after {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  background: linear-gradient(180deg, rgba(244,239,225,0.78) 0%, rgba(244,239,225,0.66) 50%, rgba(244,239,225,0.86) 100%) !important;
  pointer-events: none !important;
}
body .region-card:hover .region-card-photo { opacity: 0.95 !important; }
body .region-card:hover .region-card-photo::after {
  background: linear-gradient(180deg, rgba(244,239,225,0.55) 0%, rgba(244,239,225,0.45) 50%, rgba(244,239,225,0.78) 100%) !important;
}

/* Ensure card content sits above the photo layer */
body .region-card { position: relative !important; overflow: hidden !important; }
body .region-card > *:not(.region-card-photo) { position: relative; z-index: 1; }

/* Region detail page hero background photo */
body .region-hero .region-hero-bg-photo,
body main .region-hero-bg-photo {
  position: absolute !important;
  inset: 0 !important;
  top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important;
  z-index: 0 !important;
  background-size: cover !important;
  background-position: center !important;
  filter: saturate(0.55) contrast(1.05) brightness(0.95) !important;
}
body .region-hero {
  position: relative !important;
  overflow: hidden !important;
}
body .region-hero > *:not(.region-hero-bg-photo) {
  position: relative;
  z-index: 1;
}
body .region-hero-bg-photo::after {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  background: linear-gradient(180deg, rgba(244,239,225,0.20) 0%, rgba(244,239,225,0.35) 50%, rgba(244,239,225,0.78) 100%) !important;
}

/* ====================================================================
   RESPONSIVE FIXES — masthead/nav overlap at narrow widths
   ==================================================================== */

/* The masthead .ml/.mr can wrap and clip behind the sticky nav at
   middle viewport widths (981-1080px). At anything below 1080,
   hide masthead .ml so it doesn't wrap. Below 980, the original CSS
   already hides .mr. Combined effect: clean single-line masthead, or
   no masthead at all on narrow viewports. */
@media (max-width: 1080px) {
  .masthead .ml { display: none !important; }
  .masthead-inner { justify-content: flex-end !important; }
}
@media (max-width: 880px) {
  .masthead { display: none !important; }
}

/* Compact the nav at middle widths */
@media (max-width: 1080px) and (min-width: 781px) {
  .site-nav { padding: 14px 0 !important; }
  .site-nav-inner { gap: 16px !important; }
  .brand-tag { display: none !important; }
}

/* Make sure the masthead never overlaps the sticky nav */
.masthead {
  position: relative;
  z-index: 9 !important;
}
.masthead-inner {
  flex-wrap: nowrap !important;
}

/* Mobile-tablet polish: smaller brand on narrow screens */
@media (max-width: 600px) {
  .brand-name { font-size: 18px !important; }
  .nav-cta, .nav-signin { font-size: 13px !important; }
  .site-nav { padding: 10px 0 !important; }
}

/* ====================================================================
   LEGACY LOGO — swap CSS-drawn brand mark to the legacy PNG logo
   ==================================================================== */
.brand-mark {
  background: url('/static/img/logo.png') center/contain no-repeat !important;
  border: none !important;
}
.brand-mark::before, .brand-mark::after { display: none !important; content: none !important; }
.brand.inverse .brand-mark {
  background: url('/static/img/logo.png') center/contain no-repeat !important;
}


/* ====================================================================
   NAV BURGER + MOBILE MENU
   ==================================================================== */
.nav-burger {
  display: none;
  background: none; border: none; padding: 8px 6px;
  cursor: pointer; align-items: center; justify-content: center;
  flex-direction: column; gap: 5px;
}
.nav-burger span {
  display: block; width: 22px; height: 1.5px;
  background: var(--ink); transition: transform 250ms var(--ease), opacity 200ms;
}

/* Wide screens: hide burger, show inline nav-links */
@media (min-width: 1081px) {
  .nav-burger { display: none !important; }
}

/* Narrow screens: hamburger appears, nav-links become a dropdown panel */
@media (max-width: 1080px) {
  .nav-burger { display: inline-flex !important; }
  /* The nav-links container becomes an overlay panel */
  .nav-links {
    display: none;
    position: absolute !important;
    top: 100%; left: 0; right: 0;
    background: var(--paper-0);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    padding: 8px 24px 14px;
    flex-direction: column !important;
    gap: 0 !important;
    box-shadow: 0 12px 24px -16px rgba(19,18,14,0.18);
    z-index: 10;
  }
  body.nav-open .nav-links { display: flex !important; }
  .nav-links a {
    padding: 14px 6px !important;
    font-size: 16px !important;
    border-bottom: 1px solid var(--rule-2);
    color: var(--ink-2);
  }
  .nav-links a:last-child { border-bottom: none; }
  .nav-links a::after { display: none; } /* kill the underline animation in panel mode */
  /* When open, transform burger to X */
  body.nav-open .nav-burger span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  body.nav-open .nav-burger span:nth-child(2) { opacity: 0; }
  body.nav-open .nav-burger span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
  /* Position context for absolute panel */
  .site-nav { position: sticky; }
  .site-nav-inner { position: relative; }
}

/* On very narrow / mobile: make CTA + sign in smaller and stay on the right */
@media (max-width: 600px) {
  .brand-tag { display: none !important; }
  .nav-right { gap: 14px !important; }
  .nav-cta { font-size: 13px !important; }
  .nav-signin { font-size: 13px !important; }
  .brand-mark { width: 32px !important; height: 32px !important; }
  .brand-name { font-size: 17px !important; }
}

/* Prevent body scroll when mobile menu is open */
body.nav-open { overflow: hidden; }


/* ====================================================================
   CHAPTER RAIL OVERLAP FIX — keep it pinned outside the content column
   ==================================================================== */
.chapters {
  z-index: 6;
  pointer-events: none; /* allow clicks through to content underneath, except for the chapter links themselves */
}
.chapters .chapter,
.chapters > * { pointer-events: auto; }

/* Hide the chapter rail entirely on narrower screens where it overlaps */
@media (max-width: 1280px) {
  .chapters { display: none !important; }
}

/* ====================================================================
   LISTING CARD TITLE — JP/EN size normalisation
   ==================================================================== */
.entry-h {
  font-size: 19px !important;
  line-height: 1.32 !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 2.7em;
}

/* When the title contains primarily Japanese characters, slightly shrink because JP glyphs are visually larger */
.entry-h:lang(ja),
.entry-h[data-lang="ja"] {
  font-size: 16px !important;
}

/* The Plate label in listing cards: hide the "Plate IV" etc roman label entirely */
.entry-plate { display: none !important; }


/* Hide chapter rail entirely — adds clutter without clear value */
.chapters { display: none !important; }
/* /* CHAPTER RAIL HIDE ALWAYS */
