/* ===========================================================
   LAYAN — persistent shell (task 3)
   Fixed layer above the page, on every breakpoint:
     #hdr          wordmark + «Записаться» pill
     .shell__side  ≥1024px: title top-left, section nav + footer
                   bottom-left (the reference's left column)
   The side column is hidden until html.shell-docked: on desktop the
   hero's title and nav fly into these exact spots on scroll
   (js/shell.js), then the copies here take over and stay.
   Colours follow the section underneath: data-top (header + title)
   and data-bot (nav + footer) are "dark", "light" or "hero", set by
   js/shell.js from each section's data-theme.
   =========================================================== */

.shell{
  --top-fg:var(--white);
  --bot-fg:var(--white);
  position:fixed;inset:0;z-index:100;pointer-events:none;
  font-family:var(--font-text);
}
.shell[data-top="light"]{--top-fg:var(--black)}
.shell[data-bot="light"]{--bot-fg:var(--black)}
/* screens I–II: Burgundy on the engraving → White with its colour (--hero-fg, css/intro.css) */
.shell[data-top="hero"]{--top-fg:var(--hero-fg)}
.shell[data-bot="hero"]{--bot-fg:var(--hero-fg)}

/* ---------- header ---------- */
#hdr{
  position:absolute;top:0;left:0;right:0;pointer-events:auto;
  display:flex;align-items:center;justify-content:space-between;
  padding:10px var(--pad-x) 0;
  padding-top:calc(10px + env(safe-area-inset-top,0px));
  color:var(--top-fg);
  opacity:0;transform:translateY(-6px);
}
#hdr.in{opacity:1;transform:none;transition:opacity .7s ease,transform .7s var(--ease-out)}

/* wordmark: the cream PNG used as a mask, painted with currentColor so it
   turns ink on light sections (never recoloured beyond white / brand black) */
.logo-link{display:block;line-height:0;color:inherit}
.logo{
  display:block;height:17px;aspect-ratio:666/152;
  background:currentColor;transition:background-color .35s ease;
  -webkit-mask:url(../assets/logo/layan-wordmark.png) no-repeat 0 0/contain;
          mask:url(../assets/logo/layan-wordmark.png) no-repeat 0 0/contain;
}

/* «Записаться»: a plain burgundy rectangle (client 2026-11-03), the same
   dress as the doctors page's «Следующий врач» (.dstory__next): Arimo,
   cream on Burgundy, no radius, Garnet on hover. Fades in with the header
   (#hdr.in). The brush version is in archive/header-brush-button/. */
.book{
  margin:0;padding:.85em 1.35em;white-space:nowrap;
  font:400 clamp(11px,.8vw,13px)/1 var(--font-text);letter-spacing:.01em;
  color:var(--cotton-fluff);background:var(--burgundy);border:0;border-radius:0;cursor:pointer;
  transition:background-color .3s ease,opacity .4s ease,visibility 0s;
  -webkit-tap-highlight-color:transparent;
}
/* the contacts section has its own form, so the button steps aside there (client, 2026-10-24) */
.shell[data-sec="sec-vi"] .book{opacity:0;visibility:hidden;pointer-events:none;
  transition:opacity .4s ease,visibility 0s linear .4s}
.book:hover{background:var(--garnet)}
.book:focus-visible{outline:2px solid var(--garnet);outline-offset:3px}

/* ---------- language switch: RU · EN · UZ (client 2026-11-25) ----------
   Three small Arimo Bold codes; the current one is full strength, the
   others dimmed like the inactive nav items. js/i18n.js marks the current
   one (.is-on) and reloads the page in the chosen language.
   ≥761px: in the header, left of «Записаться», in the header's colour.
   Phones: the header has no room, so the row sits in the menu (.mnav__lang). */
.lang{display:flex;align-items:center;gap:2px}
.lang button{
  margin:0;padding:8px 5px;background:none;border:0;border-radius:0;cursor:pointer;
  font:700 clamp(11px,.8vw,13px)/1 var(--font-text);letter-spacing:.04em;
  color:inherit;opacity:.6;transition:opacity .25s ease,color .35s ease;
  -webkit-tap-highlight-color:transparent;
}
.lang button:hover,.lang button.is-on{opacity:1}
.lang button.is-on{cursor:default}
.lang button:focus-visible{outline:2px solid var(--garnet);outline-offset:1px}
#hdr .lang{margin-left:auto;margin-right:clamp(8px,1.2vw,20px)}
.mnav__lang{display:none}
/* another language is loading (js/i18n.js): hold the Russian text back for that moment */
html.i18n-wait [data-i18n]{visibility:hidden}
}

/* ---------- side column (≥1024px) ---------- */
.shell__side{display:none}

.shell__ttl,.shell__nav,.shell__foot{pointer-events:auto;visibility:hidden}
html.shell-docked .shell__ttl,
html.shell-docked .shell__nav{visibility:visible}
/* hand-over: once docked the hero's own title + nav hide (same spot, same size) */
html.shell-docked .box .ttl,
html.shell-docked .box .nav{visibility:hidden}

