/* =========================================================
   Jorstr Landing Page
   ========================================================= */

:root {
  color-scheme: dark;

  --page-bg:
    radial-gradient(
      circle at top,
      rgba(112, 83, 255, 0.18),
      transparent 34%
    ),
    linear-gradient(
      180deg,
      #14111f 0%,
      #0d0b14 100%
    );

  --panel-bg: rgba(31, 27, 45, 0.92);
  --panel-bg-hover: rgba(38, 33, 55, 0.96);

  --border: rgba(151, 128, 255, 0.22);
  --border-strong: rgba(151, 128, 255, 0.48);

  --text: #f4f1ff;
  --text-soft: #c8c0df;
  --text-muted: #9189a7;

  --accent: #8468ff;
  --accent-hover: #967fff;
  --accent-soft: rgba(132, 104, 255, 0.14);

  --success: #4fd28a;
  --success-soft: rgba(79, 210, 138, 0.14);

  --danger: #ff7c92;

  --shadow:
    0 18px 50px rgba(0, 0, 0, 0.28);

  --radius-large: 20px;
  --radius-medium: 14px;
  --radius-small: 11px;

  --transition-fast: 160ms ease;
  --transition-medium: 240ms ease;
}


/* =========================================================
   Base
   ========================================================= */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;

  background: var(--page-bg);
  background-attachment: fixed;

  color: var(--text);

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}


/* =========================================================
   Accessibility
   ========================================================= */

.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 Layout
   ========================================================= */

.identity-demo {
  width: min(100% - 32px, 1480px);
  min-height: 100vh;

  margin: 0 auto;
  padding: 16px 0 26px;

  display: flex;
  flex-direction: column;
}

.identity-experience {
  width: min(100%, 760px);
  margin: 0 auto;
}


/* =========================================================
   Header
   ========================================================= */

.demo-header {
  max-width: 100%;
  margin: 0 auto 26px;

  text-align: left;
}

.demo-header.jorstr-page-header {
  grid-template-columns:
    auto
    minmax(0, 1fr)
    auto;
}

.demo-header .jorstr-header-brand {
  grid-column: 1;
}

.demo-header .jorstr-header-nav {
  grid-column: 2;
  justify-self: center;
}

.demo-header .jorstr-header-context {
  grid-column: 1 / 3;
}

.demo-header .jorstr-header-identity {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
}

.jorstr-title {
  margin: 0;

  font-size: 1.35rem;
  font-weight: 850;

  letter-spacing: 0.035em;
  line-height: 1;
}

.jorstr-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;

  margin: 18px 0 0;

  color: #b6a7ff;

  font-size: clamp(0.9rem, 2vw, 1.02rem);
  font-weight: 760;

  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.jorstr-actions span[aria-hidden="true"] {
  color: rgba(182, 167, 255, 0.48);
}

.demo-description {
  max-width: 560px;
  margin: 0;

  color: var(--text-soft);

  font-size: clamp(0.98rem, 2vw, 1.1rem);
}


/* =========================================================
   Shared Panels
   ========================================================= */

.demo-panel {
  padding: 24px;

  background: var(--panel-bg);

  border: 1px solid var(--border);
  border-radius: var(--radius-large);

  box-shadow: var(--shadow);

  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  animation:
    panel-enter
    var(--transition-medium)
    both;
}

.demo-panel + .demo-panel {
  margin-top: 14px;
}

.panel-heading {
  margin-bottom: 18px;

  text-align: center;
}

.panel-heading h2 {
  margin: 0;

  font-size: 1.2rem;
  line-height: 1.2;
}

.panel-heading p {
  margin: 7px 0 0;

  color: var(--text-soft);

  font-size: 0.94rem;
}


/* =========================================================
   Connection Panel
   ========================================================= */

.connection-panel {
  min-height: 0;
}

.landing-primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;

  margin-top: 22px;
}

.landing-action-button {
  min-height: 68px;

  font-size: 1.02rem;
}

.guide-link-button {
  display: block;

  margin: 20px auto 0;

  color: #c7bbff;

  background: transparent;
  border: 0;

  font-size: 0.9rem;
  font-weight: 760;

  cursor: pointer;

  text-decoration: underline;
  text-underline-offset: 5px;
}

