/* ===================================================================
 * llucky.ai/kz/cases/<slug>/ — case study page, on top of kz.css + craft.css.
 * Same Liquid glass system as /kz: Exo 2 for titles and proof numbers,
 * Onest for text, one blue accent, glass panels, no new colours.
 * Shape of every case: hero (client, result headline, 4 numbers) →
 * article (summary, before, quote, steps, dialog, table, next, FAQ) with a
 * sticky CTA card → final CTA → other cases.
 * Pages link this file as cases.css?v=<first 8 of sha1sum>: after any change,
 * update the ?v= in every page under kz/cases/ so browsers fetch the new file.
 * ================================================================= */

/* Fonts with relative URLs, so the page also opens from disk. */
@font-face { font-family: 'Exo 2'; font-style: normal; font-weight: 800; font-display: swap; src: url('../fonts/Exo2-800-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Exo 2'; font-style: normal; font-weight: 800; font-display: swap; src: url('../fonts/Exo2-800-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Onest'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('../fonts/Onest-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Onest'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('../fonts/Onest-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Saira'; font-style: normal; font-weight: 800; font-display: swap; src: url('../fonts/Saira-800-lucky.woff2') format('woff2'); }

.case-page {
  --case-read: 64ch;
  --case-gap-section: clamp(56px, 2.5rem + 3vw, 88px);
}
.case-page .nav > a[aria-current="page"] { color: hsl(var(--foreground)); }

/* ---------- Hero ---------- */
.case-hero { padding: clamp(16px, 3svh, 32px) 0 0; }

.case-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: hsl(var(--muted-foreground));
  font-size: var(--lq-text-md);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--lq-dur-color) ease;
}
.case-back:hover { color: hsl(var(--foreground)); }

.case-client {
  display: flex;
  align-items: center;
  gap: var(--lq-space-3);
  margin-top: clamp(20px, 4svh, 40px);
}
.case-logo {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--lq-radius-md);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-family: var(--cr-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.case-logo-img {
  flex: none;
  width: auto;
  height: 44px;
  border-radius: var(--lq-radius-md);
}
.case-client div { display: grid; gap: 1px; }
.case-client div strong { color: hsl(var(--title)); font-size: 15px; font-weight: 600; }
.case-client div span { color: hsl(var(--muted-foreground)); font-size: var(--lq-text-md); }

.case-title {
  max-width: 21ch;
  margin-top: var(--lq-space-5);
  color: hsl(var(--title));
  font-family: var(--cr-display);
  font-size: clamp(32px, min(0.9rem + 3.4vw, 7.4svh), 66px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.case-title-accent { color: hsl(var(--primary)); }

.case-lede {
  max-width: 58ch;
  margin-top: clamp(14px, 2.4svh, 22px);
  font-size: clamp(16px, 0.9rem + 0.3vw, 19px);
  line-height: 1.5;
  text-wrap: pretty;
}

/* Four numbers: the number first, then what it counts, then the comparison.
   Number + caption sit 6px apart; the columns are 1px hairlines apart. */
.case-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: clamp(24px, 4.4svh, 44px) 0 0;
  padding: 0;
}
.case-metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: clamp(18px, 2.6svh, 26px) var(--mk-pad);
}
.case-metric + .case-metric { border-left: 1px solid hsl(var(--lq-hairline)); }
.case-metric dd {
  order: -1;
  margin: 0 0 4px;
  color: hsl(var(--primary));
  font-family: var(--cr-display);
  font-size: clamp(34px, 1rem + 2.2vw, 54px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
  white-space: nowrap;
}
.case-metric dd small { font-size: 0.5em; letter-spacing: -0.01em; }
.case-metric dt {
  color: hsl(var(--title));
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}
.case-metric p {
  color: hsl(var(--muted-foreground));
  font-size: var(--lq-text-md);
  line-height: 1.4;
}

/* Desktop: text on the left, the four numbers as a 2×2 block on the right. */
@media (min-width: 961px) {
  .case-hero .shell {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    column-gap: clamp(32px, 4vw, 64px);
    align-items: start;
  }
  .case-back,
  .case-client,
  .case-title,
  .case-lede { grid-column: 1; }
  .case-back { justify-self: start; }
  .case-client { justify-self: start; }
  .case-title { font-size: clamp(32px, min(0.6rem + 2.8vw, 7svh), 56px); }
  .case-metrics {
    grid-column: 2;
    grid-row: 2 / 5;
    align-self: center;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0;
  }
  .case-metric:nth-child(3) { border-left: 0; }
  .case-metric:nth-child(n+3) { border-top: 1px solid hsl(var(--lq-hairline)); }
}

/* ---------- Article + sticky CTA card ---------- */
.case-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "summary aside" "article .";
  column-gap: clamp(32px, 5vw, 72px);
  align-items: start;
  margin-top: var(--case-gap-section);
}
.case-layout > .case-summary { grid-area: summary; align-self: stretch; }
.case-article { grid-area: article; }
.case-article { min-width: 0; }

.case-article p {
  max-width: var(--case-read);
  font-size: 16px;
  line-height: 1.65;
}
.case-article p + p,
.case-article p + .case-list,
.case-article p + .case-table-wrap { margin-top: var(--lq-space-4); }

.case-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--lq-space-6);
}
.case-summary h2 {
  margin-bottom: 6px;
  color: hsl(var(--title));
  font-size: 15px;
  font-weight: 600;
}
.case-summary p { font-size: 15px; line-height: 1.55; }

.case-section { margin-top: var(--case-gap-section); }
.case-h2 {
  margin-bottom: var(--lq-space-4);
  color: hsl(var(--title));
  font-family: var(--cr-display);
  font-size: clamp(26px, 1rem + 1.3vw, 38px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.case-list { display: grid; gap: var(--lq-space-3); max-width: var(--case-read); }
.case-list li {
  position: relative;
  padding-left: 22px;
  color: hsl(var(--muted-foreground));
  font-size: 16px;
  line-height: 1.6;
}
.case-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(var(--primary));
}
.case-list strong { color: hsl(var(--title)); font-weight: 600; }

/* Quote: large text and the person under it. No stripe, no box. */
.case-quote { margin: var(--case-gap-section) 0 0; padding: 0; }
.case-article .case-quote p {
  max-width: 30ch;
  color: hsl(var(--title));
  font-family: var(--cr-display);
  font-size: clamp(22px, 0.9rem + 1.1vw, 32px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: pretty;
}
.case-quote footer {
  display: flex;
  align-items: center;
  gap: var(--lq-space-3);
  margin-top: var(--lq-space-5);
}
.case-quote-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  font-weight: 600;
}
.case-quote footer > span:last-child {
  display: grid;
  color: hsl(var(--muted-foreground));
  font-size: var(--lq-text-md);
}
.case-quote footer strong { color: hsl(var(--title)); font-size: 15px; font-weight: 600; }

/* Client's own words: the video and its quote side by side. */
.case-voice {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: center;
  gap: var(--lq-space-8);
  margin-top: var(--case-gap-section);
}
.case-voice .case-quote { margin: 0; }
.case-video { margin: 0; }
.case-video video {
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border: 1px solid var(--lq-pop-edge);
  border-radius: var(--lq-panel-radius);
  background: hsl(var(--rail));
  box-shadow: var(--lq-pop-shadow);
}
.case-video figcaption {
  margin-top: var(--lq-space-2);
  color: hsl(var(--muted-foreground));
  font-size: var(--lq-text-sm);
}

/* Steps: numbered squares, as in the deck. */
.case-steps {
  display: grid;
  gap: var(--lq-space-6);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.case-steps li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: var(--lq-space-4);
  row-gap: 4px;
  counter-increment: step;
}
.case-steps li::before {
  content: counter(step, decimal-leading-zero);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--lq-radius-md);
  background: hsl(var(--rail));
  color: hsl(0 0% 100%);
  font-family: var(--cr-display);
  font-size: 15px;
  font-weight: 800;
}
.case-steps h3 { align-self: center; font-size: 17px; line-height: 1.3; min-height: 40px; display: flex; align-items: center; }
.case-article .case-steps p { font-size: 15px; line-height: 1.6; }

.case-figure { margin: var(--case-gap-section) 0 0; }
.case-figure .chat { max-width: 560px; margin-inline: 0; }
.case-figure figcaption {
  margin-top: var(--lq-space-3);
  color: hsl(var(--muted-foreground));
  font-size: var(--lq-text-md);
}

/* Monthly bar chart: before bars in a light tint, after bars in the accent. */
.case-chart { margin: var(--lq-space-6) 0 0; max-width: 640px; }
.case-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 200px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.case-bar {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}
.case-bar-col {
  width: 100%;
  max-width: 44px;
  height: var(--h);
  border-radius: 4px 4px 0 0;
  background: hsl(var(--primary) / 0.28);
}
.case-bar.is-after .case-bar-col { background: hsl(var(--primary)); }
.case-bar-val {
  margin-bottom: 4px;
  color: hsl(var(--title));
  font-size: var(--lq-text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.case-bar-m {
  margin-top: 6px;
  color: hsl(var(--muted-foreground));
  font-size: var(--lq-text-sm);
}
.case-bar-gap {
  flex: 0 0 auto;
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  padding: 0 2px 22px;
  border-left: 1px dashed hsl(var(--line));
}
.case-bar-gap span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: hsl(var(--faint));
  font-size: var(--lq-text-xs);
}
.case-chart-legend {
  display: flex;
  gap: var(--lq-space-5);
  margin-top: var(--lq-space-4);
  color: hsl(var(--muted-foreground));
  font-size: var(--lq-text-md);
}
.case-chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.case-chart-legend span::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: hsl(var(--primary) / 0.28);
}
.case-chart-legend .is-after::before { background: hsl(var(--primary)); }
.case-chart figcaption {
  margin-top: var(--lq-space-2);
  color: hsl(var(--muted-foreground));
  font-size: var(--lq-text-sm);
  line-height: 1.5;
}

/* Before / after table on glass. */
.case-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--lq-panel-edge);
  border-radius: var(--lq-panel-radius);
  background-color: var(--lq-panel-bg);
  box-shadow: var(--lq-panel-shadow);
  -webkit-backdrop-filter: var(--lq-blur);
  backdrop-filter: var(--lq-blur);
}
.case-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.case-table th,
.case-table td {
  padding: 14px var(--lq-space-5);
  text-align: right;
  white-space: nowrap;
}
.case-table th:first-child { text-align: left; white-space: normal; min-width: 14ch; }
.case-table thead th {
  color: hsl(var(--muted-foreground));
  font-size: var(--lq-text-md);
  font-weight: 500;
}
.case-table tbody th { color: hsl(var(--title)); font-weight: 500; }
.case-table td { color: hsl(var(--muted-foreground)); }
.case-table tbody tr { border-top: 1px solid hsl(var(--lq-hairline)); }
.case-table td:last-child { color: hsl(var(--title)); font-weight: 600; }
.case-table td.is-up { color: hsl(var(--good-ink)); }
.case-article .case-note {
  margin-top: var(--lq-space-4);
  color: hsl(var(--faint));
  font-size: 14px;
  line-height: 1.55;
}

