/* ==========================================================================
   Pincbone — login.css
   Page styles for login.html. Builds on tokens.css; never redefines tokens.

   State lives on <html>:
     data-role="founder|creator"  single source of truth; CSS reads it,
                                  login.js only flips it
     .js          inline head script ran (gates every pre-entrance hidden state)
     .is-ready    entry curtain cleared, entrance stagger plays
     .role-anim   the visitor switched role at least once; enables swap motion
                  (keeps the first paint still and avoids replaying on load)

   "ON"  = an element whose data-for matches the current role
   "OFF" = an element whose data-for is the other role
   written out as :is(...) pairs below.
   ========================================================================== */

/* ---- page-local values (no matching token exists) ------------------------ */
.page-login {
  color-scheme: light;               /* the form column is a light surface */
  --col-w: 27rem;                    /* measure of the form column */
  --pad-x: clamp(1.25rem, 0.6rem + 3vw, 3rem);
  --dur-toggle: 420ms;               /* bone thumb travel */
  --dur-swap: 450ms;                 /* role word roll in the heading */
  --ink-ring: rgba(13, 10, 11, 0.5); /* 3:1 control outline on bone */
}

/* ---- page grid: mobile first --------------------------------------------- */
.login {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "visual" "main" "foot";
  min-height: 100vh;
  min-height: 100svh;
}

.login__top,
.login__main,
.login__foot {
  width: 100%;
  max-width: calc(var(--col-w) + 2 * var(--pad-x));
  padding-inline: var(--pad-x);
  justify-self: center;
}

/* ---- top row: home mark + wordmark, back link ---------------------------- */
.login__top {
  grid-area: visual;                 /* mobile: sits on top of the ink header */
  align-self: start;
  position: relative;
  z-index: 3;
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 3rem;
  font-family: var(--font-display);
  font-variation-settings: "wdth" 85, "opsz" 36;
  font-weight: 800;
  font-size: 1.3125rem;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--fg);
}
.brand__mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--ink);            /* the mascot only reads on ink */
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform var(--dur-2) var(--ease-snap);
}
.brand__mark img {
  width: 1.75rem;
  height: auto;
  aspect-ratio: 128 / 146;
}

.top-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--muted);
  transition: color var(--dur-1) var(--ease-out);
}
.top-link svg {
  flex: none;
  width: 1rem;
  height: 1rem;
  transition: transform var(--dur-2) var(--ease-snap);
}

@media (hover: hover) {
  .brand:hover .brand__mark { transform: rotate(-8deg) scale(1.05); }
  .top-link:hover { color: var(--fg); }
  .top-link:hover svg { transform: translateX(-3px); }
}

/* ---- main column --------------------------------------------------------- */
.login__main {
  grid-area: main;
  padding-block: 1.75rem 0.5rem;
}
.login__eyebrow { margin-bottom: 0.75rem; }
.login__title { margin-bottom: clamp(1.25rem, 2.6vh, 2rem); }

/* role word in the heading: both words share one grid cell, so the box is
   always as wide as the longer word and the heading never reflows */
