/*
 * The design tokens: the only file with literal values of color, font family, size, space, radius
 * and shadow. The values are the preset b6nBuGoH8S of shadcn/create (style maia, base color zinc,
 * theme blue, chart color blue, fonts Inter and Montserrat). To change the look, change the
 * values here and nothing else. The rules that declare the font files are in fonts.css.
 * Dark by default: :root has the dark values and the class `light` on <html> the light ones.
 */

:root {
  /* Colors */
  --background: oklch(0.141 0.005 285.823);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.21 0.006 285.885);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.21 0.006 285.885);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.424 0.199 265.638);
  --primary-foreground: oklch(0.97 0.014 254.604);
  --secondary: oklch(0.274 0.006 286.033);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.274 0.006 286.033);
  --muted-foreground: oklch(0.705 0.015 286.067);
  --accent: oklch(0.274 0.006 286.033);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --destructive-foreground: oklch(0.141 0.005 285.823);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.552 0.016 285.938);
  --success: oklch(0.792 0.209 151.711);
  --success-foreground: oklch(0.141 0.005 285.823);
  --info: oklch(0.623 0.214 259.815);
  --info-foreground: oklch(0.141 0.005 285.823);
  --overlay: oklch(0.141 0.005 285.823 / 80%);
  /* The background behind a QR code: light in both modes, so an app can scan it. */
  --qr-background: oklch(0.985 0 0);
  /* The charts, from the chart color blue of the preset. */
  --chart-1: oklch(0.809 0.105 251.813);
  --chart-2: oklch(0.623 0.214 259.815);
  --chart-3: oklch(0.546 0.245 262.881);
  --chart-4: oklch(0.488 0.243 264.376);
  --chart-5: oklch(0.424 0.199 265.638);

  /* Typography: Inter for the text, Montserrat for the headings, the system stack as last resort. */
  --font-family: "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-family-heading:
    "Montserrat Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;

  /* Spacing: the base unit of Tailwind (p-4 is 4 times this) */
  --spacing: 0.25rem;
  --border-width: 1px;
  --ring-width: 3px;

  /* Radii */
  --radius: 0.625rem;
  --radius-small: calc(var(--radius) - 4px);
  --radius-medium: calc(var(--radius) - 2px);
  --radius-large: var(--radius);
  --radius-extra-large: calc(var(--radius) + 4px);
  --radius-2x-large: calc(var(--radius) * 1.8);
  --radius-3x-large: calc(var(--radius) * 2.2);
  --radius-4x-large: calc(var(--radius) * 2.6);

  /* Shadows */
  --shadow-small: 0 1px 2px 0 rgb(0 0 0 / 0.1);
  --shadow-medium: 0 4px 6px -1px rgb(0 0 0 / 0.2), 0 2px 4px -2px rgb(0 0 0 / 0.2);
  --shadow-large: 0 10px 15px -3px rgb(0 0 0 / 0.25), 0 4px 6px -4px rgb(0 0 0 / 0.25);
}

.light {
  --background: oklch(1 0 0);
  --foreground: oklch(0.141 0.005 285.823);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.141 0.005 285.823);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.141 0.005 285.823);
  --primary: oklch(0.488 0.243 264.376);
  --primary-foreground: oklch(0.97 0.014 254.604);
  --secondary: oklch(0.967 0.001 286.375);
  --secondary-foreground: oklch(0.21 0.006 285.885);
  --muted: oklch(0.967 0.001 286.375);
  /* Darker than the preset (0.552): on --muted it has to reach 4.5:1. */
  --muted-foreground: oklch(0.5 0.016 285.938);
  --accent: oklch(0.967 0.001 286.375);
  --accent-foreground: oklch(0.21 0.006 285.885);
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: oklch(1 0 0);
  --border: oklch(0.92 0.004 286.32);
  --input: oklch(0.92 0.004 286.32);
  --ring: oklch(0.705 0.015 286.067);
  --success: oklch(0.527 0.154 150.069);
  --success-foreground: oklch(1 0 0);
  --info: oklch(0.546 0.245 262.881);
  --info-foreground: oklch(1 0 0);
  --overlay: oklch(0.141 0.005 285.823 / 50%);
  --qr-background: oklch(1 0 0);
  --chart-1: oklch(0.488 0.243 264.376);
  --chart-2: oklch(0.546 0.245 262.881);
  --chart-3: oklch(0.623 0.214 259.815);
  --chart-4: oklch(0.707 0.165 254.624);
  --chart-5: oklch(0.809 0.105 251.813);

  --shadow-small: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-medium: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-large: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/*
 * Styles for HTML without React (the pages of the server and of the instance VPS). They look
 * like the React components and use only the tokens of tokens.css: no literal value here.
 */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
}

h1,
h2,
h3 {
  margin: 0 0 calc(var(--spacing) * 4);
  font-family: var(--font-family-heading);
  line-height: var(--line-height-tight);
  font-weight: var(--font-weight-semibold);
}

h1 {
  font-size: var(--font-size-2xl);
}

p {
  margin: 0 0 calc(var(--spacing) * 4);
}

a {
  color: var(--info);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: var(--ring-width) solid var(--ring);
  outline-offset: 0;
}

code {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  background: var(--muted);
  padding: calc(var(--spacing) * 0.5) calc(var(--spacing) * 1.5);
  border-radius: var(--radius-small);
  overflow-wrap: anywhere;
}

