/* --- Register: liquid glass -------------------------------------------------
   Three stacked layers make the "glass": a backdrop blur, an SVG
   feDisplacementMap that bends the backdrop (see the <filter> defs in
   index.html), and inset rim highlights standing in for Apple's rim light.
   Only Chromium supports SVG filters in backdrop-filter, so every glass surface
   declares the plain blur first and the url() version second — Safari and
   Firefox discard the second declaration and keep blur + rim only.
   ---------------------------------------------------------------------------- */

.glass-register {
  --dark-background-color: #11232a;
  font-family: "Geist", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;

  --accent: #ee2b3c;
  --accent-hover: #ff4252;
  --accent-glow: rgba(238, 43, 60, 0.45);

  /* Glass material tokens, shared by every surface in this section. */
  --glass-tint: rgba(255, 255, 255, 0.1);
  --glass-tint-strong: rgba(255, 255, 255, 0.16);
  --glass-rim-bright: rgba(255, 255, 255, 0.7);
  --glass-rim-soft: rgba(255, 255, 255, 0.25);
  --glass-edge: rgba(255, 255, 255, 0.35);
  --glass-cast-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  --glass-text: #ffffff;
  --glass-text-muted: rgba(255, 255, 255, 0.72);
  /* Text over glass loses contrast against a busy backdrop, so anything
     readable sits on this darker scrim rather than on the tint alone. */
  --glass-text-scrim: rgba(9, 35, 40, 0.28);

  /* Tile geometry, kept here so the half-drop offsets below stay in sync with
     the tile size — the second layer must sit at exactly half a tile. The gap
     around each mark is baked into goathacks-banner-tile.svg; these values are
     the tile's own dimensions, so changing them rescales the whole cell
     (lockup included) rather than only the spacing. */
  --logo-tile-width: 520px;
  --logo-tile-height: 320px;

  /* Contains the ::before tile field; index.css sets this for every section,
     but /dashboard/register doesn't load index.css. */
  position: relative;
  display: grid;
  grid-template-columns: minmax(min-content, 5vw) auto;
  /* Grow past the viewport rather than clip the card on short screens. */
  height: auto;
  min-height: 100vh;
  overflow: hidden;
  background-color: var(--dark-background-color);
}

@media (min-width: 761px) {
  /* Labels overlay the content rather than widening the nav column, so the
     page doesn't shift on hover. */
  .glass-register:has(nav:hover),
  .glass-register:has(nav:focus-within) {
    a span.hidden {
      opacity: 1;
      pointer-events: auto;
      transition-delay: 0.2s, 0s, 0s;
    }
  }

  .glass-register > :not(nav) {
    transition: opacity 0.2s ease;
  }
}

/* Below this width the labels run into the content, so fade it back while
   they're showing. */
@media (min-width: 761px) and (max-width: 1240px) {
  .glass-register:has(nav:hover),
  .glass-register:has(nav:focus-within) {
    > :not(nav) {
      opacity: 0.15;
    }
  }
}

/* The tessellated logo field the glass refracts. Two identical repeating layers,
   the second offset by half a tile on both axes, give a half-drop (staggered)
   lattice rather than a plain grid — the diagonal rhythm reads better through
   the distortion than square rows do. It lives on ::before so the slow drift can
   animate `transform`, which does not repaint the tiles. */
.glass-register::before {
  content: "";
  position: absolute;
  inset: -12%;
  z-index: 1;
  pointer-events: none;
  background-image:
    url("/static/img/goathacks-banner-tile.svg"),
    url("/static/img/goathacks-banner-tile.svg");
  background-size:
    var(--logo-tile-width) var(--logo-tile-height),
    var(--logo-tile-width) var(--logo-tile-height);
  background-position:
    0 0,
    calc(var(--logo-tile-width) / 2) calc(var(--logo-tile-height) / 2);
  background-repeat: repeat, repeat;
  opacity: 0.012;
  animation: register-glass-drift 18s ease-in-out infinite alternate;
}

@keyframes register-glass-drift {
  from {
    transform: translate3d(-5%, -5%, 0);
  }
  to {
    transform: translate3d(5%, 5%, 0);
  }
}