.roll {
  display: grid;
  width: max-content;
  max-width: 100%;
  /* clip vertically for the roll, but let italic overhang breathe sideways */
  clip-path: inset(-0.2em -0.4em -0.24em -0.2em);
}
.roll__item {
  grid-area: 1 / 1;
  padding-block: 0.2em 0.24em;      /* room for Fraunces ascenders/descenders */
  margin-block: -0.2em -0.24em;     /* ...without changing the line rhythm */
  visibility: hidden;
  transform: translateY(110%);
  transition: visibility 0s linear var(--dur-swap);
}
:is([data-role="founder"] [data-for="founder"], [data-role="creator"] [data-for="creator"]).roll__item {
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

/* ---- role toggle: the bone switch ---------------------------------------- */
.role {
  --track-h: 3.5rem;                                       /* 56px */
  --track-pad: 0.375rem;
  --bone-h: calc(var(--track-h) - 2 * var(--track-pad));   /* 44px */
  --knob: calc(var(--bone-h) * 0.58);                      /* knob diameter */
  --shaft: calc(var(--bone-h) * 0.5);                      /* shaft thickness */
  --bone-inset: 0.625rem;  /* keeps the knobs inside the pill even at peak overshoot */
  margin: 0 0 clamp(1.25rem, 2.6vh, 2rem);
  padding: 0;
  border: 0;
  min-width: 0;
}
.role__track {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(100%, 21rem);
  padding: var(--track-pad);
  border-radius: var(--radius-pill);
  background: var(--ink);
  transition: outline-color var(--dur-1) var(--ease-out);
}
/* keyboard focus on either radio rings the whole track */
.role__track:has(.role__input:focus-visible) {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
}
@supports not selector(:has(a)) {
  .role__input:focus-visible + .role__opt {
    outline: 2.5px solid var(--pink);
    outline-offset: -3px;
    border-radius: var(--radius-pill);
  }
}

.role__thumb {
  position: absolute;
  z-index: 0;
  top: var(--track-pad);
  left: var(--track-pad);
  width: calc((100% - 2 * var(--track-pad)) / 2);
  height: var(--bone-h);
  pointer-events: none;
  transition: transform var(--dur-toggle) var(--ease-snap);
}
[data-role="creator"] .role__thumb { transform: translateX(100%); }

/* The bone: a shaft running knob-centre to knob-centre (background), plus a
   pair of round knobs at each end (::before / ::after, the lower knob is the
   pseudo's own box-shadow). The two knobs overlap, leaving the V notch that
   makes it read as a dog bone. Pure CSS so it stays crisp at any width. */
.role__bone {
  position: absolute;
  inset: 0 var(--bone-inset);
  background: linear-gradient(var(--bone), var(--bone)) center / calc(100% - var(--knob)) var(--shaft) no-repeat;
}
.role__bone::before,
.role__bone::after {
  content: "";
  position: absolute;
  top: 0;
  width: var(--knob);
  height: var(--knob);
  border-radius: 50%;
  background: var(--bone);
  box-shadow: 0 calc(var(--bone-h) - var(--knob)) 0 var(--bone);
}
.role__bone::before { left: 0; }
.role__bone::after { right: 0; }

.role__opt {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--bone-h);
  font-family: var(--font-display);
  font-variation-settings: "wdth" 88, "opsz" 24;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.005em;
  line-height: 1;
  color: rgba(255, 246, 238, 0.7);   /* inactive: bone at 70% on ink */
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-2) var(--ease-out);
}
[data-role="founder"] .role__opt--founder,
[data-role="creator"] .role__opt--creator {
  color: var(--ink);                 /* active: ink on the bone */
  cursor: default;
}

@media (hover: hover) {
  [data-role="founder"] .role__opt--creator:hover,
  [data-role="creator"] .role__opt--founder:hover { color: var(--bone); }
  /* the bone leans a touch toward the option you are about to pick */
  .js[data-role="founder"] .role__track:has(.role__opt--creator:hover) .role__thumb { transform: translateX(0.375rem); }
  .js[data-role="creator"] .role__track:has(.role__opt--founder:hover) .role__thumb { transform: translateX(calc(100% - 0.375rem)); }
}

