/* Shared foundation: reset, chameleon tokens, carousel, calculator. Each direction adds its own sheet. */
@property --cham-h { syntax: "<number>"; inherits: true; initial-value: 174; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, video, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p, figure, blockquote, ul, ol, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }

:root {
  --cham-h: 174;
  --cham: hsl(var(--cham-h) 80% 70%);
  --cham-deep: hsl(var(--cham-h) 40% calc(10% + var(--pulse, 0) * 7%));
  --margin: clamp(16px, 3vw, 40px);
  --cham-ink: #0b0a10;
  --turq: #2ec4b6; --blue: #3b5bdb; --violet: #7b5bd6; --pink: #e46aa6; --orange: #f79a5b; --sun: #f6c96b;
  --margin: clamp(16px, 3vw, 40px);
  transition: --cham-h 1.4s cubic-bezier(.2,.7,.2,1);
}
.skip { position: absolute; inset-inline-start: 8px; top: -60px; z-index: 999; padding: 12px 18px; background: #fff; color: #000; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--cham); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* WhatsApp floating action, always in reach */
.wa-float {
  position: fixed; inset-inline-start: 16px; bottom: 16px; z-index: 60; width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center; background: #25d366; color: #fff;
  transition: transform .2s;
}
.wa-float:hover { transform: scale(1.06); }
.wa-float svg { width: 32px; height: 32px; fill: currentColor; }

/* ---------- carousel ---------- */
.cc { --card-w: clamp(210px, 21vw, 300px); position: relative; user-select: none; }
.cc-stage {
  position: relative; height: calc(var(--card-w) * 16 / 9 + 40px); perspective: 1400px; perspective-origin: 50% 45%;
  transform-style: preserve-3d; touch-action: pan-y; cursor: grab; outline-offset: 8px;
}
.cc-stage:active { cursor: grabbing; }
.cc-card {
  position: absolute; top: 20px; left: 50%; width: var(--card-w); aspect-ratio: 9 / 16; margin-left: calc(var(--card-w) / -2);
  border-radius: 0; overflow: hidden; background: #111; will-change: transform; backface-visibility: hidden;
}
.cc-card video, .cc-card img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.cc-card::after { content: ""; position: absolute; inset: 0; background: #000; opacity: var(--dim, 0); transition: opacity .3s; pointer-events: none; }
.cc-card.is-active { outline: calc(3px + var(--pulse, 0) * 4px) solid var(--cham); outline-offset: calc(4px + var(--pulse, 0) * 10px); }
.cc-ui { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.cc-btn {
  width: 52px; height: 52px; border-radius: 0; border: 0; background: var(--cc-btn-bg, rgb(255 255 255 / .1)); color: inherit;
  display: grid; place-items: center; cursor: pointer; transition: background .2s, color .2s, transform .15s;
}
.cc-btn:hover { background: var(--cham); color: var(--cham-ink); }
.cc-btn:active { transform: scale(.94); }
.cc-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cc-btn .spk { fill: currentColor; stroke: none; }
.cc-sound .on { display: none; } .cc-sound[aria-pressed="true"] .on { display: block; } .cc-sound[aria-pressed="true"] .off { display: none; }
.cc-cap { min-width: 14ch; text-align: center; font-size: 1.0625rem; line-height: 1.35; }
.cc-cap strong { font-weight: 700; }
.cc-count { display: block; font-size: .875rem; opacity: .75; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .cc { --card-w: 60vw; } .cc-ui { gap: 10px; } }

/* ---------- savings calculator ---------- */
.sc { display: grid; gap: 28px; }
.sc-group legend { font-weight: 700; font-size: 1.125rem; margin-bottom: 12px; }
.sc-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sc-seg--n { grid-template-columns: repeat(4, 1fr); }
.sc-seg button {
  min-height: 56px; padding: 14px 16px; border: 0; border-radius: 0; cursor: pointer; text-align: start;
  background: var(--sc-off, rgb(0 0 0 / .18)); color: inherit; transition: background .2s, color .2s, transform .15s;
}
.sc-seg--n button { text-align: center; font-size: 1.375rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sc-seg button b { display: block; font-size: 1.125rem; }
.sc-seg button small { display: block; font-size: .875rem; line-height: 1.35; margin-top: 4px; opacity: .85; }
.sc-seg button[aria-checked="true"] { background: var(--sc-on, #0b0a10); color: var(--sc-on-ink, #fff); }
.sc-seg button:active { transform: scale(.98); }
.sc-out { display: grid; gap: 16px; margin-top: 8px; }
.sc-save { font-size: clamp(2.5rem, 1.4rem + 4vw, 4.75rem); font-weight: 800; line-height: .95; letter-spacing: -0.03em; }
.sc-save strong { font-variant-numeric: tabular-nums; }
.sc-keep { font-size: clamp(1.125rem, 1rem + .6vw, 1.5rem); }
.sc-keep [data-keep] { font-weight: 800; font-size: 1.35em; unicode-bidi: isolate; white-space: nowrap; }
.sc-vs { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 8px; }
.sc-vs p { display: grid; gap: 4px; justify-items: start; }
.sc-vs span { font-size: 1rem; font-weight: 500; }
.sc-old s { font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem); font-weight: 500; unicode-bidi: isolate; white-space: nowrap; }
.sc-new b { font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.75rem); font-weight: 800; line-height: 1; white-space: nowrap; }
.sc-bars { display: grid; gap: 6px; }
.sc-bar { height: 14px; background: var(--sc-track, rgb(0 0 0 / .12)); }
.sc-bar i { display: block; height: 100%; transform-origin: right center; background: var(--sc-old, currentColor); }
.sc-bar--new i { background: var(--sc-new, #0b0a10); }
.sc-note { font-size: .9375rem; }
@media (max-width: 640px) {
  .sc-vs { grid-template-columns: 1fr; }
  .cham-corner { width: 54px; height: 54px; }
  .wa-float { width: 54px; height: 54px; }
  .sc-seg { grid-template-columns: 1fr; }
  .sc-seg--n { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) { :root { transition: none; } }

/* ---------- moving between pages ---------- */
@view-transition { navigation: auto; }
/* RTL book: going forward, the new page comes in from the left and the old one drifts right */
::view-transition-old(root) { animation: vt-old .6s cubic-bezier(.7,0,.2,1) both; }
::view-transition-new(root) { animation: vt-new .6s cubic-bezier(.7,0,.2,1) both; }
html[data-dir="back"]::view-transition-old(root) { animation-name: vt-old-back; }
html[data-dir="back"]::view-transition-new(root) { animation-name: vt-new-back; }
@keyframes vt-old { to { transform: translateX(28%); opacity: .2; } }
@keyframes vt-new { from { transform: translateX(-100%); } }
@keyframes vt-old-back { to { transform: translateX(-28%); opacity: .2; } }
@keyframes vt-new-back { from { transform: translateX(100%); } }
::view-transition-group(cham) { animation-duration: .6s; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* the chameleon in the corner: its colours follow the page */
.cham-corner {
  position: fixed; inset-inline-end: 16px; bottom: 16px; z-index: 60; width: 72px; height: 72px; view-transition-name: cham;
  display: grid; place-items: center; border-radius: 0;
}
.cham-body { position: relative; display: block; width: 100%; transform-origin: 50% 60%; animation: cham-breathe 5s ease-in-out infinite; }
.cham-corner img { width: 100%; height: auto; filter: hue-rotate(calc((var(--cham-h) - 174) * 1deg)); scale: calc(1 + var(--pulse, 0) * .14); }
.cham-corner:hover .cham-body { animation-duration: 1.2s; }
.cham-eye { position: absolute; left: 82.5%; top: 24%; width: 12%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.cham-eye i { width: 62%; aspect-ratio: 1; border-radius: 50%; background: #0d2a33; transition: transform .12s linear; }
.cham-tongue { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 70; pointer-events: none; display: none; overflow: visible; }
.cham-tongue line { stroke: #e57ab0; stroke-width: 7; stroke-linecap: round; }
.cham-tongue circle { fill: #e57ab0; }
@keyframes cham-breathe { 0%, 100% { transform: rotate(-4deg) scale(1); } 50% { transform: rotate(3deg) scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .cham-body { animation: none; } }

/* page dots: the colour sequence of the site */
.page-dots { display: flex; justify-content: center; gap: 10px; padding: 40px 16px 24px; background: var(--ground); }
.page-dots a { width: 14px; height: 14px; border-radius: 0; background: hsl(var(--dot-h) 55% 62%); opacity: .55; transition: transform .2s, opacity .2s; }
.page-dots a:hover { opacity: 1; transform: scale(1.3); }
.page-dots a[aria-current="page"] { opacity: 1; width: 40px; border-radius: 0; }

/* next page: a quiet link bar, tinted with the next page's colour */
.next-page {
  display: flex; align-items: center; justify-content: center; gap: 12px; padding: 22px var(--margin); text-decoration: none;
  background: var(--ground-2); color: var(--paper); font-size: 1.125rem;
}
.next-page span { color: var(--soft); }
.next-page b { font-weight: 700; color: hsl(var(--next-h) 60% 74%); }
.next-page svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s; }
.next-page:hover svg { transform: translateX(-6px); }

/* GradientText (React Bits port): animated gradient fill for headlines on dark grounds. Requested by the client. taste-skill-ignore */
.gt {
  background-image: var(--gt-gradient, linear-gradient(90deg, var(--paper), var(--paper)));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  padding-bottom: .04em;
}
@media (forced-colors: active) { .gt { -webkit-text-fill-color: CanvasText; background: none; } }

/* guidelines pass */
html { color-scheme: dark; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
button, a, summary, [role="radio"] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.a-drawer { overscroll-behavior: contain; }

/* reels viewer */
.reels { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; font-family: inherit; }
html.reels-open, html.reels-open body { overflow: hidden; }
.reels-bar { position: absolute; inset-inline: 0; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  background: linear-gradient(#000a, #0000); } /* scrim over video. taste-skill-ignore */
.reels-brand { display: flex; align-items: center; gap: 8px; margin-inline-end: auto; font-size: 1.125rem; }
.reels-bar button { width: 48px; height: 48px; display: grid; place-items: center; background: none; border: 0; color: #fff; cursor: pointer; }
.reels svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.reels .spk { fill: currentColor; stroke: none; }
.reels-sound .on { display: none; } .reels-sound[aria-pressed="true"] .on { display: block; } .reels-sound[aria-pressed="true"] .off { display: none; }
.reels-list { height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; }
.reels-list::-webkit-scrollbar { display: none; }
.reel { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; display: grid; place-items: center; }
.reel video { height: 100%; width: min(100%, 100dvh * 9 / 16); object-fit: cover; }
.reel { height: 100dvh; }
.reel-side { position: absolute; inset-inline-start: max(12px, calc(50% - 28.1vh + 12px)); bottom: 120px; display: grid; gap: 22px; z-index: 2; }
.reel-side button, .reel-side a { display: grid; justify-items: center; gap: 4px; background: none; border: 0; color: #fff; text-decoration: none; cursor: pointer; font-size: .8125rem; font-weight: 500; text-shadow: 0 1px 3px #000; }
.reel-side svg { width: 34px; height: 34px; filter: drop-shadow(0 1px 3px #000); }
.reel-like[aria-pressed="true"] svg { fill: #ff4d6d; stroke: #ff4d6d; }
.reel-meta { position: absolute; bottom: 0; inset-inline: 0; padding: 60px 16px 28px; z-index: 1; background: linear-gradient(#0000, #000c); } /* scrim. taste-skill-ignore */
.reel-meta > * { max-width: calc(100vh * 9 / 16); margin-inline: auto; }
.reel-name { display: flex; align-items: center; gap: 10px; font-size: 1.0625rem; }
.reel-name img { width: 32px; height: 32px; background: #fff; border-radius: 50%; }
.reel-cap { margin-top: 6px; font-size: .9375rem; opacity: .9; }

@media (max-width: 640px) { .cham-corner { width: 54px; height: 54px; } .wa-float { width: 54px; height: 54px; } }