/* Toggled by index.js while the landing-page section is out of view. */
.glass-register.offscreen::before {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .glass-register::before {
    animation: none;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

.glass-register nav,
.glass-register .glass-card {
  position: relative;
  z-index: 2;
  backdrop-filter: blur(12px) saturate(170%);
}

/* only chromium engine support*/
@supports (backdrop-filter: url(#filter)) and (selector(::-webkit-slider-thumb)) {
  .glass-register nav,
  .glass-register .glass-card {
    backdrop-filter: url(#glass-refraction-panel) blur(12px) saturate(170%);
  }
}

/* A floating pill rather than a full-height rail, so the page reads as one
   flat surface with the nav resting on it. */
.glass-register nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  align-self: center;
  justify-self: start;
  z-index: 3;
  margin-left: 22px;
  padding: 14px 16px;
  border: 1px solid var(--glass-edge);
  border-radius: 28px;

  background: var(--glass-tint);
  box-shadow:
    inset 1px 1px 1px var(--glass-rim-soft),
    var(--glass-cast-shadow);

  a {
    display: flex;
    align-items: center;
    border-radius: 16px;
  }

  a img {
    width: 32px;
    height: 32px;
    object-fit: contain;
  }

  a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 6px;
  }

  /* Labels hang outside the pill, each level with its icon; the one under
     the pointer brightens and nudges right. */
  a span.hidden {
    opacity: 0;
    white-space: nowrap;
    position: absolute;
    left: calc(100% + 30px);
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.35rem;
    font-weight: 600;
    pointer-events: none;
    transition:
      opacity 0.2s ease,
      color 0.2s ease,
      transform 0.2s ease;
  }

  a:is(:hover, :focus-visible) span.hidden {
    color: #fff;
    transform: translateX(6px);
  }
}

.glass-register .glass-card {
  align-self: center;
  justify-self: center;
  border-radius: 50px;
  overflow: hidden;

  background:
    linear-gradient(160deg, rgba(238, 43, 60, 0.1), transparent 40%),
    var(--glass-tint-strong);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 1px 1px 1px var(--glass-rim-bright),
    inset -1px -1px 1px var(--glass-rim-soft),
    0 20px 50px rgba(0, 0, 0, 0.45);
}

/* --- Landing sign-up -------------------------------------------------------
   Discord is the main path, so it gets the glass panel. The email form stays
   hidden behind a quiet text toggle until someone asks for it. */

.glass-register #sign-up {
  position: relative;
  z-index: 2;
  align-self: center;
  justify-self: center;
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: min(740px, 100% - 64px);
  margin: 5vh 0;
  color: var(--glass-text);

  --logo-size: 36px;
  --logo-gap: 14px;
}

.glass-register .sign-up-heading {
  display: flex;
  align-items: center;
  gap: var(--logo-gap);

  img {
    width: var(--logo-size);
    height: var(--logo-size);
    object-fit: contain;
  }

  h2 {
    margin: 0;
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
  }
}

/* Indented so the copy lines up with the heading text, not the logo. */
.glass-register #sign-up .register-lede {
  margin: 0;
  padding-left: calc(var(--logo-size) + var(--logo-gap));
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.85);
}

.glass-register .login-error {
  margin: 0;
  padding: 12px 16px;
  border: 1px solid rgba(238, 43, 60, 0.6);
  border-radius: 14px;
  background: rgba(238, 43, 60, 0.15);
  color: var(--glass-text);
}

.glass-register .login-notice {
  margin: 0;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--glass-text);
}

.glass-register .discord-panel {
  align-self: stretch;
  padding: 10px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow:
    inset 1px 1px 1px var(--glass-rim-soft),
    0 0 48px rgba(88, 101, 242, 0.22);
}

.glass-register .discord-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 70px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 21px;
  background: #5865f2;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;

  img {
    width: 36px;
    height: 36px;
  }
}

.glass-register .discord-auth:hover {
  background: #4752c4;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    0 8px 22px rgba(88, 101, 242, 0.45);
}

