/* ============================================================
   ACCOUNT — passwordless OTP gate + branded dashboard
   Loaded only on the My Account page (see inc/account-auth.php).
   ============================================================ */

/* ---------- Focused chrome (logged-out gate) ----------
   header.php adds .site-header--auth and drops the nav/cart, leaving a
   centered logo (matches the Shopify-style sign-in mockup). */
.site-header--auth .site-header__inner { justify-content: center; }
.site-header--auth .site-header__brand { margin-inline: auto; }

/* Drop the oversized default page/endpoint title (My account, Orders, Addresses…).
   Mirrors the checkout treatment — the gate and dashboard provide their own headings. */
.woocommerce-account .simms-entry > h1 { display: none; }

/* ---------- Sign-in gate ---------- */
.woocommerce-account:not(.logged-in) main { padding: 0; }

.simms-auth {
  max-width: 27rem;
  margin-inline: auto;
  padding-block: clamp(3rem, 12vh, 9rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 55vh;
}

.simms-auth__title {
  font-family: var(--font-heading--family);
  font-weight: var(--font-heading--weight);
  font-size: 2rem;
  line-height: var(--line-height--body-tight);
  letter-spacing: var(--letter-spacing--heading-tight);
  color: var(--color-foreground-heading);
  margin: 0 0 0.5rem;
}

.simms-auth__subtitle {
  font-family: var(--font-body--family);
  font-size: 1rem;
  color: rgb(var(--color-foreground-rgb) / 0.6);
  margin: 0 0 1.5rem;
}

.simms-auth__field {
  position: relative;
  display: flex;
  align-items: center;
}

.simms-auth__input {
  width: 100%;
  height: 56px;
  padding: 0 56px 0 16px;
  border: 1px solid rgb(var(--color-foreground-rgb) / 0.18);
  border-radius: var(--style-border-radius-buttons-primary);
  font-family: var(--font-body--family);
  font-size: 1rem;
  color: var(--color-foreground);
  background: var(--color-background);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.simms-auth__input:focus {
  outline: none;
  border-color: var(--color-foreground);
  box-shadow: 0 0 0 1px var(--color-foreground);
}

.simms-auth__submit {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-foreground);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.simms-auth__submit:hover { background: var(--color-foreground); color: var(--color-background); }
.simms-auth__submit svg { width: 20px; height: 20px; }

.simms-auth__legal {
  margin: 1.25rem 0 0;
  font-size: 0.8125rem;
  color: rgb(var(--color-foreground-rgb) / 0.55);
}

.simms-auth__legal a { color: inherit; text-decoration: underline; }

/* Code step */
.simms-auth__code {
  width: 100%;
  height: 64px;
  text-align: center;
  font-family: var(--font-mono--family);
  font-size: 1.6rem;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  border: 1px solid rgb(var(--color-foreground-rgb) / 0.18);
  border-radius: var(--style-border-radius-buttons-primary);
  background: var(--color-background);
  color: var(--color-foreground);
}

.simms-auth__code:focus {
  outline: none;
  border-color: var(--color-foreground);
  box-shadow: 0 0 0 1px var(--color-foreground);
}

.simms-auth__verify { width: 100%; margin-top: 1rem; }
.simms-auth__email-target { color: var(--color-foreground); font-weight: 500; }

.simms-auth__resend {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  margin-top: 1.25rem;
}

.simms-auth__link {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-body--family);
  font-size: 0.875rem;
  color: rgb(var(--color-foreground-rgb) / 0.6);
  text-decoration: underline;
}

.simms-auth__link:hover { color: var(--color-foreground); }
.simms-auth__link[disabled] { opacity: 0.5; cursor: default; text-decoration: none; }

.simms-auth__alert {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--style-border-radius-buttons-primary);
  background: #fdeaea;
  color: #8a1c1c;
  font-size: 0.875rem;
  font-family: var(--font-body--family);
}

.simms-auth__alert[hidden] { display: none; }

