@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@400;700&display=swap');

:root {
  --bg-color: #fdf6e3;
  --paper-color: #fffef8;
  --line-color: #d4c9a8;
  --text-color: #4a3728;
  --accent: #e07b54;
  --accent-light: #f5c5a3;
  --shadow: rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Zen Maru Gothic', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  padding: 0 0 60px;
}

/* ===== ヘッダー ===== */
.site-header {
  background-color: var(--accent);
  color: #fff;
  text-align: center;
  padding: 20px 16px 16px;
  box-shadow: 0 3px 8px var(--shadow);
  margin-bottom: 32px;
}

.site-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.site-header p {
  font-size: 0.9rem;
  margin-top: 4px;
  opacity: 0.9;
}

/* ===== サイトナビゲーション ===== */
.site-nav {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.site-nav a {
  color: #fff;
  text-decoration: none;
  font-size: 0.88rem;
  padding: 4px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition: background 0.15s;
}

.site-nav a:hover,
.site-nav a.active {
  background: rgba(255, 255, 255, 0.25);
}

/* ===== コンテナ ===== */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== 日記一覧グリッド ===== */
.diary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

.diary-card {
  background: var(--paper-color);
  border-radius: 8px;
  box-shadow: 3px 4px 12px var(--shadow);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s, box-shadow 0.18s;
  border: 1px solid var(--line-color);
}

.diary-card:hover {
  transform: translateY(-4px);
  box-shadow: 5px 8px 20px var(--shadow);
}

.diary-card__thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;   /* 長辺に合わせて全体表示 */
  display: block;
  background: var(--accent-light);
}

.diary-card__body {
  padding: 12px 14px 16px;
}

.diary-card__date {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.diary-card__title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

.diary-card__weather {
  font-size: 0.8rem;
  margin-top: 6px;
  opacity: 0.7;
}

/* ===== 日記詳細ページ ===== */
.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}

.diary-page {
  background: var(--paper-color);
  border-radius: 10px;
  box-shadow: 4px 6px 18px var(--shadow);
  border: 1px solid var(--line-color);
  overflow: hidden;
}

.diary-page__header {
  background: var(--accent);
  color: #fff;
  padding: 18px 24px;
}

.diary-page__date {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 4px;
}

.diary-page__title {
  font-size: 1.4rem;
  font-weight: 700;
}

.diary-page__weather {
  font-size: 0.85rem;
  margin-top: 6px;
  opacity: 0.85;
}

/* 左写真・右テキストの2カラム */
.diary-page__body {
  display: flex;
  align-items: flex-start;
}

.diary-page__image {
  width: 50%;
  flex-shrink: 0;
  object-fit: contain;   /* 長辺に合わせて全体表示 */
  display: block;
  background: var(--accent-light);
  max-height: 520px;
  align-self: stretch;   /* 高さを本文エリアに合わせる */
}

/* テキスト＋署名を束ねるラッパー（罫線はここに） */
.diary-page__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-image: repeating-linear-gradient(
    transparent,
    transparent 31px,
    var(--line-color) 31px,
    var(--line-color) 32px
  );
  background-size: 100% 32px;
  background-position-y: 32px; /* padding-top 分オフセット */
}

.diary-page__text {
  flex: 1;
  padding: 32px 28px 0;
  font-size: 1rem;
  line-height: 32px;
  white-space: pre-wrap;
  word-break: break-all;
}

.diary-page__author {
  padding: 0 28px 32px;
  line-height: 32px;
  text-align: right;
  font-size: 1rem;
}

/* ===== 人物紹介 ===== */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 32px;
  max-width: 720px;
  margin: 0 auto;
}

.character-card {
  background: var(--paper-color);
  border-radius: 10px;
  box-shadow: 3px 4px 12px var(--shadow);
  border: 1px solid var(--line-color);
  overflow: hidden;
  text-align: center;
}

.character-card__photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  display: block;
  background: var(--accent-light);
}

.character-card__body {
  padding: 16px 20px 28px;
}

.character-card__role {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 2px 14px;
  margin-bottom: 10px;
  letter-spacing: 0.12em;
}

.character-card__name {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  margin-bottom: 14px;
}

.character-card__desc {
  font-size: 0.9rem;
  line-height: 1.9;
  text-align: left;
}

/* ===== フッター ===== */
.site-footer {
  text-align: center;
  padding: 28px 16px 16px;
  font-size: 0.78rem;
  opacity: 0.5;
  letter-spacing: 0.05em;
}

/* ===== ローディング / エラー ===== */
.loading,
.error-msg {
  text-align: center;
  padding: 48px 0;
  font-size: 1rem;
  opacity: 0.6;
}

/* ===== レスポンシブ ===== */
@media (max-width: 640px) {
  .site-header h1 {
    font-size: 1.5rem;
  }

  .diary-grid {
    grid-template-columns: 1fr;
  }

  /* スマホは上写真・下テキストに切り替え */
  .diary-page__body {
    flex-direction: column;
  }

  .diary-page__image {
    width: 100%;
    max-height: 280px;
    align-self: auto;
  }

  .diary-page__content {
    background-position-y: 32px;
  }

  .diary-page__text {
    padding: 32px 16px 0;
  }

  .diary-page__author {
    padding: 0 16px 32px;
  }
}
