/* エンドボードの皮（Q-1109。企画書 119 の 3・6 章）。骨格はストップボード（infra-dashboard の site/style.css）と同じ:
   頭の帯・脚・字の大きさ・間・行の形。替えたのは頭の帯の色 1 つ（ストップボードの案内板の緑 #00674a の対で、期限の赤茶）。
   本館の共通の枠・皮は読まない。広告の枠の規則は置かない（D833）。
   色の値を変えたら node --test tests/colors.test.js（地と字の比）を通す。 */

/* ---------- 変数: 明るい設定 ---------- */
:root {
  --ground: #f7f5f3;      /* ページの地 */
  --plate: #ffffff;       /* 押す所・表の地 */
  --ink: #201a16;         /* 字 */
  --ink-2: #544a43;       /* 添えの字（印・版の一覧を確かめた日） */
  --rule: #ddd6d0;        /* 行の区切り */
  --rule-strong: #857870; /* 押す所の縁 */
  --shell: #8c3a12;       /* 頭の帯（期限の赤茶。ストップボードの緑の対） */
  --shell-ink: #ffffff;
  --shell-ink-2: #f3d9c9;
  --bar: #8c3a12;         /* 版の帯（サポートの区間） */
  --bar-ext: #d9a07c;     /* 延長の区間 */
  --track: #ece7e2;       /* 帯の地 */
  --focus: #1f5aa6;
  --sel: #f5dccb;

  --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;
  --fs-xs: 0.8125rem;  /* 13 */
  --fs-s: 0.9375rem;   /* 15 */
  --fs-m: 1rem;        /* 16 */
  --fs-l: 1.125rem;    /* 18: 製品の名前 */
  --fs-xl: 1.375rem;   /* 22: 見出し（375 幅） */
  --fs-2xl: 1.5rem;    /* 24: 見出し（1280 幅） */
  --lh: 1.6;
  --lh-tight: 1.35;

  --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;
  --w-max: 1120px;
  --radius: 6px;
  --radius-chip: 4px;

  color-scheme: light;
}

/* ---------- 変数: 暗い設定 ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #1a1614; --plate: #231e1b; --ink: #efe9e5; --ink-2: #b9aea7;
    --rule: #3a322d; --rule-strong: #8a7d75;
    --shell: #5a250b; --shell-ink: #fbf3ee; --shell-ink-2: #e7c3ad;
    --bar: #e08a5a; --bar-ext: #7a4a30; --track: #2d2622;
    --focus: #8fb8ff; --sel: #4a2a18;
    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; }
[hidden] { display: none !important; }
time { font-family: var(--f-num); font-weight: 600; letter-spacing: 0.01em; }

/* ---------- 頭の帯 ---------- */
.shell { background: var(--shell); color: var(--shell-ink); }
.shell-in {
  max-width: var(--w-max); margin: 0 auto; padding: var(--sp-3) var(--gutter);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-5);
}
.brand {
  margin: 0;
  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 a { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); text-decoration: none; }
.brand svg { flex: none; }
.brand a:focus-visible { outline-color: var(--shell-ink); }
.tagline { font-size: var(--fs-xs); font-weight: 400; letter-spacing: 0; color: var(--shell-ink-2); white-space: nowrap; }

/* ---------- 並び ---------- */
main { max-width: var(--w-max); margin: 0 auto; padding: var(--sp-5) var(--gutter) var(--sp-7); }
h1 { margin: 0 0 var(--sp-4); font-size: var(--fs-2xl); line-height: var(--lh-tight); }
h2 { margin: 0 0 var(--sp-3); font-size: var(--fs-xl); line-height: var(--lh-tight); }

/* ---------- 入口: ジャンルの切り替え ---------- */
.eb-genres { display: flex; flex-wrap: wrap; gap: var(--tap-gap); margin: 0 0 var(--sp-5); }
.eb-genres button {
  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);
}
.eb-genres button:hover { border-color: var(--ink); }
.eb-genres button[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }

