/* ============================================================
   963 Labs Portal — Portal Shell (index.html)
   Light aesthetic. Login screen + authenticated product grid.
   ============================================================ */

body {
  background: #edeff2; /* canvas GROUND; fallback behind the shared bg */
  color: var(--light-text-primary);
  min-height: 100vh;
}

/* ---------- Login Screen ---------- */
#login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;      /* overlay above #app; dissolves on sign-in */
  inset: 0;
  z-index: 200;
  background: transparent;  /* shared canvas shows through */
  overflow: hidden;
  transition: opacity 0.9s ease;
}

/* Feathered scrim: a ground-coloured glow behind the panel so the mesh
   recedes under the text. No edges, no card — just contrast. */
#login-screen::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 780px);
  height: min(55vh, 480px);
  background: radial-gradient(closest-side,
    rgba(237, 239, 242, 0.95),
    rgba(237, 239, 242, 0.7) 45%,
    rgba(237, 239, 242, 0));
  pointer-events: none;
  z-index: 0;
}

#login-screen.dismissed {
  opacity: 0;
  pointer-events: none;
}

/* Sign-in: fade the panel out while the background keeps going, then freezes. */
#login-screen.signing-in .login-wordmark,
#login-screen.signing-in .login-quote,
#login-screen.signing-in .login-btn {
  animation: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

/* Animated background: drifting color wash + connected mesh (v3). */
.login-bg {
  position: fixed;      /* shared page background, behind login + portal */
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

/* Wash is drawn into a tiny backing buffer (see initLoginBg) and stretched
   to full size here — the browser's upscale IS the blur. No CSS filter, so
   no per-repaint re-blur (that caused the flickering rectangles). */
#bg-wash {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#bg-mesh {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.55;
}

.login-wordmark {
  font-size: 48px;
  font-weight: 200;
  letter-spacing: -0.5px;
  color: var(--light-text-primary);
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: fade-in-up 0.8s ease forwards;
}

.login-quote {
  position: relative;
  z-index: 1;
  max-width: 420px;
  margin-bottom: 40px;
  text-align: center;
  opacity: 0;
  transition: opacity 600ms ease-out;
}

.login-quote.visible { opacity: 1; }

.login-quote-text {
  font-size: 18px;
  font-weight: 400;
  font-style: italic;
  line-height: 1.4;
  color: var(--light-text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.login-quote-text:hover {
  color: var(--light-text-primary);
  text-decoration: underline;
}

.login-quote-author {
  font-size: 14px;
  color: var(--light-text-secondary);
  opacity: 0.7;
  margin-top: 8px;
}

.login-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 44px;
  font-size: 17px;
  font-weight: 400;
  font-family: var(--sans);
  color: var(--light-white);
  background: var(--light-accent-blue);
  border: none;
  border-radius: 980px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  opacity: 0;
  animation: fade-in-up 0.8s ease 0.3s forwards;
}

.login-btn:hover  { background: var(--light-accent-blue-hover); }
.login-btn:active { transform: scale(0.97); }

/* ---------- App Nav ---------- */
#app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.nav-wordmark {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--light-text-primary);
}

.nav-right { position: relative; }

.avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: var(--light-white);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.avatar-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 2px 12px rgba(102, 126, 234, 0.3);
}

/* ---------- Dropdown ---------- */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--light-white);
  border-radius: 14px;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--light-text-primary);
  margin-bottom: 2px;
}

.dropdown-email {
  font-size: 13px;
  color: var(--light-text-secondary);
  margin-bottom: 14px;
}

.dropdown-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  margin-bottom: 14px;
}

.sign-out-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--sans);
  color: #ff3b30;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.sign-out-btn:hover { background: rgba(255, 59, 48, 0.06); }

/* ---------- Hero ---------- */
.hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: 64px 24px 24px;
}

.hero-greeting {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--light-text-primary);
  margin-bottom: 6px;
  opacity: 0;
  animation: fade-in-up 0.6s ease 0.1s forwards;
}

.hero-subtitle {
  font-size: 19px;
  font-weight: 400;
  color: var(--light-text-secondary);
  margin-bottom: 4px;
  opacity: 0;
  animation: fade-in-up 0.6s ease 0.2s forwards;
}

.hero-date {
  font-size: 15px;
  color: var(--light-text-secondary);
  opacity: 0;
  animation: fade-in-up 0.6s ease 0.3s forwards;
}

/* ---------- Product Grid ---------- */
.products-section {
  background: transparent; /* let the shared bg show through */
  padding: 48px 24px 80px;
  margin-top: 32px;
}

.products-grid {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.product-card {
  /* Translucent, no backdrop-filter: sampling the will-change bg layer
     below produced rectangular compositor seams. */
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: var(--light-card-shadow);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px);
}

.product-card.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease,
              box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--light-card-shadow-hover);
}

.product-card.visible:hover { transform: translateY(-8px); }

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.card-icon svg {
  width: 24px;
  height: 24px;
  fill: rgba(255, 255, 255, 0.9);
}

.card-icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 20px;
  background: inherit;
  opacity: 0.2;
  filter: blur(12px);
  z-index: -1;
}

.card-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--light-text-primary);
  margin-bottom: 4px;
}

.card-desc {
  font-size: 14px;
  line-height: 1.45;
  color: var(--light-text-secondary);
  margin-bottom: 16px;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ---------- Badges ---------- */
.badge {
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 980px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-live        { background: rgba(52, 199, 89, 0.1);  color: #248a3d; }
.badge-live::before        { background: var(--light-green); }
.badge-development { background: rgba(255, 159, 10, 0.1); color: #c77c00; }
.badge-development::before { background: var(--light-amber); }
.badge-planning    { background: rgba(0, 122, 255, 0.1);  color: #0062cc; }
.badge-planning::before    { background: var(--light-blue); }
.badge-onhold      { background: rgba(142, 142, 147, 0.1); color: #636366; }
.badge-onhold::before      { background: var(--light-grey-badge); }

.card-metric {
  font-size: 12px;
  color: var(--light-text-secondary);
  text-align: right;
  white-space: nowrap;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 40px 24px;
  font-size: 13px;
  color: var(--light-text-secondary);
  background: transparent;
}

/* ---------- Animations ---------- */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .products-grid  { grid-template-columns: repeat(2, 1fr); }
  .hero-greeting  { font-size: 28px; }
  .hero-subtitle  { font-size: 17px; }
}

@media (max-width: 600px) {
  .products-grid   { grid-template-columns: 1fr; }
  .hero            { padding: 40px 20px 16px; }
  .products-section{ padding: 32px 20px 60px; }
  .login-wordmark  { font-size: 38px; }
  .hero-greeting   { font-size: 24px; }
}
