/*
 * Role Sign In — artboards 13a and 13b.
 * Gate-local component rules keep the shared sign-in panel consistent across
 * the role surfaces. Tokens come from organic-tokens.css; hosts also load
 * organic-system.css. Preserve scoped resets when adjusting host layouts.
 */
@import url("/organic-tokens.css");

.gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: var(--space-6);
  overflow-y: auto;
  color: var(--color-text);
  font-family: var(--font-body);

  font-size: 15px;
  line-height: 1.55;
  background: var(--color-bg);
}

.gate[hidden] {
  display: none;
}

/* Soft blob decoration: behind content, never over it.
 *
 * The artboard draws no blob, because its overlay is translucent and the staff
 * surface shows through. The repo's overlay is opaque on purpose (a
 * passer-by must not read the queue through it), which leaves a
 * full screen of flat ground the design never has to fill. These two shapes
 * fill it in the system's own language and change no measurement inside the
 * card. */
.gate-blob {
  position: absolute;
  z-index: 0;
  width: 32rem;
  height: 32rem;
  border-radius: 48% 52% 58% 42%;
  filter: blur(18px);
  opacity: 0.5;
  pointer-events: none;
}

.gate-blob-top {
  top: -11rem;
  right: -9rem;
  background: radial-gradient(
    circle at 35% 35%,
    var(--color-accent-300),
    var(--color-accent-200) 55%,
    transparent 75%
  );
}

.gate-blob-bottom {
  bottom: -13rem;
  left: -10rem;
  background: radial-gradient(
    circle at 50% 50%,
    var(--color-accent-2-300),
    var(--color-accent-2-200) 55%,
    transparent 75%
  );
  opacity: 0.4;
}

.gate-card {
  position: relative;
  z-index: 1;
  /* 520px at padding --space-6 and radius 32, as `Role Gate.dc.html` sets it. */
  width: min(100%, 520px);
  padding: var(--space-6);
  border-radius: 32px;
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}

/* `.tag` + `.tag-outline`, reproduced. "Locked", not "Role Session": the
   artboard labels this with the state the surface is actually in, which is the
   gate's entire point. Mixed case at 11px — this is a tag, not one of the
   system's 10px uppercase eyebrow labels. */
.gate-eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 3px 10px;
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  color: var(--color-accent);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.55;
  text-transform: none;
}

.gate-title {
  margin: var(--space-2) 0 0;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 27px;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--color-text);
}

/* `.text-muted` at the artboard's 13px. */
.gate-hint {
  margin: var(--space-2) 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}

/* The `session_ended` notice, drawn as the artboard draws its refusal message:
   accent-100 ground, accent-800 ink, 20px radius. Terracotta at the dark end of
   its own ramp — the palette carries no red, and design.md forbids inventing
   one. */
.gate-ended {
  margin: var(--space-4) 0 0;
  padding: var(--space-3) var(--space-4);
  border-radius: 20px;
  background: var(--color-accent-100);
  color: var(--color-accent-800);
  font-size: 13px;
  line-height: 1.55;
}

.gate-ended[hidden] {
  display: none;
}

/* The outage state. The artboard does not draw it; it takes the refusal box's
   geometry in the sage ramp so the two read as one family. */
.gate-frozen {
  display: none;
  margin: var(--space-4) 0 0;
  padding: var(--space-3) var(--space-4);
  border: 1px dashed var(--color-accent-2-500);
  border-radius: 20px;
  background: var(--color-accent-2-100);
  color: var(--color-accent-2-800);
  font-size: 13px;
  line-height: 1.55;
}

.gate-card:has(.gate-submit:disabled) .gate-frozen {
  display: block;
}

/* The artboard's form is one flex row, bottoms aligned: the field takes the
   remaining width, `Sign in` sits beside it at its own intrinsic width, and the
   220px floor drops the button onto its own line on a narrow card. */
.gate-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.gate-field {
  flex: 1;
  min-width: 220px;
}

/* The artboard label is a plain 15px body span. */
.gate-label {
  display: block;
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--color-text);
}

/* `.input`, reproduced. */
.gate-input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 6px 14px;
  border: 1px solid var(--color-divider);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  caret-color: var(--color-accent);
  font-family: var(--font-body);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.gate-input:hover {
  border-color: color-mix(in srgb, var(--color-text) 45%, transparent);
}

.gate-input:focus-visible {
  border-color: var(--color-accent);
}

.gate-input:focus-visible,
.gate-submit:focus-visible,
/* Every gate control uses the same visible focus ring. */
.gate-switch-role:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* `.btn` + `.btn-primary`, reproduced. */
.gate-submit {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
  margin: 0;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-bg);
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
}

.gate-submit:hover {
  background: var(--color-accent-600);
}

.gate-submit:active {
  background: var(--color-accent-700);
}

/* The system's one disabled treatment: 45% opacity, nothing recoloured. */
.gate-card :disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/*
 * SURF-4d: the escape hatch to the role switcher, from Role Gate.dc.html.
 * A role switcher nobody can reach from a locked surface is half the feature.
 *
 * Flush left and underlined, as the artboard renders it, at the 44px touch
 * floor. The hover/active tints are `.btn-ghost`'s own 10%/18% color-mix
 * formula reproduced locally — the same escalation the system asks every
 * interactive element for, not a new one. The negative inline margin cancels
 * the padding the tint needs, so the text still starts at the card's edge.
 */
.gate-switch-role {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: var(--space-3) 0 0 calc(var(--space-1) * -1);
  padding: 0 var(--space-1);
  border-radius: var(--radius-md);
  color: var(--color-accent-700);
  font-size: 13px;
  line-height: 1.55;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.gate-switch-role:hover {
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
}

.gate-switch-role:active {
  background: color-mix(in srgb, var(--color-accent) 18%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .gate,
  .gate * {
    transition: none;
  }
}