/* title — same markup and proportions as the hero .ttl, so the flight
   is a pure translate + scale */
.shell__ttl{
  align-self:flex-start;color:var(--top-fg);text-decoration:none;
  font-weight:700;font-size:clamp(17px,1.4vw,22px);line-height:.92;letter-spacing:-.02em;
  transition:color .35s ease;
}
.shell__ttl .ln,.shell__ttl b{display:block;font-weight:700;line-height:.92}
.shell__ttl .it{font-family:var(--font-display);font-style:italic;font-weight:400;font-size:1.06em}

/* section nav — inactive items dim, the active one gets a short rule */
.shell__nav{margin-top:auto;display:flex;flex-direction:column;color:var(--bot-fg);transition:color .35s ease}
.shell__nav a{
  position:relative;display:flex;align-items:baseline;justify-content:space-between;gap:12px;
  color:inherit;text-decoration:none;
  font-weight:700;font-size:clamp(13px,1.05vw,16px);line-height:1.08;letter-spacing:-.01em;
}
.shell__nav .nm,.shell__nav .rn{opacity:.55;transition:opacity .3s ease}
.shell__nav .rn{font-family:var(--font-display);font-weight:400;font-size:.7em;letter-spacing:.02em}
.shell__nav a:hover .nm,.shell__nav a:hover .rn,
.shell__nav a.is-active .nm{opacity:1}
.shell__nav a.is-active .rn{opacity:.82}
.shell__nav a::before{
  content:"";position:absolute;right:calc(100% + 10px);top:.56em;width:16px;height:1px;
  background:currentColor;transform:scaleX(0);transform-origin:right center;
  transition:transform .45s var(--ease-out);
}
.shell__nav a.is-active::before{transform:scaleX(1)}

/* tiny footer */
.shell__foot{
  margin-top:18px;display:flex;flex-direction:column;
  font-family:var(--font-display);font-size:11px;line-height:1.35;
  color:var(--bot-fg);opacity:0;
  transition:opacity .4s ease,visibility 0s linear .4s,color .35s ease;
}
.shell__foot a{color:inherit;text-decoration:none;opacity:.7;transition:opacity .25s ease}
.shell__foot a:hover{opacity:1}
html.shell-docked .shell__foot{visibility:visible;opacity:1;transition:opacity .5s ease .1s,color .35s ease}

@media (min-width:1024px){
  .shell__side{
    position:absolute;display:flex;flex-direction:column;
    left:var(--pad-x);
    top:calc(64px + env(safe-area-inset-top,0px));
    bottom:20px;
    width:calc(var(--sidebar-w) - var(--pad-x) - 1.5vw);
  }
}

@media (max-width:760px){
  /* reference phone header: 14px label, 34px tall button (client 2026-11-04) */
  .book{font-size:14px;padding:10px 16px}
  .logo{height:21px}
  #hdr{padding-top:calc(12px + env(safe-area-inset-top,0px))}
}

/* ---------- mobile menu (<1024px, client 2026-11-04) ----------
   Reference: the Shopify Editions phone menu. A two-line burger sits right
   of «Записаться»; it opens .mnav, a full-screen warm-Black sheet under the
   header with the six sections as big Arimo rows, Faberge roman numerals
   right-aligned and hairlines between. While it is open the header is
   white, the burger is a cross and the page doesn't scroll (js/menu.js).
   ≥1024px none of this exists: the side nav does the job. */
.burger{display:none}
.mnav{display:none}

