/* Badge landing. Night sky, type and top bar taken from recordsapp.org (Inter,
   #050a1c, stars from sky.js). The page itself is only the mark and the word Badge. */

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/inter-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/inter-latin-600-normal.woff2") format("woff2");
}

:root {
  --bg: #ffffff;
  --ink: #1d1f24;
  --muted: rgba(255, 255, 255, 0.55);
  --line: rgba(255, 255, 255, 0.12);
  --accent: #1f6fe5;
  --hdr-h: 65px;
  /* Default pose of the top-left mark. Save copies a replacement for these four lines. */
  color-scheme: only light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: #ffffff;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.028em;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

html.has-sky, html.has-sky body {
  background-color: #ffffff;
}

/* --- Records sky.js stars (night). Exact rules from recordsapp.org/static/css/app.css. --- */
.lp-stars {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--sky-h, 100lvh);
  overflow: hidden;
  pointer-events: none;
  contain: strict;
  transform: translateZ(0);
}

.lp-stars span {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  animation: lp-drift var(--drift) ease-in-out var(--drift-delay) infinite alternate;
}

.lp-stars .is-bright {
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.7);
}

.lp-stars .is-twinkle {
  animation:
    lp-drift var(--drift) ease-in-out var(--drift-delay) infinite alternate,
    lp-twinkle var(--twinkle) ease-in-out var(--twinkle-delay) infinite;
}

@keyframes lp-drift {
  from { translate: 0 0; }
  to { translate: var(--dx) var(--dy); }
}

@keyframes lp-twinkle {
  0%, 100% { scale: 1; opacity: var(--o); }
  50% { scale: 0.6; opacity: calc(var(--o) * 0.25); }
}

@media (prefers-reduced-motion: reduce) {
  .lp-stars span,
  .lp-stars .is-twinkle {
    animation: none;
  }
}

html.is-scrolling .lp-stars,
html.is-scrolling .lp-stars * {
  animation-play-state: paused !important;
}

/* --- Top bar, sized and set like Records' header.rv-ph --- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: var(--hdr-h);
  min-height: var(--hdr-h);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
}


/* --- Centered silver badge --- */
main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh; /* the visible height (100lvh was taller than the screen on iOS, so it scrolled) */
  padding-bottom: 16vh; /* centres the badge, button and links a little above the middle */
  box-sizing: border-box;
}

.badge {
  position: relative;
  width: min(440px, 88vw);
  height: min(440px, 88vw);
  display: grid;
  place-items: center;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.badge.is-dragging { cursor: grabbing; }

.badge__shadow {
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: 58%;
  height: 16%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.12), transparent 70%);
  filter: blur(12px);
  pointer-events: none;
}

.badge__stage {
  position: relative;
  width: 62%;
  height: 62%;
  perspective: 1200px;
  perspective-origin: 50% 48%;
  z-index: 2;
}

.badge__rig,
.badge__stack {
  transform-style: preserve-3d;
}

.badge__rig {
  width: 100%;
  height: 100%;
  will-change: transform;
}

.badge__stack {
  position: relative;
  width: 100%;
  height: 100%;
}

.badge__face,
.badge__wall {
  position: absolute;
  pointer-events: none;
}

.badge__face {
  inset: 0;
}

.badge__wall {
  background: #eadcb6;
  box-shadow: 0 0 0 1px #eadcb6;
  backface-visibility: hidden; /* only the walls facing you draw (see landing.js) */
  -webkit-backface-visibility: hidden;
}

