/* Case details use the saved case cover as the full-width hero. */
.case-detail-page {
  --case-gutter: max(24px, calc((100% - 1200px) / 2));
  --case-reading-inset: max(24px, calc((100% - 1080px) / 2));
  --case-section-heading: clamp(21px, 2vw, 28px);
  padding: var(--ty-header) 0 0;
  background: #fff;
}

.case-detail-page .site-shell.case-detail-copy {
  display: grid;
  position: relative;
  isolation: isolate;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(3, auto);
  width: 100%;
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.site-shell.case-detail-copy::before,
.site-shell.case-detail-copy > h1 + .case-detail-lead + figure {
  position: absolute;
  grid-area: 1 / 1 / 4 / 2;
  inset: 0;
  margin: 0;
  background: #092748;
}

.site-shell.case-detail-copy::before { z-index: -2; content: ""; }
.site-shell.case-detail-copy > h1 + .case-detail-lead + figure { z-index: -1; overflow: hidden; }
.site-shell.case-detail-copy > h1 + .case-detail-lead + figure::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #081f3a 0%, rgba(8,31,58,.97) 24%, rgba(8,31,58,.84) 46%, rgba(8,31,58,.30) 73%, rgba(8,31,58,.14) 100%);
  content: "";
}

.site-shell.case-detail-copy > h1 + .case-detail-lead + figure > img {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  object-position: center 51%;
}

.site-shell.case-detail-copy > h1 + .case-detail-lead + figure > figcaption { display: none; }

.site-shell.case-detail-copy > .site-kicker,
.site-shell.case-detail-copy > h1,
.site-shell.case-detail-copy > .case-detail-lead {
  grid-column: 1;
  width: min(100%, calc(var(--case-gutter) + 660px));
  margin: 0;
  padding-inline: var(--case-gutter) 24px;
  text-align: left;
}

.site-shell.case-detail-copy > .site-kicker {
  grid-row: 1;
  padding-top: clamp(65px, 7vw, 115px);
  color: #a9ddff;
  font-size: 14px;
  line-height: 1.5;
}

