/* Directory pages (/daycares, /daycares/{province}, /daycares/{province}/{city}-{id}) and daycare listings
   (/daycare/{name}-{id}), from the legacy redesign (whibdev/dcc #49, #63): the list on the left and the 160x600 ad
   on the right; province circles, a city filter with an A to Z bar, two-up provider cards with a house icon when
   there is no photo; a listing's header card, detail cards, request form beside them, picture carousel and map overlay.
   Breakpoints: 980px (tablet: one column, the ad below) and 600px (phone). */

.dir-page {
  padding: 16px 0 32px;
  font-size: 14px;
  line-height: 1.6;
}

.dir-page *,
.dir-page *::before,
.dir-page *::after {
  box-sizing: border-box;
}

.dir-page :where(h1, h2, p, ul, dl) {
  margin: 0;
  padding: 0;
}

.dir-page [hidden] {
  display: none !important;
}

.dir-page :where(ul) {
  list-style: none;
}

.dir-page h1 {
  font-size: 30px;
}

.dir-lead {
  max-width: 780px;
  margin-top: 10px;
  font-size: 15px;
  color: #52525B;
}

/* ---------- breadcrumbs (_Breadcrumbs.cshtml) ---------- */

.dir-page .breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}

.dir-page .breadcrumbs .sep {
  display: inline-flex;
  margin: 0;
  color: #9A8FA3;
}

/* ---------- list + ad ---------- */

.dir-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: start;
  margin-top: 28px;
}

.dir-ad {
  width: 160px;
  min-height: 600px;
}

/* ---------- Canada: provinces in two columns ---------- */

.dir-provinces {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 32px;
  padding: 8px 28px;
}

a.dir-province {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

a.dir-province:hover {
  text-decoration: none;
}

a.dir-province:hover .name {
  text-decoration: underline;
}

.dir-province .abbr {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--lilac);
  color: var(--plum);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.dir-province .name {
  flex: 1 1 auto;
}

/* ---------- province: filter, A to Z, cities in columns ---------- */

.dir-filter {
  margin-bottom: 14px;
}

.dir-filter label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: bold;
}

.dir-filter .box {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 420px;
  height: 44px;
  padding: 0 14px;
  background: #fff;
  border: 1px solid #C9BCD2;
  border-radius: 8px;
  color: var(--muted);
}

.dir-filter .box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 124, 128, 0.15);
}

.dir-filter input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: var(--text);
}

.dir-no-match {
  margin-top: 8px;
  color: var(--muted);
}

.dir-az {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
  padding: 12px;
}

a.dir-az-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: bold;
}

a.dir-az-letter:hover {
  border-color: var(--teal);
  background: var(--teal-pale);
  text-decoration: none;
}

.dir-groups {
  column-count: 4;
  column-gap: 32px;
  padding: 24px 28px;
}

.dir-group {
  break-inside: avoid;
  margin-bottom: 18px;
}

.dir-group h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: var(--lilac);
  font-size: 15px;
  line-height: 1;
  scroll-margin-top: 16px;
}

.dir-group li {
  padding: 2px 0;
}

/* ---------- city: provider cards, two up ---------- */

.dir-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.dir-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 6px 18px;
  align-content: start;
  padding: 18px 20px;
}

/* a photo, or the house icon for a provider with no photo (the photo covers it) */
.dir-photo {
  display: block;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--lilac) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B9A6C4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l9-7 9 7'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3Cpath d='M10 20v-5h4v5'/%3E%3C/svg%3E") center / 32px no-repeat;
}

.dir-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dir-card .info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.dir-card h2 {
  font-size: 17px;
  line-height: 1.35;
}

.dir-card h2 a {
  color: var(--plum);
}

.dir-card .street {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

/* the provider's description is HTML: three lines of it */
.dir-card .description {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 13px;
  color: #52525B;
}

.dir-card .description * {
  display: inline;
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
}

.dir-card .foot {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.dir-empty {
  padding: 24px 28px;
}

.dir-empty p + p {
  margin-top: 8px;
}

/* ---------- facts (lilac pills) and buttons ---------- */

.dir-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dir-fact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--lilac);
  font-size: 12px;
}

.dir-fact b {
  color: var(--plum);
}

.dir-fact.open {
  background: var(--teal-pale);
}

.dir-fact.open b {
  color: #0B5F62;
}

a.dir-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  white-space: nowrap;
}

a.dir-btn:hover,
a.dir-btn:focus {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: #fff;
  text-decoration: none;
}

a.dir-btn.ghost {
  background: #fff;
  color: var(--teal);
}

a.dir-btn.ghost:hover,
a.dir-btn.ghost:focus {
  background: var(--teal-pale);
  color: var(--teal-dark);
}

/* ---------- daycare listing: header card ---------- */

.dt-head {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 22px 24px;
}

.dt-head .dir-photo {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  background-size: 44px;
}

.dt-head h1 {
  font-size: 28px;
}

.dt-address {
  margin-top: 6px;
  color: #52525B;
}

.dt-address a {
  font-weight: bold;
  white-space: nowrap;
}

.dt-head .dir-facts {
  margin-top: 10px;
}

.dt-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 200px;
}

