/* ================================================
   Japanese Traditional Crafts — Shared Stylesheet
   CSS Variables: change --primary / --accent per site
   ================================================ */

:root {
  --primary:    #8B4513;   /* Saddle Brown — craft earthy tone */
  --accent:     #D4A017;   /* Gold — traditional Japanese */
  --bg:         #FAF7F2;
  --surface:    #FFFFFF;
  --text:       #1A1A1A;
  --text-muted: #666666;
  --border:     #E0D8CC;
  --radius:     8px;
  --max-width:  1100px;
  --font-body:  'Inter', 'Noto Sans', system-ui, sans-serif;
  --font-jp:    'Noto Sans JP', 'Hiragino Kaku Gothic Pro', sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.7; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ── Layout ── */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* ── Header ── */
.site-header {
  background: var(--primary);
  color: #fff;
  padding: 14px 0;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.site-logo { font-size: 1.2rem; font-weight: 700; color: #fff; letter-spacing: .02em; }
.site-logo:hover { text-decoration: none; opacity: .9; }
.site-logo span { color: var(--accent); }

.header-search { display: flex; gap: 6px; }
.header-search input {
  padding: 7px 12px; border: none; border-radius: 4px;
  font-size: .9rem; width: 220px;
  background: rgba(255,255,255,.15); color: #fff;
}
.header-search input::placeholder { color: rgba(255,255,255,.65); }
.header-search input:focus { outline: 2px solid var(--accent); background: rgba(255,255,255,.25); }
.header-search button {
  padding: 7px 14px; background: var(--accent); color: #1a1a1a;
  border: none; border-radius: 4px; cursor: pointer; font-weight: 600; font-size: .85rem;
}
.header-search button:hover { filter: brightness(1.1); }

/* ── Breadcrumb ── */
.breadcrumb { padding: 10px 0; font-size: .82rem; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 6px; }

/* ── Hero (index only) ── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #5a2d0c 100%);
  color: #fff; text-align: center; padding: 56px 20px 48px;
}
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.6rem); font-weight: 800; margin-bottom: 12px; }
.hero p  { font-size: 1.05rem; opacity: .88; max-width: 560px; margin: 0 auto 24px; }
.hero-stats { display: flex; justify-content: center; gap: 32px; flex-wrap: wrap; }
.hero-stats .stat { text-align: center; }
.hero-stats .stat-num { font-size: 1.8rem; font-weight: 800; color: var(--accent); display: block; }
.hero-stats .stat-lbl { font-size: .78rem; opacity: .8; text-transform: uppercase; letter-spacing: .07em; }

/* ── Filter bar ── */
.filter-bar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 0; }
.filter-bar .container { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-btn {
  padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text-muted); cursor: pointer;
  font-size: .82rem; font-weight: 500; transition: all .15s;
}
.filter-btn:hover, .filter-btn.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.filter-label { font-size: .8rem; color: var(--text-muted); font-weight: 600; margin-right: 4px; }

/* ── Results count ── */
.results-meta { padding: 14px 0 4px; font-size: .85rem; color: var(--text-muted); }
.results-meta strong { color: var(--text); }

/* ── Card Grid ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  padding: 20px 0 40px;
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.card-body { padding: 16px; flex: 1; }
.card-category {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--primary); font-weight: 700; margin-bottom: 6px;
}
.card-title { font-size: 1rem; font-weight: 700; margin-bottom: 4px; line-height: 1.35; }
.card-jp    { font-family: var(--font-jp); font-size: .82rem; color: var(--text-muted); margin-bottom: 8px; }
.card-pref  { font-size: .78rem; color: var(--text-muted); }
.card-desc  { font-size: .84rem; color: #444; margin-top: 8px; line-height: 1.55;
              display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* ── Card image ── */
.card-img-link { display: block; }
.card-img { width: 100%; aspect-ratio: 16/9; overflow: hidden; background: var(--border); }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.card:hover .card-img img { transform: scale(1.04); }

/* ── Card title link ── */
.card-title-link { text-decoration: none; color: inherit; display: block; }
.card-title-link:hover .card-title { color: var(--primary); text-decoration: underline; }

.card-footer { padding: 10px 16px; border-top: 1px solid var(--border); }
.card-link {
  font-size: .82rem; font-weight: 600; color: var(--primary);
  display: flex; align-items: center; gap: 4px;
}
.card-link::after { content: '→'; }

/* ── Detail page ── */
.detail-layout {
  display: grid; grid-template-columns: 1fr 320px; gap: 32px;
  padding: 32px 0 60px; align-items: start;
}
@media (max-width: 768px) { .detail-layout { grid-template-columns: 1fr; } }

.detail-main h1 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 800; margin-bottom: 6px; }
.detail-jp { font-family: var(--font-jp); font-size: 1.1rem; color: var(--text-muted); margin-bottom: 20px; }
.detail-badge {
  display: inline-block; background: var(--primary); color: #fff;
  font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 12px; margin-bottom: 16px;
}
/* ── Detail image ── */
.detail-img { margin-bottom: 24px; border-radius: var(--radius); overflow: hidden; }
.detail-img img { width: 100%; max-height: 420px; object-fit: cover; display: block; }
.detail-img-credit { font-size: .72rem; color: var(--text-muted); margin-top: 4px; text-align: right; }
.detail-img-credit a { color: var(--text-muted); }

.detail-description { font-size: 1rem; line-height: 1.8; color: #333; margin-bottom: 24px; }

.detail-meta-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.detail-meta-table th {
  text-align: left; padding: 10px 14px; background: var(--bg);
  color: var(--text-muted); font-weight: 600; width: 38%;
  border-bottom: 1px solid var(--border);
}
.detail-meta-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-family: var(--font-jp);
}

/* ── Sidebar ── */
.sidebar-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.sidebar-card h3 { font-size: .9rem; font-weight: 700; margin-bottom: 12px;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.related-list li { margin-bottom: 8px; }
.related-list a { font-size: .88rem; font-weight: 600; }
.related-list .related-jp { font-family: var(--font-jp); font-size: .78rem; color: var(--text-muted); }

/* ── Ad placeholder ── */
.ad-unit { text-align: center; padding: 20px 0; min-height: 90px; }

/* ── Category page ── */
.category-header { padding: 32px 0 20px; }
.category-header h1 { font-size: 1.8rem; font-weight: 800; }
.category-header p  { color: var(--text-muted); margin-top: 6px; }
.category-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; padding: 16px 0 48px;
}
.cat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; text-align: center;
  transition: all .15s; cursor: pointer;
}
.cat-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.cat-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.cat-card .count { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.cat-card .count-lbl { font-size: .75rem; color: var(--text-muted); }

/* ── Footer ── */
.site-footer {
  background: #1a1a1a; color: #aaa; padding: 32px 20px;
  font-size: .82rem; text-align: center; margin-top: 40px;
}
.site-footer a { color: #ccc; }
.site-footer p + p { margin-top: 6px; }

/* ── No results ── */
.no-results { text-align: center; padding: 48px 20px; color: var(--text-muted); font-size: 1rem; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .header-search input { width: 140px; }
  .hero { padding: 36px 16px 32px; }
  .hero-stats { gap: 20px; }
  .card-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}
@media (max-width: 420px) {
  .card-grid { grid-template-columns: 1fr; }
}

/* ── Card image placeholder (no external image) ── */
.card-img-ph {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ph-bg-a, #c8a882) 0%, var(--ph-bg-b, #8b6347) 100%);
}
/* opt.jpg が読み込めた場合はグラデーションを覆い隠す */
.card-img-ph img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
/* img 非表示時（読み込み失敗 or 未存在）はラベルを前面に出す */
.ph-label {
  position: relative;
  z-index: 0;
  color: rgba(255,255,255,.88);
  font-size: .72rem;
  font-weight: 700;
  text-align: center;
  padding: 4px 8px;
  letter-spacing: .04em;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
  pointer-events: none;
}
/* カテゴリ別カラー */
.ph-textiles               { --ph-bg-a:#c8a882; --ph-bg-b:#7a5c3a; }
.ph-ceramics               { --ph-bg-a:#b5927a; --ph-bg-b:#6e4535; }
.ph-lacquerware            { --ph-bg-a:#8b2020; --ph-bg-b:#4a0f0f; }
.ph-woodcraft-bamboocraft  { --ph-bg-a:#a07850; --ph-bg-b:#5c3d1e; }
.ph-metalwork              { --ph-bg-a:#6e7f8d; --ph-bg-b:#3a4e5c; }
.ph-dyed-fabrics           { --ph-bg-a:#3a5080; --ph-bg-b:#1c2f52; }
.ph-washi-japanese-paper   { --ph-bg-a:#c8ba9a; --ph-bg-b:#8a7555; }
.ph-dolls-kokeshi          { --ph-bg-a:#c86878; --ph-bg-b:#7a3040; }
.ph-buddhist-altars-fittings { --ph-bg-a:#7a6030; --ph-bg-b:#4a3810; }
.ph-stationery-writing     { --ph-bg-a:#507860; --ph-bg-b:#2d4835; }
.ph-stonecraft             { --ph-bg-a:#787878; --ph-bg-b:#404040; }
.ph-precious-stonework     { --ph-bg-a:#6858a0; --ph-bg-b:#3a2860; }
.ph-craft-materials-tools  { --ph-bg-a:#5a7a60; --ph-bg-b:#304838; }
.ph-other-textile-products { --ph-bg-a:#a08868; --ph-bg-b:#6a5840; }
.ph-other-crafts           { --ph-bg-a:#708878; --ph-bg-b:#405048; }

/* ── Google Fonts preconnect hint (add in <head>) ── */
