/* ==========================================================================
   Depth: isometric drawings behind a band (block initace/depth-layer) and the
   audit-page modules that sit on top of them: question cards, idea cards, the
   report map and the order panel. Loaded only on pages that contain the block.
   Values come from tokens.css; the percentages below place drawings in a scene.
   ========================================================================== */

/* ---------- 1. A band that carries a depth layer ---------- */
.has-depth { position: relative; isolation: isolate; overflow: clip; }
.has-depth > .container { position: relative; z-index: 1; }
/* The layer always spans the whole band, also inside a constrained layout (the 404 page's <main>). */
.has-depth > .depth-layer { max-width: none; margin: 0; }

/* ---------- 2. The layer and its drawings ---------- */
.depth-layer { position: absolute; inset: 0; z-index: 0; margin: 0; pointer-events: none; view-timeline-name: --depth-band; }
.depth-item { position: absolute; display: block; height: auto; overflow: visible; }
.depth-item--far  { width: var(--depth-size-far);  --depth-speed: 1; }
.depth-item--mid  { width: var(--depth-size-mid);  --depth-speed: 0.45; }
.depth-item--near { width: var(--depth-size-near); --depth-speed: -0.55; }

.depth-item :is(polygon, polyline) { fill: none; stroke: var(--depth-line); stroke-width: var(--bw-mark); stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.depth-item .dl-plane { fill: var(--depth-plane); stroke: none; }
.depth-item .dl-thin { stroke-width: var(--bw-1); }
.depth-item .dl-dash { stroke-width: var(--bw-1); stroke-dasharray: 4 5; }
.depth-item .dl-mark { stroke: var(--depth-mark); }
.depth-item--far :is(.dl-line, .dl-thin) { stroke: var(--depth-line-far); stroke-width: var(--bw-1); }

/* On an ink band the drawings are drawn in paper. */
:is(.band--ink, .band--brand) .depth-item :is(polygon, polyline) { stroke: var(--depth-line-on-ink); }
:is(.band--ink, .band--brand) .depth-item .dl-plane { fill: var(--depth-plane-on-ink); }
:is(.band--ink, .band--brand) .depth-item--far :is(.dl-line, .dl-thin) { stroke: var(--depth-line-far-on-ink); }

/* Default composition of a scene: the far plane sinks off the lower left corner, the main
   drawing sits in the upper right, the small near one low on the left. */
:where(.depth-layer) .depth-item--far  { left: -12%; bottom: -18%; }
:where(.depth-layer) .depth-item--mid  { right: 3%; top: 4%; }
:where(.depth-layer) .depth-item--near { left: 3%; bottom: 6%; }

/* Scenes: where each drawing lies in its band (wide screens). */
.depth-layer--faq .depth-item--plane      { left: -12%; bottom: -18%; }
.depth-layer--faq .depth-item--site-stack { right: 3%; top: 3%; }
.depth-layer--faq .depth-item--set-square { left: 3%; bottom: 6%; }

.depth-layer--ideas .depth-item--plane      { left: -14%; top: 30%; }
.depth-layer--ideas .depth-item--set-square { right: 2%; bottom: -2%; }
.depth-layer--ideas .depth-item--ruler      { left: 6%; bottom: 1%; }

.depth-layer--report .depth-item--plane       { left: 22%; top: 8%; }
.depth-layer--report .depth-item--sheet-stack { left: 2%; bottom: 4%; }
.depth-layer--report .depth-item--ruler       { right: 5%; top: 6%; }

.depth-layer--order .depth-item--plane      { left: -16%; bottom: -26%; }
.depth-layer--order .depth-item--set-square { right: 4%; top: -3%; }
.depth-layer--order .depth-item--envelope   { left: 38%; bottom: -1%; }

/* A section moved from the page flow into a depth band keeps the heading rhythm of a band. */
.has-depth > .container--content > * { margin-block: 0; }
.has-depth > .container--content > * + * { margin-top: var(--space-head-sub); }
.has-depth > .container--content > h2 + * { margin-top: var(--space-head); }
.has-depth > .container--content > * + h2 { margin-top: var(--space-group); }

/* Scene-specific placements; on narrow screens the corner rule below decides alone. */
@media (min-width: 900px) {
  /* Process: the plan peeks above the timeline panel, the stopwatch lies in the free space under it. */
  .depth-layer--process .depth-item--stopwatch { left: auto; right: 8%; bottom: 3%; }

  /* Trust band on the home page: the desk sinks below the lists, the pencil lies between the columns. */
  .trust-band .depth-layer--desk .depth-item--desk   { top: auto; bottom: -16%; }
  .trust-band .depth-layer--desk .depth-item--pencil { left: 36%; bottom: 5%; }

  /* Site map: the pin stands low on the right. On the 404 page (the depth layer sits in <main>) the
     tree sinks below the links, away from the heading and the number. */
  .depth-layer--sitemap .depth-item--pin { left: auto; right: 4%; bottom: 8%; }
  main.has-depth > .depth-layer--sitemap .depth-item--site-tree { top: auto; bottom: -24%; }
  main.has-depth > .depth-layer--sitemap .depth-item--pin { top: 8%; right: 3%; bottom: auto; }
}
}

