/* GlassHall · «Граница, которая исчезает» · сцена портала, версия 3 */

#anatomy.gh-portal{--gold:#e2c18d;--ink:#fcf9ef;--soft:#ecebdf;--mute:rgba(252,249,239,.66);--night:9,13,10;position:relative;margin:0;padding:0;height:auto;background:#121713;color:var(--ink);text-align:left;overflow:visible}
#anatomy.gh-portal.gh-scroll{height:260vh;height:260svh}
#anatomy.gh-portal *,#anatomy.gh-portal *::before,#anatomy.gh-portal *::after{box-sizing:border-box}
#anatomy.gh-portal [hidden]{display:none!important}
/* Без скрипта сцена статична: подсказка про прокрутку и счётчик не показываются */
#anatomy.gh-portal:not(.gh-enhanced) .gh-portal-meter{display:none}

/* Закреплённый кадр */
#anatomy.gh-portal .gh-portal-pin{position:relative;isolation:isolate;display:flex;flex-direction:column;justify-content:flex-end;height:100vh;height:100svh;min-height:0;overflow:hidden}
#anatomy.gh-portal.gh-scroll .gh-portal-pin{position:sticky;top:0}

/* Изображение: пластина 16:9, которую скрипт вписывает в окно и ведёт за действием */
#anatomy.gh-portal .gh-portal-view{position:absolute;inset:0;z-index:-1;overflow:hidden;pointer-events:none;background:#14130e}
#anatomy.gh-portal .gh-portal-plate{position:absolute;inset:0}
#anatomy.gh-portal.gh-fit .gh-portal-plate{inset:auto;left:0;top:0;will-change:transform}
#anatomy.gh-portal .gh-portal-plate img,#anatomy.gh-portal .gh-portal-plate canvas{position:absolute;inset:0;display:block;width:100%;height:100%;max-width:none;margin:0;border:0;object-fit:cover;object-position:46% 50%}

/* Зерно скрывает мягкость увеличенных кадров и плоские поверхности визуализации */
#anatomy.gh-portal .gh-portal-view::before{content:'';position:absolute;inset:0;z-index:3;opacity:.2;mix-blend-mode:overlay;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") 0 0/180px 180px}
/* Затемнение под подписями и виньетка; виньетка тает по мере выхода наружу */
#anatomy.gh-portal .gh-portal-view::after{content:'';position:absolute;inset:0;z-index:2;background:linear-gradient(to top,rgba(var(--night),.86) 0,rgba(var(--night),.62) 19%,rgba(var(--night),.2) 35%,rgba(var(--night),0) 48%),radial-gradient(125% 95% at 50% 42%,rgba(var(--night),0) 50%,rgba(var(--night),calc(.5*var(--veil,1))) 100%)}
/* Дневной свет в момент прохода через проём */
#anatomy.gh-portal .gh-portal-glow{position:absolute;inset:0;z-index:1;opacity:var(--glow,0);mix-blend-mode:soft-light;background:radial-gradient(72% 82% at 54% 44%,rgba(255,243,214,.95),rgba(255,243,214,0) 72%)}

/* Размерная линия на створке, пока портал закрыт */
#anatomy.gh-portal .gh-portal-dim{display:none}
#anatomy.gh-portal.gh-fit .gh-portal-dim{display:block;position:absolute;left:42.9%;top:11%;width:1px;height:65.3%;background:var(--gold);opacity:var(--dim,1);transform-origin:50% 0;transition:transform 1.1s cubic-bezier(.2,.7,.2,1) .25s}
#anatomy.gh-portal .gh-portal-dim::before,#anatomy.gh-portal .gh-portal-dim::after{content:'';position:absolute;left:-5px;width:11px;height:1px;background:var(--gold)}
#anatomy.gh-portal .gh-portal-dim::before{top:0}
#anatomy.gh-portal .gh-portal-dim::after{bottom:0}
#anatomy.gh-portal .gh-portal-dim i{position:absolute;left:13px;top:80%;transform:translateY(-50%);padding:5px 9px 4px;border:1px solid rgba(226,193,141,.55);background:rgba(var(--night),.78);color:var(--gold);font:500 11px/1 var(--mono,ui-monospace,SFMono-Regular,Menlo,monospace);font-style:normal;letter-spacing:.12em;white-space:nowrap;transition:opacity .6s 1s}
#anatomy.gh-portal.gh-enhanced:not(.gh-in) .gh-portal-dim{transform:scaleY(0)}
#anatomy.gh-portal.gh-enhanced:not(.gh-in) .gh-portal-dim i{opacity:0}

