/* ===========================================================================
 * Whitelisting Wizard — styles
 *
 * Design tokens (this section) followed by component styles (below), merged
 * into one file so deploying is fewer files to upload. Previously two files,
 * css/root.css and css/styles.css — see git history for the split version.
 * Still separate from css/codex/*.css, which stays untouched so it can be
 * re-copied wholesale when Codex ships a new version.
 *
 * Load order still matters. css/codex/*.css must come BEFORE this file:
 *
 *   codex/root.css       primitive palette (vapor, vermillion, …)
 *   codex/light.css      semantic tokens, :root
 *   codex/dark.css       semantic tokens, [data-theme="dark"] / .dark-mode
 *   wizard.css           ← this file (design tokens, then component styles)
 *
 * codex/numerical.css (--space-*, --radius-*, --border-width-*) is vendored
 * but deliberately NOT loaded. Nothing consumes those tokens, because the
 * spacing scale below is still local — and Codex's own light.css and dark.css
 * don't reference them either, so leaving it out can't affect the semantic
 * layer. Add the <link> back when the spacing migration happens.
 *
 * Because the semantic tokens are redefined under [data-theme="dark"], every
 * mapping below follows the theme automatically. A dark mode toggle is
 * therefore mostly a matter of setting that attribute — the CSS is already
 * in place. The unsolved part is imagery: the vendor logos, the two hero
 * illustrations and the KnowBe4 PNG are all fixed-colour.
 *
 * The tokens section is vendored from Codex v68.39.0 — a copy, not a
 * dependency, so it does not update itself. Re-copy from the repo to refresh,
 * the same as css/codex/*.css.
 * ======================================================================== */

/* ---------------------------------------------------------------------------
 * Fonts. Copied from Codex's theme.css, with the url() paths repointed at
 * assets/fonts/ — the woff2 files are vendored from
 * packages/kb4-codex/src/assets/fonts/. Space Mono is left out; nothing here
 * is monospace.
 * ------------------------------------------------------------------------ */

@font-face {
	font-family: "Inter Variable";
	font-style: normal;
	font-display: swap;
	font-weight: 100 900;
	src: url("../assets/fonts/inter-latin-ext-wght-normal.woff2")
		format("woff2-variations");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
		U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
		U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
		U+A720-A7FF;
}

@font-face {
	font-family: "Inter Variable";
	font-style: normal;
	font-display: swap;
	font-weight: 100 900;
	src: url("../assets/fonts/inter-latin-wght-normal.woff2")
		format("woff2-variations");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
		U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
		U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Sora Variable";
	font-style: normal;
	font-display: swap;
	font-weight: 100 800;
	src: url("../assets/fonts/sora-latin-ext-wght-normal.woff2")
		format("woff2-variations");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
		U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
		U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
		U+A720-A7FF;
}

