/* ==========================================================================
   Projects page. Light ground, same type system; cases.css carries the cases.
   ========================================================================== */

.work-head { padding-block: clamp(3rem, 8vw, 6rem) 0; }
.work-kicker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1rem;
}
.work-title {
  font-family: var(--font-display);
  font-size: var(--step-4);
  font-weight: 300;
  letter-spacing: -0.025em;
  max-width: 20ch;
  margin-bottom: 1.25rem;
}
.work-lede { color: var(--ink-2); max-width: 48ch; }

.work-cases { padding-bottom: clamp(4rem, 10vw, 8rem); }
.case { scroll-margin-top: 6rem; }

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .9s cubic-bezier(.22,.7,.3,1), transform .9s cubic-bezier(.22,.7,.3,1);
}
.reveal.is-in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .10s; }
.reveal[data-delay="2"] { transition-delay: .20s; }

/* Each case opens with the same picture as the home page, full width */
.case__visual { margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.case__visual > .stage { min-height: clamp(24rem, 36vw, 32rem); }
.case__visual .kfk { max-width: 52rem; margin-inline: auto; }
.case__visual .dash { max-width: 44rem; }

/* ---------- Second pictures: how the solution actually works ---------- */
.case__visual--more { margin: clamp(2.5rem, 5vw, 3.5rem) 0 0; }
.case__cap {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.case__cap::before { content: ""; width: 1.5rem; height: 1px; background: var(--accent); }
.case__visual--more > .stage { min-height: 0; place-items: stretch; }

/* 04 · Question → understand → search → answer */
.flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr 1.15fr 1.15fr;
  gap: clamp(1.25rem, 2.5vw, 2rem);
  align-items: start;
  font-size: 0.8125rem;
}
.flow__step { position: relative; display: grid; gap: 0.6rem; }
/* Arrow into the next step */
.flow__step + .flow__step::before {
  content: "→";
  position: absolute;
  left: calc(clamp(1.25rem, 2.5vw, 2rem) / -2);
  top: 0;
  translate: -50% 0;
  color: var(--ink-3);
  font-size: 0.875rem;
  line-height: 1.1rem;
}
.flow__n {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  line-height: 1.1rem;
}
.flow__n span {
  display: grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.5625rem;
  letter-spacing: 0;
}
.flow__card {
  display: grid;
  gap: 0.4rem;
  padding: 0.8rem 0.9rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 10px 24px -16px rgba(19,18,16,.25);
}
.flow__q {
  padding: 0.6rem 0.75rem;
  border-radius: 10px 10px 2px 10px;
  background: var(--ink);
  color: var(--paper);
  line-height: 1.5;
}
.flow__step:first-child .flow__card { padding: 0; border: 0; background: none; box-shadow: none; }
.flow__label {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.flow__map { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.flow__map code, .flow__filter span {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--paper-sunk);
  border: 1px solid var(--rule-firm);
}
.flow__map i { font-style: normal; color: var(--ink-3); }
.flow__map b { font-weight: 500; color: var(--accent-ink); }
.flow__line { font-size: 0.75rem; color: var(--ink); padding-left: 0.6rem; border-left: 2px solid var(--rule-firm); }
.flow__line--alt { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--ink-2); border-left-style: dashed; }
.flow__filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 7%, var(--paper));
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--accent-ink);
}
.flow__filter span { font-size: 0.5625rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.hits { display: grid; gap: 0.3rem; margin-top: 0.2rem; }
.hits li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 5px;
  border: 1px solid var(--rule);
  font-size: 0.6875rem;
  color: var(--ink-2);
}
.hits em { display: inline-block; font-style: normal; font-family: var(--font-mono); font-size: 0.5625rem; color: var(--ink-3); white-space: nowrap; }
.hits .is-top { border-color: var(--accent); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.hits .is-out { border-style: dashed; color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--rule-firm); }
.hits .is-out em { text-decoration: none; }
.flow__ans { font-size: 0.75rem; line-height: 1.5; color: var(--ink); }