.badge__face {
  /* Flat and isolated: the light streak's blend stays inside this one face instead of making the
     browser re-composite the whole 3D stack every frame (that flickered and loaded the GPU). */
  transform-style: flat;
  isolation: isolate;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.badge__face img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Glimmer on the front face, as on the popup badge: an oversized tilted streak slid across by a CSS
   animation of its transform alone (no per-frame script, no repaint). Clipped to the badge's shape. */
.badge__gleam {
  position: absolute;
  inset: 4%;
  border-radius: 21.74%;
  overflow: hidden;
  pointer-events: none;
}

.badge__gleam i,
.badge__gleam i::after {
  position: absolute;
  inset: -100%; /* 3x the face, so the tilted streak spans it corner to corner */
}

.badge__gleam i {
  background: linear-gradient(90deg, transparent 0%, transparent 42.7%, rgba(255, 255, 255, 0.06) 46.7%,
    rgba(255, 255, 255, 0.22) 49%, rgba(255, 255, 255, 0.85) 50%, rgba(255, 255, 255, 0.18) 51.3%,
    transparent 54.7%, transparent 100%);
  mix-blend-mode: soft-light;
  opacity: 0.9;
  transform: rotate(28deg) translateX(-26%);
  will-change: transform;
  animation: badge-sweep 3s linear infinite;
}

.badge__gleam i::after {
  content: "";
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, transparent 48.3%, rgba(255, 255, 255, 0.55) 50%,
    transparent 51.7%, transparent 100%);
  mix-blend-mode: overlay;
  opacity: 0.75;
}

/* The back face is turned around, so its streak is mirrored back: seen from behind it runs left to
   right at the same tilt as the front. */
.badge__gleam--back { transform: scaleX(-1); }

/* 1.1 s across, then off the right edge for 1.9 s; the jump back happens out of sight. */
@keyframes badge-sweep {
  0% { transform: rotate(28deg) translateX(-26%); }
  36.7%, 100% { transform: rotate(28deg) translateX(26%); }
}

@media (prefers-reduced-motion: reduce) {
  .badge__gleam i { animation: none; transform: rotate(28deg) translateX(-8%); will-change: auto; }
}

@media (max-width: 520px) {
  .badge { width: min(380px, 94vw); height: min(380px, 94vw); }
  .badge__stage { width: 68%; height: 68%; }
}

