/* ===== まゆねこ日記 =====
   SNSスタイル（全文フィード）＋フッター固定
   S_Diary のカラーパレットを踏襲 */

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

/* 色は CMS の「色を変える」から設定できる。
   index.html の <head> 内で上書きされるので、ここは初期値。 */
:root {
  --bg: #f5e8e8;          /* 背景（テーマカラー） */
  --card: #ffffff;        /* 記事カードの色 */
  --accent: #e8a0a0;      /* アクセント */
  --accent-dark: #c87878; /* accent から自動生成 */
  --accent-hover: #e0c8c8;/* accent から自動生成 */
  --border: #e0d0d0;      /* bg から自動生成 */
  --text: #323232;
  --subtext: #888888;
  --font-size: 16px;
  --line-height: 1.9;
  --font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  --maxw: 680px;
  --footer-h: 68px;   /* 固定フッターの高さ */
  --line-green: #06c755;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: var(--font-size);
  line-height: var(--line-height);
  font-family: var(--font-family);
  -webkit-text-size-adjust: 100%;
  /* 固定フッターに隠れないよう下に余白（iPhoneのホームバー分も加算） */
  padding-bottom: calc(var(--footer-h) + env(safe-area-inset-bottom, 0px));
}

a { color: var(--accent-dark); }

/* ===== ヘッダー ===== */
.site-header {
  background: var(--bg);
  padding: 26px 20px 18px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
/* h1 に社名テキストを持たせる（ロゴ画像のときは alt が中身になる） */
.site-header h1 { margin: 0; font-size: 1.55em; line-height: 1.3; }
.site-title {
  font-size: inherit;
  font-weight: bold;
  letter-spacing: 0.08em;
  color: var(--text);
  text-decoration: none;
  display: inline-block;
}
.site-title:hover { color: var(--accent-dark); }

/* ロゴ画像を入れた場合。--logo-h で高さを調整できる */
.site-logo {
  display: block;
  height: var(--logo-h, 70px);
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}
.site-tagline {
  font-size: 0.85em;
  color: var(--subtext);
  margin-top: 6px;
  letter-spacing: 0.05em;
}

/* ===== フィード本体 ===== */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 16px 40px;
}

/* 1記事＝1カード。全文をそのまま表示する
   背景とカードが同じ色（白×白など）でも区切りが見えるよう、細い線を引く */
.post {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 22px 26px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.post .date {
  font-size: 0.78em;
  color: var(--subtext);
  letter-spacing: 0.05em;
}

.post h2 {
  font-size: 1.22em;
  line-height: 1.55;
  margin: 5px 0 16px;
}

/* ===== 記事内の要素 ===== */
.post p { margin-bottom: 18px; }
.post p:last-child { margin-bottom: 0; }

/* 見出し（記事内の小見出し） */
.post h3 {
  font-size: 1.05em;
  margin: 28px 0 12px;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
}

/* 画像：1枚 */
.post img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 6px 0 20px;
  background: var(--bg);
}

/* 画像：横並び（2枚以上を並べたいとき） */
.img-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 6px 0 20px;
}
.img-row img { margin: 0; }

/* 画像キャプション */
.caption {
  font-size: 0.78em;
  color: var(--subtext);
  text-align: center;
  margin: -14px 0 20px;
  line-height: 1.6;
}

/* リスト */
.post ul, .post ol { margin: 0 0 18px 1.4em; }
.post li { margin-bottom: 6px; }

