/* ==========================================================================
   STEMX — application styles
   Auth pages and the member dashboard. Same palette as the public site, but
   denser: this is a tool, not a landing page.
   ========================================================================== */

/* ==========================================================================
   Auth shell
   ========================================================================== */
.auth-shell {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: calc(var(--nav-h) + 30px) var(--gutter) 60px;
  overflow: hidden;
}

.auth-card {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 480px;
  padding: clamp(30px, 4vw, 46px);
  border-radius: 0;
  /* A purple cap on the top edge. This has to be a border rather than a
     pseudo-element: the card also carries .glow-card, which already owns
     ::before, and .spotlight owns ::after. */
  border-top: 4px solid var(--purple);
  /* the card is a block sitting on the page, not a floating pane */
  box-shadow:
    var(--block) var(--block) 0 var(--purple-veil),
    0 24px 70px rgba(0, 0, 0, 0.6);
}

.auth-card--wide { max-width: 620px; }

.auth-head { margin-bottom: 34px; }

.auth-head h1 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.auth-head p {
  color: var(--ash);
  font-size: 0.9rem;
  line-height: 1.75;
}

.auth-foot {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline-soft);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--slate);
  text-align: center;
}

.auth-foot a {
  color: var(--white);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 1px;
  transition: border-color 0.3s var(--ease);
}
.auth-foot a:hover { border-color: var(--white); }

.auth-back {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  font-size: 11px;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--slate);
  transition: color 0.3s var(--ease);
}
.auth-back:hover { color: var(--white); }

.auth-logo {
  display: block;
  height: 22px;
  width: auto;
  margin: 0 auto 30px;
}

/* ==========================================================================
   Boxed form fields (the public site uses underlines; forms here need weight)
   ========================================================================== */
.field--boxed { margin-bottom: 20px; }

.field--boxed label {
  display: block;
  margin-bottom: 9px;
  font-size: 10px;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--ash);
}

.field--boxed input,
.field--boxed select {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline-soft);
  border-radius: 0;
  color: var(--white);
  font-family: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease),
              box-shadow 0.3s var(--ease);
}

.field--boxed input::placeholder { color: #555; letter-spacing: 0.02em; }

.field--boxed input:focus,
.field--boxed select:focus {
  outline: none;
  border-color: var(--purple-lit);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px var(--purple-veil);
}

.field--boxed.has-error input { border-color: rgba(255, 120, 120, 0.7); }

.field-hint {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--slate);
  letter-spacing: 0.02em;
}

.field-hint.is-error { color: #ff8f8f; }
.field-hint.is-ok { color: #8fe3a8; }

.input-wrap { position: relative; }

.reveal-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 10px;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--slate);
  font-size: 10px;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}
.reveal-pw:hover { color: var(--white); background: rgba(255, 255, 255, 0.06); }

/* the class code deserves to look like a code */
.code-input {
  text-align: center;
  font-size: 1.2rem !important;
  letter-spacing: 0.32em !important;
  text-transform: uppercase;
  padding-block: 18px !important;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

/* password strength */
.pw-meter {
  display: flex;
  gap: 5px;
  margin-top: 10px;
}
.pw-meter i {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.35s var(--ease);
}
.pw-meter[data-score="1"] i:nth-child(1) { background: #ff8f8f; }
.pw-meter[data-score="2"] i:nth-child(-n+2) { background: #ffcf8f; }
.pw-meter[data-score="3"] i:nth-child(-n+3) { background: #d8e88f; }
.pw-meter[data-score="4"] i { background: #8fe3a8; }

/* full-width submit */
.btn-block {
  width: 100%;
  padding-block: 16px;
  margin-top: 6px;
}

.btn-block[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ==========================================================================
   Alerts
   ========================================================================== */
.alert {
  display: none;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 22px;
  padding: 14px 16px;
  border-radius: 0;
  font-size: 0.85rem;
  line-height: 1.65;
  letter-spacing: 0.02em;
}

.alert.is-visible { display: flex; }

.alert--error {
  background: rgba(255, 90, 90, 0.09);
  border: 1px solid rgba(255, 120, 120, 0.32);
  color: #ffbcbc;
}

.alert--ok {
  background: rgba(120, 255, 160, 0.08);
  border: 1px solid rgba(140, 230, 170, 0.3);
  color: #b6f0c7;
}

.alert--info {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline-soft);
  color: var(--ash);
}

/* ==========================================================================
   Multi-step registration
   ========================================================================== */
.steps {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
}

.steps i {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.13);
  position: relative;
  overflow: hidden;
}

.steps i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--purple-lit);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}
.steps i.is-done::after { transform: scaleX(1); }

.step-count {
  font-size: 10px;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--slate);
  flex: none;
}

.step { display: none; }
.step.is-active { display: block; animation: stepIn 0.55s var(--ease) both; }

@keyframes stepIn {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: none; }
}

