/* Tax rates and allowances. Design plan: _work/design-plan.md; site plan: _work/site-plan.md (Reference).
   Opener: compact ruled band, a tax-year switcher and four headline figures that roll when the year changes.
   Set pieces: income tax and NI bands drawn to scale on a ruler with a draggable income marker; rate tables that
   morph between years (Flip). */

@keyframes rt-drift-32 { to { background-position: 0 32px; } }
@keyframes rt-drift-36 { to { background-position: 0 36px; } }
@keyframes rt-breathe { from { transform: scale(1); } to { transform: scale(1.05); } }
@keyframes rt-pulse { 0% { box-shadow: 0 0 0 0 rgba(242,214,75,.6); } 75%, 100% { box-shadow: 0 0 0 12px rgba(242,214,75,0); } }

/* ---------- 1. Opener ---------- */
.rt-open { position: relative; overflow: clip; background: var(--paper); padding: calc(var(--head-h) + clamp(24px, 4.4vh, 56px)) 0 clamp(36px, 6vh, 70px); }
.rt-open__ruling { position: absolute; inset: 0; pointer-events: none; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, rgba(19,32,47,.07) 31px, rgba(19,32,47,.07) 32px); animation: rt-drift-32 18s linear infinite; -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.3), #000 30%, #000 80%, rgba(0,0,0,.5)); mask-image: linear-gradient(180deg, rgba(0,0,0,.3), #000 30%, #000 80%, rgba(0,0,0,.5)); }
.rt-open__ruling::before { content: ''; position: absolute; top: 0; bottom: 0; left: clamp(18px, 3vw, 46px); width: 1.5px; background: rgba(163,24,62,.5); }
.rt-open .wrap { position: relative; }
.rt-open__top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: clamp(30px, 4.5vw, 80px); align-items: center; }
.rt-open h1 { font-size: clamp(2.6rem, min(4.8vw, 8.6vh), 4.9rem); margin-bottom: clamp(12px, 2vh, 22px); }
.rt-open__lede { margin-bottom: clamp(18px, 2.8vh, 28px); color: var(--ink); }

