/* =============================================
   黄泉戸村役場跡地 - メインスタイルシート
   表の顔テーマ（昭和〜平成の地方役場）
   ============================================= */

/* 禍ツ神文字フォント */
@font-face {
  font-family: 'MagatsukamiFont';
  src: url('../fonts/magatsukami.svg#MagatsukamiFont') format('svg');
  font-weight: normal;
  font-style: normal;
}

/* リセット */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ルート変数 */
:root {
  --color-bg: #f5f0e8;
  --color-bg-dark: #e8e0d0;
  --color-text: #2a2015;
  --color-text-light: #5a4a35;
  --color-accent: #8B1a1a;
  --color-accent-light: #c0392b;
  --color-border: #b8a890;
  --color-header-bg: #2a1a0a;
  --color-header-text: #d4c4a0;
  --color-nav-bg: #3d2b1a;
  --color-nav-text: #c8b890;
  --color-link: #6b1a1a;
  --color-link-hover: #c0392b;
  --font-main: 'Hiragino Mincho ProN', 'Yu Mincho', 'MS Mincho', serif;
  --font-gothic: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'MS Gothic', sans-serif;
  --font-magatsu: 'MagatsukamiFont', serif;
  --shadow: 0 2px 8px rgba(0,0,0,0.15);
  --transition: 0.3s ease;
}

/* ボディ */
body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.8;
  font-size: 15px;
  min-height: 100vh;
}

/* ヘッダー */
#site-header {
  background-color: var(--color-header-bg);
  color: var(--color-header-text);
  padding: 0;
  border-bottom: 3px solid var(--color-accent);
  position: relative;
  overflow: hidden;
}

#site-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(139,26,26,0.03) 10px,
    rgba(139,26,26,0.03) 20px
  );
  pointer-events: none;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-emblem {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.header-title-group {
  flex: 1;
}

.header-title-group h1 {
  font-size: 22px;
  font-weight: normal;
  letter-spacing: 0.15em;
  color: var(--color-header-text);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.header-title-group .subtitle {
  font-size: 11px;
  color: #8a7a60;
  letter-spacing: 0.1em;
  margin-top: 2px;
  font-family: var(--font-gothic);
}

.header-notice {
  font-size: 11px;
  color: #8a7a60;
  text-align: right;
  line-height: 1.5;
  font-family: var(--font-gothic);
}

/* ナビゲーション */
#site-nav {
  background-color: var(--color-nav-bg);
  border-bottom: 1px solid #5a3a20;
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.nav-inner a {
  color: var(--color-nav-text);
  text-decoration: none;
  font-size: 13px;
  padding: 10px 14px;
  display: block;
  font-family: var(--font-gothic);
  letter-spacing: 0.05em;
  transition: background-color var(--transition), color var(--transition);
  border-right: 1px solid #5a3a20;
}

.nav-inner a:hover,
.nav-inner a.active {
  background-color: var(--color-accent);
  color: #f5f0e8;
}

/* メインレイアウト */
#site-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 20px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 30px;
}

#site-main.full-width {
  grid-template-columns: 1fr;
}

/* コンテンツエリア */
.content-area {
  min-width: 0;
}

/* サイドバー */
.sidebar {
  min-width: 0;
}

/* パンくずリスト */
.breadcrumb {
  font-size: 12px;
  color: var(--color-text-light);
  margin-bottom: 20px;
  font-family: var(--font-gothic);
  padding: 8px 12px;
  background: var(--color-bg-dark);
  border-left: 3px solid var(--color-accent);
}

