/* The page is one graft. The pane with the name is the scion, the pane with the form is the field, and they meet on
   the slanted cut. Signing up instead of in sets the scion on the other side: it crosses the page along the cut,
   passing over the form, which comes out changed. */
@property --lo { syntax: "<percentage>"; inherits: true; initial-value: -40%; }
@property --hi { syntax: "<percentage>"; inherits: true; initial-value: 54%; }
@property --at { syntax: "<percentage>"; inherits: true; initial-value: 27%; }
@property --form-at { syntax: "<percentage>"; inherits: true; initial-value: 77%; }
@property --open { syntax: "<percentage>"; inherits: true; initial-value: 0%; }

body { overflow-x: hidden; }

/* --lo and --hi are where the two edges of the scion's pane cross the middle of the page's height; the edges lean
   by the cut, which over half the height comes to 16.246% of it */
.stage {
  --lo: -40%; --hi: 54%; --at: 27%; --form-at: 77%;
  position: relative; height: max(100vh, 640px); height: max(100dvh, 640px); overflow: hidden; container-type: size; opacity: 0;
  --cross: 1.05s cubic-bezier(.65,0,.35,1);
  transition: --lo var(--cross), --hi var(--cross), --at var(--cross), --form-at var(--cross), opacity .5s var(--ease);
}
.mode-register .stage { --lo: 46%; --hi: 140%; --at: 73%; --form-at: 23%; }
.ready .stage { opacity: 1; }
.still .stage { transition: none; }

.art {
  position: absolute; inset: 0; z-index: 2;
  clip-path: polygon(calc(var(--lo) + 16.246cqh) 0, calc(var(--hi) + 16.246cqh) 0, calc(var(--hi) - 16.246cqh) 100%, calc(var(--lo) - 16.246cqh) 100%);
  background:
    radial-gradient(620px 500px at calc(var(--at) - 13%) 38%, rgba(229,138,107,.14), transparent 70%),
    radial-gradient(720px 540px at calc(var(--at) + 15%) 66%, rgba(168,213,186,.12), transparent 70%),
    repeating-radial-gradient(circle at calc(var(--at) - 34%) 124%, transparent 0 41px, rgba(238,240,234,.024) 41px 42px),
    #090c0b;
}
.art .wm { position: absolute; left: var(--at); top: 50%; translate: -50% -50%; font-size: clamp(44px, 5.4vw, 88px); }

