/* ckpos.my landing page: option 7 "Colour Wash".
   Motion follows Emil Kowalski's rules: only transform and opacity animate,
   strong ease-out curves, non-uniform stagger, hover gated to real pointers,
   press feedback on the button, and a still page for reduced motion. */

:root {
  --blue: #1C2687;
  --pink: #F3064E;
  --font: Inter, Arial, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }

html { background: #fff; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  color: #fff;
  font: 400 14px/20px var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* ---------- Colour wash ----------
   Each blob is three nested layers so every motion is a plain transform:
   .p follows the mouse (set from main.js), .d drifts, .b changes shape.
   The soft edge is drawn by the gradient itself, not filter: blur(),
   so nothing repaints while the blobs move. */

.wash { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.p { position: absolute; aspect-ratio: 1; }
.d, .b { width: 100%; height: 100%; }
.d { animation: drift 16s ease-in-out infinite alternate; }
.b {
  --c: 28 38 135;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    rgb(var(--c) / .92) 0%,
    rgb(var(--c) / .92) 38%,
    rgb(var(--c) / .84) 50%,
    rgb(var(--c) / .66) 62%,
    rgb(var(--c) / .42) 74%,
    rgb(var(--c) / .20) 85%,
    rgb(var(--c) / .06) 94%,
    rgb(var(--c) / 0) 100%);
  animation: morph 11s ease-in-out infinite alternate;
}

/* Wide screens: white page with the wash, as approved in the mock-up. */
/* Blue sits behind the headline and pink behind Login, so white text never lands on white. */
.p1 { width: 84vmax; left: -21vmax; top: -11vmax; }
.p3 { width: 48vmax; right: 6vmax; top: -20vmax; }
.p2 { width: 62vmax; right: -18vmax; bottom: -30vmax; }
.p4 { width: 52vmax; left: -2vmax; bottom: -26vmax; }

.p1 .b { --c: 28 38 135; }
.p3 .b { --c: 106 123 255; }
.p2 .b { --c: 243 6 78; }
.p4 .b { --c: 255 122 158; }

.p3 .d { animation-delay: -9s; animation-duration: 19s; }
.p2 .d { animation-delay: -5s; animation-duration: 17s; }
.p4 .d { animation-delay: -2s; animation-duration: 14s; }
.p3 .b { animation-delay: -4s; animation-duration: 13s; }
.p2 .b { animation-delay: -7s; animation-duration: 12s; }
.p4 .b { animation-delay: -1s; animation-duration: 10s; }

@keyframes drift {
  to { transform: translate(6vmax, 4vmax) scale(1.15) rotate(25deg); }
}
@keyframes morph {
  0%   { transform: rotate(0deg) scale(1, 1); }
  50%  { transform: rotate(18deg) scale(1.14, .88); }
  100% { transform: rotate(-14deg) scale(.9, 1.1); }
}

/* Tall screens (phones, tablets upright): a coloured base so no corner
   is ever white, and blobs placed by height so they always cover it. */
@media (max-aspect-ratio: 1/1) {
  html { background: linear-gradient(165deg, #1C2687 0%, #3A49C9 48%, #F3064E 100%); }
  .p1 { width: 62vmax; left: -30vmax; top: -14vmax; }
  .p3 { width: 42vmax; right: -20vmax; top: 10vmax; }
  .p4 { width: 44vmax; left: -22vmax; bottom: 4vmax; }
  .p2 { width: 60vmax; right: -30vmax; bottom: -24vmax; }
}

/* ---------- Content ---------- */

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(20px + var(--safe-t)) calc(40px + var(--safe-r)) 20px calc(40px + var(--safe-l));
  font-weight: 700;
  font-size: 16px;
  line-height: 20px;
}
.logo { width: 40px; height: 40px; border-radius: 8px; display: block; flex-shrink: 0; }

.copy {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 32px calc(40px + var(--safe-r)) calc(clamp(48px, 10vh, 112px) + var(--safe-b)) calc(40px + var(--safe-l));
}

h1 {
  margin: 0 0 28px;
  max-width: 12ch;
  font: 700 clamp(40px, 7.5vw, 110px)/.98 var(--font);
  letter-spacing: -.03em;
  text-shadow: 0 2px 40px rgb(28 38 135 / .35);
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 28px;
  border-radius: 6px;
  background: #fff;
  color: var(--blue);
  font: 500 14px/20px var(--font);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 200ms var(--ease-out);
}
/* The hover shadow lives on its own layer and only fades, so it never repaints. */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 10px 30px rgb(28 38 135 / .35);
  opacity: 0;
  transition: opacity 200ms var(--ease-out);
  pointer-events: none;
}
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-3px) scale(1.06); }
  .btn:hover::after { opacity: 1; }
}
.btn:active { transform: scale(.97); transition-duration: 100ms; }

/* ---------- Entrance ----------
   Lead: the headline, word by word, with gaps that shrink (90, 80, 70, 60, 50ms)
   so it reads as one wave. Support: Login rises less, overlapping the last word.
   Decoration: the brand only fades. The wash itself does not enter. */

.w {
  display: inline-block;
  transform-origin: 0 100%;
  animation: word 800ms var(--ease-out) both;
}
.w:nth-child(1) { animation-delay: 120ms; }
.w:nth-child(2) { animation-delay: 210ms; }
.w:nth-child(3) { animation-delay: 290ms; }
.w:nth-child(4) { animation-delay: 360ms; }
.w:nth-child(5) { animation-delay: 420ms; }
.w:nth-child(6) { animation-delay: 470ms; }
.cta { animation: up 600ms var(--ease-out) 560ms both; }
.brand { animation: fade 500ms var(--ease-out) both; }

@keyframes word { from { opacity: 0; transform: translateY(.5em) rotate(4deg); } }
@keyframes up   { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Phones ----------
   Headline and Login sit in the thumb zone, well clear of the bottom edge
   and the home indicator. */
@media (max-width: 600px) {
  .brand { padding: calc(16px + var(--safe-t)) calc(24px + var(--safe-r)) 16px calc(24px + var(--safe-l)); }
  .copy { padding: 24px calc(24px + var(--safe-r)) calc(clamp(64px, 15dvh, 140px) + var(--safe-b)) calc(24px + var(--safe-l)); }
  h1 { font-size: clamp(42px, 12.5vw, 64px); margin-bottom: 24px; }
  .btn { height: 48px; padding: 0 36px; font-size: 16px; }
}

/* Short screens (phones on their side): two-line headline, less padding. */
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .brand { padding-top: calc(12px + var(--safe-t)); padding-bottom: 12px; }
  .copy { padding-top: 16px; padding-bottom: calc(24px + var(--safe-b)); }
  h1 { font-size: clamp(32px, 11vh, 52px); max-width: 18ch; margin-bottom: 20px; }
}

/* ---------- Reduced motion ----------
   No movement at all: the wash holds still and everything simply fades in together. */
@media (prefers-reduced-motion: reduce) {
  .d, .b { animation: none; }
  .w, .cta, .brand { animation: fade 300ms ease both; }
  .btn, .btn::after { transition: none; }
  .btn:hover, .btn:active { transform: none; }
}