/* ---------- 入口: 月ごとの並び ---------- */
.eb-month, .eb-picked { margin-top: var(--sp-6); }
.eb-month:first-of-type { margin-top: 0; }
.eb-rows { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.eb-row {
  display: grid; align-items: center;
  grid-template-columns: 7.5em minmax(0, 1fr) minmax(6em, 16em) auto var(--tap);   /* 日付・名前・版・印・☆ */
  gap: var(--sp-1) 20px; padding: 6px 0; border-bottom: 1px solid var(--rule);
  min-height: 56px;
}
.eb-date time { font-size: 1.0625rem; }
.eb-name { font-size: var(--fs-l); font-weight: 700; line-height: var(--lh-tight); display: inline-flex; align-items: center; min-height: var(--tap); }
.eb-ver { font-family: var(--f-num); font-weight: 600; overflow-wrap: anywhere; }
.eb-ext { font-family: var(--f-ja); font-weight: 400; font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap; }
.eb-mark {
  display: inline-block; padding: 1px 6px; justify-self: start;
  font-size: var(--fs-xs); font-weight: 700; color: var(--ink-2); white-space: nowrap;
  border: 1px solid var(--rule-strong); border-radius: 3px;
}
.eb-pick {
  appearance: none; width: var(--tap); height: var(--tap); cursor: pointer; padding: 0;
  background: none; border: 1px solid transparent; border-radius: var(--radius); color: var(--ink-2);
  font-size: 1.375rem; line-height: 1;
}
.eb-pick::before { content: "\2606"; }               /* ☆ */
.eb-pick[aria-pressed="true"] { color: var(--shell); }
.eb-pick[aria-pressed="true"]::before { content: "\2605"; } /* ★ */
.eb-pick:hover { border-color: var(--rule-strong); }

/* ---------- 製品のページ（src/page.js の productPage） ---------- */
.eb-card {
  margin: 0 0 var(--sp-5); padding: var(--sp-4); background: var(--plate);
  border: 1px solid var(--rule); border-radius: var(--radius);
  display: grid; grid-template-columns: 9em 1fr; gap: var(--sp-2) var(--sp-4);
}
.eb-card dt { font-weight: 700; color: var(--ink-2); }
.eb-card dd { margin: 0; }
.eb-card dd p { margin: 0; }
.eb-card dd p + p { margin-top: var(--sp-2); }
.eb-card .eb-mark { margin-left: var(--sp-1); }
.eb-formula { display: inline-block; margin-left: var(--sp-1); font-size: var(--fs-s); color: var(--ink-2); }

.eb-versions { width: 100%; border-collapse: collapse; margin: 0 0 var(--sp-5); border-top: 2px solid var(--ink); }
.eb-versions th, .eb-versions td { padding: 8px 10px 8px 0; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.eb-versions thead th { font-size: var(--fs-s); color: var(--ink-2); white-space: nowrap; }
.eb-versions tbody th { font-family: var(--f-num); font-weight: 700; }
.eb-bar-head, .eb-bar-cell { position: relative; width: 38%; min-width: 120px; }
.eb-bar-cell { height: 32px; background: linear-gradient(var(--track), var(--track)) center / 100% 14px no-repeat; }
.eb-bar, .eb-bar-ext { position: absolute; top: 50%; height: 14px; transform: translateY(-50%); min-width: 3px; }
.eb-bar { background: var(--bar); border-radius: 3px; }
.eb-bar-open { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.eb-bar-ext { background: var(--bar-ext); border-radius: 0 3px 3px 0; }
.eb-today { position: absolute; top: 6px; bottom: 6px; border-left: 2px dashed var(--ink-2); pointer-events: none; }   /* きょうの位置（見出しの行の帯の列に 1 本） */

.eb-changes { margin: 0 0 var(--sp-5); }
.eb-changes ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.eb-changes li { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.eb-change-version { font-family: var(--f-num); font-weight: 700; }
.eb-ics a, .eb-sources a { display: inline-flex; align-items: center; min-height: var(--tap); }
.eb-ics a { font-weight: 700; }
.eb-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 0 20px; font-size: var(--fs-s); }
.eb-checked { 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); border-top: 1px solid var(--rule);
}
footer a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--ink); }

/* ---------- 820 px 以下: 行を 2 段に積む ---------- */
@media (max-width: 820px) {
  h1 { font-size: var(--fs-xl); }
  .eb-row {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "date mark pick" "name name pick" "ver ver pick";
    gap: 0 var(--sp-3); padding: var(--sp-2) 0;
  }
  .eb-date { grid-area: date; }
  .eb-mark { grid-area: mark; }
  .eb-name { grid-area: name; }
  .eb-ver { grid-area: ver; }
  .eb-pick { grid-area: pick; align-self: center; }
  .eb-card { grid-template-columns: 1fr; gap: var(--sp-1); }
  .eb-card dd + dt { margin-top: var(--sp-2); }
  .eb-bar-head, .eb-bar-cell { display: none; }   /* 375 幅は表を読む形を先に（帯は 821 px から） */
  .eb-versions th, .eb-versions td { padding-right: 6px; font-size: var(--fs-s); }
  .eb-versions time { white-space: nowrap; font-size: var(--fs-xs); }   /* 日付を途中で折らない（375 幅で「2026- / 11-09」と割れた） */
  .eb-versions tbody th { overflow-wrap: anywhere; font-size: var(--fs-xs); }   /* 長い版の番号（Teams）は版の列の中で折る */
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
@media (forced-colors: active) {
  .eb-bar, .eb-bar-ext { forced-color-adjust: none; border: 1px solid CanvasText; }
}