/* FAQ */
.case-faq { max-width: var(--case-read); }
.case-faq details + details { border-top: 1px solid hsl(var(--lq-hairline)); }
.case-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--lq-space-4);
  min-height: 56px;
  color: hsl(var(--title));
  font-size: 16px;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}
.case-faq summary::-webkit-details-marker { display: none; }
.case-faq summary::after {
  content: "+";
  flex: none;
  color: hsl(var(--primary));
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  transition: transform var(--lq-dur-pop) var(--lq-ease-out);
}
.case-faq details[open] summary::after { transform: rotate(45deg); }
.case-article .case-faq p { padding-bottom: var(--lq-space-5); font-size: 15px; }

/* Sticky CTA card */
/* The CTA card sits beside the summary and matches its height. */
.case-aside { grid-area: aside; align-self: stretch; }
.case-card { display: grid; grid-template-rows: 1fr auto auto; gap: var(--lq-space-4); height: 100%; }
.case-card .button { margin-top: var(--lq-space-1); }
.case-card p { font-size: 15px; line-height: 1.5; }
.case-card p strong { display: block; margin-bottom: 4px; color: hsl(var(--title)); font-family: var(--cr-display); font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.case-card .button { width: 100%; }
.case-card-link {
  justify-self: start;
  color: hsl(var(--muted-foreground));
  font-size: var(--lq-text-md);
  font-weight: 500;
  text-underline-offset: 3px;
}
.case-card-link:hover { color: hsl(var(--foreground)); }

/* ---------- Final CTA ---------- */
.case-final { margin-top: var(--case-gap-section); }
.case-final-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--lq-space-6) var(--lq-space-8);
  padding: clamp(28px, 1rem + 2.4vw, 48px);
}
.case-final-panel .case-h2 { margin-bottom: var(--lq-space-3); font-size: clamp(28px, 1rem + 1.8vw, 46px); }
.case-final-lede { max-width: 48ch; font-size: 17px; line-height: 1.55; }

