/* ========================================
   User Ingress — "Backyard Blue"
   A sky cover with hills, a sun and a little house,
   then a plain form on cream paper.
   ======================================== */
:root {
  --ingress-control-border: var(--color-ink-faint);
  --ingress-action: var(--color-heeler);
  --ingress-action-hover: var(--color-heeler-dark);
}

/* ── Cover and panel ───────────────────── */
.auth-shell {
  --ui-focus-outline: var(--color-heeler);
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding: max(var(--space-md), env(safe-area-inset-top)) var(--space-md) var(--space-md);
  overflow-x: clip;
  background: var(--color-cream);
  color: var(--color-ink);
  font-family: var(--font-body);
}

.auth-cover {
  position: relative;
  isolation: isolate;
  flex: 1 1 608px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-2xl) var(--space-2xl);
  overflow: hidden;
  border: var(--line);
  border-radius: var(--radius-xl);
  background: var(--color-hover);
  color: var(--color-ink);
}

.auth-cover-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
}

.auth-brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-sm-md);
  color: var(--color-ink);
  font-weight: var(--weight-semibold);
  font-size: var(--text-title);
  line-height: normal;
  font-family: var(--font-display);
}

.auth-brand .brand-mark { flex: 0 0 auto; }

.auth-cover-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 440px;
  margin-bottom: calc(var(--space-sm) * 19);
}

.auth-cover-line {
  margin: 0;
  font-weight: var(--weight-semibold);
  font-size: var(--text-display);
  line-height: var(--leading-display);
  font-family: var(--font-display);
  color: var(--color-ink);
}

.auth-cover-line mark {
  padding: 0 var(--space-sm-md);
  border-radius: var(--radius-md);
  background: var(--color-cream-dark);
  color: inherit;
}

.auth-cover-notes {
  margin: 0;
  color: var(--color-ink);
  font-weight: var(--weight-semibold);
  font-size: var(--text-body);
  line-height: normal;
  font-family: var(--font-body);
}

.auth-cover-notes span { padding-inline: 0; }

.auth-panel {
  flex: 1 1 468px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-xl) var(--space-lg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin: 0 0 var(--space-lg);
}

.auth-title,
.auth-shell .kitchen-members-heading .auth-title {
  margin: 0;
  color: var(--color-ink);
  font-weight: var(--weight-semibold);
  font-size: var(--text-display);
  line-height: var(--leading-display);
  font-family: var(--font-display);
  text-wrap: wrap;
}

.auth-subtitle {
  margin: 0;
  color: var(--color-ink-soft);
  font-size: var(--text-body);
  line-height: normal;
}

/* ── Fields ────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.auth-field {
  display: grid;
  gap: var(--space-sm);
}

/* "Forgot password?" sits beside the label but comes after the field in tab order */
.auth-field--password {
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--space-sm-md);
}

.auth-field--password .auth-password {
  grid-column: 1 / -1;
  grid-row: 2;
}

.auth-forgot {
  grid-row: 1;
  grid-column: 2;
  align-self: baseline;
}

.auth-label {
  color: var(--color-ink);
  font-size: var(--text-body);
  font-weight: var(--weight-bold);
  line-height: normal;
}

.auth-input {
  appearance: none;
  width: 100%;
  padding: var(--input-padding);
  border: 2px solid var(--ingress-control-border);
  border-radius: var(--radius-lg);
  background: var(--color-paper);
  color: var(--color-ink);
  font-weight: var(--weight-regular);
  font-size: var(--text-body);
  line-height: normal;
  font-family: var(--font-body);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.auth-input::placeholder {
  color: var(--color-ink-soft);
  opacity: 1;
}

.auth-input:hover {
  border-color: var(--color-ink-soft);
}

body:not(.controller-prototype) input.auth-input:focus-visible,
.auth-input:focus {
  padding: var(--input-padding);
  border: var(--line);
  outline: 4px solid var(--color-hover);
  outline-offset: 0;
}

.auth-shell summary:focus-visible {
  outline: 3px solid var(--ui-focus-outline);
  outline-offset: 2px;
}

.auth-input[aria-invalid="true"] {
  border-color: var(--color-tomato);
  background: var(--color-tomato-light);
}

.auth-password {
  position: relative;
}

.auth-password .auth-input {
  padding-right: calc(var(--space-sm) * 6);
}

.auth-password .auth-input:focus {
  padding-right: calc(var(--space-sm) * 7);
}

.auth-reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-round);
  background: transparent;
  color: var(--color-ink-soft);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color 150ms ease, background-color 150ms ease;
}

.auth-reveal svg {
  width: 22px;
  height: 22px;
}

.auth-reveal .auth-reveal-hide,
.auth-reveal[aria-pressed="true"] .auth-reveal-show {
  display: none;
}

.auth-reveal[aria-pressed="true"] .auth-reveal-hide {
  display: block;
}

@media (hover: hover) and (pointer: fine) {
  .auth-reveal:hover {
    background: var(--color-hover);
    color: var(--color-ink);
  }
}

.auth-hint {
  margin: 0;
  color: var(--color-ink-soft);
  font-size: var(--text-body);
  line-height: var(--leading-body);
}

