/* ── "I miss you when..." cloud page ── */

.mw-main {
  --cloud: #ffffff;
  --cloud-ink: #3a2434;
  --cloud-lead: #a35f7b;
  --cloud-shadow: rgba(163, 95, 123, 0.28);

  position: relative;
  min-height: calc(100vh - 8rem);
  max-width: 100%;
  padding: 2rem 1.25rem 5rem;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

html[data-theme="dark"] .mw-main {
  --cloud: #2e2445;
  --cloud-ink: #f8ecff;
  --cloud-lead: #f1b6ff;
  --cloud-shadow: rgba(10, 5, 20, 0.55);
}

/* ── Soft sky behind everything ── */
.mw-sky-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 15% 12%, rgba(230, 191, 208, 0.38), transparent 70%),
    radial-gradient(ellipse 60% 40% at 85% 30%, rgba(198, 214, 240, 0.35), transparent 70%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(240, 214, 226, 0.4), transparent 70%);
}

html[data-theme="dark"] .mw-sky-bg {
  background:
    radial-gradient(ellipse 70% 45% at 15% 12%, rgba(143, 123, 211, 0.3), transparent 70%),
    radial-gradient(ellipse 60% 40% at 85% 30%, rgba(241, 182, 255, 0.16), transparent 70%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(110, 45, 153, 0.3), transparent 70%);
}

/* ── Intro ── */
/* Soft backdrop keeps the text readable on top of the page background */
.mw-intro {
  text-align: center;
  margin: 0 auto 1.25rem;
  max-width: 40rem;
  padding: 0.9rem 1.5rem 1rem;
  border-radius: 22px;
  background: rgba(255, 253, 251, 0.62);
  backdrop-filter: blur(5px);
}

html[data-theme="dark"] .mw-intro {
  background: rgba(35, 27, 51, 0.6);
}

.mw-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 6vw, 3.1rem);
  line-height: 1.15;
  margin: 0 0 0.35rem;
  color: var(--ink);
}

.mw-subtitle {
  margin: 0;
  font-size: 1rem;
  color: var(--accent);
}

/* ── Editor (bear only) ── */
.mw-editor {
  margin: 0 auto 1rem;
  width: min(34rem, 100%);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.1rem 1.1rem;
  box-shadow: 0 10px 26px rgba(30, 15, 34, 0.08);
}

.mw-form-label {
  display: block;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.mw-input {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  resize: vertical;
}

.mw-input:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
}

.mw-form-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.7rem;
  flex-wrap: wrap;
}

.mw-btn {
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.mw-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.mw-btn-primary {
  border-color: transparent;
  color: #fffdfb;
  background: linear-gradient(135deg, #ff6b9d 0%, #c9446b 60%, #8b1a3a 100%);
  box-shadow: 0 5px 16px rgba(201, 68, 107, 0.32);
}

html[data-theme="dark"] .mw-btn-primary {
  background: linear-gradient(135deg, #d87bff 0%, #a84fcc 60%, #6e2d99 100%);
  box-shadow: 0 5px 16px rgba(168, 79, 204, 0.35);
}

.mw-status {
  text-align: center;
  min-height: 1.5em;
  margin: 0.2rem 0 0.5rem;
  font-size: 0.9rem;
  color: var(--accent);
}

/* ── The sky full of clouds ── */
.mw-sky {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  align-content: center;
  gap: 4.25rem 2.75rem;
  padding: 3rem 0.5rem 2rem;
  min-height: 55vh;
  position: relative;
}

.mw-empty {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--accent);
  text-align: center;
}

/* ── One cloud ── */
.mw-cloud {
  position: relative;
  width: var(--w, 17rem);
  transform: rotate(var(--rot, 0deg)) translateY(var(--dy, 0rem));
  animation: mwFadeIn 0.5s ease both;
  animation-delay: var(--pop, 0s);
}

.mw-cloud-float {
  position: relative;
  filter: drop-shadow(0 12px 24px var(--cloud-shadow));
  animation: mwDrift var(--dur, 7s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes mwDrift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-14px) rotate(0.6deg); }
}

@keyframes mwFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Puffs share the cloud background so they merge into one shape */
.mw-puff {
  position: absolute;
  z-index: 1;
  width: 38%;
  aspect-ratio: 1;
  background: var(--cloud);
  border-radius: 50%;
}

.mw-puff-1 { left: 4%;  top: -13%; width: 36%; }
.mw-puff-2 { left: 27%; top: -30%; width: 48%; }
.mw-puff-3 { right: 2%; top: -10%; width: 34%; }
.mw-puff-4 { left: 38%; bottom: -18%; width: 36%; }
.mw-puff-5 { left: 8%;  bottom: -12%; width: 26%; }

.mw-cloud-inner {
  position: relative;
  z-index: 2;
  background: var(--cloud);
  border-radius: 2.4rem;
  padding: 1.5rem 1.4rem 1.4rem;
  text-align: center;
}

.mw-lead {
  display: block;
  font-family: var(--serif);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--cloud-lead);
  opacity: 0.85;
  margin-bottom: 0.25rem;
}

.mw-text {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--cloud-ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ── Per-cloud edit tools (bear only) ── */
.mw-cloud-tools {
  position: absolute;
  z-index: 3;
  right: 0.1rem;
  bottom: -1.6rem;
  display: flex;
  gap: 0.3rem;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.mw-cloud:hover .mw-cloud-tools,
.mw-cloud:focus-within .mw-cloud-tools {
  opacity: 1;
}

.mw-tool {
  font-family: var(--sans);
  font-size: 0.8rem;
  line-height: 1;
  width: 1.9rem;
  height: 1.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--ink);
  cursor: pointer;
}

.mw-tool:hover {
  color: var(--accent);
  transform: scale(1.1);
}

.mw-cloud.is-editing .mw-cloud-inner {
  outline: 2px dashed var(--accent-soft);
  outline-offset: 4px;
}

/* ── Touch devices: always show tools ── */
@media (hover: none) {
  .mw-cloud-tools { opacity: 1; }
}

/* ── Small screens ── */
@media (max-width: 560px) {
  .mw-sky {
    gap: 3.5rem 1.5rem;
    padding-top: 2.5rem;
  }
  .mw-cloud {
    width: min(var(--w, 17rem), 100%);
    transform: rotate(calc(var(--rot, 0deg) * 0.4)) translateY(0);
  }
  .mw-text { font-size: 1.05rem; }
}

/* ── Respect reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .mw-cloud,
  .mw-cloud-float {
    animation: none;
  }
}
