/*
  The hub's pages in the Charmers AI brand (specs/in-progress/hub-page-style.md).

  The values are the brand guide's as charmers.ai applies them
  (CharmersAIMarketingWebsite: branding/tokens.css, website/src/styles/global.css,
  website/src/components/EnquiryForm.astro and Header.astro). This file is the
  same on every hub; hub/templates/page.html sets only the primary button's
  colours, which are the tenant's (--accent, --on-accent, --accent-hover,
  --accent-pressed). The defaults below are our own hubs' colours.

  The admin page adds its own copy of Bootstrap after this file, so rules that
  must beat Bootstrap start with `html`, which makes them more specific.
  JupyterHub's pages use Bootstrap 5.3, which reads most of its colours,
  sizes and fonts from --bs-* variables; those are set here where we can.

  The image copies this file and fonts/ to JupyterHub's static folder, as
  /hub/static/charmersai/ (hub/Dockerfile).
*/

/* --- Fonts: served by the hub, from the @fontsource packages charmers.ai uses (SIL Open Font License) --- */
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/atkinson-hyperlegible-next-latin-400-normal.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: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/atkinson-hyperlegible-next-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/atkinson-hyperlegible-next-latin-700-normal.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: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/atkinson-hyperlegible-next-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* A variable font (weights 200 to 800, and optical size): the headings use weight 650. */
@font-face {
  font-family: "Bricolage Grotesque Variable"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(fonts/bricolage-grotesque-latin-opsz-normal.woff2) format("woff2-variations");
  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: "Bricolage Grotesque Variable"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(fonts/bricolage-grotesque-latin-ext-opsz-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Colours, type and shape --- */
html:root, html[data-bs-theme=light] {
  --night: #10241F; --lamplight: #FFC42E; --pine: #1D6B4F; --mist: #F2F5F1; --slate: #51605B;
  --line: #D5DDD7; --signal: #B3261E; --field-border: #8A9A93;
  /* The primary button's colours: page.html replaces these with the tenant's. */
  --accent: var(--lamplight); --on-accent: var(--night); --accent-hover: #FFD35C; --accent-pressed: #FFD35C;
  --font-display: "Bricolage Grotesque Variable", "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-text: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", Verdana, system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1); --duration: 180ms;

  --bs-body-font-family: var(--font-text); --bs-body-font-size: 1rem; --bs-body-font-weight: 400;
  --bs-body-line-height: 1.55;
  --bs-body-color: #10241F; --bs-body-color-rgb: 16, 36, 31; --bs-body-bg: #fff; --bs-body-bg-rgb: 255, 255, 255;
  --bs-emphasis-color: #10241F; --bs-emphasis-color-rgb: 16, 36, 31; --bs-heading-color: inherit;
  --bs-secondary-color: #51605B; --bs-secondary-color-rgb: 81, 96, 91;
  --bs-tertiary-bg: #F2F5F1; --bs-tertiary-bg-rgb: 242, 245, 241;
  --bs-border-color: #D5DDD7;
  --bs-link-color: #1D6B4F; --bs-link-color-rgb: 29, 107, 79;
  --bs-link-hover-color: #1D6B4F; --bs-link-hover-color-rgb: 29, 107, 79;
  --bs-danger: #B3261E; --bs-danger-rgb: 179, 38, 30; --bs-danger-text-emphasis: #B3261E;
  --bs-success: #1D6B4F; --bs-success-rgb: 29, 107, 79;
  --bs-focus-ring-color: #1D6B4F;
  --bs-border-radius: 6px; --bs-border-radius-sm: 6px; --bs-border-radius-lg: 12px;
  color-scheme: light;
}
html body { -webkit-text-size-adjust: 100%; }

html h1, html h2, html h3 {
  font-family: var(--font-display); font-weight: 650; line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance;
}
html strong, html b { font-weight: 700; }
/* Emphasis is weight, never italics. Icons (Font Awesome's <i class="fa ...">) are left alone. */
html em, html cite, html i:not([class]) { font-style: normal; font-weight: 700; }

/* --- Links: Pine on every hub, underlined as on charmers.ai --- */
html a { color: var(--pine); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
html a:hover { color: var(--pine); text-decoration-thickness: 2px; }

/* --- Focus: a 3 px Pine outline, for the keyboard only; 3 px outside buttons and links, 1 px outside fields --- */
html :focus-visible { outline: 3px solid var(--pine); outline-offset: 3px; box-shadow: none; }
html a:focus-visible:not(.btn) { border-radius: 2px; }
/* Bootstrap takes the outline off these and draws a glow instead. */
html .nav-link:focus-visible, html .form-check-input:focus-visible, html .navbar-toggler:focus-visible,
html .page-link:focus-visible, html .btn-close:focus-visible {
  outline: 3px solid var(--pine); outline-offset: 3px; box-shadow: none;
}

/* --- Fields, as the form on charmers.ai/pilot --- */
html .form-control:not(.btn), html .form-select {
  color: var(--night); background-color: #fff; font-size: 1rem; line-height: 1.55;
  border: 1px solid var(--field-border); border-radius: 6px;
}
html .form-control:not(.btn)::placeholder { color: var(--slate); opacity: 1; }
html .form-control:not(.btn):focus, html .form-select:focus { border-color: var(--pine); box-shadow: none; }
html .form-control:not(.btn):focus-visible, html .form-select:focus-visible {
  outline: 3px solid var(--pine); outline-offset: 1px;
}
html .form-check-input { border-color: var(--field-border); }
html .form-check-input:checked { background-color: var(--pine); border-color: var(--pine); }
html .form-check-input:focus { border-color: var(--pine); box-shadow: none; }

/* --- Buttons, as charmers.ai's .button. Bootstrap draws every .btn from these variables. --- */
html .btn {
  --bs-btn-padding-x: 24px; --bs-btn-padding-y: 0; --bs-btn-font-family: var(--font-text);
  --bs-btn-font-size: 1rem; --bs-btn-font-weight: 700; --bs-btn-line-height: 1;
  --bs-btn-border-width: 1px; --bs-btn-border-radius: 6px; --bs-btn-box-shadow: none;
  --bs-btn-disabled-opacity: 0.6; --bs-btn-focus-box-shadow: none;
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
  box-shadow: none; text-decoration: none;
  transition: background-color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
/* The smaller button, as in charmers.ai's header: in a table's rows, and "Stop Server" while a workspace starts. */
html .btn-sm, html .btn-xs { min-height: 40px; }
html .btn:focus-visible { outline: 3px solid var(--pine); outline-offset: 3px; box-shadow: none; }
/* Disabled, as the site's form button while it sends. */
html .btn:disabled { pointer-events: auto; cursor: progress; }

/* The form pages' buttons also have Bootstrap's .form-control, which would make them as wide as the
   form and white while they have focus. A form's button is as wide as its text. */
html .btn.form-control { width: auto; }
html .btn.form-control:focus {
  color: var(--bs-btn-color); background-color: var(--bs-btn-bg); border-color: var(--bs-btn-border-color); box-shadow: none;
}
html .btn.form-control:hover {
  color: var(--bs-btn-hover-color); background-color: var(--bs-btn-hover-bg); border-color: var(--bs-btn-hover-border-color);
}

/* Primary: the accent, which is the tenant's colour on a tenant's hub. */
html .btn-jupyter, html .btn-primary, html .btn-success {
  --bs-btn-color: var(--on-accent); --bs-btn-bg: var(--accent); --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--on-accent); --bs-btn-hover-bg: var(--accent-hover); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--on-accent); --bs-btn-active-bg: var(--accent-pressed); --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: var(--on-accent); --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: transparent;
}
/* Secondary: Pine text and a Pine border, as the brand guide's secondary button. */
html .btn-outline-secondary, html .btn-light, html .btn-secondary, html .btn-outline-primary {
  --bs-btn-color: var(--pine); --bs-btn-bg: transparent; --bs-btn-border-color: var(--pine);
  --bs-btn-hover-color: var(--pine); --bs-btn-hover-bg: rgb(29 107 79 / 0.08); --bs-btn-hover-border-color: var(--pine);
  --bs-btn-active-color: var(--pine); --bs-btn-active-bg: rgb(29 107 79 / 0.14); --bs-btn-active-border-color: var(--pine);
  --bs-btn-disabled-color: var(--pine); --bs-btn-disabled-bg: transparent; --bs-btn-disabled-border-color: var(--pine);
}
/* Danger: Signal text and a Signal border. */
html .btn-danger, html .btn-outline-danger {
  --bs-btn-color: var(--signal); --bs-btn-bg: transparent; --bs-btn-border-color: var(--signal);
  --bs-btn-hover-color: var(--signal); --bs-btn-hover-bg: rgb(179 38 30 / 0.08); --bs-btn-hover-border-color: var(--signal);
  --bs-btn-active-color: var(--signal); --bs-btn-active-bg: rgb(179 38 30 / 0.14); --bs-btn-active-border-color: var(--signal);
  --bs-btn-disabled-color: var(--signal); --bs-btn-disabled-bg: transparent; --bs-btn-disabled-border-color: var(--signal);
}

/* --- The bar along the top: charmers.ai's header, with the hub's logo --- */
html .navbar {
  --bs-tertiary-bg-rgb: 255, 255, 255; --bs-navbar-color: var(--night); --bs-navbar-hover-color: var(--pine);
  --bs-navbar-active-color: var(--night); --bs-navbar-padding-y: 0; --bs-navbar-nav-link-padding-x: 0;
  min-height: 64px; border-bottom: 1px solid var(--line);
}
html .navbar > .container-fluid { min-height: 64px; padding-inline: 24px; }
html #jupyterhub-logo { margin: 0; padding-block: 12px; }
html #jupyterhub-logo a { display: block; }
html #jupyterhub-logo .jpy-logo { display: block; height: 38px; width: auto; margin: 0; }
html .navbar-nav { gap: 8px 24px; align-items: center; }
/* JupyterHub puts Token, Admin and Add a participant on the left; on charmers.ai the links are on the right. */
html #thenavbar { justify-content: flex-end; }
html #thenavbar > .me-auto { margin-right: 24px !important; }
html #thenavbar > .me-2 { margin-right: 0 !important; }
html .navbar-nav > li:has(> #dark-theme-toggle[hidden]) { display: none; }
html .navbar-nav .nav-link, html #logout, html #login {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 0;
  color: var(--night); background: none; border: 0; border-radius: 2px;
  font: 400 1rem / 1.2 var(--font-text); text-decoration: none;
}
html .navbar-nav .nav-link:hover, html .navbar-nav .nav-link:focus, html #logout:hover, html #login:hover {
  color: var(--pine); background: none; text-decoration: underline; text-decoration-thickness: 1px;
}
html #logout .fa { display: none; }
html #login_widget { display: inline-flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; color: var(--slate); }
html .navbar-toggler { min-height: 44px; border: 1px solid var(--line); border-radius: 6px; color: var(--night); }
html .navbar-toggler:focus { box-shadow: none; }
@media (max-width: 575.98px) {
  html .navbar > .container-fluid { padding-inline: 16px; }
  html #thenavbar > .me-auto { margin-right: 0 !important; }
  html #thenavbar .navbar-nav { align-items: flex-start; gap: 0; padding-bottom: 12px; }
}