/* Step visibility (toggled by data-active-step on .simms-auth) */
.simms-auth[data-active-step="1"] .simms-auth__step--code { display: none; }
.simms-auth[data-active-step="2"] .simms-auth__step--email { display: none; }

/* ---------- Logged-in dashboard ---------- */
/* Account navigation runs horizontally above the content on every endpoint.
   It used to be a 240px sidebar, which meant the Refer & Earn page — which
   ships its own horizontal bar — changed the account chrome mid-session. */
.woocommerce-account.logged-in .woocommerce {
  /* One measure for the whole account area. --narrow-page-width (1440px) is a
     storefront value; at that width the nav sat wider than the Refer & Earn
     content beneath it. 1100px matches the storefront product grid. */
  --simms-account-measure: 1100px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  /* The nav is a solid bar and the content below it often starts with another
     bordered card, so they need a real gap or the two edges read as one block. */
  gap: clamp(2rem, 3vw, 2.75rem);
  align-items: start;
  max-width: var(--simms-account-measure);
  margin-inline: auto;
}

/* WooCommerce's woocommerce-layout.css floats the nav (width:30%) and content
   (width:65%). As grid items those percentages resolve against the grid tracks,
   collapsing the 240px nav to ~72px (labels wrap, rows balloon). Neutralise so
   the grid above owns the two-column layout. */
.woocommerce-account.logged-in .woocommerce-MyAccount-navigation,
.woocommerce-account.logged-in .woocommerce-MyAccount-content {
  float: none;
  width: auto;
}

.woocommerce-account.logged-in .woocommerce-MyAccount-navigation {
  overflow-x: auto;
  scrollbar-width: thin;
}

.simms-account-nav ul {
  list-style: none;
  margin: 0;
  /* max-content + min-width lets the bar scroll horizontally on narrow screens
     instead of wrapping into a ragged block. */
  width: max-content;
  min-width: 100%;
  padding: 4px;
  display: flex;
  flex-flow: row nowrap;
  gap: 2px;
  border: 1px solid rgb(var(--color-foreground-rgb) / 0.12);
  border-radius: 12px;
  background: rgb(255 255 255 / 0.72);
}

.simms-account-nav li {
  flex: 1 0 auto;
}

.simms-account-nav li a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 46px;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-family: var(--font-mono--family);
  font-size: 0.67rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgb(var(--color-foreground-rgb) / 0.7);
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease;
}

.simms-account-nav li a:hover {
  background: rgb(var(--color-foreground-rgb) / 0.05);
  color: var(--color-foreground);
}

.simms-account-nav li.is-active a {
  background: var(--dusk-violet, #172953);
  color: #f8f5f0;
}

.simms-account-nav__icon { display: inline-flex; width: 16px; height: 16px; }
.simms-account-nav__icon svg { width: 16px; height: 16px; }

@media (max-width: 680px) {
  .simms-account-nav ul {
    min-width: max-content;
  }

  .simms-account-nav li a {
    min-height: 42px;
    padding: 0.55rem 0.75rem;
  }
}

.simms-account-dashboard__greeting {
  font-family: var(--font-heading--family);
  font-weight: var(--font-heading--weight);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: var(--letter-spacing--heading-tight);
  margin: 0 0 0.5rem;
}

.simms-account-dashboard__intro {
  color: rgb(var(--color-foreground-rgb) / 0.6);
  margin: 0 0 2rem;
}

.simms-account-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.simms-account-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.25rem;
  border: 1px solid rgb(var(--color-foreground-rgb) / 0.12);
  border-radius: var(--style-border-radius-buttons-primary);
  text-decoration: none;
  color: var(--color-foreground);
  transition: border-color 140ms ease;
}

.simms-account-card:hover { border-color: var(--color-foreground); }
.simms-account-card__icon { width: 22px; height: 22px; margin-bottom: 0.25rem; }
.simms-account-card__icon svg { width: 22px; height: 22px; }
.simms-account-card__title { font-weight: 500; font-family: var(--font-subheading--family); }
.simms-account-card__desc { font-size: 0.85rem; color: rgb(var(--color-foreground-rgb) / 0.55); }