/* no JS: data-role stays "founder", so let the thumb follow the real radio */
html:not(.js) .role__track:has(#role-creator:checked) .role__thumb { transform: translateX(100%); }
html:not(.js) .role__track:has(#role-creator:checked) .role__opt--creator { color: var(--ink); }
html:not(.js) .role__track:has(#role-creator:checked) .role__opt--founder { color: rgba(255, 246, 238, 0.7); }

/* ---- fields --------------------------------------------------------------- */
.field + .field { margin-top: 1rem; }

.field__label {
  display: block;
  margin-bottom: 0.4375rem;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
}

.field__control { position: relative; }

.input {
  display: block;
  width: 100%;
  min-height: 3.5rem;
  margin: 0;
  padding: 0.75rem 1.125rem;
  font-size: max(1rem, var(--fs-body));   /* never under 16px: no iOS zoom */
  line-height: 1.3;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-m);
  appearance: none;
  -webkit-appearance: none;
  transition:
    border-color var(--dur-1) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out),
    background-color var(--dur-2) var(--ease-out);
}
.input--pw { padding-right: 5.75rem; }
@media (hover: hover) {
  .input:hover { border-color: rgba(13, 10, 11, 0.3); }
}
.input:focus,
.input:focus-visible {
  outline: none;
  border-color: var(--pink-deep);
  background-color: var(--bone);
  box-shadow: 0 0 0 4px rgba(255, 74, 147, 0.2);
}
.input[aria-invalid="true"] {
  border-color: var(--pink-dark);
  background-color: #fbe9e8;
  background-color: color-mix(in srgb, var(--pink) 6%, var(--bone));
}
.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 4px rgba(143, 15, 69, 0.16);
}
/* keep browser autofill on-palette */
.input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  box-shadow: inset 0 0 0 100px var(--bone-2);
}
.input:-webkit-autofill:focus {
  box-shadow: 0 0 0 4px rgba(255, 74, 147, 0.2), inset 0 0 0 100px var(--bone);
}

/* Show toggle inside the password field. Label stays "Show password" and
   aria-pressed carries the state (APG toggle-button pattern). */
.reveal {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  bottom: 0.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  min-width: 3rem;
  padding-inline: 0.875rem;
  border-radius: calc(var(--radius-m) - 0.25rem);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.reveal::before {                     /* small state dot: hollow off, filled on */
  content: "";
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px currentColor;
  transition: background-color var(--dur-1) var(--ease-out);
}
.reveal[aria-pressed="true"] { background: var(--ink); color: var(--bone); }
.reveal[aria-pressed="true"]::before { background: var(--pink); box-shadow: none; }
.reveal:focus-visible { outline-offset: 1px; }
@media (hover: hover) {
  .reveal:hover { color: var(--fg); background: rgba(13, 10, 11, 0.07); }
  .reveal[aria-pressed="true"]:hover { color: var(--bone); background: var(--ink); }
}
html:not(.js) .reveal { display: none; }
html:not(.js) .input--pw { padding-right: 1.125rem; }

.field__error {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1.35;
  color: var(--pink-dark);           /* 8.5:1 on bone */
}
.field__error:not(:empty) { margin-top: 0.5rem; }
.field__error:not(:empty)::before {
  content: "";
  flex: none;
  width: 1rem;
  height: 1rem;
  margin-top: 0.0625rem;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0Zm0 10.6a1.15 1.15 0 1 0 0 2.3 1.15 1.15 0 0 0 0-2.3ZM8 3.4c-.6 0-1 .45-.97 1.05l.2 4.2a.77.77 0 0 0 1.54 0l.2-4.2C9 3.85 8.6 3.4 8 3.4Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0Zm0 10.6a1.15 1.15 0 1 0 0 2.3 1.15 1.15 0 0 0 0-2.3ZM8 3.4c-.6 0-1 .45-.97 1.05l.2 4.2a.77.77 0 0 0 1.54 0l.2-4.2C9 3.85 8.6 3.4 8 3.4Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---- keep me logged in / forgot ------------------------------------------ */
.form__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 1rem;
  margin-top: 0.375rem;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3rem;
  font-size: 0.9375rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.check__box {
  flex: none;
  display: grid;
  place-content: center;
  width: 1.375rem;
  height: 1.375rem;
  margin: 0;
  border: 1.5px solid var(--ink-ring);
  border-radius: 0.4375rem;
  background: var(--bone);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}
.check__box::before {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  background: var(--bone);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0);
  transition: transform var(--dur-2) var(--ease-snap);
}
.check__box:checked { background: var(--ink); border-color: var(--ink); }
.check__box:checked::before { transform: scale(1); }

.form__forgot {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  font-size: 0.9375rem;
  font-weight: 500;
}

/* shown by login.js, or by :target when JS is off */
.reset-note {
  display: none;
  margin-top: 0.25rem;
  padding: 0.6875rem 0.875rem;
  border-radius: var(--radius-s);
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--accent);
  font-size: var(--fs-small);
  line-height: 1.4;
  color: var(--fg);
}
.reset-note:target,
.reset-note.is-shown { display: block; }

