html {
  -webkit-text-size-adjust: 100%;
  font-family:
    "Inter",
    "Apple Color Emoji",
    system-ui,
    sans-serif;
}

@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("./fonts/Inter/Inter-Italic-VariableFont_opsz,wght.ttf") format("truetype");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("./fonts/Inter/Inter-VariableFont_opsz,wght.ttf") format("truetype");
}

/* Minimal “bridge-web guest auth” theme (ported tokens + layout) */
:root {
  --basic-white: #ffffff;
  --basic-black: #000000;

  --basics-gray-50: #ffffff;
  --basics-gray-100: #f5f5f5;
  --basics-gray-150: #f2f2f2;
  --basics-gray-200: #ebebeb;
  --basics-gray-650: #656565;
  --basics-gray-800: #454545;
  --basics-gray-950: #171717;

  --basics-brand-blue-500: #276fff;
  --basics-brand-blue-700: #1154ea;
  --basics-brand-blue-950: #001956;

  --text-primary: var(--basics-gray-950);
  --text-secondary: var(--basics-gray-800);
  --text-muted: var(--basics-gray-650);
  --text-link: var(--basics-brand-blue-500);

  --surface-base: var(--basics-gray-50);
  --surface-island: var(--basics-gray-100);
  --surface-low: var(--basics-gray-200);

  --stroke-standard: var(--basics-gray-200);
  --stroke-accent: rgba(0, 0, 0, 0.17);

  --semantic-blue-accent: var(--basics-brand-blue-700);
  --semantic-blue-tint: color-mix(in srgb, var(--semantic-blue-accent) 20%, transparent);

  --radius-lg: 10px;
}

/* Match bridge-web convention: `.dark` overrides tokens. */
html.dark,
body.dark,
.dark {
  --text-secondary: #c2c2c2; /* basics-gray-300 */
  --text-muted: #959595; /* basics-gray-500 */
  --text-primary: #f5f5f5; /* basics-gray-100 */
  --text-link: var(--basics-brand-blue-500);

  --surface-low: #1c1c1c; /* basics-gray-925 */
  --surface-base: #212121; /* basics-gray-900 */
  --surface-island: #2b2b2b; /* basics-gray-860 */

  --stroke-standard: rgba(255, 255, 255, 0.17); /* transparency-white-600 */
  --stroke-accent: rgba(255, 255, 255, 0.35); /* transparency-white-800 */

  /* In bridge-web dark mode, primary buttons use the lighter blue. */
  --semantic-blue-accent: var(--basics-brand-blue-500);
  --semantic-blue-tint: color-mix(in srgb, var(--basics-brand-blue-500) 12%, transparent);
}

/* Auto dark mode if the OS prefers it, but allow `.light`/absence to force light. */
@media (prefers-color-scheme: dark) {
  html:not(.light) {
    --text-secondary: #c2c2c2;
    --text-muted: #959595;
    --text-primary: #f5f5f5;
    --text-link: var(--basics-brand-blue-500);

    --surface-low: #1c1c1c;
    --surface-base: #212121;
    --surface-island: #2b2b2b;

    --stroke-standard: rgba(255, 255, 255, 0.17);
    --stroke-accent: rgba(255, 255, 255, 0.35);

    --semantic-blue-accent: var(--basics-brand-blue-500);
    --semantic-blue-tint: color-mix(in srgb, var(--basics-brand-blue-500) 12%, transparent);
  }
}

body {
  margin: 0;
  background: var(--surface-base);
  color: var(--text-primary);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial;
}

.guest-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.guest-logo {
  margin-top: 80px; /* ~pt-20 */
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.bridge-logo-text {
  fill: var(--basics-brand-blue-950);
}

/* bridge-web makes the logotype white in dark mode */
html.dark .bridge-logo-text,
body.dark .bridge-logo-text,
.dark .bridge-logo-text {
  fill: #ffffff;
}

@media (prefers-color-scheme: dark) {
  html:not(.light) .bridge-logo-text {
    fill: #ffffff;
  }
}

.bridge-logo-icon {
  fill: var(--basics-brand-blue-500);
}

.guest-main {
  width: 100%;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px 0; /* ~py-12 */
}

.guest-card {
  width: 100%;
  max-width: 384px; /* ~w-96 */
  padding: 0 40px; /* ~px-10 */
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .guest-card {
    padding: 0;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#auth-step {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

#auth-step h1,
#auth-step h2 {
  margin: 0;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

#auth-step .muted {
  margin: 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.otp-enabled #otp-code {
  display: none !important;
}

input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  /* Light: subtle filled input, Dark: subtle filled input (via tokens below) */
  background: color-mix(in srgb, var(--text-primary) 4%, transparent);
  color: var(--text-primary);
  /* iOS Safari zooms on focus if font-size < 16px */
  font-size: 16px;
}

input::placeholder {
  color: var(--text-muted);
}

input:focus {
  outline: none;
  border-color: var(--semantic-blue-accent);
}

input:disabled {
  opacity: 0.8;
  cursor: not-allowed;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--text-primary) 2%, transparent);
}

textarea,
select {
  /* iOS Safari zooms on focus if font-size < 16px */
  font-size: 16px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

button {
  height: 48px; /* ~h-12 */
  padding: 0 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--semantic-blue-accent);
  color: var(--basic-white);
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
}

button:hover {
  box-shadow: 0 0 0 1px var(--stroke-accent);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

a {
  color: var(--semantic-blue-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.link-button {
  background: transparent;
  border: none;
  height: auto;
  padding: 0;
  width: auto;
  color: var(--semantic-blue-accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
  box-shadow: none;
}

.link-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  text-decoration: none;
}

.resend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

code {
  background: var(--surface-island);
  padding: 2px 6px;
  border-radius: 6px;
}

.otp {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.otp input {
  text-align: center;
  font-size: 20px;
  padding: 12px 0;
}

.error {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  font-size: 14px;
}

.spinner {
  display: none;
  color: var(--text-muted);
  font-size: 14px;
}

.htmx-request .spinner {
  display: block;
}

.guest-footer {
  width: 100%;
  padding: 52px 16px 32px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
}

.guest-footer-inner {
  max-width: 90rem;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 8px 24px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.guest-footer-inner a {
  color: var(--text-secondary);
}
