/* 底値帳
   考え方: スーパーの売場。品目ごとに案内板の色(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-head { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; }
.item-title { font-size: 20px; margin: 4px 0 4px; }
.shop { margin: 0; font-size: 13px; color: var(--ink-soft); }
.item-image { width: 112px; height: 112px; object-fit: contain; background: #fff; border-radius: 2px; }

.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; }
  .item-image { width: 80px; height: 80px; }
}

/* トップのヘッダー画像(画像ができるまでは品目の色の棚の絵) */
.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(5, 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; }
}

/* 商品情報: レビューと楽天の商品説明文の冒頭 */
.info { margin-top: 8px; }
.review { margin: 4px 0 8px; display: flex; align-items: baseline; gap: 6px; }
.review .stars { color: #e8a200; font-size: 20px; }
.review .num { font-size: 24px; }
.review-count { color: var(--ink-soft); font-size: 13px; }
.caption { margin: 0; padding: 12px 14px; background: var(--pr-bg); border-radius: 10px; font-size: 14px; line-height: 1.8; }
.caption a { white-space: nowrap; font-weight: 700; }
