/* ==========================================================================
   Kisaka tax and legal advisory page
   Built on the audit page, which is built on the IT page:
   css/kisaka-advisory.css, css/kisaka-it.css and css/kisaka-audit.css give
   the hero, the sticky index with its services, the promo cards, the wine
   closing panel and Ventriloc's entrance motion. This file adds only the
   parts of ventriloc.ca/en/data-governance those pages have no rule for:
   - the "Our way" values row: dark square icons that grow in,
   - the framework row: copy under a square marker beside the four tax
     heads drawing, which takes a pick and otherwise walks on by itself,
   - the step cards' numbers,
   - the closing line that fills in letter by letter as it scrolls up.
   Motion lives in js/kisaka-tax.js; drawings and icons come from
   scripts/make_tax_diagrams.py.
   ========================================================================== */

.kisaka-tax-page
   {
      --tx-dwell: 4.2s;
      --tx-dim: 0.2;
   }


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

/* Ventriloc's icon scale: from 0.4, never from nothing */
@keyframes tx-grow
   {
      0%
         {
            scale: 0.4;
         }
   }

@keyframes tx-timer
   {
      0%
         {
            scale: 0 1;
         }

      100%
         {
            scale: 1 1;
         }
   }


/* ===== Values: three columns, each led by a dark square ===== */

.tx-values__header
   {
      max-width: 560px;
      margin-bottom: clamp(40px, 5vw, 64px);
   }

.kisaka-adv .tx-values__list
   {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: clamp(32px, 4vw, 64px);
      margin: 0;
      padding: 0;
      list-style: none;
   }

.tx-value
   {
      display: flex;
      flex-direction: column;
      gap: 14px;
   }

.tx-value__icon
   {
      display: block;
      width: 64px;
      height: 64px;
      margin-bottom: 10px;
      border-radius: 12px;
      background: var(--adv-ink);
      overflow: clip;
   }

.tx-value__glyph
   {
      display: block;
      width: 100%;
      height: 100%;
   }

.kisaka-adv .tx-value__title
   {
      margin: 0;
      font-size: 20px;
      font-weight: 500;
      line-height: 1.25;
      letter-spacing: -0.015em;
      color: var(--adv-ink);
   }

.kisaka-adv .tx-value__text
   {
      max-width: 38ch;
      margin: 0;
      font-family: "Newsreader", Georgia, "Times New Roman", serif;
      font-optical-sizing: auto;
      font-size-adjust: 0.5;
      font-size: 17px;
      line-height: 1.5;
      color: var(--adv-body);
   }


/* ===== Framework row: copy beside the four tax heads ===== */

.tx-frame__panel
   {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
      gap: clamp(32px, 5vw, 72px);
      align-items: start;
      padding: clamp(28px, 4vw, 56px);
      border-radius: 20px;
      background: var(--it-panel);
   }

.tx-frame__copy
   {
      position: relative;
      padding-left: 26px;
   }

/* Ventriloc's square marker beside the title */
.tx-frame__copy::before
   {
      content: "";
      position: absolute;
      top: 0.5em;
      left: 0;
      width: 10px;
      height: 10px;
      border-radius: 1px;
      background: var(--adv-red);
   }

.kisaka-adv .tx-frame__title
   {
      margin: 0;
      font-size: clamp(22px, 2vw, 28px);
      font-weight: 400;
      line-height: 1.22;
      letter-spacing: -0.02em;
      color: var(--adv-ink);
      text-wrap: balance;
   }

.kisaka-adv .tx-frame__text
   {
      max-width: 520px;
   }

.tx-frame__media
   {
      --au-radius: 16px;
      position: relative;
      margin: 0;
      padding: 64px 0 28px 28px;
      border-radius: 16px;
      background: var(--it-warm);
      overflow: clip;
   }

.tx-frame__media .it-chip::before
   {
      animation: tx-pulse 2s ease-in-out infinite;
   }

@keyframes tx-pulse
   {
      50%
         {
            opacity: 0.35;
         }
   }

/* The drawing runs off the right edge, as Ventriloc's screens do. */
.kisaka-it .tx-heads__screen
   {
      position: relative;
      width: calc(100% + 28px);
      max-width: none;
   }

.tx-heads__screen .tx-diagram
   {
      display: block;
      width: 100%;
      height: auto;
   }

/* Only the chosen head is lit; picks retarget mid-fade, so these are
   transitions, never keyframes. */
.tx-heads__on,
.tx-heads__cap
   {
      opacity: 0;
      transition: opacity 240ms var(--au-ease-rule), translate 320ms var(--au-ease-rule);
   }

