/*
 * Landing auth modal: the static landing mock's copy of the CampusFinds
 * sign-in / sign-up dialog. Mirrors features/auth/components/auth-dialog.tsx
 * because `/` is currently rewritten to public/mock/landing-info-concept.html.
 *
 * Formal treatment: a hairline card on soft layered elevation, one quiet close
 * control inside the card, no rotation, no sticker offsets, and a single
 * consistent field style. The warm cream / burgundy / mustard palette and the
 * pill CTA stay: they are the product's identity, not decoration.
 */

.cf-auth {
  --cf-focus-ring: 0 0 0 3px color-mix(in srgb, var(--color-primary) 14%, transparent);

  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Safe-area aware: on a notched phone in landscape the card must clear the
     home indicator and the notch, not just 24px of arbitrary padding. */
  padding:
    max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.cf-auth[hidden] {
  display: none;
}

/* Scrim: paper wash + blur so the campus behind recedes but stays legible. */
.cf-auth-scrim {
  position: fixed;
  inset: 0;
  background: var(--color-background);
  opacity: 0.8;
  backdrop-filter: blur(10px) saturate(115%);
  -webkit-backdrop-filter: blur(10px) saturate(115%);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cf-auth-scrim {
    opacity: 0.95;
  }
}

.cf-auth-panel {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 428px;
  margin: auto;
  /* Square to the page. The card is formal; character comes from the
     illustration inside it and the hard offset shadow, not from rotation. */
}

.cf-auth-card {
  position: relative;
  /* Extra top room for the badge and the close control, both of which ride
     the card's top edge. No overflow:hidden; it would clip them. */
  padding: 40px 30px 28px;
  border: 1.5px solid var(--color-border);
  border-radius: 30px;
  background: var(--color-surface);
  /* Sign-up adds a Name field, so the card grows. Animating the height keeps
     the panel from snapping (and the card from jumping) between modes. */
  transition: height 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Form content sits above the illustration. */
.cf-auth-card > h2,
.cf-auth-card > .cf-auth-sub,
.cf-auth-card > .cf-auth-form,
.cf-auth-card > .cf-auth-footer,
.cf-auth-card > .cf-auth-alert {
  position: relative;
  z-index: 1;
}

/* Close: a quiet round control riding the top-left edge. Hairline outline and
   a muted glyph so it reads as chrome, not as a second badge. */
.cf-auth-close {
  position: absolute;
  top: -16px;
  left: -14px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-muted);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.cf-auth-close:hover {
  border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border));
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.cf-auth-close:focus-visible,
.cf-auth a:focus-visible,
.cf-auth button:focus-visible,
.cf-auth input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.cf-auth-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Campus badge: top-right, riding the card edge. */
.cf-auth-sticker-wrap {
  position: absolute;
  top: -15px;
  right: 18px;
  z-index: 20;
  max-width: calc(100% - 84px);
  pointer-events: none;
  /* The badge carries the lean. This wrapper holds it (not the inner pill)
     because the entrance tween fades the inner pill and clears its transform. */
  transform: rotate(-3deg);
  transform-origin: center;
}

.cf-auth-sticker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 13px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 55%, var(--color-border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-accent) 92%, var(--color-surface));
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  color: var(--color-on-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cf-auth-sticker svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  fill: currentColor;
}

.cf-auth h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--color-foreground);
}

.cf-auth-sub {
  margin: 9px 0 26px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-muted);
}

.cf-auth-field + .cf-auth-field {
  margin-top: 18px;
}

/* Grid children floor at min-content by default, which is how a long
   placeholder or a wide icon row can push a field past the card edge. */
.cf-auth-field {
  min-width: 0;
}

.cf-auth-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.cf-auth label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.005em;
  color: var(--color-foreground);
}

.cf-auth-forgot {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  text-underline-offset: 2px;
  text-decoration: underline;
}

.cf-auth-forgot:hover {
  color: var(--color-primary-hover);
}

/* One field style everywhere: hairline border on the card surface, 12px
   radius, 52px tall. Focus is a maroon border plus a soft ring. */
