/* === style.css 目次 === */
/*
  Sections:
  1. 全体設定 (variables)
  2. レイアウト / 基本 (body, wrapper, img)
  3. コンポーネント (hero, navbar, cards, slideshow)
  4. ユーティリティ (短い helper クラス)
  5. ページ固有の補助スタイル
*/

/* === 1. 全体設定 === */
:root {
  /* カラーパレット */
  --color-bg: #fcfaf2; /* 生成り色 */
  --color-text: #4a4a4a;
  --color-border: #e0dcd0;
  --accent-dark: #3d4c38; /* 濃い抹茶色 */
  --accent: #6e8e59; /* 明るい緑 */
  --hero-fallback: #556b2f;
  --white: #ffffff;
}

/* === 2. レイアウト / 基本 === */
body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: "Zen Maru Gothic", sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

img {
  max-width: 100%;
  height: auto;
}

/* === 3. コンポーネント === */

/* トップページのメイン画像（レスポンシブ対応） */
.custom-top-img {
  width: 100%;
  max-width: 1100px;
  height: 87vh;
  min-height: 400px;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  user-select: none;
}

/* トップ画像フェードインアニメーション */
.top-image {
  opacity: 0;
  animation: fadeInTopImg 2s ease-in-out forwards;
}

@keyframes fadeInTopImg {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ナビゲーションバー */
.navbar {
  background-color: var(--color-bg) !important; /* 背景色を強制適用 */
  border-bottom: 1px solid var(--color-border) !important;
  padding: 0.6rem 0;
  position: sticky; /* メニューを最前面に固定する設定 */
  top: 0;
  z-index: 9999; /* スライドショーより手前に表示 */
}

.navbar-logo {
  height: 55px; /* メニューの高さに合わせて調整 */
  width: auto;  /* 横幅は自動で調整 */
  margin-right: 10px; /* 文字との間に少し隙間 */
  vertical-align: middle; /* 文字と高さを真ん中に揃える */
  user-select: none;
}

.navbar-brand {
  font-family: "Shippori Mincho", serif;
  font-weight: bold;
  color: var(--color-text);
  font-size: 2rem;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.navbar-brand:hover,
.navbar-brand:focus,
.navbar-brand:active {
  color: var(--color-text);
  text-decoration: none;
}

.nav-link {
  font-family: "Shippori Mincho", serif;
  color: var(--color-text);
  font-weight: 500;
  font-size: 1.1rem;
  text-align: right;
}

.nav-link:hover {
  color: var(--accent) !important;
}

.nav-link[aria-current="page"] {
  color: var(--accent) !important;
  cursor: default;
}

.navbar-brand:focus-visible,
.nav-link:focus-visible,
.btn-primary:focus-visible,
.tag-chip-button:focus-visible,
.pagination-btn:focus-visible,
.stretched-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
  box-shadow: none;
}

.navbar-collapse {
  background-color: var(--color-bg);
}

/* フェードで切り替わるハンバーガーアイコン */
.custom-fade-toggler {
  position: relative;
  width: 34px;  /* タップしやすいように少しだけ枠に余裕 */
  height: 34px;
  background: transparent;
  cursor: pointer;
}

.fade-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 18px;
  transform: translate(-50%, -50%);
  transition: opacity 0.1s ease; /* ふわっとフェードさせる */
}

.toggler-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--accent-dark);
  border-radius: 2px;
}

.icon-menu {
  opacity: 1;
}

.icon-close {
  opacity: 0;
}

.navbar-toggler[aria-expanded="true"] .icon-menu {
  opacity: 0;
}

.navbar-toggler[aria-expanded="true"] .icon-close {
  opacity: 1;
}

/* ボタン */
.btn-primary {
  background-color: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background-color: var(--hero-fallback);
  border-color: var(--hero-fallback);
  box-shadow: none;
}

.btn-primary:active {
  background-color: var(--accent-dark) !important;
  border-color: var(--accent-dark) !important;
  box-shadow: none;
}

.btn-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-border);
  border-radius: 50%;
  background: transparent;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  width: 40px;
  height: 40px;
  padding: 0;
  box-shadow: none;
  user-select: none;
}

.btn-logo:hover,
.btn-logo:focus-visible {
  transform: scale(1.2);
  box-shadow: 0 4px 16px rgba(110, 142, 89, 0.1);
  outline: none;
}

