:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #2b2522;
  --muted: #6f6660;
  --line: #e7dfd5;
  --accent: #b7282e;
  --accent-soft: #f6e3e1;
  --gold: #a07b3b;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Noto Sans JP", system-ui, sans-serif; line-height: 1.7;
}
a { color: var(--accent); }
.site-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; background: var(--card); border-bottom: 3px solid var(--accent);
}
.logo { font-family: "Shippori Mincho", serif; font-weight: 700; font-size: 1.35rem; color: var(--ink); text-decoration: none; }
.torii { color: var(--accent); }
.badge { font-size: .75rem; background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 999px; }
main { max-width: 1040px; margin: 0 auto; padding: 20px 16px 40px; }
h1, h2, h3 { font-family: "Shippori Mincho", serif; line-height: 1.4; }
.hero h1 { font-size: 1.7rem; margin: 8px 0 4px; }
.hero p { color: var(--muted); margin: 0 0 16px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 18px; }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field > .label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
input[type=search], select {
  width: 100%; padding: 10px 12px; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 6px 12px; border-radius: 999px; font: inherit; font-size: .9rem; cursor: pointer;
}
.chip[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: #fff; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.checks label { font-size: .92rem; cursor: pointer; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 10px; color: var(--muted); font-size: .9rem; }
.linkbtn { background: none; border: none; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  color: inherit; text-decoration: none; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { margin: 0; font-size: 1.15rem; }
.yomi { color: var(--muted); font-size: .8rem; }
.meta { color: var(--muted); font-size: .85rem; margin: 4px 0 8px; }
.deity-line { font-size: .9rem; margin-bottom: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .78rem; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.tag.hit { background: var(--accent); color: #fff; }
.tag.gray { background: #f0ebe4; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.detail h1 { margin: 6px 0 0; font-size: 1.9rem; }
.back { display: inline-block; margin-bottom: 8px; font-size: .9rem; }
.section { margin-top: 18px; }
.section h2 { font-size: 1.15rem; border-left: 4px solid var(--accent); padding-left: 10px; margin: 0 0 10px; }
dl.info { display: grid; grid-template-columns: 8em 1fr; gap: 6px 12px; margin: 0; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; }
.deity-list { display: grid; gap: 10px; }
.deity-item { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; color: inherit; text-decoration: none; background: #fff; }
.deity-item:hover { border-color: var(--accent); }
.deity-item strong { font-family: "Shippori Mincho", serif; font-size: 1.05rem; }
.note { background: #fbf6ec; border: 1px solid #eadbb9; color: #6b5526; border-radius: 10px; padding: 10px 14px; font-size: .88rem; }
.btn { display: inline-block; background: var(--accent); color: #fff; text-decoration: none; padding: 8px 16px; border-radius: 8px; font-size: .92rem; }

.site-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 20px 16px 30px; border-top: 1px solid var(--line); }

/* タブ */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 14px; border-bottom: 1px solid var(--line); }
.tabs a { white-space: nowrap; padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current=page] { color: var(--accent); border-bottom-color: var(--accent); }
a.chip { text-decoration: none; display: inline-block; }
a.chip:hover { border-color: var(--accent); color: var(--accent); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn.ghost { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.subhead { font-size: 1.05rem; margin: 0 0 10px; }

/* 近くの神社 */
.near { display: grid; gap: 8px; }
.near-item { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fff; color: inherit; text-decoration: none; }
.near-item:hover { border-color: var(--accent); }
.near-item .meta { margin: 0; }

/* コース */
.stops { list-style: none; padding: 0; margin: 18px 0 0; border-left: 3px solid var(--accent-soft); }
.stop { position: relative; display: flex; flex-direction: column; padding: 8px 0 14px 20px; }
.stop::before { content: ""; position: absolute; left: -9px; top: 14px; width: 15px; height: 15px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); }
.stop.start::before { background: var(--gold); }
.stop a { color: var(--ink); text-decoration: none; font-family: "Shippori Mincho", serif; font-size: 1.1rem; }
.stop a:hover { color: var(--accent); }
.stop .meta { margin: 0 0 2px; }
.leg { font-size: .78rem; color: var(--gold); margin-bottom: 2px; }

/* 家系図 */
.tree-wrap { overflow-x: auto; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 14px; padding-left: 18px; border-left: 1px solid #d6c9b8; }
.tree li { position: relative; padding: 5px 0 5px 0; }
.tree ul > li::before { content: ""; position: absolute; left: -18px; top: 18px; width: 14px; border-top: 1px solid #d6c9b8; }
.tree ul > li:last-child::after { content: ""; position: absolute; left: -19px; top: 19px; bottom: 0; border-left: 3px solid var(--card); }
.node { display: inline-block; padding: 3px 10px; border-radius: 8px; border: 1px solid var(--accent); color: var(--accent); background: #fff; text-decoration: none; font-family: "Shippori Mincho", serif; font-weight: 700; white-space: nowrap; }
a.node:hover { background: var(--accent); color: #fff; }
.node.plain { border-color: #d6c9b8; color: var(--muted); font-weight: 500; }
.rel { display: inline-block; margin-left: 8px; font-size: .78rem; color: var(--muted); }
.path { list-style: none; padding: 0; margin: 0; }
.path li { padding: 4px 0 4px 18px; position: relative; }
.path li::before { content: "↓"; position: absolute; left: 0; color: var(--gold); }
.path li:first-child::before { content: "●"; font-size: .7rem; top: 8px; }
.path .current { font-weight: 700; color: var(--accent); }

.official .events { margin: 0; padding-left: 1.1em; }
.official .events li { margin: 0.1em 0; }
.official .sources { font-size: 0.85rem; color: var(--muted, #666); margin-top: 0.8em; line-height: 1.7; }
.official .sources a { color: inherit; text-decoration: underline; }
