/* Calseda's look for the Hub's own pages (sign-in, home, server starting, errors). Loaded after JupyterHub's
   stylesheet; the colours, fonts and card follow the Calseda console (framework static/ui.css). The fonts ship
   beside this file (fonts/, Latin subsets, SIL Open Font License beside each), so nothing comes from the internet. */
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/figtree-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Code Pro";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-code-pro-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* The console's tokens. The Hub picks light or dark (data-bs-theme) from the system setting or its toggle. */
:root,
[data-bs-theme="light"] {
  --font-sans: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Source Code Pro", ui-monospace, "SF Mono", Menlo, "Cascadia Mono",
    Consolas, "Liberation Mono", monospace;
  --radius: 6px;
  --text-xs: 0.78125rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --gutter: 16px;

  --background: #edf0f4;
  --surface: #ffffff;
  --surface-muted: #f8f9fa;
  --border: #e2e5e9;
  --border-strong: #cdd2d8;
  --text-color: #14181f;
  --text-secondary: #3a4350;
  --text-muted: #59636f;
  --text-subtle: #646c78;
  --accent: #24579f;
  --accent-soft: #e7edf6;
  --danger-dot: #d0453a;
  --danger-text: #a52a21;
  --danger-bg: #fbe6e4;
  --neutral-bg: #edeff2;
}

[data-bs-theme="dark"] {
  --background: #080b0f;
  --surface: #131921;
  --surface-muted: #18202a;
  --border: #232c37;
  --border-strong: #2e3845;
  --text-color: #e5e8ec;
  --text-secondary: #b6c0cf;
  --text-muted: #9aa3ae;
  --text-subtle: #7f8995;
  --accent: #8aaee0;
  --accent-soft: #1a2638;
  --danger-dot: #e8635a;
  --danger-text: #f08a82;
  --danger-bg: #3a1714;
  --neutral-bg: #222a34;
  color-scheme: dark;
}

/* Bootstrap (the Hub's stylesheet) reads these */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --bs-body-font-family: var(--font-sans);
  --bs-body-font-size: var(--text-base);
  --bs-body-line-height: 1.5;
  --bs-font-monospace: var(--font-mono);
  --bs-body-bg: var(--background);
  --bs-body-color: var(--text-color);
  --bs-emphasis-color: var(--text-color);
  --bs-secondary-color: var(--text-muted);
  --bs-border-color: var(--border);
  --bs-border-radius: var(--radius);
  --bs-link-color: var(--accent);
  --bs-link-hover-color: var(--accent);
  --bs-heading-color: var(--text-color);
}

body {
  background: var(--background);
  color: var(--text-color);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
}

h1, h2, h3 {
  font-weight: 600;
  color: var(--text-color);
}

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

a:hover {
  text-decoration: underline;
}

pre, code {
  font-family: var(--font-mono);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hidden {
  display: none !important;
}

/* The bar at the top: the console's header */
.navbar.bg-body-tertiary {
  min-height: 44px;
  padding: 0;
  margin-bottom: 0 !important;
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border);
}

.calseda-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-color);
}

.calseda-brand:hover {
  color: var(--text-color);
  text-decoration: none;
}

.navbar .nav-link {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: var(--text-color);
  text-decoration: none;
}

#login_widget {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Buttons: the console's */
.btn {
  --bs-btn-padding-x: 12px;
  --bs-btn-padding-y: 0;
  --bs-btn-font-family: var(--font-sans);
  --bs-btn-font-size: var(--text-sm);
  --bs-btn-font-weight: 500;
  --bs-btn-line-height: 1.5;
  --bs-btn-border-radius: var(--radius);
  --bs-btn-color: var(--text-color);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-color: var(--text-color);
  --bs-btn-hover-bg: var(--surface-muted);
  --bs-btn-hover-border-color: var(--text-subtle);
  --bs-btn-active-color: var(--text-color);
  --bs-btn-active-bg: var(--surface-muted);
  --bs-btn-active-border-color: var(--text-subtle);
  --bs-btn-focus-box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn-sm {
  --bs-btn-padding-x: 10px;
  --bs-btn-font-size: var(--text-xs);
  height: 30px;
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--accent);
  --bs-btn-hover-border-color: var(--accent);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--accent);
  --bs-btn-active-border-color: var(--accent);
}

.btn-primary:hover {
  filter: brightness(1.08);
}

/* In dark mode the accent is a light blue meant for text: the console's pairing, accent text on the soft accent */
[data-bs-theme="dark"] .btn-primary {
  --bs-btn-color: var(--accent);
  --bs-btn-bg: var(--accent-soft);
  --bs-btn-border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  --bs-btn-hover-color: var(--accent);
  --bs-btn-hover-bg: var(--accent-soft);
  --bs-btn-hover-border-color: var(--accent);
  --bs-btn-active-color: var(--accent);
  --bs-btn-active-bg: var(--accent-soft);
  --bs-btn-active-border-color: var(--accent);
}

[data-bs-theme="dark"] .btn-primary:hover {
  filter: none;
}

.btn-danger {
  --bs-btn-color: var(--danger-text);
  --bs-btn-bg: var(--danger-bg);
  --bs-btn-border-color: var(--danger-bg);
  --bs-btn-hover-color: var(--danger-text);
  --bs-btn-hover-bg: var(--danger-bg);
  --bs-btn-hover-border-color: var(--danger-text);
}

/* The card: the console's sign-in card */
.calseda-centre {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
}

.calseda-page {
  display: flex;
  justify-content: center;
  padding: 48px var(--gutter);
}

.calseda-card {
  width: min(420px, 100%);
  padding: 28px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.calseda-card.narrow {
  width: min(360px, 100%);
}

.calseda-card.wide {
  width: min(600px, 100%);
}

.calseda-card h1 {
  font-size: 17px;
  margin: 0 0 14px;
}

.calseda-card p {
  margin: 0 0 16px;
  color: var(--text-secondary);
}

.calseda-card .muted {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.calseda-card .error {
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.calseda-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.calseda-card .wide-button {
  width: 100%;
}

/* Server starting: a thin bar and the event log */
.calseda-card .progress {
  height: 6px;
  margin: 0 0 12px;
  background: var(--neutral-bg);
  border-radius: 3px;
}

.calseda-card .progress-bar {
  background: var(--accent);
}

.calseda-card .progress-bar.bg-danger {
  background: var(--danger-dot) !important;
}

.calseda-card #progress-message {
  min-height: 1.5em;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.calseda-card summary {
  font-size: var(--text-sm);
  color: var(--text-muted);
  cursor: pointer;
}

#progress-log {
  max-height: 260px;
  overflow: auto;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.announcement {
  margin-top: var(--gutter);
}

#dark-theme-toggle {
  --bs-btn-border-color: transparent;
  margin-right: 10px;
  color: var(--text-muted);
}
