/* =========================================
   TOKENS
   ========================================= */
:root {
  --bg: #020617;
  --bg-soft: #0b1120;
  --card-bg: #020617;

  --text-main: #e5e7eb;
  --text-sub: #9ca3af;

  --border-soft: rgba(148,163,184,0.35);

  --accent-local: #38bdf8;
  --accent-road: #eab308;
  --accent-highway: #f97373;

  --radius-card: 18px;
  --shadow-card: none;
}

/* =========================================
   BASE
   ========================================= */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans JP", system-ui, -apple-system,
               BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI",
               sans-serif;
  font-size: 16px;
  line-height: 1.7;
  background: radial-gradient(circle at top, #0b1120 0, #020617 55%, #020617 100%);
  color: var(--text-main);
}

a {
  color: var(--accent-local);            /* 目に入るリンク色（現地アクセント） */
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;        /* ホバーで少し太く */
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 56px;
}

/* =========================================
   TYPOGRAPHY UTILITIES（font指定はここだけ）
   ========================================= */
.text-heading {
  font-weight: 600;
}

.text-body {
  font-weight: 400;
}

.text-num {
  font-family: "IBM Plex Sans", "IBM Plex Sans JP", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum", "lnum";
}

.text-xs { font-size: 0.85rem; }
.text-sm { font-size: 1.00rem; }
.text-md { font-size: 1.25rem; }
.text-lg { font-size: 1.50rem; }

.text-muted {
  color: var(--text-sub);
}

/* =========================================
   HEADER（サイトタイトル・ナビ）
   ========================================= */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;

  padding: 0.6rem 1rem;
  margin-bottom: 1.5rem;

  border-radius: 24px;
  border: 1px solid rgba(148,163,184,0.35);

  background:
    linear-gradient(
      120deg,
      rgba(15,23,42,0.40),
      rgba(15,23,42,0.20)
    ),
    url("back5.jpg") center center / cover no-repeat;

  box-shadow: 0 10px 24px rgba(0,0,0,0.55);
  color: #f9fafb;

  position: sticky;
  top: 8px;
  z-index: 20;
}

.site-header::before {
  content: none;
}

.site-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.site-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.site-subtitle {
  font-size: 0.75rem;
  color: rgba(226,232,240,0.95);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.nav-link {
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.5);
  padding: 4px 10px;
  font-size: 0.75rem;
  background: rgba(15,23,42,0.8);
  color: #e5e7eb;
  cursor: pointer;
  white-space: nowrap;

  display: inline-flex;
  align-items: center;
  gap: 0.35rem;

  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}

.nav-link::before {
  content: "●";
  font-size: 0.55rem;
}

.nav-link:hover {
  background: rgba(37,99,235,0.95);
  border-color: rgba(191,219,254,0.85);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    border-radius: 18px;
  }
  .site-nav {
    justify-content: flex-start;
  }
}

/* =========================================
   SECTION / GRID
   ========================================= */
.section {
  margin-bottom: 32px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.grid {
  display: grid;
  gap: 14px;
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =========================================
   CARD
   ========================================= */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-soft);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-card);
}

.card--local {
  border-color: rgba(56,189,248,0.8);
}
.card--road {
  border-color: rgba(250,204,21,0.85);
}
.card--highway {
  border-color: rgba(248,113,113,0.85);
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}

.card-body {
  margin-top: 4px;
}

.card-footer {
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--text-sub);
}

/* カード上部の小さなラベル */
.card-type {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;

  padding: 0.12rem 0.7rem;
  border-radius: 999px;

  font-size: 0.72rem;
  border: 1px solid var(--border-soft);
  background: rgba(15,23,42,0.9);
  color: var(--text-muted);

  white-space: nowrap;
}

/* 現地カメラの 2 段目グリッドの上に余白を入れる */
#still .grid + .grid {
  margin-top: 20px;
}