.breadcrumb a {
  color: var(--color-link);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span {
  margin: 0 6px;
  color: #999;
}

/* ページタイトル */
.page-title {
  font-size: 24px;
  font-weight: normal;
  color: var(--color-header-bg);
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 10px;
  margin-bottom: 24px;
  letter-spacing: 0.1em;
}

.page-title .title-en {
  font-size: 11px;
  color: #999;
  display: block;
  letter-spacing: 0.15em;
  font-family: var(--font-gothic);
  margin-top: 4px;
}

/* セクション見出し */
h2.section-title {
  font-size: 18px;
  font-weight: normal;
  color: var(--color-header-bg);
  border-left: 4px solid var(--color-accent);
  padding-left: 12px;
  margin: 28px 0 16px;
  letter-spacing: 0.08em;
}

h3.subsection-title {
  font-size: 15px;
  font-weight: bold;
  color: var(--color-text);
  border-bottom: 1px dotted var(--color-border);
  padding-bottom: 6px;
  margin: 20px 0 12px;
}

/* 本文 */
.body-text p {
  margin-bottom: 1.2em;
  text-align: justify;
}

.body-text a {
  color: var(--color-link);
  text-decoration: underline;
}

.body-text a:hover {
  color: var(--color-link-hover);
}

/* お知らせボックス */
.notice-box {
  background: #fff9f0;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 14px;
}

.notice-box.important {
  background: #fff0f0;
  border-left-color: #c0392b;
}

.notice-box .notice-date {
  font-size: 11px;
  color: #999;
  font-family: var(--font-gothic);
  margin-bottom: 4px;
}

/* テーブル */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 20px;
}

table.data-table th {
  background-color: var(--color-nav-bg);
  color: var(--color-nav-text);
  padding: 10px 14px;
  text-align: left;
  font-weight: normal;
  letter-spacing: 0.05em;
}

table.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

table.data-table tr:nth-child(even) td {
  background-color: var(--color-bg-dark);
}

/* サイドバーウィジェット */
.widget {
  background: #fff;
  border: 1px solid var(--color-border);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.widget-title {
  background-color: var(--color-nav-bg);
  color: var(--color-nav-text);
  padding: 10px 14px;
  font-size: 13px;
  letter-spacing: 0.08em;
  font-family: var(--font-gothic);
}

.widget-body {
  padding: 14px;
  font-size: 13px;
}

.widget-body ul {
  list-style: none;
  padding: 0;
}

.widget-body ul li {
  padding: 6px 0;
  border-bottom: 1px dotted var(--color-border);
}

.widget-body ul li:last-child {
  border-bottom: none;
}

.widget-body ul li a {
  color: var(--color-link);
  text-decoration: none;
  font-size: 13px;
}

.widget-body ul li a:hover {
  text-decoration: underline;
}

/* フッター */
#site-footer {
  background-color: var(--color-header-bg);
  color: #8a7a60;
  padding: 30px 20px;
  margin-top: 40px;
  border-top: 3px solid var(--color-accent);
  font-size: 12px;
  font-family: var(--font-gothic);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 30px;
}

.footer-section h4 {
  color: var(--color-header-text);
  font-size: 13px;
  margin-bottom: 10px;
  font-weight: normal;
  border-bottom: 1px solid #5a3a20;
  padding-bottom: 6px;
}

.footer-section p, .footer-section a {
  color: #8a7a60;
  text-decoration: none;
  line-height: 2;
  display: block;
}

.footer-section a:hover {
  color: var(--color-header-text);
}

.footer-bottom {
  max-width: 1100px;
  margin: 20px auto 0;
  padding-top: 16px;
  border-top: 1px solid #3a2a1a;
  text-align: center;
  color: #5a4a30;
  font-size: 11px;
}

/* 画像 */
.content-image {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--color-border);
  margin-bottom: 10px;
}

.image-caption {
  font-size: 12px;
  color: var(--color-text-light);
  text-align: center;
  margin-bottom: 20px;
  font-family: var(--font-gothic);
}

