/* WST component — account widget + auth modal.
 * Globally loaded (the header is global). Pairs with assets/js/account.js,
 * template-parts/header/account-widget.php and auth-modal.php. */

/* ---------------------------------------------------------------------
 * Header account widget
 * ------------------------------------------------------------------- */
.acct-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Saved / wishlist button */
.wst-saved {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid var(--rule);
  border-radius: 99px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink);
  background: transparent;
  transition: background .18s ease, border-color .18s ease;
}
.wst-saved:hover { background: var(--paper-2); border-color: var(--ink-2); }
.wst-saved__ico {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
.wst-saved.has-items .wst-saved__ico { fill: var(--terra); stroke: var(--terra); }
.wst-saved__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--terra);
  color: #fff;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
}

/* Logged-out login link */
.acct-login {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--rule);
  border-radius: 99px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink);
  transition: background .18s ease, border-color .18s ease;
}
.acct-login:hover { background: var(--paper-2); border-color: var(--ink-2); }
.acct-login__ico {
  width: 17px; height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

/* Logged-in account control */
.acct { position: relative; }
.acct-trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--rule);
  border-radius: 99px;
  background: transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}
.acct-trigger:hover { background: var(--paper-2); border-color: var(--ink-2); }
.acct-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 16px;
}
.acct-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-caret {
  width: 7px; height: 7px;
  border-right: 1.6px solid var(--ink-2);
  border-bottom: 1.6px solid var(--ink-2);
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform .18s ease;
}
.acct.is-open .acct-caret { transform: rotate(-135deg); }

/* Account dropdown */
.acct-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  box-shadow: 0 30px 60px -28px rgba(10, 40, 40, .42);
  padding: 8px;
  z-index: 70;
}
.acct-menu[hidden] { display: none; }
.acct-menu__hi {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--muted);
  padding: 6px 10px 10px;
  margin: 0 0 4px;
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-menu__item {
  display: block;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--ink-2);
  transition: background .14s ease, color .14s ease;
}
.acct-menu__item:hover { background: var(--paper-2); color: var(--ink); }
.acct-menu__item--logout {
  margin-top: 4px;
  border-top: 1px solid var(--rule);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  color: var(--terra);
}

/* Mobile context — flat list inside the mobile menu */
.acct-wrap--mobile {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}
.acct-wrap--mobile .wst-saved,
.acct-wrap--mobile .acct-login {
  justify-content: center;
  padding: 12px 16px;
  font-size: 14px;
}
.acct-wrap--mobile .acct { width: 100%; }
.acct-wrap--mobile .acct-trigger { width: 100%; justify-content: flex-start; }
.acct-wrap--mobile .acct-caret { display: none; }
.acct-wrap--mobile .acct-menu {
  position: static;
  display: block;
  box-shadow: none;
  border: 0;
  padding: 4px 0 0;
  min-width: 0;
}

/* ---------------------------------------------------------------------
 * Auth modal
 * ------------------------------------------------------------------- */
.wst-auth {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.wst-auth[hidden] { display: none !important; }
.wst-auth.is-open { display: flex; }
.wst-auth__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 32, 29, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.wst-auth__panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 32px 30px 30px;
  box-shadow: 0 50px 90px -40px rgba(0, 0, 0, .6);
}
.wst-auth__close {
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--white);
  color: var(--ink-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.wst-auth__close:hover { background: var(--ink); color: var(--paper); }

.wst-auth__head { margin-bottom: 22px; }
.wst-auth__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.wst-auth__pin {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--terra);
  box-shadow: 0 0 0 3px rgba(184, 90, 60, .2);
}
.wst-auth__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0;
}

.wst-auth__form { display: flex; flex-direction: column; gap: 14px; }
.wst-auth__form[hidden] { display: none; }

.wst-auth__msg {
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(12, 74, 74, .08);
  color: var(--teal-deep);
}
.wst-auth__msg.is-error {
  background: rgba(184, 90, 60, .12);
  color: #8a3d27;
}

.wst-auth__field { display: flex; flex-direction: column; gap: 6px; }
.wst-auth__field > span {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.wst-auth__field input {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  transition: border-color .15s ease;
}
.wst-auth__field input:focus { outline: none; border-color: var(--teal); }
.wst-auth__hint { font-size: 11.5px; color: var(--muted); }

.wst-auth__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.wst-auth__check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.wst-auth__check input { width: 15px; height: 15px; accent-color: var(--teal); }
.wst-auth__link {
  font-size: 12.5px;
  color: var(--terra);
  border-bottom: 1px solid transparent;
}
.wst-auth__link:hover { border-color: var(--terra); }

.wst-auth__submit {
  width: 100%;
  justify-content: center;
  margin-top: 2px;
  padding: 14px 20px;
}
.wst-auth__submit[disabled] { opacity: .65; cursor: progress; transform: none; }
.wst-auth__spinner {
  display: none;
  width: 15px; height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: wst-spin .7s linear infinite;
}
.wst-auth__form.is-busy .wst-auth__spinner { display: inline-block; }
.wst-auth__form.is-busy .wst-auth__submit-text { opacity: .6; }
@keyframes wst-spin { to { transform: rotate(360deg); } }

.wst-auth__alt {
  font-size: 13.5px;
  color: var(--ink-2);
  text-align: center;
  margin: 4px 0 0;
}
.wst-auth__switch {
  background: none;
  border: 0;
  padding: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--terra);
  cursor: pointer;
  border-bottom: 1px solid var(--terra);
}
.wst-auth__fine {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  margin: 2px 0 0;
}

@media (max-width: 480px) {
  .wst-auth__panel { padding: 28px 22px 24px; }
  .wst-auth__title { font-size: 28px; }
}
