/**
 * Neuro Product Grid — Account login / register card.
 *
 * A single centred card on a dotted cream field, with a segmented Sign in /
 * Sign up control. Panel visibility is driven by `data-npg-active` on the card
 * so the correct panel paints on first render, before the script runs.
 *
 * Tokens mirror assets/css/single-buttons.css so the account page and the
 * product purchase block share one palette.
 */

.npg-account {
  --npg-acct-accent: #214d97;
  --npg-acct-accent-ink: #ffffff;
  --npg-acct-ink: #0d1528;
  --npg-acct-muted: #6f7789;
  --npg-acct-faint: #8a909c;
  --npg-acct-border: #dedbd2;
  --npg-acct-field-border: #c9ccd4;
  --npg-acct-page: #f7f5ef;
  --npg-acct-dot: #d9d5c7;
  --npg-acct-card: #fbfaf6;
  --npg-acct-field: #faf9f5;
  --npg-acct-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --npg-acct-sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  box-sizing: border-box;
  display: flex;
  justify-content: center;
  font-family: var(--npg-acct-sans);
  color: var(--npg-acct-ink);

  /* Full-bleed: the account page renders inside a centred Elementor container
	   (`.e-con` flex, full-width with side padding), so `left: 50%` lands on the
	   viewport centre and `margin-left: -50vw` pulls the box back to the viewport
	   edge — the dotted field runs edge to edge on every screen. `justify-content:
	   center` then keeps the card centred on the visible viewport. */
  position: relative;
  width: 100vw;
  left: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  padding: 56px 20px 72px;

  background-color: var(--npg-acct-page);
  background-image: radial-gradient(var(--npg-acct-dot) 1px, transparent 1px);
  background-size: 16px 16px;
  background-position: -8px -8px;
}

/* Scoped to pages that render the card so it can't affect the rest of the site.
   100vw counts the desktop scrollbar, so the full-bleed row overhangs by a few
   px; `clip` absorbs it without making the root a scroll container (which would
   break a sticky header). */
html:has(.npg-account),
html:has(.npg-account) body {
  overflow-x: clip;
}

.npg-account *,
.npg-account *::before,
.npg-account *::after {
  box-sizing: inherit;
  min-width: 0;
}

.npg-account__card {
  width: 100%;
  max-width: 420px;
  padding: 40px 36px 34px;
  background: var(--npg-acct-card);
  border: 1px solid var(--npg-acct-border);
  border-radius: 2px;
  overflow-wrap: break-word;
}

/* ---- Panel switching ----------------------------------------------------- */

.npg-account__card[data-npg-active="login"] [data-npg-panel="register"],
.npg-account__card[data-npg-active="login"] [data-npg-head="register"],
.npg-account__card[data-npg-active="register"] [data-npg-panel="login"],
.npg-account__card[data-npg-active="register"] [data-npg-head="login"] {
  display: none;
}

/* ---- Header -------------------------------------------------------------- */

.npg-account__eyebrow {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--npg-acct-accent);
}

.npg-account__title {
  margin: 0 0 10px;
  font-family: var(--npg-acct-serif);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--npg-acct-ink);
}

.npg-account__sub {
  margin: 0 0 26px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--npg-acct-muted);
}

/* ---- Segmented tabs ------------------------------------------------------ */

.npg-account__tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 26px;
  border: 1px solid var(--npg-acct-field-border);
  border-radius: 2px;
  overflow: hidden;
}

/* The tabs are anchors, so every colour here is `!important` — theme link rules
   (`.entry-content a { color: … }` and friends) otherwise repaint them blue,
   including the selected tab sitting on the dark fill. */