/* 引用 */
.post blockquote {
  border-left: 4px solid var(--accent-hover);
  background: var(--tint, #fafafa);
  padding: 12px 16px;
  margin: 0 0 18px;
  color: var(--subtext);
  font-size: 0.95em;
  border-radius: 0 8px 8px 0;
}

/* 記事内リンク（本文中のテキストリンク） */
.post a {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.post a:hover { color: var(--accent); }

/* リンクカード（商品ページなどへの大きめリンク） */
.link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--tint, #fafafa);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0 0 20px;
  text-decoration: none !important;
  color: var(--text) !important;
  transition: background 0.15s, border-color 0.15s;
}
.link-card:hover { background: var(--bg); border-color: var(--accent-hover); }
.link-card img {
  width: 64px; height: 64px;
  border-radius: 8px;
  object-fit: cover;
  margin: 0;
  flex-shrink: 0;
}
.link-card .lc-body { flex: 1; min-width: 0; }
.link-card .lc-title {
  font-size: 0.95em; font-weight: bold;
  line-height: 1.5; margin-bottom: 2px;
}
.link-card .lc-sub {
  font-size: 0.78em; color: var(--subtext); line-height: 1.5;
}

/* ===== カテゴリ切り替えバー ===== */
.cat-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  gap: 7px;
  justify-content: center;
  min-width: max-content;
}
.cat-btn {
  border: 1.5px solid var(--accent-hover);
  background: #fff;
  color: var(--text);
  border-radius: 18px;
  padding: 6px 15px;
  font-size: 0.82em;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cat-btn:hover { background: var(--bg-hover, #f0dada); }
.cat-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: bold;
}
/* カテゴリ別のアクティブ色 */
.cat-btn.active[data-cat="sale"]  { background: #e06a4a; border-color: #e06a4a; }
.cat-btn.active[data-cat="event"] { background: #7a9ec0; border-color: #7a9ec0; }
.cat-btn.active[data-cat="other"] { background: #9aa39c; border-color: #9aa39c; }

/* 件数ゼロのときの表示 */
.no-post {
  text-align: center;
  color: var(--subtext);
  font-size: 0.9em;
  padding: 40px 10px;
}

/* ===== 記事のカテゴリ見出しバッジ ===== */
.cat-label {
  display: inline-block;
  font-size: 0.72em;
  font-weight: bold;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--accent);
  border-radius: 4px;
  padding: 2px 10px;
  margin-bottom: 8px;
  vertical-align: middle;
}
.post[data-cat="sale"]  .cat-label { background: #e06a4a; }
.post[data-cat="event"] .cat-label { background: #7a9ec0; }
.post[data-cat="stock"] .cat-label { background: var(--accent); }
.post[data-cat="other"] .cat-label { background: #9aa39c; }

/* 日付行（バッジと日付を横並びに） */
.meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.meta-row .date { margin: 0; }

/* 終了したイベント：くすませる */
.post.ended { opacity: 0.72; }
.post.ended .cat-label { background: #b0a8a8 !important; }
.badge-ended {
  display: inline-block;
  font-size: 0.72em;
  font-weight: bold;
  color: #fff;
  background: #a09696;
  border-radius: 4px;
  padding: 2px 10px;
}
/* 開催中・まもなく */
.badge-now {
  display: inline-block;
  font-size: 0.72em;
  font-weight: bold;
  color: #fff;
  background: #d9534f;
  border-radius: 4px;
  padding: 2px 10px;
}

/* タグ */
.tags {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 6px;
}
.tag {
  font-size: 0.75em;
  background: var(--tint, var(--bg));
  color: var(--accent-dark);
  border-radius: 12px;
  padding: 3px 12px;
}

/* 記事末尾の購入導線 */
.buy-box {
  background: var(--tint, var(--bg));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 22px 0 0;
  text-align: center;
}
.buy-box .buy-title {
  font-size: 0.88em; font-weight: bold;
  margin-bottom: 12px; letter-spacing: 0.05em;
}
.buy-links {
  display: flex; justify-content: center;
  flex-wrap: wrap; gap: 8px;
}
.buy-links a {
  display: inline-block;
  background: #fff;
  border: 1.5px solid var(--accent-hover);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.85em;
  color: var(--text) !important;
  text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.buy-links a:hover {
  background: var(--accent); border-color: var(--accent); color: #fff !important;
}

/* フィード末尾 */
.feed-end {
  text-align: center;
  font-size: 0.8em;
  color: var(--subtext);
  padding: 10px 0 4px;
}

/* ===== 固定フッター ===== */
.fixed-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.f-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 22px;
  border: 1.5px solid var(--accent-hover);
  background: #fff;
  color: var(--text);
  font-size: 0.85em;
  font-weight: bold;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.f-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
/* LINEボタンだけ緑で目立たせる */
.f-btn.line {
  background: var(--line-green);
  border-color: var(--line-green);
  color: #fff;
}
.f-btn.line:hover { background: #05b34c; border-color: #05b34c; }

/* ===== アイコン版フッター（画像を設定したとき） =====
   4つを正方形のまま横いっぱいに並べる。
   幅は (画面幅 − 左右余白 − 隙間×3) ÷ 4 で自動決定し、
   aspect-ratio:1 で高さを幅に合わせる＝常に正方形。 */
.footer-inner.icons { gap: var(--icon-gap, 8px); }
.footer-inner.icons .f-btn {
  flex: 1 1 0;
  aspect-ratio: 1 / 1;
  height: auto;
  max-width: 96px;          /* PCで大きくなりすぎないよう頭打ち */
  flex-direction: column;
  gap: 3px;
  padding: 7px 4px;
  border-radius: 16px;
  border-color: transparent;
  background: transparent;
  overflow: visible;
}
.footer-inner.icons .f-btn:hover {
  background: var(--bg);
  border-color: var(--accent-hover);
  color: var(--text);
}
.footer-inner.icons .f-btn.line,
.footer-inner.icons .f-btn.line:hover {
  background: transparent;
  border-color: transparent;
  color: var(--text);
}
.footer-inner.icons .f-btn.line:hover {
  background: var(--bg);
  border-color: var(--accent-hover);
}
.f-btn img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  flex: 1;
  min-height: 0;
  transition: transform 0.15s;
}
.f-btn:hover img { transform: scale(1.06); }
/* アイコンの下に出す小さな文字（消すこともできる） */
.f-btn .f-label {
  font-size: 0.66em;
  font-weight: bold;
  line-height: 1.2;
  letter-spacing: 0;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.footer-inner.icons.no-label .f-label { display: none; }

/* ===== スマホ ===== */
@media (max-width: 600px) {
  :root { --font-size: 15px; --footer-h: 64px; }
  .site-header { padding: 20px 16px 14px; }
  .site-header h1 { font-size: 1.32em; }
  .site-logo { height: calc(var(--logo-h, 70px) * 0.82); }
  .post { padding: 20px 17px 22px; border-radius: 12px; }
  .post h2 { font-size: 1.14em; }
  main { padding: 14px 11px 30px; }
  .f-btn { height: 42px; font-size: 0.78em; }
  .footer-inner { gap: 6px; }
  .link-card img { width: 56px; height: 56px; }
}

/* さらに狭い端末：フッターの文字を詰める */
@media (max-width: 380px) {
  .f-btn { font-size: 0.72em; }
}

/* アイコン版フッターは高さが幅で決まるので、その分の余白を確保する */
@media (max-width: 600px) {
  .footer-inner.icons { gap: 6px; }
  .footer-inner.icons .f-btn { padding: 5px 3px; border-radius: 13px; }
  .f-btn .f-label { font-size: 0.62em; }
}
body:has(.footer-inner.icons) {
  padding-bottom: calc(min(96px, (100vw - 42px) / 4) + 22px
                       + env(safe-area-inset-bottom, 0px));
}
