/*
Theme Name: kachicollect
Theme URI: https://kachicollect.com/blog/
Author: kachicollect
Description: kachicollect.com/blog 用のテーマ。ショップ（kachishop）と同じロゴ・配色・カードの見た目に揃える。Polylang の言語切替に対応。
Version: 1.0.0
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kachicollect
*/

/* ---- トークン（apps/web/src/app/globals.css と揃える） ---- */
:root {
  --bg: #fafafa;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --card: #ffffff;
  --accent: #1e3ba8;
  --accent-2: #3b5bdb;
  --accent-weak: #dfe6f9;
  --warn: #b45309;
  --display: "Jost", "Futura", "Avenir Next", "Century Gothic", "Trebuchet MS", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Noto Sans Thai", "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
  --shadow-hover: 0 8px 24px rgba(16, 24, 40, 0.10);
  --wrap: 1080px;
  --measure: 700px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--body); font-size: 16px; line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---- ヘッダー ---- */
.site-header { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand-block { display: flex; flex-direction: column; gap: 0; min-width: 0; margin-right: auto; }
.brand {
  font-family: var(--display); font-size: 20px; font-weight: 600; letter-spacing: 0.18em;
  text-transform: lowercase; color: var(--accent); line-height: 1.2; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .blog { color: var(--muted); font-weight: 400; letter-spacing: 0.14em; }
.tagline { font-size: 12px; color: var(--muted); }
.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav a {
  font-size: 14px; font-weight: 600; color: var(--fg); padding: 8px 12px; border-radius: 999px;
}
.site-nav a:hover { background: var(--accent-weak); color: var(--accent); text-decoration: none; }
.site-nav a.shop-link { background: var(--accent); color: #fff; }
.site-nav a.shop-link:hover { background: var(--accent-2); }
.lang-switch { position: relative; }
.lang-switch select {
  appearance: none; -webkit-appearance: none; font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 28px 7px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--card) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.5'/></svg>") no-repeat right 11px center;
  color: var(--fg); cursor: pointer;
}

/* ---- ヒーロー（ブログトップ） ---- */
.blog-hero {
  margin: 20px 0 24px; padding: 32px 28px; border-radius: 16px; color: #fff;
  background: linear-gradient(115deg, #1e3ba8, #3b5bdb 70%, #5b7cf0);
  display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 20px; align-items: center; overflow: hidden; position: relative;
}
.blog-hero .kicker { font-family: var(--display); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.85; margin: 0 0 8px; }
.blog-hero h1 { font-family: var(--display); font-size: 34px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 10px; }
.blog-hero p { margin: 0 0 16px; font-size: 16px; line-height: 1.55; max-width: 52ch; opacity: 0.95; }
.blog-hero .hero-cta { display: inline-block; background: #fff; color: var(--accent); font-weight: 700; padding: 11px 22px; border-radius: 8px; }
.blog-hero .hero-cta:hover { text-decoration: none; background: var(--accent-weak); }
.hero-tiles { position: relative; height: 180px; }
.hero-tiles img {
  position: absolute; width: 130px; height: 130px; object-fit: cover; background: #fff; border-radius: 14px; padding: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.hero-tiles img:nth-child(1) { left: 6%; top: 12%; transform: rotate(-6deg); }
.hero-tiles img:nth-child(2) { left: 48%; top: 0; transform: rotate(5deg); }
.hero-tiles img:nth-child(3) { left: 32%; top: 48%; transform: rotate(-3deg); }

/* ---- セクション見出し ---- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-head h2 { font-family: var(--display); font-size: 20px; font-weight: 600; }
.section-head .more { font-size: 14px; font-weight: 600; }
.archive-title { font-family: var(--display); font-size: 26px; font-weight: 600; margin: 28px 0 4px; }
.archive-desc { color: var(--muted); margin: 0 0 12px; }

/* ---- カード ---- */
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.post-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: box-shadow 0.15s ease, transform 0.15s ease; display: flex; flex-direction: column; min-width: 0;
}
.post-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.post-card a.thumb { display: block; aspect-ratio: 16 / 10; background: var(--accent-weak); overflow: hidden; }
.post-card a.thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card .thumb-empty { display: flex; align-items: center; justify-content: center; height: 100%; font-family: var(--display); color: var(--accent); letter-spacing: 0.18em; font-size: 14px; }
.post-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.post-card .cat { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; }
.post-card h3 { font-size: 17px; font-weight: 700; line-height: 1.35; }
.post-card h3 a { color: var(--fg); }
.post-card h3 a:hover { color: var(--accent); text-decoration: none; }
.post-card .excerpt { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .meta { margin-top: auto; padding-top: 6px; font-size: 12.5px; color: var(--muted); }
/* 最新 1 件は横長カード（写真左・本文右）で全幅 */
.card-grid .post-card.featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.1fr 1fr; }
.card-grid .post-card.featured a.thumb { aspect-ratio: auto; height: 100%; min-height: 260px; }
.card-grid .post-card.featured .body { padding: 22px 24px; justify-content: center; }
.card-grid .post-card.featured h3 { font-size: 24px; }
.card-grid .post-card.featured .excerpt { font-size: 15px; -webkit-line-clamp: 4; }

/* ---- ページネーション ---- */
.pagination { display: flex; justify-content: center; gap: 6px; margin: 28px 0; flex-wrap: wrap; }
.pagination .page-numbers { padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); font-weight: 600; font-size: 14px; color: var(--fg); }
.pagination .page-numbers.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a.page-numbers:hover { background: var(--accent-weak); text-decoration: none; }

/* ---- 記事 ---- */
.article { max-width: var(--measure); margin: 0 auto; padding-top: 28px; }
.article .cat { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; }
.article h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.015em; margin: 8px 0 12px; line-height: 1.2; }
.article .meta { color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 20px; }
.article .lead-image { border-radius: 16px; overflow: hidden; margin: 0 0 24px; border: 1px solid var(--border); background: var(--card); }
.article .lead-image img { width: 100%; }
.article-body { font-size: 17px; line-height: 1.8; }
.article-body > * { margin-top: 0; margin-bottom: 1.2em; }
.article-body h2 { font-size: 24px; font-weight: 800; margin-top: 2em; padding-top: 0.2em; }
.article-body h3 { font-size: 19px; font-weight: 700; margin-top: 1.6em; }
.article-body img, .article-body figure { border-radius: 12px; }
.article-body figure { margin-left: 0; margin-right: 0; }
.article-body figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 6px; }
.article-body blockquote { margin: 1.4em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); color: #374151; }
.article-body ul, .article-body ol { padding-left: 1.4em; }
.article-body li { margin: 0.3em 0; }
.article-body table { border-collapse: collapse; width: 100%; font-size: 15px; }
.article-body th, .article-body td { border-bottom: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.article-body th { color: var(--muted); font-weight: 600; font-size: 13px; }
.article-body .wp-block-table { overflow-x: auto; }
.article-body pre { background: #f3f4f6; padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: 14px; }
.article-body code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 0.92em; }
.article-body a { text-decoration: underline; text-underline-offset: 2px; }
.article-body .wp-block-button__link { background: var(--accent); color: #fff; border-radius: 8px; padding: 12px 24px; font-weight: 700; text-decoration: none; }
.article-body .wp-block-image.alignwide, .article-body .alignwide { max-width: none; width: calc(100% + 120px); margin-left: -60px; }
.article-body .has-accent-color { color: var(--accent); }
.article-body .has-accent-background-color { background: var(--accent); }
.article-body .has-accent-weak-background-color { background: var(--accent-weak); }
.article-body .has-muted-color { color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 28px 0 0; }
.tags a { font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--accent-weak); color: var(--accent); }
.tags a:hover { text-decoration: none; background: #c9d5f5; }

/* ---- ショップへの導線 ---- */
.shop-cta {
  margin: 36px 0 0; padding: 22px 22px; border-radius: 16px; color: #fff;
  background: linear-gradient(115deg, #1e3ba8, #3b5bdb);
}
.shop-cta .kicker { font-family: var(--display); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.85; margin: 0 0 4px; }
.shop-cta h2 { font-family: var(--display); font-size: 22px; font-weight: 600; margin: 0 0 6px; }
.shop-cta p { margin: 0 0 14px; opacity: 0.95; font-size: 15px; }
.shop-cta .cats { display: flex; flex-wrap: wrap; gap: 8px; }
.shop-cta .cats a { background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.35); color: #fff; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.shop-cta .cats a:hover { background: #fff; color: var(--accent); text-decoration: none; }
.shop-cta .cats a.primary { background: #fff; color: var(--accent); }

/* ---- 前後・関連 ---- */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 28px 0 0; }
.post-nav a { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--fg); }
.post-nav a:hover { border-color: var(--accent); text-decoration: none; }
.post-nav .lab { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.post-nav .next { text-align: right; }
.related { max-width: var(--wrap); margin: 40px auto 0; }

/* ---- ページ（固定ページ） ---- */
.page-content { max-width: var(--measure); margin: 0 auto; padding-top: 28px; }
.page-content h1 { font-size: 30px; font-weight: 800; margin-bottom: 16px; }

/* ---- 404 / 検索 ---- */
.notice-box { max-width: 560px; margin: 60px auto; text-align: center; }
.notice-box h1 { font-family: var(--display); font-size: 28px; font-weight: 600; margin-bottom: 8px; }
.notice-box p { color: var(--muted); }
.search-form { display: flex; gap: 8px; max-width: 480px; margin: 16px auto 0; }
.search-form input[type="search"] { flex: 1; font: inherit; padding: 10px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); }
.search-form button { font: inherit; font-weight: 700; padding: 10px 18px; border: none; border-radius: 999px; background: var(--accent); color: #fff; cursor: pointer; }

/* ---- フッター ---- */
.site-footer { margin-top: 56px; border-top: 1px solid var(--border); background: var(--card); }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 24px; padding: 32px 20px; }
.site-footer h4 { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.site-footer a { color: var(--fg); font-size: 14px; }
.site-footer .about { font-size: 14px; color: var(--muted); max-width: 40ch; margin: 6px 0 0; }
.site-footer .legal { border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.site-footer .legal .wrap { display: flex; justify-content: space-between; gap: 12px; padding: 14px 20px; flex-wrap: wrap; }

/* ---- レスポンシブ ---- */
@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blog-hero { grid-template-columns: 1fr; padding: 26px 22px; }
  .hero-tiles { display: none; }
  .site-footer .wrap { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .card-grid .post-card.featured { display: flex; }
  .card-grid .post-card.featured a.thumb { aspect-ratio: 16 / 10; height: auto; min-height: 0; }
  .card-grid .post-card.featured .body { padding: 14px 16px 16px; }
  .card-grid .post-card.featured h3 { font-size: 18px; }
  .blog-hero h1 { font-size: 26px; }
  .article h1 { font-size: 26px; }
  .article-body { font-size: 16px; }
  .article-body .alignwide { width: 100%; margin-left: 0; }
  .site-header .wrap { gap: 10px; }
  .tagline { display: none; }
  .site-nav a:not(.shop-link) { display: none; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
  .site-footer .wrap { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .post-card { transition: none; }
}
