/*
 Theme Name:    Twenty Twenty-Five Child
 Template:      twentytwentyfive
 Description:   西陣織物同業組合沿革史 カスタマイズ統合版
 Version:       1.2.1
*/

/* Responsive header rewrite for kuzasakougei.jp
   Expected structure:
   <header class="site-header">
     <div class="header-row">
       <div class="header-brand">
         <a class="SiteLogo site-logo-mark">...</a>
         <a class="SiteLogo site-logo-title">...</a>
       </div>
       <button class="menu-toggle">...</button>
       <nav class="main-navigation header-nav">...</nav>
     </div>
   </header>
*/

/* Header rewrite proposal
   Required classes:
   .header-row
   .SiteLogo
   .global-nav
*/
@media (max-width: 782px) {
  .wp-site-blocks {
    padding-top: 70px;
  }
}
/* =========================
   Header glass
========================= */
.site-header {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  padding: 0;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.18)),
    linear-gradient(120deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.04) 40%, rgba(255, 255, 255, 0.20));
  pointer-events: none;
}

.site-header__inner {
  position: relative;
  z-index: 1;
  min-height: 88px;
  padding: 0 20px;
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-header.is-scrolled {
  background: rgba(255, 255, 255, 0.48);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.14);
}

.site-title {
  white-space: nowrap;
}

.site-nav {
  position: relative;
  z-index: 1;
}

.site-nav__list {
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__list a {
  color: #222;
  text-decoration: none;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: opacity 0.2s ease;
  font-size: 0.97rem;
}

.site-header__inner>.wp-block-group:first-child {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: max-content;
  gap: 12px;
}

.site-header .custom-logo,
.site-header .wp-block-site-logo img,
.site-header .site-logo img {
  display: block;
  max-height: 48px;
  width: auto;
  height: auto;
}

.site-nav__list a:hover {
  opacity: 0.7;
}

/* =========================
   Toggle button
========================= */
.site-nav--desktop {
  display: block;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.menu-toggle__line {
  display: block;
  width: 22px;
  height: 2px;
  margin: 0 auto;
  background: #222;
  border-radius: 999px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

body.menu-open .menu-toggle__line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.menu-open .menu-toggle__line:nth-child(2) {
  opacity: 0;
}

body.menu-open .menu-toggle__line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* =========================
   Full page overlay
========================= */
.site-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(20, 16, 12, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

body.menu-open .site-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* =========================
   Drawer panel
========================= */
.site-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 82vw);
  height: 100vh;
  z-index: 1200;
  transform: translateX(100%);
  transition: transform 0.32s ease;
  background: rgba(45, 36, 28, 0.88);
  color: #fff;
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.24);
  overflow-y: auto;
}

body.menu-open .site-drawer {
  transform: translateX(0);
}

.site-drawer__inner {
  padding: 110px 42px 42px;
}

.site-drawer__close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 42px;
  line-height: 1;
  cursor: pointer;
}

/* =========================
   Navigation in drawer
========================= */
.site-nav--drawer .site-nav__list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 28px;
}

.site-nav--drawer .site-nav__list a {
  color: #fff;
  font-size: 1.5rem;
  text-decoration: none;
  letter-spacing: 0.06em;
}

.site-nav--drawer .site-nav__list a:hover {
  opacity: 0.75;
}

/* =========================
   Desktop / mobile behavior
========================= */
@media (max-width: 1000px) {
  .site-nav--desktop {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }
}

@media (max-width: 782px) {
  .site-header {
    top: 10px;
    left: 10px;
    right: 10px;
    border-radius: 18px;
  }

  .site-header__inner {
    min-height: 72px;
    padding: 0 14px;
  }

  .site-drawer {
    width: min(360px, 88vw);
  }

  .site-drawer__inner {
    padding: 90px 28px 32px;
  }

  .site-drawer .wp-block-navigation-item__content {
    font-size: 1.2rem;
  }
}

/* =========================
   body lock
========================= */
body.menu-open {
  overflow: hidden;
}

/*ヘッダーの装飾２おわり*/
/*ヘッダーの装飾おわり*/

/* --- 以前からのギミック：ロゴの一回転 --- */
.wp-block-site-logo img {
  transition: transform 0.8s ease-in-out;
}

