/*
Dialog — Notifications/Pop-Up/Block in Sketch (My Campaigns - Manage Campaigns Pop-up).

Styles the Toolbox Dialog control (Templates/Dialog.tpl, JS/Dialog.js), which renders a
native <dialog> opened with showModal(). The browser supplies the top layer, the inert
page behind it, the focus trap and Escape-to-close, so nothing here sets a z-index.

The design is a 343px card in a 375px frame: 16px from each edge, a 16px smooth corner
(the export's 25.6 path extent is 16 at 60% smoothing), 24px padding, a 24px gap below
the title and 16px between the buttons. Wider than that it stops at 400px, a judgement
call since no wide design exists.

The symbol's default palette is the navy brand one, with a confirm button in the
Buttons/Tertiary Button state colours. The campaign frame overrides it to the greens,
which DialogThemeCampaign sets.
 */
.DialogOuter {
	--Dialog-TitleColor:           var(--Colors-Brand-Secondary);

	/* Buttons/Tertiary Button: Default, Hover, Active. Focus keeps the resting fill. */
	--DialogButtonPrimary-BackgroundColor: #69B3E7;
	--DialogButtonPrimary-Color:   #002E6D;
	--DialogButtonPrimaryActive-BackgroundColor: #C3E1F5;
	--DialogButtonPrimaryHover-BackgroundColor: #A5D1F1;

	background-color:              #ffffff;
	border:                        none;
	border-radius:                 16px;
	color:                         #000000;
	margin:                        auto;
	max-height:                    calc(100% - 32px);
	max-width:                     none;
	overflow:                      auto;
	padding:                       0;
	width:                         min(100% - 32px, 400px);
}

.DialogOuter::backdrop {
	background-color:              rgb(0 0 0 / 0.5);
}

/*
Buttons/Mini Button - Primary's states moved onto the Accent03 green. Mini Primary steps
#97D700 by tints from the brand palette chart (Symbols page, "Screenshot 2024-12-13 at
1.46.30 PM"): 20% for hover, 40% for active. These are the same columns of the #00C389
tint row.
 */
.DialogThemeCampaign {
	--Dialog-TitleColor:           var(--Colors-Secondary-Accent02);

	--DialogButtonPrimary-BackgroundColor: #00C389;
	--DialogButtonPrimary-Color:   #154734;
	--DialogButtonPrimaryActive-BackgroundColor: #66DBB8;
	--DialogButtonPrimaryHover-BackgroundColor: #33CFA1;
}

/* The page behind a modal shouldn't scroll under it. */
:root:has(.DialogOuter[open]) {
	overflow:                      hidden;
}

/* The padding lives here, not on the dialog, so a click in it isn't read as a backdrop
   click (the control closes when the click target is the <dialog> itself). */
.DialogInner {
	display:                       flex;
	flex-direction:                column;
	gap:                           24px;
	padding:                       24px;
}

/* DegularDisplay-Bold 28/28 */
.DialogTitle {
	--Typeface-FontWght:           700;

	color:                         var(--Dialog-TitleColor);
	font-family:                   var(--Typeface02-FontFamily);
	font-size:                     28px;
	font-variation-settings:       var(--Typeface02-FontVariationSettings);
	font-weight:                   var(--Typeface-FontWght);
	line-height:                   1;
	margin:                        0;
	text-align:                    center;
}

.DialogButtons {
	display:                       flex;
	flex-direction:                column;
	gap:                           16px;
	margin:                        0;
}

/* The pop-up's buttons are the compact 40px size with an 8px corner. */
.DialogButtons .FEButton {
	border-radius:                 8px;
	min-height:                    40px;
	width:                         100%;
}

/*
showModal() moves focus to the [autofocus] button, but browsers only match :focus-visible
for script-moved focus when the last input was a key, so a dialog opened by a click
hides which button Enter will press. The autofocus button shows its glow on plain :focus
instead. Only the glow: the fills stay with the FEButton state rules, so hover and active
still read over it.
 */
.DialogButtons .FEButton[autofocus]:focus {
	box-shadow:                    var(--ThisButtonFocusVisible-BoxShadow);
	outline:                       none;
}

/*
The confirm button, coloured by the palette tokens above. As in the Mini Button and
Tertiary Button Focus symbols, focus keeps the resting fill and adds an 8px glow (the
symbols' 4 blur) in that fill colour; the FEButton focus rule falls back to the resting
fill on its own.
 */
.DialogButtonPrimary {
	--ThisButton-BackgroundColor:  var(--DialogButtonPrimary-BackgroundColor);
	--ThisButton-BorderColor:      transparent;
	--ThisButton-Color:            var(--DialogButtonPrimary-Color);

	--ThisButtonActive-BackgroundColor: var(--DialogButtonPrimaryActive-BackgroundColor);
	--ThisButtonFocusVisible-BoxShadow: 0 0 8px var(--DialogButtonPrimary-BackgroundColor);
	--ThisButtonHover-BackgroundColor: var(--DialogButtonPrimaryHover-BackgroundColor);
}

/*
The cancel button: Buttons/Mini Button - Outline, whose instance overrides the white
border and label to black for the white card. Its states follow the symbol with black in
place of white: a 15% fill on hover (lighter than the symbol's 25%, which read too dark
on white) and a solid fill on active. The Active symbol's label
is the dark page colour, so on the card it becomes white. The Focus symbol shows no
change, so this keeps the shared FEButton focus glow rather than leave keyboard focus
invisible.
 */
.DialogButtonOutline {
	--ThisButton-BackgroundColor:  transparent;
	--ThisButton-BorderColor:      #000000;
	--ThisButton-BorderWidth:      2px;
	--ThisButton-Color:            #000000;

	--ThisButtonActive-BackgroundColor: #000000;
	--ThisButtonActive-Color:      #ffffff;
	--ThisButtonHover-BackgroundColor: rgb(0 0 0 / 0.15);
}