/* Заголовок: стоит на тёмной кроне за стеклом и уходит, когда створка начинает движение */
#anatomy.gh-portal .gh-portal-head{position:absolute;left:50%;right:4%;top:calc(var(--gh-top,0px) + (100% - var(--gh-top,0px))*.42);z-index:1;opacity:var(--head,1);transform:translate3d(calc(var(--push,0)*1px),-50%,0)}
#anatomy.gh-portal .gh-portal-head::before{content:'';position:absolute;inset:-38% -6% -42% -16%;z-index:-1;background:radial-gradient(closest-side,rgba(var(--night),.66),rgba(var(--night),.46) 50%,rgba(var(--night),0))}
#anatomy.gh-portal .gh-portal-label,#anatomy.gh-portal .gh-portal-meter,#anatomy.gh-portal .gh-portal-stages small{font:500 clamp(10px,.72vw,13px)/1.5 var(--mono,ui-monospace,SFMono-Regular,Menlo,monospace);letter-spacing:.15em;text-transform:uppercase}
#anatomy.gh-portal .gh-portal-label{margin:0 0 clamp(10px,2vh,24px);padding:0;color:var(--gold);text-shadow:0 0 14px rgba(var(--night),.95),0 1px 3px rgba(var(--night),.8)}
#anatomy.gh-portal :is(h1,h2){margin:0;padding:0;color:var(--ink);font-family:var(--disp,Georgia,'Times New Roman',serif);font-weight:400;font-size:clamp(40px,min(4.55vw,9.6vh),89px);line-height:1.04;letter-spacing:-.045em;text-align:left;text-wrap:balance}
#anatomy.gh-portal :is(h1,h2) em{color:var(--gold);font-family:var(--disp,'Playfair Display',Georgia,serif);font-style:italic;font-weight:400}
#anatomy.gh-portal.gh-enhanced .gh-portal-head>*{transition:opacity .9s ease,transform .9s cubic-bezier(.2,.7,.2,1)}
#anatomy.gh-portal.gh-enhanced .gh-portal-head>:nth-child(2){transition-delay:.12s}
#anatomy.gh-portal.gh-enhanced:not(.gh-in) .gh-portal-head>*{opacity:0;transform:translateY(18px)}

/* Нижняя полоса: три этапа со шкалой, управление, подпись */
#anatomy.gh-portal .gh-portal-copy{position:relative;z-index:1;width:100%;margin:0;padding:0 5% clamp(16px,3vh,32px);color:var(--ink)}
#anatomy.gh-portal .gh-portal-stages{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0 clamp(14px,2.2vw,40px);margin:0;padding:0;list-style:none}
#anatomy.gh-portal .gh-portal-stages li{min-width:0;margin:0;padding:0;border:0;list-style:none}
#anatomy.gh-portal .gh-portal-stages li::before{content:none}
#anatomy.gh-portal .gh-portal-stages button{appearance:none;-webkit-appearance:none;display:flex;align-items:baseline;gap:.8em;width:100%;margin:0;padding:15px 0 0;border:0;border-radius:0;color:var(--mute);text-align:left;cursor:pointer;background:linear-gradient(var(--gold),var(--gold)) 0 0/calc(var(--f,0)*100%) 2px no-repeat,linear-gradient(rgba(252,249,239,.32),rgba(252,249,239,.32)) 0 0/100% 1px no-repeat;transition:color .35s ease}
#anatomy.gh-portal .gh-portal-stages button:hover{color:var(--ink)}
#anatomy.gh-portal .gh-portal-stages small{flex:none;min-width:1.9em;color:var(--mute);transition:color .35s ease}
#anatomy.gh-portal .gh-stage-title{font:400 clamp(20px,1.62vw,31px)/1.15 var(--disp,Georgia,serif);letter-spacing:-.025em}
#anatomy.gh-portal .gh-portal-stages li[aria-current] button{color:var(--ink)}
#anatomy.gh-portal .gh-portal-stages li[aria-current] small{color:var(--gold)}
#anatomy.gh-portal .gh-portal-stages p{max-width:40ch;margin:clamp(5px,.9vh,9px) 0 0;padding:0;color:var(--soft);font:400 clamp(13.5px,1vw,17px)/1.45 var(--sans,Inter,Arial,sans-serif);text-align:left;transition:opacity .45s ease,visibility 0s}
#anatomy.gh-portal.gh-enhanced .gh-portal-stages li:not([aria-current]) p{opacity:0;visibility:hidden;transition:opacity .3s ease,visibility 0s .3s}