@font-face {
	font-family: "Sora Variable";
	font-style: normal;
	font-display: swap;
	font-weight: 100 800;
	src: url("../assets/fonts/sora-latin-wght-normal.woff2")
		format("woff2-variations");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
		U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
		U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
	/* --- colour scheme ---------------------------------------------------
	 * Declared so the browser renders its OWN chrome to match the page: form
	 * control text and carets, scrollbars, autofill. Form controls do not
	 * inherit `color`, so without this Chrome resolves their internal
	 * light-dark() against a light scheme no matter what the page looks like.
	 * ------------------------------------------------------------------ */
	color-scheme: light;

	/* --- spacing ---------------------------------------------------------
	 * Kept local. Codex ships --space-* in px; the wizard is built in rem.
	 * Migrating is worth doing but it's a separate pass.
	 * ------------------------------------------------------------------ */
	--space: 1rem;

	/* --- neutrals --------------------------------------------------------
	 * Codex neutrals are the "vapor" family — slightly cool and cyan-tinted
	 * rather than pure grey. --neutral-bg is rgb(250,255,255), not #fff, so
	 * the whole interface reads a touch cooler than it did.
	 * ------------------------------------------------------------------ */
	--clr-neutral-900: var(--neutral-text); /* body copy            was #2c2c2c */
	--clr-neutral-800: var(--neutral-text-soft); /* secondary text, icons   was #616161 */
	--clr-neutral-400: var(--neutral-border); /* card + input borders    was #c8c8c8 */
	--clr-neutral-300: var(--neutral-bg-component); /* nav icon circles  was #d9d9d9 */
	--clr-neutral-200: var(--neutral-bg-soft); /* page background       was #f5f5f5 */
	--clr-neutral-100: var(--neutral-bg); /* card + modal surface       was #fff     */

	/* --- links -----------------------------------------------------------
	 * Codex's own --hyperlink-link resolves to rgb(5,7,9) — near-black.
	 * Correct per the design system, but this wizard exists to send people to
	 * KB articles, and near-black links read as much less clickable.
	 *
	 * These reach past the semantic layer to the deep-teal primitive ramp,
	 * which is a deliberate exception: deep-teal-11 is rgb(8,87,124), within
	 * a few points of the original #005b86, and deep-teal-1 is close to the
	 * old #d1ecf1 hover tint. Semantic tokens had nothing equivalent.
	 *
	 * CONSEQUENCE FOR DARK MODE: primitives don't respond to the theme, so
	 * these three stay dark blue on a dark background. They need explicit
	 * [data-theme="dark"] overrides — lighter ramp steps, roughly
	 * deep-teal-4 / deep-teal-2 / deep-teal-13 — before the toggle ships.
	 * ------------------------------------------------------------------ */
	--clr-link-400: var(--color-deep-teal-11); /* link text     was #005b86 */
	--clr-link-500: var(--color-deep-teal-13); /* link hover text          */
	--clr-link-300: var(--color-deep-teal-1); /* link hover bg  was #d1ecf1 */

	/* --- highlight -------------------------------------------------------
	 * The hovered / keyboard-selected row in the typeahead. The deep-teal
	 * ramp rather than brand vermillion: every row opens a KB article, and the
	 * brand red is already carrying the primary CTA directly beneath the
	 * dropdown.
	 *
	 * BOTH blocks are required even though the hue is shared. The fill has to
	 * invert between themes — pale ground under dark text in light mode, dark
	 * ground under near-white text in dark mode — so the override below is not
	 * optional. Pointing one theme at the other's values lands text and ground
	 * at the same lightness, which is unreadable either way round. (An earlier
	 * version of this comment claimed the two could be collapsed into one.
	 * They can't.)
	 *
	 * For vermillion in light mode: --clr-accent-200 and --clr-accent-400.
	 * That pair can't work under dark — see the note on --clr-accent-200.
	 * ------------------------------------------------------------------ */
	--clr-highlight-bg: var(--color-deep-teal-1);
	--clr-highlight-bar: var(--color-deep-teal-11);

	/* --- raised surfaces -------------------------------------------------
	 * The modal. Identical to the card surface in light mode, where a shadow
	 * is enough to separate it from the page. Lifted a step under dark, where
	 * it isn't — see the note on .modal below.
	 *
	 * --clr-component-raised is the component fill for things sitting ON that
	 * raised surface (the icon circles). It exists because in dark mode
	 * --clr-surface-raised and --clr-neutral-300 both resolve to
	 * --neutral-bg-component, so the circles would have no visible background
	 * on a modal. Raising the surface has to raise its components with it.
	 * ------------------------------------------------------------------ */
	--clr-surface-raised: var(--neutral-bg);
	--clr-border-raised: var(--neutral-border);
	--clr-component-raised: var(--neutral-bg-component);

	/* --- brand -----------------------------------------------------------
	 * --brand-bg resolves to rgb(215,51,18) = #D73312, the value confirmed as
	 * accessible for white button text (~4.8:1, clears AA for normal text).
	 * Noticeably redder and darker than the previous #f16823 orange.
	 *
	 * Don't reach for --brand-border or --brand-icon as a button fill: both
	 * resolve to vermillion-8-brand, which is too light to carry white text.
	 *
	 * Hover uses --brand-gradient-l-hover for its VALUE, not its gradient
	 * intent — it's the darker vermillion (rgb(153,32,8)) and the closest
	 * thing Codex has to a brand hover fill. The gradient treatment itself
	 * was tried and dropped in favour of the flat darker step.
	 *
	 * --clr-accent-200 is currently UNUSED. It was the typeahead's warm row
	 * tint, mixed here because Codex ships no pale-brand token; the highlight
	 * settled on the deep-teal ramp in both themes instead (see
	 * --clr-highlight-bg). It also can't serve as a dark-mode highlight at
	 * this strength: 8% of vermillion against black-13 lands within a couple
	 * of points of the panel behind it. Kept as the one worked example of
	 * deriving a pale brand step, since there's still no token for one.
	 * ------------------------------------------------------------------ */
	--clr-accent-200: color-mix(in srgb, var(--brand-bg) 8%, var(--neutral-bg));
	--clr-accent-300: var(--brand-border); /* focus ring        was #f8b491 */
	--clr-accent-400: var(--brand-bg); /* buttons               was #f16823 */
	--clr-accent-500: var(--brand-gradient-l-hover); /* button hover  was #da5d1e */

	/* --- type ------------------------------------------------------------
	 * Sora for headings, Inter for everything else. Both resolve to Codex
	 * tokens in codex/root.css; the @font-face rules above load the files.
	 * ------------------------------------------------------------------ */
	--ff-heading: var(--font-family-primary), sans-serif;
	--ff-primary: var(--font-family-secondary), sans-serif;

	--fs-300: 0.875rem;
	--fs-400: 1rem;
	--fs-500: 1.25rem;
	--fs-600: 1.5rem;

	--fw-400: 400;
	--fw-500: 500;
	--fw-600: 600;
	--fw-700: 700;

	/* --- shadows ---------------------------------------------------------
	 * Composed from Codex's shadow parts, which ship as separate blur,
	 * offset and colour tokens rather than finished box-shadow values.
	 *
	 * NOTE: the card hover shadow is --shadow-card-hover, not --shadow-hover.
	 * Codex already defines --shadow-hover as a COLOUR, so reusing that name
	 * here would be self-referential and silently invalid — the hover shadow
	 * would just vanish. Don't rename it back.
	 * ------------------------------------------------------------------ */
	--shadow: 0 var(--shadow-y-offset) var(--shadow-blur) var(--shadow-regular),
		0 var(--shadow-floating-y-offset) var(--shadow-floating-blur)
			var(--shadow-floating-spread) var(--shadow-floating-color);

	--shadow-card-hover: 0 var(--shadow-y-offset-hover) var(--shadow-blur-hover)
		var(--shadow-hover);

	--shadow-focus: 0 0 0 2px var(--brand-border);
}

