/* Mindex Smooth toolbox stylesheet
   ＋ボタン、道具箱、作る/操作/管理カテゴリ、道具箱の開閉演出。
   役割を道具箱だけに絞った整理版。
*/

/* =========================================================
   Floating tool dock / plus button
   ========================================================= */

.toolDock{
  position:fixed;
  left:14px;
  right:14px;
  bottom:calc(14px + var(--safeBottom));
  z-index:15;
  display:flex;
  justify-content:flex-end;
  align-items:flex-end;
  pointer-events:none;
}

body.panel-left .toolDock{
  justify-content:flex-start;
}

body.panel-right .toolDock{
  justify-content:flex-end;
}

.toolToggle{
  width:58px;
  height:58px;
  min-width:58px;
  min-height:58px;
  border-radius:50%;
  padding:0;
  display:grid;
  place-items:center;
  font-size:0;
  box-shadow:0 12px 24px rgba(47,111,115,.26);
  pointer-events:auto;
  position:relative;
  z-index:2;
  transition:
    opacity .18s ease,
    transform .22s cubic-bezier(.2,.9,.2,1),
    box-shadow .18s ease;
  transform-origin:center center;
}

.toolToggle::before{
  content:"+";
  font-size:34px;
  line-height:1;
  font-weight:800;
  transform:translateY(-1px);
}

.toolToggle:active{
  transform:scale(.92);
}

.toolDock.open .toolToggle{
  opacity:0;
  transform:scale(.45);
  pointer-events:none;
  box-shadow:0 4px 10px rgba(47,111,115,.10);
}

/* 削除モード中は＋道具箱を隠して、作成操作と削除操作が混ざらないようにする */
.deleteMode .toolDock{
  display:none!important;
}

/* =========================================================
   Tool panel shell
   ========================================================= */

.toolPanel,
.verticalTextToolPanel{
  position:absolute;
  right:0;
  bottom:0;
  width:auto!important;
  min-width:92px!important;
  max-width:112px!important;
  padding:0!important;
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
  backdrop-filter:none!important;
  -webkit-backdrop-filter:none!important;
  overflow:visible!important;
  display:block!important;
  pointer-events:none;
  opacity:0;
  transform:translateY(12px) scale(.86);
  transform-origin:right bottom;
  transition:
    opacity .22s ease,
    transform .24s cubic-bezier(.16,1,.22,1);
}

.toolDock.open .toolPanel,
.toolDock.open .verticalTextToolPanel{
  pointer-events:auto;
  opacity:1;
  transform:translateY(0) scale(1);
}

body.panel-left .toolPanel,
body.panel-left .verticalTextToolPanel{
  left:0!important;
  right:auto!important;
  transform-origin:left bottom!important;
}

body.panel-right .toolPanel,
body.panel-right .verticalTextToolPanel{
  right:0!important;
  left:auto!important;
  transform-origin:right bottom!important;
}

/* 操作しないパネルがタッチを邪魔しないように */
.toolDock.open{
  pointer-events:none;
}

.toolDock.open .verticalTextToolPanel,
.toolDock.open .toolPanel,
.toolToggle{
  pointer-events:auto;
}

/* 道具箱が開いている時の外側クリック用の透明な受け皿 */
.toolScrim{
  position:fixed;
  inset:0;
  z-index:14;
  display:none;
  background:transparent;
}

.toolScrim.show{
  display:block;
}

/* =========================================================
   Vertical text toolbox pages
   ========================================================= */

.verticalTextToolStack{
  display:grid;
  gap:8px;
  justify-items:stretch;
  align-items:end;
}

.verticalTextPage{
  display:none;
  flex-direction:column;
  gap:8px;
}

.verticalTextPage.active{
  display:flex;
  animation:verticalTextIn .18s cubic-bezier(.18,1.08,.22,1) both;
}

.verticalTextButton{
  width:92px!important;
  min-width:92px!important;
  height:58px!important;
  min-height:58px!important;
  padding:0 10px!important;
  border-radius:22px!important;
  display:grid!important;
  place-items:center!important;
  text-align:center!important;
  background:rgba(255,255,255,.88)!important;
  border:1px solid rgba(30,27,22,.085)!important;
  color:rgba(30,27,22,.78)!important;
  box-shadow:
    0 7px 18px rgba(30,27,22,.10),
    inset 0 1px 0 rgba(255,255,255,.72)!important;
  font-size:13px!important;
  font-weight:900!important;
  line-height:1.15!important;
  white-space:normal!important;
  overflow:hidden!important;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
  -webkit-user-select:none;
  user-select:none;
  transition:transform .12s ease, background .12s ease, opacity .12s ease;
}

.verticalTextButton:active{
  transform:scale(.96);
}

