/* サービス終了・生産終了まとめ：公開画面 */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1c1f23;
  --muted: #5b6370;
  --border: #d9dde3;
  --accent: #1f4e8c;
  --accent-bg: #e9f0f9;
  --notice-bg: #fff8e1;
  --notice-border: #e6c65c;
  --radius: 6px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #7aa7e0;
  outline-offset: 2px;
}

.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--surface); padding: 8px 12px; }
.skip-link:focus { left: 8px; top: 8px; z-index: 10; }

/* ヘッダー */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 14px; padding-bottom: 14px; }
.site-title { font-size: 1.25rem; font-weight: 700; color: var(--text); text-decoration: none; }
.site-tagline { margin: 0; font-size: 0.85rem; color: var(--muted); }
.lang-switch { display: flex; gap: 4px; }
.lang-switch a { padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; text-decoration: none; color: var(--text); background: var(--surface); }
.lang-switch a[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* .container の padding 指定に負けないよう main.container で指定する */
main.container { padding-top: 24px; padding-bottom: 40px; }

h1 { font-size: 1.6rem; line-height: 1.4; margin: 0 0 12px; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; line-height: 1.5; margin: 0 0 8px; }


.muted { color: var(--muted); }
.hint { margin: 0 0 6px; font-size: 0.85rem; color: var(--muted); }

/* 入力欄・ボタン（絞り込みで使う） */
.field { margin: 14px 0 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend { display: block; padding: 0; margin-bottom: 4px; font-size: 0.9rem; font-weight: 700; }
input[type="search"], input[type="text"], input[type="password"], input[type="url"], select, textarea {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid #aab1bc; border-radius: var(--radius);
}
.check-list { max-height: 190px; overflow-y: auto; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: #fafbfc; }
.check-list.short { max-height: none; }
.check-list label { display: block; padding: 3px 0; font-size: 0.93rem; }
.check-list .count { color: var(--muted); font-size: 0.85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.button { display: inline-block; padding: 8px 16px; font: inherit; font-size: 0.95rem; line-height: 1.5; text-decoration: none; cursor: pointer;
  color: var(--text); background: var(--surface); border: 1px solid #aab1bc; border-radius: var(--radius); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.danger { background: #b3261e; border-color: #b3261e; color: #fff; }

.empty { padding: 32px 16px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 1px 9px; font-size: 0.82rem; border: 1px solid var(--border); border-radius: 999px; background: #f7f8fa; }
.tag.country { display: inline-flex; align-items: center; gap: 5px; background: var(--accent-bg); border-color: #c5d6ec; }
/* 国名の前の国旗 */
.flag { flex: none; width: 20px; height: 15px; object-fit: cover; border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 2px; }
.tag.muted { background: transparent; border-style: dashed; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============ 一覧：年表の形（上が新しい。左に日付、右にカード） ============ */
.timeline { position: relative; max-width: 880px; margin: 0 auto; padding: 0; list-style: none; }
/* 日付をつなぐ縦線 */
.timeline::before { content: ""; position: absolute; left: 43px; top: 8px; bottom: 0; width: 2px; background: var(--border); }
.tl-item { position: relative; display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 20px; padding-bottom: 18px; }

/* 日付（カレンダー風）。スクロール中は、その日のカードが見えている間、画面の上に残る */
.cal { position: sticky; top: 12px; width: 88px; overflow: hidden; text-align: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.cal-top { display: block; min-height: 8px; padding: 1px 0; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; color: #fff; background: var(--accent); }
.cal-main { display: block; padding-top: 4px; font-size: 2rem; font-weight: 800; line-height: 1.2; }
.cal-sub { display: block; padding-bottom: 6px; font-size: 0.8rem; color: var(--muted); }
.cal-main:last-child { padding-bottom: 8px; }
/* 同じ日付が続くとき：2件目からは日付を出さず、縦線の上に点だけ置く */
.tl-item.same-date .cal { display: none; }
.tl-item.same-date .tl-date::before { content: ""; position: absolute; left: 38px; top: 26px; width: 12px; height: 12px;
  background: var(--surface); border: 2px solid #aab1bc; border-radius: 50%; }
.tl-date { position: relative; }

/* カード */
.card { position: relative; overflow: hidden; min-height: 132px; background: var(--surface);
  border: 1px solid var(--border); border-left: 6px solid #c3c9d2; border-radius: 10px; }
/* 右側の業種のアイコン：右端がいちばん濃く、左へ行くほど白くなる */
.card-art { position: absolute; top: 0; right: 0; bottom: 0; width: 240px; max-width: 55%; display: flex; align-items: center; justify-content: flex-end;
  padding: 10px 14px 10px 0; color: #7f8a9a; pointer-events: none;
  -webkit-mask-image: linear-gradient(to left, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.12) 60%, transparent);
  mask-image: linear-gradient(to left, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.12) 60%, transparent); }
.card-art svg { height: 100%; max-height: 150px; width: auto; aspect-ratio: 1; }
.card-body { position: relative; padding: 14px 20px 16px; }
.card-org { margin: 0 0 2px; font-size: 1.2rem; line-height: 1.45; overflow-wrap: anywhere; }
/* 企業・組織名（見出しが商品名・サービス名のとき、その下に出す） */
.card-company { margin: 0 0 6px; font-size: 0.95rem; color: var(--muted); overflow-wrap: anywhere; }
/* 終了日の行：「終了日」＋日付＋状態（あと〇日／終了済み） */
.count-label { font-size: 0.88rem; color: var(--muted); }
.card-count { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 0 0 10px; }
.count-num { font-size: 1.3rem; font-weight: 800; line-height: 1.3; }
.count-unit { font-weight: 700; margin-left: -4px; }
.count-est { align-self: center; padding: 0 8px; font-size: 0.82rem; line-height: 1.6; border: 1px solid currentColor; border-radius: 4px; color: var(--muted); }
.count-exact, .count-target, .count-unknown { font-size: 0.88rem; color: var(--muted); }
.count-target::before { content: "／ "; }
.card-meta { margin: 8px 0 0; font-size: 0.86rem; color: var(--muted); }

/* 終了日が近いほど目立たせる（tier-0 終了日が未定 / 1 終了済み / 2 まだ先 / 3 90日以内 / 4 30日以内） */
.tier-1 { border-left-color: #93a4bb; }
.tier-1 .count-num { color: var(--muted); }
.tier-2 { border-left-color: var(--accent); }
.tier-2 .count-num { font-size: 1.6rem; color: var(--accent); }
.tier-2 .count-est { color: var(--accent); }
.tier-3 { border-left-width: 8px; border-left-color: #d97706; }
.tier-3 .count-num { font-size: 1.8rem; color: #b45309; }
.tier-3 .count-est { color: #b45309; font-weight: 700; }
.tier-3 .card-art { color: #b98a52; }
.tier-4 { border-left-width: 10px; border-left-color: #b3261e; box-shadow: 0 4px 16px rgba(179, 38, 30, 0.16); }
.tier-4 .card-body { padding: 18px 22px 20px; }
.tier-4 .card-org { font-size: 1.4rem; }
.tier-4 .count-num { font-size: 2.1rem; color: #b3261e; }
.tier-4 .count-est { color: #fff; background: #b3261e; border-color: #b3261e; font-weight: 700; }
.tier-4 .card-art { color: #bb625c; }

/* 続きの読み込み */
.load-more { margin: 4px 0 0; text-align: center; }
#load-more.loading { pointer-events: none; opacity: 0.6; }

/* ============ 絞り込み：画面の右端から出ている虫眼鏡のつまみを押すと、右から出てくる ============ */
/* つまみ：左側だけ丸い形（「つ」を左右逆にした形）で、右端にくっついている */
.filter-fab { position: fixed; right: 0; top: 50%; z-index: 21; display: flex; align-items: center; justify-content: center;
  width: 52px; height: 64px; margin-top: -32px; padding-left: 4px; color: #fff; background: var(--accent);
  border-radius: 32px 0 0 32px; box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.25); cursor: pointer; list-style: none;
  transition: right 0.22s ease-out; }
.filter-fab::-webkit-details-marker { display: none; }
/* 絞り込み中は、つまみの左上に印を付ける */
.filter-fab.active::after { content: ""; position: absolute; top: 6px; left: 8px; width: 12px; height: 12px;
  background: #f59e0b; border: 2px solid #fff; border-radius: 50%; }
/* 絞り込みの画面：つまみと同じ色で、右端から出てくる。開くと、つまみは画面の左端にくっついて一緒に動く */
.filter-sheet { position: fixed; right: 0; top: 50%; z-index: 20; width: min(340px, calc(100vw - 64px)); max-height: min(84vh, 720px);
  overflow-y: auto; padding: 16px 18px 18px; color: #fff; background: var(--accent); border-radius: 16px 0 0 16px;
  box-shadow: -6px 6px 24px rgba(0, 0, 0, 0.28); transform: translateY(-50%); }
.filter-dock[open] .filter-fab { right: min(340px, calc(100vw - 64px)); box-shadow: -4px 2px 8px rgba(0, 0, 0, 0.18); }
.filter-dock[open] .filter-sheet { animation: sheet-slide 0.22s ease-out; }
@keyframes sheet-slide { from { transform: translate(100%, -50%); } to { transform: translate(0, -50%); } }
@media (prefers-reduced-motion: reduce) {
  .filter-fab { transition: none; }
  .filter-dock[open] .filter-sheet { animation: none; }
}
.filter-title { margin: 0; font-weight: 700; }
/* 濃い背景の上なので、文字は白、入力欄と選択肢は白地にする */
.filter-sheet .field > label, .filter-sheet .field > legend { color: #fff; }
.filter-sheet .check-list { color: var(--text); background: #fff; border-color: transparent; }
.filter-sheet input[type="search"], .filter-sheet select { border-color: transparent; }
.filter-sheet .button { color: #fff; background: transparent; border-color: rgba(255, 255, 255, 0.7); }
.filter-sheet .button.primary { color: var(--accent); background: #fff; border-color: #fff; font-weight: 700; }
.filter-sheet a:focus-visible, .filter-sheet button:focus-visible, .filter-sheet input:focus-visible, .filter-sheet select:focus-visible,
.filter-fab:focus-visible { outline-color: #ffd58a; }
.check-all { float: right; font-weight: 400; }
.check-all button { padding: 0 4px; font: inherit; font-size: 0.8rem; color: #fff; background: none; border: 0; text-decoration: underline; cursor: pointer; }

@media (max-width: 600px) {
  .timeline::before { left: 28px; }
  .tl-item { grid-template-columns: 58px minmax(0, 1fr); gap: 12px; }
  .cal { width: 58px; }
  .cal-top { font-size: 0.68rem; }
  .cal-main { font-size: 1.35rem; }
  .tl-item.same-date .tl-date::before { left: 23px; }
  .card-art { width: 150px; }
  .card-art svg { max-height: 110px; }
  .card-body { padding: 12px 14px 14px; }
  .tier-4 .card-body { padding: 16px 16px 18px; }
  .tier-3 .count-num { font-size: 1.5rem; }
  .tier-4 .count-num { font-size: 1.7rem; }
  .tier-4 .card-org { font-size: 1.3rem; }
}

/* ページネーション */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.pagination a, .pagination span { min-width: 40px; padding: 7px 12px; text-align: center; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.pagination .gap { border: 0; background: transparent; min-width: 0; padding: 7px 2px; }

.message-page { max-width: 640px; padding: 32px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

/* 将来の広告枠（現在は未使用。使うときに hidden 属性を外す） */
.ad-slot { min-height: 100px; margin: 24px 0; border: 1px dashed var(--border); border-radius: var(--radius); }

/* フッター */
.site-footer { padding: 20px 0 32px; border-top: 1px solid var(--border); background: var(--surface); font-size: 0.85rem; color: var(--muted); }
.site-footer p { margin: 0 0 4px; }
