/* ==========================================================================
   Toolifyer design system
   Style:  Flat Design + Minimalism + Trust & Authority
   Colour: professional navy + brand blue (matches the logo mark)
   Type:   system UI stack (zero font requests -> no swap, no CLS)
   ========================================================================== */

/* ------------------------------------------------------------------ tokens */

:root {
  color-scheme: light;

  /* Brand — sampled from the logo */
  --brand-navy: #0f172a;
  --brand-blue: #1d4ed8;
  --brand-blue-bright: #2563eb;

  /* Surfaces */
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-raised: #ffffff;

  /* Text — all pairings verified at 4.5:1 or better */
  --fg: #0b1220;          /* 17.4:1 on --bg   */
  --fg-muted: #55617a;    /* 6.1:1  on --bg   */
  /* Darkened from #6b7689: at the old value, small text on the tinted
     --surface-2 wells (toolbars, tab strips, table headers) measured 4.2:1
     and missed AA. This clears 4.5:1 on --bg, --surface and --surface-2. */
  --fg-subtle: #626d80;
  --fg-on-primary: #ffffff;

  /* Interactive */
  --primary: #1d4ed8;         /* 6.4:1 on white */
  --primary-hover: #1a3fb0;
  --primary-active: #16358f;
  --primary-soft: #eef2ff;
  --primary-soft-fg: #1e3a8a;

  /* Semantic */
  --success: #15803d;
  --success-soft: #dcfce7;
  --success-soft-fg: #14532d;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --danger-soft-fg: #7f1d1d;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --warning-soft-fg: #78350f;

  /* Lines */
  --border: #dfe5ee;
  --border-strong: #c6cfdd;
  --ring: #2563eb;

  /* Elevation — restrained, flat-design appropriate */
  --shadow-sm: 0 1px 2px rgba(11, 18, 32, 0.06);
  --shadow-md: 0 2px 8px rgba(11, 18, 32, 0.07), 0 1px 2px rgba(11, 18, 32, 0.05);
  --shadow-lg: 0 12px 28px rgba(11, 18, 32, 0.1);

  /* Spacing scale (standard density) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Radii */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* Type scale */
  --font-sans: Inter, "Inter var", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --text-xs: 0.8125rem;   /* 13px — labels only, never body copy */
  --text-sm: 0.875rem;    /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.125rem;
  --text-4xl: clamp(2.25rem, 1.6rem + 2.6vw, 3.25rem);

  /* Motion */
  --ease: cubic-bezier(0.2, 0, 0.2, 1);
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-slow: 260ms;

  --container: 1160px;
  --header-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #0a1020;
    --surface: #121a2c;
    --surface-2: #18233a;
    --surface-raised: #162034;

    --fg: #e8eef9;          /* 15.2:1 on --bg */
    --fg-muted: #a3b0c6;    /* 8.0:1  on --bg */
    --fg-subtle: #8593ad;   /* 5.6:1  on --bg */

    --primary: #7ea6ff;         /* light-on-dark: 7.1:1 on --bg */
    --primary-hover: #9bbaff;
    --primary-active: #b3cbff;
    --primary-soft: #1b2a4d;
    --primary-soft-fg: #c3d6ff;
    --fg-on-primary: #0a1020;

    --success: #6ee7a0;
    --success-soft: #10321f;
    --success-soft-fg: #a7f3c9;
    --danger: #fca5a5;
    --danger-soft: #3a1717;
    --danger-soft-fg: #fecaca;
    --warning: #fcd34d;
    --warning-soft: #3a2c0c;
    --warning-soft-fg: #fde68a;

    --border: #26324a;
    --border-strong: #3a4761;
    --ring: #7ea6ff;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0a1020;
  --surface: #121a2c;
  --surface-2: #18233a;
  --surface-raised: #162034;

  --fg: #e8eef9;
  --fg-muted: #a3b0c6;
  --fg-subtle: #8593ad;

  --primary: #7ea6ff;
  --primary-hover: #9bbaff;
  --primary-active: #b3cbff;
  --primary-soft: #1b2a4d;
  --primary-soft-fg: #c3d6ff;
  --fg-on-primary: #0a1020;

  --success: #6ee7a0;
  --success-soft: #10321f;
  --success-soft-fg: #a7f3c9;
  --danger: #fca5a5;
  --danger-soft: #3a1717;
  --danger-soft-fg: #fecaca;
  --warning: #fcd34d;
  --warning-soft: #3a2c0c;
  --warning-soft-fg: #fde68a;

  --border: #26324a;
  --border-strong: #3a4761;
  --ring: #7ea6ff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.55);
}

