/* 法拍物件查詢 — visual spec: github.com/dolphinsue319/house-auction/issues/1 */
:root {
  --bg: #EDEFEA;
  --band: #F6F7F3;
  --surface: #FFFFFF;
  --ink: #1C2430;
  --ink-2: #4B5563;
  --ink-3: #5B6470;
  --line: #D3D7D0;
  --line-soft: #E4E7E1;
  --field: #9AA3AD;
  --action: #1F5A8C;
  --action-dark: #153F63;
  --action-tint: #E6EEF5;
  --amber: #E8B04A;
  --env-text: #8A3A2A;
  --env-border: #A52A1A;
  --muted-fill: #F3F4EF;
  --serif: "Noto Serif TC", "Songti TC", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--sans); background: var(--bg); color: var(--ink);
  font-variant-numeric: tabular-nums; line-height: 1.5;
}
a { color: var(--action); }
a:hover { color: var(--action-dark); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
input, select, button { font: inherit; color: inherit; }
input[type="search"], input[inputmode], select {
  height: 48px; padding: 0 14px; font-size: 16px;
  border: 1px solid var(--field); border-radius: 6px; background: var(--surface); color: var(--ink);
}
select:disabled { color: var(--ink-3); background: var(--muted-fill); }
button { cursor: pointer; }
.primary {
  min-height: 48px; padding: 0 32px; font-size: 16px; font-weight: 700;
  color: #FFFFFF; background: var(--action); border: none; border-radius: 6px;
}
.primary:hover { background: var(--action-dark); }

/* Header & footer */
.site-header {
  height: 68px; flex-shrink: 0; padding: 0 40px; display: flex; align-items: center; gap: 40px;
  background: var(--ink); color: var(--bg); border-bottom: 3px solid var(--amber);
}
.brand {
  font-family: var(--serif); font-weight: 900; font-size: 22px; letter-spacing: 0.08em;
  color: #FFFFFF; text-decoration: none;
}
.brand:hover { color: #FFFFFF; }
.site-header nav { display: flex; gap: 28px; font-size: 15px; }
.site-header nav a {
  min-height: 44px; display: inline-flex; align-items: center;
  color: #C5CDD5; text-decoration: none; border-bottom: 2px solid transparent;
}
.site-header nav a:hover { color: #FFFFFF; }
.site-header nav a[aria-current="page"] { color: #FFFFFF; border-bottom-color: var(--amber); }
.updated { margin-left: auto; font-size: 13px; color: #9AA6B2; }
.site-footer {
  margin-top: auto; padding: 24px 40px 32px; font-size: 13px; line-height: 1.7;
  color: var(--ink-2); border-top: 1px solid var(--line);
}

/* Search bar */
.searchbar {
  padding: 24px 40px 20px; display: flex; gap: 12px; align-items: flex-end;
  background: var(--band); border-bottom: 1px solid var(--line);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--ink-2); }
.field.place { width: 180px; }

/* Results layout */
.results-layout { display: flex; gap: 28px; padding: 24px 40px 32px; max-width: 1360px; width: 100%; margin: 0 auto; }
.filters { width: 256px; flex-shrink: 0; display: flex; flex-direction: column; gap: 22px; }
.filters-head { display: none; }
.filters fieldset { margin: 0; padding: 0; border: none; display: flex; flex-direction: column; gap: 4px; }
.filters legend { font-family: var(--serif); font-weight: 700; font-size: 15px; margin-bottom: 10px; padding: 0; }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--field); border-radius: 6px; overflow: hidden; }
.segmented label { position: relative; }
.segmented label + label { border-left: 1px solid var(--field); }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.segmented span {
  height: 44px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; background: var(--surface); cursor: pointer;
}
.segmented input:checked + span { color: #FFFFFF; background: var(--ink); font-weight: 700; }
.segmented input:focus-visible + span { outline: 3px solid var(--amber); outline-offset: -3px; }
.check { min-height: 44px; display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--action); }
.hint { margin: -8px 0 6px 28px; font-size: 12px; line-height: 1.5; color: var(--ink-3); }
.range { display: flex; align-items: center; gap: 8px; color: var(--ink-3); }
.range input { width: 0; flex-grow: 1; height: 44px; font-size: 15px; padding: 0 12px; }
.apply { width: 100%; }
.js .apply { display: none; }

.results { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.results-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.results-head h1 { margin: 0; font-size: 24px; font-weight: 900; }
.sort { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.sort select { height: 44px; font-size: 14px; padding: 0 10px; }
.updated-mobile { display: none; }
.notice { margin: 0; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2); }
.chips { display: none; }

/* Cards */
.cards { display: flex; flex-direction: column; gap: 14px; }
.card {
  display: flex; gap: 18px; padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink);
}
.card:hover { color: var(--ink); border-color: var(--action); }
.thumb {
  width: 132px; height: 100px; flex-shrink: 0; border-radius: 4px; background: #DDE1DA;
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--ink-3);
}
.card-main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.meta, .sub { font-size: 13px; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.card-title { font-size: 17px; font-weight: 700; line-height: 1.4; }
.lot {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 10px;
  border-radius: 13px; background: var(--action-tint); color: var(--action-dark); font-size: 13px; font-weight: 700;
}
.flag { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--env-text); }
.card-price { width: 150px; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.card-price .label { font-size: 12px; color: var(--ink-3); }
.price { font-family: var(--serif); font-size: 26px; font-weight: 900; line-height: 1; white-space: nowrap; }
.price small { font-size: 14px; font-weight: 700; }
.handover { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-2); }
.help {
  width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--field); font-size: 11px; cursor: help;
}
.more {
  display: none; min-height: 48px; align-items: center; justify-content: center; font-size: 15px;
  color: var(--action); background: var(--surface); border: 1px solid var(--action); border-radius: 8px; text-decoration: none;
}
.pager { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.pager span { color: var(--ink-2); margin-right: auto; }
.pager a {
  min-width: 44px; height: 44px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--field); border-radius: 6px; background: var(--surface); text-decoration: none;
}
.source-note { margin: 4px 0 0; font-size: 12px; color: var(--ink-3); }

