Skip to content

armgit / lyftr

Public Imported from GitHub
0

Self-hosted fitness tracker. Log workouts, track nutrition, and monitor progress. Docker deployment, mobile-friendly.

8.0 KB
Raw Blame
/* Bundled, not fetched from fonts.googleapis.com — an instance on a LAN with no outbound
   internet could never load the CDN stylesheet and silently fell back to system fonts.
   JetBrains Mono was declared in tailwind.config.ts but never loaded at all. */
@import '@fontsource-variable/plus-jakarta-sans';
@import '@fontsource-variable/outfit';
@import '@fontsource-variable/jetbrains-mono';

@tailwind base;
@tailwind components;
@tailwind utilities;

/* ─── CSS Variables (theme tokens) ─────────────────────
   The --surface-* / --tx-* custom properties are NOT declared here any more. They are
   emitted into :root and .dark by the addBase plugin in tailwind.config.ts, from
   packages/shared/src/theme/tokens.ts — the same values mobile's theme imports.
   Light = :root defaults, dark = .dark overrides, exactly as before.
   Everything below still consumes them; nothing else changes.
──────────────────────────────────────────────────────── */

/* ─── Base ─────────────────────────────────────────── */
@layer base {
  * { @apply border-surface-border; }

  body {
    @apply bg-surface-base text-tx-primary font-sans antialiased transition-colors duration-150;
  }
}