/* --- Enter button under the badge (Graphite) --- */
.enter {
  --enter-ease: 0.18s ease;
  position: relative;
  z-index: 2;
  margin-top: -36px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-width: 132px;
  height: 44px;
  padding: 0 26px;
  border: 1px solid #1e2024;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  color: #e6e8eb;
  background: linear-gradient(180deg, #3a3d43 0%, #2a2c31 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 4px 12px rgba(0, 0, 0, 0.16);
  transition: transform var(--enter-ease), box-shadow var(--enter-ease), background var(--enter-ease), color var(--enter-ease), border-color var(--enter-ease), filter var(--enter-ease);
}
.enter:hover { transform: translateY(-1px); filter: brightness(1.08); }
.enter:active { transform: translateY(0); }
.enter:focus-visible { outline: 2px solid #2a2c31; outline-offset: 3px; }
.enter:disabled { opacity: 0.6; cursor: default; filter: none; transform: none; }

.gate-error {
  position: relative;
  z-index: 2;
  max-width: 320px;
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
  color: #9a3412;
}

#profile { display: none; }
html.is-unlocked #gate { display: none; }
/* The front page doesn't scroll (or rubber-band on iOS); the signed-in profile on this same page does. */
html:not(.is-unlocked), html:not(.is-unlocked) body { height: 100%; overflow: hidden; overscroll-behavior: none; }
/* The unlocked profile is styled by landing/profile/profile.css. */
html.is-unlocked #profile { display: block; min-height: 100dvh; }

@media (prefers-reduced-motion: reduce) {
  .enter, .links a { transition: none; }
}

/* --- Quiet text links under the button --- */
.links {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 18px;
}
.links a {
  color: #5c5f66;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 0.18s ease;
}
.links a:hover {
  color: #2a2c31;
  text-decoration: underline;
}
.links a:focus-visible {
  outline: 2px solid #2a2c31;
  outline-offset: 3px;
  border-radius: 3px;
}

/* White page: no star field. */
.lp-stars { display: none; }


/* Gate: create / recover (below the main button) */
/* Access popup: the three options as plain text at the bottom, the recovery form inside. */
.gate-dialog .pf-qrbox { width: min(344px, 92vw); }
.gate-dialog .gate-alt { justify-content: center; gap: 8px; margin-top: 18px; white-space: nowrap; }
.gate-dialog .pf-qrbox .gate-link { margin: 0; min-width: 0; height: auto; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  color: #5c5f66; font-family: inherit; font-size: 13px; font-weight: 500; line-height: 1.4; transform: none; filter: none; }
.gate-dialog .pf-qrbox .gate-link:hover { color: #2a2c31; text-decoration: underline; }
.gate-dialog .pf-qrbox .gate-link[aria-pressed="true"] { color: #1d1f24; font-weight: 600; text-decoration: underline; }
.gate-dialog #existing-form { margin-top: 4px; }
.gate-dialog .gate-recover { width: 100%; margin-top: 14px; }
.gate-dialog .gate-recover button { margin-top: 4px; width: 100%; border-radius: 12px; } /* as wide as, and as round as, the inputs */
.gate-words { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.gate-words .gate-word { height: 40px; padding: 0 8px; font: 14px/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: left; }
.gate-words .gate-word::placeholder { color: #b4b6bb; }
.gate-dialog .pf-pop-body .gate-error { margin: 12px 0 0; color: #b42318; }
.gate-input { box-sizing: border-box; width: 100%; height: 44px; padding: 0 12px; border: 1px solid rgba(0,0,0,.18); border-radius: 12px; background: #fff;
  font: 15px/1 Inter, system-ui, sans-serif; color: #1e2024; text-align: center; }
.gate-dialog .pf-pop-body .gate-name-status { margin: 0; font-size: 13px; line-height: 1.4; color: var(--pf-muted); word-break: normal; }
.gate-dialog .pf-pop-body .gate-name-status[hidden] { display: none; }
.gate-name-status[data-kind="ok"] { color: #1a7f37 !important; }
.gate-name-status[data-kind="bad"] { color: #b42318 !important; }
.gate-dialog .gate-recover button:disabled { opacity: .45; cursor: default; transform: none; filter: none; }
/* One border only, drawn inside the box: dark when focused, green when the name is free, red when it is not. */
.gate-input:focus { outline: none; border-color: #2a2c31; box-shadow: inset 0 0 0 1px #2a2c31; }
/* The username check shows on the input itself: green when the name is free, red when it is not. */
.gate-input[data-check="ok"], .gate-input[data-check="ok"]:focus { border-color: #1a7f37; box-shadow: inset 0 0 0 1px #1a7f37; }
.gate-input[data-check="bad"], .gate-input[data-check="bad"]:focus { border-color: #b42318; box-shadow: inset 0 0 0 1px #b42318; }
.gate-alt { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; margin-top: 14px; color: #8a8d93; font-size: 13px; }
.gate-link { border: 0; padding: 0; background: none; font: inherit; font-weight: 500; color: #5c5f66; cursor: pointer; text-underline-offset: 3px; }
.gate-link:hover { color: #2a2c31; text-decoration: underline; }
.gate-link:focus-visible { outline: 2px solid #2a2c31; outline-offset: 3px; border-radius: 4px; }
.gate-link:disabled { opacity: .5; cursor: default; text-decoration: none; }
.gate-recover { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(340px, 100%); margin-top: 16px; }
.gate-recover[hidden] { display: none; }
.gate-hint { margin: 0; font-size: 12px; color: #8a8d93; text-align: center; }
.enter.enter-small { margin-top: 4px; height: 40px; font-size: 15px; }

/* BADGE-025: framed (js/frameguard.js). The access popup is removed; this is all that shows. */
html[data-framed] #access-dialog, html[data-framed] #profile { display: none !important; }
.framed-notice { display: grid; gap: 10px; place-items: center; min-height: 60vh; text-align: center; font-size: 15px; }
.framed-notice p { margin: 0; }
.framed-notice a { font-weight: 600; color: inherit; }