.cf-auth-input {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.cf-auth-input:hover {
  border-color: color-mix(in srgb, var(--color-foreground) 22%, var(--color-border));
}

.cf-auth-input:focus-within {
  border-color: var(--color-primary);
  box-shadow: var(--cf-focus-ring);
}

.cf-auth-input > svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--color-muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cf-auth-input:focus-within > svg {
  stroke: var(--color-primary);
}

.cf-auth-input input {
  flex: 1;
  min-width: 0;
  height: 50px;
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--color-foreground);
}

.cf-auth-input input::placeholder {
  color: var(--color-muted);
}

.cf-auth-input input:focus {
  outline: none;
}

.cf-auth-eye {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-right: -6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.cf-auth-eye:hover {
  background: color-mix(in srgb, var(--color-foreground) 6%, transparent);
  color: var(--color-foreground);
}

.cf-auth-eye svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Primary action: the site's pill, lifted by a soft tinted shadow rather than
   a hard offset block. */
.cf-auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  margin-top: 24px;
  border: 0;
  border-radius: 999px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.005em;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.cf-auth-submit:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.cf-auth-submit:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.cf-auth-submit svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s ease;
}

.cf-auth-submit:hover:not(:disabled) svg {
  transform: translateX(3px);
}

/* Google: same pill as the submit, outlined so it stays secondary. */
.cf-auth-google-row {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.cf-auth-google-row[hidden] {
  display: none;
}

.cf-auth-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
}

.cf-auth-or::before,
.cf-auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.cf-auth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-foreground);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s ease;
}

.cf-auth-google:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--color-foreground) 25%, transparent);
}

.cf-auth-google:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
}

.cf-auth-google:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.cf-auth-google svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.cf-auth-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 24px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
  font-size: 13.5px;
  color: var(--color-muted);
}

.cf-auth-footer a {
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  border-bottom: 1.5px solid currentColor;
  padding-bottom: 1px;
}

.cf-auth-footer a:hover {
  color: var(--color-primary-hover);
}

/* Email code step: the same card, with the fields and footer swapped. */
.cf-auth-field[hidden],
.cf-auth-footer[hidden],
.cf-auth-code-footer [hidden] {
  display: none;
}

.cf-auth-form .cf-auth-code {
  grid-column: 1 / -1;
  margin-top: 0;
}

.cf-auth-code input {
  letter-spacing: 0.3em;
  font-variant-numeric: tabular-nums;
}

.cf-auth-code input::placeholder {
  letter-spacing: normal;
}

.cf-auth-hint {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--color-muted);
}

.cf-auth-sent-to {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 600;
  color: var(--color-foreground);
}

.cf-auth-code-footer {
  flex-direction: column;
  gap: 0;
}

.cf-auth-code-footer p {
  margin: 0;
  line-height: 36px;
}

.cf-auth-code-footer button {
  min-height: 36px;
  padding: 0 4px;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: var(--color-primary);
  cursor: pointer;
}

.cf-auth-code-footer button:hover {
  text-decoration: underline;
}

.cf-auth-alert {
  margin: 16px 0 0;
  padding: 10px 13px;
  border: 1px solid color-mix(in srgb, var(--color-danger) 30%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-danger) 7%, transparent);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--color-danger);
}

.cf-auth-alert[data-tone="notice"] {
  border-color: color-mix(in srgb, var(--color-live) 30%, transparent);
  background: color-mix(in srgb, var(--color-live) 7%, transparent);
  color: var(--color-live);
}

.cf-auth-alert[hidden] {
  display: none;
}

/* Location note under the card: quiet, not a second card. */
/* Venue note: a pin and a 3D cube that rolls through three full sentences, so
   the line is never static. Centred as a group. */
.cf-auth-venues {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 16px 0 0;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  color: var(--color-muted);
}

.cf-auth-venues svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Visually hidden: the sentence for assistive tech. */
.cf-auth-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The cube. Flex-none plus a hidden sizer: the sizer is in normal flow and is
   as wide as the longest sentence, so the cube is exactly that wide and the
   pin + text centre together. `flex: 1` would let the cube eat the whole row,
   which pins the icon to the far left and centres the text in the leftover
   space instead of the pill. */
