/* Devaxio — the case study page (on top of style.css) */

.case-hero h1 { max-width: 13em; }
.case-hero .lede { max-width: 40em; }
.case-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 34px 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--line); }
.case-facts div { padding: 16px 18px; background: var(--bg-2); }
.case-facts dt { margin-bottom: 6px; font: 500 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
.case-facts dd { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--text); }

/* the story, one numbered part at a time */
.case { padding-bottom: clamp(56px, 8vw, 96px); }
.case-part { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px 28px; padding: clamp(36px, 5vw, 56px) 0; border-top: 1px solid var(--line); }
.case-part:first-child { border-top: 0; }
.case-part__n { margin: 4px 0 0; font: 500 13px var(--mono); letter-spacing: .14em; color: var(--acc-2); }
.case-part__n::after { content: ""; display: block; width: 28px; height: 1px; margin-top: 10px; background: var(--acc); }
.case-part__body { max-width: 760px; }
.case-part h2 { margin: 0 0 16px; font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.03em; }
.case-part p { margin: 0 0 16px; font-size: 16px; line-height: 1.7; color: var(--text-2); }
.case-part p b, .case-part p strong { color: var(--text); }

/* 01: how a battle is judged */
.judge { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 22px 0 24px; padding: 0; list-style: none; counter-reset: judge; }
.judge li { position: relative; padding: 16px 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--bg-2); counter-increment: judge; }
.judge li::before { content: counter(judge, decimal-leading-zero); display: block; margin-bottom: 10px; font: 500 11px var(--mono); color: var(--mute); }
.judge li:not(:last-child)::after { content: ""; position: absolute; top: 50%; right: -9px; width: 7px; height: 7px; border-top: 2px solid var(--line-2); border-right: 2px solid var(--line-2); transform: translateY(-50%) rotate(45deg); }
.judge b { display: block; font-size: 14.5px; color: var(--text); }
.judge span { display: block; margin-top: 4px; font-size: 13px; color: var(--mute); }
.judge li:last-child { border-color: rgba(217, 162, 78, .5); background: #15140f; }
@media (prefers-reduced-motion: no-preference) {
  .reveal.is-visible .judge li { animation: c-glow 6s ease-in-out infinite; }
  .reveal.is-visible .judge li:nth-child(2) { animation-delay: 1.5s; }
  .reveal.is-visible .judge li:nth-child(3) { animation-delay: 3s; }
  .reveal.is-visible .judge li:nth-child(4) { animation-delay: 4.5s; }
}
@keyframes c-glow { 0%, 22%, 100% { box-shadow: none; } 8% { box-shadow: 0 0 0 1px rgba(217, 162, 78, .6), 0 12px 30px -12px rgba(217, 162, 78, .55); } }

/* 02: the result screen the player shared */
.case-split { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 28px; align-items: center; }
.case-split p { margin: 0; }
.result-card { padding: 20px 22px; border: 1px solid rgba(239, 91, 76, .45); border-radius: var(--r-l); background: linear-gradient(180deg, #1c1110, var(--bg-2)); box-shadow: 0 24px 50px -28px rgba(239, 91, 76, .6); }
.result-card__title { margin: 0 0 14px !important; font: 800 30px/1 var(--sans) !important; letter-spacing: .12em; text-transform: uppercase; color: #ef5b4c !important; }
.result-card dl { margin: 0; }
.result-card dl div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid rgba(255, 255, 255, .07); }
.result-card dt { font-size: 13.5px; color: var(--text-2); }
.result-card dd { margin: 0; font: 600 14px var(--mono); color: var(--on); }
@media (prefers-reduced-motion: no-preference) {
  .reveal.is-visible .result-card__title { animation: c-thud .6s .3s cubic-bezier(.3, 1.6, .5, 1) both; }
}
@keyframes c-thud { from { opacity: 0; transform: scale(1.6); } }

/* 03 */
.case-callout { padding: 16px 20px; border-left: 3px solid var(--acc); border-radius: 0 var(--r-m) var(--r-m) 0; background: var(--acc-soft); color: var(--text) !important; }

/* 05: the last bit, and two runs drifting apart */
.bits { display: grid; gap: 8px; margin: 22px 0 24px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--bg-2); }
.bits p { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin: 0; }
.bits span { font: 500 11.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.bits code { font: 500 clamp(15px, 2.4vw, 20px) var(--mono); color: var(--text); }
.bits code b { padding: 0 2px; border-radius: 4px; background: rgba(239, 91, 76, .2); color: #ff8a7d; }
.bits .bits__note { margin-top: 4px; font-size: 13px; color: var(--mute); }
.diverge { margin: 0 0 24px; padding: 18px 18px 14px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--bg-2); }
.diverge svg { display: block; width: 100%; height: auto; overflow: visible; }
.diverge path { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.diverge__a { stroke: #4fd1c5; }
.diverge__b { stroke: var(--acc); stroke-dasharray: 2 0; }
.diverge__grid { stroke: var(--line); stroke-width: 1; }
.diverge__mark { stroke: rgba(239, 91, 76, .55); stroke-width: 1.5; stroke-dasharray: 4 5; }
.diverge__label { font: 500 12px var(--mono); fill: #ff8a7d; }
.diverge figcaption { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 10px; font: 500 11.5px var(--mono); color: var(--text-2); }
.key::before { content: ""; display: inline-block; width: 18px; height: 3px; margin-right: 8px; vertical-align: middle; border-radius: 2px; }
.key--a::before { background: #4fd1c5; }
.key--b::before { background: var(--acc); }
@media (prefers-reduced-motion: no-preference) {
  .diverge path { stroke-dasharray: 1400; stroke-dashoffset: 0; }
  .reveal.is-visible .diverge__a { animation: c-draw 2.6s .2s ease-out both; }
  .reveal.is-visible .diverge__b { animation: c-draw 2.6s .2s ease-out both; }
  .reveal.is-visible .diverge__mark, .reveal.is-visible .diverge__label { animation: c-fade .6s 1.1s both; }
}
@keyframes c-draw { from { stroke-dashoffset: 1400; } }
@keyframes c-fade { from { opacity: 0; } }

/* 06: the fix */
.fixes { display: grid; gap: 12px; margin: 6px 0 22px; }
.fix { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--bg-2); }
.fix h3 { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; font-size: 1.08rem; letter-spacing: -.01em; }
.fix h3 span { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--acc); font: 700 12px var(--mono); color: #16110a; }
.fix p { margin: 0; font-size: 15px; }
.case-snip { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-l); background: #1b1d21; }
.case-snip figcaption { padding: 10px 16px; border-bottom: 1px solid #2c2c2c; background: #232529; font: 500 12px var(--mono); color: #b9bcc1; }
.case-snip pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: 13px/1.65 var(--mono); color: #e6e6e6; tab-size: 4; }

/* 07: proof */
.proofs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.proof { padding: 20px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--bg-2); }
.proof .proof__big { margin: 0 0 10px; font: 700 clamp(26px, 3.4vw, 34px)/1 var(--sans); letter-spacing: -.03em; color: var(--acc-2); }
.proof p { margin: 0; font-size: 14.5px; line-height: 1.55; }

/* 08 */
.takeaways { display: grid; gap: 14px; margin: 0 0 32px; padding: 0; list-style: none; }
.takeaways li { position: relative; padding-left: 28px; font-size: 16px; line-height: 1.65; color: var(--text-2); }
.takeaways li::before { content: ""; position: absolute; left: 4px; top: .5em; width: 10px; height: 10px; border-radius: 3px; background: var(--acc); transform: rotate(45deg); }
.takeaways b { color: var(--text); }
.case-cta { padding: 24px; border: 1px solid rgba(217, 162, 78, .35); border-radius: var(--r-l); background: linear-gradient(180deg, #15140f, var(--bg-2)); }
.case-cta p { color: var(--text); }
.case-cta .hero__cta { margin: 0; }

@media (max-width: 900px) {
  .case-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .judge { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .judge li:nth-child(2)::after { display: none; }
  .case-split { grid-template-columns: 1fr; }
  .proofs { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .case-part { grid-template-columns: 1fr; }
  .case-facts { grid-template-columns: 1fr; }
}