/* ---- submit + alternate path --------------------------------------------- */
.form__submit {
  margin-top: 0.75rem;
  justify-content: space-between;
}
.form__submit .btn__icon svg { width: 1.05rem; height: 1.05rem; }
.form__submit .icon-spin { display: none; }
.form__submit[aria-busy="true"] { cursor: progress; }
.form__submit[aria-busy="true"] .icon-arrow { display: none; }
.form__submit[aria-busy="true"] .icon-spin { display: block; width: 1.25rem; height: 1.25rem; }
.form__submit[aria-busy="true"] .btn__label,
.form__submit[aria-busy="true"]:hover .btn__label { transform: none; clip-path: inset(0); }
.form__submit[aria-busy="true"] .btn__icon,
.form__submit[aria-busy="true"]:hover .btn__icon { transform: none; }
.form__submit[aria-disabled="true"]:active { transform: none; }

.form__alt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.375rem;
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  color: var(--muted);
}
.form__alt-link {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  font-weight: 600;
  color: var(--accent);              /* pink-deep on bone: 4.6:1 */
}

/* ---- form area <-> success share one cell, so nothing jumps ------------- */
.stack { display: grid; }
.stack > * { grid-area: 1 / 1; min-width: 0; }
.stack__form {
  transition:
    opacity var(--dur-1) var(--ease-out),
    transform var(--dur-1) var(--ease-out),
    visibility 0s linear 0s;
}
.stack[data-state="done"] .stack__form {
  visibility: hidden;
  opacity: 0;
  transform: translateY(-0.5rem);
  transition-delay: 0s, 0s, var(--dur-1);
}

.success {
  display: grid;
  align-content: start;
  justify-items: start;
}
.success[hidden] { display: none; }
.success__title { margin-bottom: 1rem; }
.success__title:focus { outline: none; }
.success__role {
  max-width: 24ch;
  font-size: var(--fs-lead);
  font-weight: 500;
  line-height: 1.3;
  text-wrap: pretty;
}
.success__end {
  margin-top: 0.625rem;
  color: var(--muted);
}
.success__home { margin-top: 1.75rem; }

/* ---- small print ----------------------------------------------------------- */
.login__foot {
  grid-area: foot;
  padding-block: 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
}
.login__foot .label { max-width: 46ch; }

/* ==========================================================================
   Visual panel (ink). Mobile: compact header. Desktop: framed poster.
   ========================================================================== */
.visual {
  grid-area: visual;
  position: relative;
  z-index: 0;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: clamp(15rem, 34vh, 20rem);
  height: clamp(15rem, 34svh, 20rem);
  padding: 4.25rem var(--pad-x) 1.25rem;
  border-radius: 0 0 var(--radius-l) var(--radius-l);
  overflow: hidden;
  color-scheme: dark;
}

.visual__copy {
  position: relative;
  z-index: 2;
  display: grid;
  max-width: 52%;
}
.copy {
  grid-area: 1 / 1;
  align-self: end;
  min-width: 0;
  visibility: hidden;
  transition: visibility 0s linear 360ms;   /* stay painted while words leave */
}
:is([data-role="founder"] [data-for="founder"], [data-role="creator"] [data-for="creator"]).copy {
  visibility: visible;
  transition-delay: 0s;
}

.copy__eyebrow { margin-bottom: 0.625rem; }
.copy__headline {
  color: var(--fg);
  font-size: clamp(1.5rem, 1rem + 2.6vw, 2.25rem);
  line-height: 0.92;
}

