/* 底値帳
   考え方: スーパーの売場。品目ごとに案内板の色(config.toml の color → --cat)を持ち、
   値段は黄色い棚札、底値は朱のハンコ。説明の文章は置かず、色と数字で読ませる。 */

:root {
  --paper: #ffffff;
  --ink: #1b2430;        /* 墨: 文字と実質価格の線 */
  --ink-soft: #5b6675;   /* 補足の文字 */
  --rule: #c9d6e3;       /* 罫線: 行の区切りだけに使う */
  --tag: #ffd60a;        /* 棚札の黄 */
  --tag-ink: #1b2430;
  --shu: #d7261e;        /* 朱: 底値のハンコと底値ライン */
  --price-line: #9aa5b1;
  --pr-bg: #eef3f8;

  --sans: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", sans-serif;
  --num: "Barlow Condensed", "BIZ UDPGothic", sans-serif;
  --hand: "Yusei Magic", "BIZ UDPGothic", sans-serif;  /* マーカーの手書き字: 題字・見出し・札の名前・ハンコ */
  --buy: #d7261e;
  /* 鉛筆で引いたような、少し揺れた線(見出しの下とヘッダーの区切り) */
  --pencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='6' viewBox='0 0 240 6'%3E%3Cpath d='M1 3.2 C 30 1.6, 60 4.6, 92 3 S 150 1.8, 182 3.4 S 226 4.2, 239 2.6' fill='none' stroke='%231b2430' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161c24;
    --ink: #e6ebf1;
    --ink-soft: #9aa6b4;
    --rule: #2f3b49;
    --price-line: #6b7785;
    --pr-bg: #1e2630;
    --shu: #ff5a4e;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  font-feature-settings: "palt" 0;
}
a { color: inherit; text-underline-offset: 3px; }
a:focus-visible, .row:focus-visible, .buy:focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; }
main, .site-header, .site-footer { max-width: 720px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.muted { color: var(--ink-soft); }

/* 広告の表示: 薄く、でも必ず見える位置に */
.pr { margin: 0; padding: 6px 16px; background: var(--pr-bg); color: var(--ink-soft); font-size: 12px; text-align: center; }

/* ヘッダー: 題字としての「底値帳」 */
.site-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 4px 16px;
  padding-top: 14px;
  padding-bottom: 14px;
  background: var(--pencil) repeat-x left bottom / 240px 6px;
}
.brand { font-family: var(--hand); font-size: 32px; font-weight: 400; letter-spacing: 0.06em; text-decoration: none; line-height: 1.2; }
.site-nav a { font-size: 13px; color: var(--ink-soft); }

h1, h2 { font-family: var(--hand); font-weight: 400; line-height: 1.45; }
.page-title { font-size: 24px; margin: 32px 0 4px; }
h2 { font-size: 20px; margin: 40px 0 8px; padding-bottom: 10px; background: var(--pencil) repeat-x left bottom / 240px 6px; }
.lead { color: var(--ink-soft); margin: 4px 0 8px; font-size: 14px; }
.asof { color: var(--ink-soft); font-size: 13px; margin: 0 0 8px; }
.empty { padding: 16px 0; border-bottom: 1px solid var(--rule); margin: 0; }
.fine { color: var(--ink-soft); font-size: 13px; margin-top: 16px; }