/* -------------------------------------------------------------------- base */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  width: 100%;
  max-width: 100vw;
  hyphens: auto;
  -webkit-hyphens: auto;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-wrap: balance;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
}

h1 { font-size: var(--text-4xl); letter-spacing: -0.03em; }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { margin: 0 0 var(--space-4); overflow-wrap: break-word; hyphens: auto; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--dur) var(--ease);
  overflow-wrap: break-word;
  word-break: normal;
}
a:hover { color: var(--primary-hover); }

img, svg, canvas, video { max-width: 100%; }
img { height: auto; display: block; }

pre, code {
  max-width: 100%;
  overflow-x: auto;
  overflow-wrap: anywhere;
}

/* Every interactive element keeps a visible focus ring (a11y rule #1). */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--primary);
  color: var(--fg-on-primary);
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--primary);
  color: var(--fg-on-primary);
  border-radius: var(--radius);
  font-weight: 600;
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--space-3); color: var(--fg-on-primary); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ layout */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

@media (min-width: 768px) {
  .container { padding-inline: var(--space-5); }
}

.section { padding-block: var(--space-7); }
.section--tight { padding-block: var(--space-6); }

@media (min-width: 768px) {
  .section { padding-block: var(--space-8); }
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.section__head p { margin: var(--space-1) 0 0; color: var(--fg-muted); }
.section__head h2 { margin: 0; font-size: var(--text-2xl); }

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
}

/* ------------------------------------------------------------------ header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 100vw;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

@supports not (backdrop-filter: blur(1px)) {
  .site-header { background: var(--surface); }
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-h);
  width: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
  border-radius: var(--radius);
}
.brand__logo {
  width: 148px;
  height: 34px;
  object-fit: contain;
  object-position: left center;
}

@media (max-width: 480px) {
  .brand__logo { width: 124px; height: 28px; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-header .brand__logo {
    filter: brightness(0) invert(1);
  }
}
:root[data-theme="dark"] .site-header .brand__logo {
  filter: brightness(0) invert(1);
}
:root[data-theme="light"] .site-header .brand__logo {
  filter: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-inline-start: auto;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 40px;
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.nav__link:hover { color: var(--fg); background: var(--surface-2); }
.nav__link[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }

/* ------------------------------------------------------------ nav dropdown */

.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav__link--dropdown {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.nav__link--dropdown::-webkit-details-marker { display: none; }
.nav-dropdown[open] .nav__link--dropdown svg { transform: rotate(180deg); }
.nav__link--dropdown svg { transition: transform var(--dur-fast) var(--ease); color: var(--fg-subtle); }

.nav-dropdown__menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  width: 320px;
  max-width: 90vw;
  padding: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-dropdown__item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-dropdown__item:hover,
.nav-dropdown__item.is-active {
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
}
.nav-dropdown__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
}
.nav-dropdown__item:hover .nav-dropdown__icon,
.nav-dropdown__item.is-active .nav-dropdown__icon {
  background: var(--surface);
}
.nav-dropdown__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.nav-dropdown__text strong {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
}
.nav-dropdown__text small {
  font-size: var(--text-xs);
  color: var(--fg-muted);
  line-height: 1.3;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-dropdown__item:hover .nav-dropdown__text small,
.nav-dropdown__item.is-active .nav-dropdown__text small {
  color: inherit;
  opacity: 0.85;
}

.nav__mobile-categories {
  display: none;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-inline-start: auto;
  flex-shrink: 0;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.icon-button:hover {
  color: var(--fg);
  background: var(--surface-2);
  border-color: var(--border);
}

.nav-toggle { display: none; }

/* ------------------------------------------------------------ langpicker */

.langpicker {
  position: relative;
  display: inline-block;
}
.langpicker__toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.langpicker__toggle::-webkit-details-marker { display: none; }
.langpicker__toggle:hover { color: var(--fg); background: var(--surface-2); border-color: var(--border); }
.langpicker__current { letter-spacing: 0.04em; }

.langpicker__menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 80;
  width: min(260px, calc(100vw - 32px));
  max-height: 320px;
  overflow-y: auto;
  padding: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.langpicker__label {
  padding: var(--space-1) var(--space-2);
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.langpicker__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.langpicker__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: var(--text-sm);
  text-decoration: none;
  min-height: 40px;
}
.langpicker__item:hover,
.langpicker__item[aria-current="true"] {
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
  font-weight: 600;
}
.langpicker__native { font-weight: 500; }
.langpicker__code {
  font-size: var(--text-xs);
  color: var(--fg-muted);
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ search */

.search {
  position: relative;
  flex: 1 1 240px;
  max-width: 400px;
}

.search-toggle { display: none; }

.mobile-search-bar {
  display: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-2) 0;
  box-shadow: var(--shadow-md);
}
.mobile-search-bar:not([hidden]) {
  display: block;
}
.search--mobile-bar {
  width: 100%;
  max-width: 100%;
}
.search__clear {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 0;
  margin-inline-start: auto;
}
.search__clear:hover {
  color: var(--fg);
  background: var(--surface-2);
}

.nav__mobile-search {
  display: none;
}

.search__field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 40px;
  padding-inline: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search__field:focus-within {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent);
}
.search__field svg { flex: 0 0 auto; color: var(--fg-subtle); }

.search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: var(--text-sm);
  outline: none;
}
.search__input::-webkit-search-cancel-button,
.search__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}
.search__input::placeholder { color: var(--fg-subtle); }