.npg-account__tab,
.npg-account__tab:link,
.npg-account__tab:visited,
.npg-account__tab:hover,
.npg-account__tab:focus,
.npg-account__tab:active {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 13px 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none !important;
  color: var(--npg-acct-ink) !important;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.npg-account__tab:hover {
  background: rgba(13, 21, 40, 0.04);
}

.npg-account__card[data-npg-active="login"]
  [data-npg-tab="login"].npg-account__tab,
.npg-account__card[data-npg-active="login"]
  [data-npg-tab="login"].npg-account__tab:hover,
.npg-account__card[data-npg-active="login"]
  [data-npg-tab="login"].npg-account__tab:focus,
.npg-account__card[data-npg-active="register"]
  [data-npg-tab="register"].npg-account__tab,
.npg-account__card[data-npg-active="register"]
  [data-npg-tab="register"].npg-account__tab:hover,
.npg-account__card[data-npg-active="register"]
  [data-npg-tab="register"].npg-account__tab:focus {
  color: var(--npg-acct-accent-ink) !important;
  background: var(--npg-acct-ink);
}

.npg-account__tab:focus-visible {
  outline: 2px solid var(--npg-acct-accent);
  outline-offset: -2px;
}

/* ---- Fields -------------------------------------------------------------- */

.npg-account__field {
  margin: 0 0 20px;
}

.npg-account__label {
  display: block;
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--npg-acct-muted);
}

.npg-account__control {
  position: relative;
  display: block;
}

/* `!important` on the box model keeps theme/WooCommerce input rules — rounded
   corners, tinted fills, 100%-minus-padding widths — from reshaping the field. */
.npg-account__input,
.npg-account__input:focus {
  display: block;
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.3;
  color: var(--npg-acct-ink);
  background: var(--npg-acct-field) !important;
  border: 1px solid var(--npg-acct-field-border) !important;
  border-radius: 2px !important;
  box-shadow: none !important;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.npg-account__input--reveal {
  padding-right: 76px;
}

.npg-account__input:focus {
  border-color: var(--npg-acct-accent) !important;
  box-shadow: inset 0 0 0 1px var(--npg-acct-accent) !important;
  outline: none;
}

.npg-account__input::placeholder {
  color: var(--npg-acct-faint);
}

/* Show / hide password toggle, pinned inside the field. */
.npg-account__reveal,
.npg-account__reveal:hover,
.npg-account__reveal:focus,
.npg-account__reveal:active {
  position: absolute;
  top: 50%;
  right: 1px;
  transform: translateY(-50%);
  margin: 0;
  padding: 0 16px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--npg-acct-accent) !important;
  background: none !important;
  border: 0;
  box-shadow: none !important;
  cursor: pointer;
}

.npg-account__reveal:hover {
  text-decoration: underline;
}

.npg-account__reveal:focus-visible {
  outline: 2px solid var(--npg-acct-accent);
  outline-offset: 2px;
}

.npg-account__remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--npg-acct-muted);
  cursor: pointer;
}

.npg-account__remember input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--npg-acct-accent);
}

.npg-account__note {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--npg-acct-muted);
}

/* ---- Submit -------------------------------------------------------------- */