/* 文字化けエフェクト（壊れたサイト感） */
.glitch-text {
  position: relative;
  display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glitch-text::before {
  animation: glitch-1 3s infinite;
  color: #8B1a1a;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
  transform: translate(-2px, 0);
}

.glitch-text::after {
  animation: glitch-2 3s infinite;
  color: #1a1a8B;
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
  transform: translate(2px, 0);
}

@keyframes glitch-1 {
  0%, 90%, 100% { transform: translate(0); opacity: 0; }
  92% { transform: translate(-3px, 1px); opacity: 0.8; }
  94% { transform: translate(3px, -1px); opacity: 0.8; }
  96% { transform: translate(-1px, 2px); opacity: 0.8; }
}

@keyframes glitch-2 {
  0%, 88%, 100% { transform: translate(0); opacity: 0; }
  90% { transform: translate(3px, -1px); opacity: 0.8; }
  93% { transform: translate(-3px, 1px); opacity: 0.8; }
  97% { transform: translate(1px, -2px); opacity: 0.8; }
}

/* 壊れたリンク（グレーアウト） */
a.broken-link {
  color: #999 !important;
  text-decoration: line-through !important;
  cursor: not-allowed;
  pointer-events: none;
}

/* 読み込みエラー画像 */
.image-error {
  width: 100%;
  height: 200px;
  background: #e0d8c8;
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 12px;
  font-family: var(--font-gothic);
  flex-direction: column;
  gap: 8px;
}

.image-error::before {
  content: '⚠';
  font-size: 24px;
  color: #cc9900;
}

/* =============================================
   コアルートテーマ（data-theme="core"時に適用）
   ============================================= */
[data-theme="core"] {
  --color-bg: #0a0505;
  --color-bg-dark: #150a0a;
  --color-text: #c8a0a0;
  --color-text-light: #8a5a5a;
  --color-accent: #8B0000;
  --color-accent-light: #cc0000;
  --color-border: #3a1a1a;
  --color-header-bg: #050202;
  --color-header-text: #c8a0a0;
  --color-nav-bg: #1a0505;
  --color-nav-text: #a07070;
  --color-link: #cc3333;
  --color-link-hover: #ff4444;
}

[data-theme="core"] body {
  background-color: var(--color-bg);
  color: var(--color-text);
}

[data-theme="core"] #site-header {
  background-color: #050202;
  border-bottom-color: #8B0000;
}

[data-theme="core"] .widget {
  background: #0f0505;
  border-color: #3a1a1a;
}

/* コアルート用のノイズオーバーレイ */
[data-theme="core"] body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.3;
  mix-blend-mode: overlay;
}

/* =============================================
   禍ツ神文字表示クラス
   ============================================= */
.magatsu-text {
  font-family: var(--font-magatsu);
  letter-spacing: 0.2em;
}

.magatsu-inline {
  display: inline-block;
  font-family: var(--font-magatsu);
}

/* SVGベースの禍ツ神文字（インライン表示用） */
.magatsu-glyph {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  vertical-align: middle;
}

/* =============================================
   レスポンシブ
   ============================================= */
@media (max-width: 768px) {
  #site-main {
    grid-template-columns: 1fr;
    padding: 20px 15px;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .header-inner {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  .header-notice {
    text-align: center;
  }

  .nav-inner a {
    font-size: 12px;
    padding: 8px 10px;
  }
}

/* =============================================
   アニメーション
   ============================================= */
@keyframes flicker {
  0%, 95%, 100% { opacity: 1; }
  96% { opacity: 0.8; }
  97% { opacity: 1; }
  98% { opacity: 0.6; }
  99% { opacity: 1; }
}

.flicker {
  animation: flicker 8s infinite;
}

@keyframes pulse-red {
  0%, 100% { color: var(--color-text); }
  50% { color: var(--color-accent); }
}

.pulse-red {
  animation: pulse-red 4s infinite;
}

/* DevTools検知時のオーバーレイ */
#devtools-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
}

#devtools-overlay.active {
  display: flex;
}

#devtools-overlay .devtools-message {
  color: #8B0000;
  font-size: 28px;
  font-family: var(--font-main);
  letter-spacing: 0.3em;
  text-align: center;
  animation: pulse-red 2s infinite;
}

#devtools-overlay .devtools-sub {
  color: #5a3a3a;
  font-size: 13px;
  font-family: var(--font-gothic);
  text-align: center;
  letter-spacing: 0.1em;
  line-height: 2;
}