.search__results {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  z-index: 90;
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.search__results[hidden] { display: none; }

.search__result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
  min-height: 44px;
}
.search__result:hover,
.search__result[aria-selected="true"] {
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
}
.search__result strong { display: block; font-size: var(--text-sm); font-weight: 600; }
.search__result span {
  display: block;
  font-size: var(--text-xs);
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search__result:hover span,
.search__result[aria-selected="true"] span { color: inherit; opacity: 0.85; }

.search__empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

@media (max-width: 899px) {
  .site-header__inner {
    flex-wrap: nowrap;
    justify-content: space-between;
    row-gap: 0;
    padding-block: var(--space-2);
    min-height: 56px;
  }
  .brand {
    order: 1;
    flex-shrink: 0;
  }
  .search--desktop {
    display: none;
  }
  .header__actions {
    order: 2;
    margin-inline-start: auto;
    gap: var(--space-1);
  }
  .search-toggle {
    display: inline-grid;
  }
  .nav__mobile-search {
    display: block;
    margin-bottom: var(--space-3);
  }
  .search--drawer {
    width: 100%;
    max-width: 100%;
  }

  .nav-toggle { display: inline-grid; }

  .nav-dropdown { display: none; }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
    margin: 0;
    padding: var(--space-3) var(--space-4) var(--space-5);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    max-height: calc(100dvh - 120px);
    overflow-y: auto;
    /* Hidden by default on mobile; opened via [data-open="true"] */
    display: none;
    z-index: 100;
  }
  .nav[data-open="true"] { display: flex; }
  .nav__link { min-height: 44px; font-size: var(--text-base); }

  .nav__mobile-categories {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-block: var(--space-2);
    padding-block: var(--space-2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  .nav__section-title {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--fg-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-1) var(--space-3);
  }
  .nav__link--mobile-sub {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 42px;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    color: var(--fg);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
  }
  .nav__link--mobile-sub:hover,
  .nav__link--mobile-sub[aria-current="page"] {
    background: var(--primary-soft);
    color: var(--primary-soft-fg);
  }
  .nav__link--mobile-sub svg {
    color: var(--primary);
    flex-shrink: 0;
  }
}

/* ----------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--fg-on-primary);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  max-width: 100%;
  overflow-wrap: break-word;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--primary-hover); color: var(--fg-on-primary); }
.btn:active { background: var(--primary-active); transform: translateY(1px); }

@media (max-width: 599px) {
  .btn {
    white-space: normal;
    text-align: center;
    padding-block: var(--space-2);
    hyphens: auto;
  }
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--fg);
}
.btn--secondary:hover { background: var(--surface-2); border-color: var(--fg-subtle); color: var(--fg); }
.btn--secondary:active { background: var(--surface-2); }

.btn--ghost { background: transparent; color: var(--fg-muted); }
.btn--ghost:hover { background: var(--surface-2); color: var(--fg); }

.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); color: #fff; }

.btn--sm { min-height: 36px; padding: 0 var(--space-3); font-size: var(--text-xs); }
.btn--lg { min-height: 52px; padding: 0 var(--space-6); font-size: var(--text-base); }
.btn--block { width: 100%; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ------------------------------------------------------------------ badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
}
.badge svg { flex: 0 0 auto; }

.badge--privacy { background: var(--success-soft); color: var(--success-soft-fg); }
.badge--neutral { background: var(--surface-2); color: var(--fg-muted); }
.badge--primary { background: var(--primary-soft); color: var(--primary-soft-fg); }

/* Full-width trust banner used at the top of every tool */
.privacy-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--success-soft);
  color: var(--success-soft-fg);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
}
.privacy-banner svg { flex: 0 0 auto; margin-top: 2px; }