/* word masks: each word rides inside its own clipped box */
.w {
  display: inline-block;
  padding-block: 0.12em 0.2em;
  margin-block: -0.12em -0.2em;
  clip-path: inset(0 -0.3em);
}
.w > span { display: inline-block; }
:is([data-role="founder"] [data-for="creator"], [data-role="creator"] [data-for="founder"]) .w > span {
  transform: translateY(110%);
}

.chips {
  display: none;                     /* mobile header stays compact */
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.125rem;
  padding: 0.375rem 0.875rem 0.375rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1.2;
  color: var(--fg);
  white-space: nowrap;
}
.chip::before {
  content: "";
  flex: none;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--pink);
}
:is([data-role="founder"] [data-for="creator"], [data-role="creator"] [data-for="founder"]) .chip {
  opacity: 0;
}

/* stage: glow, pink shape, mascot */
.visual__stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.visual__glow {
  position: absolute;
  left: 78%;
  top: 70%;
  width: 120%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 74, 147, 0.34), rgba(255, 74, 147, 0.1) 55%, rgba(255, 74, 147, 0));
  transition: transform var(--dur-4) var(--ease-out);
}
[data-role="creator"] .visual__glow { transform: translate(-6%, 4%) scale(1.1); }

/* The flat pink shape: a circle for founders, a turned blob for creators.
   It lives inside .visual__figure and is placed in units of the dog's own
   box, so at every size only an ear tip and a bone end overlap it. The
   mascot's pink is only 1.6:1 against --pink, so never more than that.
   It is a sibling of .visual__lean: it does not float, hop or lean. */
.visual__shape {
  position: absolute;
  z-index: 0;
  left: 53%;                         /* mobile: a halo between the ears */
  top: 16%;
  width: 50%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--pink);
  transition:
    transform var(--dur-3) var(--ease-snap),
    border-radius var(--dur-3) var(--ease-out);
}
[data-role="creator"] .visual__shape {
  transform: translate(75%, 5%) rotate(24deg) scale(1.08);   /* slides out behind the right ear */
  border-radius: 58% 42% 55% 45% / 44% 56% 44% 56%;
}

.visual__figure {
  --float-y: -6px;
  position: absolute;
  right: -3vw;
  bottom: -0.75rem;
  width: min(47vw, 12.5rem);
  aspect-ratio: 640 / 730;
}
.visual__lean,
.visual__hop,
.visual__float {
  width: 100%;
  height: 100%;
  transform-origin: 50% 100%;
}
.visual__lean { position: relative; z-index: 1; }
.visual__float { will-change: transform; }
.visual__figure picture,
.visual__figure img {
  display: block;
  width: 100%;
  height: 100%;
}
/* a tight ink halo separates the cutout where it crosses the pink shape;
   on the ink panel itself it is invisible */
.visual__figure img {
  object-fit: contain;
  object-position: 50% 100%;
  filter:
    drop-shadow(0 0 0.375rem rgba(13, 10, 11, 0.7))
    drop-shadow(0 0.75rem 1.25rem rgba(0, 0, 0, 0.5));
}

/* ---- mobile only ---------------------------------------------------------- */
@media (max-width: 899.98px) {
  /* the top row sits on the ink header: switch it to ink-theme values */
  .login__top {
    --fg: var(--bone);
    --muted: rgba(255, 246, 238, 0.74);
    --line: rgba(255, 246, 238, 0.16);
    --accent: var(--pink);
    color: var(--fg);
  }
  .brand__mark { background: var(--ink-2); }
}

/* short phones: give the form the room */
@media (max-width: 899.98px) and (max-height: 700px) {
  .visual { height: 14rem; }
}

/* ==========================================================================
   Desktop: two columns, framed ink poster on the right
   ========================================================================== */