/* Parallax: far drawings lag behind the scroll, near ones run ahead. Only transform and
   opacity move; without scroll-driven animations the scene stays as composed above. */
@keyframes depth-drift {
  from { transform: translate3d(0, calc(var(--depth-shift) * var(--depth-speed) * -1), 0); }
  to   { transform: translate3d(0, calc(var(--depth-shift) * var(--depth-speed)), 0); }
}
@keyframes depth-appear { from { opacity: 0; } to { opacity: 1; } }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) and (min-width: 900px) and (update: fast) {
    .depth-item {
      animation: depth-drift linear both, depth-appear linear both;
      animation-timeline: --depth-band, --depth-band;
      animation-range: cover 0% cover 100%, entry 0% entry 70%;
      will-change: transform;
    }
  }
}

/* Narrow screens: one small drawing in the lower corner, away from the headings, no movement. */
@media (max-width: 899px) {
  .depth-layer > :is(.depth-item--far, .depth-item--near) { display: none; }
  .depth-layer > .depth-item--mid { width: var(--depth-size-narrow); bottom: var(--space-4); right: calc(-1 * var(--space-10)); left: auto; top: auto; }
}
@media print, (forced-colors: active) { .depth-layer { display: none; } }

/* ---------- 3. Questions: two groups of separate cards ---------- */
.faq-board { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-head) var(--gap-grid); align-items: start; }
.faq-board > * { margin-block: 0; min-width: 0; }
.faq-board__head > * { margin-block: 0; }
.faq-board__head > * + * { margin-top: var(--space-4); }
.faq-board__head p { max-width: var(--measure); font-size: var(--step-1); color: var(--color-text-muted); }
.faq-group { display: grid; gap: var(--space-4); align-content: start; }
.faq-group > * { margin-block: 0; }
.faq-group > h3 { font-size: var(--step-2); margin-bottom: var(--space-2); }
.faq-group > h3::before { content: ""; display: block; width: var(--space-12); height: var(--bw-4); margin-bottom: var(--space-4); background: var(--ink); }

