/* Theme R2 (2026-10-17): the public site's theme button, logo pair and the dark hand tuning.
   Loaded by every static public page (public/*.html) and imported by the Next root layout for the Next public pages.
   Everything here is scoped to public pages (data-theme-surface="public") or to public-only classes, so the
   dashboard (/app) is never affected. Colours for both themes live in public-theme-tokens.css. */

/* ---------------------------------------------------------------- logos: black ink on light, white on dark */
/* (Repeated classes: the auth pages force `display: block !important` on header logo images.) */
html:not([data-theme='dark']) .pub-logo-dark.pub-logo-dark.pub-logo-dark,
html:not([data-theme-surface='public']) .pub-logo-dark.pub-logo-dark.pub-logo-dark,
html[data-theme='dark'][data-theme-surface='public'] .pub-logo-light.pub-logo-light.pub-logo-light {
  display: none !important;
}

/* ---------------------------------------------------------------- header: session actions + theme button */
.pub-header-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.pub-header-end--auth {
  justify-self: end;
}

.pub-theme-slot {
  display: inline-flex;
  flex: 0 0 auto;
}

/* Hold the theme button's 40px before theme.js puts it in (2026-10-25): an empty slot made the menu links slide
   sideways right after the page appeared. */
.pub-theme-slot[data-public-theme-menu] {
  min-width: 40px;
  min-height: 40px;
}

/* Static marketing pages: the actions hide at <= 980px (style.css); the button stays, next to the menu button. */
@media (min-width: 768px) and (max-width: 980px) {
  .navbar .pub-header-end {
    margin-left: auto;
  }

  .navbar .pub-header-end + .navbar-mobile-menu {
    margin-left: 10px !important;
  }

  /* Next public pages (blog, use cases, 404): the button sits just before the menu button. */
  .marketing-topbar-inner > .pub-header-end {
    order: 2;
    margin-left: auto;
  }

  /* !important: the blog/404 header (.seo-public-shell) pins the menu button with margin-left: auto !important. */
  .marketing-topbar-inner:has(> .pub-header-end) > .marketing-mobile-menu {
    order: 3;
    margin-left: 10px !important;
  }
}

/* Auth pages: the header's right column has room for the button only above ~1040px (at 920-960px it would run into
   the centred links). On phones (<= 900px) the menu panel has a theme row instead. */
@media (min-width: 768px) and (max-width: 1040px) {
  .pub-header-end--auth .pub-theme-slot {
    display: none;
  }
}

.pub-theme-panel-row {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.pub-theme-panel-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5e687b;
}

.pub-theme-inline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(56, 16, 201, 0.12);
  border-radius: 16px;
  background: rgba(56, 16, 201, 0.04);
}

.pub-theme-inline button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  margin: 0;
  padding: 0 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #141a2a;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.pub-theme-inline button.is-selected {
  background: #ffffff;
  color: #3810c9;
  box-shadow: 0 4px 12px rgba(20, 26, 42, 0.1);
}

.pub-theme-inline button:focus-visible {
  outline: 2px solid #3810c9;
  outline-offset: 1px;
}

html[data-theme='dark'][data-theme-surface='public'] .pub-theme-panel-label {
  color: #9aa6bd;
}

html[data-theme='dark'][data-theme-surface='public'] .pub-theme-inline {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme='dark'][data-theme-surface='public'] .pub-theme-inline button {
  color: #dae2fd;
}

