/* Coil — sign in.
   The composition is the WM22's face: a glass door beside a control column,
   at roughly the machine's real 875 / 400 mm split. Signing in unlocks it and
   drops a pack into the tray. Tokens come from styles.css. */

.stage-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(14px, 4vw, 40px);
}

.stage { width: 100%; display: grid; place-items: center; }

/* ---------- the machine ---------- */

.machine {
  --glass-bg: #0D0B14;
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: 1fr 0.46fr;   /* 875 : 400, near enough */
  gap: 14px;
  padding: 16px;
  background: linear-gradient(180deg, #232030, #1A1725);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .04) inset,
    0 40px 90px -50px rgba(0, 0, 0, .9);
}

.machine.is-refused { animation: refuse .42s cubic-bezier(.36, .07, .19, .97); }

@keyframes refuse {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* ---------- glass door ---------- */

.glass {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid #3A3450;
  border-radius: 12px;
  padding: 14px 14px 0;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
  overflow: hidden;
  min-height: clamp(300px, 52vh, 420px);
}

.glass__shelves {
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  gap: 9px;
  align-content: stretch;
}

.shelf {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: clamp(3px, .8vw, 6px);
  align-items: end;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

/* a pack seen edge-on, foil catching the light */
.pack {
  height: 100%;
  min-height: 20px;
  border-radius: 2px;
  background: linear-gradient(155deg, var(--foil-a), var(--foil-b));
  opacity: var(--shade, .8);
  transform: rotate(var(--tilt, 0deg)) scaleY(0);
  transform-origin: bottom;
  animation: load .5s cubic-bezier(.22, 1, .36, 1) var(--delay, 0s) forwards;
}

.pack--gone { background: rgba(255, 255, 255, .05); opacity: 1; }

@keyframes load { to { transform: rotate(var(--tilt, 0deg)) scaleY(1); } }

/* one soft reflection, so it reads as glass rather than a panel */
.glass__sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(107deg,
    rgba(255, 255, 255, .07) 0 14%,
    transparent 26% 100%);
}

/* the pack that falls when you unlock */
.glass__pack {
  position: absolute;
  left: 22%;
  top: 12%;
  width: 12px;
  height: 30px;
  border-radius: 2px;
  background: linear-gradient(155deg, var(--foil-a), var(--foil-b));
  opacity: 0;
  pointer-events: none;
}

.machine.is-open .glass__pack {
  animation: drop .62s cubic-bezier(.45, .05, .55, .95) forwards;
}

@keyframes drop {
  0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
  85%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(min(300px, 46vh)) rotate(26deg); }
}

/* ---------- pickup tray ---------- */

.tray {
  position: relative;
  margin: 0 -14px;
  padding: 12px 16px 14px;
  background: #17141F;
  border-top: 1px solid #3A3450;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tray__mouth {
  flex: 1;
  height: 16px;
  border-radius: 10px;
  background: #08070C;
  box-shadow: 0 2px 0 rgba(255, 255, 255, .05);
  transition: box-shadow .3s ease;
}

.machine.is-open .tray__mouth {
  box-shadow: 0 0 0 1px var(--foil-b), 0 0 22px -4px var(--foil-b);
}

.tray__word {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .22em;
  color: var(--stock-mute);
}

/* ---------- control column ---------- */

.column {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  min-width: 0;
}

.plate { display: grid; gap: 2px; padding: 2px 2px 0; }

.plate__name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -.01em;
  line-height: 1;
}

.plate__model {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .16em;
  color: var(--stock-mute);
}

/* the machine's own screen holds the form */
.screen {
  background: var(--glass-bg);
  border: 1px solid #3A3450;
  border-radius: 10px;
  padding: 16px 14px;
  display: grid;
  align-content: start;
  gap: 8px;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .25) inset;
}

.screen__eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--foil-b);
}

.screen__title {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(22px, 3.4vw, 28px);
  letter-spacing: -.02em;
  line-height: 1;
}

.screen__label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--stock-mute);
}

.screen__input {
  width: 100%;
  background: #05040A;
  border: 1px solid #3A3450;
  color: var(--stock);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 16px;             /* 16px keeps iOS from zooming on focus */
  letter-spacing: .18em;
}
.screen__input:focus {
  outline: none;
  border-color: var(--foil-b);
  box-shadow: 0 0 0 3px rgba(77, 225, 255, .16);
}
.screen__input:disabled { opacity: .6; }

.screen__go {
  margin-top: 4px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 13px;
  background: var(--stock);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.screen__go:hover { background: #fff; }
.screen__go:focus-visible { outline: 2px solid var(--foil-b); outline-offset: 3px; }
.screen__go:disabled { background: var(--stock-mute); color: var(--ink); cursor: default; }

.screen__msg {
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--fault);
}

/* status strip where the card reader sits on the real machine */
.reader {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  background: #17141F;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.reader__led {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--stock-mute);
  flex: none;
}
.reader__led--wait { background: var(--low); animation: pulse 1s ease-in-out infinite; }
.reader__led--ok   { background: var(--foil-b); box-shadow: 0 0 10px var(--foil-b); }
.reader__led--bad  { background: var(--fault); box-shadow: 0 0 10px var(--fault); }

@keyframes pulse { 50% { opacity: .3; } }

.reader__text {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .18em;
  color: var(--stock-dim);
}

/* ---------- narrow screens: the column sits under the glass ---------- */

@media (max-width: 620px) {
  .machine {
    grid-template-columns: 1fr;
    width: min(420px, 100%);
    padding: 12px;
  }
  .glass {
    min-height: 190px;
    padding-top: 12px;
  }
  .glass__shelves { grid-template-rows: repeat(3, 1fr); }
  .shelf:nth-child(n + 4) { display: none; }
  .plate { display: flex; align-items: baseline; justify-content: space-between; }
  @keyframes drop {
    0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
    85%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(150px) rotate(26deg); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .pack { animation: none; transform: rotate(var(--tilt, 0deg)) scaleY(1); }
  .machine.is-refused { animation: none; }
  .machine.is-open .glass__pack { animation: none; opacity: 0; }
  .reader__led--wait { animation: none; }
}