@media (max-width:1023px){
  /* Safari 26 paints a solid bar under the status bar / around the bottom
     toolbar when a full-width fixed element covers that edge, and a fully
     transparent one (the old inset:0 .shell) just keeps the page colour.
     So on phones the shell is a 0px-tall fixed line 8px down; the header
     and the menu hang off it as absolute children, which Safari ignores,
     and the page itself runs under the bars (client 2026-11-04). */
  .shell{inset:8px 0 auto 0;height:0}
  #hdr{top:-8px}
  .book{margin-left:auto}
  #hdr .lang + .book{margin-left:0}     /* 761–1023px: the language switch has the auto margin */
  .burger{
    position:relative;display:block;flex:none;
    width:40px;height:40px;margin:0 -8px 0 10px;padding:0;
    background:none;border:0;color:inherit;cursor:pointer;
    -webkit-tap-highlight-color:transparent;
  }
  .burger i{
    position:absolute;left:7px;right:7px;top:50%;height:2px;margin-top:-1px;
    background:currentColor;border-radius:1px;
    transition:transform .45s var(--ease-out);
  }
  .burger i:first-child{transform:translateY(-4.5px)}
  .burger i:last-child{transform:translateY(4.5px)}
  .shell.is-menu .burger i:first-child{transform:rotate(45deg)}
  .shell.is-menu .burger i:last-child{transform:rotate(-45deg)}
  .burger:focus-visible{outline:2px solid var(--garnet);outline-offset:-2px}

  /* open: header white over the sheet, «Записаться» stays (even over Контакты) */
  .shell.is-menu{--top-fg:var(--white)}
  .shell.is-menu .book{opacity:1;visibility:visible;pointer-events:auto}

  .mnav{
    position:absolute;top:-8px;left:0;right:0;height:100lvh;display:flex;flex-direction:column;
    padding:calc(68px + env(safe-area-inset-top,0px)) var(--pad-x) calc(20px + env(safe-area-inset-bottom,0px));
    background:var(--black);color:var(--white);
    overflow-y:auto;overscroll-behavior:contain;
    opacity:0;visibility:hidden;pointer-events:none;
    transition:opacity .4s ease,visibility 0s linear .4s;
  }
  .shell.is-menu .mnav{opacity:1;visibility:visible;pointer-events:auto;transition:opacity .35s ease}

  .mnav__list{display:flex;flex-direction:column;border-top:1px solid var(--cream-a12)}
  .mnav__list a{
    display:flex;align-items:baseline;justify-content:space-between;gap:16px;
    padding:.5em 0 .52em;border-bottom:1px solid var(--cream-a12);
    color:inherit;text-decoration:none;
    font:700 clamp(26px,7.6vw,40px)/1.12 var(--font-text);letter-spacing:-.02em;
    opacity:0;transform:translateY(14px);
    transition:opacity .3s ease,transform .3s ease;
  }
  .mnav__list .rn{
    font:400 .74em/1 var(--font-display);letter-spacing:.02em;opacity:.7;
  }
  .mnav__list a.is-active .nm{color:var(--cotton-fluff)}
  .mnav__list a:not(.is-active) .nm{opacity:.92}
  .mnav__list a:active{opacity:.6}
  .shell.is-menu .mnav__list a{opacity:1;transform:none;
    transition:opacity .5s ease calc(.05s + var(--i,0) * .045s),transform .7s var(--ease-out) calc(.05s + var(--i,0) * .045s)}

  .mnav__foot{
    margin-top:auto;padding-top:28px;display:flex;justify-content:space-between;gap:16px;
    font:400 12px/1.3 var(--font-text);color:var(--cream-a60);
  }
  .mnav__foot a{color:inherit;text-decoration:none}
}
@media (max-width:760px){
  .mnav{padding-left:var(--gutter);padding-right:var(--gutter)}
  /* language row under the section list (the header has no room for it) */
  #hdr .lang{display:none}
  #hdr .lang + .book{margin-left:auto}
  .mnav__lang{display:flex;gap:6px;margin-top:20px}
  .mnav__lang button{font-size:15px;letter-spacing:.06em;padding:12px 16px 12px 0;opacity:.5}
  .mnav__lang button.is-on{color:var(--cotton-fluff)}
}
@media (prefers-reduced-motion: reduce){
  .mnav,.mnav__list a,.burger i{transition:none !important}
}

/* ---------- page behind Safari's bars (<1024px, client 2026-11-04) ----------
   Safari 26 looks ~4px inside the top (and bottom) edge, walks up from the
   element there to the first fixed / sticky ancestor and paints a solid bar
   in its colour, unless that pinned element is pointer-events:none, which
   it skips so the page shows through (tested by hawkshift.com). So every
   full-screen pin lets taps through itself and only its controls take them:
   the header, the hero pin (box links), the doctors pin (its centre already
   works this way) and the results stage (case list, next button). */
@media (max-width:1023px){
  #hdr{pointer-events:none}
  #hdr .logo-link,#hdr .lang,#hdr .book,#hdr .burger{pointer-events:auto}
  .hero__pin,.hero__pin .stage,#bg{pointer-events:none}
  .hero__pin .box{pointer-events:auto}
  .dstory__pin{pointer-events:none}
  .rsp__stage,.rsp__list{pointer-events:none}
  .rsp__it,.rsp__next{pointer-events:auto}
}


/* ---------- White Safari bars (<1024px, client 2026-11-04) ----------
   See the comment at the top of <body>. The strips need a plain opaque
   background, ≥10px, full width and must take pointer events (Safari skips
   pointer-events:none); 12px at the very edges is above the header's
   buttons. 1 % opacity: Safari still reads the White, the page doesn't show it. */
.boot,.sbar{display:none}
@media (max-width:1023px){
  .sbar{display:block;position:fixed;left:0;right:0;z-index:1001;height:12px;background:#fff;opacity:.01}
  .sbar--t{top:0}
  .sbar--b{bottom:0}
  .boot{
    display:block;position:fixed;inset:0;z-index:1000;background:#fff;
    animation:boot-out .45s ease .6s forwards;
  }
}
@keyframes boot-out{to{opacity:0;visibility:hidden}}
@media (prefers-reduced-motion: reduce){
  .boot{animation-duration:.01s}
}