.tx-heads__cap
   {
      translate: 0 6px;
   }

.tx-heads[data-tx-on="0"] [data-tx-head="0"],
.tx-heads[data-tx-on="1"] [data-tx-head="1"],
.tx-heads[data-tx-on="2"] [data-tx-head="2"],
.tx-heads[data-tx-on="3"] [data-tx-head="3"]
   {
      opacity: 1;
      translate: 0 0;
   }

/* The timer along the chosen pillar's foot moves the drawing on when it
   fills (js/kisaka-tax.js listens for its end). It holds while the reader
   points at or focuses the drawing, and stays full once they pick. */
.tx-heads__timer
   {
      transform-box: fill-box;
      transform-origin: left center;
      scale: 1 1;
   }

/* Only the chosen head's timer runs, so each change of head starts a
   fresh one; js/kisaka-tax.js lifts data-tx-run for a frame to restart it
   on each arrival. */
.tx-heads[data-tx-run][data-tx-on="0"] [data-tx-head="0"] .tx-heads__timer,
.tx-heads[data-tx-run][data-tx-on="1"] [data-tx-head="1"] .tx-heads__timer,
.tx-heads[data-tx-run][data-tx-on="2"] [data-tx-head="2"] .tx-heads__timer,
.tx-heads[data-tx-run][data-tx-on="3"] [data-tx-head="3"] .tx-heads__timer
   {
      animation: tx-timer var(--tx-dwell) linear both;
   }

.tx-heads[data-tx-mode="hold"] .tx-heads__timer
   {
      animation-play-state: paused;
   }

.tx-heads[data-tx-mode="picked"] .tx-heads__timer
   {
      animation: none;
   }

.tx-heads__picks
   {
      position: absolute;
      inset: 0;
   }

.tx-heads__pick
   {
      position: absolute;
      padding: 0;
      border: 0;
      border-radius: 8px;
      background: transparent;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      transition: background-color 150ms ease;
   }

.tx-heads__pick:focus-visible
   {
      outline: 2px solid var(--adv-red);
      outline-offset: -2px;
   }

@media (hover: hover) and (pointer: fine)
   {
      .tx-heads__pick:hover
         {
            background-color: rgba(203, 31, 52, 0.05);
         }
   }


/* ===== Step cards ===== */

.kisaka-adv .tx-step__n
   {
      font-size: 13px;
      font-weight: 500;
      line-height: 1.4;
      color: var(--adv-red);
   }


/* ===== Closing panel: label left, the line and buttons right ===== */

.tx-cta.it-cta__panel
   {
      grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
      grid-template-rows: auto auto;
      grid-template-areas:
         "label title"
         "label action";
      row-gap: clamp(28px, 3vw, 40px);
   }

/* With no visible label (the tax page keeps its heading for screen readers
   only), the line runs wide across the panel and the two buttons stand in a
   narrow column on the right, level with the line's last row, so neither
   side is left empty. The button column is the shared one in kisaka-it.css. */
.tx-cta.it-cta__panel:not(:has(.it-cta__label))
   {
      grid-template-columns: minmax(0, 1fr) minmax(200px, 240px);
      grid-template-rows: auto;
      grid-template-areas: "title action";
      column-gap: clamp(40px, 6vw, 112px);
      align-items: end;
   }

.kisaka-adv .tx-cta:not(:has(.it-cta__label)) .it-cta__title
   {
      align-self: end;
      max-width: none;
      font-size: clamp(32px, 3.6vw, 54px);
      line-height: 1.08;
      text-wrap: pretty;
   }

.kisaka-adv .tx-cta .it-cta__label
   {
      align-self: start;
      margin: 0;
      font-family: inherit;
      line-height: 1.4;
   }

.kisaka-adv .tx-cta .it-cta__title
   {
      align-self: start;
      max-width: 24ch;
      font-size: clamp(28px, 3vw, 46px);
      line-height: 1.12;
      letter-spacing: -0.03em;
   }

.tx-fill__c
   {
      opacity: var(--tx-dim);
   }


/* ==========================================================================
   Motion, only when js/kisaka-audit.js has set .au-motion. The audit layer
   already rises the shared parts; these add the values, the framework row
   and the step numbers, on Ventriloc's values timing: columns 140ms apart,
   the icon growing from 0.4 over 1.4s, its text rising 40px after it.
   ========================================================================== */

.tx-values__header .adv-lead
   {
      --d: var(--after-lines);
   }

.tx-value
   {
      --col-d: calc(280ms + var(--index, 0) * var(--au-step));
   }