@media (min-width: 900px) {
  .login {
    grid-template-columns: minmax(0, 46fr) minmax(0, 54fr);
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "top  visual"
      "main visual"
      "foot visual";
  }

  .login__top {
    grid-area: top;
    max-width: calc(var(--col-w) + 2 * var(--pad-x));
    padding-block: clamp(0.5rem, 2vh, 1.5rem) 0;
  }
  .login__main {
    align-self: center;
    padding-block: 1rem;
  }
  .login__foot { padding-block: 0.875rem clamp(0.875rem, 2.4vh, 1.75rem); }

  .input { min-height: 3.25rem; }
  .form__alt-link { min-height: 2.5rem; }

  .visual {
    --frame: clamp(0.625rem, 1.1vw, 1rem);
    --vpad: clamp(1.75rem, 3.4vw, 3rem);
    align-self: start;
    position: sticky;
    top: var(--frame);
    justify-content: flex-start;
    height: calc(100vh - 2 * var(--frame));
    height: calc(100svh - 2 * var(--frame));
    margin: var(--frame) var(--frame) var(--frame) 0;
    padding: var(--vpad) var(--vpad) 0;
    border-radius: var(--radius-l);
  }

  .visual__copy { flex: none; max-width: none; }
  .copy { align-self: start; }
  .copy__eyebrow { margin-bottom: 1rem; }
  .copy__headline {
    font-size: clamp(2.5rem, 4.5vw, 5.5rem);
    font-size: clamp(2.5rem, min(4.5vw, 8svh), 5.5rem);
    line-height: 0.9;
    max-width: 12.5em;
  }
  .chips { display: flex; }

  /* the stage takes whatever height the copy leaves, so the mascot can never
     run into the headline; it bleeds to the panel edges */
  .visual__stage {
    position: relative;
    inset: auto;
    flex: 1 1 auto;
    min-height: 12rem;
    margin-inline: calc(-1 * var(--vpad));
  }

  .visual__glow { left: 58%; top: 60%; width: 120%; }
  [data-role="creator"] .visual__glow { transform: translate(6%, -3%) scale(1.08); }

  /* in dog-widths (W): 1.5W across. Founder: centred 0.45W left of the dog,
     so only the left ear tip and left bone end cross it. Creator: mirrored
     to 1.45W right of the dog's left edge, turned into a blob. */
  .visual__shape { left: -45%; top: 32%; width: 150%; }
  [data-role="creator"] .visual__shape {
    transform: translate(127%, 10%) rotate(24deg) scale(1.06);
  }

  .visual__figure {
    --float-y: -9px;
    top: 1.75rem;                    /* clearance for float + hop + lean */
    left: 58%;
    right: auto;
    bottom: auto;
    width: auto;
    height: max(calc(116% - 1.75rem), 24rem);   /* feet run off the bottom edge */
    aspect-ratio: 640 / 1418;
    translate: -50% 0;
  }
  .visual__figure img {
    filter:
      drop-shadow(0 0 0.5rem rgba(13, 10, 11, 0.7))
      drop-shadow(0 1.5rem 2.25rem rgba(0, 0, 0, 0.55));
  }
  .visual__lean { will-change: transform; }
}

