/* Work page — same shell as Home; content-only differences */

.work-layout {
  /* inherits .layout; keep track minmax so content cannot force overflow */
  min-height: 70vh;
}

.work-layout.layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 17.5rem);
}

.work-rail-label {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--side-muted);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #3a3a3a;
}

.work-cats {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.work-cat {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.35rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--side-muted);
  cursor: pointer;
  border-right: 2px solid transparent;
}

.work-cat .cat-short {
  display: none;
}

.work-cat:hover {
  color: var(--side-text);
}

.work-cat.is-active {
  color: var(--side-text);
  border-right-color: #e6e6e6;
}

.featured h1 {
  margin: 0.35rem 0 0.85rem;
  font-size: clamp(1.25rem, 2.5vw, 1.55rem);
  text-transform: none;
  letter-spacing: -0.02em;
}

.chip {
  display: inline-block;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.stage-figure {
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  background: #f7f7f7;
}

.stage-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.case-back {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.case-back a {
  color: var(--muted);
  text-decoration: none;
}

.case-back a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.case-lede {
  margin: 0 0 1.15rem;
  color: var(--muted);
  max-width: 40rem;
}

.case-figure {
  margin: 0 0 1.5rem;
  border: 1px solid var(--line);
  background: #f7f7f7;
}

.case-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.case-figure figcaption {
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: #fafafa;
}

.evidence-grid {
  margin: 0.75rem 0 0;
  display: grid;
  gap: 0.85rem;
}

.evidence-grid .case-figure {
  margin: 0;
}

@media (min-width: 640px) {
  .evidence-grid.two {
    grid-template-columns: 1fr 1fr;
  }
}

.evidence-note {
  margin: 0.65rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.dataset-links {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.dataset-links li {
  margin-bottom: 0.25rem;
}

.dataset-links a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.case-block {
  margin-bottom: 1.25rem;
}

.case-block h2 {
  font-size: 0.78rem;
}

.case-block ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  color: var(--text);
}

.case-block li {
  margin-bottom: 0.3rem;
}

.status-line {
  color: var(--muted);
  font-size: 0.94rem;
}

.side-copy a {
  color: var(--side-text);
}

.stage {
  display: grid;
  place-content: center;
  min-height: 200px;
  margin-bottom: 1rem;
  padding: 1.5rem;
  text-align: center;
  background:
    repeating-linear-gradient(
      -12deg,
      #f3f3f3,
      #f3f3f3 12px,
      #eeeeee 12px,
      #eeeeee 24px
    );
  border: 1px dashed var(--line);
  color: var(--muted);
  font-weight: 600;
}

.stage p {
  margin: 0;
}

.stage-sub {
  margin-top: 0.35rem !important;
  font-size: 0.86rem;
  font-weight: 500 !important;
}

.featured-meta {
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.featured-meta div {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}

.featured-meta dt {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.featured-meta dd {
  margin: 0;
  color: var(--text);
  font-size: 0.94rem;
}

.more-label {
  margin: 1.25rem 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.empty-card {
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  background: #fafafa;
  color: var(--muted);
  font-size: 0.9rem;
}

.is-hidden {
  display: none;
}

@media (max-width: 820px) {
  .work-layout.layout {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Only the Work category rail belongs above content; case meta stays after */
  .work-layout .side:has(.work-cats) {
    order: -1;
    max-width: 100%;
    min-width: 0;
    padding: 0.9rem 1rem 1rem;
  }

  .work-layout .side {
    max-width: 100%;
    min-width: 0;
  }

  .work-rail {
    padding-bottom: 0;
  }

  .work-rail-label {
    margin-bottom: 0.5rem;
  }

  /* Equal chip grid — avoids ragged flex wrap / clipped labels */
  .work-cats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    width: 100%;
  }

  .work-cat {
    width: 100%;
    min-width: 0;
    border: 1px solid #3a3a3a;
    border-right: 1px solid #3a3a3a;
    border-radius: 2px;
    white-space: normal;
    line-height: 1.25;
    padding: 0.45rem 0.5rem;
    font-size: 0.78rem;
    background: #242424;
    text-align: center;
  }

  .work-cat .cat-long {
    display: none;
  }

  .work-cat .cat-short {
    display: inline;
  }

  .work-cat.is-active {
    border-color: #e6e6e6;
    background: #2e2e2e;
    color: var(--side-text);
  }

  .featured h1 {
    font-size: 1.2rem;
  }

  .featured-meta div {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .featured-meta dt {
    margin-bottom: 0.1rem;
  }

  .stage-figure,
  .case-figure {
    max-width: 100%;
    overflow: hidden;
  }

  .evidence-grid.two {
    grid-template-columns: 1fr;
  }

  .case-lede {
    max-width: none;
  }

  .work-main,
  .case-main {
    padding-top: 1.15rem;
  }
}

@media (max-width: 560px) {
  .work-layout .side {
    padding: 0.8rem 1rem 0.9rem;
  }

  .work-cats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .work-cat {
    font-size: 0.74rem;
    padding: 0.4rem 0.4rem;
  }

  .work-main,
  .case-main {
    padding-top: 1rem;
  }
}