.verticalTextButton.primary,
.verticalTextButton.category.active{
  background:var(--accent)!important;
  color:#fff!important;
  border-color:transparent!important;
  box-shadow:0 10px 22px rgba(47,111,115,.24)!important;
}

.verticalTextButton.subtle{
  height:46px!important;
  min-height:46px!important;
  border-radius:20px!important;
  opacity:.94;
}

.verticalTextButton.dangerText{
  color:#8f2e2e!important;
  background:rgba(178,59,59,.065)!important;
  border-color:rgba(178,59,59,.14)!important;
}

.verticalTextButton.toolHidden{
  display:none!important;
}

.verticalToolClose{
  position:absolute;
  right:0;
  top:-42px;
  width:34px!important;
  height:34px!important;
  min-width:34px!important;
  min-height:34px!important;
  border-radius:50%!important;
  padding:0!important;
  display:grid!important;
  place-items:center!important;
  background:rgba(255,252,243,.94)!important;
  border:1px solid rgba(30,27,22,.10)!important;
  color:rgba(30,27,22,.52)!important;
  box-shadow:0 5px 14px rgba(30,27,22,.09)!important;
  font-size:20px!important;
  font-weight:500!important;
  line-height:1!important;
  z-index:3;
  -webkit-tap-highlight-color:transparent;
}

.verticalToolClose:active{
  transform:scale(.92);
}

body.panel-left .verticalToolClose{
  left:0;
  right:auto;
}

@keyframes verticalTextIn{
  from{
    opacity:0;
    transform:translateY(8px) scale(.97);
  }
  to{
    opacity:1;
    transform:translateY(0) scale(1);
  }
}

/* =========================================================
   Press-before-action feedback
   ========================================================= */

/* mindex-smooth.js が付与する一時クラス。
   機能発火を少しだけ遅らせる対象ボタンに、押した事実だけを強く返す。 */
.verticalTextButton.toolActionPending{
  background:rgba(30,27,22,.36)!important;
  color:#fff!important;
  transform:scale(.88) translateY(2px)!important;
  box-shadow:
    inset 0 7px 16px rgba(0,0,0,.36),
    0 1px 3px rgba(30,27,22,.08)!important;
  border-color:rgba(30,27,22,.18)!important;
}

.verticalTextButton.toolActionPending .createToolText{
  color:#fff!important;
}

.verticalTextButton.toolActionPending .createToolImg{
  filter:brightness(.58) contrast(1.12)!important;
  mix-blend-mode:normal!important;
}

/* =========================================================
   Create-category image buttons
   ========================================================= */

.verticalTextButton.createIconButton{
  height:76px!important;
  min-height:76px!important;
  padding:6px 6px 7px!important;
  display:grid!important;
  grid-template-rows:48px auto!important;
  place-items:center!important;
  gap:2px!important;
}

.createToolImg{
  width:48px!important;
  height:48px!important;
  object-fit:contain!important;
  display:block!important;
  border:0!important;
  outline:0!important;
  background:transparent!important;
  box-shadow:none!important;
  border-radius:12px!important;
  mix-blend-mode:multiply;
}

.createIconButton.primary .createToolImg{
  mix-blend-mode:normal;
  filter:saturate(.92) brightness(1.08);
}

.createToolText{
  display:block;
  font-size:11px!important;
  line-height:1.05!important;
  font-weight:900!important;
  max-width:74px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

#templateBtn .createToolText{
  font-size:10px!important;
}

html[lang="en"] .createToolText{
  font-size:10px!important;
  max-width:78px;
}

.verticalTextButton.createIconButton::before,
.verticalTextButton.createIconButton::after{
  content:none!important;
  display:none!important;
}

/* =========================================================
   Responsive / reduced motion
   ========================================================= */

@media (max-width:520px){
  .verticalTextToolPanel,
  .toolPanel{
    min-width:86px!important;
    max-width:92px!important;
  }

  .verticalTextButton{
    width:86px!important;
    min-width:86px!important;
    height:54px!important;
    min-height:54px!important;
    border-radius:21px!important;
    font-size:12px!important;
  }

  .verticalTextButton.createIconButton{
    height:72px!important;
    min-height:72px!important;
    grid-template-rows:44px auto!important;
  }

  .createToolImg{
    width:44px!important;
    height:44px!important;
  }

  .createToolText{
    font-size:10.5px!important;
  }

  #templateBtn .createToolText{
    font-size:9.5px!important;
  }
}

@media (prefers-reduced-motion: reduce){
  .toolToggle,
  .toolPanel,
  .verticalTextToolPanel,
  .verticalTextButton{
    transition:none!important;
  }

  .verticalTextPage.active{
    animation:none!important;
  }
}
