/* UI Auth gallery — page chrome + shared tokens */

:root {
  --ink: #1a2332;
  --ink-muted: #5a6578;
  --ink-faint: #8b95a8;
  --surface: #f0f3f7;
  --surface-raised: #ffffff;
  --accent: #0d7a6f;
  --accent-soft: #e4f4f2;
  --accent-deep: #085c54;
  --border: #d5dce6;
  --border-strong: #b8c2d0;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --success: #067647;
  --success-soft: #ecfdf3;
  --auth-radius: 12px;
  --auth-shadow: 0 1px 2px rgb(26 35 50 / 0.06), 0 8px 24px rgb(26 35 50 / 0.06);
  --motion: 200ms ease;
  --font-sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  --max: 72rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #d9ebe8 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, #e2e8f2 0%, transparent 50%),
    var(--surface);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

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

.page {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
  padding-block: 2rem 2.5rem;
}

@media (max-width: 40rem) {
  .page {
    width: min(100% - 1.25rem, var(--max));
    padding-block: 1.25rem 2rem;
  }

  .wb-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .wb-nav__spacer {
    flex: 0 0 0.75rem;
  }

  .pattern {
    padding: 1rem;
  }

  .auth-card {
    padding: 1.35rem 1.15rem;
  }
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header p {
  margin: 0;
  max-width: 46rem;
  color: var(--ink-muted);
}

.page-header code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.toc a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  font-size: 0.8125rem;
  font-weight: 600;
}

.toc a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.gallery {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.pattern {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--auth-radius) + 4px);
  background: rgb(255 255 255 / 0.55);
  backdrop-filter: blur(6px);
}

.pattern__meta {
  margin-bottom: 1.25rem;
}

.pattern__meta h2 {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
  font-weight: 700;
}

.pattern__meta .slug {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.pattern__meta p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.pattern__stage {
  position: relative;
  border-radius: var(--auth-radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse 70% 60% at 20% 0%, #d9ebe8 0%, transparent 55%),
    #e8edf3;
  box-shadow: var(--auth-shadow);
  padding: 1.5rem 1rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 22rem;
}

@media (max-width: 40rem) {
  .pattern__stage {
    padding: 1rem 0.65rem;
  }

  .auth-otp {
    gap: 0.3rem;
  }

  .auth-otp input {
    width: 2.15rem;
    height: 2.5rem;
    font-size: 1rem;
  }

  .auth-actions--row {
    flex-direction: column;
  }

  .auth-actions--row .auth-btn {
    width: 100%;
  }
}

.pattern__stage--wide {
  padding: 1.25rem;
}

.pattern__stage--split {
  padding: 0;
  display: block;
  min-height: 26rem;
}

/* Shared auth primitives */
.auth-card {
  width: min(100%, 24rem);
  max-width: 100%;
  min-width: 0;
  padding: 1.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--auth-radius);
  background: var(--surface-raised);
  box-shadow: var(--auth-shadow);
}

.auth-mark {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 auto 1rem;
  border-radius: 0.75rem;
  background: var(--accent);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.auth-mark--warn {
  background: var(--warn);
}

.auth-mark--danger {
  background: var(--danger);
}

.auth-mark--soft {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.auth-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
}

.auth-lede {
  margin: 0 0 1.25rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
  text-align: center;
}

.auth-title--left,
.auth-lede--left {
  text-align: left;
}

.auth-fields {
  display: grid;
  gap: 0.85rem;
}

.auth-field label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.auth-field input,
.auth-field select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.auth-field__hint {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.auth-field__error {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--danger);
}

.auth-pass {
  position: relative;
}

.auth-pass input {
  padding-right: 2.75rem;
}

.auth-pass__toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
}

.auth-pass__toggle:hover {
  color: var(--ink);
  background: var(--surface);
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.85rem 0 1rem;
  font-size: 0.8125rem;
}

.auth-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
}

.auth-check input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.auth-link {
  color: var(--accent-deep);
  font-weight: 700;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
}

.auth-btn:hover {
  background: var(--accent-deep);
}

.auth-btn--ghost {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--ink);
}

.auth-btn--ghost:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.auth-btn--soft {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.auth-btn--soft:hover {
  background: #d4ebe7;
}

.auth-btn--danger {
  background: var(--danger);
}

.auth-btn--danger:hover {
  background: #912018;
}

.auth-btn--social {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--ink);
  justify-content: flex-start;
  padding-inline: 0.85rem;
}

.auth-btn--social:hover {
  border-color: var(--ink-muted);
  background: var(--surface);
}

.auth-btn__glyph {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.7rem;
  font-weight: 800;
  flex-shrink: 0;
}

.auth-foot {
  margin: 1.15rem 0 0;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--ink-faint);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.auth-alert {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.auth-alert--danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #fecdca;
}

.auth-alert--warn {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid #fedf89;
}

.auth-alert--info {
  background: #eff8ff;
  color: #175cd3;
  border: 1px solid #b2ddff;
}

.auth-alert--success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid #abefc6;
}

.auth-otp {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin: 0.25rem 0 1rem;
  flex-wrap: wrap;
  max-width: 100%;
}

.auth-otp input {
  width: 2.5rem;
  height: 2.85rem;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-mono);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
}

.auth-otp input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.auth-actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

.auth-actions--row {
  display: flex;
  gap: 0.55rem;
}

.auth-actions--row .auth-btn {
  width: auto;
  flex: 1;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