#anatomy.gh-portal .gh-portal-foot{display:flex;align-items:center;flex-wrap:wrap;gap:10px 26px;margin-top:clamp(12px,2.3vh,24px)}
#anatomy.gh-portal .gh-portal-controls{display:flex;align-items:center;gap:14px;margin:0}
#anatomy.gh-portal .gh-portal-play{appearance:none;-webkit-appearance:none;display:inline-flex;align-items:center;gap:10px;margin:0;padding:9px 16px 9px 14px;border:1px solid rgba(226,193,141,.6);border-radius:99px;background:rgba(var(--night),.55);color:var(--ink);font:500 13px/1.1 var(--sans,Inter,Arial,sans-serif);white-space:nowrap;cursor:pointer;transition:border-color .25s ease,background-color .25s ease}
#anatomy.gh-portal .gh-portal-play:hover{border-color:var(--gold);background:rgba(var(--night),.8)}
#anatomy.gh-portal .gh-portal-play::before{content:'';flex:none;width:0;height:0;border:solid transparent;border-width:5px 0 5px 8px;border-left-color:var(--gold)}
#anatomy.gh-portal .gh-portal-play[data-state=playing]::before{width:8px;height:10px;border-width:0 3px;border-color:var(--gold)}
#anatomy.gh-portal .gh-portal-controls input{width:clamp(120px,16vw,260px);height:24px;margin:0;cursor:pointer;accent-color:var(--gold)}
#anatomy.gh-portal.gh-scroll .gh-portal-controls input{display:none}
#anatomy.gh-portal .gh-portal-meter{display:flex;flex:1 1 auto;justify-content:space-between;align-items:center;gap:6px 22px;margin:0;color:var(--soft);letter-spacing:.09em}
#anatomy.gh-portal .gh-portal-hint{opacity:var(--hint,1)}
#anatomy.gh-portal .gh-portal-open{margin-left:auto;white-space:nowrap}
#anatomy.gh-portal .gh-portal-meter b{display:inline-block;min-width:3.4ch;color:var(--gold);font-weight:500;font-variant-numeric:tabular-nums;text-align:right}
#anatomy.gh-portal .gh-portal-credit{margin:0;padding:0;color:var(--mute);font:400 12px/1.4 var(--sans,Inter,Arial,sans-serif)}
#anatomy.gh-portal .gh-portal-credit a{color:inherit;text-decoration:underline;text-decoration-color:rgba(252,249,239,.4);text-underline-offset:3px;transition:color .4s ease,text-decoration-color .4s ease}
#anatomy.gh-portal .gh-portal-credit a:hover,#anatomy.gh-portal.gh-end .gh-portal-credit a{color:var(--gold);text-decoration-color:var(--gold)}
#anatomy.gh-portal :is(button,a,input):focus-visible{outline:2px solid var(--gold);outline-offset:4px}

