/* ==========================================================================
   Kisaka accounting and bookkeeping page
   Built on the advisory, IT, audit and tax pages: their files give the type,
   the buttons, the split hero with its typed breadcrumb and red word, the
   word-by-word titles, the entrances that replay on every visit and the
   closing panel whose line fills in letter by letter. This file adds the
   parts of legacybridge.software those pages have no piece for:
   - the hero's graph-paper panel, where documents ride into the ledger,
   - the centred line with its two contrast cards,
   - the bento of live drawings on wine,
   - the pinned collage where the heading shrinks and the cards fly in,
   - the journey path that fills as the reader moves through the steps,
   and LegacyBridge's timing on top: blocks rise 110px over 1s on
   cubic-bezier(0, 1, 0.4, 1), 90ms apart; title words lift out of their
   masks 35ms apart.
   Motion lives in js/kisaka-accounting.js; the drawings come from
   scripts/make_accounting_diagrams.py.
   ========================================================================== */

.kisaka-ac-page
   {
      --ac-rise: 110px;
      --ac-ease: cubic-bezier(0, 1, 0.4, 1);
      --ac-step: 90ms;
      --ac-wine: var(--adv-red-deep);
      --ac-cream: var(--it-cream);
      --ac-cream-soft: rgba(245, 243, 240, 0.78);
      --ac-grid: rgba(29, 21, 23, 0.05);
      --ac-glow: 0 0 14px 4px rgba(203, 31, 52, 0.08), 0 16px 60px 12px rgba(203, 31, 52, 0.12), 0 0 32px rgba(203, 31, 52, 0.12);
   }


/* ===== Keyframes ===== */

@keyframes ac-rise
   {
      0%
         {
            opacity: 0;
            translate: 0 var(--ac-from, var(--ac-rise));
         }
   }

@keyframes ac-word
   {
      0%
         {
            translate: 0 115%;
         }
   }

@keyframes ac-settle
   {
      0%
         {
            opacity: 0;
            scale: 1.04;
         }
   }

@keyframes ac-flow
   {
      100%
         {
            stroke-dashoffset: -8;
         }
   }

@keyframes ac-pulse
   {
      0%
         {
            opacity: 0;
            transform: scale(0.72);
         }

      30%
         {
            opacity: 0.9;
         }

      100%
         {
            opacity: 0;
            transform: scale(1.1);
         }
   }


/* ===== Hero: graph paper to the screen edge ===== */

.kisaka-it .ac-hero__media
   {
      background-color: var(--it-panel);
      background-image: linear-gradient(var(--ac-grid) 1px, transparent 1px), linear-gradient(90deg, var(--ac-grid) 1px, transparent 1px);
      background-size: 32px 32px;
      background-position: -1px -1px;
   }

.ac-hero__screen
   {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
   }

/* The conveyor runs past the drawing's own frame to the panel's edges. */
.ac-hero__screen .ac-diagram
   {
      display: block;
      width: min(88%, 620px);
      height: auto;
      max-height: 90%;
      overflow: visible;
   }


/* ===== Intro: the line centred, two contrast cards ===== */

.ac-compare
   {
      background: var(--adv-panel);
   }

.ac-compare__head
   {
      max-width: 1000px;
      margin: 0 auto;
      text-align: center;
   }

.kisaka-adv .ac-compare__title
   {
      font-family: var(--kisaka-font-accent), 'Google Sans Flex', sans-serif;
      font-size: clamp(30px, 3.7vw, 54px);
      font-weight: 400;
      line-height: 1.08;
      letter-spacing: -0.035em;
      color: var(--adv-ink);
      text-wrap: balance;
   }

.ac-compare__grid
   {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 24px;
      max-width: 1040px;
      margin: clamp(48px, 6vw, 72px) auto 0;
   }

.ac-compare__card
   {
      padding: clamp(28px, 3vw, 40px);
      border-radius: 20px;
      background: var(--adv-page);
   }

.ac-compare__card--dark
   {
      background: var(--ac-wine);
   }

.kisaka-adv .ac-compare__text
   {
      font-family: "Newsreader", Georgia, "Times New Roman", serif;
      font-optical-sizing: auto;
      font-size-adjust: 0.5;
      font-size: 19px;
      line-height: 1.55;
      color: var(--adv-body);
      text-wrap: pretty;
   }

.kisaka-adv .ac-compare__card--dark .ac-compare__text
   {
      color: var(--ac-cream-soft);
   }


/* ===== At a glance: the bento on wine ===== */