ul {
  margin: 0 0 calc(var(--spacing) * 4);
  padding-left: calc(var(--spacing) * 5);
}

li {
  margin-bottom: calc(var(--spacing) * 2);
}

label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  margin-bottom: calc(var(--spacing) * 4);
}

input {
  display: block;
  width: 100%;
  margin-top: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
  background: color-mix(in oklab, var(--input) 30%, transparent);
  color: var(--foreground);
  border: var(--border-width) solid var(--input);
  border-radius: var(--radius-4x-large);
  font: inherit;
  font-weight: var(--font-weight-normal);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 calc(var(--spacing) * 2) calc(var(--spacing) * 2) 0;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  background: var(--primary);
  color: var(--primary-foreground);
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-4x-large);
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}

button:hover {
  background: color-mix(in oklab, var(--primary) 80%, transparent);
}

button:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* The page and the card */
.ui-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--spacing) * 4);
}

.ui-card {
  width: 100%;
  max-width: calc(var(--spacing) * 112);
  background: var(--card);
  color: var(--card-foreground);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-4x-large);
  padding: calc(var(--spacing) * 8);
}

.ui-center {
  text-align: center;
}

.ui-brand {
  margin-bottom: calc(var(--spacing) * 6);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--muted-foreground);
}

.ui-muted {
  color: var(--muted-foreground);
}

/* The buttons: the main action is the plain `button`; these are the others. */
.ui-button {
  background: var(--primary);
  color: var(--primary-foreground);
}

.ui-button-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.ui-button-secondary:hover {
  background: color-mix(in oklab, var(--secondary), var(--foreground) 5%);
}

.ui-button-destructive {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

.ui-button-destructive:hover {
  background: color-mix(in oklab, var(--destructive) 80%, transparent);
}

/* The field: label, control and help */
.ui-field {
  margin-bottom: calc(var(--spacing) * 4);
}

.ui-help {
  margin: calc(var(--spacing) * 1) 0 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  color: var(--muted-foreground);
}

/* The notice. Empty, it does not show. */
.ui-alert {
  margin: 0 0 calc(var(--spacing) * 4);
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
  background: var(--card);
  color: var(--card-foreground);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-large);
  font-size: var(--font-size-sm);
}

.ui-alert:empty {
  display: none;
}

.ui-alert-info {
  color: var(--info);
}

.ui-alert-success {
  color: var(--success);
}

.ui-alert-destructive {
  color: var(--destructive);
}

/* The QR code sits on a light background, in both modes. */
.ui-qr {
  display: inline-block;
  margin-bottom: calc(var(--spacing) * 4);
  padding: calc(var(--spacing) * 3);
  background: var(--qr-background);
  border-radius: var(--radius-2x-large);
  line-height: 0;
}

/*
 * The @font-face rules of the server pages: Inter and Montserrat, the `latin` subset of the
 * variable fonts of @fontsource-variable (OFL, see ../fonts/). The files live in the package and the
 * web of the server serves them (plain-stylesheet.ts, FONTS_PATH): never a CDN. The family names
 * are the ones of tokens.css. React apps get the same fonts from theme.css. The static pages of
 * the instance VPS leave this file out: they fall back to the system font.
 */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/ui/fonts/inter-5.3.0.woff2") format("woff2-variations");
}

@font-face {
  font-family: "Montserrat Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/ui/fonts/montserrat-5.3.0.woff2") format("woff2-variations");
}

/*
 * The layout of the landing. The tokens, the base styles and the fonts come first in /site.css
 * (packages/ui: tokens.css, plain.css, fonts.css): no literal color, size or radius here.
 */
.site-header,
.site-footer,
.site-section {
  width: 100%;
  max-width: calc(var(--spacing) * 180);
  margin: 0 auto;
  padding: calc(var(--spacing) * 6) calc(var(--spacing) * 4);
}

.site-hero {
  padding-top: calc(var(--spacing) * 12);
}

.site-lead {
  font-size: var(--font-size-lg);
  color: var(--muted-foreground);
  max-width: calc(var(--spacing) * 160);
}

.site-cta {
  display: inline-block;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius-4x-large);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
}

.site-cta:focus-visible {
  outline: var(--ring-width) solid var(--ring);
  outline-offset: 0;
}

.site-points,
.site-steps {
  max-width: calc(var(--spacing) * 160);
}

.site-card {
  max-width: calc(var(--spacing) * 140);
  margin: 0 auto;
}

.site-form label {
  margin-bottom: 0;
}

.site-form select {
  display: block;
  width: 100%;
  margin-top: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
  background: color-mix(in oklab, var(--input) 30%, transparent);
  color: var(--foreground);
  border: var(--border-width) solid var(--input);
  border-radius: var(--radius-4x-large);
  font: inherit;
  font-weight: var(--font-weight-normal);
}

.site-form select:focus-visible {
  outline: var(--ring-width) solid var(--ring);
  outline-offset: 0;
}

.site-form option {
  background: var(--card);
  color: var(--card-foreground);
}

/* The error under a field. Empty, it does not show (the live region stays in the page). */
.site-error {
  color: var(--destructive);
}

.site-error:empty {
  display: none;
}

.site-form [aria-invalid="true"] {
  border-color: var(--destructive);
}

.site-submit {
  margin-right: 0;
}

.site-confirmation {
  color: var(--success);
}

.site-confirmation:focus-visible {
  outline: var(--ring-width) solid var(--ring);
}

.site-footer {
  text-align: center;
}
