.if-wrap {
  --if-edge: #e1cf9d;
  --if-ink: #433621;
  --if-gold: #b38424;
  --flow-gap: 24px;
  color: var(--if-ink);
  container-type: inline-size;
}
.if-heading { padding: 12px 0 20px; }
.if-heading h1,.if-profile h1 { font-size: clamp(28px,3vw,42px); line-height: 1.25; margin: 0; }
.if-heading p,.if-profile p { line-height: 1.75; color: #66583f; margin: 7px 0 0; }
.if-flow { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--flow-gap); grid-template-columns: repeat(4,minmax(0,1fr)); grid-template-areas: "a b c d" "h g f e"; }
.if-node { position: relative; min-width: 0; }
.if-node:nth-child(1) { grid-area: a; }
.if-node:nth-child(2) { grid-area: b; }
.if-node:nth-child(3) { grid-area: c; }
.if-node:nth-child(4) { grid-area: d; --pointer-x:50%; --pointer-y:100%; --angle:90deg; }
.if-node:nth-child(5) { grid-area: e; }
.if-node:nth-child(6) { grid-area: f; }
.if-node:nth-child(7) { grid-area: g; }
.if-node:nth-child(8) { grid-area: h; }
.if-node:nth-child(n+5) { --pointer-x:0%; --angle:180deg; }
.if-node:not(:last-child)::after {
  content: ""; position: absolute; width: var(--flow-gap); height: 12px; pointer-events: none;
  top: var(--pointer-y,50%); left: var(--pointer-x,100%); transform-origin: 0 50%;
  transform: translateY(-50%) rotate(var(--angle,0deg)); background: var(--if-gold);
  clip-path: polygon(0 40%,68% 40%,68% 6%,100% 50%,68% 94%,68% 60%,0 60%);
}
.if-card {
  display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit;
  border: 1px solid var(--if-edge); border-radius: 12px; overflow: hidden; background: white;
}
.if-card:hover { border-color: #ad8527; background: #fffdf5; }
.if-card:focus-visible,.if-next a:focus-visible,.if-back:focus-visible { outline: 3px solid #9f7719; outline-offset: 2px; }
.if-card img { display: block; width: 100%; height: auto; aspect-ratio: 1.66; object-fit: cover; }
.if-card-copy { display: flex; align-items: flex-start; gap: 9px; padding: 13px 12px 16px; }
.if-number { display: grid; place-items: center; flex: 0 0 26px; height: 26px; border-radius: 50%; background:#f5d36e; color:#4d380b; font-weight: 750; font-size: 14px; }
.if-card-copy h2 { margin: 0; font-size: 18px; line-height: 1.5; }
.if-card-copy p { margin: 4px 0 0; line-height: 1.55; font-size: 14px; color: #6c604c; }
.if-back,.if-next a,.if-source a { color:#755317; font-weight: 600; text-underline-offset: 3px; }
.if-back { display: inline-flex; margin: 4px 0 14px; }
.if-profile { background:#fff; border:1px solid var(--if-edge); border-radius:14px; padding:clamp(16px,2.4vw,28px); }
.if-step { display:block; margin-bottom:8px; color:#785715; font-size:15px; font-weight:650; }
.if-profile h2 { font-size:20px; line-height:1.45; margin:0 0 9px; }
.if-details { display:grid; grid-template-columns: 1fr 1.1fr; gap:clamp(18px,2vw,30px); align-items:start; margin:22px 0; }
.if-details figure { margin:0; }
.if-details img { display:block; width:100%; height:auto; border-radius:10px; }
.if-inspect ol { margin:0; padding-left:1.5em; }
.if-inspect li { padding-left:2px; line-height:1.8; margin-bottom:8px; }
.if-inspect li::marker { color:#775413; font-weight:700; }
.if-decisions { display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
.if-decisions section { border-left:3px solid #e8bb4b; border-radius:5px; padding:14px 16px; background:#fffae9; }
.if-decisions p { margin:0; }
.if-profile .if-source { margin-top:18px; font-size:14px; }
.if-next { display:flex; flex-wrap:wrap; justify-content:space-between; gap:10px; margin:18px 0; }
.if-next a { display:inline-flex; border:1px solid var(--if-edge); border-radius:8px; background:white; padding:9px 12px; text-decoration:none; }
.if-next a:hover { background:#fff5d7; }
@container (max-width: 935px) {
  .if-flow { grid-template-columns: repeat(2,minmax(0,1fr)); grid-template-areas:"a b" "d c" "e f" "h g"; }
  .if-node:nth-child(n) { --pointer-x:100%; --pointer-y:50%; --angle:0deg; }
  .if-node:nth-child(3),.if-node:nth-child(7) { --pointer-x:0%; --angle:180deg; }
  .if-node:nth-child(even) { --pointer-x:50%; --pointer-y:100%; --angle:90deg; }
  .if-card img { aspect-ratio:2.1; }
}
@container (max-width: 620px) {
  .if-details,.if-decisions { grid-template-columns:1fr; }
  .if-details { gap:18px; }
  .if-flow { --flow-gap:18px; }
}
@container (max-width: 475px) {
  .if-flow { grid-template-columns:1fr; grid-template-areas:"a" "b" "c" "d" "e" "f" "g" "h"; }
  .if-flow .if-node:nth-child(n) { --pointer-x:50%; --pointer-y:100%; --angle:90deg; }
  .if-card { display:grid; grid-template-columns:32% minmax(0,1fr); }
  .if-card img { height:100%; min-height:100px; aspect-ratio:auto; }
  .if-card-copy { align-self:center; padding:10px; gap:7px; }
  .if-number { flex-basis:22px; height:22px; font-size:13px; }
  .if-card-copy h2 { font-size:16px; }
}