.guide-link-button:hover {
  color: #ffffff;
}

.remembered-identity-entry {
  text-align: center;
}

.remembered-identity-entry h3,
.identity-guide-heading h3 {
  margin: 0;

  color: var(--text);

  font-size: 0.98rem;
  font-weight: 800;
}

.remember-npub-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;

  margin-top: 12px;
}

.remember-npub-input {
  min-height: 48px;
  min-width: 0;
  padding: 12px 14px;

  color: var(--text);

  background: rgba(10, 8, 18, 0.5);

  border: 1px solid var(--border);
  border-radius: var(--radius-small);

  outline: none;

  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.remember-npub-input::placeholder {
  color: rgba(200, 192, 223, 0.54);
}

.remember-npub-input:focus {
  border-color: rgba(167, 148, 255, 0.72);

  box-shadow:
    0 0 0 3px rgba(132, 104, 255, 0.16);
}

.remember-npub-button {
  white-space: nowrap;
}

.guest-message {
  margin: 12px 0 0;

  color: var(--text-muted);

  font-size: 0.88rem;
}

.guest-message strong {
  color: var(--text-soft);
}

.identity-guide-heading {
  text-align: center;
}

.identity-guide-heading .guest-message {
  margin-top: 6px;
}

.identity-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;

  margin-top: 16px;
}

.identity-guide-item {
  display: grid;
  grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
  gap: 12px;
  align-items: center;

  min-width: 0;
  padding: 12px;

  background: rgba(255, 255, 255, 0.026);

  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-small);
}

.identity-guide-dialog {
  --jorstr-header-control-height: 40px;
  --jorstr-header-avatar-size: 30px;
  --jorstr-header-ring-size: 2px;

  max-height: min(720px, calc(100vh - 32px));
  overflow-y: auto;
}

.identity-guide-control {
  justify-self: start;
  cursor: default;
  pointer-events: none;
}

.identity-guide-control.jorstr-identity-control,
.identity-guide-control-anonymous {
  min-height: var(--jorstr-header-control-height);
  max-width: 100%;
}

.identity-guide-control .jorstr-identity-avatar {
  flex: 0 0 var(--jorstr-header-avatar-size);
  width: var(--jorstr-header-avatar-size);
  height: var(--jorstr-header-avatar-size);
}

.identity-guide-item h3 {
  margin: 0;

  font-size: 0.88rem;
  font-weight: 820;
}

.identity-guide-item p {
  margin: 3px 0 0;

  color: var(--text-muted);

  font-size: 0.8rem;
  line-height: 1.35;
}

.identity-guide-item .jorstr-identity-avatar img {
  width: 100%;
  height: 100%;

  object-fit: cover;
}


/* =========================================================
   Buttons
   ========================================================= */

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 12px 18px;

  border-radius: var(--radius-small);

  font-weight: 750;

  cursor: pointer;

  transition:
    transform var(--transition-fast),
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    box-shadow var(--transition-fast),
    opacity var(--transition-fast);
}

.primary-button {
  color: #ffffff;

  background:
    linear-gradient(
      180deg,
      var(--accent-hover),
      var(--accent)
    );

  border: 1px solid rgba(255, 255, 255, 0.16);

  box-shadow:
    0 10px 22px rgba(104, 78, 237, 0.3);
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);

  box-shadow:
    0 14px 28px rgba(104, 78, 237, 0.4);
}

.secondary-button {
  color: var(--text);

  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.045),
      rgba(255, 255, 255, 0.02)
    );

  border: 1px solid var(--border-strong);

  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.16);
}

.secondary-button:hover:not(:disabled) {
  transform: translateY(-2px);

  background: var(--accent-soft);
  border-color: rgba(163, 142, 255, 0.72);
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: translateY(0);
}

.primary-button:focus-visible,
.secondary-button:focus-visible {
  outline: 3px solid rgba(167, 148, 255, 0.42);
  outline-offset: 3px;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.58;
}


/* =========================================================
   Dialogs
   ========================================================= */

