/* 皮（Q-783。方針は DESIGN.md。名前と肩書きは企画書 113 の 14.6）。本館の共通の枠・皮は読まない。
   色の値を変えたら node --test tests/colors.test.mjs（地との比・状態の色どうしの離れ）を通す。 */

/* ---------- 変数: 明るい設定 ---------- */
:root {
  /* 地と字 */
  --ground: #f5f7f4;      /* ページの地 */
  --plate: #ffffff;       /* 押す所・帯の箱の地 */
  --ink: #16201b;         /* 字 */
  --ink-2: #47534c;       /* 添えの字（時刻の相対・確認日・数の添え） */
  --rule: #d5ddd7;        /* 行の区切り */
  --rule-strong: #77857c; /* 押す所の縁 */
  --shell: #00674a;       /* 頭の帯（案内板の緑） */
  --shell-ink: #ffffff;
  --shell-ink-2: #cfe6dc;
  --track: #e9eee9;       /* 7 日の帯の地 */
  --weekend: #dbe3dd;     /* 7 日の帯の土日 */
  --focus: #1f5aa6;
  --sel: #cfe1f7;

  /* 状態の色は 3 つ（D623）と、色を持たない「更新できていない」。札は必ず印と字を添える（DESIGN.md の表）
     赤 = 重さ critical・major、琥珀 = minor・unknown・none、青 = 予定（planned。limited も青で札だけ変える。D631） */
  --st-major: #c4122f;  --st-major-ink: #ffffff;
  --st-minor: #d99000;  --st-minor-ink: #16201b;
  --st-plan: #1f5aa6;   --st-plan-ink: #ffffff;
  --st-unverified: #47534c;  /* 塗らない。点線の印と字の色 */

  /* 字 */
  --f-ja: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  --f-num: "Bahnschrift SemiCondensed", "Bahnschrift", "DIN Alternate", "BIZ UDPGothic", sans-serif;
  /* 字体ファイルは配らない（D643）。数字は端末の字体の等幅数字（body の tabular-nums） */
  --fs-xs: 0.8125rem;  /* 13: 確認日・帯の目盛りの曜日 */
  --fs-s: 0.9375rem;   /* 15: 添え・押す所 */
  --fs-m: 1rem;        /* 16: 本文 */
  --fs-l: 1.125rem;    /* 18: 相手の名前・何も無い時の 1 行 */
  --fs-xl: 1.375rem;   /* 22: 見出し（390 幅） */
  --fs-2xl: 1.5rem;    /* 24: 見出し（1280 幅） */
  --lh: 1.6;
  --lh-tight: 1.35;

  /* 間（4 の倍数） */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  /* 押す所と並び */
  --tap: 44px;           /* 押す所の最小（幅も高さも） */
  --tap-gap: 8px;        /* 押す所どうしの間の最小 */
  --gutter: 16px;        /* 左右の余白（390 幅も 1280 幅も） */
  --w-max: 1120px;       /* 中身の最大幅 */
  --name-col: 136px;     /* 1280 幅の行の相手の名前の列 */
  --tl-name: 132px;      /* 7 日の帯の名前の列（820 px 以下は 96px） */
  --radius: 6px;
  --radius-chip: 4px;

  color-scheme: light;
}

/* ---------- 変数: 暗い設定（夜にスマホで） ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #141a17; --plate: #1b231f; --ink: #e9efeb; --ink-2: #a9b6ae;
    --rule: #2c3832; --rule-strong: #77867d;
    --shell: #0c4232; --shell-ink: #f2f7f4; --shell-ink-2: #a8cbbd;
    --track: #222c27; --weekend: #2b3630; --focus: #8fb8ff; --sel: #1d3352;
    --st-major: #ef5a62; --st-major-ink: #1a0608;
    --st-minor: #d59a1c; --st-minor-ink: #1a1405;
    --st-plan: #5d95ea;  --st-plan-ink: #06101f;
    --st-unverified: #a9b6ae;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #141a17; --plate: #1b231f; --ink: #e9efeb; --ink-2: #a9b6ae;
  --rule: #2c3832; --rule-strong: #77867d;
  --shell: #0c4232; --shell-ink: #f2f7f4; --shell-ink-2: #a8cbbd;
  --track: #222c27; --weekend: #2b3630; --focus: #8fb8ff; --sel: #1d3352;
  --st-major: #ef5a62; --st-major-ink: #1a0608;
  --st-minor: #d59a1c; --st-minor-ink: #1a1405;
  --st-plan: #5d95ea;  --st-plan-ink: #06101f;
  --st-unverified: #a9b6ae;
  color-scheme: dark;
}

/* ---------- 地 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-ja);
  font-size: var(--fs-m);
  line-height: var(--lh);
  font-variant-numeric: tabular-nums;
}
::selection { background: var(--sel); color: var(--ink); }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.num { font-family: var(--f-num); font-weight: 600; letter-spacing: 0.01em; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- 頭の帯 ---------- */
.shell { background: var(--shell); color: var(--shell-ink); }
.shell-in {
  max-width: var(--w-max); margin: 0 auto; padding: var(--sp-3) var(--gutter) 0;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2) var(--sp-5);
}
.brand {
  margin: 0; padding-bottom: var(--sp-3);
  font-size: 1.25rem; font-weight: 700; line-height: 1.3; letter-spacing: 0.02em;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3);
}
.brand svg { flex: none; }
.tagline { font-size: var(--fs-xs); font-weight: 400; letter-spacing: 0; color: var(--shell-ink-2); white-space: nowrap; }
.sample-tag {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em;
  border: 1px solid var(--shell-ink-2); border-radius: 3px; padding: 1px 6px;
}
.cols { flex-basis: 100%; display: flex; margin: 0 -2px; }
.cols button {
  appearance: none; background: none; border: 0; cursor: pointer;
  color: var(--shell-ink-2); font: inherit; font-weight: 700;
  min-height: 48px; min-width: var(--tap); padding: 0 18px;
  border-bottom: 4px solid transparent;
}
.cols button[aria-pressed="true"] { color: var(--shell-ink); border-bottom-color: var(--shell-ink); }
.cols button:hover { color: var(--shell-ink); }
.cols button:focus-visible { outline-color: var(--shell-ink); outline-offset: -3px; }