/* ---------------------------------------------------------------------------
 * Dark theme corrections
 *
 * Deliberately short. Every mapping above points at a Codex SEMANTIC token,
 * and codex/dark.css redefines those under the same two selectors this block
 * uses, so they follow the theme with no help from us — including
 * --brand-logo, which flips the inlined wordmark to white, and the shadow
 * parts, which deepen to 30% and 60% alpha.
 *
 * What's left is the two places the mapping reached past that semantic layer.
 * ------------------------------------------------------------------------ */

[data-theme='dark'],
.dark-mode {
	/* The link tokens use the deep-teal PRIMITIVE ramp, as the note above
	 * explains, and primitives don't respond to the theme — without these
	 * three they stay rgb(8,87,124) on a near-black page. Moving up the ramp
	 * also inverts the hover relationship: light text at rest, and the hover
	 * chip becomes a light ground carrying dark text rather than the reverse. */
	--clr-link-400: var(--color-deep-teal-4); /* rgb(115,206,236) at rest  */
	--clr-link-500: var(--color-deep-teal-13); /* hover text, on the chip  */
	--clr-link-300: var(--color-deep-teal-2); /* hover chip ground         */

	/* Tells the browser to paint its own chrome dark too — form control text
	 * and carets, and the results panel's scrollbar once it passes 21rem.
	 * Without it the typeahead gets a black caret on a dark field. */
	color-scheme: dark;

	/* Same hue as light mode, inverted lightness. Reusing --clr-link-300 would
	 * have put deep-teal-2 behind the rows: a LIGHT chip, right for a hover on
	 * inline text but unreadable beneath near-white row text. deep-teal-13 is
	 * the dark end of that same ramp, so the fill sits under light text while
	 * the bar stays bright. */
	--clr-highlight-bg: var(--color-deep-teal-13);
	--clr-highlight-bar: var(--color-deep-teal-4);

	/* Elevation by lightness, not by shadow — see the note on .modal. */
	--clr-surface-raised: var(--neutral-bg-component);
	--clr-border-raised: var(--neutral-border-strong);
	--clr-component-raised: var(--neutral-bg-component-hover);
}

/* ---------------------------------------------------------------------------
 * Component styles
 *
 * Consolidated from reset.css, styles.css, utilities.css, mail-server.css,
 * filter-select.css and wizard.css, then later merged with the design-token
 * section above into this one file. Design tokens come first in this file,
 * not because order matters for the cascade here, but so a palette or type
 * change is still a diff to one clearly-marked section rather than a needle
 * in the component rules.
 *
 * This merge is meant to be behaviour-preserving. Where two files defined the
 * same thing, the winning value has been folded into a single rule and the
 * loser deleted — same computed result, one place to look.
 *
 * Contents:
 *   1. Reset
 *   2. Base elements
 *   3. Layout
 *   4. Buttons and navigation
 *   5. Mail server cards
 *   6. Modals
 *   7. Spam filter typeahead
 *   8. Utilities
 *   9. Motion
 * ------------------------------------------------------------------------ */

/* ---------------------------------------------------------------------------
 * 1. Reset
 * ------------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

h1,
.h1,
h2,
.h2,
h3,
.h3,
h4,
.h4 {
  font-family: var(--ff-heading);
}

h1,
.h1,
h2,
.h2,
h3,
.h3,
h4,
.h4,
p {
  line-height: 1.6;
  font-size: clamp(
    var(--fluid-type-min, 1rem),
    calc(1rem + var(--fluid-type-target, 3vw)),
    var(--fluid-type-max, 1.3rem)
  );
}

h1 {
  --fluid-type-min: 1.5rem;
  --fluid-type-max: 6rem;
  --fluid-type-target: 1vw;
  font-weight: 600;
  line-height: 1.3;
}

p {
  --fluid-type-min: 0.75rem;
  --fluid-type-max: 1rem;
  --fluid-type-target: 1vw;
  text-wrap: pretty;
}

h1,
h2,
h3,
p {
  margin: 0;
  text-align: center;
  text-wrap: wrap;
}

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
  margin-left: 0;
}

li {
  margin-left: 1.5rem;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* font: inherit — form controls use the browser's UI font otherwise, which
   showed up when the wizard's links became real <button> elements. */
button {
  cursor: pointer;
  font: inherit;
}

input {
  cursor: text;
}

/* Vestigial: this sized the inline vendor logos on the legacy pages, which
   no longer exist. The sprite references in §5 override it. Left in place
   because the Font Awesome kit may render icons as <svg> depending on how
   it's configured — confirm that before removing. */
svg {
  height: 1.5rem;
  width: fit-content;
}

/* ---------------------------------------------------------------------------
 * 2. Base elements
 * ------------------------------------------------------------------------ */

body {
  font-family: var(--ff-primary);
  font-weight: 400;
  color: var(--clr-neutral-900);
  margin: 0;
  min-height: 100vh;
}

@media (min-width: 40em) {
  body {
    font-size: 1rem;
    background-color: var(--clr-neutral-200);
  }
}

span {
  font-weight: 600;
}

a {
  color: var(--clr-link-400);
  cursor: pointer;
  text-underline-position: under;
  transition:
    background-color 200ms ease-out,
    color 200ms ease-out;
}

a:hover {
  color: var(--clr-link-500);
  background-color: var(--clr-link-300);
}