/* Detail */
.crumbs { padding: 20px 40px 0; font-size: 14px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 8px; max-width: 1360px; width: 100%; margin: 0 auto; }
.crumbs [aria-current] { color: var(--ink); }
.crumbs a, .crumbs span { min-height: 44px; display: inline-flex; align-items: center; }
.gone-banner {
  margin: 0; padding: 14px 40px; background: #FBEFD9; border-bottom: 1px solid var(--amber);
  font-size: 15px; font-weight: 700; color: var(--ink);
}
.detail {
  padding: 16px 40px 40px; max-width: 1360px; width: 100%; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: 28px; row-gap: 24px;
  grid-template-areas: "head head" "sale photos" "sale env" "history env";
  align-items: start;
}
.head { grid-area: head; display: flex; flex-wrap: wrap; align-items: flex-end; column-gap: 32px; row-gap: 16px; }
.head-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.tag { min-height: 26px; padding: 0 10px; display: inline-flex; align-items: center; gap: 5px; border-radius: 3px; border: 1px solid var(--field); background: var(--surface); }
.tag.dark { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.tag.env { position: relative; border-color: var(--env-border); color: var(--env-text); text-decoration: none; background: transparent; }
.tag.env::after { content: ""; position: absolute; inset: -9px 0; }  /* 44px tap area around the small tag */
.head h1 { margin: 0; font-size: 36px; font-weight: 900; line-height: 1.25; }
.case { margin: 0; font-size: 15px; color: var(--ink-2); }
.price-block { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.price-block .label { font-size: 13px; color: var(--ink-3); }
.price-block .price { font-size: 44px; }
.price-block .price small { font-size: 18px; }
.price-block .when { font-size: 15px; }
.lot-note { margin: 0; flex-basis: 100%; padding: 10px 14px; background: var(--action-tint); border-radius: 6px; font-size: 15px; color: var(--action-dark); }

.panel, .photos { padding: 24px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 14px; }
.panel h2, .photos h2 { margin: 0; font-size: 20px; font-weight: 700; }
.sale { grid-area: sale; }
.photos { grid-area: photos; }
.history { grid-area: history; }
.env { grid-area: env; }
.sale dl { margin: 0; display: grid; grid-template-columns: 150px 1fr; font-size: 15px; }
.sale dt, .sale dd { margin: 0; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.sale dt { color: var(--ink-2); padding-right: 12px; }
.explain { display: inline-block; margin-left: 6px; }
.explain summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--action); text-decoration: underline; cursor: pointer; list-style: none; }
.explain summary::-webkit-details-marker { display: none; }
.explain[open] { display: block; margin: 6px 0 0; }
.explain p { margin: 6px 0 0; padding: 8px 12px; background: var(--muted-fill); border-radius: 4px; font-size: 14px; line-height: 1.6; color: #3A4452; }
.sale h3 { margin: 8px 0 0; font-family: var(--sans); font-size: 16px; font-weight: 700; }
.lot-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.lot-list a { min-height: 44px; display: flex; gap: 12px; align-items: center; padding: 10px 14px; border: 1px solid var(--line-soft); border-radius: 6px; text-decoration: none; color: var(--ink); }
.lot-list a:hover { border-color: var(--action); color: var(--ink); }
.lot-list svg { color: var(--action); }
.grow { flex-grow: 1; min-width: 0; }

.photos > * { min-width: 0; }
.carousel { margin: 0; }
.stage { position: relative; }
.carousel .main { display: block; height: 300px; border-radius: 6px; overflow: hidden; background: #C9CEC6; }
.carousel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel figcaption { margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.carousel .nav {
  display: none; position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(255, 255, 255, 0.9); border: none; color: var(--ink);
}
.js .carousel .nav { display: flex; }
.carousel .prev { left: 8px; }
.carousel .next { right: 8px; }
.carousel .count { position: absolute; right: 12px; bottom: 12px; padding: 4px 10px; border-radius: 12px; background: rgba(28, 36, 48, 0.78); color: #FFFFFF; font-size: 12px; }
.thumbs { margin: 0; padding: 0 0 4px; list-style: none; display: flex; gap: 8px; overflow-x: auto; }
.thumbs a {
  width: 48px; height: 44px; display: flex; align-items: center; justify-content: center;
  border-radius: 4px; border: 1px solid var(--line); background: var(--muted-fill); color: var(--ink); text-decoration: none; font-size: 14px;
}
.thumbs li { flex-shrink: 0; }
.thumbs a[aria-current="true"] { color: #FFFFFF; background: var(--action); border-color: var(--action); font-weight: 700; }
.no-photo {
  height: 260px; border-radius: 6px; border: 1px dashed var(--field); background: var(--muted-fill);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--ink-2); font-size: 15px;
}
.no-photo svg { color: var(--ink-3); stroke-width: 1.6; }
.note { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink-3); }

.events { margin: 0; padding: 0; list-style: none; }
.events li { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; }
.events .date { width: 96px; flex-shrink: 0; color: var(--ink-2); font-size: 14px; }
.env p { margin: 0; font-size: 14px; line-height: 1.6; }
.compact { margin: 0; display: grid; grid-template-columns: 80px 1fr; row-gap: 8px; font-size: 14px; }
.compact dt { color: var(--ink-2); }
.compact dd { margin: 0; }
.env-more { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.7; }
.ext { font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; align-self: flex-start; }

.page-text { max-width: 760px; width: 100%; margin: 0 auto; padding: 32px 40px 48px; line-height: 1.8; }
.page-text h1 { font-size: 30px; font-weight: 900; margin: 0 0 16px; }
.page-text h2 { font-size: 20px; margin: 28px 0 8px; }
.disclaimer { color: var(--ink-2); }

/* Phones & small tablets */
@media (max-width: 900px) {
  .site-header { height: 56px; padding: 0 8px 0 16px; gap: 12px; }
  .brand { font-size: 18px; letter-spacing: 0.06em; }
  .site-header nav { margin-left: auto; gap: 4px; font-size: 14px; }
  .site-header nav a { padding: 0 8px; }
  .updated { display: none; }
  .site-footer { padding: 20px 16px 28px; font-size: 12px; }

  .searchbar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .field.grow { flex-basis: 100%; }
  .field.grow label, .photos h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .field.place { width: auto; flex: 1 1 0; min-width: 0; }
  .field.place select { width: 100%; }
  .searchbar .primary { flex-basis: 100%; }
  .js .searchbar .primary { display: none; }

  .js .chips {
    display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 12px; background: var(--band);
    border-bottom: 1px solid var(--line); scrollbar-width: none;
  }
  .chips button {
    height: 44px; flex-shrink: 0; padding: 0 14px; font-size: 14px;
    color: var(--ink); background: var(--surface); border: 1px solid var(--field); border-radius: 22px;
  }
  .chips button[aria-pressed="true"] { color: #FFFFFF; background: var(--ink); border-color: var(--ink); font-weight: 700; }
  .chips .more-filters[aria-pressed="false"] { color: var(--action); border-color: var(--action); }

  .results-layout { display: block; padding: 10px 16px 24px; }
  .filters { width: auto; margin-bottom: 20px; }
  .js .filters {
    display: none; position: fixed; inset: 0; z-index: 10; margin: 0; padding: 0 16px 24px;
    background: var(--bg); overflow-y: auto;
  }
  .js .filters.open { display: flex; }
  .js .filters .filters-head {
    display: flex; align-items: center; position: sticky; top: 0; z-index: 1;
    margin: 0 -16px; padding: 6px 8px 6px 16px; background: var(--band); border-bottom: 1px solid var(--line);
  }
  .filters-head h2 { margin: 0; font-size: 18px; }
  .filters-head .close { margin-left: auto; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: none; border: none; }
  .js .apply { display: block; position: sticky; bottom: 0; }

  .results { gap: 10px; }
  .results-head { gap: 8px; flex-wrap: nowrap; }
  .results-head h1 { font-size: 17px; }
  .sort { font-size: 0; gap: 0; flex-shrink: 0; }
  .sort select { font-size: 14px; border: none; background: transparent; color: var(--action); padding: 0 4px; }
  .updated-mobile { display: block; margin: -8px 0 0; font-size: 12px; color: var(--ink-3); }

  .cards { gap: 10px; }
  .card { flex-direction: column; gap: 6px; padding: 14px; position: relative; }
  .thumb { display: none; }
  .card-title { font-size: 16px; }
  .lot { align-self: stretch; border-radius: 6px; }
  .card-price { width: auto; flex-direction: row; align-items: baseline; gap: 8px; }
  .card-price .price { font-size: 20px; }
  .card-price .handover { margin-left: auto; }
  .more { display: flex; }
  .pager { display: none; }

  .crumbs { display: none; }
  .detail {
    padding: 0 0 24px; display: flex; flex-direction: column; align-items: stretch; gap: 16px;
  }
  .photos { order: -1; padding: 0 0 4px; border: none; border-radius: 0; background: transparent; gap: 8px; }
  .carousel .main { height: 240px; border-radius: 0; }
  .carousel figcaption, .thumbs, .photos .note { padding: 0 16px; }
  .no-photo { height: 160px; margin: 16px 16px 0; }
  .head { padding: 0 16px; column-gap: 8px; row-gap: 10px; }
  .head-main { flex-basis: 100%; gap: 8px; }
  .tags { font-size: 12px; gap: 6px; }
  .head h1 { font-size: 22px; line-height: 1.35; }
  .case { font-size: 13px; }
  .price-block { flex-basis: 100%; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
  .price-block .price { font-size: 30px; }
  .price-block .when { flex-basis: 100%; font-size: 14px; }
  .lot-note { font-size: 14px; }
  .panel { margin: 0 16px; padding: 14px; gap: 10px; }
  .panel h2 { font-size: 17px; font-weight: 900; }
  .sale dl { grid-template-columns: 104px 1fr; font-size: 14px; }
  .sale dt, .sale dd { padding: 10px 0; }
  .page-text { padding: 24px 16px 40px; }
  .gone-banner { padding: 12px 16px; font-size: 14px; }
}