/* ---------- 並び ---------- */
main { max-width: var(--w-max); margin: 0 auto; padding: 0 var(--gutter) var(--sp-7); }
section { margin-top: var(--sp-6); }
h2 { margin: 0 0 var(--sp-3); font-size: var(--fs-2xl); line-height: var(--lh-tight); }
h2 .count { margin-left: 10px; font-family: var(--f-num); font-weight: 700; white-space: nowrap; }
h2 small { margin-left: 10px; font-size: var(--fs-s); font-weight: 400; color: var(--ink-2); white-space: nowrap; }

/* 状態の札（色・印・字の 3 つで 1 つ） */
.state {
  display: inline-flex; align-items: center; gap: 6px; justify-self: start;
  padding: 4px 9px 4px 7px; border-radius: var(--radius-chip);
  font-size: var(--fs-s); font-weight: 700; line-height: 1.3; white-space: nowrap;
}
.state svg { flex: none; }
.state.major { background: var(--st-major); color: var(--st-major-ink); }
.state.minor { background: var(--st-minor); color: var(--st-minor-ink); }
.state.plan, .state.limited { background: var(--st-plan); color: var(--st-plan-ink); }

/* 「いま」と「これから」の行 */
.rows { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.row {
  display: grid; align-items: center;
  grid-template-columns: var(--name-col) var(--row-rest);
  gap: var(--sp-1) 20px; padding: 14px 0; border-bottom: 1px solid var(--rule);
  --row-rest: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1.6fr) auto;   /* 名前・止まる物・区間・リンク */
}
/* 1280 幅の 1 列目（札）は日本語の「大きな障害」に合わせた 136 px。英語は札の字が長く（Q-836 の「Major incident」161 px、くらしの「Scheduled downtime」216 px）、
   次の列に重なった（Q-875）ので、いちばん長い札に合わせて広げる。英語の名前は「英語の名前（日本語の名前）」で長く、名前の列を 1.1 から 1.6 に広げる（Q-875） */
:lang(en) .row { --name-col: 216px; --row-rest: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1.4fr) auto; }
.who { font-size: var(--fs-l); font-weight: 700; line-height: var(--lh-tight); }
/* 英語の画面の日本語の名前（「（三井住友銀行）」）は途中で折らない（1280 幅で「三井住友銀 / 行）」と割れた。Q-875） */
.who [lang="ja"] { white-space: nowrap; }
.col-tag {
  display: inline-block; margin-left: var(--sp-2); padding: 0 5px; vertical-align: 2px;
  font-size: 0.75rem; font-weight: 700; color: var(--ink-2);
  border: 1px solid var(--rule-strong); border-radius: 3px;
}
.when { font-family: var(--f-num); font-weight: 600; font-size: 1.0625rem; line-height: 1.4; }
.when .rel { display: block; font-family: var(--f-ja); font-weight: 400; font-size: 0.875rem; color: var(--ink-2); }
.checked { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--ink-2); }
.go {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); min-width: var(--tap); padding: 0 var(--sp-3);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  font-size: var(--fs-s); font-weight: 700; text-decoration: none; white-space: nowrap;
}
.go:hover { border-color: var(--ink); }