.wp-block-site-logo img:hover {
  transform: rotate(360deg);
}

/* --- 以前からのギミック：タイトルの非表示 --- */
/* --- タイトルの表示制御：固定ページのみ非表示、投稿は表示 --- */

/* --- タイトルの表示制御：修正版 --- */

/* A. まず、全てのタイトルを表示の基本とする */
.wp-block-post-title {
  display: block !important;
}

/* B. 固定ページ（.page）の「トップにあるメインタイトル」だけを消す */
/* 多くのブロックテーマでは、メインコンテンツ直下のタイトルがこれに該当します */
.page>.is-layout-flow>.wp-block-post-title,
.page>.wp-block-post-title,
.page .wp-block-group>h1.wp-block-post-title {
  display: none !important;
}

/* C. 【重要】クエリーループの中にあるタイトルは、何があっても表示する */
.wp-block-post-template .wp-block-post-title,
.wp-block-query .wp-block-post-title {
  display: block !important;
  visibility: visible !important;
}

/* 3. もしアーカイブページ（一覧）のタイトルも消したい場合は以下を追加（お好みで） */
/* .archive .wp-block-post-title { display: none !important; } */

/* --- 新機能：沿革史ナビゲーションのデザイン --- */
.custom-post-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 20px;
  margin: 60px 0;
  padding-top: 30px;
  border-top: 1px solid #e0e0e0;
}

.nav-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: #f8f9fa;
  border: 1px solid #eee;
  text-decoration: none !important;
  transition: all 0.2s ease;
  color: #333 !important;
}

.nav-box:hover {
  background: #ffffff;
  border-color: #000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.nav-arrow {
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 8px;
}

.nav-title {
  font-weight: 600;
  line-height: 1.4;
}

.nav-box.next {
  text-align: right;
}

.nav-index-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  font-size: 0.85rem;
  background: #eee;
  color: #333;
  text-decoration: none;
  border-radius: 4px;
  white-space: nowrap;
}

.nav-index-btn:hover {
  background: #333;
  color: #fff;
}

.nav-box.empty {
  border: none;
  background: transparent;
  pointer-events: none;
}

/* スマホ対応 */
@media (max-width: 600px) {
  .custom-post-nav {
    flex-direction: column;
  }

  .nav-index-btn {
    order: -1;
    padding: 12px;
  }
}

/* 本棚のデザイン */
.nishijin-bookshelf {
  --paper: #f5efe5;
  --paper-strong: #efe4d2;
  --ink: #241912;
  --muted: #6f5d4f;
  --wood-1: #7a5633;
  --wood-2: #5e3e21;
  --line: rgba(36, 25, 18, 0.12);
  --shadow: 0 24px 50px rgba(36, 25, 18, 0.12);
  margin: clamp(2rem, 5vw, 4rem) auto;
  padding: clamp(1.25rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(215, 176, 122, 0.18), transparent 22rem),
    linear-gradient(180deg, #faf6ef 0%, var(--paper) 100%);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.nishijin-bookshelf__intro {
  max-width: 52rem;
  margin-bottom: 1.5rem;
}

.nishijin-bookshelf__eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.nishijin-bookshelf h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1.15;
}

.nishijin-bookshelf__lead {
  margin: 0.85rem 0 0;
  max-width: 48rem;
  line-height: 1.9;
  color: var(--muted);
}

.nishijin-bookshelf__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1.5rem 0 1.25rem;
}

.nishijin-bookshelf__filter {
  appearance: none;
  border: 1px solid rgba(36, 25, 18, 0.14);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.nishijin-bookshelf__filter:hover,
.nishijin-bookshelf__filter:focus-visible {
  transform: translateY(-1px);
  background: #fff;
  border-color: rgba(36, 25, 18, 0.28);
}

.nishijin-bookshelf__filter.is-active {
  background: #241912;
  color: #fffaf3;
  border-color: #241912;
}

.nishijin-bookshelf__shelf {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: clamp(0.7rem, 1.4vw, 1rem);
  overflow-x: auto;
  padding: 2rem 1rem 1.5rem;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0) 40%),
    linear-gradient(180deg, #8c633a 0%, #6b4726 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  scrollbar-width: thin;
}