html[data-theme='dark'][data-theme-surface='public'] .pub-theme-inline button.is-selected {
  background: #1e2740;
  color: #c7bef6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

html[data-theme='dark'][data-theme-surface='public'] .pub-theme-inline button:focus-visible {
  outline-color: #c7bef6;
}

/* ---------------------------------------------------------------- theme button (Light / Dark / Auto) */
html[data-theme-switching][data-theme-surface='public'] *,
html[data-theme-switching][data-theme-surface='public'] *::before,
html[data-theme-switching][data-theme-surface='public'] *::after {
  transition: none !important;
}

/* Owner 2026-10-26: the theme button used to pop in when theme.js (loaded last) built it. Each page now carries the
   same button from the start (data-theme-placeholder) with the three icons; the head script's data-theme-choice and
   data-theme pick the icon theme.js would show (the choice, or the theme in use when there is none). */
.pub-theme-slot [data-theme-placeholder] [data-theme-icon] { display: none; }
html[data-theme-choice="light"] .pub-theme-slot [data-theme-placeholder] [data-theme-icon="light"],
html[data-theme-choice="dark"] .pub-theme-slot [data-theme-placeholder] [data-theme-icon="dark"],
html[data-theme-choice="system"] .pub-theme-slot [data-theme-placeholder] [data-theme-icon="system"],
html[data-theme-choice="none"][data-theme="light"] .pub-theme-slot [data-theme-placeholder] [data-theme-icon="light"],
html[data-theme-choice="none"][data-theme="dark"] .pub-theme-slot [data-theme-placeholder] [data-theme-icon="dark"] { display: block; }

.pub-theme-menu {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.pub-theme-menu .ui-theme-menu-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(20, 26, 42, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #141a2a;
  box-shadow: 0 6px 18px rgba(20, 26, 42, 0.08);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.pub-theme-menu .ui-theme-menu-button:hover {
  border-color: rgba(56, 16, 201, 0.36);
  color: #3810c9;
}

.pub-theme-menu .ui-theme-menu-button:focus-visible,
.pub-theme-menu .ui-theme-menu-list button:focus-visible {
  outline: 2px solid #3810c9;
  outline-offset: 2px;
}

.pub-theme-menu .ui-theme-menu-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1200;
  display: grid;
  gap: 2px;
  width: 168px;
  padding: 6px;
  border: 1px solid rgba(20, 26, 42, 0.12);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(20, 26, 42, 0.16);
}

.pub-theme-menu .ui-theme-menu-list[hidden] {
  display: none;
}

.pub-theme-menu .ui-theme-menu-list button {
  display: grid;
  grid-template-columns: 18px 1fr 16px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #141a2a;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.pub-theme-menu .ui-theme-menu-list button:hover {
  background: rgba(56, 16, 201, 0.07);
}

.pub-theme-menu .ui-theme-menu-list button[aria-checked='true'] {
  color: #3810c9;
}

html[data-theme='dark'][data-theme-surface='public'] .pub-theme-menu .ui-theme-menu-button {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(19, 27, 46, 0.86);
  color: #dae2fd;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

html[data-theme='dark'][data-theme-surface='public'] .pub-theme-menu .ui-theme-menu-button:hover {
  border-color: rgba(199, 190, 246, 0.5);
  color: #c7bef6;
}

html[data-theme='dark'][data-theme-surface='public'] .pub-theme-menu .ui-theme-menu-button:focus-visible,
html[data-theme='dark'][data-theme-surface='public'] .pub-theme-menu .ui-theme-menu-list button:focus-visible {
  outline-color: #c7bef6;
}

html[data-theme='dark'][data-theme-surface='public'] .pub-theme-menu .ui-theme-menu-list {
  border-color: rgba(148, 163, 184, 0.22);
  background: #131b2e;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

html[data-theme='dark'][data-theme-surface='public'] .pub-theme-menu .ui-theme-menu-list button {
  color: #dae2fd;
}

html[data-theme='dark'][data-theme-surface='public'] .pub-theme-menu .ui-theme-menu-list button:hover {
  background: rgba(199, 190, 246, 0.1);
}

html[data-theme='dark'][data-theme-surface='public'] .pub-theme-menu .ui-theme-menu-list button[aria-checked='true'] {
  color: #c7bef6;
}

@media (prefers-reduced-motion: reduce) {
  .pub-theme-menu .ui-theme-menu-button {
    transition: none;
  }
}

/* ---------------------------------------------------------------- dark hand tuning (after review) */

/* Homepage gradient headings (Tailwind bg-clip-text): their stop classes also paint section backgrounds, which turn
   dark; the headings keep light gradients ("Understood.", "who cares about every reply.") and the closing CTA uses
   the lavender-to-white gradient its own dark: classes describe. */
html[data-theme='dark'][data-theme-surface='public'] .bg-clip-text.text-transparent.from-white {
  background-image: linear-gradient(to right, #ffffff, #e1e0ff, #c4c0ff);
}

html[data-theme='dark'][data-theme-surface='public'] .bg-clip-text.text-transparent.to-white {
  background-image: linear-gradient(to right, #c0c1ff, #ffffff);
}

html[data-theme='dark'][data-theme-surface='public'] .bg-clip-text.text-transparent.from-\[\#3810C9\] {
  background-image: linear-gradient(to right, #c4c0ff, #ffffff);
}

/* ---------------------------------------------------------------- browser autofill (owner review 2026-10-17)
   When Chrome fills a saved email / password it paints its own box (light blue, or grey in dark) inside the
   field. Login / signup / forgot / reset cover it with a solid inset fill; in dark that fill was see-through,
   so Chrome's grey box showed inside the field. Dark now uses the field's own colour (light is unchanged). */
html[data-theme='dark'][data-theme-surface='public'] body.login-page .input-wrapper input:-webkit-autofill,
html[data-theme='dark'][data-theme-surface='public'] body.login-page .input-wrapper input:-webkit-autofill:hover,
html[data-theme='dark'][data-theme-surface='public'] body.login-page .input-wrapper input:-webkit-autofill:focus,
html[data-theme='dark'][data-theme-surface='public'] body.login-page .input-wrapper input:-webkit-autofill:active,
html[data-theme='dark'][data-theme-surface='public'] body.signup-page .input-wrapper input:-webkit-autofill,
html[data-theme='dark'][data-theme-surface='public'] body.signup-page .input-wrapper input:-webkit-autofill:hover,
html[data-theme='dark'][data-theme-surface='public'] body.signup-page .input-wrapper input:-webkit-autofill:focus,
html[data-theme='dark'][data-theme-surface='public'] body.signup-page .input-wrapper input:-webkit-autofill:active,
html[data-theme='dark'][data-theme-surface='public'] body.forgot-password-page .input-wrapper input:-webkit-autofill,
html[data-theme='dark'][data-theme-surface='public'] body.reset-password-page .input-wrapper input:-webkit-autofill {
  box-shadow: 0 0 0 1000px var(--pt-surface-43af32d9, #141d31) inset !important;
  -webkit-box-shadow: 0 0 0 1000px var(--pt-surface-43af32d9, #141d31) inset !important;
}

/* Every other field (contact form, ...): the browser's autofill colours never take over, the field keeps its own
   background and text colour (the change is held back indefinitely; typing clears autofill as usual). */
html[data-theme-surface='public'] input:-webkit-autofill,
html[data-theme-surface='public'] select:-webkit-autofill,
html[data-theme-surface='public'] textarea:-webkit-autofill {
  transition: background-color 0s 2147483s, color 0s 2147483s !important;
}

/* ...also during a theme switch (which turns transitions off): an autofilled field keeps its matching pair of
   colours instead of jumping to the browser's autofill box. */
html[data-theme-switching][data-theme-surface='public'] input:-webkit-autofill,
html[data-theme-switching][data-theme-surface='public'] select:-webkit-autofill,
html[data-theme-switching][data-theme-surface='public'] textarea:-webkit-autofill {
  transition: background-color 0s 2147483s, color 0s 2147483s !important;
}