/* ------------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: var(--space-4);
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}
.tool-card:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.tool-card:focus-within {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent);
}

.tool-card__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
}

.tool-card__title { margin: 0; font-size: var(--text-lg); }

/* Whole card is clickable, while the link itself stays the a11y target. */
.tool-card__link { text-decoration: none; color: inherit; }
.tool-card__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.tool-card__link:hover { color: var(--primary); }

.tool-card__desc {
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  flex: 1;
}

.tool-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.tool-card--empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-8) var(--space-5);
  color: var(--fg-muted);
  border-style: dashed;
  box-shadow: none;
}

/* ------------------------------------------------------------------- chips */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
/* Reserve the row height so filter chips never shift content. */
.chip-row--filters { min-height: 44px; align-items: center; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--fg-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.chip:hover { background: var(--surface-2); color: var(--fg); }
.chip[aria-pressed="true"],
.chip[aria-current="page"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--fg-on-primary);
}

/* ------------------------------------------------------------- breadcrumbs */

.breadcrumbs {
  padding-block: var(--space-4) 0;
  font-size: var(--text-sm);
}
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.breadcrumbs li { display: flex; align-items: center; gap: var(--space-2); }
.breadcrumbs li:not(:last-child)::after {
  content: "/";
  color: var(--fg-subtle);
}
.breadcrumbs a { color: var(--fg-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--fg); font-weight: 600; }

/* -------------------------------------------------------------------- hero */

.hero {
  padding-block: var(--space-7) var(--space-6);
  text-align: center;
}
@media (min-width: 768px) {
  .hero { padding-block: var(--space-8) var(--space-7); }
}

.hero h1 { margin-bottom: var(--space-4); }

.hero__lead {
  max-width: 46rem;
  margin-inline: auto;
  font-size: var(--text-lg);
  color: var(--fg-muted);
  text-wrap: pretty;
}

.hero__search {
  max-width: 620px;
  margin: var(--space-6) auto 0;
}
.hero__search .search { max-width: none; flex-basis: auto; }
.hero__search .search__field { height: 56px; padding-inline: var(--space-4); }
.hero__search .search__input { font-size: var(--text-base); }

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* ---------------------------------------------------------------- features */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: var(--space-4);
}

.feature {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.feature__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
  margin-bottom: var(--space-1);
}
.feature h3 { margin: 0; font-size: var(--text-base); }
.feature p { margin: 0; color: var(--fg-muted); font-size: var(--text-sm); }

/* --------------------------------------------------------------- tool page */

.tool-header { padding-block: var(--space-5) var(--space-4); }
.tool-header h1 { margin-bottom: var(--space-3); }
.tool-header__lead {
  max-width: 62ch;
  color: var(--fg-muted);
  font-size: var(--text-lg);
}
.tool-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.tool-app {
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  margin-block: var(--space-5);
}
@media (min-width: 768px) {
  .tool-app { padding: var(--space-6); }
}