.simms-account-dashboard__logout { margin-top: 2rem; }
.simms-account-dashboard__logout a { color: rgb(var(--color-foreground-rgb) / 0.6); text-decoration: underline; }

/* ---------- Default Woo subpages (orders / addresses / account details) ---------- */
.woocommerce-account.logged-in .woocommerce-MyAccount-content { font-family: var(--font-body--family); }

/* Tame the oversized default section headings (Billing/Shipping address titles,
   edit-address form headers) to a sensible account-page scale. */
.woocommerce-account.logged-in .woocommerce-MyAccount-content h2,
.woocommerce-account.logged-in .woocommerce-MyAccount-content h3 {
  font-family: var(--font-heading--family);
  font-weight: var(--font-heading--weight);
  font-size: 1.3rem;
  line-height: var(--line-height--body-tight);
  letter-spacing: var(--letter-spacing--heading-tight);
  margin: 0 0 0.75rem;
}
.woocommerce-account.logged-in .woocommerce-MyAccount-content a:not(.button) { color: var(--color-foreground); }

.woocommerce-account.logged-in .woocommerce-MyAccount-content .button,
.woocommerce-account.logged-in .woocommerce-MyAccount-content button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border: 0;
  border-radius: var(--style-border-radius-buttons-primary);
  background: var(--color-foreground);
  color: var(--color-background);
  font-family: var(--font-body--family);
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 140ms ease;
}

.woocommerce-account.logged-in .woocommerce-MyAccount-content .button:hover,
.woocommerce-account.logged-in .woocommerce-MyAccount-content button[type="submit"]:hover { opacity: 0.88; }

.woocommerce-account.logged-in .woocommerce-MyAccount-content input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
.woocommerce-account.logged-in .woocommerce-MyAccount-content select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid rgb(var(--color-foreground-rgb) / 0.18);
  border-radius: var(--style-border-radius-buttons-primary);
  font-family: var(--font-body--family);
  font-size: 0.95rem;
  background: var(--color-background);
  color: var(--color-foreground);
}

.woocommerce-account.logged-in .woocommerce-MyAccount-content input:focus,
.woocommerce-account.logged-in .woocommerce-MyAccount-content select:focus {
  outline: none;
  border-color: var(--color-foreground);
  box-shadow: 0 0 0 1px var(--color-foreground);
}

.woocommerce-account.logged-in .shop_table {
  width: 100%;
  border-collapse: collapse;
}

.woocommerce-account.logged-in .shop_table th,
.woocommerce-account.logged-in .shop_table td {
  padding: 0.85rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgb(var(--color-foreground-rgb) / 0.1);
  font-size: 0.9rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .woocommerce-account.logged-in .woocommerce { grid-template-columns: 1fr; }
  .simms-account-nav ul { flex-direction: row; flex-wrap: wrap; gap: 0.5rem; }
  .simms-account-nav li a { padding: 0.5rem 0.75rem; }
}

/* ---------- Shared account shell ----------
   Every endpoint sits on the same warm ground with the same soft ambient wash
   and the same carded content panel. Before this, Refer & Earn had all of it
   and the Woo defaults had none, so moving between them felt like falling onto
   a bare white page. Refer & Earn opts out of the panel because it ships its
   own cards. */
.woocommerce-account.logged-in {
  --simms-account-paper: #fcfaf6;
  --simms-account-line: rgb(23 41 83 / 0.1);
  /* Positioned so the panel below resolves against the document rather than
     the viewport, and therefore scrolls with the page. */
  position: relative;
  background: var(--simms-account-paper);
}

/* Ambient wash.

   This has to hang off the body as a fixed, full-viewport layer. Attached to
   the content column instead it clips to that box (a visible tinted rectangle)
   and, because the column paints after the nav, covers the nav. Fixed + inset:0
   has no box to clip against, and z-index:-1 on the body sits behind every
   descendant — provided nothing between here and the content isolates. */