/* 何も無い時の 1 行 */
.calm {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3); margin: 0;
  padding: var(--sp-4) 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule);
  font-size: var(--fs-l); font-weight: 700;
}
.calm svg { flex: none; }
.calm .msg { max-width: calc(100% - 22px - var(--sp-3)); word-break: auto-phrase; text-wrap: pretty; } /* 字が 1 行に収まらない幅でも、印の横で折り返す */
.calm .sub { font-size: var(--fs-s); font-weight: 400; color: var(--ink-2); }

/* 日時を選ぶ所: 押す所 3 つと欄 1 つ */
.pick { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tap-gap); margin: 0 0 var(--sp-4); }
.pick button, .pick input {
  appearance: none; min-height: var(--tap); padding: 0 14px; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--ink);
  background: var(--plate); border: 1px solid var(--rule-strong); border-radius: var(--radius);
}
.pick button:hover, .pick input:hover { border-color: var(--ink); }
.pick button[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.pick input { font-family: var(--f-num); font-weight: 600; font-size: 1.0625rem; padding: 0 10px; min-width: 0; }
.pick .clear { background: none; border-color: transparent; font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }

/* 7 日の帯（「これから」の 1 つだけの図。帯は予定の色だけ） */
.tl { position: relative; margin-bottom: 20px; padding: var(--sp-6) var(--sp-3) var(--sp-2); background: var(--plate); border: 1px solid var(--rule); border-radius: var(--radius); }
.tl-grid { display: grid; grid-template-columns: var(--tl-name) 1fr; row-gap: 6px; align-items: center; }
.tl-name { padding-right: 10px; font-size: var(--fs-s); font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track { position: relative; height: 28px; background: var(--track); border-radius: 3px; overflow: hidden; }
.tl-day { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--rule); }
.tl-day.we { background: var(--weekend); }
.band { position: absolute; top: 4px; bottom: 4px; min-width: 6px; border-radius: 3px; background: var(--st-plan); }
.tl-axis { position: relative; height: 30px; }
.tl-axis > span { position: absolute; top: 6px; padding-left: 4px; font-size: var(--fs-xs); line-height: 1.2; color: var(--ink-2); white-space: nowrap; }
.tl-axis > span.off { display: none; }   /* その日の区間に収まらない印（app.js の fitAxis。D711） */
.tl-axis b { font-family: var(--f-num); font-weight: 600; font-size: var(--fs-s); color: var(--ink); }
.tl-now { position: absolute; top: 10px; bottom: 44px; border-left: 2px dashed var(--ink-2); pointer-events: none; }
.tl-now i { position: absolute; top: 0; left: -1px; transform: translateX(-50%); padding: 4px 6px; border-radius: 3px; background: var(--ink-2); color: var(--ground); font-style: normal; font-size: var(--fs-xs); font-weight: 700; line-height: 1; white-space: nowrap; }

/* 「更新できていない N 件」と「発表なし N 件／公式ページで見る M 件」の 1 行（たたむ） */
.lines { margin-top: 28px; border-top: 1px solid var(--rule); }
.lines details { padding: var(--sp-1) 0; border-bottom: 1px solid var(--rule); } /* 隣の summary との間を 8 px 以上に */
.lines summary {
  list-style: none; cursor: pointer; min-height: 52px;
  display: flex; align-items: center; gap: var(--sp-3); font-weight: 700;
}
.lines summary::-webkit-details-marker { display: none; }
.lines summary .ic { flex: none; }
.lines summary .meta { font-weight: 400; font-size: var(--fs-s); color: var(--ink-2); }
.lines summary .chev { margin-left: auto; flex: none; color: var(--ink-2); transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.lines details[open] summary .chev { transform: rotate(180deg); }
.unverified summary .ic { color: var(--st-unverified); }
.links { list-style: none; margin: var(--sp-2) 0 var(--sp-3); padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 var(--sp-5); }
.links a { border-top: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: var(--tap); text-decoration: none; }
.links a:hover span:first-child { text-decoration: underline; }
.links .k { font-size: var(--fs-xs); color: var(--ink-2); }

/* 脚 */
footer {
  max-width: var(--w-max); margin: 0 auto; padding: 20px var(--gutter) 40px;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--tap-gap) 20px;
  font-size: 0.875rem; color: var(--ink-2);
}
footer a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--ink); }
footer a[hreflang] { min-width: var(--tap); justify-content: center; }   /* 言葉の切り替え（Q-836）。「日本語」の 3 字は幅 42 px で 44 に届かなかった */

