/* ── Portal Sign-In ───────────────────────────────────────────
   External CSS for /pj/signin — matches PJ design system
   Palette: dark forest green + emerald accent + amber secondary
   ──────────────────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  --bg0: #061a10;
  --bg1: #062017;
  --ink: rgba(248, 247, 242, 0.96);
  --muted: rgba(248, 247, 242, 0.68);
  --faint: rgba(248, 247, 242, 0.14);
  --line: rgba(248, 247, 242, 0.12);

  --surface: rgba(0, 0, 0, 0.26);
  --surface2: rgba(0, 0, 0, 0.36);

  --accent: #34d399;
  --accent2: #fbbf24;

  --danger: #fb7185;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
  --radius-lg: 22px;
  --radius-md: 14px;

  --font-sans: "Sora", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  --font-serif: "Fraunces", ui-serif, Georgia, serif;

  --noise: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%22200%22%20height%3D%22200%22%20viewBox%3D%220%200%20200%20200%22%3E%3Cfilter%20id%3D%22n%22%3E%3CfeTurbulence%20type%3D%22fractalNoise%22%20baseFrequency%3D%220.9%22%20numOctaves%3D%223%22%20stitchTiles%3D%22stitch%22/%3E%3CfeColorMatrix%20type%3D%22matrix%22%20values%3D%221%200%200%200%200%20%200%201%200%200%200%20%200%200%201%200%200%20%200%200%200%200.25%200%22/%3E%3C/filter%3E%3Crect%20width%3D%22200%22%20height%3D%22200%22%20filter%3D%22url(%23n)%22%20opacity%3D%220.42%22/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg0), var(--bg1));
  overflow-x: hidden;
}

a { color: inherit; }

/* ── Ambient background ────────────────────────────────────── */
.bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 720px at 18% 12%, rgba(52, 211, 153, 0.16), transparent 62%),
    radial-gradient(900px 520px at 86% 18%, rgba(251, 191, 36, 0.12), transparent 64%),
    radial-gradient(900px 900px at 55% 88%, rgba(52, 211, 153, 0.08), transparent 68%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.30), transparent 46%),
    var(--noise);
  opacity: 1;
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(52, 211, 153, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 211, 153, 0.03) 1px, transparent 1px);
  background-size: 68px 68px;
  opacity: 0.35;
  mask-image: radial-gradient(circle at 20% 10%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at 20% 10%, black 30%, transparent 70%);
}

/* ── Top nav ───────────────────────────────────────────────── */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(18px, 4vw, 52px);
  background: rgba(6, 26, 16, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(248, 247, 242, 0.08);
}

.topnav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.topnav__mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: -0.02em;
  color: rgba(52, 211, 153, 0.95);
  border: 1px solid rgba(52, 211, 153, 0.30);
  background:
    radial-gradient(circle at 25% 25%, rgba(52, 211, 153, 0.38), transparent 56%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.12));
}

.topnav__title {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.topnav__links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topnav__link {
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(248, 247, 242, 0.68);
  text-decoration: none;
  transition: color 140ms ease, background 140ms ease;
}

.topnav__link:hover {
  color: rgba(248, 247, 242, 0.96);
  background: rgba(248, 247, 242, 0.06);
}

.topnav__link--active {
  color: rgba(52, 211, 153, 0.95);
  background: rgba(52, 211, 153, 0.08);
}

@media (max-width: 600px) {
  .topnav__links { gap: 2px; }
  .topnav__link { padding: 6px 10px; font-size: 12px; }
}

/* ── Layout ────────────────────────────────────────────────── */
.wrap {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 52px);
  padding-top: calc(64px + clamp(18px, 4vw, 52px));
}

.shell {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1fr minmax(340px, 420px);
  gap: clamp(18px, 4vw, 56px);
  align-items: center;
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero { padding: clamp(6px, 1vw, 18px); }

.hero__top {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: rgba(52, 211, 153, 0.95);
  border: 1px solid rgba(52, 211, 153, 0.30);
  background:
    radial-gradient(circle at 25% 25%, rgba(52, 211, 153, 0.38), transparent 56%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.12));
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.36);
  user-select: none;
}

.brandname {
  font-family: var(--font-serif);
  font-size: clamp(34px, 4.2vw, 52px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin: 0;
}

.tagline {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.22);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(52, 211, 153, 0.95);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 800;
  font-size: 11px;
}

.hero__art {
  margin: 22px 0 22px;
  padding: 18px 18px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(248, 247, 242, 0.10);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.26), rgba(0, 0, 0, 0.14));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.duck { display: grid; place-items: center; }

.duck svg {
  width: min(520px, 100%);
  height: auto;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.45));
  transform: translateY(2px);
}

.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 980px) {
  .features { grid-template-columns: 1fr; }
}

.feature {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(248, 247, 242, 0.10);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.24), rgba(0, 0, 0, 0.10));
  padding: 16px 16px 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  min-height: 140px;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.feature:hover {
  transform: translateY(-2px);
  border-color: rgba(52, 211, 153, 0.22);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.10), rgba(0, 0, 0, 0.10));
}

.feature__icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: rgba(52, 211, 153, 0.92);
  border: 1px solid rgba(52, 211, 153, 0.18);
  background: rgba(52, 211, 153, 0.08);
  margin-bottom: 12px;
}

.feature__icon svg { width: 22px; height: 22px; }

.feature__title {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 18px;
}

.feature__text {
  margin: 0;
  color: rgba(248, 247, 242, 0.76);
  line-height: 1.45;
  font-size: 13px;
  font-weight: 600;
}

