4.6 KiB · text History 65cab78
/* Tailwind 4 + DaisyUI 5 for the captive portal (neiam-portal). Configured
   here rather than in a tailwind.config.js, which Tailwind 4 no longer needs.
   Only the two themes we ship (light `her` + dark `afterdark`) and only the
   classes used by the portal pages are emitted, keeping the gzipped CSS tiny.

   source(none) + @source: scan the pages and nothing else. Tailwind 4 would
   otherwise walk the whole directory, and build.rs runs this from web/. */
@import "tailwindcss" source(none);
@source "./src";

@plugin "@tailwindcss/forms";

/* themes: false drops DaisyUI's built-in themes; ours are below. */
@plugin "daisyui" {
  themes: false;
}

/* Theme palettes are copied from ../dms/assets/tailwind.config.js (primary,
   secondary, accent, neutral, base-100 and the four states). DaisyUI 4 derived
   the rest — base-200/300, base-content and every *-content — and DaisyUI 5
   wants them spelled out, so these are the exact values 4 computed, in the
   oklch it computed them in. Radii are 4's too (box 1rem, buttons and fields
   0.5rem), and depth/noise are off because 4 had neither. */
@plugin "daisyui/theme" {
  name: "her";
  default: true;
  --color-base-100: #651d1d;
  --color-base-200: oklch(32.243% 0.09643 24.310124);
  --color-base-300: oklch(29.8162% 0.089172 24.310124);
  --color-base-content: oklch(86.934% 0.020738 24.310124);
  --color-primary: #b57979;
  --color-primary-content: oklch(12.7581% 0.015108 19.362126);
  --color-secondary: #d5abab;
  --color-secondary-content: oklch(15.5792% 0.009865 18.265142);
  --color-accent: #fef3c7;
  --color-accent-content: oklch(19.2379% 0.011605 95.617445);
  --color-neutral: #7f3535;
  --color-neutral-content: oklch(88.6113% 0.020623 22.381898);
  --color-info: #7dd3fc;
  --color-info-content: oklch(16.5517% 0.020255 230.317893);
  --color-success: #a7f3d0;
  --color-success-content: oklch(18.0988% 0.017898 164.150083);
  --color-warning: #fef08a;
  --color-warning-content: oklch(18.902% 0.024861 101.539857);
  --color-error: #fca5a5;
  --color-error-content: oklch(16.1538% 0.020697 19.57064);
  --radius-selector: 0.5rem;
  --radius-field: 0.5rem;
  --radius-box: 1rem;
  --size-selector: 0.25rem;
  --size-field: 0.25rem;
  --border: 1px;
  --depth: 0;
  --noise: 0;
}

@plugin "daisyui/theme" {
  name: "afterdark";
  --color-base-100: #201D65;
  --color-base-200: oklch(26.7726% 0.113367 277.334003);
  --color-base-300: oklch(24.7574% 0.104834 277.334003);
  --color-base-content: oklch(85.7575% 0.02438 277.334003);
  --color-primary: #7B79B5;
  --color-primary-content: oklch(12.0428% 0.018093 284.862228);
  --color-secondary: #ACABD5;
  --color-secondary-content: oklch(15.1278% 0.011981 285.964235);
  --color-accent: #fef3c7;
  --color-accent-content: oklch(19.2379% 0.011605 95.617445);
  --color-neutral: #38357F;
  --color-neutral-content: oklch(87.5196% 0.024274 280.640415);
  --color-info: #7dd3fc;
  --color-info-content: oklch(16.5517% 0.020255 230.317893);
  --color-success: #a7f3d0;
  --color-success-content: oklch(18.0988% 0.017898 164.150083);
  --color-warning: #fef08a;
  --color-warning-content: oklch(18.902% 0.024861 101.539857);
  --color-error: #fca5a5;
  --color-error-content: oklch(16.1538% 0.020697 19.57064);
  --radius-selector: 0.5rem;
  --radius-field: 0.5rem;
  --radius-box: 1rem;
  --size-selector: 0.25rem;
  --size-field: 0.25rem;
  --border: 1px;
  --depth: 0;
  --noise: 0;
}

/* Self-hosted B612 Mono (latin subset), served by the device from flash.
   Files are emitted to /font-400.woff2 and /font-700.woff2 by build.rs. */
@font-face {
  font-family: 'B612 Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/font-400.woff2') format('woff2');
}
@font-face {
  font-family: 'B612 Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/font-700.woff2') format('woff2');
}

@layer base {
  /* Tailwind 4's default border colour is currentColor where 3's was
     gray-200. Every border on these pages names its colour, so this only
     guards one that forgets to (the upgrade tool's own compatibility rule). */
  *,
  ::after,
  ::before,
  ::backdrop,
  ::file-selector-button {
    border-color: var(--color-gray-200, currentcolor);
  }

  /* DaisyUI 4 set color-scheme from the system preference (its fallback
     blocks); 5 sets it only from a theme's own. Keep native controls and
     scrollbars following the system as before. */
  :root {
    color-scheme: light;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      color-scheme: dark;
    }
  }

  html,
  body {
    font-family: 'B612 Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  }
}