.auth-link {
  color: var(--color-heeler-dark);
  font-weight: var(--weight-bold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-link:hover {
  color: var(--color-ink);
}

.auth-link--muted {
  font-size: var(--text-body);
  line-height: normal;
}

/* ── Action ────────────────────────────── */
.auth-button,
.auth-shell .kitchen-members-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  border: var(--line);
  border-radius: var(--radius-control);
  background: var(--ingress-action);
  color: var(--color-paper);
  cursor: pointer;
  font-weight: var(--weight-semibold);
  font-size: var(--text-title);
  line-height: normal;
  font-family: var(--font-display);
  text-decoration: none;
  /* A submit input does not wrap by default; a wide label would push the board past a narrow phone. */
  white-space: normal;
  transition: transform 160ms var(--ease-out-soft), background-color 150ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .auth-button:hover:not(:disabled),
  .auth-shell .kitchen-members-button:hover:not(:disabled) {
    background: var(--ingress-action-hover);
  }
}

.auth-button:active,
.auth-shell .kitchen-members-button:active {
  background: var(--ingress-action-hover);
  transform: scale(0.97);
}

.auth-button:disabled,
.auth-shell .kitchen-members-button:disabled {
  border-color: var(--color-border);
  background: var(--color-hover);
  color: var(--color-ink-soft);
  cursor: not-allowed;
  transform: none;
}

.auth-shell .kitchen-members-button--quiet {
  background: var(--color-paper);
  color: var(--color-ink);
}

@media (hover: hover) and (pointer: fine) {
  .auth-shell .kitchen-members-button--quiet:hover {
    background: var(--color-hover);
  }
}

.auth-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs);
  margin-top: var(--space-lg);
  color: var(--color-ink-soft);
  font-size: var(--text-body);
  line-height: normal;
}

.auth-flash {
  padding: var(--space-sm-md) var(--space-md);
  /* Every flash here is an alert: alerts keep the ink line (DESIGN.md Ink edges). */
  border: var(--line);
  border-color: var(--color-ink);
  border-radius: var(--radius-lg);
  background: var(--color-cream-dark);
  color: var(--color-ink);
  font-size: var(--text-body);
  line-height: var(--leading-body);
}

/* ── Invitation ────────────────────────── */
.auth-invite-from {
  display: flex;
  align-items: center;
  gap: var(--space-sm-md);
  color: var(--color-ink-soft);
  font-size: var(--text-body);
}

.auth-invite-from strong {
  color: var(--ui-text-strong);
  font-weight: var(--weight-semibold);
}

.auth-invite-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-cream-dark) 32%, var(--color-cream));
  outline: 1px solid var(--color-border);
  outline-offset: 3px;
  color: var(--ui-text-strong);
  font-weight: var(--weight-semibold);
  font-size: var(--text-body);
  line-height: var(--leading-display);
  font-family: var(--font-display);
}

.auth-invite-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-shell .kitchen-invitation-review {
  display: grid;
  gap: var(--space-md);
}

.auth-shell .kitchen-invitation-review > * { margin: 0; }
.auth-shell .kitchen-invitation-review .auth-title { margin: 0; overflow-wrap: anywhere; }
.auth-shell .kitchen-invitation-lede { color: var(--ui-text); line-height: var(--leading-body); }

.auth-shell .kitchen-invitation-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: var(--space-xs) 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.auth-shell .kitchen-invitation-steps li {
  position: relative;
  display: grid;
  justify-items: center;
  gap: var(--space-sm);
  padding: 0;
  background: none;
  box-shadow: none;
  color: var(--color-ink-soft);
  font-size: var(--text-label);
  font-weight: var(--weight-medium);
  text-align: center;
}

.auth-shell .kitchen-invitation-steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 14px;
  left: calc(50% + 20px);
  right: calc(-50% + 20px);
  height: 1.5px;
  background: var(--color-border);
}

.auth-shell .kitchen-invitation-steps li.is-done:not(:last-child)::after { background: var(--color-heeler); }

.auth-shell .kitchen-invitation-step-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-paper);
  font-weight: var(--weight-semibold);
  font-size: var(--text-label);
  line-height: var(--leading-display);
  font-family: var(--font-body);
}

.auth-shell .kitchen-invitation-steps li[aria-current="step"] { background: none; box-shadow: none; color: var(--ui-text-strong); font-weight: var(--weight-semibold); }
.auth-shell .kitchen-invitation-steps li[aria-current="step"] .kitchen-invitation-step-mark { border-color: var(--color-heeler-dark); background: var(--color-heeler-dark); color: var(--color-paper); }
.auth-shell .kitchen-invitation-steps li.is-done .kitchen-invitation-step-mark { border-color: var(--color-ink); background: var(--color-ink); color: var(--color-paper); }

.auth-shell .kitchen-scope-review { border-block: 1px solid var(--color-border); }
.auth-shell .kitchen-members-hint { color: var(--color-ink-soft); font-size: var(--text-body); }

/* ── Wide screens: cover left, form right ── */
/* ── Profile: the account has a cover too ── */









@media (prefers-reduced-motion: reduce) {
  .auth-input,
  .auth-button,
  .auth-shell .kitchen-members-button {
    transition: none;
  }

  .auth-button:active,
  .auth-shell .kitchen-members-button:active {
    transform: none;
  }
}

}

/* Signed in: the invitation sits in the app as one paper card */
.auth-shell.auth-shell--inline {
  min-height: 0;
  display: block;
  padding: clamp(var(--space-lg), 6vh, calc(var(--space-sm) * 7)) var(--space-md) var(--space-2xl);
  background: none;
}

.auth-shell--inline .auth-panel { display: block; padding: 0; }

.auth-shell--inline .auth-card {
  width: min(100%, 480px);
  margin: 0 auto;
  padding: clamp(var(--space-lg), 5vw, var(--space-2xl));
  border: var(--line);
  border-radius: var(--radius-xl);
  background: var(--color-paper);
}