/* ─── Components ────────────────────────────────────── */
@layer components {

  /* Cards */
  .card             { @apply bg-surface-raised border border-surface-border rounded-xl; }
  .card-interactive { @apply card hover:border-tx-muted transition-colors duration-150 cursor-pointer; }
  .card-glass       { @apply bg-surface-raised backdrop-blur-xl border border-surface-border rounded-xl; }

  /* Buttons */
  .btn {
    @apply inline-flex items-center justify-center gap-2 font-semibold rounded-lg
           transition-all duration-150 focus-visible:outline-none
           focus-visible:ring-2 focus-visible:ring-brand-500 focus-visible:ring-offset-2
           focus-visible:ring-offset-surface-base
           disabled:opacity-40 disabled:cursor-not-allowed select-none;
  }
  .btn-sm  { @apply btn text-xs  px-3   py-1.5 gap-1.5; }
  .btn-md  { @apply btn text-sm  px-4   py-2.5; }
  .btn-lg  { @apply btn text-sm  px-5   py-3; }

  .btn-primary   { @apply bg-brand-500 text-white hover:bg-brand-600 active:bg-brand-700 shadow-sm; }
  .btn-secondary { @apply bg-surface-muted border border-surface-border text-tx-secondary hover:text-tx-primary hover:border-tx-muted; }
  .btn-ghost     { @apply text-tx-muted hover:text-tx-primary hover:bg-surface-muted; }
  .btn-danger        { @apply bg-error-500/10 border border-error-500/20 text-error-400 hover:bg-error-500/20; }
  .btn-danger-solid  { @apply bg-error-500 text-white hover:bg-error-600 active:bg-error-700 shadow-sm; }
  .btn-icon      { @apply btn p-2.5 rounded-lg; }
  .btn-icon-sm   { @apply btn p-2   rounded-md; }

  /* Inputs */
  .input {
    /* text-base (16px) is the minimum to prevent iOS Safari auto-zoom on focus. */
    /* min-w-0 overrides browser-imposed intrinsic min-width on date/number inputs. */
    @apply w-full min-w-0 px-3.5 py-2.5 bg-surface-overlay border border-surface-border rounded-lg
           text-tx-primary placeholder-tx-muted text-base
           focus:outline-none focus:ring-1 focus:ring-brand-500 focus:border-brand-500
           transition-colors duration-150;
  }
  /* The −/+ buttons beside a field already step it, so the browser's own spinners are
     a second, tinier copy of the same control — and they land on top of a unit suffix
     like "ml". Opt in per field; a field with no buttons of its own keeps them. */
  .input-no-spin { appearance: textfield; }
  .input-no-spin::-webkit-outer-spin-button,
  .input-no-spin::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

  .input-group     { @apply space-y-1.5; }
  .input-help      { @apply text-xs text-tx-muted mt-1; }

  .label {
    @apply flex items-center gap-1.5 text-xs font-medium text-tx-secondary tracking-wide uppercase;
  }

  /* Progress */
  .progress-track { @apply h-1 bg-surface-overlay rounded-full overflow-hidden; }
  .progress-bar   { @apply h-full rounded-full transition-all duration-500 ease-out; }

  /* Stat */
  .stat-value { @apply font-display font-bold text-tx-primary tabular-nums leading-none; }
  .stat-label { @apply text-xs font-medium text-tx-muted uppercase tracking-wider; }

  /* Alerts */
  .alert         { @apply flex gap-3 items-start rounded-lg p-3.5 text-sm border; }
  /* Text colour comes from --alert-* (emitted per theme by the addBase plugin from
     the shared tokens), not from a fixed 400. The 400s are legible on the dark
     surface these classes were written against and measure 2.4:1 (error) and 1.4:1
     (warning) on the light one, below WCAG AA. packages/shared's alertContrast test
     fails the build if any pairing regresses. */
  .alert-error   { @apply alert bg-error-500/10   border-error-500/20   text-[color:var(--alert-error)]; }
  .alert-success { @apply alert bg-success-500/10 border-success-500/20 text-[color:var(--alert-success)]; }
  .alert-info    { @apply alert bg-brand-500/10   border-brand-500/20   text-[color:var(--alert-info)]; }
  .alert-warning { @apply alert bg-warning-500/10 border-warning-500/20 text-[color:var(--alert-warning)]; }

  /* Nav */
  .nav-item {
    @apply flex flex-col items-center justify-center gap-1 py-3 text-tx-muted
           transition-colors duration-150 relative text-xs font-medium;
  }
  .nav-item.active { @apply text-brand-500; }
  .nav-item.active::after {
    content: '';
    @apply absolute bottom-0 left-1/2 -translate-x-1/2 w-5 h-px bg-brand-500;
  }

  /* Empty state */
  .empty-state {
    @apply flex flex-col items-center justify-center text-center py-16 px-6;
  }

  /* Section header */
  .section-header {
    @apply flex items-center justify-between mb-4;
  }
  .section-title {
    @apply text-sm font-semibold text-tx-primary;
  }

  /* Divider */
  .divider { @apply border-t border-surface-border; }

  /* Badge */
  .badge     { @apply inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs font-medium; }
  .badge-dim { @apply badge bg-surface-muted border border-surface-border text-tx-muted; }
  .badge-brand { @apply badge bg-brand-500/10 border border-brand-500/20 text-brand-400; }

  /* Tooltip target */
  .help-icon { @apply text-tx-muted hover:text-tx-secondary transition-colors cursor-help; }

  /* Row item */
  .list-row {
    @apply flex items-center justify-between px-3 py-3 rounded-lg
           hover:bg-surface-muted transition-colors duration-150 cursor-pointer group;
  }

  /* Kbd */
  .kbd {
    @apply inline-flex items-center px-1.5 py-0.5 rounded text-xs font-mono
           bg-surface-overlay border border-surface-border text-tx-muted;
  }
}

/* ─── Utilities ─────────────────────────────────────── */
@layer utilities {
  .text-gradient {
    background: linear-gradient(135deg, #00b8d9 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  @keyframes slide-up {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  /* The scanner's read line, passing over the barcode while it is looked up. */
  @keyframes scan-sweep {
    from { top: 8%; }
    to   { top: 88%; }
  }
  .animate-scan-sweep { animation: scan-sweep 1.1s ease-in-out infinite alternate; }
  @media (prefers-reduced-motion: reduce) {
    .animate-scan-sweep { animation: none; top: 48%; }
  }

  .animate-slide-up { animation: slide-up 0.2s ease-out both; }
  .animate-fade-in  { animation: fade-in 0.15s ease-out both; }

  .no-scrollbar { scrollbar-width: none; }
  .no-scrollbar::-webkit-scrollbar { display: none; }
}