.tx-value__title
   {
      --d: calc(var(--col-d) + var(--au-step));
   }

.tx-value__text
   {
      --d: calc(var(--col-d) + var(--au-step) * 2);
   }

.tx-frame__text
   {
      --d: var(--au-step);
   }

.au-motion [data-au]:not(.is-inview) :is(.tx-value__title, .tx-value__text, .tx-frame__title, .tx-frame__text)
   {
      opacity: 0;
   }

.au-motion [data-au].is-inview :is(.tx-value__title, .tx-value__text, .tx-frame__title, .tx-frame__text)
   {
      animation: au-rise var(--au-rise) var(--au-ease-out) var(--d, 0ms) backwards, au-fade 250ms linear var(--d, 0ms) backwards;
   }

.au-motion .tx-value:not(.is-inview) .tx-value__icon
   {
      opacity: 0;
   }

.au-motion .tx-value.is-inview .tx-value__icon
   {
      animation: tx-grow 1.4s var(--au-ease-rule) var(--col-d) backwards, au-fade 300ms linear var(--col-d) backwards;
   }

/* the square marker turns in like the index square */
.au-motion .tx-frame__copy:not(.is-inview)::before
   {
      opacity: 0;
      rotate: -270deg;
      scale: 0.4;
   }

.au-motion .tx-frame__copy.is-inview::before
   {
      transition: opacity 250ms linear, rotate 950ms var(--au-ease-expo), scale 950ms var(--au-ease-expo);
   }

/* the drawing panel opens from the bottom, its screen settling */
.au-motion .tx-frame__media[data-au]:not(.is-inview)
   {
      opacity: 0;
   }

.au-motion .tx-frame__media[data-au].is-inview
   {
      animation: au-open 1.2s var(--au-ease-expo) var(--au-step) backwards;
   }

.au-motion .tx-frame__media[data-au].is-inview .tx-heads__screen
   {
      animation: au-settle 1.2s var(--au-ease-scale) var(--au-step) backwards;
      transform-origin: top left;
   }


/* ===== Responsive ===== */

@media (max-width: 1100px)
   {
      .tx-frame__panel
         {
            grid-template-columns: minmax(0, 1fr);
         }
   }

@media (max-width: 900px)
   {
      .kisaka-adv .tx-values__list
         {
            grid-template-columns: minmax(0, 1fr);
            gap: 40px;
         }

      .tx-cta.it-cta__panel
         {
            grid-template-columns: minmax(0, 1fr);
            grid-template-areas:
               "label"
               "title"
               "action";
            row-gap: 20px;
         }

      .tx-cta.it-cta__panel:not(:has(.it-cta__label))
         {
            grid-template-columns: minmax(0, 1fr);
            grid-template-areas:
               "title"
               "action";
            row-gap: 28px;
         }
   }

/* On phones the four heads swipe at a readable width, like the IT
   drawings; the picks scroll with them. */
@media (max-width: 600px)
   {
      .tx-frame__panel
         {
            padding: 24px 20px;
         }

      .tx-frame__media
         {
            padding: 60px 0 20px 0;
            overflow-x: auto;
            overscroll-behavior-x: contain;
            scrollbar-width: none;
         }

      .tx-frame__media::-webkit-scrollbar
         {
            display: none;
         }

      .kisaka-it .tx-heads__screen
         {
            width: 520px;
            margin-left: 16px;
         }
   }

@media (prefers-reduced-motion: reduce)
   {
      .tx-heads__on,
      .tx-heads__cap,
      .tx-heads__pick
         {
            transition: opacity 150ms linear;
         }

      .tx-heads__cap
         {
            translate: none;
         }

      .tx-heads .tx-heads__on .tx-heads__timer
         {
            animation: none;
         }

      .tx-frame__media .it-chip::before
         {
            animation: none;
         }

      .tx-fill__c
         {
            opacity: 1;
         }
   }


/* ===== Discuss scope: the site's flying arrow (css/kisaka-base.css) ===== */

/* The arrow flies out the top right while its copy comes in from the bottom
   left, as on every other link of this kind on the site. The tax and
   internal audit pages both carry .kisaka-tax. */
.kisaka-tax .au-link .kisaka-home-launch__btn-arrow-box
   {
      width: 0.95em;
      height: 0.95em;
   }

.kisaka-tax .au-link:is(:hover, :focus-visible) .kisaka-home-launch__btn-arrow
   {
      transform: translate(115%, -115%);
   }

.kisaka-tax .au-link:is(:hover, :focus-visible) .kisaka-home-launch__btn-arrow--ghost
   {
      transform: translate(0, 0);
   }