.landing-dialog {
  width: min(100% - 32px, 540px);
  padding: 24px;

  color: var(--text);

  background: rgba(31, 27, 45, 0.98);

  border: 1px solid var(--border-strong);
  border-radius: var(--radius-large);

  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.48);
}

.landing-dialog::backdrop {
  background: rgba(6, 5, 12, 0.72);
  backdrop-filter: blur(5px);
}

.landing-dialog h2 {
  margin: 0 32px 16px 0;

  font-size: 1.35rem;
  line-height: 1.15;
}

.landing-dialog p {
  margin: 0 0 13px;

  color: var(--text-soft);

  font-size: 0.94rem;
}

.dialog-close-form {
  position: absolute;
  top: 14px;
  right: 14px;
}

.dialog-close-button {
  display: grid;
  place-items: center;

  width: 32px;
  height: 32px;

  color: var(--text-muted);

  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;

  cursor: pointer;
}

.dialog-close-button:hover {
  color: var(--text);
}

.landing-dialog .remember-npub-form {
  display: grid;
  grid-template-columns: 1fr;
}

.landing-dialog label {
  color: var(--text);

  font-size: 0.88rem;
  font-weight: 760;
}

.dialog-helper {
  margin-bottom: 0;
}

.dialog-primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: min(100%, 220px);
  margin-top: 4px;

  text-decoration: none;
}

.dialog-placeholder {
  margin-top: 18px;
  padding-top: 14px;

  color: var(--text-muted);

  border-top: 1px solid rgba(151, 128, 255, 0.14);
}

.dialog-placeholder span {
  font-size: 0.84rem;
}

.identity-guide-dialog {
  width: min(100% - 32px, 760px);
}


/* =========================================================
   Connected Identity
   ========================================================= */

.identity-panel {
  padding: 20px 24px;
}

.identity-card {
  display: grid;

  grid-template-columns:
    auto
    minmax(0, 1fr)
    180px;

  gap: 18px;
  align-items: center;
}

.identity-avatar-wrap {
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 1px solid rgba(151, 128, 255, 0.42);
  border-radius: 50%;
  background: rgba(132, 104, 255, 0.16);
}

.identity-avatar,
.identity-avatar-fallback {
  width: 100%;
  height: 100%;
}

.identity-avatar {
  display: block;
  object-fit: cover;
}

.identity-avatar-fallback {
  display: grid;
  place-items: center;
  color: #f4f1ff;
  font-size: 1.6rem;
  font-weight: 850;
  background:
    linear-gradient(
      135deg,
      rgba(132, 104, 255, 0.82),
      rgba(52, 36, 126, 0.92)
    );
}

.identity-details {
  min-width: 0;
  text-align: left;
}

.identity-details h2 {
  margin: 0;

  font-size: 1.9rem;
  line-height: 1.05;
}

.identity-nip05 {
  margin-top: 8px;

  color: #b9f5d2;

  font-size: 0.92rem;
}

.identity-npub {
  display: none !important;
}

.identity-about {
  display: -webkit-box;

  margin-top: 10px;

  color: var(--text-soft);

  font-size: 0.92rem;

  overflow: hidden;

  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.identity-actions {
  display: flex;

  flex-direction: column;
  align-items: center;
}

.explore-button {
  display: flex;

  width: 170px;
  height: 72px;

  align-items: center;
  justify-content: center;

  text-decoration: none;

  font-size: 1.05rem;
  font-weight: 800;
}

.disconnect-button {
  margin-top: 10px;

  background: transparent;
  border: 0;

  color: var(--text-muted);

  font-size: 0.84rem;

  cursor: pointer;
}

.disconnect-button:hover {
  color: var(--text-soft);

  text-decoration: underline;
}

/* =========================================================
   Status
   ========================================================= */

.status-panel {
  margin-top: 14px;
}

.connection-status {
  position: relative;

  margin: 0;
  padding: 11px 15px 11px 40px;

  color: var(--text-soft);

  background: rgba(255, 255, 255, 0.022);

  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-medium);

  font-size: 0.88rem;
}