.seam {
  position: absolute; z-index: 3; top: 0; bottom: 0; width: 1px; margin-left: -.5px; pointer-events: none;
  background: var(--seam); box-shadow: 0 0 60px rgba(227,189,114,.2); transform: skewX(calc(var(--cut) * -1));
}
.seam.hi { left: var(--hi); }
.seam.lo { left: var(--lo); }
.seam.flat { display: none; }
/* light on the seam where the pointer is */
.seam::after {
  content: ""; position: absolute; left: -1px; width: 3px; top: calc(var(--py, -400px) - 150px); height: 300px;
  background: linear-gradient(transparent, rgba(255,236,190,.95), transparent); filter: blur(.6px);
}
/* every keystroke sends sap up the seam */
.sap { position: absolute; left: -1px; bottom: -90px; width: 3px; height: 90px; background: linear-gradient(transparent, #ffe9b8, transparent); animation: sap .85s linear forwards; }
@keyframes sap { to { transform: translateY(calc(-100cqh - 180px)); } }

.ready .art { animation: dock 1.3s var(--ease) both; }
.ready .seam { animation: dock-seam 1.3s var(--ease) both; }
/* the entrance stays in the list, or it would play again each time the flash is taken away */
.took .seam { animation: dock-seam 1.3s var(--ease) both, take .95s var(--ease); }
/* both arrive along the cut: 18deg off the vertical */
@keyframes dock { from { opacity: 0; transform: translate(37px, -114px); } to { opacity: 1; transform: none; } }
@keyframes dock-seam { from { opacity: 0; transform: translate(37px, -114px) skewX(calc(var(--cut) * -1)); } to { opacity: 1; transform: skewX(calc(var(--cut) * -1)); } }
@keyframes take { 0% { box-shadow: 0 0 0 rgba(227,189,114,0); } 35% { box-shadow: 0 0 130px 7px rgba(227,189,114,.6); background: #fff1cf; } 100% { box-shadow: 0 0 60px rgba(227,189,114,.2); } }

.pane { position: absolute; inset: 0; z-index: 1; background: radial-gradient(540px 440px at var(--form-at) 46%, rgba(168,213,186,.055), transparent 70%); }
.card { position: absolute; left: var(--form-at); top: 50%; translate: -50% -50%; width: min(340px, calc(100vw - 56px)); transition: opacity .2s var(--ease), transform .2s var(--ease); }
.ready .card { animation: in 1s var(--ease) .25s backwards; }
.card.out { opacity: 0; transform: translate(9px, -28px); }
@keyframes in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.back { position: absolute; right: 0; top: -64px; font-size: 13px; color: var(--ink-faint); letter-spacing: .1em; transition: color .2s var(--ease); }
.back:hover { color: var(--ink); }
h1 { font: 400 30px/1.3 var(--serif); letter-spacing: .3em; margin: 0 0 22px; }
form { display: grid; gap: 12px; }

/* a field is a bare line; taking it up runs the three colours along it, scion to seam to field */
.gf { position: relative; display: block; padding-top: 18px; }
.gf input { display: block; width: 100%; height: 42px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; outline: none; font-size: 16px; transition: color .4s var(--ease); }
.gf > span { position: absolute; left: 2px; top: 27px; font-size: 14px; letter-spacing: .1em; color: var(--ink-faint); pointer-events: none; transform-origin: left; transition: transform .28s var(--ease), color .28s var(--ease); }
.gf input:focus + span, .gf input:not(:placeholder-shown) + span, .gf input:-webkit-autofill + span { transform: translateY(-25px) scale(.82); }
.gf input:focus + span { color: var(--ink-dim); }
.gf::after { content: ""; position: absolute; left: 0; right: 0; top: 59px; height: 1px; background: linear-gradient(90deg, var(--scion), var(--seam) 55%, var(--jade)); transform: scaleX(0); transform-origin: left; transition: transform .55s var(--ease); }
.gf:focus-within::after { transform: scaleX(1); }
.gf input:-webkit-autofill { -webkit-text-fill-color: var(--ink); box-shadow: 0 0 0 40px var(--bg) inset; caret-color: var(--ink); }

/* the password is shown by light: the bud opens, and a bright cut crosses the line */
#secret input { padding-right: 38px; }
.bud { position: absolute; right: -6px; top: 22px; width: 36px; height: 36px; padding: 0; border: 0; background: none; color: var(--ink-faint); cursor: pointer; display: grid; place-items: center; transition: color .3s var(--ease), filter .3s var(--ease); }
.bud:hover { color: var(--ink-dim); }
.bud svg { width: 21px; height: 21px; overflow: visible; transform: rotate(calc(var(--cut) * -1)); }
.bud .lid { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; transform-origin: 12px 12px; transform: scaleY(.3); transition: transform .38s var(--ease); }
.bud .pupil { fill: currentColor; transform-origin: 12px 12px; transform: scale(0); transition: transform .38s var(--ease); }
.lit .bud { color: var(--seam); filter: drop-shadow(0 0 7px rgba(227,189,114,.75)); }
.lit .bud .lid, .lit .bud .pupil { transform: none; }
.lit input { color: #f8ebcb; }
.lit::before { content: ""; position: absolute; left: 0; right: 30px; top: 20px; height: 39px; background: linear-gradient(270deg, transparent, rgba(227,189,114,.13) 16%, transparent 88%); pointer-events: none; }
.sweep { position: absolute; top: 16px; height: 46px; right: 30px; width: 2px; background: #ffe9b8; box-shadow: 0 0 16px 3px rgba(227,189,114,.7); transform: skewX(calc(var(--cut) * -1)); opacity: 0; pointer-events: none; }
.sweep-in .sweep { animation: sweep-in .46s var(--ease); }
.sweep-out .sweep { animation: sweep-out .46s var(--ease); }
@keyframes sweep-in { 0% { opacity: 0; right: 30px; } 15%, 85% { opacity: 1; } 100% { opacity: 0; right: calc(100% - 2px); } }
@keyframes sweep-out { 0% { opacity: 0; right: calc(100% - 2px); } 15%, 85% { opacity: 1; } 100% { opacity: 0; right: 30px; } }

/* how strong a new password is: a shoot that grows from scion to field, and leafs when it has taken */
.sprout { display: flex; align-items: center; gap: 5px; height: 10px; margin-top: 7px; padding-right: 12px; }
.sprout b { flex: 1; height: 2px; background: var(--line); transform: skewX(calc(var(--cut) * -1)); transition: background .4s var(--ease); }
.sprout b:nth-child(1) { --k: var(--scion); }
.sprout b:nth-child(2) { --k: #e4a36e; }
.sprout b:nth-child(3) { --k: var(--seam); }
.sprout b:nth-child(4) { --k: var(--jade); }
.sprout[data-s="1"] b:nth-child(-n+1), .sprout[data-s="2"] b:nth-child(-n+2), .sprout[data-s="3"] b:nth-child(-n+3), .sprout[data-s="4"] b { background: var(--k); }
.sprout::after { content: ""; width: 9px; height: 9px; margin: -7px -12px 0 -3px; border-radius: 0 100%; background: var(--jade); transform: scale(0); transform-origin: 0 100%; transition: transform .5s cubic-bezier(.34,1.56,.64,1); }
.sprout[data-s="4"]::after { transform: scale(1); }

/* the button is two halves on the cut: they part under the pointer, work apart while the answer is awaited,
   and close in gold when it has come */
.join { position: relative; display: grid; place-items: center; width: 100%; height: 48px; margin-top: 14px; padding: 0; border: 0; border-radius: 99px; overflow: hidden; isolation: isolate; background: var(--seam); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.join .half { position: absolute; z-index: -1; top: 0; bottom: 0; width: calc(50% + 8px); background: var(--ink); transition: transform .35s var(--ease), background .4s var(--ease); }
.join .scion { left: 0; clip-path: polygon(0 0, 100% 0, calc(100% - 16px) 100%, 0 100%); }
.join .stock { right: 0; clip-path: polygon(16px 0, 100% 0, 100% 100%, 0 100%); }
.join em { font-style: normal; font-weight: 500; color: #0a0c0b; letter-spacing: .3em; text-indent: .3em; }
.join:hover .scion { transform: translateX(-3px); }
.join:hover .stock { transform: translateX(3px); }
.join:active .half { transform: none; }
.join:focus-visible { outline: 1px solid var(--seam); outline-offset: 3px; }
.join.joining { cursor: default; }
.join.joining .scion { animation: part-scion 1.1s var(--ease) infinite; }
.join.joining .stock { animation: part-stock 1.1s var(--ease) infinite; }
.join.joined .half { animation: none; transform: none; background: var(--seam); }
.join.slip .scion { animation: slip .5s var(--ease); }
@keyframes part-scion { 0%, 100% { transform: translateX(-2px); } 50% { transform: translateX(-10px); } }
@keyframes part-stock { 0%, 100% { transform: translateX(2px); } 50% { transform: translateX(10px); } }
@keyframes slip { 0% { transform: none; } 30% { transform: translate(-6px, 5px); } 62% { transform: translate(2px, -2px); } 100% { transform: none; } }

.msg { min-height: 20px; font-size: 13px; color: var(--warn); }
.row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.row button { background: none; border: 0; color: var(--ink-dim); cursor: pointer; padding: 0; border-bottom: 1px solid var(--line); }
.row button:hover { color: var(--ink); border-color: var(--ink-dim); }

/* signed in: the cut opens from the middle of the page and takes it */
.take {
  position: fixed; inset: 0; z-index: 10; pointer-events: none; background: var(--bg); --open: 0%;
  clip-path: polygon(calc(50% + 16.246vh - var(--open)) 0, calc(50% + 16.246vh + var(--open)) 0, calc(50% - 16.246vh + var(--open)) 100%, calc(50% - 16.246vh - var(--open)) 100%);
  transition: --open .62s cubic-bezier(.7,0,.3,1);
}
.take i { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--seam); box-shadow: 0 0 44px 5px rgba(227,189,114,.5); transform: skewX(calc(var(--cut) * -1)); }
.take i:first-child { left: calc(50% - var(--open) + 1px); }
.take i:last-child { left: calc(50% + var(--open) - 3px); }
.taken .take { --open: 115%; }

@media (max-width: 1199px) {
  .stage { --hi: 46%; --at: 23%; --form-at: 74%; }
  .mode-register .stage { --lo: 54%; --at: 77%; --form-at: 26%; }
}

/* narrow: the scion is a band across the top, cut at the same slant, and the form stays where it is */
@media (max-width: 900px) {
  .stage, .mode-register .stage { --at: 50%; --form-at: 50%; height: auto; min-height: 100vh; min-height: 100dvh; container-type: normal; overflow: visible; overflow-x: clip; display: flex; flex-direction: column; }
  .art { position: relative; inset: auto; order: -1; flex: none; height: max(34vh, 230px); clip-path: polygon(0 0, 100% 0, 100% calc(100% - 32.49vw), 0 100%); }
  .art .wm { top: 36%; font-size: clamp(36px, 11vw, 60px); }
  .seam.hi, .seam.lo { display: none; }
  .seam.flat { display: block; left: 0; top: max(34vh, 230px); bottom: auto; width: 105.2vw; height: 1px; margin: 0; transform-origin: 0 0; transform: rotate(calc(var(--cut) * -1)); }
  .seam.flat::after { display: none; }
  .ready .seam.flat { animation: in-seam 1.2s var(--ease) both; }
  .took .seam.flat { animation: in-seam 1.2s var(--ease) both, take .95s var(--ease); }
  .ready .art { animation: in-art 1.2s var(--ease) both; }
  .pane { position: relative; inset: auto; padding: 26px 28px 44px; background: none; }
  .card { position: relative; left: auto; top: auto; translate: none; width: min(340px, 100%); margin: 0 auto; }
  .back { display: none; }
  h1 { font-size: 26px; margin-bottom: 14px; }
}
@keyframes in-art { from { opacity: 0; transform: translateY(-40px); } to { opacity: 1; transform: none; } }
@keyframes in-seam { from { opacity: 0; transform: translateY(-40px) rotate(calc(var(--cut) * -1)); } to { opacity: 1; transform: rotate(calc(var(--cut) * -1)); } }

/* the human check, where the site has one */
.human { min-height: 65px; margin: 6px 0 2px; }