#devtools-overlay .devtools-close {
  color: #5a3a3a;
  font-size: 11px;
  font-family: var(--font-gothic);
  cursor: pointer;
  border: 1px solid #3a1a1a;
  padding: 8px 20px;
  margin-top: 20px;
  transition: all 0.3s;
}

#devtools-overlay .devtools-close:hover {
  color: #c8a0a0;
  border-color: #8B0000;
}

/* =============================================
   擬似チャット（村の掲示板）
   ============================================= */
.chat-message {
  border-bottom: 1px solid #e8e0d0;
  padding: 6px 0;
  font-size: 12px;
  line-height: 1.6;
}
.chat-message:last-child { border-bottom: none; }
.chat-user {
  font-weight: bold;
  color: #5a4a35;
  margin-right: 6px;
}
.chat-time {
  font-size: 10px;
  color: #aaa;
}
.chat-text {
  margin: 2px 0 0 0;
  color: #3a2a15;
}
.chat-message-horror .chat-user { color: #8B1a1a; }
.chat-message-horror .chat-text { color: #5a0000; }

/* =============================================
   追加スタイル（精査時に不足が判明したクラス群）
   ============================================= */

/* ルート分岐セクション */
.novice-branch,
.core-branch {
  display: none;
}
.novice-branch.active,
.core-branch.active {
  display: block;
}

/* 禍ツ神文字フォント適用クラス */
.magatsu-font {
  font-family: 'MagatsukamiFont', 'Noto Serif JP', serif;
  letter-spacing: 0.15em;
  line-height: 2.2;
}

/* ブログ記事スタイル */
.blog-article {
  background: #faf7f0;
  border: 1px solid #d4c9b0;
  padding: 32px;
  margin-bottom: 24px;
}
.blog-header {
  border-bottom: 1px solid #d4c9b0;
  padding-bottom: 16px;
  margin-bottom: 24px;
}
.blog-title {
  font-size: 1.5rem;
  color: #3d2b1a;
  margin-bottom: 8px;
}
.blog-meta {
  font-size: 0.85rem;
  color: #8a7a60;
}
.blog-body p {
  margin-bottom: 1.2em;
  line-height: 1.9;
  color: #3d2b1a;
}
.blog-tags {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #d4c9b0;
}
.blog-tag {
  display: inline-block;
  background: #e8e0d0;
  color: #5a3a20;
  font-size: 0.75rem;
  padding: 3px 10px;
  margin-right: 6px;
  border-radius: 2px;
}
.blog-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  font-size: 0.9rem;
}
.blog-nav a {
  color: #5a3a20;
  text-decoration: none;
  border-bottom: 1px solid #d4c9b0;
  padding-bottom: 2px;
}
.blog-nav a:hover {
  color: #3d2b1a;
  border-color: #3d2b1a;
}

/* 広報誌記事スタイル */
.kouhou-article {
  background: #faf7f0;
  border: 1px solid #d4c9b0;
  padding: 32px;
  margin-bottom: 32px;
}
.kouhou-article h2 {
  font-size: 1.4rem;
  color: #3d2b1a;
  border-left: 4px solid #8B6914;
  padding-left: 12px;
  margin-bottom: 16px;
}
.kouhou-article h3 {
  font-size: 1.1rem;
  color: #5a3a20;
  margin: 20px 0 10px;
}
.kouhou-article p {
  line-height: 1.9;
  color: #3d2b1a;
  margin-bottom: 1em;
}
.kouhou-cover {
  width: 100%;
  max-width: 400px;
  display: block;
  margin: 0 auto 24px;
  border: 2px solid #d4c9b0;
}
.kouhou-header {
  text-align: center;
  border-bottom: 2px solid #8B6914;
  padding-bottom: 20px;
  margin-bottom: 28px;
}
.kouhou-issue-num {
  font-size: 1.8rem;
  color: #3d2b1a;
  font-family: 'Noto Serif JP', serif;
}
.kouhou-date {
  font-size: 0.9rem;
  color: #8a7a60;
  margin-top: 4px;
}
.kouhou-ad {
  background: #f0ebe0;
  border: 1px dashed #b8a890;
  padding: 16px;
  margin: 20px 0;
  font-size: 0.9rem;
  color: #5a3a20;
  text-align: center;
}
.kouhou-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #d4c9b0;
  font-size: 0.9rem;
}
.kouhou-nav a {
  color: #5a3a20;
  text-decoration: none;
}
.kouhou-nav a:hover {
  color: #3d2b1a;
  text-decoration: underline;
}