/* :focus-visible, not :focus — the ring is for keyboard users, and :focus
   would also fire on mouse click.

   The text colour here is --clr-link-500, matching a:hover above, NOT the
   --clr-link-400 rest colour. Both states paint the same --clr-link-300
   chip, and that chip is light in both themes — pale deep-teal-1 in light
   mode, deep-teal-2 in dark — so the text on it has to be the dark end of
   the ramp either way. Using the rest colour worked in light mode by
   coincidence, because there the rest colour happens to be dark; in dark
   mode it's pale, and a focused link came out pale-on-pale. */
button:focus-visible,
a:focus-visible {
  outline-color: var(--clr-accent-400);
  outline-offset: calc(var(--space) * 0.15);
  color: var(--clr-link-500);
  background-color: var(--clr-link-300);
}

i.fa-regular.fa-arrow-up-right-from-square {
  font-size: var(--fs-300);
}

/* ---------------------------------------------------------------------------
 * 3. Layout
 * ------------------------------------------------------------------------ */

.cover {
  display: grid;
  place-items: center;
  min-block-size: 100vh;
  padding-bottom: 4rem;
  grid-template-rows: 1fr auto;
}

main {
  height: 100%;
  justify-content: center;
  display: flex;
  width: 100%;
}

@media (min-width: 40em) {
  main {
    align-items: center;
  }
}

/* height: auto and flex-start, not the original `height: calc(100% - 23vh)`
   with space-between. That sized the card to the viewport, which worked when
   each screen was its own file. In one document the states differ wildly —
   a hero and two lines vs. a four-card grid — so the card sizes to content
   and the gap does the spacing. */
section {
  width: min(100%, 45rem);
  background-color: var(--clr-neutral-100);
  padding-block: min(5vh, 5rem);
  padding-inline: min(5vw, 5rem);
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: auto;
  gap: 2rem;
  animation: screen-in 200ms ease-out both;
}

@media (min-width: 40em) {
  section {
    margin: auto;
  }

  .section h1 {
    min-inline-size: 43.5ch;
  }

  .shadow {
    box-shadow: var(--shadow);
  }
}

footer {
  width: 100%;
}

/* The logo is an inline <svg> now, not an <img>. It needs an explicit height
   because the bare `svg` rule in §1 sets 1.5rem; `auto` lets the viewBox
   keep the aspect ratio. `color` drives currentColor inside the wordmark,
   and --brand-logo flips to white under [data-theme="dark"]. */
.logo {
  width: 9rem;
  height: auto;
  margin: 0 auto;
  color: var(--brand-logo);
}

/* No aspect-ratio here on purpose. The proportions come from the width/height
   attributes the hero() helper in wizard.js puts on the element, per image.
   Hardcoding one ratio in CSS would work only as long as both illustrations
   stay the same shape, which is a coincidence rather than a rule. */
.hero {
  width: 24rem;
}

.h1 {
  margin-bottom: 1.5rem;
}

.space {
  padding-bottom: 1.5rem;
}

/* ---------------------------------------------------------------------------
 * 4. Buttons and navigation
 * ------------------------------------------------------------------------ */

/* width: 100% because these are <button> elements now. An <a> with
   display:flex is block-level and filled .button-primary's clamp() width;
   a <button> is width:auto and shrinks to its text. */
.button {
  font-weight: 600;
  font-size: var(--fs-400);
  margin: 0 auto;
  padding: 1rem;
  background-color: var(--clr-accent-400);
  border: none;
  display: flex;
  justify-content: center;
  border-radius: 6.25rem;
  cursor: pointer;
  color: #fff;
  text-decoration: none;
  width: 100%;
  transition: background-color 200ms ease-out;
}

.switcher .button.box {
  width: auto;
}

.button-primary {
  /* No bottom margin: the nav arrows sit directly below on most screens and
     section's flex gap already separates them. Modals override this with
     margin-block. */
  margin: 1rem auto 0;
  width: clamp(22ch, 20%, 46ch);
}

.button:hover,
.button:active,
.button:focus {
  background-color: var(--clr-accent-500);
}