.tool-app__section + .tool-app__section {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

.tool-noscript {
  padding: var(--space-4);
  background: var(--warning-soft);
  color: var(--warning-soft-fg);
  border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
  border-radius: var(--radius);
  font-size: var(--text-sm);
}

/* ------------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field + .field { margin-top: var(--space-4); }

.label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg);
}
.label__hint {
  display: block;
  font-weight: 400;
  color: var(--fg-muted);
  font-size: var(--text-xs);
  margin-top: 2px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--text-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent);
}
.input::placeholder,
.textarea::placeholder { color: var(--fg-subtle); }

.textarea {
  min-height: 240px;
  resize: vertical;
  line-height: 1.6;
}
.textarea--code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  tab-size: 2;
}

.select {
  appearance: none;
  padding-inline-end: var(--space-6);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: var(--space-4);
}

/* Switch / checkbox */
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  cursor: pointer;
  font-size: var(--text-sm);
  user-select: none;
}
.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
  flex: 0 0 auto;
}

/* Range */
.range {
  width: 100%;
  height: 44px;
  accent-color: var(--primary);
  cursor: pointer;
  background: transparent;
}
.range-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.range-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--primary);
  font-size: var(--text-sm);
}

/* Segmented control */
.segmented {
  display: inline-flex;
  padding: var(--space-1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  gap: var(--space-1);
  flex-wrap: wrap;
}
.segmented button {
  min-height: 36px;
  padding: 0 var(--space-4);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.segmented button:hover { color: var(--fg); }
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------- drop zone */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: 200px;
  padding: var(--space-6) var(--space-4);
  text-align: center;
  background: var(--surface-2);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--fg-muted);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
}
.dropzone[data-dragover="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
}
.dropzone__icon { color: var(--primary); }
.dropzone__title { font-size: var(--text-lg); font-weight: 700; color: var(--fg); margin: 0; }
.dropzone[data-dragover="true"] .dropzone__title,
.dropzone:hover .dropzone__title { color: inherit; }
.dropzone__hint { margin: 0; font-size: var(--text-sm); }

/* ------------------------------------------------------------- file list */

