/* Income protection set piece: the weeks off work (see partials/features/income-weeks.php).
   The default is the finished picture: every week filled, the cover flag, three payment cards stacked, the bills
   ticked and the day back lit, beside the full list of steps. The script parks it at day 1 and runs it.
   .is-pinned (wide, tall screens with full motion) sets up the pinned scene; .is-live (script running) turns on
   the pointer readout and the ambient loops while the section is in view (.is-awake). */
.inw { overflow: clip; padding-block: clamp(3rem, min(7vw, 8vh), 6rem); --wgap: 4px; --wkh: clamp(58px, 9vh, 92px); }
.inw-in { position: relative; z-index: 1; }
.inw-head { margin-bottom: clamp(1.4rem, 3.4vh, 2.6rem); }
.inw-head .h2 { color: #fff; }

/* the section's own ground: a faint wall-planner grid over the pine, fading out at the edges */
.inw-grid-bg {
  position: absolute; inset: -10% 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(159,216,180,.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(159,216,180,.09) 1px, transparent 1px);
  background-size: 92px 80px;
  -webkit-mask-image: radial-gradient(70% 60% at 70% 45%, #000 0%, transparent 80%);
          mask-image: radial-gradient(70% 60% at 70% 45%, #000 0%, transparent 80%);
}

/* ------------------------------------------------------------------ scene */
.inw-scene { display: grid; gap: clamp(2rem, 5vw, 3rem); align-items: center; }
@media (min-width: 900px) {
  .inw-scene { grid-template-columns: minmax(0, 1fr) clamp(260px, 25vw, 340px); gap: clamp(2rem, 3.6vw, 3.6rem); }
}

/* ---------------------------------------------------------------- planner */
.inw-planner {
  position: relative;
  padding: calc(var(--pu, 1rem) * 1.6) clamp(1rem, 2.2vw, 1.9rem) calc(var(--pu, 1rem) * 1.3);
  border-radius: 14px; background: var(--paper); color: var(--ink);
  box-shadow: 0 50px 80px -44px rgba(0,0,0,.8), 0 0 0 1px rgba(12,59,39,.06);
}
/* a second sheet behind, as on a pad, and an offset outline */
.inw-planner-wrap { position: relative; }
.inw-planner-wrap::before, .inw-planner-wrap::after { content: ""; position: absolute; inset: 0; border-radius: 14px; pointer-events: none; }
.inw-planner-wrap::before { background: rgba(255,255,255,.1); transform: translate(10px, 10px) rotate(.8deg); }
.inw-planner-wrap::after { border: 1px solid rgba(159,216,180,.38); transform: translate(-14px, 14px); }

/* the binding along the top edge */
.inw-rings { position: absolute; left: 6%; right: 6%; top: -11px; display: flex; justify-content: space-between; pointer-events: none; }
.inw-rings i { width: 9px; height: 22px; border-radius: 6px; border: 2.5px solid #C9D6CE; background: transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.inw-rings i::after { content: ""; display: block; width: 7px; height: 7px; margin: 9px 0 0 -1.5px; border-radius: 50%; background: var(--pine); opacity: .85; }

.inw-ptop { display: flex; align-items: center; justify-content: space-between; gap: .6rem 1.2rem; flex-wrap: wrap; margin-bottom: calc(var(--pu, 1rem) * .9); }
.inw-ptitle { font-family: var(--display); font-weight: 800; font-size: clamp(1.25rem, 1.7vw, 1.6rem); letter-spacing: -.025em; line-height: 1.1; color: var(--pine); }
.inw-key { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .9375rem; font-weight: 600; color: rgba(14,21,18,.72); }
.inw-key-i { display: inline-flex; align-items: center; gap: .45rem; }
.inw-key-i::before { content: ""; width: 18px; height: 12px; border-radius: 3px; }
.inw-key-wait::before { background: repeating-linear-gradient(135deg, var(--honey) 0 3px, #FBDD9E 3px 6px); }
.inw-key-cov::before { background: var(--tick); }

/* months and weeks share one grid: twelve weeks, then the day back */
.inw-months, .inw-strip { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)) minmax(0, 1.75fr); column-gap: var(--wgap); }
.inw-mo {
  position: relative; padding: 0 0 .45rem; margin-bottom: .55rem;
  font-weight: 700; font-size: .9375rem; line-height: 1.2; color: var(--pine); text-align: center; white-space: nowrap;
}
/* a bracket under each month's label */
.inw-mo::after {
  content: ""; position: absolute; left: 2px; right: 2px; bottom: 0; height: 7px;
  border: 2px solid rgba(12,59,39,.28); border-bottom: 0; border-radius: 5px 5px 0 0;
}

/* the track: the strip of cells, with the marker, readout and the layer of flags under it */
.inw-track { position: relative; margin-bottom: calc(var(--pu, 1rem) * .9); }
.inw-wk { position: relative; height: var(--wkh); }
.inw-wk-in {
  position: absolute; inset: 0; overflow: clip; border-radius: 8px;
  /* seven days a week, marked faintly */
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(100% / 7 - 1px), rgba(12,59,39,.08) calc(100% / 7 - 1px) calc(100% / 7)),
    var(--chalk);
  box-shadow: inset 0 0 0 1px rgba(12,59,39,.1);
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s;
}
.inw-fill { position: absolute; inset: 0; transform-origin: 0 50%; background: linear-gradient(180deg, #1DB053 0%, var(--tick) 100%); }
.inw-wk-wait .inw-fill { background: repeating-linear-gradient(135deg, var(--honey) 0 6px, #FBDD9E 6px 12px); }
.inw-n {
  position: absolute; left: 50%; top: 7px; z-index: 1; margin-left: -12px;
  width: 24px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  background: rgba(255,255,255,.92); color: var(--pine);
  font-weight: 700; font-size: .8125rem; line-height: 1; font-variant-numeric: tabular-nums;
}

/* the day back: the last cell, lit with a tick */
.inw-back .inw-wk-in { background: var(--mint); box-shadow: inset 0 0 0 1.5px rgba(15,127,56,.4); }
.inw-back .inw-fill { background: linear-gradient(135deg, #DDF3E4, var(--mint-deep)); }
.inw-back-tick { position: absolute; z-index: 1; left: calc(50% - 15px); top: calc(50% - 15px); width: 30px; height: 30px; color: var(--tick-dark); }

/* the day back waits with a dashed edge until you get there */
.inw-back.is-todo .inw-wk-in { background: var(--chalk); box-shadow: none; outline: 2px dashed rgba(15,127,56,.35); outline-offset: -2px; }

/* The layer under the strip. It is not part of the strip's grid; its flags are placed from the strip's
   column sizes: one week is --u wide, (100% - 12 gaps) / 13.75 (twelve weeks plus the 1.75 wide day back). */
.inw-under { position: relative; height: calc(var(--pu, 1rem) * 2.4 + 56px); --u: calc((100% - 12 * var(--wgap)) / 13.75); }

/* a payment lands at the end of each month: a coin that hangs under week --k */
.inw-coin {
  position: absolute; z-index: 2; top: 0; left: calc((var(--k) - 1) * (var(--u) + var(--wgap)) + var(--u) / 2 - 15px);
  display: grid; justify-items: start; pointer-events: none; transform-origin: 15px 0;
}
.inw-coin::before { content: ""; width: 2px; height: 10px; margin-left: 14px; background: var(--honey); }
.inw-coin > span { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; font-weight: 700; font-size: .875rem; line-height: 1.2; color: var(--pine); }
.inw-coin b {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--honey); color: var(--pine); font-family: var(--display); font-weight: 800; font-size: 1rem; line-height: 1;
  box-shadow: 0 0 0 3px var(--paper), 0 6px 12px -4px rgba(12,59,39,.5);
}
/* the waiting week's stripes creep along while you wait */
.inw.is-awake .inw-wk-wait .inw-fill { background-size: 17px 17px; animation: inw-wait 1.2s linear infinite; }
@keyframes inw-wait { to { background-position: 17px 0; } }

/* flags that hang under the strip */
.inw-flag { position: absolute; top: 0; z-index: 2; display: grid; justify-items: start; pointer-events: none; }
.inw-flag::before { content: ""; width: 2px; height: 12px; background: var(--pine); margin-left: 0; }
.inw-flag > span {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  padding: .3rem .6rem .32rem; border-radius: 8px; background: var(--pine); color: #fff;
  font-weight: 700; font-size: .875rem; line-height: 1.2;
}
.inw-flag .tick { width: 1.1em; height: 1.1em; color: var(--mint-deep); }
.inw-flag-day { left: 0; }
.inw-flag-cover { left: calc(var(--u) + var(--wgap) / 2 - 1px); }
.inw-flag-cover::before { height: calc(var(--pu, 1rem) * 2.4 + 12px); background: var(--tick-dark); }
.inw-flag-cover > span { background: var(--tick-dark); }
.inw-flag-back { right: 0; justify-items: end; }
.inw-flag-back::before { height: calc(var(--pu, 1rem) * 2.4 + 12px); background: var(--tick-dark); }
.inw-flag-back > span { background: var(--pine); }

/* the "today" marker that rides the front of the fill (script only) */
.inw-now { display: none; }
.inw.is-live .inw-now {
  display: block; position: absolute; z-index: 3; left: 0; top: -8px; height: calc(var(--wkh) + 16px); width: 0; pointer-events: none;
}
.inw-now::before { content: ""; position: absolute; left: -1.5px; top: 0; bottom: 0; width: 3px; border-radius: 3px; background: var(--pine); }
.inw-now i { position: absolute; left: -7px; top: -6px; width: 14px; height: 14px; border-radius: 50%; background: var(--honey); box-shadow: 0 0 0 3px var(--pine); }
.inw.is-awake .inw-now i { animation: inw-ping 1.8s ease-out infinite; }
@keyframes inw-ping { 0% { box-shadow: 0 0 0 3px var(--pine), 0 0 0 3px rgba(244,185,66,.6); } 80%, 100% { box-shadow: 0 0 0 3px var(--pine), 0 0 0 14px rgba(244,185,66,0); } }

/* pointer readout over the strip (desktop) */
.inw-peek {
  position: absolute; z-index: 4; left: 0; bottom: calc(100% + 10px); pointer-events: none;
  padding: .35rem .65rem; border-radius: 8px; background: var(--ink); color: #fff;
  font-weight: 600; font-size: .875rem; line-height: 1.2; white-space: nowrap;
  opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s;
}
.inw-peek.is-on { opacity: 1; transform: none; }
.inw.is-live .inw-wk.is-hover .inw-wk-in { transform: translateY(-5px); box-shadow: inset 0 0 0 2px var(--pine), 0 12px 18px -10px rgba(12,59,39,.55); }

/* the bills it pays for */
.inw-bills { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .6rem; padding-top: calc(var(--pu, 1rem) * .9); border-top: 1.5px dashed rgba(12,59,39,.18); }
.inw-bills-l { font-weight: 700; font-size: .9375rem; color: rgba(14,21,18,.66); margin-right: .3rem; }
.inw-bill {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .45rem .85rem .45rem .45rem; border-radius: 999px;
  background: var(--mint); color: var(--pine); font-weight: 600; font-size: .9375rem; line-height: 1.2;
  transition: background-color .35s, color .35s;
}
.inw-bill-ok { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--tick); transition: background-color .35s; }
.inw-bill-ok .tick { width: 16px; height: 16px; color: #fff; }
.inw-bill.is-off { background: var(--chalk); color: rgba(14,21,18,.6); }
.inw-bill.is-off .inw-bill-ok { background: rgba(12,59,39,.14); }

.inw-eg {
  position: absolute; right: clamp(1rem, 2.2vw, 1.9rem); top: -14px;
  padding: .3rem .7rem; border-radius: 999px; background: var(--honey); color: var(--ink);
  font-weight: 700; font-size: .8125rem; line-height: 1.2; transform: rotate(3deg);
  box-shadow: 0 8px 16px -8px rgba(0,0,0,.5);
}

/* ---------------------------------------------------------- payment cards */
.inw-pay { display: grid; justify-items: center; gap: 1.1rem; }
.inw-float { width: min(100%, 340px); }
.inw.is-awake .inw-float { animation: inw-float 5.5s ease-in-out infinite alternate; }
@keyframes inw-float { from { transform: translateY(-5px); } to { transform: translateY(6px); } }
.inw-stack { position: relative; aspect-ratio: 1.5; margin: 18px 14px 14px; }
.inw-tray {
  position: absolute; inset: -12px; border-radius: 18px; border: 2px dashed rgba(159,216,180,.45);
  display: grid; place-items: center;
}
.inw-tray-c { display: grid; justify-items: center; gap: .7rem; font-weight: 600; font-size: .9375rem; color: rgba(255,255,255,.72); opacity: 0; transition: opacity .3s; }
.inw-tray-c b {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  border: 2px dashed rgba(244,185,66,.7); color: var(--honey);
  font-family: var(--display); font-weight: 800; font-size: 1.9rem; line-height: 1;
}
.inw.is-empty .inw-tray-c { opacity: 1; }
.inw.is-awake.is-empty .inw-tray-c b { animation: inw-wait-coin 2.4s ease-in-out infinite; }
@keyframes inw-wait-coin { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(7px); } }
.inw-card {
  position: absolute; inset: 0; z-index: 1; overflow: clip;
  display: grid; grid-template-rows: auto 1fr auto; padding: clamp(.9rem, 1.4vw, 1.2rem) clamp(1rem, 1.5vw, 1.3rem);
  border-radius: 14px; background: var(--paper); color: var(--ink);
  border-left: 7px solid var(--tick);
  box-shadow: 0 30px 50px -28px rgba(0,0,0,.85), 0 0 0 1px rgba(12,59,39,.06);
}
.inw-card[data-m="1"] { transform: translate(-10px, 12px) rotate(-6deg); }
.inw-card[data-m="2"] { transform: translate(8px, 6px) rotate(3.5deg); }
.inw-card[data-m="3"] { transform: rotate(-1deg); }
.inw-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.inw-card-t { font-weight: 700; font-size: 1rem; color: var(--pine); }
.inw-card-m { font-weight: 600; font-size: .875rem; color: rgba(14,21,18,.6); }
.inw-card-amt {
  align-self: center; display: flex; align-items: baseline; gap: .4rem;
  font-family: var(--display); font-weight: 800; font-size: clamp(2.2rem, 3.4vw, 3rem); letter-spacing: -.035em; line-height: 1; color: var(--pine);
  font-variant-numeric: tabular-nums;
}
.inw-card-amt small { font-family: var(--body); font-weight: 700; font-size: 1rem; letter-spacing: 0; color: var(--tick-dark); }
.inw-card-foot { display: flex; align-items: center; justify-content: space-between; }
.inw-pill { padding: .3rem .7rem; border-radius: 999px; background: var(--mint); color: var(--pine); font-weight: 700; font-size: .875rem; line-height: 1.2; }
.inw-card-ok { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--tick); }
.inw-card-ok .tick { width: 18px; height: 18px; color: #fff; }
/* a light passing across the top card */
/* (moved with background-position, not a transform, so it never sits sideways of the card's grid) */
.inw-sheen {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(220,238,226,.75) 50%, transparent 60%) no-repeat;
  background-size: 300% 100%; background-position: 100% 0;
}
.inw.is-awake .inw-card[data-m="3"] .inw-sheen { animation: inw-sheen 4.8s ease-in-out 1s infinite; }
@keyframes inw-sheen { 0% { background-position: 100% 0; } 30%, 100% { background-position: 0% 0; } }
.inw-stack .card-glare { border-radius: 14px; }

.inw-count { display: flex; align-items: baseline; gap: .6rem; margin: 0; color: rgba(255,255,255,.84); font-weight: 600; font-size: 1rem; }
.inw-count b { font-family: var(--display); font-weight: 800; font-size: 2.2rem; line-height: 1; color: var(--honey); font-variant-numeric: tabular-nums; min-width: .65em; text-align: right; }

/* ----------------------------------------------------------------- steps */
/* phones and tablets: a vertical line of steps; the line runs in the dot column, between the dots */
.inw-stages { position: relative; display: grid; margin: clamp(2.4rem, 5vw, 3rem) 0 0; padding: 0; list-style: none; }
.inw-stage { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 1rem; align-content: start; padding-bottom: 1.5rem; }
.inw-stage:last-child { padding-bottom: 0; }
.inw-dot {
  position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: var(--tick); box-shadow: 0 0 0 5px var(--pine);
  transition: background-color .35s, box-shadow .35s;
}
.inw-dot .tick { width: 22px; height: 22px; color: #fff; }
.inw-stage h3 { margin: .35rem 0 .2rem; font-size: clamp(1.15rem, 1.5vw, 1.3rem); letter-spacing: -.01em; color: #fff; }
.inw-stage p { margin: 0; font-size: 1.0625rem; line-height: 1.45; color: rgba(255,255,255,.82); }
.inw-link { position: absolute; left: 19px; top: 52px; bottom: 8px; width: 2px; border-radius: 2px; background: rgba(255,255,255,.16); }
.inw-link i { position: absolute; inset: 0; border-radius: 2px; background: var(--mint-deep); transform-origin: 50% 0; }

/* script states for the steps (both layouts) */
.inw-stage.is-ahead .inw-dot { background: var(--pine); box-shadow: 0 0 0 5px var(--pine), inset 0 0 0 1.5px rgba(255,255,255,.4); }
.inw-stage.is-ahead .inw-dot .tick { opacity: 0; }
.inw-stage.is-ahead .inw-stage-c { opacity: .8; }
.inw-stage.is-ahead h3 { color: rgba(255,255,255,.86); }
.inw-stage-c { transition: opacity .4s; }
.inw-stage.is-on .inw-dot { background: var(--honey); box-shadow: 0 0 0 5px var(--pine), 0 0 0 9px rgba(244,185,66,.25); }
.inw.is-awake .inw-stage.is-on .inw-dot { animation: inw-beat 1.8s ease-out infinite; }
@keyframes inw-beat { 0% { box-shadow: 0 0 0 5px var(--pine), 0 0 0 5px rgba(244,185,66,.55); } 80%, 100% { box-shadow: 0 0 0 5px var(--pine), 0 0 0 18px rgba(244,185,66,0); } }
.inw-stage.is-on .inw-dot .tick { color: var(--pine); }
.inw.is-live .inw-stage { cursor: default; }

@media (min-width: 1200px) {
  /* desktop: the steps run across under the planner, a connector in each gap between the dots */
  .inw-stages { grid-template-columns: repeat(5, minmax(0, 1fr)); column-gap: clamp(1.4rem, 2.4vw, 2.4rem); margin-top: clamp(2rem, 4.4vh, 3rem); }
  .inw-stage { grid-template-columns: minmax(0, 1fr); gap: .6rem; padding-bottom: 0; }
  .inw-stage h3 { margin: 0 0 .15rem; }
  .inw-stage p { font-size: 1rem; }
  .inw-link { left: 54px; right: calc(-1 * clamp(1.4rem, 2.4vw, 2.4rem) + 14px); top: 19px; bottom: auto; width: auto; height: 2px; }
  .inw-link i { transform-origin: 0 50%; }
  .inw.is-live .inw-stage { cursor: pointer; }
}

.inw-note { display: flex; align-items: flex-start; gap: .6rem; margin: clamp(1.6rem, 3.4vh, 2.4rem) 0 0; font-size: 1rem; line-height: 1.45; color: rgba(255,255,255,.78); }
.inw-note svg { width: 20px; height: 20px; flex: none; margin-top: .1rem; fill: none; stroke: var(--mint-deep); stroke-width: 2; stroke-linecap: round; }

/* ------------------------------------------------ pinned scene (desktop) */
@media (min-width: 1200px) {
  .inw.is-pinned { --pu: clamp(.7rem, 1.6vh, 1rem); min-height: 100vh; display: grid; align-content: center; padding-block: 90px 14px; }
  .inw.is-pinned .inw-head { margin-bottom: clamp(1.2rem, 3vh, 2.2rem); }
}

/* ------------------------------------------------------------- phones */
@media (max-width: 899px) {
  .inw-pay { order: 2; }
}
@media (max-width: 640px) {
  .inw { --wgap: 3px; }
  .inw-planner { padding-inline: .85rem; }
  .inw-planner-wrap::after { transform: translate(-8px, 10px); }
  .inw-rings { left: 5%; right: 5%; }
  .inw-rings i:nth-child(n+10) { display: none; }
  .inw { --wkh: 64px; }
  .inw-wk-in { border-radius: 5px; background: var(--chalk); }
  .inw-n { width: auto; left: 2px; right: 2px; margin: 0; top: 3px; height: 18px; border-radius: 4px; font-size: .75rem; letter-spacing: -.02em; }
  .inw-coin { left: calc((var(--k) - 1) * (var(--u) + var(--wgap)) + var(--u) / 2 - 11px); transform-origin: 11px 0; }
  .inw-coin::before { margin-left: 10px; }
  .inw-coin b { width: 22px; height: 22px; font-size: .8125rem; box-shadow: 0 0 0 2px var(--paper); }
  .inw-coin-t { display: none; }
  .inw-back-tick { width: 22px; height: 22px; left: calc(50% - 11px); top: calc(50% - 11px); }
  .inw-mo { font-size: .8125rem; }
  .inw-key { font-size: .875rem; }
  .inw-flag > span { font-size: .8125rem; padding: .25rem .5rem .27rem; }
  .inw-bills { gap: .4rem .35rem; }
  .inw-bills-l { width: 100%; font-size: .875rem; }
  .inw-bill { gap: .4rem; padding: .32rem .7rem .32rem .32rem; font-size: .875rem; }
  .inw-bill-ok { width: 22px; height: 22px; }
  .inw-bill-ok .tick { width: 14px; height: 14px; }
  .inw-float { width: min(100%, 300px); }
}