.cf-auth-cube {
  --cf-cube-h: 36px;
  position: relative;
  display: grid;
  flex: none;
  height: var(--cf-cube-h);
  /* A long perspective keeps the perspective magnification under 1% so the
     clipped box cannot eat the first letter (at 420px it was 1.045, which
     rendered "Meet" as "leet"). */
  perspective: 2000px;
  /* Clip on the PERSPECTIVE parent, not on the preserve-3d child: overflow on
     the child flattens the 3D context, here it just crops the roll to the box
     so the outgoing sentence cannot bleed over the card. */
  overflow: hidden;
}

.cf-auth-cube-sizer {
  grid-area: 1 / 1;
  padding: 0 6px;
  visibility: hidden;
  white-space: nowrap;
  line-height: 1.45;
}

.cf-auth-cube-inner {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(0deg);
  transition: transform 0.95s cubic-bezier(0.65, 0, 0.35, 1);
}

.cf-auth-cube-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--cf-cube-h);
  /* Absorbs the sub-1% perspective growth so nothing meets the clip edge. */
  padding: 0 6px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  line-height: 1.45;
  text-align: center;
}

/* Four faces: three sentences, then the first repeated so the roll can reset
   without a visible jump. */
.cf-auth-cube-face:nth-child(1) {
  transform: rotateX(0deg) translateZ(18px);
}

.cf-auth-cube-face:nth-child(2) {
  transform: rotateX(90deg) translateZ(18px);
}

.cf-auth-cube-face:nth-child(3) {
  transform: rotateX(180deg) translateZ(18px);
}

.cf-auth-cube-face:nth-child(4) {
  transform: rotateX(270deg) translateZ(18px);
}

@media (prefers-reduced-motion: reduce) {
  .cf-auth-venues {
    transform: none;
  }

  .cf-auth-cube-inner {
    transition: none;
  }
}

/* Entrance/exit are GSAP-driven; these only cover the no-script fallback. */
.cf-auth[data-animated="pending"] .cf-auth-card,
.cf-auth[data-animated="pending"] .cf-auth-venues {
  opacity: 0;
}