.inline-accent-link {
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.25rem;
  font-size: 1.2rem;
}

.inline-accent-link:hover {
  color: var(--accent) !important;
}

.inline-accent-link:focus-visible {
  color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-color: var(--accent) !important;
  border-radius: 4px;
}

/* === 4. ユーティリティ / ギャラリー === */

.custom-gallery-card {
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
  background-color: var(--white);
  border: 1px solid var(--color-border) !important;
}

.gallery-thumbnail img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 0.5s ease;
  user-select: none;
}

.tag-chip {
  display: inline-block;
  position: relative;
  z-index: 2;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--white);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.22rem 0.45rem;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tag-chip-link {
  flex-shrink: 0;
  line-height: 1;
}

.tag-chip-trigger {
  cursor: pointer;
}

.tag-chip-button {
  font-size: 0.85rem;
  border-radius: 12px;
  padding: 6px 12px;
  margin: 0 6px 6px 0;
  cursor: pointer;
}

.tag-chip.is-active {
  background-color: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

.post-item {
  position: relative;
  z-index: 0;
  border-bottom: none;
  padding: 0;
}

.post-title {
  font-family: "Shippori Mincho", serif;
  font-weight: bold;
  font-size: 1.1rem;
}

.post-tag-list .tag-chip {
  font-size: 0.85rem;
}

.post-tags-display {
  margin-left: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

@media (min-width: 600px) and (max-width: 800px) {
  #blog-posts .col {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

.custom-gallery-card:has(.stretched-link:focus-visible) {
  z-index: 3;
  transform: translateY(-8px);
  background-color: color-mix(in srgb, var(--white) 95%, transparent);
  box-shadow: 0 10px 25px color-mix(in srgb, var(--accent-dark) 10%, transparent) !important;
}

.post-item:has(.stretched-link:focus-visible) {
  z-index: 4;
}

.custom-gallery-card:has(.stretched-link:focus-visible) .gallery-thumbnail img {
  transform: scale(1.05);
}

@media (min-width: 600px) {
  .post-item:has(.custom-gallery-card:hover) {
    z-index: 4;
  }

  .custom-gallery-card:hover {
    z-index: 3;
    transform: translateY(-8px);
    background-color: color-mix(in srgb, var(--white) 95%, transparent);
    box-shadow: 0 10px 25px color-mix(in srgb, var(--accent-dark) 10%, transparent) !important;
  }

  .custom-gallery-card:hover .gallery-thumbnail img {
    transform: scale(1.05);
  }

  .tag-chip:hover {
    background: var(--hero-fallback);
    color: var(--white);
  }
}

.pagination-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: none;
}

.pagination-btn:hover {
  background: color-mix(in srgb, var(--accent-dark) 3%, transparent);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* === 5. コンポーネント / スライドショー === */

@media (max-width: 600px) {
  .custom-top-img {
    height: 85vh; /* スマホの時だけ85vhに縮める */
  }

  .caption-text {
    font-size: 1.1rem; /* スマホ向けに少し大きく */
  }

  /* スマホ向け：ナビゲーションバーを1行に収める調整 */
  .navbar-brand {
    font-size: 1.3rem;
    white-space: nowrap;
    max-width: calc(100% - 65px);
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
  }

  .navbar-logo {
    height: 30px;
    margin-right: 8px;
  }

  .navbar .container-fluid {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
}

@media screen and (max-width: 380px) {
  html {
    font-size: 13px;
  }

  h1,
  .font-shippori {
    font-size: 1.5rem !important;
    letter-spacing: -0.02em;
    line-height: 1.3;
  }
}

/* レスポンシブな写真と文章のレイアウト */
.responsive-section {
  display: flex;
  flex-wrap: nowrap;
  gap: 2rem;
  align-items: flex-start;
}

.responsive-image {
  position: relative;
  flex: 1;
  min-width: 300px;
  order: 1; /* パソコンでは左に表示 */
  aspect-ratio: 16/10; /* アスペクト比固定 */
  overflow: hidden;
}

.responsive-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-width: 800px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.responsive-text {
  flex: 1 1 300px;
  min-width: 0;
  order: 2; /* パソコンでは右に表示 */
}

.responsive-text h3 {
  font-family: 'Shippori Mincho', serif;
  color: var(--accent-dark);
  margin-top: 0;
}

@media (max-width: 991px) {
  .responsive-section {
    flex-direction: column;
  }

  .responsive-image {
    order: 1;
    min-width: auto;
    width: 100%;
    aspect-ratio: 16/10;
  }

  .responsive-text {
    flex: 1 1 auto;
    order: 2;
    min-width: auto;
  }
}

/* ローカルスライドショー（各セクション内） */
.local-slideshow {
  position: relative;
  overflow: hidden;
  display: block;
  width: 100%;
  max-width: 800px; /* allow larger slides on desktop */
  aspect-ratio: 16/10; /* maintain consistent aspect ratio */
  border-radius: 8px;
  user-select: none;
  touch-action: pan-y pinch-zoom;
}

.local-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 1;
  transition: opacity 1500ms ease-in-out;
}

.local-slide.active {
  opacity: 1;
  z-index: 2;
}

.local-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  border-color: var(--color-border);
}

.local-dots {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0.6rem;
  z-index: 3;
}

.local-dots .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.6);
  border: 0;
  border-radius: 50%;
  margin: 0 4px;
  cursor: pointer;
  padding: 0;
}

