/* The abacus menu and the language beads. Loaded after each page's own styles.
   - The menu button is a tiny abacus: two rods, two beads. Hover slides the beads;
     open turns the rods into an X and the beads meet in one rust bead at the centre.
   - A small bead on its corner carries the current language's letter (a, ğ, ñ, ĳ, あ).
   - The menu is available at every width: a full sheet on phones, a dropdown on desktop.
   - The CV lives in the menu now. */

.nav-toggle { display: inline-grid !important; place-items: center; width: 38px; height: 38px; padding: 0; overflow: visible; transition: border-color 0.2s, background 0.2s, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.nav-toggle:hover { border-color: var(--ctl-line-hover, rgba(28,28,30,0.32)); background: var(--paper, #fff6f4); }
.mt-ic { width: 22px; height: 22px; overflow: visible; }
.mt-rod { stroke: var(--ink, #1c1c1e); stroke-width: 1.6; stroke-linecap: round; transform-box: view-box; transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s; }
.mt-rod.r1 { transform-origin: 12px 8.5px; }
.mt-rod.r2 { transform-origin: 12px 15.5px; }
.mt-bead { transform-box: view-box; transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s; }
.mt-bead.k1 { fill: var(--rust, #e0301e); transform-origin: 7.5px 8.5px; }
.mt-bead.k2 { fill: var(--ink, #1c1c1e); transform-origin: 16.5px 15.5px; }
.nav-toggle:hover .mt-bead.k1 { transform: translateX(9px); }
.nav-toggle:hover .mt-bead.k2 { transform: translateX(-9px); }
.site-header.menu-open .mt-rod.r1 { transform: translateY(3.5px) rotate(45deg) scaleX(0.9); }
.site-header.menu-open .mt-rod.r2 { transform: translateY(-3.5px) rotate(-45deg) scaleX(0.9); }
.site-header.menu-open .mt-bead.k1 { transform: translate(4.5px, 3.5px) scale(1.25); }
.site-header.menu-open .mt-bead.k2 { transform: translate(-4.5px, -3.5px) scale(0); opacity: 0; }

/* the language bead on the menu's corner */
.mt-lang { position: absolute; top: -7px; right: -7px; display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 4px; border-radius: 999px;
  background: var(--ink, #1c1c1e); color: #fff; font: 600 11px/1 var(--font, system-ui), "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif; letter-spacing: 0;
  outline: 2px solid var(--bg, #fff); outline-offset: 0; transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s; pointer-events: none; }
.nav-toggle:hover .mt-lang { transform: translateY(-1px); }
.site-header.menu-open .mt-lang { background: var(--rust, #e0301e); }
.mt-lang.is-swap { animation: mt-swap 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes mt-swap { 0% { opacity: 0; transform: translateY(5px); } 100% { opacity: 1; transform: none; } }

/* the sheet: CV row and the language beads */
.nav-sheet a.sheet-cv svg { width: 14px; height: 14px; margin-left: 0.4rem; vertical-align: -2px; opacity: 0.6; }
.sheet-lang { padding: 0.9rem 0 0.4rem; }
.sheet-lang-k { display: block; font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted, #6e6e73); margin-bottom: 0.6rem; }
.lang-beads { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.lang-bead { display: inline-flex; align-items: center; gap: 0.5rem; height: 2.4rem; padding: 0 0.85rem 0 0.35rem; border-radius: 999px; border: 1px solid var(--ctl-line, rgba(28,28,30,0.14));
  background: var(--bg, #fff); color: var(--ink, #1c1c1e); font: 600 0.82rem/1 var(--font, system-ui), sans-serif; cursor: pointer; transition: border-color 0.2s, background 0.2s, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.lang-bead i { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; font-style: normal; font: 600 0.95rem/1 var(--font, system-ui), "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  background: var(--bg-subtle, #f8f8f8);  transition: background 0.25s, color 0.25s, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.lang-bead:hover { border-color: var(--rust, #e0301e); transform: translateY(-1px); }
.lang-bead:hover i { transform: translateX(2px); }
.lang-bead[aria-pressed="true"] { border-color: var(--ink, #1c1c1e); background: var(--ink, #1c1c1e); color: #fff; }
.lang-bead[aria-pressed="true"] i { background: var(--rust, #e0301e); color: #fff;  }
.lang-bead small { font-weight: 500; opacity: 0.6; font-size: 0.7rem; }
.lang-note { margin-top: 0.6rem; font-size: 0.72rem; color: var(--text-muted, #6e6e73); }

/* desktop: the sheet is a dropdown under the menu button; page links stay in the bar */
@media (min-width: 1201px) {
  .site-header.menu-open .nav-sheet { display: block; position: absolute; top: calc(100% + 6px); right: max(16px, calc((100vw - 1240px) / 2)); width: 360px;
    border: 1px solid var(--ctl-line, rgba(28,28,30,0.14)); border-radius: 18px;  animation: mt-drop 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .site-header.menu-open .nav-sheet .container { padding: 0.4rem 1.1rem 1rem; max-width: none; }
  .nav-sheet a.sheet-dup { display: none; }
}
@keyframes mt-drop { from { opacity: 0; transform: translateY(-8px) scale(0.97); } to { opacity: 1; transform: none; } }

/* Japanese: break at phrase boundaries and keep punctuation rules */
html[lang="ja"] body { line-break: strict; }
html[lang="ja"] p { word-break: auto-phrase; }
html[lang="ja"] .hero-is mark, html[lang="ja"] h1, html[lang="ja"] h2 { letter-spacing: 0; }

@media (prefers-reduced-motion: reduce) {
  .mt-rod, .mt-bead, .mt-lang, .lang-bead, .lang-bead i, .nav-toggle { transition: none; }
  .mt-lang.is-swap, .site-header.menu-open .nav-sheet { animation: none; }
}

/* Translations run longer than English: let the hero's buttons and ticker wrap on phones.
   Every ticker phrase shares one grid cell, so the hero keeps the height of the longest one. */
@media (max-width: 600px) {
  .hero-ctas { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hero-ctas .btn { min-width: 0; height: auto; min-height: var(--ctl-h, 40px); white-space: normal; line-height: 1.2; text-align: center; padding-top: 0.45rem; padding-bottom: 0.45rem; }
  html:not([lang="en"]) .hero-is, html:not([lang="en"]) .ticker > .tk { white-space: normal; }
  html:not([lang="en"]) .ticker { display: grid; }
  html:not([lang="en"]) .ticker > .tk { justify-self: stretch; }
  html:not([lang="en"]) .ticker { grid-template-columns: minmax(0, 1fr); max-width: 100%; }
  html:not([lang="en"]) .ticker > .tk { min-width: 0; }
  html[lang="ja"] .hero-is { word-break: normal; }
  html:not([lang="en"]) .hero-name { font-size: clamp(1.75rem, 8.5vw, 2.5rem); }
}
/* Japanese labels need their own line under the number on narrow screens. */
@media (max-width: 700px) { html[lang="ja"] .proof-strip li { flex-direction: column; align-items: flex-start; gap: 0.15rem; } }

/* Phones and tablets: the menu is a full-height sheet under the bar, not a dropdown list.
   Only the four sections and the language beads live here; Fit check, booking, the CV and
   the agent each have their own place in the bar, the hero or the footer. */
@media (max-width: 1200px) {
  .site-header.menu-open .nav-sheet { position: absolute; top: 100%; left: 0; right: 0; height: calc(var(--sheet-h, calc(100dvh - 64px)) + 40px); padding-bottom: 40px; overflow-y: auto; overscroll-behavior: contain;
    background: var(--bg, #fff); border-top: 1px solid var(--ctl-line, rgba(28,28,30,0.1)); }
  .nav-sheet .container { display: flex; flex-direction: column; min-height: 100%; padding-top: 0.75rem; padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); counter-reset: sheet; }
  .nav-sheet a.sheet-dup { counter-increment: sheet; display: flex; align-items: baseline; justify-content: flex-start; gap: 0.55rem; padding: 1.05rem 0;
    font-size: clamp(1.6rem, 7.5vw, 2.25rem); font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; color: var(--ink, #1c1c1e);
    border-bottom: 1px solid var(--ctl-line, rgba(28,28,30,0.1)); opacity: 0; transform: translateY(10px); }
  /* the page's link-bead hover is replaced here by a numbered index */
  .nav-sheet a.sheet-dup::before, .nav-sheet a.sheet-dup:hover::before { content: counter(sheet, decimal-leading-zero); position: static; flex: none; width: 1.5rem; height: auto; margin: 0; border-radius: 0;
    background: none;  font: 500 0.72rem/1 var(--font-mono, ui-monospace, monospace); letter-spacing: 0.06em; color: var(--rust, #e0301e); transform: translateY(-0.35em); transition: none; }
  .nav-sheet a.sheet-dup:hover { padding-left: 0; }
  .nav-sheet a.sheet-dup::after { content: "\2192"; margin-left: auto; font-size: 1.1rem; font-weight: 400; color: var(--text-muted, #6e6e73); transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s; }
  .nav-sheet a.sheet-dup:hover::after, .nav-sheet a.sheet-dup:focus-visible::after { transform: translateX(6px); color: var(--rust, #e0301e); }
  .nav-sheet a.sheet-dup:active { color: var(--rust-deep, #b4200f); }
  .site-header.menu-open .nav-sheet a.sheet-dup { animation: sheet-row 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
  .site-header.menu-open .nav-sheet a.sheet-dup:nth-child(2) { animation-delay: 0.05s; }
  .site-header.menu-open .nav-sheet a.sheet-dup:nth-child(3) { animation-delay: 0.1s; }
  .site-header.menu-open .nav-sheet a.sheet-dup:nth-child(4) { animation-delay: 0.15s; }
  .nav-sheet .sheet-lang { margin-top: auto; padding-top: 1.75rem; }
  html.menu-lock, html.menu-lock body { overflow: hidden; }
  html.menu-lock .vfa, html.menu-lock [role="region"][aria-label="Analytics consent"] { display: none !important; }
}
@keyframes sheet-row { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .nav-sheet a.sheet-dup { opacity: 1; transform: none; } .site-header.menu-open .nav-sheet a.sheet-dup { animation: none; } }

/* bar links never wrap onto two lines, whatever the language */
.nav-links a { white-space: nowrap; }

/* The language button: its own control in the bar, with the current language's letter.
   Tapping it opens a small popover of the five language beads right under the bar, so the
   choice never sits behind a phone browser's toolbar. The menu keeps only the sections. */
.lang-pick { position: relative; flex: none; }
.lang-btn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 50%; border: 1px solid var(--ctl-line, rgba(28,28,30,0.14));
  background: var(--bg, #fff); color: var(--ink, #1c1c1e); cursor: pointer; transition: border-color 0.25s, background 0.3s cubic-bezier(0.22, 1, 0.36, 1), transform 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.lang-btn:hover { border-color: var(--rust, #e0301e); transform: translateY(-1px); }
.lang-btn[aria-expanded="true"] { background: var(--ink, #1c1c1e); color: #fff; border-color: var(--ink, #1c1c1e); }
.lang-glyph { font: 600 15px/1 var(--font, system-ui), "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif; }
.lang-glyph.is-swap { animation: mt-swap 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.lang-pop { position: absolute; top: calc(100% + 10px); right: 0; z-index: 80; width: 320px; padding: 0.9rem 1rem 1rem; border-radius: 18px;
  background: var(--bg, #fff); border: 1px solid var(--ctl-line, rgba(28,28,30,0.14)); 
  animation: mt-drop 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
.lang-pop[hidden] { display: none; }
.lang-pop .sheet-lang-k { margin-bottom: 0.6rem; }
@media (min-width: 1201px) { .nav-toggle { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .lang-pop, .lang-glyph.is-swap { animation: none; } .lang-btn { transition: none; } }

/* Narrow bars: the Fit check chip keeps both words; the name beside the logo yields first, then the chip's icon (set by i18n.js) */
.site-nav.bar-tight .brand-name { display: none; }
.site-nav.bar-tighter .nav-fit .fit-ic { display: none; }