.button:active,
.button:focus-visible {
  outline: 3px solid var(--clr-accent-300);
  color: var(--clr-neutral-100);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.text-nav {
  padding-top: 1rem;
}

@media (min-width: 40em) {
  .text-nav {
    padding-top: 0;
  }
}

.link {
  font-size: var(--fs-300);
  flex: 0 1 10rem;
  display: flex;
  justify-content: center;
  max-inline-size: 60rem;
}

.link a {
  color: var(--clr-neutral-800);
}

.link a:hover,
.link a:focus,
.link a:active {
  /* Was #fff, then --clr-neutral-100 — but that's the card surface, only one
     step off the page the footer sits on, so the chip barely registered in
     either theme. --clr-neutral-300 is a genuinely distinct surface: darker
     than the page in light mode, lighter in dark, contrasting either way.
     It's also what .bg-icon uses for the nav circles, so a hovered footer
     link and a nav button now read as the same kind of surface.

     Checked against .link a's --clr-neutral-800 text: about 5.3:1 in light
     and 5.9:1 in dark, so both clear AA. Going further — --neutral-bg-strong
     for instance — inverts the relationship and needs the text colour to
     flip with it. */
  background-color: var(--clr-neutral-300);
  text-decoration: none;
}

.nav-button {
  display: flex;
  justify-content: center;
  flex: unset;
}

.bg-icon {
  background-color: var(--clr-neutral-300);
  width: 2rem;
  height: 2rem;
  padding: 0.5rem 0.75rem;
  border-radius: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  color: var(--clr-neutral-800);
  font-size: var(--fs-300);
  /* Transparent outline at rest so :hover animates its colour instead of
     popping a solid outline into existence. Its width must match the hover
     width below, or the ring changes thickness as well as colour. Outline is
     drawn outside the box and doesn't affect layout, so this costs nothing
     visually. */
  outline: 2px solid transparent;
  outline-offset: 0;
  transition:
    background-color 200ms ease-out,
    outline-color 200ms ease-out,
    color 200ms ease-out;
}

button.bg-icon {
  border: none;
}

.bg-icon:hover,
button.close-button:hover {
  outline: 2px solid var(--clr-neutral-800);
  background-color: var(--clr-neutral-300);
  border-radius: 2rem;
  outline-offset: 0;
}

.bg-icon:focus-visible,
.bg-icon:active {
  border: 2px solid var(--clr-neutral-800);
  background-color: var(--clr-neutral-400);
  color: var(--clr-neutral-800);
}

/* Two rules, one property: the transparent below wins on source order at
   equal specificity, so a background-color declared here never applied at
   all. It used to say `white`, which would have been wrong under dark mode
   — but only in theory, since it was already dead. Removed rather than
   retokenised. */
.close-button {
  border: none;
  padding: 0;
  /* Mirrors .bg-icon, because the hover rule below targets this element
     while the .bg-icon class sits on the <i> inside it — so without these
     the ring snapped on while the circle within it faded.

     The transparent outline at rest is the part that makes it animate at
     all: outline-style isn't an animatable property, so going from `none`
     to `solid` changes discretely no matter what transition is declared.
     Declaring a transparent outline up front means only outline-color
     moves — and its width has to match the hover width, or the ring
     thickens as it appears. Outline is drawn outside the box, so it costs
     nothing in layout.

     border-radius matters too: an outline follows the border radius, so
     without it the transparent ring would be square around the round icon
     and appear as a square the moment it gained colour. */
  border-radius: 2rem;
  outline: 2px solid transparent;
  outline-offset: 0;
  transition:
    background-color 200ms ease-out,
    outline-color 200ms ease-out,
    color 200ms ease-out;
}

.close-button,
.close-button:focus-visible {
  background-color: transparent;
}

/* Pinned to the viewport's top-right corner, not the card's. Fixed rather
   than absolute: this is page chrome, it belongs to the document rather than
   to any one screen, and it should hold its corner while the page scrolls.
   section no longer needs position: relative as a result.

   z-index is cheap insurance — without it a fixed element with auto z-index
   can be painted under positioned content elsewhere in the document.

   Larger than the nav buttons it borrows .bg-icon from, which is a deliberate
   difference: this one isn't part of the wizard's step navigation and sits
   alone in the corner with nothing to match. padding is zeroed because the
   fixed box plus .bg-icon's flex centring already place the glyph, and with
   border-box the inherited padding would just squeeze the content box.

   NOTE: .theme-toggle and .bg-icon are both single classes, so these win on
   source order alone — this rule has to stay below .bg-icon. */
.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1;
  width: 3rem;
  height: 3rem;
  padding: 0;
  font-size: var(--fs-500);
}

/* Both icons and both labels are in the markup, and CSS shows whichever pair
   matches the current theme. That keeps the state in one place — the
   data-theme attribute on <html> — rather than mirroring it in JS and risking
   the icon and the announced label drifting apart.

   Keyed on data-theme only, not .dark-mode: codex/dark.css honours both, but
   this app only ever sets the attribute. */
[data-theme='dark'] .theme-to-dark,
html:not([data-theme='dark']) .theme-to-light {
  display: none;
}

/* ---------------------------------------------------------------------------
 * 5. Mail server cards
 * ------------------------------------------------------------------------ */

.modals {
  display: grid;
  grid-gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(15em, 1fr));
  width: 100%;
  /* stretch on the block axis so every card in a row matches the tallest;
     center on the inline axis, which .server's width: 95% relies on.
     Was `place-items: center`, which sized each card to its own content —
     so the Other card came up short by the height of a logo. */
  place-items: stretch center;
}

/* height: auto with a min-height, not height: 100% — the original filled a
   fixed-height card, and with a content-sized container that ballooned the
   cards to ~500px. */
.server {
  color: var(--clr-neutral-800);
  font-size: 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid var(--clr-neutral-400);
  padding: 2rem;
  text-align: center;
  background-color: var(--clr-neutral-100);
  cursor: pointer;
  text-decoration: none;
  display: flex;
  width: 95%;
  height: auto;
  min-height: 8rem;
  align-items: center;
  justify-content: center;
  transition:
    border-color 200ms ease-out,
    box-shadow 200ms ease-out;
}

.server:hover {
  border: 1px solid var(--clr-neutral-800);
  /* --shadow-card-hover, not --shadow-hover: Codex defines --shadow-hover as
     a colour, so that name is taken. See the design tokens section above. */
  box-shadow: var(--shadow-card-hover);
}

/* border-color, not border: the `border: transparent` shorthand resets
   border-style to none, so the computed width went 1px -> 0 and the card
   visibly shrank by 2px on focus. */