.ac-bento
   {
      padding: clamp(80px, 11vw, 150px) 0;
      background: var(--ac-wine);
   }

.kisaka-adv .ac-bento__title
   {
      color: var(--ac-cream);
   }

.kisaka-adv .ac-bento__lead
   {
      color: var(--ac-cream-soft);
   }

.ac-bento__grid
   {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 24px;
      margin-top: clamp(48px, 6vw, 72px);
   }

.ac-bento__card
   {
      display: flex;
      flex-direction: column;
      padding: 16px;
      border-radius: 20px;
      background: var(--adv-panel);
   }

.ac-bento__card:nth-child(2)
   {
      background: var(--it-warm);
   }

.ac-bento__card--wide
   {
      grid-column: 1 / -1;
      display: grid;
      grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
      align-items: stretch;
      gap: 16px;
   }

.ac-bento__media
   {
      display: grid;
      place-items: center;
      margin: 0;
      padding: clamp(16px, 3vw, 40px);
      border-radius: 12px;
      background: #fff;
   }

.ac-bento__media .ac-diagram
   {
      display: block;
      width: 100%;
      height: auto;
   }

.ac-bento__copy
   {
      padding: 24px 16px 16px;
   }

.ac-bento__card--wide .ac-bento__copy
   {
      padding: clamp(24px, 3vw, 40px);
   }

.kisaka-adv .ac-bento__label
   {
      font-family: var(--kisaka-font-accent), 'Google Sans Flex', sans-serif;
      font-size: clamp(22px, 2.2vw, 32px);
      font-weight: 400;
      line-height: 1.12;
      letter-spacing: -0.025em;
      color: var(--adv-ink);
      text-wrap: balance;
   }

.kisaka-adv .ac-bento__text
   {
      max-width: 520px;
      margin-top: 14px;
      font-family: "Newsreader", Georgia, "Times New Roman", serif;
      font-optical-sizing: auto;
      font-size-adjust: 0.5;
      font-size: 17px;
      color: var(--adv-body);
      text-wrap: pretty;
   }


/* ===== The four services: heading, note and a 2x2 grid ===== */

.ac-proof
   {
      position: relative;
      background: var(--adv-page);
   }

.ac-proof__stage
   {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 48px;
      padding: clamp(80px, 11vw, 150px) var(--adv-gutter);
   }

.ac-proof__center
   {
      max-width: 720px;
      text-align: center;
   }

.kisaka-adv .ac-proof__title
   {
      font-family: var(--kisaka-font-accent), 'Google Sans Flex', sans-serif;
      font-size: clamp(30px, 4vw, 60px);
      font-weight: 400;
      line-height: 1.04;
      letter-spacing: -0.035em;
      color: var(--adv-ink);
      text-wrap: balance;
   }

.kisaka-adv .ac-proof__lead
   {
      margin-top: 24px;
      font-family: "Newsreader", Georgia, "Times New Roman", serif;
      font-optical-sizing: auto;
      font-size-adjust: 0.5;
      font-size: 17px;
      color: var(--adv-body);
      text-wrap: pretty;
   }

.ac-proof__cards
   {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 20px;
      width: 100%;
      max-width: 1040px;
   }

.ac-proof__card
   {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 12px;
      padding: 28px;
      border-radius: 16px;
      background: var(--ac-wine);
   }

.ac-icon
   {
      display: block;
      width: 32px;
      height: 32px;
      flex-shrink: 0;
   }

.kisaka-adv .ac-proof__name
   {
      font-family: var(--kisaka-font-accent), 'Google Sans Flex', sans-serif;
      font-size: 22px;
      font-weight: 400;
      line-height: 1.2;
      letter-spacing: -0.02em;
      color: var(--ac-cream);
   }

.kisaka-adv .ac-proof__text
   {
      font-family: "Newsreader", Georgia, "Times New Roman", serif;
      font-optical-sizing: auto;
      font-size-adjust: 0.5;
      font-size: 16px;
      line-height: 1.5;
      color: var(--ac-cream-soft);
      text-wrap: pretty;
   }

/* Wide and tall screens: the collage. The stage pins for the length of the
   track; js/kisaka-accounting.js shrinks the heading from 2.35x
   (--ac-tscale), carries each card in from beyond the screen edge and
   raises the note (--ac-note) as the page scrolls. The cards always sit in
   their ring; the script only pushes them out. */
