/* chat3d landing page. Styling is lifted directly from the app frontend
   (client/src/index.css + client/src/components/PanelLayout.css) so the
   landing brandmark matches the in-app brandmark exactly. */

/* --- Theme tokens (verbatim from client/src/index.css) ----------------- */
:root {
  color-scheme: light dark;

  --color-surface-base: #f5f5f7;
  --color-surface-primary: #ffffff;
  --color-surface-secondary: #eef1f6;
  --color-surface-divider: #d0d0d8;
  --color-surface-divider-hover: #a0a0b0;
  --color-surface-hover: #e0e0e4;
  --color-border: #c0c0c8;
  --color-text-primary: #1a1a2e;
  --color-text-secondary: #555555;
  --color-text-error: #c62828;
  --color-viewport-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-surface-base: #000000;
    --color-surface-primary: #000000;
    --color-surface-secondary: #0a0a0a;
    --color-surface-divider: #2a2a2a;
    --color-surface-divider-hover: #4a4a4a;
    --color-surface-hover: #1a1a1a;
    --color-border: #333333;
    --color-text-primary: #e0e0e0;
    --color-text-secondary: #cccccc;
    --color-text-error: #e57373;
    --color-viewport-bg: #000000;
  }
}

:root[data-theme="dark"] {
  --color-surface-base: #000000;
  --color-surface-primary: #000000;
  --color-surface-secondary: #0a0a0a;
  --color-surface-divider: #2a2a2a;
  --color-surface-divider-hover: #4a4a4a;
  --color-surface-hover: #1a1a1a;
  --color-border: #333333;
  --color-text-primary: #e0e0e0;
  --color-text-secondary: #cccccc;
  --color-text-error: #e57373;
  --color-viewport-bg: #000000;
}

/* --- Base (verbatim from client/src/index.css) ------------------------- */
html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background-color: var(--color-surface-primary);
  color: var(--color-text-primary);
}

/* --- Layout ------------------------------------------------------------ */
.landing {
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Toolbar + brandmark: same geometry and type as the app's viewport toolbar
   (client/src/components/PanelLayout.css). Absolutely positioned like the app
   so it overlays the content and doesn't affect vertical centering. */
.landing__toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px;
  pointer-events: none;
}

.landing__heading {
  font-size: 22px;
  font-weight: 700;
  line-height: 32px;
  color: var(--color-text-primary);
}

/* Secondary "Sign in" affordance for returning users. Reads quietly next to
   the brandmark — plain text link, not a button — so it doesn't compete with
   the "Request access" form. Re-enable pointer events the toolbar disables. */
.landing__signin {
  pointer-events: auto;
  align-self: center;
  font-size: 15px;
  font-weight: 600;
  line-height: 32px;
  color: var(--color-text-secondary);
  text-decoration: none;
}

.landing__signin:hover {
  color: var(--color-text-primary);
  text-decoration: underline;
}

.landing__body {
  flex: 1;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.landing__copy {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.landing__copy p {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text-primary);
}

/* --- Signup form ------------------------------------------------------- */
.signup {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Extra breathing room above the form, on top of the copy's 16px gap. */
  margin-top: 16px;
}

.signup__row {
  display: flex;
  gap: 8px;
  /* Full copy width. Input + button stay on one line: the input shrinks
     (min-width: 0) while the button keeps its label. */
}

.signup__input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px; /* 16px keeps iOS Safari from zooming on focus. */
  color: var(--color-text-primary);
  background-color: var(--color-surface-primary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.signup__input:focus {
  outline: none;
  border-color: var(--color-surface-divider-hover);
}

.signup__button {
  flex: 0 0 auto; /* Never shrink — keeps the label on one line with the input. */
  padding: 10px 18px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-surface-primary);
  background-color: var(--color-text-primary);
  border: 1px solid var(--color-text-primary);
  border-radius: 8px;
  cursor: pointer;
}

.signup__button:hover {
  background-color: var(--color-text-secondary);
  border-color: var(--color-text-secondary);
}

.signup__button:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Status message: an icon + text row. The icon differentiates the states at a
   glance (check on success, alert on error) so success doesn't read as just
   another line of text. In-flight requests show progress on the button label
   ("Requesting access…"), so there's no loading state here. */
.signup__status {
  margin: 0;
  min-height: 1.4em; /* Reserve space so the layout doesn't jump on message. */
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--color-text-secondary);
  transition: color 0.15s ease;
}

/* Fixed-size leading icon slot, shared by all states so text stays aligned. */
.signup__status::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
}

/* No message → no icon and no gap taking up space. */
.signup__status:empty {
  gap: 0;
}
.signup__status:empty::before {
  display: none;
}

/* Success + error: theme-colored glyphs via CSS mask so they inherit the
   text color (currentColor) and stay crisp at any DPI. */
.signup__status[data-kind="success"] {
  color: var(--color-text-primary);
}
.signup__status[data-kind="success"]::before {
  background-color: currentColor;
  -webkit-mask: var(--icon-check) center / contain no-repeat;
  mask: var(--icon-check) center / contain no-repeat;
  animation: signup-pop 0.2s ease;
}

.signup__status[data-kind="error"] {
  color: var(--color-text-error);
}
.signup__status[data-kind="error"]::before {
  background-color: currentColor;
  -webkit-mask: var(--icon-alert) center / contain no-repeat;
  mask: var(--icon-alert) center / contain no-repeat;
  animation: signup-pop 0.2s ease;
}

/* Inline SVG glyphs (fill/stroke color is irrelevant — the mask uses only the
   alpha channel, and the pseudo-element's background-color supplies the tint). */
:root {
  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M13.5 4.5 6.5 11.5 3 8' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3Cpath d='M8 4.5v4' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='11.3' r='0.9' fill='%23000'/%3E%3C/svg%3E");
}

@keyframes signup-pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Honor reduced-motion: drop the spin/pop, keep the static icons. */
@media (prefers-reduced-motion: reduce) {
  .signup__status::before {
    animation: none;
  }
}
