/* Early access widget: a glowing pill in the top right that opens a two-step panel. */

.ea {
  position: fixed;
  top: calc(var(--gutter) * 0.6 + var(--safe-top));
  right: calc(var(--gutter) + var(--safe-right));
  z-index: 20;
  font-family: var(--font-text);
}

/* ---- collapsed pill ---- */
.ea__pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 16px 0 12px;
  border: 1px solid rgba(245, 242, 235, 0.22);
  border-radius: 999px;
  background: rgba(14, 30, 42, 0.72);
  color: var(--ivory);
  font: 600 12px/1 var(--font-text);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 0 0 rgba(203, 227, 246, 0.55);
  animation: ea-glow 2.4s var(--ease-out) infinite;
  transition: transform 160ms var(--ease-out), border-color 200ms ease, background-color 200ms ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.ea__pill:active { transform: scale(0.97); }
.ea__pill-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--turf);
  box-shadow: 0 0 0 3px rgba(39, 121, 63, 0.28);
  transition: background-color 700ms var(--ease-in-out), box-shadow 700ms var(--ease-in-out);
}
.is-winter .ea__pill-dot { background: var(--frost); box-shadow: 0 0 0 3px rgba(28, 109, 174, 0.32); }

@keyframes ea-glow {
  0%   { box-shadow: 0 0 0 0 rgba(203, 227, 246, 0.55); }
  70%  { box-shadow: 0 0 0 14px rgba(203, 227, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(203, 227, 246, 0); }
}

.ea[data-state="open"] .ea__pill,
.ea[data-state="done"] .ea__pill { animation: none; }
.ea[data-state="open"] .ea__pill { border-color: rgba(245, 242, 235, 0.4); background: rgba(14, 30, 42, 0.9); }

@media (hover: hover) and (pointer: fine) {
  .ea__pill:hover { border-color: rgba(245, 242, 235, 0.45); background: rgba(14, 30, 42, 0.9); }
}

/* ---- panel ---- */
.ea__panel {
  position: absolute;
  top: 50px;
  right: 0;
  width: min(380px, calc(100vw - 2 * var(--gutter) - var(--safe-left) - var(--safe-right)));
  padding: 26px 26px 24px;
  border: 1px solid rgba(245, 242, 235, 0.14);
  border-radius: 20px;
  background: rgba(14, 30, 42, 0.94);
  color: var(--ivory);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transform-origin: top right;
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}
.ea__panel[hidden] { display: none; }
.ea[data-state="open"] .ea__panel { opacity: 1; transform: none; }

.ea__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ivory-70);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.ea__close:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) {
  .ea__close:hover { background: rgba(245, 242, 235, 0.08); color: var(--ivory); }
}

.ea__mark { width: 44px; height: 44px; margin-bottom: 16px; }

.ea__title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ivory);
  text-wrap: balance;
}
.ea__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ivory-85);
}
.ea__fine {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ivory-70);
}

.ea__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--frost);
  color: #fff;
  font: 600 15px/1 var(--font-text);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 160ms var(--ease-out), background-color 200ms ease, opacity 200ms ease;
}
.ea__btn:active { transform: scale(0.97); }
.ea__btn[disabled] { opacity: 0.6; cursor: default; }
.ea__btn--ghost { background: rgba(245, 242, 235, 0.1); color: var(--ivory); }
@media (hover: hover) and (pointer: fine) {
  .ea__btn:hover { background: #1F78BF; }
  .ea__btn--ghost:hover { background: rgba(245, 242, 235, 0.16); }
}
.ea__btn svg { flex: none; }

/* ---- form ---- */
.ea__label {
  display: block;
  margin-top: 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ivory-70);
}
.ea__label:first-of-type { margin-top: 4px; }
.ea__input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 242, 235, 0.18);
  border-radius: 12px;
  background: rgba(245, 242, 235, 0.06);
  color: var(--ivory);
  font: 400 16px/1.3 var(--font-text); /* 16px stops iOS zooming into the field */
  caret-color: var(--ice);
  transition: border-color 160ms ease, background-color 160ms ease;
}
.ea__input::placeholder { color: rgba(245, 242, 235, 0.45); }
.ea__input:focus { outline: none; border-color: var(--ice); background: rgba(245, 242, 235, 0.09); }
.ea__input[aria-invalid="true"] { border-color: #E07A7A; }
.ea__hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ea__error {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: #F3B4B4;
}
.ea__error[hidden] { display: none; }

.ea__step[hidden] { display: none; }

/* ---- phones: the panel becomes a bottom sheet ---- */
@media (max-width: 560px) {
  .ea__panel {
    position: fixed;
    top: auto;
    right: var(--gutter);
    left: var(--gutter);
    bottom: calc(16px + var(--safe-bottom));
    width: auto;
    max-height: calc(100dvh - 32px - var(--safe-top) - var(--safe-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    transform-origin: bottom center;
    transform: translateY(10px) scale(0.98);
  }
  .ea__pill-text { display: none; }
  .ea__pill { padding: 0 12px; gap: 0; }
  .ea__pill::after { content: "Early access"; margin-left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .ea__pill { animation: none; box-shadow: 0 0 0 4px rgba(203, 227, 246, 0.25); }
  .ea__panel, .ea__btn, .ea__close, .ea__pill { transition: none; }
}
