/* Standalone pages (login, setup, error) and responsive rules for the app frame. */
.page-center {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--sp-7);
  background:
    radial-gradient(1200px 600px at 15% -10%, var(--accent-soft), transparent 60%),
    var(--surface-1);
}

.card {
  width: min(400px, 100%);
  padding: var(--sp-8);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface-2);
  box-shadow: var(--shadow-soft);
}

.card h1 {
  font-size: 22px;
  margin-bottom: var(--sp-3);
}

.card > p {
  color: var(--text-2);
}

.card form {
  display: grid;
  gap: var(--sp-6);
  margin-top: var(--sp-7);
}

.card .btn {
  width: 100%;
  height: 38px;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-7);
  color: var(--text-2);
  font-weight: 600;
}

.brand .mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--text-on-accent);
}

.error-code {
  font: 600 var(--fs-sm) / 1 var(--font-mono);
  color: var(--text-3);
  margin-bottom: var(--sp-4);
}

.error-card p + p {
  margin-top: var(--sp-7);
}

.only-narrow {
  display: none;
}

@media (max-width: 1180px) {
  .app,
  .app[data-right="closed"] {
    grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr);
  }

  .rightrail {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(var(--right-w), 90vw);
    z-index: 30;
    box-shadow: var(--shadow-pop);
  }

  .app[data-right="closed"] .rightrail {
    display: none;
  }
}

@media (max-width: 900px) {
  .app,
  .app[data-right="closed"] {
    grid-template-columns: minmax(0, 1fr);
  }

  .only-narrow {
    display: inline-grid;
  }

  .rail,
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 40;
    /* the sidebar starts after the rail, so it must travel past the rail too */
    transform: translateX(calc(-100% - var(--rail-w) - 16px));
    visibility: hidden;
    transition: transform var(--t-med) var(--ease-out), visibility var(--t-med);
  }

  .rail {
    left: 0;
    width: var(--rail-w);
  }

  .sidebar {
    left: var(--rail-w);
    width: min(var(--side-w), calc(100vw - var(--rail-w) - 24px));
    box-shadow: var(--shadow-pop);
  }

  .app[data-drawer="open"] .rail,
  .app[data-drawer="open"] .sidebar {
    transform: none;
    visibility: visible;
  }

  .side-foot .btn kbd {
    display: none;
  }
}

/* Print the note only, in dark ink on white, whatever the theme. */
@media print {
  :root {
    color-scheme: light;
  }

  html,
  body,
  .main {
    background: #fff !important;
  }

  .app,
  .app[data-right="closed"] {
    display: block;
    height: auto;
  }

  .rail,
  .sidebar,
  .rightrail,
  .topbar,
  .toasts,
  .doc-tags,
  .milkdown-block-handle,
  .milkdown-slash-menu,
  .milkdown-toolbar {
    display: none !important;
  }

  .main,
  .doc {
    overflow: visible;
    height: auto;
    padding: 0;
  }

  .doc,
  .doc * {
    color: #111 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .doc pre,
  .doc table,
  .doc img {
    break-inside: avoid;
  }

  .doc pre,
  .doc th,
  .doc td {
    border: 1px solid #ccc !important;
  }
}