.step-nav {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}
.step-nav .pill { flex: 1; }

/* chapter picker */
.chapter-choices {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.choice {
  position: relative;
  display: block;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-body {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--hairline-soft);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.35s var(--ease), background 0.35s var(--ease),
              transform 0.35s var(--ease);
}

.choice:hover .choice-body { border-color: var(--purple-lit); transform: translate(-2px, -2px); box-shadow: var(--block-sm) var(--block-sm) 0 var(--purple-veil); }

.choice input:checked + .choice-body {
  border-color: var(--purple-lit);
  background: var(--purple-veil);
}

.choice input:focus-visible + .choice-body {
  box-shadow: 0 0 0 3px var(--purple-glow);
}

.choice-mark {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  flex: none;
  position: relative;
  transition: border-color 0.3s var(--ease);
}
.choice-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--purple-lit);
  transform: scale(0);
  transition: transform 0.3s var(--ease);
}
.choice input:checked + .choice-body .choice-mark { border-color: var(--purple-lit); }
.choice input:checked + .choice-body .choice-mark::after { transform: scale(1); }

.choice-text { flex: 1; min-width: 0; }
.choice-text strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  margin-bottom: 5px;
}
.choice-text span {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--slate);
}

.choice.is-disabled { cursor: not-allowed; opacity: 0.4; }
.choice.is-disabled:hover .choice-body { border-color: var(--hairline-soft); transform: none; }

.choice-badge {
  font-size: 9px;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--slate);
  border: 1px solid var(--hairline-soft);
  border-radius: 0;
  padding: 4px 10px;
  flex: none;
}

/* the "I'm not a member yet" escape hatch */
.side-door {
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px dashed var(--hairline-soft);
  border-radius: 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--slate);
  letter-spacing: 0.02em;
}
.side-door a {
  color: var(--white);
  border-bottom: 1px solid var(--hairline);
  transition: border-color 0.3s var(--ease);
}
.side-door a:hover { border-color: var(--purple-lit); color: var(--purple-lit); }

/* ==========================================================================
   Dashboard
   ========================================================================== */
.app-body { background: #030303; }

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100svh;
}

/* sidebar */
.app-sidebar {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 26px 20px;
  border-right: 1px solid var(--hairline-soft);
  background: #000;
}

.app-sidebar .brand img { height: 20px; }

.app-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.app-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 0;
  font-size: 12px;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--slate);
  transition: color 0.3s var(--ease), background 0.3s var(--ease);
}

.app-nav a:hover { color: var(--white); background: rgba(255, 255, 255, 0.05); }
.app-nav a.is-current { color: var(--white); background: var(--purple-veil); box-shadow: inset 3px 0 0 var(--purple-lit); }

.app-nav a.is-locked { cursor: default; }
.app-nav a.is-locked:hover { color: var(--slate); background: transparent; }

.app-nav svg { width: 15px; height: 15px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.4; }

.app-nav .soon {
  margin-left: auto;
  font-size: 8px;
  letter-spacing: 0.1em;
  color: #4a4a4a;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 0;
  padding: 3px 6px;
}