/* Refer & Earn earns the hard-edged panel: its hero card covers most of it, so
   the tint only shows as a halo around dense content. The sparser endpoints
   have almost nothing on them, which leaves the same panel reading as a bare
   block of colour — so they get a soft, feathered wash instead. Same palette,
   intensity matched to how much content sits on top of it. */
body.simms-refer-earn-page::before {
  position: absolute;
  z-index: -1;
  top: 92px;
  left: 50%;
  width: min(1180px, 100% - 28px);
  height: 712px;
  content: "";
  pointer-events: none;
  transform: translateX(-50%);
  background-color: rgb(216 230 241 / 0.5);
  background-image:
    radial-gradient(620px 560px at 88% 4%, rgb(226 196 190 / 0.62), rgb(226 196 190 / 0) 72%),
    radial-gradient(700px 620px at 2% 46%, rgb(186 214 236 / 0.72), rgb(186 214 236 / 0) 74%);
  background-repeat: no-repeat;
}

/* No decorative panel on these pages. A fixed-size pseudo-element cannot
   contain anything, so it started above the nav, sprawled past short pages and
   clipped tall ones mid-form. The content column becomes the card instead. */

.woocommerce-account.logged-in:not(.simms-refer-earn-page) .woocommerce-MyAccount-content {
  /* The card. Grows with its content, so it never crops a form or leaves a
     tinted void under a short page. min-height only stops the emptiest
     endpoints collapsing to a sliver above the footer. */
  min-height: 320px;
  padding: clamp(26px, 2.8vw, 40px);
  border: 1px solid var(--simms-account-line);
  border-radius: 26px;
  background-color: rgb(216 230 241 / 0.4);
  background-image:
    radial-gradient(620px 520px at 96% 0%, rgb(226 196 190 / 0.5), rgb(226 196 190 / 0) 70%),
    radial-gradient(680px 600px at 0% 64%, rgb(186 214 236 / 0.5), rgb(186 214 236 / 0) 72%);
  background-repeat: no-repeat;
  box-shadow: 0 24px 70px rgb(23 41 83 / 0.06);
}

.simms-account-head {
  margin: 0 0 1.5rem;
}

.simms-account-head__eyebrow {
  margin: 0 0 0.6rem;
  color: rgb(16 16 18 / 0.56);
  font-family: var(--font-mono--family);
  font-size: 0.67rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  line-height: 1.35;
  text-transform: uppercase;
}

.woocommerce-account.logged-in .woocommerce-MyAccount-content .simms-account-head__title {
  margin: 0;
  font-family: var(--font-heading--family);
  font-weight: 500;
  font-size: clamp(1.6rem, 2.4vw, 2rem);
  letter-spacing: -0.02em;
  line-height: 1.06;
}

/* The content panel. Excludes Refer & Earn, which brings its own. */
.woocommerce-account.logged-in:not(.simms-refer-earn-page) .woocommerce-MyAccount-content > *:not(.simms-account-head) {
  position: relative;
}

.woocommerce-account.logged-in:not(.simms-refer-earn-page) .simms-account-panel {
  padding: clamp(24px, 2.6vw, 36px);
  border: 1px solid var(--simms-account-line);
  border-radius: 18px;
  background: linear-gradient(120deg, rgb(255 255 255 / 0.98) 0%, rgb(252 250 246 / 0.94) 60%, rgb(238 245 251 / 0.9) 100%);
  box-shadow: 0 24px 70px rgb(23 41 83 / 0.06);
}

/* Woo scatters actions inline after paragraphs, which floated them into the
   top-right of an otherwise empty page. Stack them under the copy instead. */
.woocommerce-account.logged-in .woocommerce-MyAccount-content .woocommerce-message,
.woocommerce-account.logged-in .woocommerce-MyAccount-content .woocommerce-info,
.woocommerce-account.logged-in .woocommerce-MyAccount-content .woocommerce-Message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  margin: 0 0 1.25rem;
  padding: clamp(24px, 2.6vw, 36px);
  border: 1px solid var(--simms-account-line);
  border-radius: 18px;
  background: linear-gradient(120deg, rgb(255 255 255 / 0.98) 0%, rgb(252 250 246 / 0.94) 60%, rgb(238 245 251 / 0.9) 100%);
  box-shadow: 0 24px 70px rgb(23 41 83 / 0.06);
  color: rgb(16 16 18 / 0.72);
  line-height: 1.6;
}

