/* Language selector (header dropdown + footer row). Used by translated pages and, at publish time, the English pages. */

/* header button: always visible, outside the collapsible menu */
.nav { position: relative; }
.nav nav { order: 1; margin-left: auto; }
.nav .lang-menu { order: 2; margin-left: 18px; position: relative; }
.nav .menu-btn { order: 3; }
.lang-menu summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line, #d9d6cc); border-radius: 999px; background: var(--paper, #fff); color: var(--ink, #1b2630); font-size: .85rem; font-weight: 600; letter-spacing: .04em; user-select: none; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary::before { content: "\1F310"; font-size: .95rem; letter-spacing: 0; }
.lang-menu summary::after { content: "\25BE"; font-size: .8rem; opacity: .7; }
.lang-menu summary:hover, .lang-menu[open] summary { border-color: var(--teal, #1f6f62); color: var(--teal, #1f6f62); }
.lang-menu summary:focus-visible { outline: 2px solid var(--teal, #1f6f62); outline-offset: 2px; }
.lang-list { list-style: none; margin: 0; padding: 6px; position: absolute; right: 0; top: calc(100% + 8px); min-width: 168px; background: var(--paper, #fff); border: 1px solid var(--line, #d9d6cc); border-radius: 12px; box-shadow: 0 10px 30px rgba(20, 30, 40, .14); z-index: 30; }
.lang-list li { margin: 0; }
.lang-list a, .lang-list .lang-current { display: block; padding: 9px 12px; border-radius: 8px; font-size: .95rem; text-decoration: none; color: var(--ink, #1b2630); }
.lang-list a:hover, .lang-list a:focus-visible { background: var(--teal-tint, #e3efec); color: var(--teal-deep, #174f46); }
.lang-list .lang-current { font-weight: 700; color: var(--teal, #1f6f62); background: var(--teal-tint, #e3efec); }

/* footer row */
.lang-footer { margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: center; }
.lang-footer a { color: inherit; opacity: .85; text-decoration: underline; text-underline-offset: 3px; }
.lang-footer a:hover { opacity: 1; }
.lang-footer .lang-current { font-weight: 700; }

/* English menu has more items now: switch to the compact menu a little earlier */
@media (max-width: 1000px) {
  html[lang="en"] .menu-btn { display: block; }
  html[lang="en"] nav { display: none; position: absolute; top: 68px; left: 0; right: 0; background: var(--paper); flex-direction: column; align-items: flex-start; padding: 16px; border-bottom: 1px solid var(--line); }
  html[lang="en"] nav.open { display: flex; }
}
/* Translated menus are longer: switch to the compact menu earlier than the English site does */
@media (max-width: 1360px) {
  html:not([lang="en"]) .menu-btn { display: block; }
  html:not([lang="en"]) nav { display: none; position: absolute; top: 68px; left: 0; right: 0; background: var(--paper); flex-direction: column; align-items: flex-start; padding: 16px; border-bottom: 1px solid var(--line); }
  html:not([lang="en"]) nav.open { display: flex; }
  .nav .lang-menu { margin-left: auto; margin-right: 12px; }
}
@media (min-width: 1361px) {
  html:not([lang="en"]) nav { gap: 18px; }
  html:not([lang="en"]) nav a { white-space: nowrap; font-size: .9rem; }
}
@media (max-width: 1000px) { html[lang="en"] .nav .lang-menu { margin-left: auto; margin-right: 12px; } }
html[lang="ja"] body { font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif; }
html[lang="ja"] h1, html[lang="ja"] h2, html[lang="ja"] h3 { letter-spacing: 0; }
/* Japanese: break lines between phrases, not in the middle of words */
html[lang="ja"] h1, html[lang="ja"] h2, html[lang="ja"] h3, html[lang="ja"] .lead, html[lang="ja"] .section-sub { word-break: auto-phrase; line-break: strict; text-wrap: balance; }
html[lang="ja"] h1 { font-size: clamp(2rem, 4.2vw, 3rem); }
