/* 舖見 portal (D99): the same Japanese direction as the back office (D98):
   washi paper, sumi ink, one 藍 accent, hairlines, Mincho-leaning headings
   from system fonts only. No script, no inline styles, no web fonts. */
:root {
  --bg: #f6f3ec; --surface: #fcfbf7; --surface-2: #f0ece3; --border: #e0d9cc; --border-strong: #8a8376;
  --text: #1c1b19; --text-2: #55504a; --text-3: #69645b;
  --accent: #27477a; --accent-hover: #1e3961; --accent-soft: #e7ecf3; --on-accent: #ffffff; --focus: #27477a;
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-heading: "Noto Serif TC", "Noto Serif CJK TC", "Source Han Serif TC", "Songti TC", "PMingLiU", "MingLiU", serif;
  --radius: 6px; --radius-card: 10px;
  /* D144: the status colours of this surface (the back office's values: one error red per surface). */
  --danger: #a12a1e; --ok: #1d6a3a; --ok-bg: #e2eedf; --ok-border: #3d7a4f; --warn: #4f360a; --warn-bg: #f7eedb; --warn-border: #9a6a12;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161b; --surface: #1b1e25; --surface-2: #232731; --border: #2d323e; --border-strong: #6f7586;
    --text: #ede9e1; --text-2: #bab5ab; --text-3: #9e998f;
    --accent: #93acd8; --accent-hover: #adc1e4; --accent-soft: #262e3e; --on-accent: #10141c; --focus: #adc1e4;
    --danger: #f2897d; --ok: #9fd3ae; --ok-bg: #1b2a20; --ok-border: #4f8a60; --warn: #f0dfb8; --warn-bg: #2e2615; --warn-border: #a88231;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.6; color: var(--text); background: var(--bg); overflow-wrap: anywhere; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 5px var(--accent-soft); border-radius: var(--radius); }
.skip { position: absolute; left: 8px; top: 8px; padding: 8px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); transform: translateY(-200%); }
.skip:focus { transform: none; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }

.site-head { border-bottom: 1px solid var(--border); background: var(--bg); }
.head-row { display: flex; align-items: center; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; min-height: 44px; }
.brand:hover { color: var(--text); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius); background: var(--accent); color: var(--on-accent); font-family: var(--font-heading); font-size: 1.125rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-heading); font-size: 1.25rem; letter-spacing: .06em; }
.brand-sub { font-size: .75rem; color: var(--text-2); letter-spacing: .08em; }
/* D122: the way to the sales pages, right of the brand; the footer's links */
.head-nav { margin-left: auto; }
.head-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 9999px; color: var(--text); text-decoration: none; font-size: .9375rem; white-space: nowrap; }
.head-link:hover, .head-link[aria-current="page"] { border-color: var(--accent); color: var(--accent); }
.foot-links { display: flex; flex-wrap: wrap; gap: 0 16px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; }

main { padding-top: 32px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 24px; }
.page-title { margin: 0; font-family: var(--font-heading); font-weight: 600; font-size: 1.75rem; line-height: 1.3; letter-spacing: .03em; text-wrap: balance; }
@media (min-width: 768px) { .page-title { font-size: 2.25rem; } }
.lead { margin: 8px 0 0; color: var(--text-2); max-width: 40em; }