/* ==========================================================================
   Motion. Everything keyframed lives here, so reduced-motion visitors get
   instant state changes and never a hidden pre-entrance state.
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {

  /* -- entrance (waits for PB.ready -> html.is-ready) -------------------- */
  html.js:not(.is-ready) .enter { opacity: 0; transform: translateY(14px); }
  html.js:not(.is-ready) .login__title { transform: translateY(14px); } /* moves, never hidden */
  html.js:not(.is-ready) .copy .w > span { transform: translateY(110%); }
  html.js:not(.is-ready) .copy .chip { opacity: 0; }
  html.js:not(.is-ready) .visual__lean { opacity: 0; translate: 0 6%; }
  html.js:not(.is-ready) .visual__shape { opacity: 0; scale: 0.6; }

  html.is-ready .enter {
    animation: pb-enter var(--dur-3) var(--ease-out) backwards;
    animation-delay: calc(40ms + var(--i, 0) * 45ms);
  }
  html.is-ready .login__title { animation: pb-lift var(--dur-3) var(--ease-out) backwards; }

  html.is-ready :is([data-role="founder"] [data-for="founder"], [data-role="creator"] [data-for="creator"]) .w > span {
    animation: pb-word-in var(--dur-3) var(--ease-out) backwards;
    animation-delay: calc(200ms + var(--line, 0) * 70ms);
  }
  html.is-ready :is([data-role="founder"] [data-for="founder"], [data-role="creator"] [data-for="creator"]) .chip {
    animation: pb-chip-in var(--dur-3) var(--ease-out) backwards;
    animation-delay: calc(440ms + var(--c, 0) * 60ms);
  }
  html.is-ready .visual__lean { animation: pb-figure-in var(--dur-4) var(--ease-out) 120ms backwards; }
  html.is-ready .visual__shape { animation: pb-shape-in var(--dur-4) var(--ease-snap) 40ms backwards; }

  /* -- role swap (only after the visitor switches) ------------------------- */
  /* These carry the html type selector so they match the specificity of the
     html.is-ready entrance rules above and win by source order. */
  /* heading word: old rolls up and out, new rolls up into place */
  html.role-anim :is([data-role="founder"] [data-for="founder"], [data-role="creator"] [data-for="creator"]).roll__item {
    animation: pb-roll-in var(--dur-swap) var(--ease-out) both;
  }
  html.role-anim :is([data-role="founder"] [data-for="creator"], [data-role="creator"] [data-for="founder"]).roll__item {
    animation: pb-roll-out var(--dur-swap) var(--ease-out) both;
  }

  /* panel headline: line by line, ~40ms apart, done inside 700ms */
  html.role-anim :is([data-role="founder"] [data-for="founder"], [data-role="creator"] [data-for="creator"]) .w > span {
    animation: pb-word-in 420ms var(--ease-out) backwards;
    animation-delay: calc(110ms + var(--line, 0) * 40ms);
  }
  html.role-anim :is([data-role="founder"] [data-for="creator"], [data-role="creator"] [data-for="founder"]) .w > span {
    animation: pb-word-out 300ms var(--ease-in-out) both;
    animation-delay: calc(var(--line, 0) * 20ms);
  }
  html.role-anim :is([data-role="founder"] [data-for="founder"], [data-role="creator"] [data-for="creator"]) .chip {
    animation: pb-chip-in 380ms var(--ease-out) backwards;
    animation-delay: calc(200ms + var(--c, 0) * 40ms);
  }
  html.role-anim :is([data-role="founder"] [data-for="creator"], [data-role="creator"] [data-for="founder"]) .chip {
    animation: pb-chip-out 200ms var(--ease-out) both;
  }

  /* bone squashes while it travels (name alternates so each switch replays) */
  html.role-anim[data-role="founder"] .role__bone { animation: pb-squash-a var(--dur-toggle) var(--ease-out); }
  html.role-anim[data-role="creator"] .role__bone { animation: pb-squash-b var(--dur-toggle) var(--ease-out); }

  /* the dog reacts: one hop and tilt, then settles with the snap ease */
  html.role-anim[data-role="founder"] .visual__hop { animation: pb-hop-founder 640ms; }
  html.role-anim[data-role="creator"] .visual__hop { animation: pb-hop-creator 640ms; }

  /* idle float */
  .visual__float { animation: pb-float 5.6s var(--ease-in-out) infinite; }

  /* success + small notes */
  .success:not([hidden]) > * {
    animation: pb-enter var(--dur-3) var(--ease-out) backwards;
  }
  .success:not([hidden]) > :nth-child(2) { animation-delay: 60ms; }
  .success:not([hidden]) > :nth-child(3) { animation-delay: 120ms; }
  .success:not([hidden]) > :nth-child(4) { animation-delay: 180ms; }
  .reset-note.is-shown { animation: pb-enter var(--dur-2) var(--ease-out); }

  .form__submit[aria-busy="true"] .icon-spin { animation: pb-spin 900ms linear infinite; }
}