.site-shell.case-detail-copy > h1 {
  grid-row: 2;
  padding-top: 15px;
  color: #fff;
  font-size: clamp(34px, 3.2vw, 52px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .01em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.site-shell.case-detail-copy > .case-detail-lead {
  grid-row: 3;
  padding-top: 20px;
  padding-bottom: clamp(60px, 6.5vw, 105px);
  color: #e3effb;
  font-size: 16px;
  line-height: 1.85;
}

.site-shell.case-detail-copy > dl {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 18px var(--case-reading-inset);
  border-bottom: 1px solid var(--ty-line);
  background: var(--ty-soft);
  color: var(--ty-ink);
  font-size: 14px;
  line-height: 1.5;
}

.site-shell.case-detail-copy > dl dt { color: #4f6480; }
.site-shell.case-detail-copy > dl dd:not(:last-child) { margin-right: 18px; }

.case-detail-copy > .case-detail-body {
  min-width: 0;
  padding: 0 var(--case-reading-inset);
  color: var(--ty-text);
  line-height: 1.85;
}

.case-detail-body > div { padding: 24px 0; }
.case-detail-body > div + div { border-top: 1px solid var(--ty-line); }
.case-detail-body h2 {
  margin: 0 0 12px;
  color: var(--ty-ink);
  font-size: var(--case-section-heading);
  font-weight: 600;
  line-height: 1.4;
}
.case-detail-body p, .case-detail-body ol { max-width: 52em; margin: 0 0 12px; }
.case-detail-body p { text-indent: 0; }
.case-detail-body > ol,
.case-detail-body > div > ol { padding-inline-start: 0; list-style: none; }
.case-detail-body li + li { margin-top: 8px; }
.case-detail-body li > strong { color: var(--ty-ink); font-weight: 600; }
.case-detail-body a { color: var(--ty-primary-dark); text-decoration: underline; text-underline-offset: 3px; }

.case-detail-body > table:first-child {
  width: 100%;
  margin: 10px 0 0;
  border-collapse: collapse;
  table-layout: fixed;
  text-align: left;
}

.case-detail-body > table:first-child td {
  padding: 19px clamp(8px, 2vw, 27px);
  border-bottom: 2px solid #c9dff4;
  background: #eff6fd;
  color: var(--ty-ink);
  font-size: clamp(12px, 1.6vw, 16px);
  vertical-align: top;
}

.case-detail-body > table:first-child td + td { border-left: 1px solid #d5e5f5; }
.case-detail-body > table:first-child strong {
  color: var(--ty-primary-dark);
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.14;
}

.case-detail-copy > .case-detail-body + figure {
  width: min(1080px, calc(100% - 2 * var(--case-reading-inset)));
  margin: 0 auto 34px;
  padding: 14px;
  border: 1px solid var(--ty-line);
  border-radius: 12px;
  background: var(--ty-soft);
}
.case-detail-copy > .case-detail-body + figure img { border-radius: 5px; }
.case-detail-copy > .case-detail-body + figure figcaption { color: #4f6480; }

.site-shell.case-detail-copy > p:last-child:not(.case-detail-lead) {
  margin: 0;
  padding: 22px var(--case-reading-inset) 42px;
  border-top: 1px solid var(--ty-line);
  color: var(--ty-primary-dark);
  line-height: 2.25;
}

@media (max-width: 640px) {
  .case-detail-page { --case-gutter: 20px; --case-reading-inset: 20px; }
  .site-shell.case-detail-copy > h1 + .case-detail-lead + figure::after {
    background: linear-gradient(90deg, rgba(8,31,58,.96), rgba(8,31,58,.76));
  }
  .site-shell.case-detail-copy > h1 + .case-detail-lead + figure > img { object-position: 60% center; }
  .site-shell.case-detail-copy > .site-kicker { padding-top: 49px; font-size: 13px; }
  .site-shell.case-detail-copy > h1 { padding-top: 11px; font-size: clamp(26px, 7.5vw, 34px); }
  .site-shell.case-detail-copy > .case-detail-lead { padding-top: 15px; padding-bottom: 45px; font-size: 15px; }
  .site-shell.case-detail-copy > dl { gap: 5px 9px; padding-block: 13px; }
  .site-shell.case-detail-copy > dl dd:not(:last-child) { margin-right: 8px; }
  .case-detail-body > div { padding-block: 23px; }
}

/* Shared case sections rendered by app/cases.php. */
.case-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #092748;
}
.case-hero::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, #081f3a, rgba(8,31,58,.93) 34%, rgba(8,31,58,.74) 53%, rgba(8,31,58,.13) 100%);
  content: "";
}
.case-hero-image {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.case-hero-content { padding-block: clamp(54px, 7vw, 100px); }
.case-hero-content .home-hero-badge { margin: 0 0 17px; color: #eef8ff; }
.case-hero-content h1 {
  max-width: 680px;
  margin: 0;
  color: #fff;
  font-size: clamp(30px, 3.3vw, 50px);
  font-weight: 700;
  line-height: 1.28;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.case-hero-content .case-detail-lead {
  max-width: 630px;
  margin: 18px 0 0;
  color: #e3effb;
  font-size: 16px;
  line-height: 1.85;
}
.case-detail-page > .case-detail-copy {
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
}
.case-detail-page > .case-detail-copy > dl {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0;
  padding: 16px var(--case-reading-inset);
  border-bottom: 1px solid var(--ty-line);
  color: var(--ty-ink);
  font-size: 14px;
  line-height: 1.5;
}
.case-detail-copy > dl > div { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.case-detail-body > img,
.case-detail-body figure img { width: auto; max-width: 100%; }
.case-system {
  margin: 0 var(--case-reading-inset) 36px;
  padding: 14px;
  border: 1px solid var(--ty-line);
  border-radius: 12px;
  background: var(--ty-soft);
}
.case-system figure { margin: 0; }
.case-system img { width: auto; max-width: 100%; margin-inline: auto; border-radius: 5px; }
.case-system figcaption { color: #4f6480; }
@media (max-width: 640px) {
  .case-hero::before {
    background: linear-gradient(90deg, rgba(8,31,58,.97), rgba(8,31,58,.76));
  }
  .case-hero-image { object-position: 60% center; }
  .case-hero-content { width: calc(100% - 40px); padding-block: 44px; }
  .case-hero-content h1 { font-size: clamp(26px, 7.5vw, 34px); }
  .case-hero-content .case-detail-lead { margin-top: 14px; font-size: 15px; }
}

.case-gallery {
  padding: clamp(36px, 5.1vw, 70px) 0;
  border-top: 1px solid var(--ty-line);
  background: var(--ty-soft);
}
.case-gallery-software { background: #fff; }
.case-gallery > .site-shell { width: min(1080px, calc(100% - 48px)); }
.case-gallery h2 {
  margin: 0 0 12px;
  color: var(--ty-ink);
  font-size: var(--case-section-heading);
  font-weight: 600;
  line-height: 1.3;
}
.case-gallery p { margin: 0 0 25px; color: var(--ty-text); line-height: 1.75; }
.case-gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.case-gallery-grid > figure {
  min-width: 0;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--ty-line);
  border-radius: 11px;
  background: #fff;
}
.case-gallery-grid a { display: block; background: #e8f0f8; }
.case-gallery-grid a:focus-visible { outline: 3px solid var(--ty-primary); outline-offset: -3px; }
.case-gallery-grid a img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  border-radius: 0;
  object-fit: cover;
}
.case-gallery-software .case-gallery-grid a img { object-fit: contain; }
.case-gallery-grid figcaption {
  margin: 0;
  padding: 11px 15px;
  color: var(--ty-ink);
  font-size: 14px;
  line-height: 1.5;
}
@media (max-width: 640px) {
  .case-gallery > .site-shell { width: calc(100% - 40px); }
  .case-gallery-grid { grid-template-columns: 1fr; gap: 14px; }
}

.case-hero .case-title-line { display: block; }
.case-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.case-gallery[id] { scroll-margin-top: calc(var(--ty-header) + 16px); }
.case-gallery-grid > figure a:hover img { opacity: .92; }
@media (max-width: 640px) {
  .case-hero-content h1 { font-size: clamp(24px, 7.35vw, 34px); }
  .case-hero-actions { gap: 8px; margin-top: 20px; }
  .case-hero-actions .site-btn { padding-inline: 16px; }
}