/* 02 · Evaluator tools + a trace of one claim */
.tools {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: center;
  font-size: 0.8125rem;
}
.tools__rack { display: grid; gap: 0.6rem; }
.tool {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 10px 24px -16px rgba(19,18,16,.25);
}
.tool__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: var(--paper-sunk);
}
.tool__icon svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tool__name { font-weight: 500; color: var(--ink); line-height: 1.3; }
.tool__sub { font-size: 0.6875rem; color: var(--ink-3); }
.tool--code { border-color: var(--ink); }
.tool--code .tool__icon { background: var(--ink); }
.tool--code .tool__icon svg { stroke: var(--paper); }
.tool--guide { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.tool--guide .tool__icon { background: color-mix(in srgb, var(--accent) 12%, var(--paper)); }
.tool--guide .tool__icon svg { stroke: var(--accent-ink); }

.trace {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(19,18,16,.04), 0 18px 40px -18px rgba(19,18,16,.22);
}
.trace__body { list-style: none; margin: 0; padding: 0.5rem 0; }
.trace__body li {
  display: grid;
  grid-template-columns: 4.75rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink);
}
.trace__body em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.trace__body code {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  word-break: break-word;
}
.t-reason { color: var(--ink-2); }
.t-reason em { color: var(--accent); }
.t-act em { color: var(--ink); }
.t-obs { background: color-mix(in srgb, var(--paper-sunk) 55%, var(--paper)); }
.t-obs b { display: inline-block; vertical-align: middle; width: 3.5rem; height: 6px; border-radius: 3px; background: var(--ink-2); margin: 0 0.35rem; }
.t-obs small { font-family: var(--font-mono); font-size: 0.5625rem; color: var(--ink-3); }
.t-done { border-top: 1px solid var(--rule); margin-top: 0.25rem; }
.t-done em { color: #2F6B45; }

@media (max-width: 1000px) {
  .flow { grid-template-columns: 1fr 1fr; }
  .flow__step:nth-child(3)::before { display: none; }
}
@media (max-width: 760px) {
  .tools { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .flow { grid-template-columns: 1fr; }
  .flow__step + .flow__step::before { display: none; }
  .trace__body li { grid-template-columns: 1fr; gap: 0.15rem; }
}

/* Hybrid search: two searches side by side, merged and reranked */
.flow { grid-template-columns: 0.8fr 1fr 1.55fr 1fr; }
.flow__skip { font-size: 0.625rem; color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--rule-firm); }
.lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.2rem; }
.lane {
  display: grid;
  gap: 0.3rem;
  align-content: start;
  padding: 0.55rem;
  border-radius: 6px;
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
}
.lane__why { font-size: 0.625rem; color: var(--ink-3); line-height: 1.4; }
.lane__why mark {
  padding: 0 0.2rem;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.5625rem;
}
.hits--ranked { counter-reset: hit; margin: 0; padding: 0; list-style: none; }
.hits--ranked li { counter-increment: hit; background: var(--paper); }
.hits--ranked li span::before {
  content: counter(hit);
  display: inline-block;
  width: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  color: var(--ink-3);
}
.lane .hits li { padding: 0.3rem 0.4rem; font-size: 0.625rem; }
.merge {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 0.25rem 0 0.1rem;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
/* Two strokes joining into one, above the label */
.merge::before {
  content: "";
  display: block;
  position: absolute;
  top: -0.35rem;
  left: 25%;
  right: 25%;
  height: 0.35rem;
  border: 1px solid var(--rule-firm);
  border-top: 0;
  border-radius: 0 0 6px 6px;
}
.merge span { padding-top: 0.35rem; }
.merge span::after { content: " ↓"; color: var(--accent); }
.hits--final .is-low { opacity: .5; }

@media (max-width: 1000px) {
  .flow { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .flow { grid-template-columns: 1fr; }
}