@media (max-width: 520px) {
  .cf-auth-card {
    padding: 36px 22px 24px;
    border-radius: 24px;
  }

  .cf-auth h2 {
    font-size: 30px;
  }

  /* Touch targets, not just visual size. A phone has no hover to widen a
     control, and these four were under the 44px minimum: the close button and
     the password eye were 40px and 36px of real hit area, the "Forgot your
     password" link was an 18px-tall line of text, and the footer's Sign up
     link was 22px tall. The visual size is unchanged where it matters — the
     hit area is grown with padding and negative margins so the layout does
     not shift. */
  .cf-auth-close {
    width: 44px;
    height: 44px;
    top: -18px;
    left: -14px;
  }

  .cf-auth-eye {
    width: 44px;
    height: 44px;
    margin-right: -10px;
  }

  /* The link sits in the field's label row; pad it vertically and pull the
     padding back out so the row's height does not grow. */
  .cf-auth-forgot {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-block: -13px;
  }

  .cf-auth-code-footer button {
    min-height: 44px;
  }

  .cf-auth-footer a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

@media (max-width: 420px) {
  .cf-auth {
    padding:
      max(16px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .cf-auth-card {
    padding: 34px 17px 20px;
    border-radius: 22px;
  }

  .cf-auth h2 {
    font-size: 27px;
  }

  .cf-auth-sub {
    margin: 8px 0 20px;
    font-size: 13.5px;
  }

  .cf-auth-sticker-wrap {
    right: 12px;
  }

  .cf-auth-sticker {
    padding: 6px 11px;
    font-size: 9px;
    letter-spacing: 0.04em;
  }

  .cf-auth-close {
    width: 44px;
    height: 44px;
    top: -16px;
    left: -12px;
  }

  .cf-auth-submit {
    min-height: 50px;
  }
}

/* ~320px (iPhone SE / Galaxy Fold cover): shrink the chrome, not the targets. */
@media (max-width: 360px) {
  .cf-auth-card {
    padding: 32px 14px 18px;
    border-radius: 20px;
  }

  .cf-auth h2 {
    font-size: 24px;
  }

  .cf-auth-sticker-wrap {
    top: -15px;
    right: 8px;
    max-width: calc(100% - 74px);
  }

  .cf-auth-sticker {
    gap: 5px;
    padding: 5px 9px;
    font-size: 8px;
    letter-spacing: 0.02em;
  }

  .cf-auth-sticker svg {
    width: 10px;
    height: 10px;
  }

  .cf-auth-close {
    /* Still 44px: at 360px the card is narrow but a close button is the one
       control a thumb must be able to hit without aiming. */
    width: 44px;
    height: 44px;
    top: -16px;
    left: -8px;
  }

  /* The label and the reset link stop competing for one line. */
  .cf-auth-label-row {
    flex-wrap: wrap;
    row-gap: 3px;
  }

  .cf-auth-forgot {
    font-size: 11.5px;
  }

  .cf-auth-input {
    min-height: 48px;
    padding: 0 11px;
    gap: 10px;
  }

  .cf-auth-input input {
    height: 46px;
    font-size: 15px;
  }

  .cf-auth-submit {
    min-height: 48px;
    font-size: 14px;
  }

  .cf-auth-footer {
    font-size: 13px;
  }

  .cf-auth-venues {
    font-size: 11px;
    padding: 9px 12px;
  }
}

/* Short viewport: landscape phone, or a keyboard-shrunk window on desktop.
   Drop the decorative height so the fields and the button stay reachable
   without scrolling. */
@media (max-height: 620px) {
  .cf-auth {
    align-items: flex-start;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .cf-auth-panel {
    margin-top: 0;
    margin-bottom: 0;
  }

  .cf-auth-card {
    padding: 32px 22px 18px;
  }

  .cf-auth h2 {
    font-size: 22px;
  }

  .cf-auth-sub {
    margin: 4px 0 14px;
    font-size: 13px;
  }

  /* Two columns where there is width: the form fits a short window without
     scrolling. The name field, the alert and the button span both.
     minmax(0, 1fr) is deliberate: a bare 1fr floors at min-content, which
     lets the fields overflow the card. */
  .cf-auth-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 14px;
    align-items: start;
  }

  .cf-auth-form .cf-auth-field + .cf-auth-field {
    margin-top: 0;
  }

  .cf-auth-field:first-child,
  .cf-auth-terms,
  .cf-auth-alert,
  .cf-auth-submit {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .cf-auth-input {
    min-height: 46px;
  }

  .cf-auth-input input {
    height: 44px;
  }

  .cf-auth-submit {
    min-height: 46px;
    margin-top: 14px;
  }

  .cf-auth-footer {
    margin-top: 14px;
    padding-top: 12px;
  }

  .cf-auth-venues {
    margin-top: 12px;
    padding: 8px 14px;
  }
}

@media (max-height: 620px) and (max-width: 560px) {
  .cf-auth-form {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cf-auth-close,
  .cf-auth-input,
  .cf-auth-submit,
  .cf-auth-submit svg,
  .cf-auth-eye {
    transition: none;
  }

  .cf-auth-submit:hover:not(:disabled) {
    transform: none;
  }

  .cf-auth-submit:hover:not(:disabled) svg {
    transform: none;
  }
}

@media (forced-colors: active) {
  .cf-auth-card,
  .cf-auth-input,
  .cf-auth-venues {
    border-color: CanvasText;
  }

  .cf-auth-submit {
    border: 1px solid ButtonText;
  }
}

/* Sign-up consent: required checkbox; the sign-in note covers Google's first-use sign-up. */
.cf-auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.5;
}

.cf-auth-terms[hidden],
.cf-auth-terms-note[hidden] {
  display: none;
}

.cf-auth-terms input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--color-primary);
}

.cf-auth-terms-note {
  margin: -8px 0 0;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.cf-auth-terms a,
.cf-auth-terms-note a {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