.npg-account__submit,
.npg-account__submit:hover,
.npg-account__submit:focus,
.npg-account__submit:focus-visible,
.npg-account__submit:active {
  display: block;
  width: 100%;
  margin: 0;
  padding: 16px 22px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  color: var(--npg-acct-accent-ink) !important;
  background: var(--npg-acct-accent) !important;
  border: 1px solid var(--npg-acct-accent);
  border-radius: 2px;
  box-shadow: none !important;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.npg-account__submit:hover,
.npg-account__submit:focus-visible {
  background: color-mix(in srgb, #000 12%, var(--npg-acct-accent)) !important;
  border-color: color-mix(in srgb, #000 12%, var(--npg-acct-accent));
}

.npg-account__submit:focus-visible {
  outline: 2px solid var(--npg-acct-accent);
  outline-offset: 2px;
}

/* ---- Footer -------------------------------------------------------------- */

.npg-account__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 0;
  font-size: 13px;
  color: var(--npg-acct-muted);
}

.npg-account__foot--center {
  justify-content: center;
}

/* Same story as the tabs: outrank the theme's anchor colours. */
.npg-account__link,
.npg-account__link:link,
.npg-account__link:visited,
.npg-account__link:hover,
.npg-account__link:focus,
.npg-account__link:active {
  font-family: inherit;
  font-size: 13px;
  color: var(--npg-acct-muted) !important;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.npg-account__link--accent,
.npg-account__link--accent:link,
.npg-account__link--accent:visited,
.npg-account__link--accent:hover,
.npg-account__link--accent:focus,
.npg-account__link--accent:active {
  color: var(--npg-acct-accent) !important;
  font-weight: 600;
}

.npg-account__link:hover {
  text-decoration: underline;
}

.npg-account__link:focus-visible {
  outline: 2px solid var(--npg-acct-accent);
  outline-offset: 2px;
}

/* ---- WooCommerce notices + password strength ----------------------------- */

.npg-account__notices:empty {
  display: none;
}

.npg-account .woocommerce-error,
.npg-account .woocommerce-message,
.npg-account .woocommerce-info {
  list-style: none;
  margin: 0 0 24px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.45;
  background: #fff;
  border: 1px solid var(--npg-acct-field-border);
  border-left: 3px solid var(--npg-acct-accent);
  border-radius: 2px;
}

.npg-account .woocommerce-error {
  border-left-color: #b3261e;
}

.npg-account .woocommerce-error li,
.npg-account .woocommerce-message li,
.npg-account .woocommerce-info li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.npg-account .woocommerce-error li + li {
  margin-top: 6px;
}

.npg-account .woocommerce-password-strength,
.npg-account .woocommerce-password-hint {
  display: block;
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--npg-acct-muted);
}

.npg-account .woocommerce-password-strength.short,
.npg-account .woocommerce-password-strength.bad {
  color: #b3261e;
}

.npg-account .woocommerce-password-strength.good,
.npg-account .woocommerce-password-strength.strong {
  color: #1c6b3c;
}

/* ---- Responsive ---------------------------------------------------------- */

/* Tablet / large phone: the card still fits, only the frame tightens. */
@media (max-width: 640px) {
  .npg-account {
    padding: 40px 16px 56px;
    left: 0% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .npg-account__card {
    padding: 32px 24px 28px;
  }

  .npg-account__title {
    font-size: 34px;
  }

  .npg-account__sub {
    margin-bottom: 22px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .npg-account {
    padding: 40px 16px 56px;
    left: 0% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .npg-account__card {
    padding: 26px 18px 24px;
  }

  .npg-account__title {
    font-size: 28px;
  }

  .npg-account__tabs {
    margin-bottom: 22px;
  }

  .npg-account__tab,
  .npg-account__tab:hover,
  .npg-account__tab:focus {
    padding: 12px 8px;
    font-size: 14px;
  }

  .npg-account__field {
    margin-bottom: 16px;
  }

  /* 16px keeps iOS Safari from zooming the viewport on focus. */
  .npg-account__input,
  .npg-account__input:focus {
    padding: 13px 14px;
    font-size: 16px;
  }

  .npg-account__input--reveal {
    padding-right: 68px;
  }

  .npg-account__reveal,
  .npg-account__reveal:hover,
  .npg-account__reveal:focus,
  .npg-account__reveal:active {
    padding: 0 12px;
    font-size: 11px;
  }

  .npg-account__submit,
  .npg-account__submit:hover,
  .npg-account__submit:focus,
  .npg-account__submit:focus-visible,
  .npg-account__submit:active {
    padding: 15px 18px;
    font-size: 15px;
  }

  /* Two footer items side by side get squeezed to one word per line — stack
	   them instead and keep both flush left. */
  .npg-account__foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-top: 20px;
  }

  .npg-account__foot--center {
    align-items: center;
  }

  .npg-account .woocommerce-error,
  .npg-account .woocommerce-message,
  .npg-account .woocommerce-info {
    margin-bottom: 18px;
    padding: 12px 14px;
    font-size: 13px;
  }
}

/* Very narrow (≤360px) — the segmented control is the first thing to break. */
@media (max-width: 360px) {
  .npg-account__card {
    padding: 22px 14px 20px;
  }

  .npg-account__title {
    font-size: 25px;
  }

  .npg-account__tab,
  .npg-account__tab:hover,
  .npg-account__tab:focus {
    padding: 11px 4px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .npg-account__tab,
  .npg-account__input,
  .npg-account__submit {
    transition: none;
  }
}