/* ---------- Other cases ---------- */
.case-more { margin-top: var(--case-gap-section); }
.case-more-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--lq-gap);
}
.case-more-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--lq-space-3);
  height: 100%;
  text-decoration: none;
  transition: transform var(--lq-dur-pop) var(--lq-ease-out), box-shadow var(--lq-dur-pop) var(--lq-ease-out);
}
.case-more-card:hover { transform: translateY(-2px); box-shadow: var(--lq-pop-shadow); }
.case-more-card strong {
  color: hsl(var(--title));
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  text-wrap: pretty;
}
.case-more-num {
  margin-top: auto;
  padding-top: var(--lq-space-3);
  color: hsl(var(--primary));
  font-family: var(--cr-display);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}
.case-more-num small {
  margin-left: 4px;
  color: hsl(var(--muted-foreground));
  font-family: var(--cr-text);
  font-size: var(--lq-text-md);
  font-weight: 500;
  letter-spacing: 0;
}

/* ---------- Cases index (/kz/cases/) ---------- */
.case-index-hero .shell { display: block; }
.case-index-hero .case-title { max-width: 18ch; }
.case-index { margin-top: clamp(32px, 2rem + 2vw, 56px); }
.case-index-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.case-index-card { gap: var(--lq-space-4); }
.case-index-top { display: flex; align-items: center; gap: var(--lq-space-3); width: 100%; }
.case-index-logo { flex: none; width: auto; height: 40px; border-radius: var(--lq-radius-sm); }
.case-index-name { color: hsl(var(--title)); font-size: 15px; font-weight: 600; }
.case-index-top .pill { margin-left: auto; }
.case-index-card strong { font-size: 19px; }
.case-index-card .case-more-num { font-size: 40px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .case-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "summary" "article"; }
  /* The final CTA does the card's job on narrow screens. */
  .case-aside { display: none; }
  .case-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-metric:nth-child(3) { border-left: 0; }
  .case-metric:nth-child(n+3) { border-top: 1px solid hsl(var(--lq-hairline)); }
  .case-more-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .case-voice { grid-template-columns: minmax(0, 1fr); gap: var(--lq-space-5); }
  .case-voice .case-video { max-width: 240px; }
  .case-summary { grid-template-columns: minmax(0, 1fr); gap: var(--lq-space-5); }
  .case-final-panel { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .case-final-panel .button-row .button { flex: 1 1 100%; }
  .case-table th,
  .case-table td { padding: 12px var(--lq-space-3); font-size: 14px; }
  .case-table thead th { font-size: var(--lq-text-sm); }
}
@media (max-width: 560px) {
  /* Table on a phone: the metric on its own line, then three labelled values. */
  .case-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .case-table tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px var(--lq-space-3); padding: 14px var(--lq-space-4); }
  .case-table tbody tr:first-child { border-top: 0; }
  .case-table tbody th { grid-column: 1 / -1; padding: 0 0 6px; }
  .case-table td { display: grid; gap: 2px; padding: 0; text-align: left; white-space: normal; }
  .case-table td::before { content: attr(data-label); color: hsl(var(--faint)); font-size: var(--lq-text-sm); font-weight: 400; }
}
@media (max-width: 560px) {
  /* Phone: the whole hero, numbers included, fits a 375×667 screen. */
  .case-hero { padding-top: 4px; }
  .case-client { margin-top: var(--lq-space-3); }
  .case-logo { width: 40px; height: 40px; font-size: 15px; }
  .case-title { margin-top: var(--lq-space-3); font-size: clamp(26px, 7.2vw, 32px); }
  .case-lede { margin-top: 10px; font-size: 15px; line-height: 1.45; }
  .case-metrics { margin-top: var(--lq-space-4); }
  .case-metric { gap: 3px; padding: 12px var(--lq-space-4); }
  .case-metric dd { margin-bottom: 2px; font-size: 30px; }
  .case-metric dt { font-size: 13px; line-height: 1.25; }
  .case-metric p { font-size: var(--lq-text-sm); line-height: 1.3; }
}
@media (prefers-reduced-motion: reduce) {
  .case-more-card { transition: none; }
  .case-more-card:hover { transform: none; }
}