/* 数字: 値札の書体 */
.num { font-family: var(--num); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.yen { font-size: 0.55em; margin-left: 2px; font-weight: 700; }

/* 値段の水準のハンコ(底値・安め・ふつう・高め)。src/tracker/stamps.py のSVG */
.stamp { display: block; flex-shrink: 0; }
.stamp-text { font-family: var(--hand); }

/* 底値帳の行 */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.row {
  display: grid;
  grid-template-columns: 56px 1fr auto 7em;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}
.row:hover .row-name { text-decoration: underline; }
.thumb { width: 56px; height: 56px; object-fit: contain; background: #fff; border-radius: 2px; }
.row-name { font-size: 14px; line-height: 1.55; display: flex; flex-direction: column; min-width: 0; }
.row-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-shop { font-size: 12px; color: var(--ink-soft); }
.drop { font-size: 12px; font-weight: 700; color: var(--ink); margin-top: 2px; }
.row-price { font-size: 26px; white-space: nowrap; text-align: right; }
.row-status { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.diff { font-size: 11px; line-height: 1.3; color: var(--ink-soft); display: block; text-align: center; }
.diff-up { display: block; font-family: var(--num); font-weight: 700; font-size: 15px; color: var(--ink); }

/* トップの品目表 */
.items-table, .history { width: 100%; border-collapse: collapse; font-size: 14px; }
.items-table th, .items-table td, .history th, .history td { padding: 9px 6px; border-bottom: 1px solid var(--rule); text-align: right; }
.items-table thead th, .history thead th { font-size: 12px; color: var(--ink-soft); font-weight: 400; border-bottom: 2px solid var(--ink); }
.items-table th:first-child, .history th:first-child, .history td:first-child { text-align: left; }
.items-table tbody th { font-weight: 700; }

/* 商品ページ */
.crumb { margin: 24px 0 0; font-size: 13px; color: var(--ink-soft); }
.item-title { font-size: 20px; margin: 4px 0 4px; }
.shop { margin: 0; font-size: 13px; color: var(--ink-soft); }

.buy-block { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; margin: 24px 0 8px; }
/* 棚札: このサイトでいちばん目立たせる所 */
.tag {
  position: relative;
  display: grid;
  min-width: 220px;
  padding: 12px 20px 14px;
  background: var(--tag);
  color: var(--tag-ink);
  border-radius: 10px;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.06);
}
.tag-label { font-family: var(--hand); font-size: 15px; font-weight: 400; }
.tag-price { font-size: 64px; line-height: 1; margin: 2px 0 6px; }
.tag-price .yen { font-size: 0.4em; }
.tag-sub { font-size: 12px; }
.tag .stamp { position: absolute; right: -22px; top: -26px; background: var(--paper); border-radius: 50%; }
.buy {
  display: inline-block;
  padding: 12px 22px;
  background: var(--buy);
  color: #fff;
  border-radius: 3px;
  text-decoration: none;
  font-weight: 700;
}
.buy:hover { opacity: 0.88; }
.buy-side .asof { margin-top: 8px; }

.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis { fill: var(--ink-soft); font-family: var(--num); font-size: 16px; }
.chart polyline.eff-line { fill: none; stroke: var(--cat, var(--ink)); stroke-width: 3; stroke-linejoin: round; }
.chart polyline.price-line { fill: none; stroke: var(--price-line); stroke-width: 2; stroke-dasharray: 5 4; }
.chart circle.eff-line { fill: var(--cat, var(--ink)); }
.chart circle.price-line { fill: var(--price-line); }
.chart .bottom-line { stroke: var(--shu); stroke-width: 1.5; stroke-dasharray: 3 4; }
.chart .bottom-label { fill: var(--shu); font-size: 15px; font-weight: 700; }
.chart .pt-mark { fill: var(--tag); }
.legend { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12px; color: var(--ink-soft); }
.key { display: inline-block; width: 18px; height: 0; vertical-align: middle; margin-right: 6px; border-top: 3px solid var(--cat, var(--ink)); }
.key-price { border-top: 2px dashed var(--price-line); }
.key-bottom { border-top: 2px dotted var(--shu); }
.key-pt { width: 8px; height: 10px; border: 0; background: var(--tag); }

.summary { display: grid; grid-template-columns: max-content 1fr; gap: 4px 20px; margin: 8px 0 16px; font-size: 14px; }
.summary dt { color: var(--ink-soft); }
.summary dd { margin: 0; font-weight: 700; }

/* 人が書いた「買い時のメモ」: ノートの書き込み */
.note { margin: 16px 0 8px; padding: 2px 0 2px 16px; border-left: 3px solid var(--tag); }
.note h2 { font-size: 14px; border: 0; margin: 8px 0 4px; padding: 0; }
.note p { margin: 4px 0; font-size: 15px; }

.site-footer { margin-top: 56px; padding-top: 16px; padding-bottom: 40px; border-top: 2px solid var(--ink); color: var(--ink-soft); font-size: 12px; }

@media (max-width: 560px) {
  .brand { font-size: 24px; }
  .row { grid-template-columns: 48px 1fr auto; gap: 10px; }
  .row-status { grid-column: 2 / -1; flex-direction: row; justify-content: flex-start; gap: 10px; }
  .row-status .stamp { width: 40px; height: 40px; }
  .diff { text-align: left; }
  .diff-up { display: inline; margin-left: 4px; }
  .thumb { width: 48px; height: 48px; }
  .row-price { font-size: 22px; }
  .buy-block { grid-template-columns: 1fr; gap: 16px; }
  .tag-price { font-size: 56px; }
  .tag .stamp { right: 10px; top: 10px; }
  .item-title { font-size: 18px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
}

/* トップのヘッダー画像(画像ができるまでは品目の色の棚の絵) */
.hero { margin: 0 -16px; }
.hero-img { display: block; width: 100%; height: 300px; object-fit: cover; }

/* 売場の案内板 */
.aisles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.aisle { display: flex; flex-direction: column; text-decoration: none; border-radius: 14px; overflow: hidden; background: var(--cat); color: #fff; }
.aisle:focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; }
.aisle-name { padding: 8px 12px; font-family: var(--hand); font-weight: 400; font-size: 16px; line-height: 1.35; min-height: 3.1em; text-wrap: balance; }
.aisle-img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #fff; }
.aisle:hover .aisle-name { text-decoration: underline; }
.placeholder.aisle-img, .placeholder.aisle-head-img {
  display: grid; place-items: center; background: color-mix(in srgb, var(--cat) 18%, #fff);
  color: var(--cat); font-size: 44px; font-weight: 700;
}

/* 品目ページの見出し: 案内板そのもの */
.aisle-head { display: flex; align-items: center; gap: 16px; margin: 24px 0 8px; padding: 12px 16px; background: var(--cat); color: #fff; border-radius: 14px; }
.aisle-head h1 { margin: 0; font-size: 24px; }
.aisle-head-img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: #fff; flex-shrink: 0; }
.placeholder.aisle-head-img { font-size: 30px; }

/* 商品ページの品目のしるし */
.aisle-chip { display: inline-block; margin-top: 24px; padding: 3px 12px; border-radius: 999px; background: var(--cat); color: #fff; font-family: var(--hand); font-size: 14px; font-weight: 400; text-decoration: none; }

@media (max-width: 760px) {
  .aisles { grid-template-columns: repeat(2, 1fr); }
  .hero-img { height: 180px; }
}

/* 商品画像(最大3枚) */
.gallery { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gallery img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 10px; border: 1px solid var(--rule); }

/* 商品情報: 単価と順位、特徴の札 */
.unit { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 4px 0 12px; }
.unit-label { font-family: var(--hand); font-size: 16px; }
.unit-price { font-size: 40px; line-height: 1; color: var(--cat, var(--ink)); }
.unit-price .yen { font-size: 0.45em; }
.unit-rank { font-size: 14px; }
.unit-rank b { font-family: var(--hand); font-weight: 400; font-size: 20px; color: var(--shu); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--pr-bg); color: var(--ink); }
.chip-point, .chip-sale { background: var(--tag); color: var(--tag-ink); }
.chip-postage { background: color-mix(in srgb, var(--cat, var(--ink)) 14%, var(--paper)); }
.chip-award { background: #fbe3c7; color: #7a4100; }
.chip-spec { background: color-mix(in srgb, var(--cat, var(--ink)) 82%, #000); color: #fff; font-family: var(--num); font-size: 15px; letter-spacing: 0.02em; }
.chip-coupon { background: var(--shu); color: #fff; }
.chip-review { background: #fff1c2; color: #6b4a00; }
@media (prefers-color-scheme: dark) {
  .chip-award { background: #4a3215; color: #ffd9a8; }
  .chip-review { background: #4a3d12; color: #ffe69a; }
}

/* 底値帳の仲間たちのひとこと(顔アイコンと吹き出し) */
.talks-title { margin: 20px 0 8px; font-family: var(--hand); font-size: 15px; color: var(--ink-soft); }
.talks { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.talk { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: start; }
.talk-face { width: 56px; height: 56px; border-radius: 50%; background: #fff; border: 2px solid var(--cat, var(--ink)); object-fit: cover; }
.talk-name { margin: 0 0 4px; font-family: var(--hand); font-size: 15px; }
.talk-name span { margin-left: 8px; font-family: var(--sans); font-size: 11px; color: var(--ink-soft); }
.talk-text { position: relative; margin: 0; padding: 10px 14px; background: var(--paper); border: 2px solid var(--rule); border-radius: 4px 16px 16px 16px; font-size: 15px; line-height: 1.7; }

/* 値段の記録(アコーディオン。最初は閉じている) */
.history-box { margin-top: 32px; border: 2px solid var(--rule); border-radius: 12px; }
.history-box summary { cursor: pointer; list-style: none; padding: 12px 16px; font-family: var(--hand); font-size: 17px; display: flex; justify-content: space-between; align-items: center; }
.history-box summary::-webkit-details-marker { display: none; }
.history-box summary::after { content: "＋"; font-family: var(--sans); font-weight: 700; color: var(--ink-soft); }
.history-box[open] summary::after { content: "−"; }
.history-box summary:focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; border-radius: 10px; }
.history-box .history { margin: 0 0 8px; }
.history-box .history th:first-child, .history-box .history td:first-child { padding-left: 16px; }
.history-box .history th:last-child, .history-box .history td:last-child { padding-right: 16px; }

/* 大カテゴリー(フロア)の見出しと、中カテゴリー・品目へのパンくず */
.floor { margin: 20px 0 8px; font-family: var(--hand); font-weight: 400; font-size: 17px; color: var(--ink-soft); }
.floor:first-of-type { margin-top: 4px; }
.aisle-name small { display: block; font-family: var(--sans); font-size: 11px; line-height: 1.4; opacity: 0.85; margin-top: 2px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 24px; font-size: 13px; }
.crumbs > a:not(.aisle-chip) { color: var(--ink-soft); }
.crumbs > a:not(:last-child)::after { content: "›"; margin-left: 6px; color: var(--ink-soft); }
.crumbs .aisle-chip { margin-top: 0; }
.aisles-sub { margin-bottom: 8px; }
h2 a { text-decoration: none; }
h2 a:hover { text-decoration: underline; }

/* 行に出すポイントUPの印 */
.pt { font-size: 12px; font-weight: 700; color: var(--tag-ink); background: var(--tag); border-radius: 999px; padding: 0 8px; align-self: flex-start; margin-top: 2px; }

/* 品目ページの並べ替え */
.sorter { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.sorter button { font: inherit; font-size: 13px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer; }
.sorter button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.sorter button:focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; }

/* グラフ: タップした日の値段 */
.chart-wrap { position: relative; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .guide { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .guide-dot { fill: var(--paper); stroke: var(--cat, var(--ink)); stroke-width: 3; }
.chart-tip { position: absolute; top: 4px; transform: translateX(-50%); padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--paper); font-size: 12px; line-height: 1.5; white-space: nowrap; pointer-events: none; }
.chart-tip .num { font-size: 16px; }
.chart-tip span { opacity: .8; }