.sidebar-foot { margin-top: auto; display: grid; gap: 14px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--hairline-soft);
  border-radius: 0;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #2a2a2a, #0c0c0c);
  border: 1px solid var(--hairline-soft);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--white);
  flex: none;
}

.sidebar-user .who { min-width: 0; }
.sidebar-user .who strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .who span {
  font-size: 10px;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--slate);
}

.signout {
  width: 100%;
  padding: 11px;
  background: transparent;
  border: 1px solid var(--hairline-soft);
  border-radius: 0;
  color: var(--slate);
  font-size: 10px;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.signout:hover { color: var(--white); border-color: var(--hairline); }

/* main column */
.app-main { position: relative; min-width: 0; padding: 0 0 70px; }

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px clamp(22px, 3vw, 44px);
  border-bottom: 1px solid var(--hairline-soft);
  background: rgba(3, 3, 3, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.app-topbar h1 {
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
  letter-spacing: var(--track-mid);
}

.chapter-chip {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 15px;
  border: 1px solid var(--hairline-soft);
  border-radius: 0;
  font-size: 10px;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--ash);
}

.app-content { padding: clamp(28px, 4vw, 48px) clamp(22px, 3vw, 44px); }

.app-greeting { margin-bottom: 34px; }
.app-greeting h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}
.app-greeting p { color: var(--ash); font-size: 0.92rem; line-height: 1.75; max-width: 58ch; }

/* tiles */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(272px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.tile {
  position: relative;
  border: 1px solid var(--hairline-soft);
  border-radius: 0;
  padding: 24px;
  background: #070707;
  min-height: 168px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.4s var(--ease), background 0.4s var(--ease);
}

.tile:hover { border-color: rgba(255, 255, 255, 0.2); background: #0a0a0a; }

.tile-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--slate);
}

.tile-head svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.4; }

.tile--full { grid-column: 1 / -1; }

/* empty states — the dashboard is deliberately blank for now */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  padding: 14px 0;
}

.empty-state .glyph {
  width: 34px;
  height: 34px;
  border-radius: 0;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  display: grid;
  place-items: center;
  color: #3d3d3d;
  font-size: 15px;
  margin-bottom: 4px;
}

.empty-state strong {
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--ash);
}

.empty-state span {
  font-size: 0.8rem;
  line-height: 1.7;
  color: #5a5a5a;
  letter-spacing: 0.02em;
  max-width: 42ch;
}

/* skeleton shimmer for values still loading */
.skeleton {
  display: inline-block;
  min-width: 90px;
  height: 0.9em;
  border-radius: 0;
  background: linear-gradient(90deg, #141414 25%, #1f1f1f 50%, #141414 75%);
  background-size: 240% 100%;
  animation: skeletonPass 1.4s linear infinite;
  vertical-align: middle;
}

@keyframes skeletonPass {
  from { background-position: 200% 0; }
  to   { background-position: -60% 0; }
}

/* forced password change overlay */
.gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  place-items: center;
  padding: var(--gutter);
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.gate.is-open { display: grid; }
.gate .auth-card { max-width: 440px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }

  .app-sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--hairline-soft);
    overflow-x: auto;
  }

  .app-nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 4px;
  }
  .app-nav .soon { display: none; }
  .app-nav a span.label { display: none; }
  .app-nav a { padding: 10px; }
  .app-nav a.is-current span.label { display: inline; }

  .sidebar-foot { margin-top: 0; margin-left: auto; grid-auto-flow: column; align-items: center; }
  .sidebar-user { border: 0; padding: 0; }
  .sidebar-user .who { display: none; }
  .signout { width: auto; padding: 10px 14px; }

  .app-topbar { position: static; }
  .chapter-chip { display: none; }
}

@media (max-width: 560px) {
  .auth-card { padding: 26px 20px; }
  .step-nav { flex-direction: column-reverse; }
}