.dt-actions a.dir-btn {
  align-self: stretch;
  height: 44px;
  font-size: 14px;
}

.dt-actions .edit-link {
  font-size: 12px;
  text-align: right;
}

/* ---------- daycare listing: detail cards and the request form beside them ---------- */

.dt-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}

.dt-main,
.dt-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.dt-card {
  padding: 22px 24px;
}

.dt-card h2 {
  margin-bottom: 12px;
  font-size: 17px;
  line-height: 1.35;
}

.dt-description {
  overflow-wrap: anywhere;
}

.dt-info {
  display: grid;
  grid-template-columns: 40% minmax(0, 1fr);
}

.dt-info dt,
.dt-info dd {
  margin: 0;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.dt-info dt {
  padding-right: 12px;
  font-size: 13px;
  color: var(--muted);
}

.dt-info dd {
  font-weight: bold;
}

.dt-hours {
  width: 100%;
  border-collapse: collapse;
}

.dt-hours th,
.dt-hours td {
  padding: 7px 12px 7px 0;
  border-top: 1px solid var(--line);
  text-align: left;
}

.dt-hours thead th {
  padding-top: 0;
  border-top: 0;
  font-size: 12px;
  font-weight: normal;
  color: var(--muted);
}

.dt-pictures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 12px;
}

.dt-pictures a {
  display: block;
  overflow: hidden;
  border-radius: 10px;
  background: var(--lilac);
  cursor: zoom-in;
}

.dt-pictures img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.dt-pictures .caption {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  text-transform: capitalize;
}

/* the 300x250 ad */
.dt-ad {
  padding: 16px;
  text-align: center;
}

.dt-ad h2 {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: normal;
  color: #8A8A93;
}

/* Basic (free) listings: no detail cards, so the form and the ad sit side by side */
.dt-basic .dt-columns {
  grid-template-columns: minmax(0, 1fr);
}

.dt-basic .dt-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.dt-basic .dt-side > :only-child {
  grid-column: 1 / -1;
}

/* forms.css makes the request form's button full width; on a wide Basic card it fits its text */
.dt-basic .dt-form .request-form .form-btn {
  width: auto;
}

/* ---------- a listing no longer shown (410) ---------- */

.dt-gone {
  max-width: 720px;
  padding: 28px;
}

.dt-gone p {
  margin-top: 10px;
}

/* ---------- map overlay (the overlay itself, .lb, is in site.css) ---------- */

.map-lb {
  touch-action: auto;
}

.map-box {
  display: flex;
  flex-direction: column;
  width: min(900px, 100%);
  height: min(640px, calc(100vh - 80px));
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
}

.map-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 20px;
  border-bottom: 1px solid var(--line);
}

.map-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb .map-close {
  width: 40px;
  height: 40px;
  background: var(--lilac);
  color: var(--plum);
}

.lb .map-close:hover,
.lb .map-close:focus-visible {
  background: var(--teal);
  color: #fff;
}

.map-canvas-lb {
  flex: 1;
  width: 100%;
}

/* ---------- tablet ---------- */

@media (max-width: 980px) {
  .dir-layout,
  .dt-columns,
  .dt-basic .dt-side {
    grid-template-columns: minmax(0, 1fr);
  }

  .dir-ad {
    margin: 8px auto 0;
  }

  .dir-groups {
    column-count: 3;
  }

  .dir-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .dt-head {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .dt-head .dir-photo {
    width: 96px;
    height: 96px;
  }

  .dt-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .dt-actions a.dir-btn {
    align-self: auto;
  }
}

/* ---------- phone ---------- */

@media (max-width: 600px) {
  .dir-page {
    padding: 4px 0 24px;
  }

  .dir-page h1 {
    font-size: 23px;
  }

  .dir-lead {
    font-size: 14px;
  }

  .dir-layout {
    margin-top: 20px;
  }

  .dir-provinces {
    grid-template-columns: minmax(0, 1fr);
    padding: 4px 18px;
  }

  .dir-filter .box {
    max-width: none;
  }

  /* one scrolling row of letters that stays at the top while the list scrolls */
  .dir-az {
    position: sticky;
    top: 0;
    z-index: 2;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 10px;
  }

  a.dir-az-letter {
    flex: none;
    min-width: 40px;
    height: 40px;
  }

  .dir-group h2 {
    scroll-margin-top: 76px;
  }

  .dir-groups {
    column-count: 2;
    column-gap: 20px;
    padding: 18px;
  }

  .dir-card {
    grid-template-columns: 64px minmax(0, 1fr);
    padding: 16px;
  }

  .dir-card .dir-photo {
    width: 64px;
    height: 64px;
  }

  a.dir-btn {
    align-self: stretch;
  }

  .dt-head {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
    padding: 18px;
  }

  .dt-head h1 {
    font-size: 21px;
  }

  .dt-head .dir-photo {
    width: 72px;
    height: 72px;
    background-size: 32px;
  }

  .dt-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .dt-card {
    padding: 18px;
  }

  .dt-pictures {
    gap: 12px 8px;
  }

  .dt-basic .dt-form .request-form .form-btn {
    width: 100%;
  }

  .map-lb {
    padding: 12px 8px;
  }

  .map-box {
    height: calc(100vh - 24px);
  }
}
