/* Sign-in — the one page an outsider ever sees, and the only one with no work to do.
 *
 * So it gets the room the work surfaces cannot afford: an editorial half carrying the
 * brand (display serif, deep terracotta, generous margins) and a quiet half carrying the
 * single action. The split is not decoration — it exists so the button sits alone.
 *
 * No image files. The panel is built from gradients over the brand tokens, so the page
 * costs one request and never shows a half-loaded photograph. Colours come from
 * tokens.css; the handful of literals here belong to the dark stage, which is deliberately
 * the same in both themes — a lobby does not change with the daylight.
 */

.app-main.auth-main {
  padding: 0;
  max-width: none;
  display: block;
}

.auth-page {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100dvh;
  background-color: var(--color-bg);
}

@media (min-width: 900px) {
  .auth-page {
    /* The brand side is the wider one: it is what the page is for on first sight. */
    grid-template-columns: 1.15fr 1fr;
  }
}

/* --- The editorial half --------------------------------------------------- */

.auth-stage {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-8) var(--space-6);
  background-image:
    radial-gradient(120% 90% at 12% 8%, rgba(200, 155, 135, 0.5) 0%, rgba(200, 155, 135, 0) 55%),
    radial-gradient(95% 75% at 88% 96%, rgba(0, 172, 216, 0.28) 0%, rgba(0, 172, 216, 0) 60%),
    linear-gradient(155deg, #3c2c22 0%, #241a14 48%, #17100c 100%);
  color: #f6efe6;
}

@media (min-width: 900px) {
  .auth-stage {
    padding: var(--space-12) var(--space-10);
  }
}

/* A woven grain a few percent strong: gives the flat gradient a surface to catch light
   on, which is most of the difference between "dark box" and "material". */
.auth-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(
      to bottom, rgba(255, 255, 255, 0.028) 0 1px, rgba(255, 255, 255, 0) 1px 4px),
    repeating-linear-gradient(
      to right, rgba(255, 255, 255, 0.02) 0 1px, rgba(255, 255, 255, 0) 1px 6px);
}

.auth-stage-mark {
  font-family: var(--font-ui);
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: rgba(246, 239, 230, 0.72);
}

.auth-stage-body {
  padding: var(--space-10) 0;
}

.auth-stage-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.5rem, 6vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 0;
  color: #fdfaf5;
}

.auth-stage-title em {
  display: block;
  font-style: italic;
  font-weight: 200;
  /* The terracotta accent, lifted for the dark ground it sits on. */
  color: #e8bda8;
}

.auth-stage-rule {
  width: 3.5rem;
  height: 1px;
  margin: var(--space-6) 0 0;
  border: 0;
  background-color: rgba(232, 189, 168, 0.55);
}

.auth-stage-lede {
  margin: var(--space-5) 0 0;
  max-width: 34ch;
  font-size: var(--text-body);
  line-height: var(--leading-loose);
  color: rgba(246, 239, 230, 0.78);
}

.auth-stage-foot {
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  color: rgba(246, 239, 230, 0.52);
}

/* --- The access half ------------------------------------------------------ */

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-5);
  background-color: var(--color-surface);
}

@media (min-width: 900px) {
  .auth-panel {
    padding: var(--space-12) var(--space-10);
  }
}

.auth-card {
  width: 100%;
  max-width: 25rem;
}

.auth-eyebrow {
  margin: 0 0 var(--space-3);
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.auth-title {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2rem;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

.auth-subtitle {
  margin: 0 0 var(--space-8);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  color: var(--color-text-2);
}

/* The single action. Sized like the decision it is, not like a form control. */
.auth-sso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 3.25rem;
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background-color: var(--color-text);
  color: var(--color-surface);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  font-weight: 600;
  text-decoration: none;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-base),
    background-color var(--transition-fast);
}

.auth-sso:hover,
.auth-sso:focus-visible {
  background-color: var(--color-text-2);
  color: var(--color-surface);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.auth-sso:active {
  transform: translateY(0);
}

.auth-sso:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 3px;
}

.auth-sso-glyph {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
}

.auth-note {
  margin: var(--space-5) 0 0;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--color-text-muted);
}

/* Refused for want of activation. Amber rather than red: nothing went wrong, it is
   waiting for a person — and it carries an icon, so colour is never the only signal. */
.auth-pending {
  display: flex;
  gap: var(--space-3);
  margin: 0 0 var(--space-6);
  padding: var(--space-4);
  border: 1px solid var(--color-warning-border);
  border-left: 3px solid var(--color-warning);
  border-radius: var(--radius-card);
  background-color: var(--color-warning-subtle);
  color: var(--color-warning-text);
}

.auth-pending-glyph {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.1rem;
  color: var(--color-warning);
}

.auth-pending-title {
  margin: 0 0 var(--space-1);
  font-size: var(--text-body);
  font-weight: 600;
}

.auth-pending-text {
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

/* --- The password form, where sign-on cannot reach ------------------------ */

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-8) 0 var(--space-6);
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--color-border);
}

.auth-field {
  margin-bottom: var(--space-4);
}

.auth-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-2);
}

.auth-input {
  width: 100%;
  min-height: 3rem;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-ui);
  /* 16px floor: anything smaller makes iOS zoom the page on focus. */
  font-size: 1rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.auth-input:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: var(--shadow-focus);
}

.auth-submit {
  width: 100%;
  min-height: 3rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background-color: var(--color-surface-2);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.auth-submit:hover {
  background-color: var(--color-surface-3);
}

.auth-submit:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.auth-error {
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--color-danger-border);
  border-radius: var(--radius-card);
  background-color: var(--color-danger-subtle);
  color: var(--color-danger-text);
  font-size: var(--text-sm);
}

@media (prefers-reduced-motion: reduce) {
  .auth-sso,
  .auth-input,
  .auth-submit {
    transition: none;
  }

  .auth-sso:hover,
  .auth-sso:focus-visible {
    transform: none;
  }
}
