/* ─────────────────────────────────────────────
   CASE FILES — one case study at a time,
   each on its own index card ("ficha").
   Add-on for amandabaruch.com (needs case-files.js)
   ───────────────────────────────────────────── */

.cf {
  --cf-ink: #172c46;
  --cf-blue: #234c88;
  --cf-muted: #556070;
  --cf-line: rgba(35, 76, 136, .16);
  --cf-edge: rgba(35, 76, 136, .14);
  --cf-lime: #d5e69b;
  --cf-lime-ink: #3f5a1d;
  --cf-tab-h: 40px;
  position: relative;
  max-width: 900px;
  margin-top: 8px;
}

/* the original grid + filters stay in the HTML as a fallback,
   but are hidden once the card file is built */
.cases.cf-ready .work-toolbar,
.cases.cf-ready .case-grid { display: none !important; }

/* ── TABS (the little folder tabs on top of each card) ── */
.cf-tabs {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(var(--cf-count, 3), minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  height: var(--cf-tab-h);
  max-width: calc(var(--cf-count, 3) * 250px);
  margin-right: 18px;
}
.cf-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 16px;
  border: 1px solid var(--cf-edge);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: var(--paper);
  color: var(--cf-muted);
  font: 600 10px/1 'Noto Sans', sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  align-self: end;
  height: calc(100% - 7px);
  filter: saturate(.85) brightness(.96);
  transition: height .3s cubic-bezier(.2, .8, .2, 1), color .2s, filter .2s;
}
.cf-tab span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-tab-num { font-family: var(--display, 'Noto Serif', serif); font-size: 17px; font-weight: 600; letter-spacing: 0; color: var(--cf-blue); }
.cf-tab:hover { height: calc(100% - 3px); color: var(--cf-ink); }
.cf-tab[aria-selected="true"] {
  height: calc(100% + 1px);  /* overlaps the card's top border so tab + card read as one piece */
  margin-bottom: -1px;
  color: var(--cf-ink);
  filter: none;
  z-index: 2;
}
.cf-tab:focus-visible { outline: 2px solid var(--cf-blue); outline-offset: -4px; }

/* ── DECK ── */
.cf-deck {
  position: relative;
  display: grid;
  margin: 0 18px 22px 0;
  touch-action: pan-y;
}
.cf-card {
  grid-area: 1 / 1;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 34px 44px 30px;
  background-color: var(--paper);
  /* faint paper grain */
  background-image:
    radial-gradient(120% 80% at 10% 0%, rgba(255, 255, 255, .55), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.09 0 0 0 0 0.17 0 0 0 0 0.27 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  border: 1px solid var(--cf-edge);
  border-radius: 0 0 6px 6px;
  color: var(--cf-ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 18px 40px -26px rgba(23, 44, 70, .45);
  transform-origin: 30% 100%;
  transition: transform .55s cubic-bezier(.2, .8, .2, 1), box-shadow .4s;
}

/* cards waiting behind the active one */
.cf-card[data-depth="1"] { z-index: 2; transform: translate(9px, 11px) rotate(.9deg); }
.cf-card[data-depth="2"] { z-index: 1; transform: translate(16px, 20px) rotate(-.6deg); }
.cf-card[data-depth="1"], .cf-card[data-depth="2"] { box-shadow: 0 10px 24px -20px rgba(23, 44, 70, .5); }
.cf-card:not(.is-active) > * { visibility: hidden; }
.cf-card.is-active { z-index: 3; transform: none; }

/* pulling a card out of the file */
.cf-card.is-active.cf-in-next { animation: cf-pull-next .6s cubic-bezier(.2, .8, .2, 1) both; }
.cf-card.is-active.cf-in-prev { animation: cf-pull-prev .6s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes cf-pull-next {
  0%   { transform: translate(28px, 18px) rotate(2.2deg); }
  100% { transform: none; }
}
@keyframes cf-pull-prev {
  0%   { transform: translate(-22px, 18px) rotate(-2deg); }
  100% { transform: none; }
}
.cf-card.is-active > * { animation: cf-ink .5s .12s ease both; }
@keyframes cf-ink { from { opacity: 0; } to { opacity: 1; } }

/* ── CARD CONTENT ── */
.cf-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--cf-blue);
  box-shadow: 0 3px 0 -2px var(--cf-blue); /* double rule, like a printed index card */
  font: 700 10px/1 'Noto Sans', sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cf-blue);
}
.cf-files { display: flex; align-items: center; gap: 0; font-weight: 600; color: var(--cf-muted); }
.cf-files span { padding: 0 9px; border-left: 1px solid currentColor; line-height: 1; }
.cf-files span:first-child { border-left: none; }
.cf-files span.is-on { color: var(--cf-blue); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px; }

.cf-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  column-gap: 44px;
  flex: 1;
  padding-top: 22px;
}
.cf-main, .cf-side { min-width: 0; align-self: start; }