.connection-status::before {
  position: absolute;
  top: 50%;
  left: 15px;

  width: 8px;
  height: 8px;

  background: var(--text-muted);

  border-radius: 50%;

  content: "";

  transform: translateY(-50%);

  box-shadow:
    0 0 0 5px rgba(145, 137, 167, 0.1);
}

.connection-status.is-working::before {
  background: var(--accent);

  animation:
    status-pulse
    1.2s
    ease-in-out
    infinite;
}

.connection-status.is-success::before {
  background: var(--success);

  box-shadow:
    0 0 0 5px var(--success-soft);
}

.connection-status.is-error {
  color: #ffd1d9;

  border-color: rgba(255, 124, 146, 0.34);
}

.connection-status.is-error::before {
  background: var(--danger);

  box-shadow:
    0 0 0 5px rgba(255, 124, 146, 0.12);
}


/* =========================================================
   Footer
   ========================================================= */

.demo-footer {
  margin-top: auto;
  padding-top: 26px;

  text-align: center;
}

.demo-footer p {
  margin: 0;

  color: rgba(145, 137, 167, 0.72);

  font-size: 0.76rem;
  letter-spacing: 0.06em;
}


/* =========================================================
   Motion
   ========================================================= */

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(7px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes status-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 4px rgba(132, 104, 255, 0.12);
  }

  50% {
    box-shadow:
      0 0 0 8px rgba(132, 104, 255, 0.03);
  }
}


/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 680px) {
  .identity-demo {
    width: min(100% - 20px, 1480px);
    padding: 16px 0 20px;
  }

  .identity-experience {
    width: min(100%, 760px);
  }

  .demo-header {
    margin-bottom: 21px;
  }

  .demo-header.jorstr-page-header {
    grid-template-columns:
      minmax(0, 1fr)
      auto;
  }

  .demo-header .jorstr-header-brand {
    grid-column: 1;
    grid-row: 1;
  }

  .demo-header .jorstr-header-identity {
    grid-column: 2;
    grid-row: 1;
  }

  .demo-header .jorstr-header-nav,
  .demo-header .jorstr-header-context {
    grid-column: 1 / -1;
  }

  .jorstr-actions {
    gap: 7px;

    font-size: 0.82rem;
    letter-spacing: 0.05em;
  }

  .demo-description {
    margin-top: 11px;
  }

  .demo-panel {
    padding: 18px;

    border-radius: 17px;
  }

  .landing-primary-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .remember-npub-form,
  .identity-guide-grid {
    grid-template-columns: 1fr;
  }

  .remember-npub-button {
    width: 100%;
  }

  .landing-action-button {
    min-height: 60px;
  }

  .guest-entry {
    margin-top: 17px;
  }

  .identity-card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
  }

  .identity-avatar-wrap {
    width: 66px;
    height: 66px;
  }

  .identity-actions {
    grid-column: 1 / -1;
    margin-top: 4px;
  }

  .identity-guide-item {
    grid-template-columns: 1fr;
  }

  .explore-button {
    aspect-ratio: auto;
    min-height: 62px;
  }

  .remote-connection-qr {
    width: 210px;
    min-height: 210px;

    padding: 14px;
  }

  .remote-connection-qr canvas,
  .remote-connection-qr img {
    width: 182px;
    height: 182px;
  }
}

@media (max-width: 420px) {
  .jorstr-title {
    font-size: 1.28rem;
  }

  .jorstr-actions {
    flex-wrap: wrap;
  }

  .demo-description {
    font-size: 0.96rem;
  }

  .identity-card {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
  }

  .identity-avatar-wrap {
    width: 58px;
    height: 58px;
  }

  .identity-details h2 {
    font-size: 1.4rem;
  }

  .identity-about {
    font-size: 0.84rem;
  }

  .remote-connection-qr {
    width: min(100%, 200px);
    min-height: 0;
  }

  .remote-connection-qr canvas,
  .remote-connection-qr img {
    width: min(172px, 100%);
    height: auto;
  }

  .connection-status {
    padding-right: 12px;

    font-size: 0.82rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;

    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;

    transition-duration: 0.01ms !important;
  }
}
