/* 肉いち — 30-language layer: switcher UI + script-specific layout */

/* ---------- header button ---------- */
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; margin-inline-end: 10px;
  background: transparent; color: var(--cream); border: 1px solid var(--rule); border-radius: 999px;
  font: 600 12px/1 var(--latin); letter-spacing: .08em; cursor: pointer; transition: border-color .3s, background .3s, transform .3s;
}
.lang-btn:hover { border-color: var(--ember); background: rgba(233, 138, 74, .12); }
.lang-btn:hover svg { transform: rotate(180deg); }
.lang-btn svg { transition: transform .8s cubic-bezier(.2, .8, .2, 1); }
@media (max-width: 700px) { .lang-btn { height: 34px; padding: 0 9px; margin-inline-end: 6px; } .lang-btn span { display: none; } }

/* ---------- picker dialog ---------- */
.lang-dlg { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: 16px; background: rgba(10, 6, 4, 0); backdrop-filter: blur(0); transition: background .3s ease, backdrop-filter .3s ease; }
.lang-dlg.on { background: rgba(10, 6, 4, .72); backdrop-filter: blur(8px); }
.lang-panel {
  width: min(880px, 100%); max-height: min(86vh, 760px); overflow: auto; background: var(--sumi-2); color: var(--cream);
  border: 1px solid var(--rule); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  transform: translateY(24px) scale(.97); opacity: 0; transition: transform .45s cubic-bezier(.2, .9, .3, 1.15), opacity .3s ease;
}
.lang-dlg.on .lang-panel { transform: none; opacity: 1; }
.lang-top { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; background: var(--sumi-2); border-bottom: 1px solid var(--rule); }
.lang-top strong { display: inline-flex; align-items: center; gap: 10px; font: 600 18px/1.2 var(--mincho); }
.lang-x { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--rule); background: transparent; color: var(--cream); font-size: 22px; cursor: pointer; transition: transform .3s, border-color .3s; }
.lang-x:hover { transform: rotate(90deg); border-color: var(--ember); }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; padding: 20px 22px 24px; }
.lang-grid a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid rgba(216, 174, 102, .16); color: var(--cream); text-decoration: none; background: rgba(255, 255, 255, .02);
  opacity: 0; transform: translateY(10px); transition: background .25s, border-color .25s, transform .25s;
}
.lang-dlg.on .lang-grid a { animation: langIn .5s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: calc(var(--k) * 18ms + 80ms); }
@keyframes langIn { to { opacity: 1; transform: none; } }
.lang-grid a:hover, .lang-grid a:focus-visible { background: rgba(233, 138, 74, .12); border-color: var(--ember); transform: translateY(-2px); outline: none; }
.lang-grid a[aria-current] { background: var(--beni); border-color: var(--beni); }
.lang-grid b { font: 600 15px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: 0; }
.lang-grid small { font: 600 10px/1 var(--latin); letter-spacing: .1em; opacity: .55; }
html.lang-open { overflow: hidden; }
.drawer-lang { display: inline-flex !important; align-items: center; gap: 8px; }

/* ---------- "view in your language?" toast ---------- */
.lang-toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 8000; display: flex; align-items: center; gap: 12px;
  max-width: calc(100% - 32px); padding: 12px 12px 12px 16px; border-radius: 14px; background: rgba(31, 21, 17, .96); color: var(--cream);
  border: 1px solid var(--rule); box-shadow: 0 18px 50px rgba(0, 0, 0, .5); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none; transition: transform .5s cubic-bezier(.2, .9, .3, 1.2), opacity .4s ease;
}
.lang-toast.on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.lang-toast a { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--beni); color: #fff; text-decoration: none; font-weight: 600; }
.lang-toast button { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: var(--cream-dim); font-size: 18px; cursor: pointer; }

/* ---------- non-CJK: vertical Japanese headings become horizontal ---------- */
.nk-horiz .tategaki, .nk-horiz .mei-vtitle small, .nk-horiz .mei-vtitle h2, .nk-horiz .p-title, .nk-horiz .mei-label {
  writing-mode: horizontal-tb !important; text-orientation: mixed;
}
.nk-horiz .tategaki { font-size: clamp(26px, 3vw, 40px); line-height: 1.3; letter-spacing: .01em; max-width: 22ch; }
.nk-horiz .mei-label { padding: 14px 18px; letter-spacing: .04em; text-align: center; }
.nk-horiz .p-title { grid-row: auto; grid-column: 1 / -1; font-size: clamp(22px, 2.4vw, 30px); letter-spacing: .02em; }
.nk-horiz .mei-vtitle { writing-mode: horizontal-tb; }
.nk-horiz .kakko { letter-spacing: .02em; line-height: 1.25; }
.nk-horiz h1, .nk-horiz h2, .nk-horiz h3 { word-break: normal; overflow-wrap: break-word; hyphens: auto; }
.nk-horiz .hero h1 { line-height: 1.15; }
.nk-horiz [data-split] .w { display: inline-block; white-space: nowrap; }

/* scripts that join letters or carry combining marks: no tracking */
.nk-tight body, .nk-tight body * { letter-spacing: 0 !important; }

/* right-to-left */
[dir="rtl"] .lang-grid a, [dir="rtl"] .lang-toast { direction: rtl; }
[dir="rtl"] .to-top { right: auto; left: 18px; }
[dir="rtl"] .bg-kanji { direction: ltr; }

/* brand lettering always keeps the Japanese brush face */
.brand-mark, .hero-tate, .intro-mark, .bg-kanji, .curtain span { font-family: "Yuji Syuku", "Shippori Mincho B1", serif !important; }

/* 名物 poster: the vertical-title column becomes a full-width heading row */
.nk-horiz .mei-poster { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 34px 56px; }
.nk-horiz .mei-vtitle { grid-column: 1 / -1; flex-direction: column; gap: 8px; align-items: flex-start; }
.nk-horiz .mei-line { width: 120px; height: 3px; background: linear-gradient(90deg, var(--beni-2), transparent); transform-origin: left; }
.nk-horiz .mei-vtitle small { padding-top: 0; letter-spacing: .12em; }
.nk-horiz .mei-vtitle h2 { font-size: clamp(38px, 5vw, 68px); letter-spacing: .01em; line-height: 1.1; padding: 0; border: 0; }
@media (max-width: 900px) { .nk-horiz .mei-poster { grid-template-columns: minmax(0, 1fr); } }

/* おすすめ posters: title on top, items full width */
.nk-horiz .poster { grid-template-columns: minmax(0, 1fr); }
.nk-horiz .p-title { flex-direction: row; padding: 0 0 10px; border: 0; border-bottom: 1px solid rgba(216, 174, 102, .45); }
.nk-horiz .p-items { grid-column: 1; }
[dir="rtl"] .nk-horiz .mei-line, [dir="rtl"] .mei-line { transform-origin: right; }

/* Korean: break lines between words, never inside one */
.nk-ko body { word-break: keep-all; overflow-wrap: anywhere; }
