/* Grain Manager — animated sign-in mark ("data logo") + login backdrop.
   Framework-free port of client/src/index.css (.lit-grain-mark, .login-wheat*).
   Pair with lit-grain-mark.js. Add class "dark" to <html> for the dark theme. */

:root {
  --gm-background: 42 30% 96%;      /* paper cream, HSL channels */
  --gm-foreground: 35 16% 14%;      /* warm ink */
  --gm-primary: 168 52% 25%;        /* brand green #1f6154 */
  --gm-ring: 168 52% 25%;
  --gm-font-sans: "Inter", "Segoe UI", system-ui, sans-serif;
  --gm-font-display: "Fraunces", Georgia, serif;
}
html.dark {
  --gm-background: 215 16% 9%;
  --gm-foreground: 210 16% 92%;
  --gm-primary: 162 48% 36%;
  --gm-ring: 162 48% 36%;
}

/* ---------- The mark ----------------------------------------------------- */
/* The ear stays drawn; its light breathes. Data lines run into the chip and
   pulse on the same beat. */
.lit-grain-mark {
  --lf-line: hsl(36 38% 58%);
  --lf-pulse: hsl(168 50% 14%);
  overflow: visible;
}
.dark .lit-grain-mark {
  --lf-line: hsl(36 28% 72%);
  --lf-pulse: hsl(45 70% 90%);
}
.lit-grain-mark svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.lit-grain-mark .lit-grain-tile {
  filter:
    drop-shadow(0 1px 1px hsl(168 40% 10% / 0.35))
    drop-shadow(0 4px 7px hsl(168 40% 12% / 0.28));
}
.dark .lit-grain-mark .lit-grain-tile {
  filter:
    drop-shadow(0 1px 1px hsl(0 0% 0% / 0.45))
    drop-shadow(0 5px 8px hsl(0 0% 0% / 0.4));
}
.lit-grain-mark .lit-feed,
.lit-grain-mark .lit-feed-node {
  stroke: var(--lf-line);
  stroke-width: 0.7;
  fill: none;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  opacity: 0.4;
}
.lit-grain-mark .lit-feed-node-glow {
  opacity: 0;
  stroke-linecap: round;
}
.lit-grain-mark .lit-feed-pulse {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}
.lit-grain-mark .lit-grain-halo,
.lit-grain-mark .lit-grain-bloom,
.lit-grain-mark .lit-grain-core {
  animation: lit-grain-pulse 4s ease-in-out infinite;
}
.lit-grain-mark .lit-grain-core {
  animation-name: lit-grain-core;
}
@keyframes lit-grain-pulse {
  0%, 100% { opacity: 0.28; }
  50% { opacity: 0.9; }
}
@keyframes lit-grain-core {
  0%, 100% { opacity: 0.62; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .lit-grain-mark .lit-grain-halo,
  .lit-grain-mark .lit-grain-bloom,
  .lit-grain-mark .lit-grain-core,
  .lit-grain-mark .lit-feed-pulse {
    animation: none;
  }
  .lit-grain-mark .lit-feed-pulse { opacity: 0; }
  .lit-grain-mark .lit-grain-halo { opacity: 0.315; }
  .lit-grain-mark .lit-grain-bloom { opacity: 0.495; }
  .lit-grain-mark .lit-grain-core { opacity: 1; }
}

/* ---------- The sign-in backdrop ---------------------------------------- */
/* Wheat-field photograph scaled to the viewport, a soft cream (or charcoal)
   wash over it, dust motes drifting in the top half, and a frosted panel. */
.login-wheat {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-anchor: none;
  background-color: hsl(var(--gm-background));
  background-image: url("wheat-field.jpg");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  background-attachment: fixed;
  color: hsl(var(--gm-foreground));
  font-family: var(--gm-font-sans);
}
.login-wheat::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    hsl(40 36% 97% / 0.42) 0%,
    hsl(38 32% 96% / 0.28) 42%,
    hsl(36 40% 94% / 0.22) 100%
  );
}
.dark .login-wheat::before {
  background: linear-gradient(
    180deg,
    hsl(215 16% 9% / 0.62) 0%,
    hsl(215 16% 9% / 0.5) 48%,
    hsl(215 16% 9% / 0.58) 100%
  );
}
.login-wheat > :not(.login-wheat-motion) {
  position: relative;
  z-index: 3;
}
.login-wheat-motion {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.login-wheat-dust {
  z-index: 2;
}
.login-wheat-main {
  display: flex;
  flex: 1;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 1rem 1.5rem;
}
.login-wheat-panel {
  width: 100%;
  max-width: 28rem;
  padding: 1.5rem 1.25rem;
  border-radius: 1.15rem;
  background: hsl(var(--gm-background) / 0.46);
  border: 1px solid hsl(0 0% 100% / 0.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow:
    inset 0 1px 0 hsl(0 0% 100% / 0.62),
    0 18px 40px -24px hsl(35 30% 16% / 0.4);
}
.dark .login-wheat-panel {
  background: hsl(var(--gm-background) / 0.42);
  border-color: hsl(0 0% 100% / 0.14);
  box-shadow:
    inset 0 1px 0 hsl(0 0% 100% / 0.08),
    0 18px 40px -24px hsl(0 0% 0% / 0.45);
}
/* Size used on the real sign-in screen: 7.5rem tall, up to 24.75rem wide. */
.login-wheat-panel .lit-grain-mark {
  margin: 0 auto 1rem;
  height: 7.5rem;
  width: 100%;
  max-width: 24.75rem;
}
.login-wheat-panel h1 {
  font-family: var(--gm-font-display);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0;
}
.login-wheat-panel p {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: hsl(var(--gm-foreground) / 0.72);
}
