/* Rain theme module for Linkify: pixel rain streaks over a slate night sky.
 *
 * Two fixed layers fall behind the content: a dim, slow far layer (::before) and a
 * softer, faster near layer (::after). Each layer is a repeating SVG tile of
 * crisp-edged streaks; animating the background position by exactly one tile height
 * in stepped jumps gives seamless, choppy pixel motion. Both layers sit at
 * z-index -1, behind the card and buttons, so text is never drawn over.
 */

body[data-theme="Rain"] {
  --shell-top: #121a24;
  --shell-bottom: #243241;
  --panel-bg: #cdd4da;
  --pill-bg: rgba(255, 255, 255, 0.14);
  --pill-border: rgba(26, 36, 48, 0.58);
  --frame-border: rgba(26, 36, 48, 0.58);
  --ink: #18222e;
  --ink-soft: rgba(24, 34, 46, 0.9);
}

body[data-theme="Rain"]::before,
body[data-theme="Rain"]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-repeat: repeat;
}

/* Far layer: sparse, short, dim streaks on a 160 x 240 tile. */
body[data-theme="Rain"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='240' shape-rendering='crispEdges' fill='%237f9fbf'%3E%3Crect x='10' y='16' width='2' height='6'/%3E%3Crect x='46' y='128' width='2' height='6'/%3E%3Crect x='78' y='52' width='2' height='6'/%3E%3Crect x='110' y='196' width='2' height='6'/%3E%3Crect x='140' y='94' width='2' height='6'/%3E%3Crect x='28' y='212' width='2' height='4'/%3E%3Crect x='122' y='8' width='2' height='4'/%3E%3C/svg%3E");
  background-size: 160px 240px;
  opacity: 0.22;
  animation: rainFallFar 2.6s steps(12, end) infinite;
}

/* Near layer: slightly longer, softer streaks on a 240 x 320 tile. */
body[data-theme="Rain"]::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='320' shape-rendering='crispEdges' fill='%23a9c4e0'%3E%3Crect x='18' y='40' width='2' height='10'/%3E%3Crect x='84' y='200' width='2' height='10'/%3E%3Crect x='132' y='110' width='2' height='10'/%3E%3Crect x='196' y='24' width='2' height='10'/%3E%3Crect x='60' y='286' width='2' height='8'/%3E%3Crect x='214' y='236' width='2' height='8'/%3E%3C/svg%3E");
  background-size: 240px 320px;
  opacity: 0.3;
  animation: rainFallNear 1.3s steps(16, end) infinite;
}

/* Card overlay: faint scanlines with a cool wash, like a rain-streaked window. */
body[data-theme="Rain"] .phone-frame::before {
  background:
    linear-gradient(180deg, rgba(143, 178, 214, 0.1), rgba(143, 178, 214, 0.02)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 6px);
  opacity: 0.6;
}

body[data-theme="Rain"][data-color-mode="dark"] {
  --shell-top: #0a1018;
  --shell-bottom: #172230;
  --panel-bg: #131b25;
  --pill-bg: rgba(10, 16, 24, 0.6);
  --pill-border: rgba(160, 196, 230, 0.28);
  --frame-border: rgba(160, 196, 230, 0.28);
  --ink: #eaf2fb;
  --ink-soft: rgba(234, 242, 251, 0.84);
  /* Filled buttons: a rain-cloud slate blue rather than the default greyed shell tone. */
  --pill-fill: #2b4157;
  --pill-fill-hover: #35506b;
}

body[data-theme="Rain"][data-color-mode="dark"] .phone-frame::before {
  background:
    linear-gradient(180deg, rgba(10, 16, 24, 0.3), rgba(10, 16, 24, 0.1)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 6px);
  opacity: 0.5;
}

/* Open layout, light mode keeps the night scene (see index.html); Filled buttons
   use the same Rain blue as dark mode. */
body[data-theme="Rain"][data-layout="open"]:not([data-color-mode="dark"]) {
  --pill-fill: #2b4157;
  --pill-fill-hover: #35506b;
}

@keyframes rainFallFar {
  from { background-position: 0 0; }
  to { background-position: 0 240px; }
}

@keyframes rainFallNear {
  from { background-position: 0 0; }
  to { background-position: 0 320px; }
}

/* Still rain for visitors who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
  body[data-theme="Rain"]::before,
  body[data-theme="Rain"]::after {
    animation: none;
  }
}
