/**
 * @package     fchduguesclin
 * @copyright   (C) 2026 frencheese
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 *
 * Themes of the popups (pkg_fchpopups, module mod_fchpopups). The theme rules set
 * --mod-fchpopups-* variables only, the package's mod-fchpopups.css does the rest; the two
 * additions are the bar before the title and the colour of hovered and focused links, at the end
 * of this file. The theme keys match the com_fchpopups option "themes"
 * (tools/content/setup-popups.php).
 *
 * Theme selectors carry two classes (0,2,0), so they outrank the package defaults set on
 * .mod-fchpopups (0,1,0) whatever the order in which the two stylesheets load.
 *
 * Contrast ratios (WCAG relative luminance) are given against the popup background.
 */

/* Close button, all themes: smaller than the package default (2.75rem box, 1.5rem icon).
   dialog.mod-fchpopups (0,1,1) outranks the package defaults on .mod-fchpopups (0,1,0) whatever
   the load order, and stays under the theme rules (0,2,0), so a theme can still change it.
   Box 2rem = 32 x 32 px, the hit area, above the 24 x 24 px of WCAG 2.2 (2.5.8); icon 1.25rem =
   20 px, so a drawn cross of 10 px (6 to 18 in the 24 viewBox); stroke kept at 2 viewBox units
   (about 1.7 px). */
dialog.mod-fchpopups {
  --mod-fchpopups-close-size: 2rem;
  --mod-fchpopups-close-icon-size: 1.25rem;
  --mod-fchpopups-close-icon-stroke: 2;
}

/* Theme "default", « Cinéma (sombre) »: the dark look of the site and of the mails
   (html/layouts/joomla/mail/mailtemplate.php): site ground, white text, brand red rule. */
.mod-fchpopups.mod-fchpopups--theme-default {
  --mod-fchpopups-bg: #111113; /* --flq-color-background hsl(240,6%,7%) (fliqs.css) */
  --mod-fchpopups-color: #fff; /* 18.86:1 */
  /* Decorative edge (1.40:1), so the popup stands out from a page that is already dark. */
  --mod-fchpopups-border: 1px solid #2e2e33;
  /* The red rule on top: an inset shadow, since the border variable sets all four sides.
     Brand red #be1823 (custom-cinema.css), decorative (3.00:1). */
  --mod-fchpopups-shadow: inset 0 4px 0 #be1823, 0 0.5rem 2rem rgb(0 0 0 / 0.6);
  --mod-fchpopups-backdrop: rgb(0 0 0 / 0.75);
  /* Space between the header row (logo) and the content: the top of the content padding
     (package default 0.5rem). */
  --mod-fchpopups-padding: 1.5rem 1.5rem 1.5rem;
  --mod-fchpopups-close-color: #fff; /* 18.86:1 */
  --mod-fchpopups-close-bg-hover: rgb(255 255 255 / 0.12);
  --mod-fchpopups-button-bg: #be1823; /* white text on it: 6.28:1 */
  --mod-fchpopups-button-color: #fff;
  /* White ring, offset onto the background: 18.86:1 against it, 6.28:1 against a red button. */
  --mod-fchpopups-focus: 3px solid #fff;
  --mod-fchpopups-autoclose-color: #b4b4ba; /* 9.14:1, the mail footer grey */
  --fchduguesclin-popup-title-bar: #be1823; /* 3.00:1, graphic element (3:1 minimum) */
}

/* Theme "blue", « Bleu »: the production popup blue rgb(69,133,182) gives white text only
   3.97:1; #407ba9 is the closest darker shade of the same hue and saturation (HSL 206°, 45%,
   45.7%) that reaches 4.5:1 with white (4.54:1). */
