.case-detail {
  background: var(--bg);
  overflow-x: hidden;
}

.case-detail-shell {
  padding-top: clamp(58px, 6vw, 78px);
}

.case-detail__back {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 0 var(--pad);
}

.case-detail__back-link {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(9, 17, 27, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  color: rgba(9, 17, 27, 0.56);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.case-detail__back-link svg {
  width: 16px;
  height: 16px;
}

.case-detail__back-link:hover,
.case-detail__back-link:focus-visible {
  transform: translateX(-2px);
  border-color: rgba(9, 17, 27, 0.26);
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
  outline: none;
}

.case-hero-loop {
  width: 100%;
  max-width: var(--max);
  min-height: auto;
  margin: 0 auto;
  padding: clamp(22px, 3.8vw, 42px) var(--pad) clamp(24px, 3.4vw, 42px);
  display: grid;
  align-content: center;
}

.case-hero-loop > *,
.case-stamp-point > * {
  min-width: 0;
}

/* LOCKED hero layout (see WIP.md "Case Page Hero + Mobile Standard").
   Left title block is vertically CENTERED against the right column, so the
   left side re-centers as the right copy changes length. Keep align-items: center. */
.case-hero-loop__head {
  display: grid;
  grid-template-columns: minmax(320px, 0.48fr) minmax(360px, 0.52fr);
  align-items: center;
  gap: clamp(28px, 5vw, 82px);
}

.case-hero-loop__title-block {
  display: grid;
  gap: 14px;
  padding-top: clamp(2px, 0.5vw, 8px);
}

/* Header reads "<Case name> [logo]" - the loop mark stands in for "Loop".
   baseline so the logo sits on the text baseline, not floating at center. */
.case-loop-mark {
  display: flex;
  align-items: baseline;
  gap: clamp(10px, 1.4vw, 16px);
}

/* Groups the h1 + built-note so the note centers under the WORD only
   (the logo is outside this group, so it is excluded from the centering). */
.case-title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.case-loop-mark img {
  width: auto;
  height: clamp(30px, 3.4vw, 52px);
  transform: translateY(0.04em);
}

.case-loop-mark h1 {
  max-width: none;
  font-size: clamp(44px, 6.4vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.065em;
}

@media (min-width: 901px) {
  .case-loop-mark h1 {
    white-space: nowrap;
  }
}

/* Scoped: the long single word "Photographer" needs a smaller hero size so it
   fits without pushing the loop mark. Only this case page; others untouched. */
.case-detail--photographer-back-office .case-loop-mark h1 {
  font-size: clamp(44px, 5vw, 74px);
}

.case-detail--rental-property-admin .case-loop-mark h1 {
  font-size: clamp(40px, 4.05vw, 62px);
}

.case-detail--booking-ops .case-loop-mark h1 {
  font-size: clamp(42px, 4.35vw, 66px);
}

.case-detail--startup-revenue-tracker .case-loop-mark h1 {
  font-size: clamp(40px, 4.05vw, 62px);
}

.case-detail--similar-companies .case-loop-mark h1 {
  font-size: clamp(36px, 3.85vw, 58px);
  letter-spacing: -0.06em;
}

.case-detail--similar-companies .case-hero-loop__head {
  grid-template-columns: minmax(430px, 0.48fr) minmax(420px, 0.52fr);
  gap: clamp(42px, 6vw, 96px);
}

.case-detail--similar-companies .case-loop-mark {
  gap: clamp(8px, 1vw, 12px);
}

.case-detail--similar-companies .case-loop-mark img {
  height: clamp(24px, 2.45vw, 36px);
  flex: 0 0 auto;
}

.case-detail--similar-companies .case-hero-loop__italic {
  max-width: 48rem;
  font-size: clamp(24px, 2.35vw, 36px);
}

.case-built-note {
  max-width: 31rem;
  color: rgba(9, 17, 27, 0.48);
  font-size: clamp(14px, 1vw, 16px);
  line-height: 1.38;
  font-weight: 600;
  text-align: center;
}

.case-detail--similar-companies .case-built-note {
  max-width: none;
  white-space: nowrap;
}

.case-hero-loop__reading {
  display: grid;
  gap: clamp(12px, 1.6vw, 18px);
}

.case-hero-loop__italic {
  width: 100%;
  max-width: 56rem;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(24px, 2.7vw, 40px);
  font-style: italic;
  line-height: 1.02;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.case-detail--rental-property-admin .case-hero-loop__italic {
  white-space: normal;
}

.case-detail--similar-companies .case-hero-loop__italic {
  white-space: normal;
}

.case-hero-loop__copy {
  width: 100%;
  max-width: 50rem;
  display: grid;
  gap: 8px;
  color: rgba(9, 17, 27, 0.72);
  font-size: clamp(15.5px, 1.1vw, 18px);
  line-height: 1.48;
  letter-spacing: -0.01em;
  font-weight: 570;
}

.case-hero-loop__copy strong {
  color: var(--text);
  font-weight: 850;
}

.case-specs {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(6px, 1.5vw, 16px) var(--pad) clamp(30px, 4vw, 54px);
  display: grid;
  gap: 0;
}

.case-stamp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(22px, 4vw, 70px);
  padding-top: clamp(8px, 1vw, 14px);
}

.case-stamp-point {
  display: grid;
  align-content: start;
  gap: 11px;
  padding-top: clamp(12px, 1.5vw, 18px);
  border-top: 1px solid rgba(9, 17, 27, 0.16);
}

.case-stamp-point span {
  width: fit-content;
  padding: 5px 8px 6px;
  border: 2px solid #ff5a2c;
  border-radius: 6px;
  color: #ff5a2c;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  transform: rotate(-1.7deg);
}

.case-stamp-point h2 {
  max-width: 22rem;
  font-size: clamp(19px, 1.7vw, 26px);
  line-height: 1.03;
  letter-spacing: -0.04em;
}

@media (min-width: 901px) {
  .case-detail--content-publishing .case-stamp-point h2 {
    min-height: calc(clamp(19px, 1.7vw, 26px) * 2.06);
  }
}

.case-stamp-point p {
  width: 100%;
  max-width: 24rem;
  color: rgba(9, 17, 27, 0.68);
  font-size: clamp(13.5px, 0.96vw, 15.5px);
  line-height: 1.42;
  font-weight: 560;
}

.case-workflow {
  background: #f7f6f1;
  border-top: 1px solid var(--line);
}

/* trim the tall page-section padding above/below these case sections */
.case-workflow.start-flow {
  padding-top: clamp(48px, 5vw, 74px);
  padding-bottom: clamp(40px, 4.5vw, 66px);
}

.case-outcomes.method {
  padding-top: clamp(48px, 5vw, 74px);
  padding-bottom: clamp(52px, 6vw, 82px);
}

.case-workflow .start-copy p {
  max-width: 50rem;
}

.case-workflow .start-copy h2,
.case-outcomes .method-copy h2,
.case-cta h2 {
  white-space: nowrap;
}

.case-inline-link {
  color: #c7461e;
  font-weight: 850;
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
  transition: color 160ms ease, text-underline-offset 160ms ease;
}

.case-inline-link:hover,
.case-inline-link:focus-visible {
  color: var(--text);
  text-underline-offset: 0.24em;
  outline: none;
}

.case-workflow .start-inner {
  gap: clamp(22px, 2.6vw, 38px);
}

/* Horizontal workflow rail. Numbered nodes sit on the line and say what the
   step does; the ministeps above each node are the operations inside it. */
.case-flow {
  --flow-line: rgba(9, 17, 27, 0.18);
  --cp-top: clamp(96px, 9vw, 116px);
  position: relative;
  margin-top: 0;
}

/* base track + an orange pulse that runs 01 -> 06 like a current */
.case-flow::before,
.case-flow::after {
  content: "";
  position: absolute;
  left: 8.33%;
  right: 8.33%;
  top: calc(var(--cp-top) + 28px);
  height: 2px;
  transform: translateY(-1px);
}

.case-flow::before {
  background: var(--flow-line);
}

.case-flow::after {
  background-image: linear-gradient(90deg, rgba(255, 90, 44, 0), #ff5a2c, rgba(255, 90, 44, 0));
  background-size: 26% 100%;
  background-repeat: no-repeat;
  background-position: -26% 0;
  animation: case-flow-current 3s linear infinite;
}

@keyframes case-flow-current {
  to {
    background-position: 126% 0;
  }
}

@keyframes case-flow-current-v {
  to {
    background-position: 0 155%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-flow::after,
  .cp::after {
    animation: none;
    opacity: 0;
  }
}

.case-flow__track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(6px, 1vw, 18px);
}

.cp {
  display: grid;
  grid-template-rows: var(--cp-top) 56px auto;
  justify-items: center;
  text-align: center;
}

/* ministeps above the line - editorial serif, no boxes */
.cp__mini {
  grid-row: 1;
  align-self: end;
  justify-self: center;
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 5px;
  width: fit-content;
  max-width: 12rem;
  text-align: left;
}

.cp__mini li {
  color: rgba(9, 17, 27, 0.66);
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 11.5px;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

/* node sits on the line */
.cp__node {
  grid-row: 2;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 24px rgba(9, 17, 27, 0.18);
}

/* below the line: what the step does + an optional technical dropdown */
.cp__foot {
  grid-row: 3;
  align-self: start;
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 14px;
  width: 100%;
  max-width: 12rem;
}

.cp__title {
  margin: 0;
  color: #ff5a2c;
  font-size: 12.5px;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 800;
}

@media (min-width: 901px) {
  .case-detail--startup-revenue-tracker .cp__title {
    min-height: 2.4em;
  }
}

.cp__more {
  width: 100%;
}

.cp__more summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  margin: 0 auto;
  color: rgba(9, 17, 27, 0.5);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
  transition: color 0.15s ease;
}

.cp__more summary::-webkit-details-marker {
  display: none;
}

.cp__more summary::after {
  content: "+";
  font-size: 13px;
  line-height: 1;
  color: #ff5a2c;
}

.cp__more[open] summary::after {
  content: "\2212"; /* minus */
}

.cp__more summary:hover {
  color: rgba(9, 17, 27, 0.78);
}

.cp__more ul {
  margin: 10px auto 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  width: fit-content;
  max-width: 12rem;
  text-align: left;
}

.cp__more li {
  position: relative;
  padding-left: 15px;
  color: rgba(9, 17, 27, 0.62);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 500;
}

.cp__more li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: rgba(255, 90, 44, 0.78);
  font-weight: 700;
}

.case-workflow__tag {
  width: fit-content;
  justify-self: center;
  padding: 5px 8px;
  border: 1px solid rgba(255, 90, 44, 0.26);
  color: #c94620;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.case-step-details {
  max-width: 15rem;
  color: rgba(9, 17, 27, 0.6);
  font-size: 13px;
  line-height: 1.45;
}

.case-step-details summary {
  width: fit-content;
  margin: 6px auto 0;
  color: rgba(9, 17, 27, 0.76);
  cursor: pointer;
  font-weight: 800;
}

.case-step-details p {
  margin: 8px 0 0;
}

.case-hood {
  display: grid;
  grid-template-columns: minmax(230px, 0.3fr) minmax(0, 0.7fr);
  gap: clamp(22px, 4vw, 54px);
  padding: clamp(24px, 3.4vw, 40px);
  border: 1px solid rgba(9, 17, 27, 0.14);
  background: #ece8df;
}

.case-hood__copy {
  display: grid;
  align-content: start;
  gap: 12px;
}

.case-hood__copy h3 {
  margin: 0;
  font-size: clamp(28px, 3vw, 46px);
  line-height: 0.96;
  letter-spacing: -0.055em;
}

.case-hood__copy p {
  max-width: 18rem;
  margin: 0;
  color: rgba(9, 17, 27, 0.66);
  font-size: 15px;
  line-height: 1.44;
  font-weight: 590;
}

.case-hood__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: rgba(9, 17, 27, 0.12);
  border: 1px solid rgba(9, 17, 27, 0.12);
}

.case-hood__grid article {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 126px;
  padding: clamp(15px, 1.8vw, 20px);
  background: #f7f6f1;
}

.case-hood__grid span {
  color: #c94620;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.case-hood__grid p {
  margin: 0;
  color: rgba(9, 17, 27, 0.68);
  font-size: 13.5px;
  line-height: 1.45;
  font-weight: 550;
}

.case-outcomes {
  background: #ece8df;
}

.case-outcomes .method-copy {
  align-items: end;
}

.case-outcomes .method-copy p {
  color: rgba(9, 17, 27, 0.7);
  font-size: clamp(16px, 1.4vw, 21px);
  line-height: 1.32;
  letter-spacing: -0.022em;
  font-weight: 600;
}

/* closing call to action */
.case-cta {
  background: #ff5a2c;
  padding: clamp(26px, 3.3vw, 42px) var(--pad);
}

.case-cta__inner {
  width: min(100%, var(--max));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(220px, 0.82fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(24px, 6vw, 88px);
  color: var(--text);
  text-decoration: none;
  transition: transform 180ms ease;
}

.case-cta__inner:hover {
  transform: translateY(-2px);
}

.case-cta__inner:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 8px;
}

.case-cta h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(34px, 5.2vw, 76px);
  line-height: 0.92;
  letter-spacing: -0.058em;
  font-weight: 900;
}

.case-cta__copy {
  display: grid;
  justify-items: start;
  gap: 9px;
  max-width: 35rem;
}

.case-cta h3 {
  margin: 0;
  color: var(--text);
  font-size: clamp(24px, 3vw, 42px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  font-weight: 860;
}

.case-detail--similar-companies .case-cta__copy {
  max-width: 42rem;
}

.case-detail--similar-companies .case-cta h3 {
  white-space: nowrap;
  font-size: clamp(24px, 2.7vw, 38px);
}

.case-detail--proposal-system .case-cta__copy {
  max-width: 42rem;
}

.case-detail--proposal-system .case-cta h3 {
  white-space: nowrap;
  font-size: clamp(19px, 2.7vw, 38px);
}

.case-detail--quotation-system .case-cta__copy {
  max-width: 44rem;
}

.case-detail--quotation-system .case-cta h3 {
  white-space: nowrap;
  font-size: clamp(14px, 2.25vw, 32px);
}

.case-cta p {
  margin: 0;
  color: rgba(9, 17, 27, 0.72);
  font-size: clamp(13px, 1vw, 15px);
  line-height: 1.45;
  font-weight: 540;
}

.case-cta__stamp {
  width: fit-content;
  justify-self: center;
  margin-top: 13px;
  padding: 10px 15px 11px;
  border: 2.5px solid var(--text);
  border-radius: 6px;
  color: var(--text);
  font-size: clamp(14px, 1.25vw, 18px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  transform: rotate(-1.7deg);
  transition: background 180ms ease, color 180ms ease;
}

.case-cta__inner:hover .case-cta__stamp {
  background: var(--text);
  color: #ff5a2c;
}

.case-outcomes .method-orb strong {
  max-width: 9rem;
}

.case-outcomes .method-orb p {
  max-width: 10rem;
}

@media (max-width: 900px) {
  .case-hero-loop__head {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .case-loop-mark {
    align-items: baseline;
    flex-direction: row;
  }

  .case-title-group {
    align-items: flex-start;
  }

  .case-built-note {
    text-align: left;
    white-space: nowrap;
    font-size: clamp(7.5px, 2.3vw, 11px);
  }

  .case-loop-mark h1 {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: clamp(46px, 14.5vw, 62px);
  }

  .case-hero-loop__copy,
  .case-stamp-point p {
    max-width: calc(100vw - (var(--pad) * 2));
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .case-hero-loop__italic {
    max-width: calc(100vw - (var(--pad) * 2));
    white-space: nowrap;
    font-size: clamp(15px, 4.6vw, 30px);
  }

  .case-detail--rental-property-admin .case-hero-loop__italic {
    white-space: normal;
  }

  .case-stamp-grid {
    grid-template-columns: 1fr;
  }

  .case-stamp-point {
    min-height: auto;
  }

  .case-step-details,
  .case-step-details summary {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }

  .case-workflow__tag {
    justify-self: start;
  }

  .case-flow::before,
  .case-flow::after {
    display: none;
  }

  .case-flow__track {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  /* vertical connecting line + downward current between step nodes */
  .cp {
    position: relative;
  }

  .cp:not(:last-child)::before,
  .cp:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 28px;
    top: 28px;
    bottom: -56px;
    width: 2px;
    transform: translateX(-1px);
    z-index: 0;
  }

  .cp:not(:last-child)::before {
    background: var(--flow-line);
  }

  .cp:not(:last-child)::after {
    background-image: linear-gradient(180deg, rgba(255, 90, 44, 0), #ff5a2c, rgba(255, 90, 44, 0));
    background-size: 100% 55%;
    background-repeat: no-repeat;
    background-position: 0 -55%;
    animation: case-flow-current-v 3s linear infinite;
  }

  .cp:nth-child(2)::after { animation-delay: 0.5s; }
  .cp:nth-child(3)::after { animation-delay: 1s; }
  .cp:nth-child(4)::after { animation-delay: 1.5s; }
  .cp:nth-child(5)::after { animation-delay: 2s; }

  .cp {
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    justify-items: start;
    align-items: start;
    text-align: left;
    column-gap: 18px;
    row-gap: 12px;
  }

  .cp__node {
    grid-row: 1;
    grid-column: 1;
  }

  /* let the title, mini steps and dropdown stack as their own rows */
  .cp__foot {
    display: contents;
  }

  .cp__title {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    margin: 0;
  }

  .cp__mini {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    justify-self: start;
    margin: 0;
    max-width: none;
    text-align: left;
  }

  .cp__more {
    grid-column: 2;
    grid-row: 3;
    width: 100%;
    margin-top: 2px;
  }

  .cp__more summary {
    margin: 0;
  }

  .cp__mini li {
    position: relative;
    padding-left: 14px;
  }

  .cp__mini li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.62em;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(9, 17, 27, 0.3);
  }

  .case-hood {
    grid-template-columns: 1fr;
    padding: clamp(20px, 6vw, 28px);
  }

  .case-hood__copy p {
    max-width: 34rem;
  }

  .case-hood__grid {
    grid-template-columns: 1fr;
  }

  .case-cta__inner {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .case-cta h2 {
    max-width: none;
  }

  .case-cta__copy {
    max-width: 34rem;
  }
}

@media (max-width: 720px) {
  .case-detail-shell {
    padding-top: 68px;
  }

  .case-hero-loop {
    min-height: auto;
    padding-top: 14px;
  }

  .cp__mini span {
    font-size: 10.5px;
  }
}

/* Longer case names retain the shared title-and-loop layout. */
.case-detail--proposal-system .case-loop-mark h1 {
  font-size: clamp(34px, 4.1vw, 62px);
}

.case-detail--quotation-system .case-loop-mark h1 {
  font-size: clamp(30px, 3.5vw, 54px);
}

@media (min-width: 1025px) {
  .case-detail--proposal-system .case-outcomes .method-copy p {
    justify-self: end;
  }
}

@media (max-width: 900px) {
  .case-detail--proposal-system .case-loop-mark h1 {
    font-size: clamp(28px, 8.6vw, 62px);
  }

  .case-detail--quotation-system .case-loop-mark h1 {
    font-size: clamp(25px, 7.3vw, 54px);
  }

  .case-detail--proposal-system .case-hero-loop__italic,
  .case-detail--quotation-system .case-hero-loop__italic {
    white-space: normal;
  }
}