@keyframes pb-enter { from { opacity: 0; transform: translateY(14px); } }
@keyframes pb-lift { from { transform: translateY(14px); } }
@keyframes pb-word-in { from { transform: translateY(110%); } to { transform: none; } }
@keyframes pb-word-out { from { transform: none; } to { transform: translateY(-110%); } }
@keyframes pb-roll-in { from { transform: translateY(110%); } to { transform: none; } }
@keyframes pb-roll-out { from { transform: none; } to { transform: translateY(-110%); } }
@keyframes pb-chip-in { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }
@keyframes pb-chip-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes pb-figure-in { from { opacity: 0; translate: 0 6%; } }
@keyframes pb-shape-in { from { opacity: 0; scale: 0.6; } }

@keyframes pb-squash-a {
  0%   { transform: none; }
  28%  { transform: scale(1.07, 0.86); }
  64%  { transform: scale(0.98, 1.04); }
  100% { transform: none; }
}
@keyframes pb-squash-b {
  0%   { transform: none; }
  28%  { transform: scale(1.07, 0.86); }
  64%  { transform: scale(0.98, 1.04); }
  100% { transform: none; }
}

/* timing functions repeat --ease-out and --ease-snap from tokens.css */
@keyframes pb-hop-creator {
  0%   { transform: none; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  32%  { transform: translateY(-10px) rotate(-5deg); animation-timing-function: cubic-bezier(0.34, 1.4, 0.64, 1); }
  100% { transform: none; }
}
@keyframes pb-hop-founder {
  0%   { transform: none; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  32%  { transform: translateY(-10px) rotate(4deg); animation-timing-function: cubic-bezier(0.34, 1.4, 0.64, 1); }
  100% { transform: none; }
}

@keyframes pb-float {
  0%, 100% { transform: translateY(0) rotate(-0.75deg); }
  50%      { transform: translateY(var(--float-y, -9px)) rotate(0.75deg); }
}
@keyframes pb-spin { to { transform: rotate(360deg); } }

/* brand link: the vector logo mark replaces the photo thumbnail (it animates on hover itself) */
.brand__mark .pb-mark { --mark-size: 1.75rem; }
@media (hover: hover) and (pointer: fine) {
  .brand:hover .brand__mark { transform: scale(1.06); }
}

/* ---- mascot: live 3D model (replaces the photo cutout) -----------------------
   Phones show the head (square box), desktop the whole dog (5:7 box). */
.visual__mascot { width: 100%; height: 100%; pointer-events: auto; }
.visual__figure { aspect-ratio: 1 / 1; }
.visual__float:has(.mascot3d.is-live) { animation: none !important; }
@media (min-width: 900px) {
  .visual__figure { aspect-ratio: 5 / 7; }
  /* the box is 1.58x wider than the old cutout's, so the pink shape is restated in the new units */
  .visual__shape { left: -10%; top: 32%; width: 95%; }
}

/* pause control for the idle motion (WCAG 2.2.2) */
.visual__pause {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 3;
  display: none;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: rgba(13, 10, 11, 0.6);
  box-shadow: inset 0 0 0 1.5px rgba(255, 246, 238, 0.22);
  color: var(--bone);
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
html.js .visual__pause { display: grid; }
.visual__pause-icon { width: 0.875rem; height: 0.875rem; grid-area: 1 / 1; }
.visual__pause-icon--play { display: none; }
.visual__pause[aria-pressed="true"] .visual__pause-icon--pause { display: none; }
.visual__pause[aria-pressed="true"] .visual__pause-icon--play { display: block; }
@media (hover: hover) { .visual__pause:hover { background: var(--bone); color: var(--ink); } }
@media (prefers-reduced-motion: reduce) { html.js .visual__pause { display: none; } }
/* phones: the panel is a short header, so the pause button sits top-centre, clear of the headline and the dog */
@media (max-width: 899.98px) {
  .visual__pause { left: 50%; top: 0.875rem; bottom: auto; translate: -50% 0; }
}