.open-button:focus-visible,
.open-button:active {
  box-shadow: var(--shadow-focus);
  outline: 2px solid var(--clr-accent-400);
  border-color: transparent;
}

/* Text-label cards (currently just "Other") carry the weight the logo
   wordmarks have on the other cards, so the grid reads evenly. */
.server-label {
  font-weight: 600;
}

.server-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
  margin-top: 1.5rem;
}

/* Sprite references have no viewBox of their own, so they fall back to the
   replaced-element default of 300x150 and height:auto won't shrink them.
   Both axes need definite values; the symbol's viewBox keeps the ratio. */
.server-svg,
.modal-svg {
  width: 100%;
  max-width: 11rem;
  height: 2.25rem;
}

/* The three wordmarks have very different aspect ratios — Exchange 4.4:1,
   Microsoft 6.2:1, Google 7.8:1 — and with preserveAspectRatio "meet" each
   fits inside the box above, so whichever axis binds first sets the rendered
   size. At 11rem x 2.25rem (4.9:1) Exchange is height-limited and fills the
   box, while Google is width-limited and lands only 1.41rem tall: 37%
   shorter than Exchange. That's why it read as undersized rather than
   anything being wrong with the asset.

   A modal has room a card doesn't, so widening the box here lets HEIGHT be
   the binding axis for all three. Google needs 17.6rem of width to reach the
   2.25rem height set above, so a 20rem cap makes every wordmark exactly
   2.25rem tall — Google about 17.6rem wide, Microsoft 13.9rem, Exchange
   9.9rem — and lets their widths differ, which is the right normalisation
   for wordmarks: they're text, and equal cap height is what reads as equal
   size.

   Only max-width is set here; the height comes from the shared rule above.
   The 20rem cap is deliberately looser than the 17.6rem Google needs, so
   nudging that shared height up a little doesn't silently flip Google back
   to being width-limited.

   Below roughly a 360px viewport the modal gets narrower than Google needs
   and it goes back to being width-limited, shrinking proportionally. That's
   correct, not a regression.

   The cards keep the 11rem cap — the grid depends on them staying uniform. */
.modal-svg {
  max-width: 20rem;
}

/* ---------------------------------------------------------------------------
 * 6. Modals
 * ------------------------------------------------------------------------ */

.modal {
  border-radius: 0.5rem;
  /* Separation from the page needs different mechanics per theme. A shadow
     works in light mode because the surface is lighter than what sits behind
     it. Under dark, the modal and the darkened backdrop are both near-black
     and a heavier shadow has nothing left to darken — so the raised tokens
     lift the surface a step in lightness and strengthen the border instead,
     which is how elevation actually reads on a dark ground. The shadow stays
     for light mode. */
  border: 1px solid var(--clr-border-raised);
  box-shadow: var(--shadow);
  background-color: var(--clr-surface-raised);
  /* Was 70vmin, which keys off the shorter viewport axis — on a wide desktop
     that let the modal grow past a comfortable measure, and on a phone it
     left almost no gutter. */
  max-width: min(100% - 2rem, 40rem);
  padding: 2rem;
  /* Open/close animation. `display` and `overlay` need allow-discrete so the
     dialog stays painted while the exit transition runs; @starting-style
     gives the entry transition somewhere to start from. Browsers without
     these features skip straight to the open state, which is fine. */
  opacity: 0;
  transform: scale(0.98);
  transition:
    opacity 200ms ease-out,
    transform 200ms ease-out,
    overlay 200ms ease-out allow-discrete,
    display 200ms ease-out allow-discrete;
}

/* Components sitting on the raised surface get raised with it. This
   redefines the token for the modal's subtree rather than adding
   higher-specificity rules, which is the point: every existing .bg-icon
   state — rest, :hover, :focus-visible, :active — keeps its own specificity
   and just resolves one step lighter. Overriding them individually would
   mean out-specifying .bg-icon:hover, button.close-button:hover and
   .bg-icon:focus-visible separately, and getting one wrong would silently
   flatten that state.

   Scoped here rather than overridden globally in the dark block because
   --clr-neutral-300 is also the footer link hover chip, where stepping up to
   --neutral-bg-component-hover would drop its contrast against
   --clr-neutral-800 text from roughly 6:1 to 4.3:1 — under AA.

   Light mode resolves --clr-component-raised to the same value
   --clr-neutral-300 already had, so this is a no-op there. */
.modal {
  --clr-neutral-300: var(--clr-component-raised);
}

.modal[open] {
  opacity: 1;
  transform: scale(1);
}

@starting-style {
  .modal[open] {
    opacity: 0;
    transform: scale(0.98);
  }
}

.modal::backdrop {
  background-color: #000;
  opacity: 0;
  transition:
    opacity 200ms ease-out,
    overlay 200ms ease-out allow-discrete,
    display 200ms ease-out allow-discrete;
}

.modal[open]::backdrop {
  opacity: 0.8;
}

@starting-style {
  .modal[open]::backdrop {
    opacity: 0;
  }
}

/* One rhythm for everything inside a modal.

   The dialog's children — close button, content, CTA, nav arrows — each got
   their spacing from a different place. This sets a single gap between every
   pair of siblings, so changing 1.5rem here changes all of them.

   Don't add `.modal .button-primary { margin-block: 0 }` to "help" — two
   classes outranks this rule's one and the CTA loses its gap entirely. */