.bottomline {
  margin: 18px 0 0;
  color: rgba(52, 211, 153, 0.24);
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
}

/* ── Card ──────────────────────────────────────────────────── */
.card {
  border-radius: calc(var(--radius-lg) + 6px);
  border: 1px solid rgba(248, 247, 242, 0.12);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.38), rgba(0, 0, 0, 0.20));
  box-shadow: var(--shadow);
  padding: 26px;
  position: relative;
  overflow: hidden;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background: radial-gradient(700px 360px at 40% -40%, rgba(52, 211, 153, 0.18), transparent 50%);
  opacity: 0.85;
}

.card__inner { position: relative; z-index: 1; }

.card h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 22px;
}

.card p.sub {
  margin: 8px 0 16px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.45;
}

/* ── Error / Success banners ───────────────────────────────── */
.error {
  display: none;
  gap: 10px;
  align-items: flex-start;
  border-radius: var(--radius-md);
  border: 1px solid rgba(251, 113, 133, 0.22);
  background: rgba(251, 113, 133, 0.10);
  padding: 12px;
  color: rgba(255, 198, 206, 0.95);
  font-weight: 650;
  font-size: 13px;
  margin: 12px 0 14px;
}

.error svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }

.error[data-show="1"] { display: flex; }

.success {
  display: none;
  gap: 10px;
  align-items: flex-start;
  border-radius: var(--radius-md);
  border: 1px solid rgba(52, 211, 153, 0.28);
  background: rgba(52, 211, 153, 0.10);
  padding: 12px;
  color: rgba(52, 211, 153, 0.95);
  font-weight: 650;
  font-size: 13px;
  margin: 12px 0 14px;
}

.success svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }

.success[data-show="1"] { display: flex; }

/* ── Form ──────────────────────────────────────────────────── */
form { display: grid; gap: 12px; margin-top: 12px; }

label {
  display: grid;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(248, 247, 242, 0.78);
  letter-spacing: 0.03em;
}

.field { position: relative; }

.input {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(248, 247, 242, 0.14);
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  padding: 12px 12px 12px 44px;
  font-size: 14px;
  font-weight: 650;
  outline: none;
  transition: box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.input::placeholder {
  color: rgba(248, 247, 242, 0.38);
  font-weight: 600;
}

.input:focus {
  border-color: rgba(52, 211, 153, 0.38);
  background: rgba(0, 0, 0, 0.28);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.10);
}

.icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: rgba(248, 247, 242, 0.44);
  pointer-events: none;
}

.field:focus-within .icon { color: rgba(52, 211, 153, 0.92); }

.toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid rgba(248, 247, 242, 0.12);
  background: rgba(0, 0, 0, 0.16);
  color: rgba(248, 247, 242, 0.68);
  border-radius: 12px;
  padding: 6px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.02em;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.toggle:hover {
  border-color: rgba(52, 211, 153, 0.24);
  background: rgba(52, 211, 153, 0.08);
  transform: translateY(calc(-50% - 1px));
}

.toggle svg { width: 16px; height: 16px; }

.eye-hidden { display: none; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 2px;
}

.remember {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 650;
  color: rgba(248, 247, 242, 0.72);
  user-select: none;
}

.remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.link {
  color: rgba(52, 211, 153, 0.95);
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
}

.link:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.btn {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(52, 211, 153, 0.22);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.86), rgba(16, 185, 129, 0.72));
  color: rgba(6, 26, 16, 0.96);
  font-weight: 900;
  letter-spacing: 0.02em;
  padding: 12px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
  position: relative;
}

.btn:hover {
  transform: translateY(-1px);
  filter: saturate(1.08);
  box-shadow: 0 10px 28px rgba(52, 211, 153, 0.20);
}

.btn:active { transform: translateY(0); }

.btn[aria-busy="true"] { pointer-events: none; color: transparent; }

.btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 999px;
  border: 2px solid rgba(6, 26, 16, 0.28);
  border-top-color: rgba(6, 26, 16, 0.96);
  animation: spin 700ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 14px 0 6px;
  color: rgba(248, 247, 242, 0.42);
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  background: rgba(248, 247, 242, 0.12);
}

/* ── SSO / OAuth buttons ───────────────────────────────────── */
.sso-group { display: grid; gap: 8px; }

.btn-sso {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(248, 247, 242, 0.12);
  background: rgba(0, 0, 0, 0.12);
  color: rgba(248, 247, 242, 0.86);
  font-weight: 850;
  letter-spacing: 0.01em;
  padding: 12px 14px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.btn-sso:hover {
  transform: translateY(-1px);
  border-color: rgba(52, 211, 153, 0.20);
  background: rgba(52, 211, 153, 0.08);
}

.btn-sso svg { width: 18px; height: 18px; flex: 0 0 auto; }

.btn-sso--microsoft {
  border-color: rgba(52, 211, 153, 0.22);
  background: rgba(52, 211, 153, 0.06);
  color: rgba(248, 247, 242, 0.92);
  font-weight: 900;
}

.btn-sso--microsoft:hover {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.36);
}

.foot {
  margin-top: 14px;
  text-align: center;
  color: rgba(248, 247, 242, 0.54);
  font-size: 12px;
  font-weight: 650;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(248, 247, 242, 0.14);
  border-radius: 999px;
  padding: 10px 14px;
  color: rgba(248, 247, 242, 0.92);
  font-weight: 750;
  font-size: 13px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 10;
}

.toast[data-show="1"] {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

:focus-visible {
  outline: 3px solid rgba(251, 191, 36, 0.40);
  outline-offset: 2px;
  border-radius: 12px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
