/* ============================================================
   嚴選工班名錄 — Contractor Directory
   White / light-grey ground. No dark surfaces.
   Reads as a professional trade register, not a marketplace.
   ============================================================ */

/* ---------- Filter bar ---------- */
.dir-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: flex-start;
  padding: 22px 0 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 34px;
}
.dir-filter {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}
.dir-filter__label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
}
.dir-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.dir-chip {
  appearance: none;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 7px 14px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.01em;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease),
              background 0.2s var(--ease);
  white-space: nowrap;
}
.dir-chip:hover { border-color: var(--ink); color: var(--ink); }
.dir-chip[aria-pressed="true"] {
  background: var(--mist);
  border-color: var(--navy);
  color: var(--navy);
  font-weight: 700;
}
.dir-count {
  margin-left: auto;
  align-self: flex-end;
  font-size: 0.82rem;
  color: var(--text-3);
  padding-bottom: 8px;
  white-space: nowrap;
}
.dir-count b { color: var(--ink); font-weight: 700; }

/* ---------- Directory grid ---------- */
.dir-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 2.4vw, 28px);
}
.dir-grid > * { min-width: 0; }

/* ---------- Contractor card ---------- */
.ctr {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.ctr:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }

/* photo strip — 1 to 3 real site photos */
.ctr__photos {
  display: grid;
  gap: 2px;
  background: var(--mist-2);
  aspect-ratio: 16 / 7;
  overflow: hidden;
}
.ctr__photos[data-n="1"] { grid-template-columns: 1fr; }
.ctr__photos[data-n="2"] { grid-template-columns: 1fr 1fr; }
.ctr__photos[data-n="3"] { grid-template-columns: 2fr 1fr; }
.ctr__photos[data-n="3"] > :nth-child(2),
.ctr__photos[data-n="3"] > :nth-child(3) { grid-row: span 1; }
.ctr__photos[data-n="3"] {
  grid-template-rows: 1fr 1fr;
}
.ctr__photos[data-n="3"] > :first-child { grid-row: span 2; }
.ctr__photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ctr__body {
  padding: clamp(20px, 2.4vw, 26px);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.ctr__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 4px;
}
.ctr__name {
  font-family: var(--serif);
  font-size: 1.16rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  margin: 0;
}
.ctr__area {
  font-size: 0.84rem;
  color: var(--text-3);
  margin: 5px 0 0;
  line-height: 1.5;
}
.ctr__area b { color: var(--text-2); font-weight: 600; }

.ctr__tier {
  flex-shrink: 0;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--text-3);
  background: var(--paper);
  white-space: nowrap;
}
.ctr__tier[data-tier="T1"],
.ctr__tier[data-tier="T2"],
.ctr__tier[data-tier="T3"] {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 32%, transparent);
  background: color-mix(in srgb, var(--green) 4%, var(--paper));
}

.ctr__lead {
  font-size: 0.9rem;
  line-height: 1.72;
  color: var(--text-2);
  margin: 14px 0 0;
}

/* transparent reference pricing */
.ctr__price {
  margin: 18px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.ctr__price-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}
.ctr__price-head span {
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
}
.ctr__price-head a {
  font-size: 0.76rem;
  color: var(--navy);
  border-bottom: 1px solid color-mix(in srgb, var(--navy) 30%, transparent);
  padding-bottom: 1px;
}
.ctr__price-head a:hover { border-color: var(--navy); }
.ctr__price ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.ctr__price li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.5;
}
.ctr__price li b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ctr__price li b small {
  font-weight: 400;
  color: var(--text-3);
  font-size: 0.76rem;
  margin-left: 2px;
}

/* actions */
.ctr__actions {
  margin-top: auto;
  padding-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.ctr__actions .btn { flex: 1 1 auto; }
.ctr__actions .btn--ghost { flex: 0 0 auto; }

.ctr__meta {
  margin: 14px 0 0;
  font-size: 0.74rem;
  color: var(--text-3);
  line-height: 1.6;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.ctr__meta svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--green);
}

/* ---------- Empty state ---------- */
.dir-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 56px 28px;
  text-align: center;
  background: var(--mist);
}
.dir-empty h3 { margin-bottom: 10px; }
.dir-empty p { font-size: 0.92rem; max-width: 460px; margin-inline: auto; }

/* ---------- Legal firewall note ---------- */
.dir-legal {
  margin-top: 40px;
  padding: 22px 24px;
  background: var(--mist);
  border: 1px solid var(--line);
  border-left: 3px solid var(--navy);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.dir-legal p {
  font-size: 0.84rem;
  line-height: 1.78;
  color: var(--text-2);
  margin: 0;
}
.dir-legal strong { color: var(--ink); font-weight: 700; }

/* ---------- How it works (3 steps) ---------- */
.dir-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.4vw, 30px);
  counter-reset: dstep;
}
.dir-step {
  border-top: 2px solid var(--ink);
  padding-top: 18px;
}
.dir-step__n {
  font-family: var(--serif);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--text-3);
  display: block;
  margin-bottom: 10px;
}
.dir-step h3 { font-size: 1.04rem; margin-bottom: 9px; }
.dir-step p { font-size: 0.9rem; line-height: 1.72; margin: 0; }

/* ---------- Homepage teaser ---------- */
.dir-teaser {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 22px);
}
.dir-teaser__item {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.dir-teaser__item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.dir-teaser__item img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--mist-2);
}
.dir-teaser__body { padding: 18px 20px 20px; }
.dir-teaser__body h3 {
  font-size: 1rem;
  margin-bottom: 5px;
  line-height: 1.4;
}
.dir-teaser__body p {
  font-size: 0.82rem;
  color: var(--text-3);
  margin: 0 0 12px;
  line-height: 1.55;
}
.dir-teaser__body .price {
  font-size: 0.84rem;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: block;
  margin-bottom: 14px;
}
.dir-teaser__body .price small {
  font-weight: 400;
  color: var(--text-3);
  font-size: 0.76rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .dir-grid { grid-template-columns: 1fr; }
  .dir-teaser { grid-template-columns: 1fr; }
  .dir-steps { grid-template-columns: 1fr; gap: 22px; }
  .dir-count { margin-left: 0; align-self: flex-start; padding-bottom: 0; }
  .dir-filters { gap: 20px; }
}
@media (max-width: 560px) {
  .ctr__photos { aspect-ratio: 16 / 9; }
  .ctr__actions .btn { flex: 1 1 100%; }
  .ctr__actions .btn--ghost { flex: 1 1 100%; }
}