.modal > * + * {
  margin-block-start: 1.5rem;
}

.modal .text-nav {
  padding-top: 0;
}

/* Visible only on the Other card — the three logo modals carry the same
   <h2> as sr-only, since the logo identifies the server visually. Either way
   the dialog is aria-labelledby it, so it has an accessible name instead of
   announcing as a bare "dialog". */
.modal-title {
  font-size: 1.5rem;
  font-weight: 600;
}

.modal-content {
  color: var(--clr-neutral-900);
  padding: 0;
  --flow-space: 1.5rem;
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
}

/* The logo carries its own margins on the cards; inside a modal the flow
   spacing alone is enough, and both together doubled the gap. */
.modal .server-logo {
  margin-top: 0;
  margin-bottom: 0;
}

/* ---------------------------------------------------------------------------
 * 7. Spam filter typeahead
 *
 * Structure:
 *   .typeahead              positioning root, owns the column
 *     .typeahead-label        static label, above the field
 *     .typeahead-field        relative wrapper: input + clear button
 *       .inputfield
 *       .typeahead-clear
 *       ul                    results panel, absolute to the field
 *       .typeahead-empty      no-results panel, same position
 *
 * The floating label is gone. Codex's KbFormField stacks a static label above
 * the control and helper text below it, and a floating label can't coexist
 * with either — it IS the label. Anchoring the panel to .typeahead-field
 * rather than .typeahead means helper text can be added after the field later
 * without the dropdown sliding down to clear it.
 * ------------------------------------------------------------------------ */

.typeahead {
  position: relative;
  width: clamp(40ch, 40%, 50ch);
  text-align: left;
}

/* Full size, not the old scale(0.7) float. --fs-400 matches Codex, whose
   form-field label is body-regular-base. --fs-500 if you want it bigger. */
.typeahead-label {
  display: block;
  font-size: var(--fs-400);
  color: var(--clr-neutral-900);
  margin-bottom: 0.375rem;
}

.typeahead-field {
  position: relative;
}

/* Dropped from this rule along with the floating label: position: relative,
   display: flex, flex-direction: column, align-items: center and a margin
   transition. None of them do anything to an <input> — they were scaffolding
   for the label that used to be positioned against it. */
.inputfield {
  width: 100%;
  /* Right padding keeps typed text from running under the clear button. */
  padding: 1rem 2.5rem 1rem 0.5rem;
  border: 1px solid var(--clr-neutral-400);
  background-color: var(--clr-neutral-200);
  /* Both explicit, and neither is redundant. Form controls don't inherit
     `color` from the document, so without it the field renders the browser's
     default text colour — black on a dark field. caret-color follows
     currentColor by default, but naming it documents the intent and covers
     browsers that resolve the caret separately. color-scheme, set in the
     design tokens section above, is the systemic half of this fix. */
  color: var(--clr-neutral-900);
  caret-color: var(--clr-neutral-900);
  border-radius: 0.25rem;
  font-size: 1rem;
  height: 3rem;
  line-height: 1.33333;
}

.inputfield:active,
.inputfield:focus {
  background-color: var(--clr-neutral-100);
  outline-color: var(--clr-link-400);
}

/* Trailing actions, one at a time. The arrow shows while the field is empty
   (there's a list to browse); the clear button replaces it once there's text
   (and by then the list is already open, so the arrow has nothing left to
   do). :placeholder-shown does the swap, so neither needs JS toggling and
   they never crowd each other. Codex stacks both side by side via
   KbFieldTrailingActions if you'd rather see them together.

   The clear button is a general sibling of the input now, not an adjacent
   one — the arrow sits between them in source order. */
.inputfield:not(:placeholder-shown) + .typeahead-open,
.inputfield:placeholder-shown ~ .typeahead-clear {
  display: none;
}

/* The ::before overlay grows the pointer target to 24x24 for WCAG 2.2
   SC 2.5.8 while the layout box stays icon-sized, so the icon doesn't shift
   — the same trick Codex uses in KbClearButton. */
.typeahead-open,
.typeahead-clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--clr-neutral-800);
  font-size: var(--fs-400);
  border-radius: 0.25rem;
  transition: color 200ms ease-out;
}

.typeahead-open::before,
.typeahead-clear::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.5rem;
  height: 1.5rem;
  transform: translate(-50%, -50%);
}

.typeahead-open:hover,
.typeahead-clear:hover {
  color: var(--clr-neutral-900);
}

.typeahead-open:focus-visible,
.typeahead-clear:focus-visible {
  outline: 2px solid var(--clr-accent-400);
  outline-offset: 2px;
}

/* Flip the chevron while the list is open. The hook is the input's own
   aria-expanded, which the JS already keeps accurate for screen readers — so
   there's no extra class to set and no second source of truth to drift out of
   sync with what assistive tech is told.

   The rotation goes on the icon, not the button: the button is already using
   transform for its translateY(-50%) centring, and a second transform on the
   same element replaces it rather than composing with it — the button would
   drop to the bottom of the field. */
.typeahead-open i {
  transition: transform 200ms ease-out;
}

.inputfield[aria-expanded='true'] + .typeahead-open i {
  transform: rotate(180deg);
}