@media (min-width: 1360px) and (min-height: 760px)
   {
      .ac-proof__track
         {
            height: calc(900px + 300vh);
         }

      .ac-proof__stage
         {
            position: sticky;
            top: 0;
            display: block;
            height: 100vh;
            padding: 0;
            overflow: hidden;
            --ac-ring: max(24px, calc(50vw - 690px));
         }

      .ac-proof__center
         {
            position: absolute;
            left: 50%;
            top: 46%;
            width: 600px;
            translate: -50% -50%;
         }

      /* No will-change: a promoted layer would be drawn once at 1x and
         blown up, so the oversized heading would blur. */
      .ac-proof__head
         {
            scale: var(--ac-tscale, 1);
         }

      .kisaka-adv .ac-proof__lead
         {
            position: absolute;
            top: calc(100% + 8px);
            left: 0;
            width: 100%;
            opacity: var(--ac-note, 1);
            translate: 0 calc((1 - var(--ac-note, 1)) * 24px);
         }

      .ac-proof__cards
         {
            display: block;
            max-width: none;
         }

      .ac-proof__card
         {
            position: absolute;
            width: 340px;
            will-change: transform;
         }

      .ac-proof__card--tl
         {
            left: var(--ac-ring);
            top: 11%;
         }

      .ac-proof__card--tr
         {
            right: var(--ac-ring);
            top: 11%;
         }

      .ac-proof__card--bl
         {
            left: var(--ac-ring);
            top: 54%;
         }

      .ac-proof__card--br
         {
            right: var(--ac-ring);
            top: 54%;
         }
   }


/* ===== How we run the engagement: the journey ===== */

.ac-journey
   {
      position: relative;
      overflow: hidden;
      background-color: var(--adv-panel);
      background-image: linear-gradient(var(--ac-grid) 1px, transparent 1px), linear-gradient(90deg, var(--ac-grid) 1px, transparent 1px);
      background-size: 40px 40px;
      background-position: -1px -1px;
   }

.ac-journey__stage
   {
      position: relative;
      margin-top: clamp(48px, 6vw, 80px);
   }

.ac-journey__path
   {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      overflow: visible;
      pointer-events: none;
   }

.ac-journey__dots
   {
      fill: none;
      stroke: var(--adv-muted);
      stroke-width: 2;
      stroke-linecap: round;
      stroke-dasharray: 1 7;
      animation: ac-flow 0.4s linear infinite;
   }

.ac-journey__progress
   {
      fill: none;
      stroke: var(--adv-red);
      stroke-width: 4;
      stroke-linecap: round;
   }

.ac-journey__marker
   {
      transition: opacity 0.35s ease;
   }

.ac-journey__marker.is-hidden
   {
      opacity: 0;
   }

.ac-journey__ring,
.ac-journey__pulse
   {
      fill: none;
      stroke: var(--adv-ink);
      stroke-width: 1.5;
   }

.ac-journey__ring
   {
      opacity: 0.8;
   }

.ac-journey__pulse
   {
      transform-box: fill-box;
      transform-origin: center;
      animation: ac-pulse 2.4s ease-out infinite;
   }

.ac-journey__pulse--2
   {
      animation-delay: 0.5s;
   }

.ac-journey__pulse--3
   {
      animation-delay: 1s;
   }

/* Not positioned, so the cards and nodes measure from the stage. */
.ac-journey__steps
   {
      display: flex;
      flex-direction: column;
   }

.ac-journey__step
   {
      display: flex;
      justify-content: flex-start;
   }

.ac-journey__step:nth-child(even)
   {
      justify-content: flex-end;
   }

.ac-journey__step + .ac-journey__step
   {
      margin-top: -140px;
   }

.ac-journey__node
   {
      position: absolute;
      left: var(--node-x, 50%);
      top: var(--node-y, 0);
      z-index: 1;
      display: grid;
      place-items: center;
      width: 56px;
      height: 56px;
      border-radius: 50%;
      background: var(--adv-faint);
      color: #fff;
      translate: -50% -50%;
      transition: background-color 0.4s ease;
   }

.ac-journey__node svg
   {
      width: 26px;
      height: 26px;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.6;
      stroke-linecap: round;
      stroke-linejoin: round;
   }

.ac-journey__step.is-done .ac-journey__node,
.ac-journey__step.is-active .ac-journey__node
   {
      background: var(--adv-ink);
   }

.ac-journey__card
   {
      position: relative;
      z-index: 2;
      width: min(420px, 38%);
      padding: 8px;
      border-radius: 16px;
      background: #fff;
      box-shadow: 0 8px 24px rgba(29, 21, 23, 0.06);
      transition: box-shadow 0.6s ease;
   }