.local-dots .dot.active {
  background: #fff;
}

.local-slideshow:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.local-dots .dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 480px) {
  .responsive-image {
    aspect-ratio: auto;
    min-height: 250px;
  }

  .local-slideshow {
    max-width: 100%;
    width: 100%;
    aspect-ratio: auto;
    min-height: 250px; /* keep taller on mobile too */
  }

  .local-slideshow .local-slide img {
    object-fit: cover;
  }

  .local-dots .dot {
    width: 10px;
    height: 10px;
    margin: 0 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .top-image {
    opacity: 1;
    animation: none;
  }

  .local-slide {
    transition: none;
  }

  .gallery-thumbnail img,
  .custom-gallery-card,
  .sidebar-post-link,
  .sidebar-post-thumbnail img,
  .btn-logo,
  .fade-icon {
    transition: none;
  }
}

/* footer styles */
footer {
  background-color: var(--color-bg);
  border-top: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  flex-direction: column; /* 縦並び */
  align-items: center;
  gap: 0.5rem; /* 各行の間隔 */
}

.footer-links > div {
  margin: 0.2rem 0;
}

.footer-links a {
  padding: 0.2rem 0.4rem; /* 各リンクに余白を追加 */
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* === 6. 共通ユーティリティ === */

/* 投稿ページ内の複数画像レイアウト */
.post-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  align-items: start;
}

.post-images .photo-item {
  margin: 0;
  max-width: 100%;
}

.sidebar-panel {
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-post-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-post-link {
  background: var(--white);
  border: 1px solid var(--color-border);
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.sidebar-post-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-post-thumbnail img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}

.sidebar-post-body {
  padding: 0.6rem 0.65rem;
}

.sidebar-post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-post-meta {
  font-size: 0.8rem;
}

.tag-chip-link:focus-visible {
  color: var(--white);
  background: var(--accent);
  outline: none;
}

.sidebar-post-body h3 {
  font-size: 1.1rem;
  line-height: 1.35;
  line-clamp: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.sidebar-post-body p {
  font-size: 0.85rem;
  line-height: 1.5;
  line-clamp: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.sidebar-post-link:has(.stretched-link:focus-visible) .sidebar-post-thumbnail img {
  transform: scale(1.07);
}

.sidebar-post-link:has(.stretched-link:focus-visible) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

@media (min-width: 600px) {
  .sidebar-post-link:hover
  {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  }

  .sidebar-post-link:hover .sidebar-post-thumbnail img {
    transform: scale(1.07);
  }
}

.sidebar-panel-actions {
  margin-top: auto;
  padding-top: 0.25rem;
}

@media (max-width: 991px) {
  .index-sidebar-column {
    margin-top: 1.5rem;
  }
}

.max-width-1400 {
  max-width: 1400px;
}

.max-width-1200 {
  max-width: 1200px;
}

.font-shippori {
  font-family: 'Shippori Mincho', serif;
}

.color-accent-dark {
  color: var(--accent-dark) !important;
}

.border-color-default {
  border-color: var(--color-border) !important;
}

.bg-accent-soft {
  background-color: color-mix(in srgb, var(--accent) 5%, transparent 20%);
}

.photo-item {
  max-width: 700px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  user-select: none;
  display: block;
  margin: 1rem auto 1.5rem auto;
  border: 1px solid var(--color-border);
}