.typeahead-field > ul {
  position: absolute;
  /* Overlaps the input's bottom border by 2px and carries the card shadow, so
     the panel reads as floating over the field rather than welded to it.
     Codex's dropdown is a reka popper with shadow-floating and rounded-sm on
     all four corners — butting a square-topped panel against the border is
     what made ours look attached. The z-index clears the trailing buttons so
     the overlap covers that border rather than sliding under it. */
  top: calc(100% - 2px);
  border: 1px solid var(--clr-neutral-400);
  border-radius: 0.25rem;
  box-shadow: var(--shadow);
  background-color: var(--clr-neutral-100);
  max-height: 21rem;
  overflow-y: auto;
  margin: 0;
  width: 100%;
  padding: 0;
  z-index: 2;
}

.typeahead-field > ul:empty {
  visibility: hidden;
}

/* Not a flex container. It was one for no reason — the row is inline text —
   and it had a visible cost: in a flex container each text run and the marked
   run become separate flex items, so align-items: center centred every box on
   its own instead of sharing a baseline, and the emphasised letters rode
   visibly higher than the rest of the name.

   margin-left: 0 overrides the global `li` rule in section 1, which doesn't
   reach this list through `ul[class]` (it has an id, no class) and was
   indenting every row by 1.5rem — floating the highlight bar inward off the
   panel edge. The transparent border reserves the bar's width at rest so
   highlighting a row doesn't shift its text sideways. */
.typeahead-field > ul > li {
  padding: 0.5em 0.75em;
  margin-left: 0;
  border-left: 0.25em solid transparent;
  cursor: pointer;
}

/* <mark>, not <strong>: the matched run is highlighted for reference, which
   is what mark means — strong means strong importance, and a matched
   substring isn't important, it just matched. The UA gives mark a yellow
   background and its own text colour; both are reset so the weight carries it
   and the row's own highlight stays the only background in play.

   700, not 600: at 600 against Inter regular the match barely reads as
   emphasised. Inter Variable covers 100-900, so 700 is a real face rather
   than a synthesised one. */
.typeahead-field > ul > li mark {
  background: none;
  color: inherit;
  font-weight: var(--fw-700);
}

/* One treatment for both, so the two can't read as different states. Hover is
   suppressed while the keyboard owns the highlight — wizard.js sets
   data-keyboard-nav on arrow keys and drops it on pointerover, the same split
   Codex draws in useComboboxKeyboardNav.

   The link ramp rather than brand vermillion, and the tokens invert between
   themes so the fill is always the opposite lightness to the row text. See
   --clr-highlight-bg above. */
.typeahead-field > ul:not([data-keyboard-nav]) > li:hover,
.typeahead-field > ul > li.selected {
  background-color: var(--clr-highlight-bg);
  border-left-color: var(--clr-highlight-bar);
}

/* role="status" in the markup, so assigning textContent announces it;
   styled as the panel it stands in for. */
.typeahead-empty {
  position: absolute;
  top: calc(100% - 2px);
  width: 100%;
  padding: 0.5em 0.75em;
  border: 1px solid var(--clr-neutral-400);
  border-radius: 0.25rem;
  box-shadow: var(--shadow);
  background-color: var(--clr-neutral-100);
  color: var(--clr-neutral-800);
  z-index: 2;
}

.typeahead-empty:empty {
  display: none;
}

/* ---------------------------------------------------------------------------
 * 8. Utilities
 * ------------------------------------------------------------------------ */

.block {
  display: block;
  width: 100%;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
}

.margin {
  margin-bottom: 3rem;
}

@media (min-width: 40em) {
  .margin {
    margin-bottom: 0;
  }
}

.flow-content > * + * {
  margin-top: var(--flow-space, var(--spacer));
}

/* A visually hidden element takes no space, so it shouldn't create rhythm
   either. Without this, an .sr-only heading makes the first visible element
   a second child, which then picks up a flow margin it didn't have before —
   an invisible element producing a visible gap. */
.flow-content > .sr-only + * {
  margin-top: 0;
}

.flow-content--xl {
  --flow-space: 4.5rem;
}

.flow-content--large {
  --flow-space: 3rem;
}

.flow-content--medium {
  --flow-space: 1.5rem;
}

.flow-content--small {
  --flow-space: 1rem;
}

.switcher {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.switcher-modals {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: flex-start;
  align-items: center;
}

.box {
  flex: 0 1 15rem;
  margin: 0.5rem;
}

@media (min-width: 40em) {
  .center {
    border-radius: 0.5rem;
  }

  .box {
    flex: 0 1 10rem;
    margin: 0 1rem 0 1rem;
  }
}

.center-aligned {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.left-aligned {
  text-align: left;
  width: 100%;
}

.heading {
  color: var(--clr-neutral-900);
  font-weight: var(--fw-600);
}

.sr-only {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.hidden {
  display: none;
}

/* ---------------------------------------------------------------------------
 * 9. Motion
 *
 * The screen transition runs by itself: <section> is rebuilt on every screen
 * change, so the animation fires with no JS. Entry only — an exit animation
 * would mean delaying navigation, which reads as lag rather than polish.
 * ------------------------------------------------------------------------ */

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(0.375rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Motion here is a nicety, never information, so drop all of it for anyone
   who has asked the OS to reduce motion. */
@media (prefers-reduced-motion: reduce) {
  a,
  .button,
  .bg-icon,
  .close-button,
  .server {
    transition: none;
  }

  .typeahead-open i {
    transition: none;
  }

  section {
    animation: none;
  }

  .modal,
  .modal::backdrop {
    transition: none;
  }
}
