/* 灯浦町 落とし物・忘れ物センター ― 少し古いお役所のサイト（白地に紺の帯・明朝の見出し） */
: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;
  --night: #10292c;
  --night-card: #163639;
  --night-line: #2e5457;
  --night-ink: #e4e0d4;
  --dust: #d9bd73;
  --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); }
.gnav a[aria-current='page'] { border-bottom-color: var(--navy); font-weight: 700; }

/* 本文 */
.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; }

/* 作品の題名カード（夜の色: 暗い青緑とくすんだ黄色） */
.titlecard { background: var(--night); color: var(--night-ink); border-radius: 4px; overflow: hidden; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08); }
.tc-art { display: block; width: 100%; height: auto; aspect-ratio: 960 / 400; background: #0d2224; }
.tc-body { padding: 14px 18px 16px; }
.tc-kicker { margin: 0; font-size: 0.78rem; letter-spacing: 0.3em; color: var(--dust); }
.tc-title { margin: 2px 0 8px; font-family: var(--serif); font-weight: 700; font-size: clamp(1.25rem, 6.4vw, 2.2rem); line-height: 1.3; letter-spacing: 0.06em; color: #f1e6c6; }
.tc-lead { margin: 0 0 12px; line-height: 1.85; }
.tc-meta { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 10px; list-style: none; }
.tc-meta li { font-size: 0.8rem; padding: 1px 10px; border: 1px solid rgba(217, 189, 115, 0.55); border-radius: 999px; color: #eadcb2; }
.tc-more { border-top: 1px solid rgba(217, 189, 115, 0.25); padding-top: 8px; }
.tc-more summary { cursor: pointer; color: var(--dust); font-size: 0.9rem; }
.tc-more p { margin: 6px 0; font-size: 0.9rem; color: #d3d8d2; }

/* 表（記録票） */
.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 { overflow-x: auto; padding: 16px clamp(12px, 4vw, 22px); }
.poem p { margin: 0.3em 0; white-space: nowrap; word-spacing: 0.55em; letter-spacing: 0.02em; font-size: clamp(0.78rem, calc((100vw - 72px) / 20.5), 1.12rem); }
.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; }

/* 備考の赤い文字（色だけでなく太さでも分かるように） */
.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; }
@media (min-width: 641px) { .list td:first-child { white-space: nowrap; } }
.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: 8px; padding: 0; margin: 0; list-style: none; counter-reset: pop; }
.popular li { counter-increment: pop; }
.popular a { display: inline-block; padding: 3px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: 0.92rem; }
.popular a::before { content: counter(pop) " "; color: var(--muted); font-size: 0.8rem; }
.popular a:hover { border-color: var(--navy); }
.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 { transition: background-color 1.2s ease, color 1.2s ease; }
body.theme-night { background: var(--night); color: var(--night-ink); }
.theme-night a { color: #ecd593; }
.theme-night .site-header { background: #0c2023; border-bottom-color: #0a1a1c; }
.theme-night .gnav a { color: #d8ccaa; }
.theme-night .page-title { color: #f1e6c6; border-bottom-color: #8c7740; }
.theme-night .sub, .theme-night .sec { color: var(--dust); border-left-color: var(--dust); }
.theme-night .crumb, .theme-night .small, .theme-night .caption, .theme-night .more { color: #9fb1ad; }
.theme-night .staff { background: var(--dust); color: #10292c; }
.theme-night .list, .theme-night .diary, .theme-night .return form, .theme-night .returned { background: var(--night-card); border-color: var(--night-line); }
.theme-night .list th, .theme-night .list td { border-color: var(--night-line); }
.theme-night .list thead th { background: #0b1d1f; color: #eadcb2; }
.theme-night .list tbody tr:nth-child(even) { background: #18393c; }
.theme-night .list .hl, .theme-night .list tr.hl { background: #22474a !important; box-shadow: inset 4px 0 0 var(--dust); }
.theme-night .diary h3 { color: #eadcb2; border-bottom-color: var(--night-line); }
.theme-night .diary .hand { color: #f0e2bb; }
.theme-night .return input { background: #f6f1e2; border-color: #8c7740; color: #222; }
.theme-night .return-msg { color: #ffb4a8; }
.theme-night .btn { background: var(--dust); color: #10292c; border-color: #b39548; }
.theme-night .btn:hover { background: #e6cb85; }
.theme-night .site-footer { background: #0a1a1c; }
.caption { margin: -6px 0 6px; font-size: 0.8rem; color: var(--muted); }
@media (max-width: 640px) {
  .theme-night .list { background: none; }
  .theme-night .list tr { background: var(--night-card) !important; border-color: var(--night-line); }
  .theme-night .list tr.hl { background: #22474a !important; }
  .theme-night .list td::before { color: #9fb1ad; }
}

/* 吊るす灯りの写し（名前の札だけ切り取られている） */
.lantern-copy { margin: 0 auto; text-align: center; }
.lantern { display: inline-flex; flex-direction: column; align-items: center; }
.lantern-cap { display: block; width: 92px; height: 12px; background: #2a2418; border-radius: 3px; }
.lantern-body { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 150px; height: 190px; margin: -2px 0; border-radius: 46% / 32%;
  background: repeating-linear-gradient(180deg, rgba(120, 88, 30, 0.22) 0 1px, transparent 1px 17px), radial-gradient(ellipse at 50% 45%, #fbe9b4 0%, #f0cf7c 55%, #d6a948 100%);
  color: #6b2a1c; box-shadow: 0 0 34px rgba(226, 192, 112, 0.35); }
.lantern-text { font-size: 0.95rem; line-height: 1.5; letter-spacing: 0.08em; }
.lantern-slot { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; padding: 4px 8px; background: rgba(255, 250, 235, 0.75); border: 1px solid rgba(107, 42, 28, 0.35); }
.lantern .gap { width: 3.6em; height: 1.4em; background: var(--night); border: 1px dashed rgba(107, 42, 28, 0.55); }
.lantern-copy figcaption { margin-top: 10px; }

/* 明るくなるページ: 灰色から、紙の色へゆっくり明るくなる（白くは光らせない） */
body.theme-dawn { animation: dawn 3.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(--night); } 45% { background-color: #6f7a70; } 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: #6e695e; 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-box { border-top-color: var(--dust); }
.done-label { font-family: var(--serif); letter-spacing: 0.4em; color: #6e5c2c; font-weight: 700; margin: 6px 0 0; font-size: 0.85rem; }
.done-title { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; color: var(--navy); margin: 0 0 8px; letter-spacing: 0.04em; }
.done-time { font-size: 1.05rem; }

/* 新着の拾得物にクリアした後で増える 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: #dfe5ee; font-size: 0.8rem; line-height: 1.7; }
.site-footer p { margin: 2px auto; max-width: 960px; }
.site-footer a { color: #fff; }
.foot-in { padding: 18px 16px 14px; }
.foot-name { font-family: var(--serif); font-weight: 700; font-size: 0.95rem; color: #fff; }
.foot-out { background: var(--navy-dark); padding: 12px 16px 22px; color: #b9c4d4; }
.flinks { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.flinks span { color: #b9c4d4; }
.site-footer .credit { color: #93a1b6; }

/* スマホ: メニューは 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; }
}

/* 狭い画面（320px 前後）: 町の名前とメニューを 1 行に収める */
@media (max-width: 360px) {
  .brand-ja { font-size: 0.86rem; letter-spacing: 0; }
  .brand-en { font-size: 0.66rem; }
  .gnav { grid-template-columns: 0.8fr 1.45fr 1.2fr 1.3fr; }
  .gnav a { font-size: 0.72rem; white-space: nowrap; letter-spacing: -0.02em; }
}
@media (min-width: 641px) {
  .tc-art { max-height: 320px; object-fit: cover; object-position: center 30%; }
}
/* 夜から戻るとき、上の帯も地の色と一緒にゆっくり変わる（急に明るくしない） */
.site-header, .gnav a, .site-footer, .foot-out { transition: background-color 1.2s ease, color 1.2s ease, border-color 1.2s ease; }