.mod-fchpopups.mod-fchpopups--theme-blue {
  --mod-fchpopups-bg: #407ba9;
  --mod-fchpopups-color: #fff; /* 4.54:1 */
  /* Header row on a dark band, like the mail band: the light logo's red (#be1823) would show
     at 1.38:1 on the blue, 3.00:1 on #111113. The close button sits on the band: 18.86:1. */
  --mod-fchpopups-header-bg: #111113;
  --mod-fchpopups-header-padding: 0.5rem 0.5rem 0.5rem 1.5rem;
  /* Space under the dark band, as in the default theme. */
  --mod-fchpopups-padding: 1.5rem 1.5rem 1.5rem;
  --mod-fchpopups-close-color: #fff;
  --mod-fchpopups-close-bg-hover: rgb(255 255 255 / 0.15);
  /* Dark buttons: white text 18.86:1; button edge against the blue 4.15:1. */
  --mod-fchpopups-button-bg: #111113;
  --mod-fchpopups-button-color: #fff;
  /* White ring: 4.54:1 against the blue, 18.86:1 against a dark button. */
  --mod-fchpopups-focus: 3px solid #fff;
  --mod-fchpopups-autoclose-color: #fff; /* 4.54:1; any lighter grey would fail */
  /* Title bar: the brand red gives 1.38:1 on the blue, below 3:1; white gives 4.54:1. */
  --fchduguesclin-popup-title-bar: #fff;
}

/* Theme "red", « Rouge »: the brand red #be1823 (custom-cinema.css) as the ground, white text
   6.28:1. Same structure as "blue". */
.mod-fchpopups.mod-fchpopups--theme-red {
  --mod-fchpopups-bg: #be1823;
  --mod-fchpopups-color: #fff; /* 6.28:1 */
  /* Header row on a dark band, as in "blue": the light logo's red would vanish on the red
     ground (1.00:1); 3.00:1 on #111113. The close button sits on the band: 18.86:1. */
  --mod-fchpopups-header-bg: #111113;
  --mod-fchpopups-header-padding: 0.5rem 0.5rem 0.5rem 1.5rem;
  /* Space under the dark band, as in the default theme. */
  --mod-fchpopups-padding: 1.5rem 1.5rem 1.5rem;
  --mod-fchpopups-close-color: #fff;
  --mod-fchpopups-close-bg-hover: rgb(255 255 255 / 0.15); /* white on it: 12.25:1 */
  /* Dark buttons: white text 18.86:1; button edge against the red 3.004:1 (3:1 minimum, and the
     text identifies the button, WCAG 1.4.11). */
  --mod-fchpopups-button-bg: #111113;
  --mod-fchpopups-button-color: #fff;
  /* White ring: 6.28:1 against the red, 18.86:1 against a dark button and the band. */
  --mod-fchpopups-focus: 3px solid #fff;
  --mod-fchpopups-autoclose-color: #fff; /* 6.28:1; the default theme's grey would give 3.04:1 */
  /* Title bar: the brand red would not show on the red ground; white gives 6.28:1. */
  --fchduguesclin-popup-title-bar: #fff;
}

/* Title (blocks mode): the small vertical bar of the screening times in the movie cards
   (fliqs.css, li.card-diffusion::before: 2px wide, 15px high on 1.0875rem text, i.e. 0.86em,
   text 0.8rem from the bar). Height in em so that it follows the title size; its top (0.1em)
   centres it on the first line of the title (package line-height 1.25), so a title on two lines
   keeps one bar, as the cards do. The colour is a template variable set by each theme. */
.mod-fchpopups .mod-fchpopups__title {
  position: relative;
  padding-left: 0.8rem;
}

.mod-fchpopups .mod-fchpopups__title::before {
  content: "";
  position: absolute;
  top: 0.1em;
  left: 0;
  width: 2px;
  height: 0.86em;
  background: var(--fchduguesclin-popup-title-bar, #be1823);
}

/* Links in the content (editor mode), hovered or focused: the template's a:hover, a:focus
   (fliqs.css, 0,1,1) paints them in the brand red, which vanishes on the red ground (1.00:1) and
   fails on the others (blue 1.38:1, default 3.00:1). They keep the theme's text colour instead,
   and the underline, thickened, shows the state. Two classes on the dialog, as the theme rules
   (0,5,1 in all), so the package's link rule (0,3,1) and the template's are outranked. */
.mod-fchpopups.mod-fchpopups--theme-default .mod-fchpopups__content a:not(.mod-fchpopups__button):is(:hover, :focus),
.mod-fchpopups.mod-fchpopups--theme-blue .mod-fchpopups__content a:not(.mod-fchpopups__button):is(:hover, :focus),
.mod-fchpopups.mod-fchpopups--theme-red .mod-fchpopups__content a:not(.mod-fchpopups__button):is(:hover, :focus) {
  color: var(--mod-fchpopups-color);
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
}