.file-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.file-item__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--fg-muted);
  overflow: hidden;
}
.file-item__icon img { width: 100%; height: 100%; object-fit: cover; }
.file-item__body { flex: 1; min-width: 0; }
.file-item__name {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item__meta {
  display: block;
  font-size: var(--text-xs);
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.file-item__actions { display: flex; gap: var(--space-1); flex: 0 0 auto; }
.file-item__actions .icon-button { width: 36px; height: 36px; }
@media (min-width: 600px) {
  .file-item__actions .icon-button { width: 44px; height: 44px; }
}

/* --------------------------------------------------------------- statistics */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: var(--space-3);
}

.stat {
  padding: var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.stat__value {
  display: block;
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.1;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  /* Fixed line box so counting up never nudges the layout. */
  min-height: 1.1em;
}
.stat__label {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat--primary { background: var(--primary-soft); border-color: transparent; }
.stat--primary .stat__value { color: var(--primary-soft-fg); }
.stat--primary .stat__label { color: var(--primary-soft-fg); opacity: 0.8; }

/* ------------------------------------------------------------------ tables */

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  background: var(--surface);
}
.table th,
.table td {
  padding: var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th {
  background: var(--surface-2);
  font-weight: 700;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  position: sticky;
  top: 0;
}
.table tr:last-child td { border-bottom: 0; }
.table td:not(:first-child) { font-variant-numeric: tabular-nums; }

/* Density bar doubles as a non-colour-only cue for the value. */
.density-bar {
  display: block;
  height: 6px;
  min-width: 2px;
  border-radius: var(--radius-pill);
  background: var(--primary);
}

/* ------------------------------------------------------------------ alerts */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  border: 1px solid transparent;
}
.alert svg { flex: 0 0 auto; margin-top: 2px; }
.alert__body { min-width: 0; }
.alert__title { font-weight: 700; }
.alert code {
  display: block;
  margin-top: var(--space-2);
  padding: var(--space-2);
  background: color-mix(in srgb, currentColor 10%, transparent);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  overflow-x: auto;
  white-space: pre;
}
.alert--error { background: var(--danger-soft); color: var(--danger-soft-fg); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.alert--success { background: var(--success-soft); color: var(--success-soft-fg); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.alert--info { background: var(--primary-soft); color: var(--primary-soft-fg); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.alert--warning { background: var(--warning-soft); color: var(--warning-soft-fg); border-color: color-mix(in srgb, var(--warning) 40%, transparent); }
.alert[hidden] { display: none; }

/* Live region wrapper keeps its height so messages do not shift content. */
.status-line {
  min-height: 24px;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* ---------------------------------------------------------------- progress */

.progress {
  height: 8px;
  width: 100%;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
}
.progress__bar {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: inherit;
  transition: width var(--dur-slow) var(--ease);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.is-busy { position: relative; pointer-events: none; opacity: 0.7; }

/* --------------------------------------------------------------- accordion */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.faq {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  min-height: 56px;
  padding: var(--space-3) var(--space-4);
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  list-style: none;
  transition: background-color var(--dur) var(--ease);
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q:hover { background: var(--surface-2); }
.faq__q svg {
  flex: 0 0 auto;
  color: var(--fg-subtle);
  transition: transform var(--dur) var(--ease);
}
.faq[open] .faq__q svg { transform: rotate(180deg); }
.faq[open] .faq__q { color: var(--primary); }

.faq__a {
  padding: 0 var(--space-4) var(--space-4);
  color: var(--fg-muted);
  font-size: var(--text-sm);
  max-width: 75ch;
}

/* ------------------------------------------------------------------- steps */

.steps {
  display: grid;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  counter-reset: step;
  list-style: none;
}
@media (min-width: 768px) {
  .steps { grid-template-columns: repeat(2, 1fr); }
}

.step {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--fg-on-primary);
  font-size: var(--text-sm);
  font-weight: 700;
}
.step h3 { margin: 0 0 var(--space-1); font-size: var(--text-base); }
.step p { margin: 0; color: var(--fg-muted); font-size: var(--text-sm); }

/* -------------------------------------------------------------------- prose */

.prose { max-width: 72ch; }
.prose h2 { margin-top: var(--space-7); font-size: var(--text-2xl); }
.prose h3 { margin-top: var(--space-5); }
.prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: var(--space-5); color: var(--fg-muted); }
.prose li { margin-bottom: var(--space-2); }
.prose strong { color: var(--fg); }

/* ------------------------------------------------------------------ footer */

.site-footer {
  margin-top: var(--space-8);
  padding-block: var(--space-7) var(--space-5);
  background: var(--brand-navy);
  color: #cbd5e1;                 /* 10.4:1 on --brand-navy */
  border-top: 1px solid var(--border);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: var(--space-6);
}

.footer-brand { max-width: 34ch; }
.footer-brand p { margin-top: var(--space-3); font-size: var(--text-sm); color: #a9b6c9; }
.footer-brand .brand__logo { filter: brightness(0) invert(1); opacity: 0.95; }

.footer-col h2 {
  font-size: var(--text-sm);
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-3);
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: var(--space-1); }
.footer-col a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: #cbd5e1;
  font-size: var(--text-sm);
  text-decoration: none;
}
.footer-col a:hover { color: #fff; text-decoration: underline; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: var(--text-sm);
  color: #a9b6c9;
}
.footer-bottom .badge--privacy {
  background: rgba(110, 231, 160, 0.14);
  color: #a7f3c9;
}

/* ------------------------------------------------------------------ utility */

.mt-0 { margin-top: 0; }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mb-4 { margin-bottom: var(--space-4); }
.text-muted { color: var(--fg-muted); }
.text-sm { font-size: var(--text-sm); }
.text-center { text-align: center; }
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-2); }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ touch sizing

   Compact controls are fine for a mouse, but every target must clear 44x44px
   on touch. Gating on `pointer: coarse` keeps desktop density intact while
   meeting the touch guideline where it actually applies. */

@media (pointer: coarse) {
  .chip,
  .segmented button,
  .btn--sm,
  .file-item__actions .icon-button,
  .footer-col a {
    min-height: 44px;
  }
  .file-item__actions .icon-button { width: 44px; }
  .brand { min-height: 44px; }
  .check { min-height: 48px; }
}

/* --------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .tool-card:hover { transform: none; }
}

/* ------------------------------------------------------------------- print */

@media print {
  .site-header, .site-footer, .btn, .dropzone, .search { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ------------------------------------------------------- language picker */

.langpicker { position: relative; }

.langpicker__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.langpicker__toggle::-webkit-details-marker { display: none; }
.langpicker__toggle:hover { color: var(--fg); background: var(--surface-2); }
.langpicker[open] .langpicker__toggle { color: var(--primary); background: var(--primary-soft); }

.langpicker__menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 70;
  width: min(92vw, 320px);
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-3);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.langpicker__label {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

.langpicker__list {
  display: grid;
  /* Two columns keeps 25 languages reachable without a long scroll. */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr));
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.langpicker__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.langpicker__item:hover { background: var(--surface-2); color: var(--fg); }
.langpicker__item[aria-current="true"] {
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
  font-weight: 700;
}

.langpicker__code {
  flex: 0 0 auto;
  font-size: var(--text-xs);
  text-transform: uppercase;
  color: var(--fg-subtle);
}
.langpicker__item[aria-current="true"] .langpicker__code { color: inherit; opacity: 0.8; }

@media (max-width: 899px) {
  .langpicker__menu { right: auto; left: 0; }
}

/* Mirror the interface for right-to-left languages. */
[dir="rtl"] .nav { margin-inline-start: 0; margin-inline-end: auto; }
[dir="rtl"] .langpicker__menu { right: auto; left: 0; }
[dir="rtl"] .breadcrumbs li:not(:last-child)::after { content: "\\"; }

/* ==========================================================================
   Homepage hero
   ========================================================================== */

.hero-band {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  /* Generous on desktop, tighter on phones. The bottom is deliberately
     lighter than the top: the section below contributes its own 64px, so
     matching them here left a visible dead band under the badges. */
  padding-block: var(--space-8) var(--space-6);
}

@media (max-width: 599px) {
  .hero-band { padding-block: var(--space-6) var(--space-5); }
}

/* Depth without distraction: a faint dot grid, faded out at the edges so it
   never competes with the headline. */
.hero-band::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: radial-gradient(circle, var(--border-strong) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.5;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, #000 40%, transparent 100%);
}

/* A soft brand wash behind the headline. */
.hero-band::after {
  content: "";
  position: absolute;
  inset: -20% 0 auto 0;
  height: 420px;
  z-index: -1;
  background:
    radial-gradient(ellipse 50% 45% at 30% 40%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 70%),
    radial-gradient(ellipse 45% 40% at 72% 30%, color-mix(in srgb, #6366f1 12%, transparent), transparent 70%);
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-band__inner > * { animation: hero-rise var(--dur-slow) var(--ease) both; }
  .hero-band__inner > *:nth-child(2) { animation-delay: 60ms; }
  .hero-band__inner > *:nth-child(3) { animation-delay: 120ms; }
  .hero-band__inner > *:nth-child(4) { animation-delay: 180ms; }
}
@keyframes hero-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.hero-band__inner {
  max-width: 52rem;
  margin-inline: auto;
  text-align: center;
}

.hero-band h1 {
  margin: 0 0 var(--space-4);
  font-size: clamp(2.25rem, 1.5rem + 3.4vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

/* The accent half of the headline. background-clip is progressively enhanced:
   without it the text simply keeps the primary colour rather than vanishing. */
.hero-accent {
  display: inline-block;
  color: var(--primary);
}
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .hero-accent {
    background-image: linear-gradient(100deg, var(--primary) 0%, #6366f1 55%, #8b5cf6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    /* Keeps descenders from being clipped by the text box. */
    padding-bottom: 0.06em;
  }
}

.hero-band__lead {
  max-width: 44rem;
  margin: 0 auto;
  font-size: var(--text-lg);
  line-height: 1.6;
  color: var(--fg-muted);
  text-wrap: pretty;
}

/* ------------------------------------------------------- quick access */

.quick-access {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

.quick-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--fg);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    color var(--dur) var(--ease);
}
.quick-pill:hover {
  color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.quick-pill svg { color: var(--primary); flex: 0 0 auto; }

@media (prefers-reduced-motion: reduce) {
  .quick-pill:hover { transform: none; }
}

/* --------------------------------------------------------- trust badges */

.trust-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

/* Each badge carries its own soft tint; the check mark inherits it. */
.trust-badge--privacy { background: var(--success-soft); color: var(--success-soft-fg); }
.trust-badge--speed   { background: var(--primary-soft); color: var(--primary-soft-fg); }
.trust-badge--free    { background: var(--warning-soft); color: var(--warning-soft-fg); }

.trust-badge__check {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 18%, transparent);
}
.trust-badge__check svg { display: block; }

@media (max-width: 480px) {
  .trust-badge { font-size: var(--text-xs); padding-inline: var(--space-3); }
}
