/* Case files: the index grid at /cases/ and one page per case.
   Colors, radii, shadows and fonts are the site tokens from css/site-theme.css,
   so both themes follow without separate dark rules. Every selector is scoped
   to body.case-file-body: the shared stylesheet stack styles bare elements,
   and the scope keeps these pages independent of it. */

body.case-file-body main {
  padding: 24px 0 clamp(56px, 8vw, 96px);
  background: var(--pm-canvas);
}

body.case-file-body .case-wrap {
  box-sizing: border-box;
  width: 100%;
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 24px;
}

body.case-file-body .case-wrap--wide {
  max-width: var(--pm-measure);
}

/* Breadcrumb */
body.case-file-body .case-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 1.5rem 0 1.4rem;
  color: var(--pm-text-muted);
  font-family: var(--pm-font);
  font-size: 0.9rem;
  line-height: 1.4;
}

body.case-file-body .case-breadcrumbs a {
  color: var(--pm-slate);
  text-decoration: none;
}

body.case-file-body .case-breadcrumbs a:hover {
  text-decoration: underline;
}

body.case-file-body .case-breadcrumbs [aria-current] {
  color: var(--pm-text);
  font-weight: 600;
}

/* Headings */
body.case-file-body h1 {
  max-width: 22ch;
  margin: 0 0 1.1rem;
  color: var(--pm-text);
  font-family: var(--pm-font);
  font-size: clamp(2.1rem, 4.6vw, 3.3rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

body.case-file-body .case-index h1 {
  margin: 2.4rem 0 0;
}

body.case-file-body .case-section h2 {
  margin: 0 0 0.9rem;
  padding: 0;
  border: 0;
  color: var(--pm-text);
  font-family: var(--pm-font);
  font-size: clamp(1.35rem, 2.2vw, 1.65rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

/* Date, kind and setting: facts about the case, set as small chips */
body.case-file-body .case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.8rem;
  padding: 0;
  list-style: none;
}

body.case-file-body .case-meta li {
  margin: 0;
  padding: 0.32rem 0.8rem;
  border: 1px solid var(--pm-border-strong);
  border-radius: var(--pm-radius-pill);
  background: var(--pm-surface);
  color: var(--pm-text-2);
  font-family: var(--pm-font);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.03em;
}

body.case-file-body .case-meta li:first-child {
  border-color: var(--pm-brass-line);
  background: var(--pm-brass-soft);
  color: var(--pm-brass-text);
}

/* Illustration */
body.case-file-body .case-figure {
  margin: 0;
}

body.case-file-body .case-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--pm-radius);
  box-shadow: var(--pm-shadow-2);
}

/* Body text */
body.case-file-body .case-section {
  margin: clamp(2.2rem, 4vw, 3.2rem) 0 0;
}

body.case-file-body .case-section p.text,
body.case-file-body .case-list li,
body.case-file-body .case-sources li,
body.case-file-body .case-pattern__note {
  max-width: 44rem;
  color: var(--pm-text-2);
  font-family: var(--pm-font-read);
  font-size: 1.14rem;
  line-height: 1.7;
}

body.case-file-body .case-section p.text {
  margin: 0 0 1.05rem;
}

body.case-file-body .case-section a {
  color: var(--pm-primary);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--pm-brass-line);
  text-underline-offset: 3px;
}

body.case-file-body .case-section a:hover {
  text-decoration-color: var(--pm-brass);
}

body.case-file-body .case-list,
body.case-file-body .case-sources {
  margin: 0;
  padding: 0 0 0 1.3rem;
}

body.case-file-body .case-list li,
body.case-file-body .case-sources li {
  margin: 0 0 0.7rem;
  padding-left: 0.2rem;
}

body.case-file-body .case-list li::marker,
body.case-file-body .case-sources li::marker {
  color: var(--pm-brass);
}

body.case-file-body .case-sources li {
  font-size: 1.02rem;
  line-height: 1.6;
}

body.case-file-body .case-checked {
  margin: 1.1rem 0 0;
  color: var(--pm-text-muted);
  font-family: var(--pm-font);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Patterns the case is read against */
body.case-file-body .case-patterns {
  display: grid;
  gap: 0.8rem;
  max-width: 46rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
}

body.case-file-body .case-pattern {
  margin: 0;
  padding: 0.95rem 1.15rem 1rem;
  border: 1px solid var(--pm-border);
  border-left: 4px solid var(--pm-brass);
  border-radius: var(--pm-radius-sm);
  background: var(--pm-surface);
}

body.case-file-body .case-pattern--rule-out {
  border-left-color: var(--pm-border-strong);
}

body.case-file-body .case-pattern__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem 1rem;
  margin: 0 0 0.4rem;
  font-family: var(--pm-font);
  font-size: 1.02rem;
  line-height: 1.4;
}

body.case-file-body .case-pattern__id {
  color: var(--pm-brass-text);
  font-weight: 700;
}

body.case-file-body .case-pattern__fit {
  color: var(--pm-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

body.case-file-body .case-pattern__note {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.6;
}

/* Newer and older case */
body.case-file-body .case-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: clamp(2.4rem, 4vw, 3.4rem) 0 0;
  padding: 1.6rem 0 0;
  border-top: 1px solid var(--pm-border);
  font-family: var(--pm-font);
}

body.case-file-body .case-pagination a {
  display: block;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-sm);
  background: var(--pm-surface);
  color: var(--pm-text);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}

body.case-file-body .case-pagination a:hover {
  border-color: var(--pm-slate-2);
}

body.case-file-body .case-pagination__older {
  text-align: right;
}

body.case-file-body .case-pagination__label {
  display: block;
  margin: 0 0 0.2rem;
  color: var(--pm-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Index grid */
body.case-file-body .case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1.5rem;
  margin: 2.2rem 0 0;
  padding: 0;
  list-style: none;
}

body.case-file-body .case-card {
  margin: 0;
  padding: 0;
}

body.case-file-body .case-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius);
  background: var(--pm-surface);
  box-shadow: var(--pm-shadow-1);
  color: var(--pm-text);
  text-decoration: none;
  transition: transform 0.18s var(--pm-ease), box-shadow 0.18s var(--pm-ease), border-color 0.18s var(--pm-ease);
}

body.case-file-body .case-card__link:hover {
  border-color: var(--pm-border-strong);
  box-shadow: var(--pm-shadow-2);
  transform: translateY(-2px);
}

body.case-file-body .case-card__link:focus-visible {
  outline: 3px solid var(--pm-brass);
  outline-offset: 3px;
}

body.case-file-body .case-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

body.case-file-body .case-card__title {
  margin: 1rem 1.15rem 0.5rem;
  padding: 0;
  border: 0;
  color: var(--pm-text);
  font-family: var(--pm-font);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

body.case-file-body .case-card__date {
  margin: auto 1.15rem 1.05rem;
  color: var(--pm-brass-text);
  font-family: var(--pm-font);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  body.case-file-body .case-wrap {
    padding: 0 16px;
  }

  body.case-file-body .case-section p.text,
  body.case-file-body .case-list li {
    font-size: 1.08rem;
  }

  body.case-file-body .case-pagination {
    grid-template-columns: 1fr;
  }

  body.case-file-body .case-pagination__older {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.case-file-body .case-card__link {
    transition: none;
  }

  body.case-file-body .case-card__link:hover {
    transform: none;
  }
}