/* Телефоны и узкие окна: кадр сверху целиком, текст под ним — действие ничем не закрыто */
@media(max-width:760px){
  #anatomy.gh-portal .gh-portal-pin{justify-content:flex-start}
  #anatomy.gh-portal .gh-portal-view{position:relative;inset:auto;z-index:0;flex:1 1 0;min-height:32vh;margin-top:var(--gh-top,0px)}
  #anatomy.gh-portal .gh-portal-view::after{background:linear-gradient(to top,#121713 0,rgba(18,23,19,.55) 9%,rgba(18,23,19,0) 26%),radial-gradient(125% 95% at 50% 42%,rgba(var(--night),0) 55%,rgba(var(--night),calc(.4*var(--veil,1))) 100%)}
  #anatomy.gh-portal .gh-portal-head{position:relative;left:auto;right:auto;top:auto;margin-top:-22px;padding:0 6%;opacity:1;transform:none}
  #anatomy.gh-portal .gh-portal-head::before{content:none}
  #anatomy.gh-portal .gh-portal-label{margin-bottom:6px}
  #anatomy.gh-portal :is(h1,h2){font-size:clamp(32px,9.2vw,56px)}
  #anatomy.gh-portal .gh-portal-copy{padding:14px 6% max(16px,env(safe-area-inset-bottom))}
  #anatomy.gh-portal .gh-portal-stages{display:block}
  #anatomy.gh-portal .gh-portal-stages li+li{margin-top:10px}
  #anatomy.gh-portal .gh-portal-stages button{padding-top:11px}
  #anatomy.gh-portal .gh-stage-title{font-size:21px}
  #anatomy.gh-portal .gh-portal-stages p{max-width:none;margin-top:4px;font-size:14px}
  /* Со скриптом: активный этап раскрыт, остальные свёрнуты до номера; описание — общей строкой ниже */
  #anatomy.gh-portal.gh-enhanced .gh-portal-stages{position:relative;display:flex;gap:8px;padding-bottom:70px}
  #anatomy.gh-portal.gh-enhanced .gh-portal-stages li{flex:0 0 46px;margin:0}
  #anatomy.gh-portal.gh-enhanced .gh-portal-stages li[aria-current]{flex:1 1 auto}
  #anatomy.gh-portal.gh-enhanced .gh-portal-stages li:not([aria-current]) .gh-stage-title{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  #anatomy.gh-portal.gh-enhanced .gh-portal-stages p{position:absolute;left:0;right:0;bottom:0;height:61px;margin:0}
  #anatomy.gh-portal .gh-portal-foot{gap:8px 14px;margin-top:10px}
  #anatomy.gh-portal .gh-portal-meter{font-size:10px}
  #anatomy.gh-portal.gh-scroll .gh-portal-hint{display:none}
  #anatomy.gh-portal .gh-portal-credit{flex-basis:100%;font-size:11px}
  #anatomy.gh-portal .gh-portal-dim i{font-size:10px;padding:4px 7px 3px}
}
@media(max-width:760px) and (max-height:640px){
  #anatomy.gh-portal .gh-portal-view{min-height:24vh}
  #anatomy.gh-portal :is(h1,h2){font-size:30px}
  #anatomy.gh-portal .gh-portal-copy{padding-top:8px}
}
/* Низкие окна и телефоны в альбомной ориентации */
@media(max-height:560px) and (min-width:761px){
  #anatomy.gh-portal .gh-portal-copy{padding-bottom:10px}
  #anatomy.gh-portal .gh-portal-stages button{padding-top:10px}
  #anatomy.gh-portal .gh-stage-title{font-size:19px}
  #anatomy.gh-portal .gh-portal-stages p{font-size:13px;margin-top:3px}
  #anatomy.gh-portal .gh-portal-foot{margin-top:8px}
  #anatomy.gh-portal .gh-portal-play{padding:6px 13px 6px 11px}
  #anatomy.gh-portal .gh-portal-label{margin-bottom:6px}
}
@media(prefers-reduced-motion:reduce){
  #anatomy.gh-portal *,#anatomy.gh-portal *::before,#anatomy.gh-portal *::after{transition:none!important}
}