/* =========================================
   HERO
   ========================================= */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr);
  gap: 20px;
  margin-bottom: 32px;
}
.hero-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hero-meta {
  margin-top: auto;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =========================================
   media (YouTube 等)
   ========================================= */
.media-16x9 {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #000;
}
.media-16x9 lite-youtube,
.media-16x9 iframe,
.media-16x9 img {
  width: 100%;
  height: 100%;
  display: block;
}

/* =========================================
   BADGE / PILL
   ========================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;

  padding: 0.15rem 0.7rem;
  border-radius: 999px;

  font-size: 0.75rem;
  border: 1px solid var(--border-soft);
  background: rgba(15,23,42,0.9);
  color: var(--text-muted);

  white-space: nowrap;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* IP 情報 */
.ip-info {
  margin: 4px 0 8px;
}
.ip-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
}
.ip-ipv4 {
  background: rgba(59,130,246,0.12);
  border-color: rgba(59,130,246,0.7);
  color: #bfdbfe;
}
.ip-ipv6 {
  background: rgba(22,163,74,0.12);
  border-color: rgba(22,163,74,0.7);
  color: #bbf7d0;
}

/* ライブ用バッジ：先頭に赤丸 */
.badge-live {
  position: relative;
}

.badge-live::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: #f97373;                          /* 赤丸 */
  box-shadow: 0 0 0 2px rgba(248,113,113,0.45); /* うっすらグロー */
  margin-right: 0.4rem;
}

/* =========================================
   OBS（観測・予報テーブル共通）
   ========================================= */
.obs-block {
  margin-top: 4px;
}

.obs-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

/* テーブル本体：観測・JMA・OWM 共通 */
.obs-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(31, 41, 55, 0.85);
  border-radius: 10px;
  overflow: hidden;
}

/* 2行目以降の横線 */
.obs-table tr + tr {
  border-top: 1px solid rgba(148,163,184,0.3);
}

/* 共通セル */
.obs-table th,
.obs-table td {
  padding: 4px 8px;
  vertical-align: baseline;
  font-variant-numeric: tabular-nums;
}

/* 左側：項目名 */
.obs-table th {
  text-align: left;
  color: var(--text-sub);
  white-space: nowrap;
}

/* 右側：値（観測データ用：末尾のメイン数値に合わせて整列） */
.obs-value {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 8px;
  text-align: right;
}

/* 予報テーブルのヘッダ下にラインだけ付けたいとき用（任意） */
.obs-table--forecast thead tr th {
  border-bottom: 1px solid rgba(148,163,184,0.4);
}

/* メインの大きな数値用 */
.obs-main-number {
  font-size: 1.6rem;
  font-weight: 700;
}

/* 補足テキスト（カッコ書きなど） */
.obs-subtext {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--text-sub);
}

/* 上昇・下降矢印（気温・気圧用） */
.num-up {
  color: #f87171;
  font-weight: 600;
}
.num-down {
  color: #4ade80;
  font-weight: 600;
}

/* =======================================
   Netatmo 観測パネルがカードからはみ出さないようにする
   （スマホ + PC表示 / タブレット共通）
   ======================================= */

#netatmo .new-obs-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;   /* どうしても狭いときはパネル内だけ横スクロール */
}

/* パネル内テーブルの横幅をカードにフィットさせる */
#netatmo .new-obs-card table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
}

/* 念のため、パネル内画像もはみ出さないように */
#netatmo .new-obs-card img {
  max-width: 100%;
  height: auto;
  display: block;
}


/* =========================================
   FOOTER
   ========================================= */
.footer {
  margin-top: 32px;
  padding-top: 12px;
  border-top: 1px solid rgba(55,65,81,0.9);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-sub);
}
@media (max-width: 768px) {
  .footer {
    flex-direction: column;
  }
}

/* -----------------------------------------
   スマホ向け：obs / 予報テーブルのはみ出し対策
   ----------------------------------------- */
@media (max-width: 600px) {

  /* テーブル幅をカードの中に収める */
  .obs-table {
    table-layout: fixed;   /* 最小幅ではなく、枠に合わせて列を割り振る */
    max-width: 100%;
  }

  .obs-table th,
  .obs-table td {
    padding: 3px 4px;      /* ほんの少しパディングを詰める */
    font-size: 0.8rem;     /* 1段階だけ文字を小さく */
  }

  /* ラベルを折り返し可能にする（夏 obs / JMA / OWM 共通） */
  .obs-table th {
    white-space: normal;
  }
}

