/* 灯浦町 落とし物・忘れ物センター ― 少し古いお役所のサイト（白地に紺の帯・明朝の見出し） */
:root {
  --paper: #f7f4ec;
  --card: #fffdf7;
  --ink: #2a2a2a;
  --muted: #5f5b52;
  --line: #cfc7b5;
  --navy: #1f3a5f;
  --navy-dark: #15294a;
  --link: #1d4f91;
  --red: #b3262e;
  --stone: #d6d3cc;
  --stone-card: #e4e1da;
  --serif: 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --sans: system-ui, -apple-system, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', Meiryo, sans-serif;
  --hand: 'Klee One', 'Hiragino Maru Gothic ProN', 'Yu Gothic', var(--sans);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
a { color: var(--link); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid #e0a43a; outline-offset: 2px; }
img { max-width: 100%; height: auto; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 10; background: #fff; padding: 4px 8px; }

/* ヘッダー */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.band { background: var(--navy); border-bottom: 4px solid var(--navy-dark); }
.brand { display: flex; align-items: center; gap: 10px; max-width: 960px; margin: 0 auto; padding: 10px 16px; color: #fff; text-decoration: none; }
.brand img { flex: none; background: #fffdf6; border-radius: 50%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-ja { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.04em; }
.brand-en { font-size: 0.72rem; opacity: 0.85; letter-spacing: 0.06em; }
.gnav { display: flex; flex-wrap: wrap; max-width: 960px; margin: 0 auto; padding: 0 8px; }
.gnav a { padding: 10px 10px; color: var(--navy); text-decoration: none; font-size: 0.92rem; border-bottom: 3px solid transparent; }
.gnav a:hover { border-bottom-color: var(--navy); }

/* 本文 */
.main { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; min-height: 60vh; }
.page-title { font-family: var(--serif); font-weight: 700; font-size: 1.45rem; color: var(--navy); margin: 8px 0 16px; padding-bottom: 6px; border-bottom: 2px solid var(--navy); line-height: 1.4; }
.sec { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--navy); margin: 32px 0 12px; padding-left: 10px; border-left: 5px solid var(--navy); line-height: 1.4; }
.sec-sub, .sub { font-family: var(--serif); font-size: 1.02rem; color: var(--navy); margin: 24px 0 10px; }
.crumb { font-size: 0.82rem; color: var(--muted); margin: 0 0 4px; }
.small { font-size: 0.82rem; color: var(--muted); }
.warn { background: #fbf1dd; border: 1px solid #e6cf9e; padding: 10px 12px; }
.loading { color: var(--muted); }

.btn { display: inline-block; font: inherit; font-weight: 600; color: #fff; background: var(--navy); border: 1px solid var(--navy-dark); border-radius: 3px; padding: 8px 18px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--navy-dark); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-plain { background: var(--card); color: var(--navy); }
.btn-plain:hover { background: #eef1f6; }

/* はじめての方へ */
.intro { background: var(--card); border: 1px solid var(--line); border-left: 5px solid #c9a55a; padding: 8px 14px; }
.intro summary { cursor: pointer; font-weight: 700; color: var(--navy); }
.intro p { margin: 6px 0; }
.intro .meta { font-weight: 600; }

/* 表（記録票） */
.record { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
.record th, .record td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.record th { width: 7.5em; background: #eeeadf; font-weight: 600; color: #3d3a33; white-space: nowrap; }
.status { display: inline-block; padding: 0 8px; border: 1px solid var(--red); color: var(--red); font-weight: 600; font-size: 0.9rem; }
.status.done { border-color: var(--navy); color: var(--navy); }

/* 問い合わせ */
.slip { background: var(--card); border: 1px solid var(--line); padding: 12px; }
.inquiry-letter { margin-top: 12px; }

/* 手書き風の紙 */
.paper { background: #fbf6e6; border: 1px solid #e3d8b8; padding: 16px 18px; box-shadow: 0 1px 0 #e9e1c8; }
.hand { font-family: var(--hand); font-weight: 600; letter-spacing: 0.04em; }
.paper p { margin: 0.4em 0; }
.poem p { margin: 0.25em 0; font-size: 1.08rem; }
.letter p { margin: 0.8em 0; line-height: 2; }
.letter .sign { text-align: right; }

/* 木の札・布の札 */
.plaque { position: relative; max-width: 360px; margin: 0 auto; background: #e9cf9f; border: 2px solid #b48a4c; border-radius: 6px; padding: 34px 20px 16px; clip-path: polygon(50% 0, 100% 18%, 100% 100%, 0 100%, 0 18%); text-align: center; color: #3b2a14; }
.plaque p { margin: 0.4em 0; }
.plaque-name { margin-top: 1em !important; }
.blackout { letter-spacing: 0; color: #111; }
.tag { max-width: 320px; margin: 0 auto; background: #fff; border: 2px solid #8aa3c4; border-top-width: 14px; border-radius: 4px; padding: 10px 16px; text-align: center; }
.tag p { margin: 0.3em 0; }
.tag-top { font-size: 0.9rem; color: #46607f; }
.gap { display: inline-block; width: 4.2em; height: 1.3em; vertical-align: middle; border: 1px dashed #9b9b9b; background: var(--paper); border-radius: 2px; }
.theme-dim .gap { background: var(--stone); }

/* 備考の赤い文字（色だけでなく太さでも分かるように） */
.note { background: var(--card); border: 1px solid var(--line); padding: 10px 14px; }
.note p { margin: 0.4em 0; }
.mark { color: var(--red); font-weight: 800; }

/* 一覧の表（PC は表・スマホは札の並び） */
.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); font-size: 0.92rem; }
.list th, .list td { border: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
.list thead th { background: var(--navy); color: #fff; font-weight: 600; white-space: nowrap; }
.list tbody tr:nth-child(even) { background: #faf8f1; }
.list .hl { font-weight: 700; }
.nodetail { color: #a19b8d; }
.detail { font-weight: 700; }
.more { color: #8a857a; font-size: 0.86rem; text-align: right; margin: 6px 0 0; }
.staff { display: inline-block; vertical-align: middle; font-family: var(--sans); font-size: 0.75rem; font-weight: 700; color: #fff; background: #5d5a54; padding: 1px 8px; border-radius: 2px; letter-spacing: 0.1em; }

@media (max-width: 640px) {
  .list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .list, .list tbody, .list tr, .list td { display: block; width: 100%; }
  .list { border: none; background: none; }
  .list tr { background: var(--card) !important; border: 1px solid var(--line); margin-bottom: 8px; padding: 6px 10px; }
  .list td { border: none; padding: 2px 0 2px 6.2em; position: relative; min-height: 1.6em; }
  .list td::before { content: attr(data-label); position: absolute; left: 0; width: 5.8em; color: var(--muted); font-size: 0.8rem; font-weight: 600; line-height: 1.75rem; }
  .list.compact td { padding-left: 5.2em; }
  .list.compact td::before { width: 4.8em; }
  .record th { width: 6em; white-space: normal; }
  .page-title { font-size: 1.25rem; }
  .brand-ja { font-size: 0.95rem; }
}

/* 検索 */
.search-form { display: flex; gap: 8px; }
.search-form input { flex: 1; min-width: 0; font: inherit; padding: 8px 10px; border: 1px solid #9e968a; border-radius: 3px; background: #fff; }
.popular { display: flex; flex-wrap: wrap; gap: 4px 22px; padding: 0; margin: 0; list-style: none; counter-reset: pop; }
.popular li { counter-increment: pop; }
.popular li::before { content: counter(pop) ". "; color: var(--muted); }
.result { margin-top: 16px; }
.result-h { font-family: var(--serif); font-size: 1.08rem; color: var(--navy); margin: 0 0 6px; }
.count { font-family: var(--sans); font-size: 0.92rem; color: var(--ink); }
.noresult { background: var(--card); border: 1px solid var(--line); padding: 12px 14px; }

/* お知らせ・よくある質問 */
.news { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); }
.news li { padding: 8px 12px; border-bottom: 1px dotted var(--line); }
.news li:last-child { border-bottom: none; }
.news time { display: inline-block; min-width: 6.5em; color: var(--muted); font-variant-numeric: tabular-nums; }
.faq dt { font-weight: 700; margin-top: 18px; }
.faq dt::before { content: 'Q. '; color: var(--navy); }
.faq dd { margin: 4px 0 0; padding-left: 1.6em; }
.faq dd::before { content: 'A. '; margin-left: -1.6em; color: var(--red); font-weight: 700; }
.dots { padding-left: 1.3em; }
.steps { padding-left: 1.5em; }

/* ヒント */
.hint { background: var(--card); border: 1px solid var(--line); margin: 6px 0; padding: 6px 12px; }
.hint summary { cursor: pointer; font-weight: 700; color: var(--navy); }
.hint p { margin: 6px 0 4px; }
.hint.answer summary { color: var(--red); }

/* 記録の下 */
.back { margin-top: 28px; }
.diary { background: var(--card); border: 1px solid var(--line); padding: 4px 16px 12px; }
.diary h3 { font-family: var(--serif); font-size: 0.98rem; color: #3d3a33; margin: 18px 0 4px; border-bottom: 1px dotted var(--line); }
.diary p { margin: 0.35em 0; }

/* 返却手続き */
.return form { background: var(--card); border: 1px solid var(--line); padding: 14px; }
.return label { display: block; font-weight: 700; margin-bottom: 6px; }
.return input { width: 100%; max-width: 320px; font: inherit; padding: 8px 10px; border: 1px solid #9e968a; border-radius: 3px; background: #fff; }
.return .small { margin: 4px 0 12px; }
.return-msg { min-height: 1.75em; margin: 10px 0 0; color: var(--red); font-weight: 600; }
.returned { background: var(--card); border: 1px solid var(--line); padding: 12px 14px; }

/* 暗い地の色のページ（切り替えは色が変わるだけ） */
body.theme-dim { background: var(--stone); }
.theme-dim .record, .theme-dim .list, .theme-dim .diary, .theme-dim .return form, .theme-dim .returned, .theme-dim .note { background: var(--stone-card); }
.theme-dim .list tbody tr:nth-child(even) { background: #dedad2; }
.theme-dim .site-header { background: #e9e6df; }
body { transition: background-color 0.8s ease; }

/* 明るくなるページ: 灰色から、紙の色へゆっくり明るくなる（白くは光らせない） */
body.theme-dawn { animation: dawn 2.6s ease-out both; }
.theme-dawn .view { animation: rise 1.6s ease-out 1.1s both; }
.theme-dawn .afterword { animation: rise 2s ease-out 4.2s both; }
@keyframes dawn { from { background-color: var(--stone); } to { background-color: var(--paper); } }
@keyframes rise { from { opacity: 0; } to { opacity: 1; } }
.done-head .record { margin-bottom: 8px; }
.afterword { margin: 28px 0; text-align: center; color: #8d877a; font-family: var(--hand); letter-spacing: 0.06em; }
.done-box { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--navy); padding: 12px 16px; text-align: center; }
.done-label { font-family: var(--serif); letter-spacing: 0.4em; color: var(--navy); font-weight: 700; margin: 4px 0; }

/* 新着の拾得物にクリアした後で増える 1 行（静かに表れる） */
.quiet-new { animation: rise 2.4s ease-out 0.6s both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* フッター */
.site-footer { background: var(--navy); color: #e8ecf3; font-size: 0.85rem; padding: 18px 16px 24px; text-align: center; }
.site-footer p { margin: 4px auto; max-width: 960px; }
.site-footer a { color: #fff; }
.site-footer .fiction { font-weight: 600; }
.site-footer .credit { opacity: 0.8; }

/* スマホ: メニューは 4 つを 1 行に、検索結果は短い札に */
@media (max-width: 480px) {
  .gnav { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0; }
  .gnav a { padding: 9px 2px; font-size: 0.8rem; text-align: center; line-height: 1.35; }
  .list.results tr { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; padding: 8px 12px; }
  .list.results td { padding: 0; min-height: 0; font-size: 0.86rem; color: var(--muted); }
  .list.results td::before { position: static; display: inline; width: auto; content: attr(data-label) '：'; font-size: inherit; font-weight: 400; line-height: inherit; }
  .list.results td:nth-child(3) { grid-column: 1; grid-row: 1; font-size: 1rem; font-weight: 700; color: var(--ink); }
  .list.results td:nth-child(3)::before, .list.results td:nth-child(2)::before { content: none; }
  .list.results td:nth-child(2) { grid-column: 2; grid-row: 1; text-align: right; font-variant-numeric: tabular-nums; }
  .list.results td:nth-child(4), .list.results td:nth-child(5) { grid-column: 1 / -1; color: var(--ink); }
  .list.results td:nth-child(1) { grid-column: 1; white-space: nowrap; }
  .list.results td:nth-child(1)::before { content: 'No.'; }
  .list.results td:nth-child(6) { grid-column: 2; text-align: right; }
  .list.results td:nth-child(7) { grid-column: 1 / -1; margin-top: 4px; }
  .list.results td:nth-child(7)::before { content: none; }
  .list.results td:has(.nodetail) { display: none; }
}
