/* Folio v0.7.2 — 右ページ下端の6ページ見出し */
:root {
  --folio-tab-paper: rgba(247, 240, 220, .94);
  --folio-tab-line: rgba(63, 70, 60, .24);
}

/* 写真は「全体表示」のまま、白い額縁だけを細くする */
.photo-page-grid .large-polaroid {
  width: min(278px, 92%);
  padding: 3px 3px 16px;
}
.photo-page-grid .large-polaroid span {
  margin: 4px 0 -12px;
}

/* お気に入り編集ページを紙面上端へ寄せる */
.favorite-library-paper {
  padding-top: 8px;
}
.favorite-library-paper > .detail-header {
  min-height: 48px;
  margin-bottom: 3px;
}
.favorite-library-paper > .favorite-library-intro {
  margin: 3px 0 8px;
  line-height: 1.45;
}
.favorite-shelf-grid[data-zone="dock"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 840px) {
  .home-view .right-page {
    grid-template-rows: 6.5% minmax(0, 51%) minmax(0, 34%);
    gap: 1%;
  }

  .home-view .right-page > .right-lower-controls {
    position: absolute;
    z-index: 25;
    left: 11px;
    right: 11px;
    bottom: 4px;
    min-width: 0;
    min-height: 36px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    padding: 0;
    border: 0;
    background: transparent;
    pointer-events: none;
  }

  .right-page-tab-group {
    min-width: 0;
    display: flex;
    align-items: end;
    border: 1px solid var(--folio-tab-line);
    background: var(--folio-tab-paper);
    box-shadow: 0 3px 8px rgba(54, 40, 25, .1);
    pointer-events: auto;
  }

  .right-page-tab-group button {
    min-width: 46px;
    max-width: 76px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 7px;
    overflow: hidden;
    color: var(--dock-ink);
    border: 0;
    border-right: 1px solid var(--folio-tab-line);
    background: transparent;
    font: 9px/1.05 var(--display);
    white-space: nowrap;
  }
  .right-page-tab-group button:last-child { border-right: 0; }
  .right-page-tab-group button:active { transform: translateY(1px); }
  .right-page-tab-group button:focus-visible { position: relative; z-index: 2; outline: 2px solid var(--dock-russet); outline-offset: 1px; }
  .right-page-tab-group button > span:last-child {
    min-width: 0;
    max-width: 51px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .right-page-tab-group button.is-active {
    color: #fffaf0;
    background: var(--dock-moss);
  }
  .right-page-tab-group-right #rightModeAppButton { color: var(--dock-russet); }

  .right-page-home-tab svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    stroke-width: 1.7;
  }
  .right-page-tab-group .bottom-tab-app-icon {
    width: 20px !important;
    height: 20px !important;
    flex: 0 0 20px;
    margin: 0;
    border-width: 1px;
    border-radius: 6px;
    box-shadow: none;
    font-size: 8px;
  }
  .bottom-tab-plus {
    color: var(--dock-moss);
    font: 18px/1 var(--body);
  }

  /* アプリ面は上の空きをなくし、下のページ見出しだけ避ける */
  .right-apps-panel {
    inset: 5px 9px 44px;
    gap: 5px;
    padding: 7px 10px 9px;
  }
  .right-apps-heading {
    padding-bottom: 5px;
  }
  .right-apps-heading h2 {
    margin-top: 0;
    font-size: 21px;
  }
  .right-apps-heading button { padding: 5px 9px; }

  /* 折り返しの丸ボタンはページ見出しの一段上へ逃がす */
  .page-fold-actions {
    bottom: 47px;
  }

  /* 左ページと下の見出しを固定し、右ページ本文だけを送る */
  .home-view .right-page > :is(.right-header, .calendar-card, .family-today-mount, .family-upcoming-panel, .right-apps-panel) {
    transition: transform .16s ease, opacity .12s ease;
  }
  .home-view .right-page[data-turn-direction="to-apps"].is-right-page-leaving > :is(.right-header, .calendar-card, .family-today-mount, .family-upcoming-panel, .right-apps-panel) {
    opacity: 0;
    transform: translateX(-28px);
  }
  .home-view .right-page[data-turn-direction="to-calendar"].is-right-page-leaving > :is(.right-header, .calendar-card, .family-today-mount, .family-upcoming-panel, .right-apps-panel) {
    opacity: 0;
    transform: translateX(28px);
  }
  .home-view .right-page[data-turn-direction="to-apps"].is-right-page-entering > :is(.right-header, .calendar-card, .family-today-mount, .family-upcoming-panel, .right-apps-panel) {
    opacity: 0;
    transform: translateX(28px);
    transition: none;
  }
  .home-view .right-page[data-turn-direction="to-calendar"].is-right-page-entering > :is(.right-header, .calendar-card, .family-today-mount, .family-upcoming-panel, .right-apps-panel) {
    opacity: 0;
    transform: translateX(-28px);
    transition: none;
  }
}

@media (max-width: 839px) {
  .right-lower-controls { display: none !important; }
  .favorite-library-paper { padding-top: 5px; }
  .favorite-library-paper > .detail-header { margin-bottom: 1px; }
  .photo-page-grid .large-polaroid {
    width: 96%;
    padding: 2px 2px 12px;
  }
  .photo-page-grid .large-polaroid span {
    margin: 3px 0 -9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-view .right-page > :is(.right-header, .calendar-card, .family-today-mount, .family-upcoming-panel, .right-apps-panel) {
    transition: none !important;
  }
}