/* ---------- 英語の 821〜1099 px: 行を 4 段に積む（下の 820 px 以下と同じ並び）。英語の名前は長く、5 列では名前の列が 96〜177 px になり 5〜8 行に折れた（Q-875） ---------- */
@media (min-width: 821px) and (max-width: 1099px) {
  :lang(en) .row { grid-template-columns: auto 1fr; grid-template-areas: "state when" "who who" "what what" "go go"; gap: 6px var(--sp-3); padding: var(--sp-4) 0; }
  :lang(en) .row .state { grid-area: state; }
  :lang(en) .row .when { grid-area: when; justify-self: end; text-align: right; }
  :lang(en) .row .when .nw, :lang(en) .row .when .rel { display: inline-block; }
  :lang(en) .row .when .rel { margin-left: 6px; }
  :lang(en) .row .who { grid-area: who; }
  :lang(en) .row .what { grid-area: what; }
  :lang(en) .row .go-cell { grid-area: go; }
}

/* ---------- 390 幅（820 px 以下）: 行を 4 段に積む ---------- */
@media (max-width: 820px) {
  :root { --tl-name: 96px; }
  h2 { font-size: var(--fs-xl); }
  .row {
    grid-template-columns: auto 1fr;
    grid-template-areas: "state when" "who who" "what what" "go go";
    gap: 6px var(--sp-3); padding: var(--sp-4) 0;
  }
  .row .state { grid-area: state; }
  .row .when { grid-area: when; justify-self: end; text-align: right; }
  .row .when .rel { display: inline; margin-left: 6px; }
  /* 英語の区間（Fri, Nov 20, 11:00 PM–Sat, Nov 21, 1:00 AM）は「–」の後ろと経過の前で折れず、390 幅であふれた（Q-836）。
     英語だけ、区間の片側と経過を 1 つずつの箱にして、その間で折れるようにする（日本語の並びは変えない） */
  :lang(en) .row .when .nw, :lang(en) .row .when .rel { display: inline-block; }
  .row .who { grid-area: who; }
  .row .what { grid-area: what; }
  .row .go-cell { grid-area: go; }
  .tl-name { font-size: var(--fs-xs); padding-right: 6px; }
  .tl-axis { height: 40px; }
  .tl-axis > span { top: 4px; padding-left: 3px; font-size: 0.75rem; }
  .tl-axis .wk { display: block; }
  .cols button { padding: 0 14px; }
  .brand { padding-bottom: var(--sp-1); }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
@media (forced-colors: active) {
  .state, .band { forced-color-adjust: none; border: 1px solid CanvasText; }
}

/* たたんだ一覧の中の見出し（「発表なし」と「公式ページで見る」。D622・D634） */
.links-h { margin: var(--sp-3) 0 0; font-size: var(--fs-s); font-weight: 700; color: var(--ink-2); }
.lines summary .sep { margin: 0 var(--sp-1); color: var(--ink-2); font-weight: 400; }
.lines summary .seg, .when .rel { white-space: nowrap; }

/* ---------- 入口の 1 枚（site/index.html。Q-772） ---------- */
[hidden] { display: none !important; }
.sample-tag, .sample-only { display: none; }
body.is-sample .sample-tag, body.is-sample .sample-only { display: inline-block; }
body.loading .after-load, body.failed .after-load { display: none; }   /* 読めなかった時は、動かない押す所と空の数を出さない（Q-813） */
.pick input.on { border-width: 2px; border-color: var(--ink); }
.tl-day.first { border-left: 0; }
.band.open { border-top-right-radius: 0; border-bottom-right-radius: 0; }
/* いまと選んだ日時の線は、帯の列（名前の列の右）の上に重ねる */
.tl-over { position: absolute; top: 10px; bottom: 38px; left: calc(var(--sp-3) + var(--tl-name)); right: var(--sp-3); pointer-events: none; container-type: inline-size; }
.tl-over .tl-now { top: 0; bottom: 0; left: 0; }
.tl-at { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--ink); }
/* 選んだ日時の印は線の真ん中に置き、右の端に近い時は、帯の列の右端（.tl-over の右）を越えない所まで左へ寄せる。--room は線から右端までの %（app.js。D711） */
.tl-at i { position: absolute; top: 0; left: -1px; transform: translateX(min(-50%, calc(var(--room, 100) * 1cqw - 1px - 100%))); padding: 4px 6px; border-radius: 3px; background: var(--ink); color: var(--ground); font-style: normal; font-family: var(--f-num); font-size: var(--fs-xs); font-weight: 700; line-height: 1; white-space: nowrap; }
footer .theme, .calm .again {
  appearance: none; min-height: var(--tap); min-width: var(--tap); padding: 0 var(--sp-3); cursor: pointer;
  font: inherit; color: var(--ink); background: var(--plate); border: 1px solid var(--rule-strong); border-radius: var(--radius);
}
.calm .again { font-size: var(--fs-s); }
footer .theme:hover, .calm .again:hover { border-color: var(--ink); }
@media (max-width: 820px) { .tl-over { bottom: 48px; } }
.when .nw, .lines .meta .nw { white-space: nowrap; }