.cf-label {
  display: inline-block;
  margin-right: 8px;
  font: 700 10px/1 'Noto Sans', sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cf-blue);
}
.cf-client {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--cf-ink);
  margin-bottom: 14px;
}
.cf-title {
  font-family: var(--display, 'Noto Serif', serif);
  font-weight: 600;
  font-size: clamp(28px, 3.3vw, 38px);
  line-height: 1.08;
  letter-spacing: -.04em;
  color: var(--cf-ink);
  margin: 0 0 18px;
  text-wrap: balance;
}

/* ruled lines under the description, like writing on a card */
.cf-note {
  --lh: 26px;
  font-size: 13px;
  line-height: var(--lh);
  color: #33445c;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--lh) - 1px), var(--cf-line) calc(var(--lh) - 1px), var(--cf-line) var(--lh));
  background-position: 0 -3px;
}
.cf-note .cf-label { line-height: var(--lh); }

.cf-metrics {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  border-top: 1px solid var(--cf-line);
  border-bottom: 1px solid var(--cf-line);
  margin-bottom: 20px;
}
.cf-metric { padding: 16px 12px 14px; border-left: 1px solid var(--cf-line); }
.cf-metric:first-child { border-left: none; padding-left: 0; }
.cf-metric-num {
  font-family: var(--display, 'Noto Serif', serif);
  font-size: clamp(28px, 2.6vw, 36px);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1;
  white-space: nowrap;
  color: var(--cf-blue);
}
.cf-metric-label {
  margin-top: 6px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cf-muted);
}

.cf-tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.cf-tags li {
  padding: 6px 10px;
  border: 1px dashed rgba(35, 76, 136, .35);
  border-radius: 3px;
  font-size: 10px;
  letter-spacing: .03em;
  color: #43546a;
  background: rgba(255, 255, 255, .35);
}

/* "Behind the strategy" — the little green tag, like "SAVE THIS" */
.cf-behind { grid-column: 1 / -1; align-self: end; margin-top: 22px; }
.cf-behind summary {
  display: flex;
  justify-content: flex-end;
  list-style: none;
  cursor: pointer;
}
.cf-behind summary::-webkit-details-marker { display: none; }
.cf-behind summary span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 7px 16px;
  background: var(--cf-lime);
  color: var(--cf-lime-ink);
  font: 700 10px/1 'Noto Sans', sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%);
  transition: filter .2s;
}
.cf-behind summary:hover span { filter: brightness(.96); }
.cf-behind summary:focus-visible { outline: none; }
.cf-behind summary:focus-visible span { outline: 2px solid var(--cf-blue); outline-offset: 2px; }
.cf-behind summary b { font-size: 15px; font-weight: 400; transition: transform .2s; }
.cf-behind[open] summary b { transform: rotate(45deg); }
.cf-behind p {
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 3px solid var(--cf-lime);
  background: rgba(255, 255, 255, .45);
  font-size: 13px;
  line-height: 1.7;
  color: #33445c;
}

/* paper clip */
.cf-clip {
  position: absolute;
  top: 74px;
  right: -16px;
  width: 22px;
  height: 64px;
  pointer-events: none;
  filter: drop-shadow(1px 2px 1.5px rgba(23, 44, 70, .25));
}

/* ── CONTROLS ── */
.cf-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-right: 18px;
}
.cf-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border: 1px solid rgba(35, 76, 136, .25);
  border-radius: 30px;
  background: transparent;
  color: var(--cf-blue);
  font: 600 11px/1 'Noto Sans', sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.cf-btn:hover { background: var(--cf-blue); color: #fff; }
.cf-btn:focus-visible { outline: 2px solid var(--cf-blue); outline-offset: 3px; }
.cf-count {
  font-family: var(--display, 'Noto Serif', serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--cf-ink);
}
.cf-count small { font-family: 'Noto Sans', sans-serif; font-size: 11px; color: var(--cf-muted); letter-spacing: .1em; }
.cf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── SMALL SCREENS ── */
@media (max-width: 760px) {
  .cf { --cf-tab-h: 38px; }
  .cf-tabs, .cf-controls { margin-right: 10px; }
  .cf-deck { margin: 0 10px 16px 0; }
  .cf-card { padding: 24px 22px 22px; }
  .cf-card[data-depth="1"] { transform: translate(5px, 8px) rotate(.8deg); }
  .cf-card[data-depth="2"] { transform: translate(10px, 14px) rotate(-.5deg); }
  .cf-body { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; padding-top: 18px; }
  .cf-tab { padding: 0 10px; gap: 6px; font-size: 9px; letter-spacing: .08em; }
  .cf-tab-num { font-size: 15px; }
  .cf-files { display: none; }
  .cf-metrics { margin-top: 20px; }
  .cf-metric-num { font-size: 32px; }
  .cf-clip { right: -12px; top: 58px; }
  .cf-btn { padding: 10px 14px; font-size: 10px; }
}
@media (max-width: 420px) {
  .cf-tab-name { display: none; }
  .cf-tab { justify-content: center; }
  .cf-btn-word { display: none; }
}

/* respect "Motion off" and reduced-motion settings */
.motion-paused .cf-card, .motion-paused .cf-card > *, .motion-paused .cf-tab { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .cf-card, .cf-card > *, .cf-tab { animation: none !important; transition: none !important; }
}