.yr { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 5px; background: #fff; border: 1px solid var(--rule); box-shadow: 0 16px 34px rgba(34,9,15,.08); max-width: 100%; }
.yr__ink { position: absolute; z-index: 0; left: 0; top: 0; width: 0; height: 0; border-radius: var(--btn-r); background: var(--claret); }
.yr__tab { position: relative; z-index: 1; display: grid; gap: 1px; min-width: 0; padding: 10px 22px 10px 18px; border-radius: var(--btn-r); color: var(--ink); text-decoration: none; transition: color .35s var(--ease); }
.yr__tab b { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; line-height: 1.1; }
.yr__tab span { font-size: .92rem; color: var(--ink-soft); transition: color .35s var(--ease); }
.yr__tab i { position: absolute; right: 8px; top: -11px; padding: 2px 8px; background: var(--highlight); color: var(--ink); font-style: normal; font-weight: 700; font-size: .8rem; line-height: 1.4; }
.yr__tab[aria-current] { color: #fff; background: var(--claret); transition: color .35s var(--ease), background-color 0s .5s; } /* its own colour once the ink is under it */
.yr__tab[aria-current] span { color: #F6D8DF; }
.yr__tab:hover:not([aria-current]) { color: var(--crimson); }
.no-js .yr__ink, .motion-fail .yr__ink { display: none; }
.no-js .yr__tab[aria-current], .motion-fail .yr__tab[aria-current] { background: var(--claret); }

.rt-open__ph { position: relative; margin: 0; padding: 18px 18px 18px 0; }
.rt-open__oval { position: absolute; left: -8%; top: -10%; width: 116%; height: 120%; overflow: visible; pointer-events: none; }
.rt-open__oval ellipse { fill: none; stroke: var(--crimson); stroke-width: 1.5; stroke-dasharray: 5 10; opacity: .55; animation: dash-turn 30s linear infinite; }
.rt-open__frame { position: relative; aspect-ratio: 1264 / 848; max-height: min(34vh, 330px); width: 100%; box-shadow: 20px 20px 0 rgba(117,21,35,.1); }
.rt-open__frame img { position: absolute; inset: 0; }
.motion .rt-open__frame img { animation: rt-breathe 12s ease-in-out infinite alternate; }

.heads { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: clamp(22px, 4vh, 44px) 0 0; border-top: 2px solid var(--ink); }
.head { position: relative; padding: 16px 20px 6px 0; background: transparent; }
.head + .head { padding-left: 22px; border-left: 1px solid rgba(117,21,35,.2); }
.head dt { font-size: .9rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--claret); margin-bottom: 4px; }
.head dd { margin: 0; display: grid; gap: 6px; }
.head__v { display: flex; font-weight: 600; font-size: clamp(2.4rem, min(4vw, 7vh), 3.9rem); line-height: 1.04; letter-spacing: -.035em; color: var(--ink); white-space: nowrap; }
.head__v .ch { position: relative; display: inline-block; overflow: clip; }
.head__v .ch > i { display: inline-block; font-style: normal; }
.head__n { font-size: .98rem; line-height: 1.4; color: var(--ink-soft); min-height: 2.8em; }
.head.is-up .head__v { color: var(--crimson); }
.motion:not(.motion-fail) [data-rt-in], .motion:not(.motion-fail) [data-head] { opacity: 0; }
.motion:not(.motion-fail) [data-rt-wipe] { clip-path: inset(0 100% 0 0); }

@media (min-width: 901px) and (max-height: 860px) {
  .rt-open { padding-top: calc(var(--head-h) + 18px); padding-bottom: 30px; }
  .rt-open__frame { max-height: 30vh; }
}
@media (max-width: 1100px) { .heads { grid-template-columns: repeat(2, minmax(0, 1fr)); } .head:nth-child(3) { padding-left: 0; border-left: 0; } .head:nth-child(n+3) { border-top: 1px solid rgba(117,21,35,.2); } }
@media (max-width: 900px) { .rt-open__top { grid-template-columns: minmax(0, 1fr); } .rt-open__ph { width: min(100%, 520px); } }
@media (max-width: 560px) {
  .rt-open h1 { font-size: clamp(2.2rem, 10vw, 2.8rem); }
  .yr { display: grid; width: 100%; }
  .yr__tab { padding: 10px 12px; }
  .yr__tab b { font-size: 1.35rem; }
  .yr__tab span { font-size: .875rem; }
  .head { padding-right: 10px; }
  .head + .head { padding-left: 12px; }
  .head__v { font-size: 2.1rem; }
  .head__n { font-size: .92rem; min-height: 4.2em; }
}

/* ---------- 2. The ruler ---------- */
.ruler { overflow: clip; }
.ruler__ruling { position: absolute; inset: 0; pointer-events: none; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 35px, rgba(255,255,255,.04) 35px, rgba(255,255,255,.04) 36px); animation: rt-drift-36 22s linear infinite; }
.ruler .wrap { position: relative; }
.ruler__head { display: grid; gap: 16px; margin-bottom: clamp(30px, 4vw, 54px); }
.ruler h2 { color: #fff; }
.ruler__head .lede { margin: 0; max-width: 120ch; }
.ru { --name: 170px; position: relative; padding-bottom: 6px; touch-action: pan-y; }
.ru__lane { display: grid; grid-template-columns: var(--name) minmax(0, 1fr); align-items: center; }
.ru__lane + .ru__lane { margin-top: 10px; }
.ru__name { margin: 0; padding-right: 14px; font-weight: 700; color: #fff; line-height: 1.25; }
.ru__track { position: relative; height: 60px; background: rgba(255,255,255,.05); }
.ru__lane[data-lane="ee"] .ru__track, .ru__lane[data-lane="se"] .ru__track { height: 40px; }
.ru__band, .ru__taper { position: absolute; top: 0; bottom: 0; left: calc(var(--a) / 150000 * 100%); width: calc((var(--b) - var(--a)) / 150000 * 100%); display: flex; flex-direction: column; justify-content: center; padding: 0 10px; overflow: hidden; transform-origin: left center; border-right: 2px solid var(--ink-blue); }
.ru__band b { font-weight: 700; font-size: 1.05rem; line-height: 1.1; color: #fff; }
.ru__band small { font-size: .88rem; font-weight: 600; color: rgba(255,255,255,.85); white-space: nowrap; line-height: 1.2; }
.ru__band--0 { background: rgba(255,255,255,.1); }
.ru__band--20 { background: #C2456A; }
.ru__band--40 { background: var(--crimson); }
.ru__band--45 { background: var(--claret); }
.ru__band--2 { background: rgba(194,69,106,.45); }
.ru__taper { top: auto; height: 16px; border: 0; padding: 0 6px; justify-content: center; background: repeating-linear-gradient(-45deg, rgba(242,214,75,.95) 0 6px, rgba(242,214,75,.55) 6px 12px); }
.ru__taper small { font-size: .78rem; font-weight: 700; color: var(--ink); white-space: nowrap; line-height: 16px; }
.ru__scale { position: relative; height: 40px; margin: 8px 0 0 var(--name); border-top: 1.5px solid rgba(255,255,255,.55); }
.ru__scale i { position: absolute; top: 0; left: calc(var(--a) / 150000 * 100%); width: 1px; height: 8px; background: rgba(255,255,255,.45); }
.ru__scale i.is-major { height: 14px; background: #fff; }
.ru__scale i span { position: absolute; top: 18px; left: 0; transform: translateX(-50%); font-size: .9rem; font-weight: 700; color: var(--on-dark-soft); white-space: nowrap; }
.ru__scale i:first-child span { transform: none; }
.ru__scale i:last-child span { transform: translateX(-100%); }
.ru__marker { position: absolute; z-index: 5; top: -14px; bottom: 34px; left: calc(var(--name) + (100% - var(--name)) * var(--a) / 150000); width: 0; }
.ru__line { position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--highlight); box-shadow: 0 0 0 1px rgba(19,32,47,.4); }
.ru__handle { position: absolute; left: 0; top: -44px; transform: translateX(-50%); min-height: 44px; padding: 6px 12px; border: 0; border-radius: var(--btn-r); background: var(--highlight); color: var(--ink); font: inherit; font-weight: 700; font-size: 1rem; line-height: 1.4; white-space: nowrap; cursor: grab; box-shadow: 0 10px 22px rgba(0,0,0,.35); touch-action: none; }
.ru__handle::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; margin-left: -6px; background: var(--highlight); transform: rotate(45deg); }
.ru__handle:active { cursor: grabbing; }
.ru__handle:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.ru.is-idle .ru__handle { animation: rt-pulse 2.2s infinite; }
.ru__marker[hidden], .ru__read[hidden] { display: none; }
.ru { margin-top: 50px; }
.ru__read { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: clamp(18px, 2.4vw, 30px); border-top: 1px solid rgba(255,255,255,.3); }
.ru__read p { margin: 0; display: grid; gap: 2px; padding: 16px 16px 0 0; }
.ru__read p + p { padding-left: 20px; border-left: 1px solid rgba(255,255,255,.16); }
.ru__read span { font-size: .95rem; font-weight: 600; color: var(--on-dark-soft); }
.ru__read b { font-weight: 600; font-size: clamp(1.8rem, 2.6vw, 2.5rem); line-height: 1.05; letter-spacing: -.03em; color: #fff; }
.ru__read p:first-child b { color: var(--highlight); }
.ru__read small { font-size: .9rem; color: var(--on-dark-soft); }
.ruler__foot { margin: clamp(22px, 3vw, 36px) 0 0; color: var(--on-dark-soft); max-width: 120ch; }
.ruler__foot a { color: #fff; font-weight: 700; }
@media (max-width: 900px) {
  .ru { --name: 0px; }
  .ru__lane { grid-template-columns: minmax(0, 1fr); }
  .ru__name { margin-bottom: 6px; font-size: .95rem; }
  .ru__lane + .ru__lane { margin-top: 14px; }
  .ru__read { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ru__read p:nth-child(3) { padding-left: 0; border-left: 0; }
}
@media (max-width: 560px) {
  .ru__band small { display: none; }
  .ru__band { padding: 0 4px; }
  .ru__band b { font-size: .9rem; }
  .ru__taper small { display: none; }
  .ru__scale i span { font-size: .8rem; }
  .ru__scale i:nth-child(10n+6) span { display: none; }
  .ru__read b { font-size: 1.6rem; }
  .ru__read p + p { padding-left: 12px; }
}

/* ---------- 3. Every rate, by year ---------- */
.rtab { overflow: clip; }
.rtab__ruling { position: absolute; inset: 0; pointer-events: none; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, rgba(117,21,35,.06) 31px, rgba(117,21,35,.06) 32px); animation: rt-drift-32 22s linear infinite; }
.rtab .wrap { position: relative; }
.rtab__head { display: grid; gap: 16px; margin-bottom: clamp(26px, 3vw, 42px); }
.rtab__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 30px; }
.rtab__span { margin: 0; font-weight: 600; font-size: 1.1rem; color: var(--ink-soft); }
.rtab__only { position: relative; display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 16px 6px 10px; background: #fff; border: 1px solid var(--rule); font-weight: 700; cursor: pointer; user-select: none; }
.rtab__only[hidden] { display: none; }
.rtab__only input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rtab__only b { color: var(--crimson); }
.rtab__sw { position: relative; flex: none; width: 46px; height: 26px; border-radius: 13px; background: #E8D9DD; transition: background .3s; }
.rtab__sw::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .4s var(--ease); }
.rtab__only input:checked + .rtab__sw { background: var(--crimson); }
.rtab__only input:checked + .rtab__sw::after { transform: translateX(20px); }
.rtab__only:has(input:focus-visible) { outline: 3px solid var(--highlight); outline-offset: 2px; }
.rtab__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 1.8vw, 26px); align-items: start; }
.rcard { position: relative; background: #fff; border-top: 4px solid var(--claret); box-shadow: 0 20px 40px rgba(34,9,15,.08); }
.rcard::before { content: ''; position: absolute; left: 0; top: -4px; height: 4px; width: 34%; background: linear-gradient(90deg, rgba(242,214,75,0), var(--highlight), rgba(242,214,75,0)); transform: translateX(-100%); pointer-events: none; }
.motion .rcard::before { animation: rt-run 6s cubic-bezier(.5,0,.4,1) infinite; }
.motion .rcard:nth-child(3n+2)::before { animation-delay: 2s; }
.motion .rcard:nth-child(3n)::before { animation-delay: 4s; }
.rcard { overflow: clip; overflow-clip-margin: 4px; }
@keyframes rt-run { 0% { transform: translateX(-100%); } 40%, 100% { transform: translateX(300%); } }
.rcard[hidden] { display: none; }
.rcard__head { padding: 20px 22px 12px; border-bottom: 2px solid var(--ink); }
.rcard__head h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.3rem, 1.6vw, 1.55rem); line-height: 1.15; }
.rcard__head p { margin: 6px 0 0; font-size: .95rem; line-height: 1.4; color: var(--ink-soft); }
.rcard__t { width: 100%; border-collapse: collapse; }
.rrow { position: relative; }
.rrow[hidden] { display: none; }
.rrow th, .rrow td { padding: 11px 22px; border-bottom: 1px dashed #E2D3D7; vertical-align: top; }
.rrow:last-child th, .rrow:last-child td { border-bottom: 0; }
.rrow th { padding-right: 8px; text-align: left; font-weight: 600; font-size: .98rem; line-height: 1.35; }
.rrow th small { display: block; margin-top: 2px; font-weight: 400; font-size: .9rem; color: var(--ink-soft); }
.rrow td { padding-left: 8px; text-align: right; font-weight: 700; font-size: 1.02rem; line-height: 1.35; color: var(--claret); white-space: nowrap; }
.rrow td span { display: inline-block; }
.rrow__was { display: block; margin-top: 2px; font-weight: 600; font-size: .875rem; color: var(--ink-soft); }
.rrow.is-changed th { box-shadow: inset 4px 0 0 var(--highlight); }
.rrow.is-changed td span { background: linear-gradient(100deg, rgba(242,214,75,0), rgba(242,214,75,.9) 3%, rgba(242,214,75,.85) 97%, rgba(242,214,75,0)) no-repeat 0 88% / var(--hl, 100%) 55%; }
.rtab__foot { margin: clamp(24px, 3vw, 40px) 0 0; color: var(--ink-soft); max-width: 120ch; }
@media (max-width: 1100px) { .rtab__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .rtab__grid { grid-template-columns: minmax(0, 1fr); }
  .rrow th, .rrow td { padding-inline: 16px; }
  .rrow td { white-space: normal; max-width: 9.5em; }
  .rcard__head { padding-inline: 16px; }
}

/* ---------- 4. Call to action ---------- */
.rt-cta { position: relative; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); min-height: min(80vh, 720px); background: var(--claret); color: #fff; overflow: clip; }
.rt-cta__bg { position: relative; overflow: hidden; }
.rt-cta__bg img { position: absolute; left: 0; top: -3%; width: 100%; height: 106%; object-fit: cover; object-position: 50% 40%; }
.motion .rt-cta__bg { animation: rt-breathe 16s ease-in-out infinite alternate; }
.rt-cta__bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(117,21,35,0) 65%, rgba(117,21,35,.6)); }
.rt-cta__body { position: relative; display: grid; align-content: center; padding: clamp(56px, 8vh, 96px) max(var(--gutter), calc((100vw - 1320px) / 2)) clamp(56px, 8vh, 96px) clamp(36px, 5vw, 88px); background: repeating-linear-gradient(to bottom, transparent 0, transparent 35px, rgba(255,255,255,.05) 35px, rgba(255,255,255,.05) 36px); animation: rt-drift-36 22s linear infinite; }
.rt-cta__body h2 { color: #fff; margin-bottom: 18px; }
.rt-cta__body > p { font-size: clamp(1.08rem, 1.25vw, 1.2rem); color: #F6DDE3; margin-bottom: 26px; max-width: 120ch; }
.rt-next { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; margin-top: clamp(28px, 4vh, 44px); border-top: 1px solid rgba(255,255,255,.35); }
.rt-next a { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 58px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.22); color: #fff; font-weight: 700; font-size: 1.08rem; text-decoration: none; background: linear-gradient(90deg, rgba(255,255,255,.1), rgba(255,255,255,.1)) no-repeat 0 0 / 0 100%; transition: background-size .45s var(--ease), padding .45s var(--ease); }
.rt-next a:hover, .rt-next a:focus-visible { background-size: 100% 100%; padding-inline: 12px; }
.rt-next svg { width: 20px; flex: none; color: var(--highlight); transition: transform .35s var(--ease); }
.rt-next a:hover svg { transform: translateX(5px); }
@media (max-width: 900px) {
  .rt-cta { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .rt-cta__bg { height: min(56vh, 440px); }
  .rt-cta__bg::after { background: linear-gradient(180deg, rgba(117,21,35,0) 65%, rgba(117,21,35,.6)); }
  .rt-cta__body { padding: 48px var(--gutter) 56px; }
}
@media (max-width: 560px) { .rt-next { grid-template-columns: minmax(0, 1fr); } }
.rtab__oval { position: absolute; right: -18vw; top: 4%; width: min(1100px, 80vw); overflow: visible; pointer-events: none; }
.rtab__oval ellipse { fill: none; stroke: rgba(163,24,62,.14); stroke-width: 1.4; }
.rtab__oval .dash { stroke: rgba(163,24,62,.28); stroke-dasharray: 3 12; animation: dash-turn 40s linear infinite; }
@media (max-width: 560px) { .rt-open__ph { display: none; } .heads { margin-top: 24px; } }