.faq-board .wp-block-details { margin: 0; border: var(--bw-1) solid var(--line); background: var(--paper); box-shadow: var(--shadow-lift); transition: box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease); }
.faq-board .wp-block-details:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift-hover); }
.faq-board .wp-block-details[open] { background: var(--paper); border-color: var(--line-strong); box-shadow: var(--shadow-lift-hover), inset var(--bw-4) 0 0 0 var(--ink); transform: none; }
.faq-board .wp-block-details > summary { padding: var(--space-5) var(--space-6); font-size: var(--step-2); line-height: var(--lh-sub); }
.faq-board .wp-block-details > summary + * { margin-top: 0; }
.faq-board .wp-block-details > :not(summary) { padding-inline: var(--space-6); max-width: calc(var(--measure) + 2 * var(--space-6)); }
.faq-board .wp-block-details > :last-child { padding-bottom: var(--space-6); }
@media (min-width: 1100px) {
  .faq-board { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-12); }
  .faq-board__head { grid-column: 1 / -1; }
}
@media (max-width: 639px) {
  .faq-board .wp-block-details > summary { padding: var(--space-4); font-size: var(--step-1); }
  .faq-board .wp-block-details > :not(summary) { padding-inline: var(--space-4); }
}

/* ---------- 4. Ideas: an honesty panel and dashed idea cards ---------- */
.idea-board { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-head) var(--space-16); align-items: start; }
.idea-board > * { margin-block: 0; min-width: 0; }
.idea-board__intro > * { margin-block: 0; }
.idea-board__intro > * + * { margin-top: var(--space-4); }
.idea-board__intro > h2 + p { margin-top: var(--space-6); font-size: var(--step-1); color: var(--ink); }
.idea-board__intro p { max-width: var(--measure); }

.idea-board__honesty { padding: var(--space-8); border-radius: var(--radius-lg); background: var(--ink); color: var(--paper); box-shadow: var(--shadow-lift-hover); }
.idea-board__honesty > * { margin-block: 0; }
.idea-board__honesty h3 { color: var(--paper); font-size: var(--step-2); }
.idea-board__honesty ul.wp-block-list { margin-top: var(--space-6); gap: 0; }
.idea-board__honesty ul.wp-block-list > li { padding: var(--space-4) 0 var(--space-4) var(--space-6); border-top: var(--bw-1) solid var(--line-on-ink); color: var(--on-ink-muted); }
.idea-board__honesty ul.wp-block-list:not([class*="is-style-"]) > li::before { top: calc(var(--space-4) + 0.65em); background: var(--brand-bright); }
.idea-board__honesty strong { color: var(--paper); font-weight: var(--weight-semibold); }