.nishijin-bookshelf__shelf::after {
  content: "";
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.75rem;
  height: 0.9rem;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--wood-1) 0%, var(--wood-2) 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
}

.archive-book {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  transition: transform 0.24s ease;
}

.archive-book[hidden] {
  display: none !important;
}

.archive-book__spine {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width: clamp(78px, 10vw, 110px);
  min-height: var(--book-height, 18rem);
  padding: 0.9rem 0.55rem 1rem;
  border-radius: 14px 14px 10px 10px;
  text-decoration: none;
  color: #fff8ef;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 18%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0, rgba(255, 255, 255, 0.08) 4px, rgba(0, 0, 0, 0.16) 4px, rgba(0, 0, 0, 0.04) 9px, transparent 9px),
    var(--book-color, #5c3b24);
  box-shadow:
    0 16px 26px rgba(0, 0, 0, 0.16),
    inset -6px 0 10px rgba(0, 0, 0, 0.18);
  isolation: isolate;
  transition: transform 0.24s ease, box-shadow 0.24s ease;
}

.archive-book__spine::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 12px;
  width: 3px;
  border-radius: 999px;
  background: var(--book-accent, rgba(255, 255, 255, 0.6));
  opacity: 0.9;
}

.archive-book__spine::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.archive-book__label,
.archive-book__index {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.92;
}

.archive-book__title {
  position: relative;
  z-index: 1;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  line-height: 1.3;
  letter-spacing: 0.08em;
  font-weight: 700;
  min-height: 11rem;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

@media (hover: hover) {
  .archive-book:hover {
    transform: translateY(-10px);
  }

  .archive-book:hover .archive-book__spine {
    transform: translateZ(0) scale(1.02);
    box-shadow:
      0 24px 34px rgba(0, 0, 0, 0.2),
      inset -6px 0 10px rgba(0, 0, 0, 0.18);
  }
}

.archive-book.is-active {
  transform: translateY(-12px);
}

.archive-book.is-active .archive-book__spine {
  box-shadow:
    0 28px 36px rgba(0, 0, 0, 0.22),
    inset -6px 0 10px rgba(0, 0, 0, 0.18);
  outline: 2px solid rgba(255, 248, 239, 0.45);
  outline-offset: 2px;
}

.archive-book__spine:focus-visible {
  outline: 3px solid rgba(255, 248, 239, 0.9);
  outline-offset: 4px;
}

.nishijin-bookshelf__note {
  margin: 1rem 0 1.4rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.archive-preview {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
  padding: clamp(1rem, 3vw, 2rem);
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 252, 247, 0.95) 100%);
  box-shadow: 0 12px 32px rgba(36, 25, 18, 0.08);
}

.archive-preview__media {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 18px;
  background: var(--paper-strong);
}

.archive-preview__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.archive-preview__status {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.archive-preview__title {
  margin: 0;
  font-size: clamp(1.4rem, 2.2vw, 2.1rem);
  line-height: 1.2;
}

.archive-preview__meta {
  margin: 0.7rem 0 0;
  color: var(--muted);
}

.archive-preview__summary {
  margin: 1rem 0 0;
  line-height: 1.9;
}

.archive-preview__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.2rem;
  padding: 0.85rem 1.2rem;
  border-radius: 999px;
  background: #241912;
  color: #fffaf3;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.archive-preview__link:hover,
.archive-preview__link:focus-visible {
  transform: translateY(-1px);
  opacity: 0.92;
}

@media (max-width: 781px) {
  .nishijin-bookshelf {
    padding: 1.15rem;
    border-radius: 22px;
  }

  .nishijin-bookshelf__shelf {
    padding: 1.5rem 0.8rem 1.2rem;
  }

  .archive-book__spine {
    width: 86px;
    min-height: 15rem;
  }

  .archive-book__title {
    min-height: 9.5rem;
    font-size: 0.95rem;
  }

  .archive-preview {
    grid-template-columns: 1fr;
  }

  .archive-preview__media {
    max-width: 360px;
    width: 100%;
    margin: 0 auto;
  }
}

@media (prefers-reduced-motion: reduce) {

  .nishijin-bookshelf__filter,
  .archive-book,
  .archive-book__spine,
  .archive-preview__link {
    transition: none;
  }

  .archive-book:hover,
  .archive-book.is-active {
    transform: none;
  }
}