/* 住民の声コーナー */
.resident-voice {
  background: #f5f0e8;
  border-left: 3px solid #8B6914;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 0.9rem;
  color: #3d2b1a;
  line-height: 1.8;
}
.resident-voice-name {
  font-size: 0.8rem;
  color: #8a7a60;
  margin-top: 8px;
  text-align: right;
}

/* 警告・重要ボックス */
.warning-box {
  background: #fff8e8;
  border: 2px solid #c8a020;
  padding: 16px 20px;
  margin: 20px 0;
  color: #3d2b1a;
}
.danger-box {
  background: #1a0a0a;
  border: 1px solid #5a1a1a;
  padding: 16px 20px;
  margin: 20px 0;
  color: #c87070;
  font-family: 'Noto Serif JP', serif;
}

/* 歴史年表 */
.timeline {
  position: relative;
  padding-left: 32px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #8B6914, #3d2b1a);
}
.timeline-item {
  position: relative;
  margin-bottom: 28px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8B6914;
  border: 2px solid #faf7f0;
}
.timeline-year {
  font-size: 0.85rem;
  color: #8a7a60;
  font-weight: bold;
  margin-bottom: 4px;
}
.timeline-content {
  font-size: 0.95rem;
  color: #3d2b1a;
  line-height: 1.8;
}

/* 特産品ページ */
.product-card {
  background: #faf7f0;
  border: 1px solid #d4c9b0;
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.product-card img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border: 1px solid #d4c9b0;
  flex-shrink: 0;
}
.product-info h3 {
  font-size: 1.2rem;
  color: #3d2b1a;
  margin-bottom: 8px;
}
.product-info p {
  font-size: 0.9rem;
  color: #5a3a20;
  line-height: 1.8;
}
.product-price {
  font-size: 1.1rem;
  color: #8B6914;
  font-weight: bold;
  margin-top: 12px;
}
@media (max-width: 600px) {
  .product-card { flex-direction: column; }
  .product-card img { width: 100%; height: auto; }
}

/* 観光スポットページ */
.spot-card {
  background: #faf7f0;
  border: 1px solid #d4c9b0;
  margin-bottom: 32px;
  overflow: hidden;
}
.spot-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}
.spot-card-body {
  padding: 20px 24px;
}
.spot-card-body h3 {
  font-size: 1.2rem;
  color: #3d2b1a;
  margin-bottom: 10px;
}
.spot-card-body p {
  font-size: 0.9rem;
  color: #5a3a20;
  line-height: 1.8;
}
.spot-access {
  font-size: 0.8rem;
  color: #8a7a60;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #d4c9b0;
}

/* 小学校ページ */
.school-notice {
  background: #fff8e8;
  border: 1px solid #d4c9b0;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.student-work {
  background: #faf7f0;
  border: 1px solid #d4c9b0;
  padding: 20px;
  margin-bottom: 16px;
}
.student-work h4 {
  color: #3d2b1a;
  font-size: 1rem;
  margin-bottom: 8px;
}
.student-work p {
  font-size: 0.9rem;
  color: #5a3a20;
  line-height: 1.9;
}
.student-work .author {
  font-size: 0.8rem;
  color: #8a7a60;
  text-align: right;
  margin-top: 8px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  #site-main {
    grid-template-columns: 1fr;
  }
  .footer-inner {
    grid-template-columns: 1fr;
  }
  .nav-inner {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .header-inner {
    flex-wrap: wrap;
  }
}
