/*
  case-pages.css
  Case studies list and the single study page.
  Type, colour, and full-height sections match the rest of the site.
*/

[hidden] {
  display: none !important;
}

.case-hero,
.case-catalogue,
.study-hero,
.study-block,
.study-pager,
.study-missing {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.75rem;
  padding-top: calc(var(--header-offset) + 1.5rem);
  padding-bottom: 3rem;
}

.case-hero .display,
.study-hero .display {
  max-width: 16em;
}

.case-hero .lede,
.study-prose {
  max-width: 46rem;
}

.case-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 12rem));
  gap: 1.5rem 2rem;
  width: 100%;
  margin: 0.5rem 0 0;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.case-facts li {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.case-facts strong {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  font-weight: 600;
  line-height: 1;
}

.case-facts span {
  color: var(--text-muted);
}

.case-catalogue {
  justify-content: flex-start;
  gap: 0.65rem;
  padding-top: var(--header-offset);
}

.case-catalogue__head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/*
  Category filter. Need, Domain, and Industry are dropdowns.
  Opening one reveals its options in the same bar.
*/
.facet-bar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.facet-bar__label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  color: var(--accent-ink);
  font-size: 0.82rem;
  font-weight: 600;
}

.facet-bar__mark {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
}

.facet-bar__meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.facet-bar__clear {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.facet-bar__clear:hover {
  color: var(--text);
}

.facet-bar__shell {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem 0.95rem;
  width: 100%;
  padding: 0.85rem 1rem 0.55rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--text) 5%, var(--bg-elevated));
}

.facet-bar__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.facet-bar__cat {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--text-soft);
  font-weight: 600;
}

.facet-bar__cat[aria-expanded="true"] {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
}

.facet-bar__cat svg {
  width: 0.95rem;
  height: 0.95rem;
  transition: transform 180ms ease;
}

.facet-bar__cat[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.facet-bar__count {
  display: grid;
  place-items: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.3rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.facet-bar__options {
  display: contents;
}

.facet-bar__opt {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 2.5rem;
  padding: 0.3rem 0.8rem;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.2;
  white-space: nowrap;
}

.facet-bar__name {
  display: inline-grid;
  justify-items: start;
}

.facet-bar__name::before {
  content: attr(data-label);
  grid-area: 1 / 1;
  font-weight: 700;
  visibility: hidden;
  pointer-events: none;
}

.facet-bar__name > span {
  grid-area: 1 / 1;
  font-weight: 500;
}

.facet-bar__opt:hover {
  color: var(--text);
}

.facet-bar__opt.is-on {
  background: #0c0c0c;
  color: #fff;
  box-shadow: 0 8px 18px rgb(0 0 0 / 0.28);
}

.facet-bar__opt.is-on .facet-bar__name > span {
  font-weight: 700;
}

[data-theme="light"] .facet-bar__opt.is-on {
  background: #111;
}

.facet-bar__check {
  position: absolute;
  top: -0.4rem;
  right: -0.4rem;
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #ececec;
  color: #161616;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.35);
  visibility: hidden;
}

.facet-bar__opt.is-on .facet-bar__check {
  visibility: visible;
}

.facet-bar__check svg {
  width: 0.72rem;
  height: 0.72rem;
}

.facet-bar__cat:focus-visible,
.facet-bar__opt:focus-visible,
.facet-bar__clear:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
}

.case-count {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  white-space: nowrap;
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0.15rem 0 0;
  padding: 0;
  list-style: none;
}

.case-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--bg-elevated);
  color: inherit;
}

.case-card img {
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
}

.case-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0.7rem 0.8rem 0.75rem;
}

.case-card .eyebrow {
  font-size: 0.68rem;
}

.case-card h3 {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.case-card__summary {
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.case-card__go {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.3rem;
  color: var(--accent-ink);
  font-size: 0.95rem;
  font-weight: 700;
}

.case-card__go svg {
  transition: transform 200ms ease;
}

.case-card:hover {
  border-color: var(--accent);
}

.case-card:hover .case-card__go svg {
  transform: translateX(3px);
}

.case-card:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
}

.case-empty {
  color: var(--text-muted);
}

.study-prose {
  color: var(--text-soft);
  font-size: clamp(1.05rem, 1.35vw, 1.2rem);
}

.study-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

.study-tags li {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.study-index {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.study-block .check-list {
  max-width: 46rem;
}

.study-outcome {
  max-width: 46rem;
  margin-top: 0.5rem;
  color: var(--text-soft);
  font-size: 1.05rem;
}

.study-pager__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}

.study-jump {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 7.5rem;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: var(--bg-elevated);
  color: inherit;
}

.study-jump span {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.study-jump strong {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
}

.study-jump--next {
  align-items: flex-end;
  text-align: right;
}

.study-jump:hover {
  border-color: var(--accent);
}

.study-jump:hover strong {
  color: var(--accent-ink);
}

.study-missing .lede {
  max-width: 36rem;
}

/*
  Holding page for individual studies. Same type, colour, and left edge
  as the case list. The 404 is the status; the headline is the message.
*/
.soon {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1.15rem;
  padding-top: calc(var(--header-offset) + 1.5rem);
  padding-bottom: 3rem;
}

.soon-code {
  margin: 0;
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: clamp(4.75rem, 16vw, 9rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.82;
}

.soon .display {
  max-width: 11em;
}

.soon .lede {
  max-width: 34rem;
}

.soon .arrow-fill {
  margin-top: 0.85rem;
}

@media (max-width: 1100px) {
  .case-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .case-facts,
  .study-pager__row {
    grid-template-columns: 1fr;
  }

  .study-jump--next {
    align-items: flex-start;
    text-align: left;
  }
}

@media (max-width: 680px) {
  .case-grid {
    grid-template-columns: 1fr;
  }

  .facet-bar__head {
    align-items: flex-start;
  }

  .facet-bar__options {
    display: flex;
    flex-basis: 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-card__go svg,
  .facet-bar__cat svg {
    transition: none;
  }
}
