/* Phone and tablet menu (js/nav-menu.js). Hidden on desktop, where the chapter list sits in the nav. */
.m-toggle, .m-menu { display: none; }
.nav .nav-chapters { display: flex; min-width: 0; }

/* EN/FR switch (static markup on every page; the menu panel carries its own at phone width) */
.lang-sw { display: inline-flex; align-items: center; min-height: 48px; padding: 12px 10px; color: var(--soft); text-decoration: none; font: 300 12px/1.6 var(--font-display); letter-spacing: .3em; text-transform: uppercase; transition: color var(--t-ctl) var(--ease); }
.lang-sw:hover, .lang-sw:focus-visible { color: var(--ink); }
.lang-sw:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sub-nav li .lang-sw { padding-inline: 14px; }
.legal-head .lang-sw { color: var(--soft); }
.m-switch { display: inline-flex; align-items: center; min-height: 48px; color: var(--soft); text-decoration: none; font: 300 12px/1.6 var(--font-display); letter-spacing: .3em; text-transform: uppercase; }
.m-switch:hover, .m-switch:focus-visible { color: var(--ink); }

/* Sub-page headers stay with the reader: pinned at the top on every size. At the top of the page they look as before; once the page
   scrolls they settle into a slimmer frosted ink bar with a hairline, and the wordmark eases down a touch (js/nav-menu.js sets is-scrolled
   and --hdr-h, the bar's height, so sticky lists below it, like the Clients index, sit just under it). */
.sub-head, .legal-head { position: sticky; top: 0; z-index: 35; background: var(--bg); border-bottom: 1px solid var(--line);
  transition: background-color 480ms var(--ease), padding 480ms var(--ease-out), box-shadow 480ms var(--ease), border-color 480ms var(--ease); }
.sub-head.is-scrolled, .legal-head.is-scrolled { background: rgba(16, 17, 18, .8); -webkit-backdrop-filter: blur(16px) saturate(1.15); backdrop-filter: blur(16px) saturate(1.15);
  box-shadow: 0 14px 34px -22px rgba(0, 0, 0, .9); padding-top: 2px; padding-bottom: 2px; }
.sub-head .sub-brand img, .legal-head > a:first-child img { transform-origin: left center; transition: transform 480ms var(--ease-out); }
.sub-head.is-scrolled .sub-brand img, .legal-head.is-scrolled > a:first-child img { transform: scale(.88); }
/* the links answer like the home menu: a silver hairline draws in under the one you point at and stays under this page */
.sub-nav a { position: relative; }
.sub-nav a::after { content: ''; position: absolute; inset: auto 14px 9px; height: 1px; background: var(--accent); pointer-events: none;
  transform: scaleX(0); transform-origin: right center; transition: transform var(--t-hover) var(--ease); }
.sub-nav a[aria-current="page"]::after, .sub-nav a:focus-visible::after { transform: scaleX(1); transform-origin: left center; }
@media (hover: hover) { .sub-nav a:hover::after { transform: scaleX(1); transform-origin: left center; } }
html body .sec-index { top: var(--hdr-h, 64px); }