/* --- Text shared by the pages --- */
/* A sentence that belongs to the whole page: charmers.ai's lead paragraph. */
html .hub-lede { font-size: 1.25rem; line-height: 1.5; }
/* Notes such as "Problems? Email ...". */
html .hub-note { font-size: 0.875rem; color: var(--slate); }

/* --- The form pages: join, login, sign-in link, set-password, password, add a late participant ---
   One 448 px column, 48 px below the bar. JupyterHub's form header becomes the page heading and
   its form body a Mist card. The forms are left out of the layout (display: contents), so that a
   lead paragraph placed before the form in the markup (login.html) shows under the heading. */
html #login-main {
  display: grid; gap: 24px; align-content: start;
  width: 100%; max-width: calc(448px + 32px); height: auto; margin: 24px auto 48px; padding: 0 16px;
}
html #login-main form { display: contents; }
html #login-main > p, html #login-main form > p { margin: 0; }
html #login-main .auth-form-header {
  order: -1; padding: 0; color: var(--night); background: none; border: 0; border-radius: 0;
}
html #login-main .auth-form-header > h1 {
  margin: 0; font: 650 clamp(39px, 6.5vw, 61px) / 1.1 var(--font-display); letter-spacing: -0.02em;
}
/* The card, as charmers.ai's .card: Mist, 12 px corners, 24 px padding, no border or shadow. */
html #login-main .auth-form-body {
  display: flex; flex-direction: column; gap: 24px;
  width: 100%; margin: 0; padding: 24px; background: var(--mist); border: 0; border-radius: 12px;
}
html #login-main .auth-form-body > * { margin: 0; }
/* Labels above their fields, 8 px apart; fields 24 px apart. */
html #login-main .auth-form-body label { display: block; font-weight: 700; }
html #login-main .auth-form-body label + * { margin-top: -16px; }
html #login-main .form-control:not(.btn) { min-height: 48px; padding: 12px 16px; }
html #login-main .auth-form-body .btn, html #login-main .feedback-container { align-self: flex-start; }
html #login-main .auth-form-body .btn + .btn { margin-top: -8px; }
/* The show-password button, inside the password field. */
html #login-main .input-group { position: relative; flex-wrap: nowrap; }
html #login-main .input-group > .form-control { border-radius: 6px; padding-right: 52px; }
html #login-main #toggle_password_visibility {
  position: absolute; top: 1px; right: 1px; bottom: 1px; z-index: 6; width: 48px;
  display: flex; align-items: center; justify-content: center; margin: 0; padding: 0;
  color: var(--slate); background: transparent; border: 0; border-radius: 0 5px 5px 0;
}
/* Messages, at the top of the card: errors as charmers.ai's form errors. */
html #login-main .login_error { color: var(--signal); font-size: 0.875rem; font-weight: 700; text-align: left; }
html #login-main .login_message { color: var(--night); }

/* --- The other pages: home, starting, stopping, not running, errors and workspace restart ---
   The same bar, heading and cards as the form pages, in a 640 px column: the width of
   charmers.ai's form, with room for a workspace's event log. */
html .hub-page {
  display: grid; gap: 24px; align-content: start;
  width: 100%; max-width: calc(640px + 32px); margin: 24px auto 48px; padding: 0 16px;
}
html .hub-page > p { margin: 0; }
html .hub-heading {
  margin: 0; color: var(--night); font: 650 clamp(39px, 6.5vw, 61px) / 1.1 var(--font-display);
  letter-spacing: -0.02em;
}
html .hub-card {
  display: grid; gap: 24px; align-content: start; min-width: 0;
  padding: 24px; background: var(--mist); border-radius: 12px;
}
html .hub-card > p, html .hub-card > div > p { margin: 0; }
html .hub-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
html .hub-actions form { display: contents; }

/* While a workspace starts: the progress bar in the accent colour on white, 8 px high. */
html .hub-card .progress {
  --bs-progress-height: 8px; --bs-progress-bg: #fff; --bs-progress-border-radius: 4px;
  --bs-progress-bar-bg: var(--accent); border: 1px solid var(--line);
}
html .hub-card .progress-bar.bg-danger { background-color: var(--signal) !important; }
html #progress-message { color: var(--slate); }
html #progress-message:empty { display: none; }
html #progress-details summary { color: var(--slate); }
html #progress-log { margin-top: 8px; }
html .progress-log-event { padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.875rem; overflow-wrap: anywhere; }
html .hub-spinner { color: var(--slate); }
html #stop-server-status.alert { margin-bottom: 0; }

/* Workspace restart (hub/templates/workspace-restart/): its steps, in Pine, Signal for a failure. */
html .wr-page .hub-heading:focus { outline: none; }
html .wr-page .wr-eyebrow { margin-bottom: -16px; }
html .wr-live { display: grid; gap: 24px; }
html .wr-live > p { margin: 0; }
html .wr-kept p { margin: 0; }
html .wr-kept ul { margin: 8px 0 0; padding-left: 1.25em; }
html .wr-kept li + li { margin-top: 4px; }
/* Bootstrap draws code in pink, which is not in the brand: the text colour instead. */
html .wr-kept code, html #wr-lost code { color: var(--night); overflow-wrap: anywhere; }
html .wr-steps { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
html .wr-steps li { display: flex; align-items: center; gap: 12px; padding: 4px 0; color: var(--slate); }
html .wr-steps li::before {
  content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--field-border); box-sizing: border-box;
}
html .wr-steps li[data-state="current"] { color: var(--night); font-weight: 700; }
html .wr-steps li[data-state="current"]::before {
  border-color: var(--pine); border-right-color: transparent; animation: wr-spin 1s linear infinite;
}
html .wr-steps li[data-state="done"]::before { background: var(--pine); border-color: var(--pine); }
html .wr-steps li[data-state="failed"] { color: var(--signal); font-weight: 700; }
html .wr-steps li[data-state="failed"]::before { border-color: var(--signal); }
html .wr-note { margin: 0; padding: 12px 16px; background: #fff; border-radius: 6px; }
@keyframes wr-spin { to { transform: rotate(360deg); } }

/* --- The admin and token pages keep their own layout, a wide table, with the bar, type, colours,
   corners and focus above. The admin page's buttons sit in the table's rows, so all of them are
   the smaller button, 40 px. Its own style sheet draws a grey border on .btn-light and colours a
   selected property orange. --- */
html #react-admin-hook .btn { min-height: 40px; white-space: nowrap; }
html .form-label { font-weight: 700; }
html #react-admin-hook .card {
  --bs-card-border-color: var(--line); --bs-card-cap-bg: var(--mist); --bs-card-border-radius: 12px;
}
html .server-dashboard-container .btn { border: var(--bs-btn-border-width) solid var(--bs-btn-border-color); }
html .properties-table .item.selected, html .properties-table-keyvalues .item.selected {
  color: #fff; background-color: var(--pine);
}

@media (prefers-reduced-motion: reduce) {
  html .btn { transition: none; }
  html .wr-steps li[data-state="current"]::before { animation: none; border-right-color: var(--pine); }
}
