/* =============================================
   地震通知 — style.css
   方針: 新聞テロップ風 / グラデーション禁止 / カード禁止 / 絵文字禁止
   ============================================= */

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

:root {
  --bg:        #f7f7f5;
  --surface:   #ffffff;
  --border:    #c8c8c4;
  --text:      #111111;
  --text-mute: #666666;
  --red:       #c8001a;
  --red-mid:   #e85d04;
  --red-low:   #b5800a;
  --green:     #1a6e3a;
  --mono:      'JetBrains Mono', 'Courier New', Courier, monospace;
  --sans:      'Hiragino Kaku Gothic ProN', 'Hiragino Sans', '游ゴシック', 'Yu Gothic',
               'Meiryo', system-ui, sans-serif;
  --header-h:  48px;
}

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  min-height: 100dvh;
}

/* --- ヘッダー ------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--text);
  color: #fff;
  height: var(--header-h);
  border-bottom: 2px solid var(--red);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
}

.site-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-family: var(--sans);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}

.status-dot.connected   { background: #4caf50; }
.status-dot.connecting  { background: #ff9800; }
.status-dot.error       { background: var(--red); }

.status-label {
  font-size: 0.75rem;
  color: #ccc;
  letter-spacing: 0.04em;
}

/* --- メインレイアウト ---------------------------------- */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* --- 通知バナー --------------------------------------- */
.notify-banner {
  background: var(--surface);
  border-left: 3px solid var(--red);
  padding: 12px 16px;
  margin: 20px 0;
  display: none; /* JSで表示切替 */
}

.notify-banner.visible {
  display: block;
}

.banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.banner-text {
  font-size: 0.875rem;
  color: var(--text-mute);
}

.btn-allow {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 6px 16px;
  font-size: 0.875rem;
  font-family: var(--sans);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.btn-allow:hover {
  background: #a50016;
}

.btn-allow:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* --- セクション共通 ------------------------------------ */
.section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-top: 28px;
  margin-bottom: 0;
}

/* --- 最新地震（プライマリ表示） ----------------------- */
.quake-primary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

/* 震度 */
.quake-shindo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  border-right: 1px solid var(--border);
  padding-right: 24px;
}

.shindo-label {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin-bottom: 4px;
}

.shindo-value {
  font-family: var(--mono);
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-mute);
  transition: color 0.2s;
  /* 更新フラッシュはJSでクラス付与 */
}

/* 震度別カラー */
.shindo-value.shindo-7   { color: var(--red); }
.shindo-value.shindo-6   { color: var(--red); }
.shindo-value.shindo-5   { color: var(--red-mid); }
.shindo-value.shindo-4   { color: var(--red-low); }
.shindo-value.shindo-3   { color: var(--text); }

@keyframes shindoFlash {
  0%   { border-left: 3px solid transparent; }
  20%  { border-left: 3px solid var(--red); }
  100% { border-left: 3px solid transparent; }
}

.quake-primary.flash {
  animation: shindoFlash 0.8s ease-out;
}

/* 詳細 */
.quake-details {
  display: flex;
  align-items: center;
}

.quake-dl {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  list-style: none;
  width: 100%;
}

.quake-dl-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px;
  align-items: baseline;
  font-size: 0.875rem;
}

.quake-dl-row dt {
  color: var(--text-mute);
  font-size: 0.75rem;
}

.quake-dl-row dd {
  font-weight: 600;
  font-family: var(--mono);
  font-size: 0.9rem;
}

/* --- 直近リスト --------------------------------------- */
.quake-list {
  list-style: none;
  padding: 0;
}

.quake-list-empty {
  padding: 20px 0;
  color: var(--text-mute);
  font-size: 0.875rem;
}

.quake-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 0 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.quake-item:last-child {
  border-bottom: none;
}

.quake-item-shindo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.3rem;
  text-align: center;
  color: var(--text-mute);
}

.quake-item-shindo.shindo-7 { color: var(--red); }
.quake-item-shindo.shindo-6 { color: var(--red); }
.quake-item-shindo.shindo-5 { color: var(--red-mid); }
.quake-item-shindo.shindo-4 { color: var(--red-low); }
.quake-item-shindo.shindo-3 { color: var(--text); }

.quake-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quake-item-location {
  font-weight: 600;
}

.quake-item-sub {
  color: var(--text-mute);
  font-size: 0.78rem;
}

.quake-item-time {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-mute);
  white-space: nowrap;
  text-align: right;
}

/* --- 震度チップ (凡例用) ------------------------------- */
.shindo-chip {
  display: inline-block;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  width: 40px;
  text-align: center;
  padding: 2px 0;
}

.shindo-chip.shindo-7  { color: var(--red); }
.shindo-chip.shindo-6  { color: var(--red); }
.shindo-chip.shindo-5  { color: var(--red-mid); }
.shindo-chip.shindo-4  { color: var(--red-low); }
.shindo-chip.shindo-3  { color: var(--text); }
.shindo-chip.shindo-12 { color: var(--text-mute); }

/* --- 凡例テーブル ------------------------------------- */
.legend-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.8rem;
}

.legend-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-mute);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.legend-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
  color: var(--text-mute);
}

.legend-table td:first-child {
  white-space: nowrap;
  width: 60px;
}

.legend-table tr:last-child td {
  border-bottom: none;
}

/* --- フッター ----------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  font-size: 0.75rem;
  color: var(--text-mute);
  line-height: 1.8;
}

.site-footer a {
  color: var(--text-mute);
  text-decoration: underline;
}

.footer-note {
  margin-top: 8px;
  color: #aaa;
}

/* --- レスポンシブ ------------------------------------- */
@media (max-width: 480px) {
  .quake-primary {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .quake-shindo-wrap {
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 16px;
    gap: 12px;
  }

  .shindo-value {
    font-size: 2.8rem;
  }

  .quake-dl-row {
    grid-template-columns: 90px 1fr;
  }

  .quake-item {
    grid-template-columns: 36px 1fr auto;
    gap: 0 10px;
  }
}

/* --- モーション軽減 ----------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .quake-primary.flash {
    animation: none;
    border-left: 3px solid var(--red);
  }
}