.idea-board__title { font-size: var(--step-3); }
.idea-board__title + .idea-cards { margin-top: calc(var(--space-head-sub) - var(--space-head)); }
.idea-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap-grid); }
.idea-cards > * { margin-block: 0; min-width: 0; }
.idea-card { display: grid; align-content: start; gap: var(--space-3); padding: var(--space-6); border: var(--bw-mark) dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--paper); }
.idea-card > * { margin-block: 0; }
.idea-card .line-icon { margin-bottom: var(--space-3); }
.idea-card__title { font-size: var(--step-2); }
.idea-card__gain { font-size: var(--step-1); font-weight: var(--weight-medium); color: var(--ink); line-height: 1.35; }
.idea-card p:not(.idea-card__gain) { font-size: var(--step--1); line-height: var(--lh-small); color: var(--color-text-muted); }
@media (max-width: 639px) {
  .idea-card { grid-template-columns: auto minmax(0, 1fr); column-gap: var(--space-4); padding: var(--space-5); }
  .idea-card .line-icon { grid-row: span 3; margin-bottom: 0; }
}
@media (min-width: 640px) {
  .idea-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .idea-card:last-child { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .idea-board { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .idea-board__title, .idea-cards { grid-column: 1 / -1; }
  .idea-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .idea-card { grid-column: span 2; }
  .idea-card:nth-child(n + 4), .idea-card:last-child { grid-column: span 3; }
}
@media (min-width: 1600px) {
  .idea-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .idea-card, .idea-card:nth-child(n + 4), .idea-card:last-child { grid-column: auto; }
}

/* ---------- 5. Report map: the sheet with notes and callout lines beside it ---------- */
.report-map { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-head) var(--leader); align-items: center; }
.report-map > * { margin-block: 0; min-width: 0; }
.report-map__head > * { margin-block: 0; }
.report-map__head > * + * { margin-top: var(--space-4); }
.report-map .audit-sheet { width: 100%; max-width: var(--w-report-sheet); justify-self: center; }
.report-map__side { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap-grid); align-content: center; }
.report-map__side > * { margin-block: 0; }
.report-note { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2) var(--space-5); align-items: start; align-content: start; padding: var(--space-6); border: var(--bw-1) solid var(--line); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow-lift); }
.report-note > * { margin-block: 0; }
.report-note .line-icon { grid-row: span 2; }
.report-note h3 { font-size: var(--step-2); }
.report-note p { color: var(--color-text-muted); }
.report-note--idea { border: var(--bw-mark) dashed var(--line-strong); box-shadow: none; }
@media (min-width: 640px) and (max-width: 1099px) {
  .report-map__side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-map__side--end > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .report-map { grid-template-columns: minmax(0, 1fr) minmax(var(--w-report-mid-min), var(--w-report-mid-max)) minmax(0, 1fr); }
  .report-map__head { grid-column: 1 / -1; }
  .report-map .audit-sheet { max-width: none; }
  .report-map__side { max-width: var(--w-report-side); width: 100%; }
  .report-map__side--start { justify-self: end; }
  .report-map__side--end { justify-self: start; }
  .report-note--points::after {
    content: ""; position: absolute; top: 50%; width: var(--leader); height: var(--space-2); margin-top: calc(-1 * var(--space-1));
    background: linear-gradient(var(--color-mark), var(--color-mark)) center / 100% var(--bw-mark) no-repeat;
  }
  .report-note--points::before {
    content: ""; position: absolute; top: 50%; width: var(--space-3); height: var(--space-3); margin-top: calc(-0.5 * var(--space-3));
    border: var(--bw-mark) solid var(--color-mark); border-radius: var(--radius-full); background: var(--paper); z-index: 1;
  }
  .report-map__side--start .report-note--points::after { left: 100%; width: calc(var(--leader) + var(--space-8)); }
  .report-map__side--start .report-note--points::before { right: calc(-0.5 * var(--space-3)); }
  .report-map__side--end .report-note--points::after { right: 100%; }
  .report-map__side--end .report-note--points::before { left: calc(-0.5 * var(--space-3)); }
}

/* ---------- 6. Order: what happens after sending, beside the form ---------- */
.audit-order__intro > * { margin-block: 0; }
.audit-order__intro > .lead { margin-top: var(--space-5); }
.audit-order__intro > h3 { margin-top: var(--space-12); font-size: var(--step-2); }
ul.wp-block-list.order-steps { gap: 0; margin-top: var(--space-6); }
ul.wp-block-list.order-steps > li { display: grid; gap: var(--space-1); padding: 0 0 var(--space-6) var(--space-10); }
ul.wp-block-list.order-steps > li::before { top: 0.3em; left: 0; width: var(--dot); height: var(--dot); border-radius: var(--radius-full); background: var(--ink); }
ul.wp-block-list.order-steps > li:not(:last-child)::after { content: ""; position: absolute; left: calc(var(--dot) / 2 - var(--bw-1)); top: calc(0.3em + var(--dot)); bottom: 0; width: var(--bw-2); background: var(--line); }
.order-steps strong { font-size: var(--step-1); font-weight: var(--weight-semibold); }
.order-steps span { color: var(--color-text-muted); max-width: var(--measure); }
.audit-order .initace-person { margin-top: var(--space-6); padding: var(--space-5); border: var(--bw-1) solid var(--line); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow-lift); }
.audit-order .person { grid-template-columns: var(--photo-col) minmax(0, 1fr); gap: var(--space-5); }
.audit-order .person h3 { font-size: var(--step-2); }
.audit-order .person p { margin-top: var(--space-2); }
.audit-order .photo-slot { max-width: none; border-radius: var(--radius); }
@media (min-width: 1100px) {
  .audit-order__intro { position: sticky; top: calc(var(--h-header) + var(--space-8)); }
}