/* Woo puts the action first in the markup, which rendered it above the copy
   explaining it. Order it after without reversing the DOM. */
.woocommerce-account.logged-in .woocommerce-MyAccount-content .woocommerce-message .button,
.woocommerce-account.logged-in .woocommerce-MyAccount-content .woocommerce-info .button,
.woocommerce-account.logged-in .woocommerce-MyAccount-content .woocommerce-Message .button {
  order: 2;
  float: none;
  margin: 0;
}

/* Match the nav's active pill rather than pure black, which read as a
   different design system sitting on the same page. */
.woocommerce-account.logged-in .woocommerce-MyAccount-content .button,
.woocommerce-account.logged-in .woocommerce-MyAccount-content button[type="submit"] {
  min-height: 46px;
  padding: 11px 20px;
  border-radius: 9px;
  background: var(--dusk-violet, #172953);
  color: #f8f5f0;
  font-size: 0.9rem;
}

.woocommerce-account.logged-in .woocommerce-MyAccount-content .simms-account-panel .button {
  align-self: flex-start;
}

/* Forms: a full-1100px first-name field is unusable. */
.woocommerce-account.logged-in .woocommerce-MyAccount-content form {
  max-width: 720px;
}

.woocommerce-account.logged-in .woocommerce-MyAccount-content fieldset {
  margin: 1.5rem 0 0;
  padding: clamp(20px, 2vw, 28px);
  border: 1px solid var(--simms-account-line);
  border-radius: 14px;
}

.woocommerce-account.logged-in .woocommerce-MyAccount-content legend {
  padding: 0 0.5rem;
  font-family: var(--font-mono--family);
  font-size: 0.67rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgb(16 16 18 / 0.56);
}

.simms-account-dashboard__intro {
  max-width: 62ch;
}

.woocommerce-account.logged-in .simms-account-card {
  padding: 1.4rem;
  border-radius: 14px;
  border-color: var(--simms-account-line);
  background: rgb(255 255 255 / 0.72);
}

@media (max-width: 680px) {
  .woocommerce-account.logged-in .woocommerce-MyAccount-content {
    min-height: 0;
    padding-bottom: 48px;
  }
}

/* Addresses ship as two bare text columns. Card them so the page reads like
   the rest of the account rather than an unstyled fragment. */
.woocommerce-account.logged-in .woocommerce-Addresses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.woocommerce-account.logged-in .woocommerce-Address {
  width: auto;
  float: none;
  padding: clamp(20px, 2vw, 28px);
  border: 1px solid var(--simms-account-line);
  border-radius: 16px;
  background: linear-gradient(120deg, rgb(255 255 255 / 0.98) 0%, rgb(252 250 246 / 0.94) 60%, rgb(238 245 251 / 0.9) 100%);
  box-shadow: 0 20px 60px rgb(23 41 83 / 0.05);
}

.woocommerce-account.logged-in .woocommerce-Address-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.woocommerce-account.logged-in .woocommerce-Address-title h2,
.woocommerce-account.logged-in .woocommerce-Address-title h3 {
  margin: 0;
  font-size: 1.05rem;
}

.woocommerce-account.logged-in .woocommerce-Address-title .edit {
  font-family: var(--font-mono--family);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.woocommerce-account.logged-in .woocommerce-Address address {
  font-style: normal;
  line-height: 1.65;
  color: rgb(16 16 18 / 0.7);
}

/* Woo's .col2-set clearfix pseudo-elements become grid items and shunt the
   two address cards a column to the right. */
.woocommerce-account.logged-in .woocommerce-Addresses::before,
.woocommerce-account.logged-in .woocommerce-Addresses::after {
  display: none;
}