.ac-journey__step.is-active .ac-journey__card
   {
      box-shadow: var(--ac-glow);
   }

.ac-journey__media
   {
      margin: 0;
      overflow: hidden;
      aspect-ratio: 16 / 10;
      border-radius: 10px;
      background: var(--adv-page);
   }

.ac-journey__media .ac-diagram
   {
      display: block;
      width: 100%;
      height: 100%;
   }

.ac-journey__text
   {
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding: 16px 16px 20px;
   }

.kisaka-adv .ac-journey__title
   {
      font-family: var(--kisaka-font-accent), 'Google Sans Flex', sans-serif;
      font-size: 22px;
      font-weight: 400;
      line-height: 1.2;
      letter-spacing: -0.02em;
      color: var(--adv-ink);
   }

.kisaka-adv .ac-journey__desc
   {
      font-family: "Newsreader", Georgia, "Times New Roman", serif;
      font-optical-sizing: auto;
      font-size-adjust: 0.5;
      font-size: 16px;
      line-height: 1.5;
      color: var(--adv-body);
   }


/* ==========================================================================
   Motion, only when js/kisaka-audit.js has set .au-motion. Blocks rise
   110px over 1s and drop in from above when the reader comes back up; the
   words of a title lift out of their masks 35ms apart.
   ========================================================================== */

.au-motion .kisaka-ac [data-au][data-au-from="above"]
   {
      --ac-from: -60px;
   }

.au-motion .kisaka-ac [data-au].is-inview [data-au-lines] .au-line-word__in
   {
      animation: ac-word 0.9s var(--ac-ease) calc(var(--ac-wi, 0) * 35ms + var(--lines-delay, 0ms)) backwards;
   }

.au-motion .kisaka-ac :is(.ac-compare__card, .ac-bento__card, .ac-journey__card)[data-au]:not(.is-inview)
   {
      opacity: 0;
   }

.au-motion .kisaka-ac :is(.ac-compare__card, .ac-bento__card, .ac-journey__card)[data-au].is-inview
   {
      animation: ac-rise 1s var(--ac-ease) calc(var(--index, 0) * var(--ac-step)) backwards;
   }

.au-motion .ac-hero.is-inview .ac-hero__screen
   {
      animation: ac-settle 1.2s var(--au-ease-scale) var(--au-step) backwards;
   }


/* ===== Narrower screens ===== */

/* The journey stacks: no path, each card joined to the next by a short line
   that fills red as the reader passes (--fill, set by the script). */
@media (max-width: 1099px)
   {
      .ac-journey__path,
      .ac-journey__node
         {
            display: none;
         }

      .ac-journey__steps
         {
            align-items: center;
            gap: 48px;
         }

      .ac-journey__step,
      .ac-journey__step:nth-child(even)
         {
            position: relative;
            justify-content: center;
            width: 100%;
         }

      .ac-journey__step + .ac-journey__step
         {
            margin-top: 0;
         }

      .ac-journey__card
         {
            width: 100%;
            max-width: 520px;
         }

      .ac-journey__step:not(:last-child)::after
         {
            content: "";
            position: absolute;
            top: 100%;
            left: 50%;
            width: 3px;
            height: 48px;
            margin-left: -1.5px;
            background:
               linear-gradient(var(--adv-red), var(--adv-red)) center top / 3px calc(var(--fill, 0) * 48px) no-repeat,
               repeating-linear-gradient(var(--adv-muted) 0 2px, transparent 2px 8px) center / 2px 100% no-repeat;
            transition: background-size 0.25s linear;
         }
   }

@media (max-width: 900px)
   {
      .kisaka-it .ac-hero__media
         {
            aspect-ratio: 1 / 1;
         }

      .ac-compare__grid,
      .ac-bento__grid,
      .ac-proof__cards
         {
            grid-template-columns: minmax(0, 1fr);
         }

      .ac-bento__card--wide
         {
            grid-template-columns: minmax(0, 1fr);
         }

      .ac-bento__card--wide .ac-bento__copy
         {
            order: 2;
            padding: 24px 16px 16px;
         }

      .kisaka-adv .ac-compare__text
         {
            font-size: 18px;
         }
   }

/* On phones the wide drawing runs edge to edge in its frame and swipes. */
@media (max-width: 600px)
   {
      .ac-bento__card--wide .ac-bento__media
         {
            display: block;
            overflow-x: auto;
            padding: 16px;
            scrollbar-width: none;
         }

      .ac-bento__card--wide .ac-bento__media .ac-diagram
         {
            width: 560px;
            max-width: none;
         }
   }
