/* ===========================================================================
 *  Loyal Sathi — shop theming
 *
 *  A shop supplies two colours. Everything else is worked out here.
 *
 *      --main        the dark brand tone: headers, buttons, body text
 *      --accent      the stamps, the highlights, the call to action
 *      --on-main     light or dark text for sitting on --main   (set by PHP)
 *      --accent-ink  a darkened accent that is readable as text (set by PHP)
 *
 *  Those four arrive as an inline style on the element carrying .ls-themed —
 *  index.php puts it on <html>, and the settings page puts it on the little
 *  preview card. Because both use this same file, the preview cannot drift
 *  away from the real thing.
 *
 *  Mixing happens in oklab rather than sRGB: blending a saturated colour
 *  toward white in sRGB drains the hue out of it and leaves the tints looking
 *  muddy, where oklab keeps them recognisably the shop's colour.
 *
 *  Used by everything a shop owns — their customers' card and their own admin
 *  panel — because the panel is their view of their business, not a platform
 *  tool. The super admin panel deliberately does not carry .ls-themed, so it
 *  keeps the fixed platform palette from tokens.css whichever shop you are
 *  looking at.
 * ======================================================================== */

.ls-themed{
  /* A shop supplies --main and --accent; PHP adds --on-main and --accent-ink.
     Only the brand roles follow the shop. Surfaces, lines and text stay the
     neutral values from tokens.css, so any colour pair sits on a clean canvas
     and body text always passes AA. */
  --navy:        var(--main);
  --navy-deep:   color-mix(in oklab, var(--main) 80%, #000);
  --navy-soft:   color-mix(in oklab, var(--main) 86%, #fff);

  --gold:        var(--accent);
  --gold-soft:   color-mix(in oklab, var(--accent) 45%, #fff);
  --gold-ink:    var(--accent-ink);
  --gold-wash:   color-mix(in oklab, var(--accent) 12%, #fff);

  --cream:        var(--on-main);     /* every use of --cream is "text on main" */
  --text-on-dark: var(--on-main);

  --primary-wash: color-mix(in oklab, var(--main) 9%, #fff);
  --focus:        var(--accent-ink);  /* guaranteed ≥4.5:1 on white by ls_ink_for() */

  --grad-navy:  linear-gradient(var(--navy), var(--navy));
  --grad-gold:  linear-gradient(var(--gold), var(--gold));

  /* Card roles (assets/css/app.css).
     --brand-ink  the main colour, darkened only when it is too pale to hold an
                  edge or a thin bar on white; a dark main passes through as-is.
     --accent-wash / --accent-line  quiet accent tints for "next" and reward cues. */
  --brand-ink:   color-mix(in oklab, var(--main) 72%, #000);
  --accent-wash: color-mix(in oklab, var(--accent) 14%, #fff);
  --accent-line: color-mix(in oklab, var(--accent) 50%, #fff);
}

/* Clamp lightness rather than darken everything, so a mid or dark main keeps
   its own tone and only a pale one (with dark --on-main) gets a visible edge. */
@supports (color: oklch(from red l c h)){
  .ls-themed{ --brand-ink: oklch(from var(--main) min(l, 0.5) c h); }
}

@supports not (color: color-mix(in oklab, red 50%, blue)){
  .ls-themed{
    --navy: var(--main); --navy-deep: var(--main); --navy-soft: var(--main);
    --gold: var(--accent); --gold-ink: var(--accent-ink);
    --cream: var(--on-main); --text-on-dark: var(--on-main);
    --focus: var(--accent-ink);
    --brand-ink: var(--main); --accent-wash: #FAFAFB; --accent-line: var(--accent);
  }
}
/* ---------------------------------------------------------- cover image --- */
/*
 * An optional photo behind the shop's name. The shop chooses the picture; we
 * cannot choose how busy it is, so the text always sits on a scrim in the
 * shop's own main colour. On the card it sits behind the home header; the top
 * bar carries it on the sign-in screen (and wherever the header is not drawn).
 */
.has-cover .topbar,
.has-cover .hero:not(.compact):not(.centred){
  background-image:
    linear-gradient(to bottom,
      color-mix(in srgb, var(--main) 40%, transparent) 0%,
      color-mix(in srgb, var(--main) 92%, transparent) 100%),
    var(--cover-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.has-cover .topbar{
  position: relative;
  min-height: 132px;
  align-items: flex-end;
}
.has-cover .hero:not(.compact):not(.centred){ padding-top: calc(var(--safe-top, 0px) + 72px); }
.has-cover .topbar .brand,
.has-cover .topbar .tagline,
.has-cover .hero .biz-name{
  text-shadow: 0 1px 3px color-mix(in srgb, var(--main) 70%, transparent);
}