@media (max-width: 900px) {
  .nav { gap: var(--s2); }
  .nav .brand { margin-right: auto; }
  .m-toggle { order: 3; }
  .nav .nav-chapters { display: none; }
  .nav > .lang-sw { display: none; }
  .sub-head, .legal-head { flex-wrap: nowrap; }
  .sub-head .sub-nav { display: none; }
  .m-toggle { margin-left: auto; }
  .m-toggle.m-float { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 4vw; z-index: 41; background: rgba(16, 17, 18, .92); border-color: #3a3b3e; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); animation: m-float-in 520ms var(--ease-out) both; }
  @keyframes m-float-in { from { opacity: 0; transform: translateY(-12px) scale(.86); } to { opacity: 1; transform: none; } }
  html body .sec-index ol { padding-right: 60px; }
  .m-pinned { position: fixed; inset: 0 0 auto 0; z-index: 40; border-bottom-color: transparent !important; background: transparent; }
  .m-toggle { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; width: 48px; height: 48px; flex: none; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: border-color var(--t-ctl) var(--ease), transform var(--t-press) var(--ease); }
  .m-toggle:active { transform: scale(.92); }
  .m-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
  .m-bar { display: block; width: 18px; height: 1px; background: currentColor; transition: transform 520ms var(--ease-out), width 520ms var(--ease-out); }
  .m-bar + .m-bar { width: 12px; margin-left: 6px; }
  .nav.menu-open .m-toggle { border-color: var(--accent); }
  .nav.menu-open .m-bar { transform: translateY(4px) rotate(45deg); }
  .nav.menu-open .m-bar + .m-bar { width: 18px; margin-left: 0; transform: translateY(-4px) rotate(-45deg); }

  /* while open the nav goes clear and its quote button steps aside for the one in the panel */
  .nav > .a-btn { transition: opacity var(--t-hover) var(--ease), transform var(--t-hover) var(--ease); }
  .nav.menu-open { background: transparent; border-bottom-color: transparent; }
  .nav.menu-open > .a-btn { opacity: 0; transform: translateY(-6px); pointer-events: none; }

  .m-menu { position: fixed; inset: 0; z-index: 39; flex-direction: column; justify-content: space-between; gap: var(--s5); padding: calc(84px + env(safe-area-inset-top)) var(--gut) calc(var(--s4) + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; text-align: left; background: var(--bg); clip-path: circle(0 at var(--ox, 90%) var(--oy, 40px)); -webkit-clip-path: circle(0 at var(--ox, 90%) var(--oy, 40px)); transition: clip-path 640ms cubic-bezier(.7, 0, .2, 1), -webkit-clip-path 640ms cubic-bezier(.7, 0, .2, 1); }
  .m-menu:not([hidden]) { display: flex; }
  .m-menu.is-open { clip-path: circle(150vmax at var(--ox, 90%) var(--oy, 40px)); -webkit-clip-path: circle(150vmax at var(--ox, 90%) var(--oy, 40px)); transition-duration: 760ms; }

  /* a soft silver light that follows the finger, and a paper grain so the ink is never flat */
  .m-glow { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(420px circle at var(--gx, 70%) var(--gy, 30%), rgba(199, 194, 184, .09), transparent 70%); opacity: 0; transition: opacity 900ms var(--ease) 200ms; }
  .m-glow::after { content: ''; position: absolute; inset: 0; background: url('../assets/photos/grain-tile-512.png') 0 0 / 256px; mix-blend-mode: overlay; opacity: .05; }
  .m-menu.is-open .m-glow { opacity: 1; }

  .m-list { position: relative; list-style: none; margin: 0; padding: 0; counter-reset: none; }
  .m-list li { border-top: 1px solid transparent; position: relative; }
  .m-list li::before { content: ''; position: absolute; inset: -1px 0 auto; height: 1px; background: var(--line); transform: scaleX(0); transform-origin: left center; transition: transform 700ms var(--ease-out); transition-delay: calc(var(--i) * 60ms); }
  .m-list li:last-child::after { content: ''; position: absolute; inset: auto 0 -1px; height: 1px; background: var(--line); transform: scaleX(0); transform-origin: left center; transition: transform 700ms var(--ease-out) 320ms; }
  .m-menu.is-open .m-list li::before, .m-menu.is-open .m-list li:last-child::after { transform: scaleX(1); transition-delay: calc(180ms + var(--i) * 70ms); }

  .m-link { display: block; overflow: hidden; color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .m-line { display: flex; align-items: baseline; gap: var(--s2); padding: 14px 0 12px; transform: translateY(110%); transition: transform 520ms cubic-bezier(.7, 0, .2, 1); transition-delay: calc((4 - var(--i)) * 30ms); }
  .m-menu.is-open .m-line { transform: none; transition: transform 900ms var(--ease-out); transition-delay: calc(200ms + var(--i) * 70ms); }
  .m-num { flex: none; width: 2.4em; font: 300 11px/1 var(--font-display); letter-spacing: .2em; color: var(--soft); }
  .m-word { font: 200 clamp(30px, 9vw, 64px)/1.05 var(--font-display); letter-spacing: .04em; text-transform: uppercase; transition: transform 420ms var(--ease-out), color var(--t-ctl) var(--ease), letter-spacing 520ms var(--ease-out); }
  .m-link svg { width: 14px; height: 14px; flex: none; align-self: center; margin-left: auto; fill: var(--accent); opacity: 0; transform: translateX(-14px) rotate(-12deg); transition: opacity var(--t-hover) var(--ease), transform 520ms var(--ease-out); }
  .m-link[aria-current="true"] svg, .m-link[aria-current="page"] svg, .m-link:focus-visible svg { opacity: 1; transform: none; }
  .m-link[aria-current="true"] .m-num, .m-link[aria-current="page"] .m-num { color: var(--accent); }
  .m-link:active .m-word { transform: translateX(10px); letter-spacing: .08em; color: var(--accent); transition-duration: var(--t-press); }
  .m-link:focus-visible { outline: none; }
  .m-link:focus-visible .m-word { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 8px; }
  @media (hover: hover) {
    .m-link:hover .m-word { transform: translateX(10px); letter-spacing: .07em; }
    .m-link:hover svg { opacity: 1; transform: none; }
    .m-list:hover .m-link:not(:hover) .m-word { color: var(--soft); }
  }

  .m-foot { position: relative; display: grid; gap: var(--s1); opacity: 0; transform: translateY(16px); transition: opacity 300ms var(--ease), transform 300ms var(--ease); }
  .m-menu.is-open .m-foot { opacity: 1; transform: none; transition: opacity 700ms var(--ease) 560ms, transform 900ms var(--ease-out) 560ms; }
  .m-place { font: 300 11px/1.6 var(--font-display); letter-spacing: .3em; text-transform: uppercase; color: var(--soft); }
  .m-fr { margin-bottom: var(--s3); font: 300 15px/1.5 var(--font-body); color: var(--soft); }
  .m-cta { width: 100%; padding: 18px 20px; }
  .m-social { display: grid; gap: 0; justify-items: start; margin-top: var(--s2); border-top: 1px solid var(--line); padding-top: var(--s2); }
  .m-social a { display: inline-flex; align-items: center; gap: 14px; min-height: 48px; padding: 0 4px; font: 300 11px/1.6 var(--font-display); letter-spacing: .3em; text-transform: uppercase; color: var(--soft); text-decoration: none; }
  .m-social .ig { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; color: var(--accent); }
  .m-social a:hover, .m-social a:focus-visible { color: var(--ink); }
  .m-social a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
  .m-social a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

  html.m-locked body { position: fixed; inset-inline: 0; width: 100%; overflow: hidden; }
}

/* on a phone the bar keeps only the brand and the menu: the quote button lives in the hero and in the menu */
@media (max-width: 560px) {
  .nav > .a-btn, .legal-head > .cap { display: none; }
}

@media (max-width: 900px) and (max-height: 560px) {
  /* phone on its side: smaller words so all five chapters and the quote button fit */
  .m-menu { padding-top: calc(72px + env(safe-area-inset-top)); gap: var(--s3); }
  .m-word { font-size: clamp(24px, 6vh, 40px); }
  .m-line { padding: 8px 0 6px; }
  .m-place, .m-fr { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .m-menu, .m-menu.is-open { clip-path: none; -webkit-clip-path: none; transition: opacity 1ms; }
  .m-menu:not(.is-open) { opacity: 0; }
  .m-line, .m-foot, .m-list li::before, .m-list li:last-child::after { transform: none !important; opacity: 1 !important; }
}