/* search: one row on wide screens, stacked on phones; 44 px targets */
.search { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
@media (min-width: 720px) { .search { grid-template-columns: minmax(0, 1fr) 200px auto; align-items: end; } }
.search label { display: block; margin-bottom: 6px; font-size: .875rem; font-weight: 500; color: var(--text); }
.search input, .search select { width: 100%; min-height: 44px; padding: 8px 12px; font: inherit; font-size: 1rem; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.search input:focus-visible, .search select:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; box-shadow: 0 0 0 4px var(--accent-soft); }
.select-wrap { position: relative; display: block; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 20px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-quiet { background: transparent; color: var(--accent); }
.btn-quiet:hover { background: var(--accent-soft); color: var(--accent-hover); }

/* categories: a row of quiet links, the current one underlined in 藍 */
.cats ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; border-bottom: 1px solid var(--border); }
.cat { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.cat:hover { color: var(--text); }
.cat[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.cat-n { font-size: .75rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
::placeholder { color: var(--text-3); opacity: 1; } /* D118: the browser's grey is 4.45:1 on paper, 3.6:1 on ink */

.count { margin: 0; color: var(--text-2); font-size: .875rem; }
.shops { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .shops { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .shops { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; } }
.shop-link { display: flex; flex-direction: column; height: 100%; color: var(--text); text-decoration: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; transition: border-color .3s cubic-bezier(.22, 1, .36, 1); }
.shop-link:hover { color: var(--text); border-color: var(--accent); }
.shop-cover { display: block; aspect-ratio: 4 / 3; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.shop-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* No cover (D104): a tinted block, the first character large in the heading
   face, the category under it. Fixed tints (no inline styles under this CSP);
   every pair is >= 5.7:1 in light and dark (test/portal-cover.test.js). */
.cover-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; height: 100%; padding: 8px; background: var(--tint-bg, var(--surface-2)); color: var(--tint-ink, var(--text-3)); text-align: center; }
.cover-char { font-family: var(--font-heading); font-weight: 600; font-size: 4rem; line-height: 1; }
.cover-cat { font-size: .8125rem; letter-spacing: .08em; color: var(--tint-label, var(--text-2)); }
.tint-ai { --tint-bg: #dde5f1; --tint-ink: #1f3a64; --tint-label: #3b5277; }
.tint-matcha { --tint-bg: #e1eadb; --tint-ink: #2c4722; --tint-label: #45583c; }
.tint-sakura { --tint-bg: #f5e0e4; --tint-ink: #6a2534; --tint-label: #7a4450; }
.tint-kaki { --tint-bg: #f6e2d2; --tint-ink: #673012; --tint-label: #7a4a30; }
.tint-yamabuki { --tint-bg: #f2e8c6; --tint-ink: #56420c; --tint-label: #6a5726; }
.tint-fuji { --tint-bg: #e8e1f1; --tint-ink: #462f63; --tint-label: #5c4a74; }
.tint-asagi { --tint-bg: #d8ebeb; --tint-ink: #1c4a4d; --tint-label: #3a5d60; }
.tint-sumi { --tint-bg: #e8e4dc; --tint-ink: #36322d; --tint-label: #55504a; }
@media (prefers-color-scheme: dark) {
  .tint-ai { --tint-bg: #1d2840; --tint-ink: #c9d7ee; --tint-label: #a9bbdc; }
  .tint-matcha { --tint-bg: #1f2b1c; --tint-ink: #cfe0c4; --tint-label: #b0c6a3; }
  .tint-sakura { --tint-bg: #35202a; --tint-ink: #f0cdd6; --tint-label: #d9aebb; }
  .tint-kaki { --tint-bg: #36231a; --tint-ink: #f2d2bd; --tint-label: #dbb59c; }
  .tint-yamabuki { --tint-bg: #2f2a17; --tint-ink: #ece0b4; --tint-label: #d3c58f; }
  .tint-fuji { --tint-bg: #2a2238; --tint-ink: #ddd0ef; --tint-label: #c1b2da; }
  .tint-asagi { --tint-bg: #192d2e; --tint-ink: #c3e2e2; --tint-label: #a2c9c9; }
  .tint-sumi { --tint-bg: #24262c; --tint-ink: #e2ddd3; --tint-label: #bab5ab; }
}
.shop-body { display: flex; flex-direction: column; gap: 4px; padding: 16px; flex: 1; }
.shop-name { font-family: var(--font-heading); font-size: 1.25rem; font-weight: 600; line-height: 1.4; letter-spacing: .02em; }
.shop-meta { font-size: .875rem; color: var(--text-2); }
/* D119: the shop's logo beside its name, on a white plate (a dark logo stays visible in dark mode, a JPEG's white edge disappears into it) */
.shop-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.shop-title .shop-name { min-width: 0; }
.shop-logo { display: inline-flex; flex: none; align-items: center; justify-content: center; height: 40px; max-width: 104px; padding: 4px; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.shop-logo img { display: block; height: 30px; width: auto; max-width: 94px; object-fit: contain; }
.shop-intro { font-size: .9375rem; color: var(--text); }
.shop-go { margin-top: auto; padding-top: 8px; font-size: .8125rem; color: var(--accent); }

.pager ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.pg { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; font-variant-numeric: tabular-nums; }
a.pg:hover { border-color: var(--accent); color: var(--accent); }
.pg.is-current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.pg-gap { border-color: transparent; background: transparent; min-width: 24px; color: var(--text-3); }

.empty { padding: 48px 16px; text-align: center; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.empty p { margin: 8px auto 0; max-width: 32em; color: var(--text-2); }
.empty-title, .empty .page-title { margin: 0; font-family: var(--font-heading); font-size: 1.25rem; color: var(--text); }

.site-foot { border-top: 1px solid var(--border); padding: 24px 0 40px; color: var(--text-2); font-size: .875rem; }
.site-foot p { margin: 0 0 8px; }
.foot-name { font-family: var(--font-heading); color: var(--text); }
.foot-note { color: var(--text-3); }
@media (prefers-reduced-motion: reduce) { .shop-link { transition: none; } }
/* phones (D112, replaces the one-row-per-shop list of D99): an app-like
   directory. The search is one sticky row (words, 縣市, 搜尋; the labels stay
   for screen readers), the categories a sideways row of chips, the shops two
   cards a row with the introduction cut to two lines (the card links to the
   shop's own site, where all of it is). */
@media (max-width: 559px) {
  main { padding-top: 20px; gap: 16px; }
  .page-title { font-size: 1.5rem; }
  .lead { font-size: .9375rem; }
  .search { position: sticky; top: 0; z-index: 5; grid-template-columns: minmax(0, 1fr) 108px auto; gap: 6px; padding: 8px; margin: 0 -16px; border-width: 0 0 1px; border-radius: 0; background: var(--bg); }
  .search label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
  .search .btn { padding: 8px 14px; }
  .search select { padding-right: 24px; }
  .cats { margin: 0 -16px; }
  .cats ul { flex-wrap: nowrap; gap: 8px; padding: 2px 16px; overflow-x: auto; border-bottom: 0; scrollbar-width: none; }
  .cats ul::-webkit-scrollbar { display: none; }
  .cat { flex: none; padding: 0 14px; margin: 0; border: 1px solid var(--border); border-radius: 9999px; background: var(--surface); white-space: nowrap; }
  .cat[aria-current="page"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
  .cat[aria-current="page"] .cat-n { color: inherit; }
  .shops { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .shop-cover { aspect-ratio: 3 / 2; }
  .cover-char { font-size: 2.5rem; }
  .cover-cat { font-size: .75rem; letter-spacing: .04em; }
  .shop-body { padding: 10px 12px 12px; gap: 2px; }
  .shop-name { font-size: 1rem; line-height: 1.4; }
  .shop-meta { font-size: .75rem; }
  .shop-title { gap: 8px; }
  .shop-logo { height: 32px; max-width: 72px; padding: 3px; }
  .shop-logo img { height: 24px; max-width: 64px; }
  .shop-intro { font-size: .8125rem; line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .shop-go { font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Scrollbars (D109, docs/ui-design.md 「捲軸」): the page keeps a thin scrollbar
   in the theme's colours; nothing scrolls sideways at 360 px and up. */
:root { --scroll-thumb: #8a8376; --scroll-thumb-hover: #55504a; --scroll-track: transparent; }
@media (prefers-color-scheme: dark) { :root { --scroll-thumb: #6f7586; --scroll-thumb-hover: #9e998f; } }
html { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
html, body { overflow-x: clip; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--scroll-track); }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 9999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }
