/*
 * Yote website layer: every server-rendered page a signed-out or signed-in person can
 * reach outside the app (login, 404, 500, "not permitted", notices).
 *
 * Loaded through web_include_css only, so nothing here reaches the administrator desk.
 * Part 1 re-points the engine's own CSS variables at Yote tokens, so the widgets those
 * pages render (buttons, inputs, alerts) inherit the brand instead of being re-skinned
 * one selector at a time. Part 2 styles what Yote draws itself.
 *
 * Tokens only: docs/DESIGN.md §3. No hex values in this file.
 */

/* ==================================================================== */
/* 1. Bridge: engine variables -> Yote tokens                            */
/* ==================================================================== */

:root {
  --font-stack: var(--y-font-ui);

  /* surfaces */
  --bg-color: var(--y-bg);
  --fg-color: var(--y-surface);
  --card-bg: var(--y-surface);
  --modal-bg: var(--y-surface-raised);
  --popover-bg: var(--y-surface-raised);
  --toast-bg: var(--y-surface-raised);
  --control-bg: var(--y-surface);
  --control-bg-on-gray: var(--y-surface-sunken);
  --subtle-accent: var(--y-bg-subtle);
  --subtle-fg: var(--y-surface-sunken);
  --fg-hover-color: var(--y-surface-hover);
  --highlight-color: var(--y-surface-hover);
  --disabled-control-bg: var(--y-surface-sunken);
  --input-disabled-bg: var(--y-surface-sunken);

  /* text */
  --text-color: var(--y-text);
  --heading-color: var(--y-text-strong);
  --text-muted: var(--y-text-secondary);
  --text-light: var(--y-text-muted);
  --disabled-text-color: var(--y-text-disabled);

  /* lines */
  --border-color: var(--y-border);
  --dark-border-color: var(--y-border-strong);
  --table-border-color: var(--y-border);
  --btn-group-border-color: var(--y-border);

  /* action */
  --primary: var(--y-accent);
  --primary-color: var(--y-accent);
  --brand-color: var(--y-accent);
  --btn-primary: var(--y-accent);
  --border-primary: var(--y-accent);
  --btn-default-bg: var(--y-surface);
  --btn-default-hover-bg: var(--y-surface-hover);
  --btn-ghost-hover-bg: var(--y-surface-hover);

  /* radius and elevation */
  --border-radius-sm: var(--y-radius-sm);
  --border-radius: var(--y-radius-md);
  --border-radius-md: var(--y-radius-md);
  --border-radius-lg: var(--y-radius-lg);
  --shadow-xs: var(--y-shadow-xs);
  --shadow-sm: var(--y-shadow-sm);
  --shadow-md: var(--y-shadow-md);
  --card-shadow: none;
  --btn-shadow: none;

  /* status */
  --alert-text-danger: var(--y-danger-fg);
  --alert-text-warning: var(--y-warning-fg);
  --alert-text-info: var(--y-info-fg);
  --alert-text-success: var(--y-success-fg);
  --alert-bg-danger: var(--y-danger-bg);
  --alert-bg-warning: var(--y-warning-bg);
  --alert-bg-info: var(--y-info-bg);
  --alert-bg-success: var(--y-success-bg);

  --scrollbar-thumb-color: var(--y-border-strong);
  --scrollbar-track-color: var(--y-bg-subtle);
  --navbar-bg: var(--y-surface);
}

/* ==================================================================== */
/* 2. Page chrome                                                        */
/* ==================================================================== */

body {
  font-family: var(--y-font-ui);
  font-size: var(--y-text-md);
  line-height: var(--y-leading-md);
  color: var(--y-text);
  background: var(--y-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body h1,
body h2,
body h3 {
  font-family: var(--y-font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--y-text-strong);
}

body a {
  color: var(--y-text-link);
  text-decoration: none;
}

body a:hover {
  color: var(--y-text-link-hover);
  text-decoration: underline;
}

body :focus-visible {
  outline: none;
  box-shadow: var(--y-focus-ring);
  border-radius: var(--y-radius-sm);
}

/* Controls ---------------------------------------------------------- */

.btn {
  font-family: var(--y-font-ui);
  font-size: var(--y-text-base);
  font-weight: 500;
  border-radius: var(--y-radius-md);
  transition: background-color var(--y-duration-instant) var(--y-ease-standard),
    border-color var(--y-duration-instant) var(--y-ease-standard),
    transform var(--y-duration-instant) var(--y-ease-standard);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary,
.btn-primary:not(:disabled):not(.disabled) {
  background-color: var(--y-accent);
  border-color: var(--y-accent);
  color: var(--y-accent-fg);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:not(:disabled):not(.disabled):hover {
  background-color: var(--y-accent-hover);
  border-color: var(--y-accent-hover);
  color: var(--y-accent-fg);
}

.btn-default,
.btn-secondary {
  background-color: var(--y-surface);
  border: 1px solid var(--y-border);
  color: var(--y-text);
}

.btn-default:hover,
.btn-secondary:hover {
  background-color: var(--y-surface-hover);
  border-color: var(--y-border-strong);
  color: var(--y-text);
}

.form-control {
  font-family: var(--y-font-ui);
  font-size: var(--y-text-base);
  color: var(--y-text);
  background-color: var(--y-surface);
  border: 1px solid var(--y-border-input);
  border-radius: var(--y-radius-md);
}

.form-control::placeholder {
  color: var(--y-text-muted);
}

.form-control:hover {
  border-color: var(--y-border-strong);
}

.form-control:focus {
  border-color: var(--y-border-focus);
  box-shadow: var(--y-focus-ring);
  background-color: var(--y-surface);
  color: var(--y-text);
}

.form-label {
  font-size: var(--y-text-sm);
  font-weight: 500;
  color: var(--y-text-secondary);
}

/* Engine dialogs (frappe.msgprint: "Password set", "Invalid link", ...) ------------ */
/* The website bundle paints .modal-content, .modal-header and .modal-footer with a fixed
   white and the title with a fixed near-black, while the text inside follows the tokens.
   In dark mode that gave light text on a white dialog (owner, 5 Oct 2026: "white writing
   on white screen"). Every part of the dialog takes its colours from the tokens here, so
   text and surface always switch together. */

.modal .modal-content,
.modal .modal-header,
.modal .modal-footer {
  background-color: var(--y-surface-raised);
  color: var(--y-text);
}

.modal .modal-content {
  border: 1px solid var(--y-border);
  border-radius: var(--y-radius-lg);
  box-shadow: var(--y-shadow-xl);
}

.modal .modal-header,
.modal .modal-footer {
  border-color: var(--y-border);
}

.modal .modal-header .modal-title {
  color: var(--y-text-strong);
  font-weight: 600;
}

.modal .modal-body,
.modal .msgprint {
  color: var(--y-text);
}

.modal .btn-modal-close,
.modal .btn-modal-minimize {
  --icon-stroke: var(--y-text-secondary);
  color: var(--y-text-secondary);
  background: transparent;
}

.modal .btn-modal-close:hover,
.modal .btn-modal-minimize:hover {
  background: var(--y-surface-hover);
}

.modal-backdrop.show {
  background: var(--y-scrim);
  opacity: 1;
}

/* Website navbar and footer ----------------------------------------- */

.navbar {
  background: var(--y-surface);
  border-bottom: 1px solid var(--y-border);
  box-shadow: none;
}

.web-footer,
.footer-powered {
  display: none;
}

/* ==================================================================== */
/* 3. Error, 403 and message pages                                       */
/* ==================================================================== */

/* These pages share the sign-in page's frame and card: yote-login.css, loaded by each of
   them (templates/includes/brand/auth_frame.html, error_card.html). */