.glass-register .discord-auth:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 3px;
}

.glass-register .discord-panel:has(.cta-auth) {
  box-shadow:
    inset 1px 1px 1px var(--glass-rim-soft),
    0 0 48px rgba(238, 43, 60, 0.22);
}

.glass-register .discord-auth.cta-auth {
  background: var(--accent);
}

.glass-register .discord-auth.cta-auth:hover {
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    0 8px 22px rgba(238, 43, 60, 0.45);
}

.glass-register .sign-up-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: stretch;
  padding: 12px;
  border-radius: 28px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  box-shadow:
    inset 1px 1px 1px var(--glass-rim-soft),
    0 20px 50px rgba(0, 0, 0, 0.35);
}

.glass-register .tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.glass-register .tile-grid.single {
  grid-template-columns: 1fr;
}

.glass-register .field-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(9, 35, 40, 0.45);
  cursor: text;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;

  label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--glass-text-muted);
    cursor: text;
  }

  input {
    min-width: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: none;
    color: var(--glass-text);
    font: inherit;
    font-size: 1.05rem;
    line-height: 1.5;
  }

  input::placeholder {
    color: rgba(255, 255, 255, 0.3);
  }
}

/* The ring lives on the tile, since the bare input inside has no box of its own. */
.glass-register .field-tile:has(input:focus-visible),
.glass-register .field-tile:has(input:user-invalid) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.glass-register .panel-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-left: 10px;

  p {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--glass-text-muted);
  }
}

.glass-register .sign-up-submit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 26px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.45),
    0 8px 28px var(--accent-glow);
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;

  span {
    font-size: 0.8rem;
    opacity: 0.8;
  }
}

.glass-register .sign-up-submit:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.45),
    0 12px 36px rgba(238, 43, 60, 0.65);
}

.glass-register .sign-up-submit:active {
  transform: translateY(1px) scale(0.99);
}

.glass-register .sign-up-submit:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 3px;
}

.glass-register .sign-up-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: -2px;
  padding: 0 16px;
  font-size: 0.9rem;
  color: var(--glass-text-muted);

  a {
    color: var(--glass-text);
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
  }
}

.glass-register .link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--glass-text);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.glass-register .sign-up-meta :is(.link-button, .email-toggle) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.95rem;
}

.glass-register .link-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.glass-register .email-toggle {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;

  span {
    display: inline-block;
    margin-left: 6px;
    transition: transform 0.2s ease;
  }
}

.glass-register .email-toggle:hover {
  color: var(--glass-text);
}

.glass-register .email-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

/* `display: flex` on the panel would otherwise beat the hidden attribute. */
.glass-register .sign-up-panel[hidden] {
  display: none;
}

.glass-register .register-lede {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--glass-text-muted);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* --- Narrow screens ---------------------------------------------------------
   One column: the side nav becomes a bar across the top and content spans the
   width with a 16px gutter. */

@media (max-width: 760px) {
  .glass-register {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .glass-register nav {
    position: relative;
    top: auto;
    flex-direction: row;
    justify-content: space-around;
    justify-self: stretch;
    gap: 4px;
    margin: 16px 16px 0;
    padding: 14px 18px;
    border-radius: 24px;
    transform: none;

    a img {
      width: 28px;
      height: 28px;
    }

    /* Off-screen, not display: none — it's the link's only accessible name. */
    a span.hidden {
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
    }
  }

  .glass-register .glass-card {
    width: calc(100% - 32px);
    margin: 16px 0;
    border-radius: 32px;
  }

  .glass-register #sign-up {
    width: calc(100% - 32px);
    margin: 24px 0;
    --logo-size: 28px;
    --logo-gap: 10px;

    h2 {
      font-size: 1.6rem;
    }
  }

  .glass-register .tile-grid {
    grid-template-columns: 1fr;
  }

  .glass-register .discord-auth {
    height: 64px;
  }

  .glass-register .sign-up-meta {
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin-top: 12px;
  }

  .glass-register .sign-up-submit {
    width: 100%;
    justify-content: center;
  }

}
