/* =====================================================
   Daily Gratitude — stylesheet
   Light: white sky with drifting clouds.
   Dark: near-black night with fireflies.
   ===================================================== */

:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: rgba(17, 17, 17, 0.55);
  --accent: #0ea5e9;
  --border: rgba(17, 17, 17, 0.18);
  --card-bg: rgba(255, 255, 255, 0.72);
  --error: #dc2626;
}

body.dark {
  --bg: #0a0a0a;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.55);
  --accent: #0ea5e9;
  --border: rgba(255, 255, 255, 0.22);
  --card-bg: rgba(10, 10, 10, 0.55);
  --error: #f87171;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.6s ease, color 0.6s ease;
}

/* ---------- Canvas backdrop ---------- */

#canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Layout ---------- */

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 600px;
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.title {
  font-weight: 900;
  letter-spacing: -1px;
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  line-height: 1.1;
}

.tagline {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: clamp(1.15rem, 3.5vw, 1.5rem);
  color: var(--muted);
  margin-top: 10px;
  transition: color 0.6s ease;
}

.rule {
  width: 56px;
  height: 2px;
  background: var(--accent);
  margin-top: 26px;
}

/* ---------- Prompt card ---------- */

.prompt-card {
  width: 100%;
  max-width: 600px;
  padding: 40px;
  margin-top: 34px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: background-color 0.6s ease, border-color 0.6s ease;
}

.prompt-text {
  font-size: clamp(1.25rem, 4.2vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.2px;
  line-height: 1.6;
}

.prompt-meta {
  margin-top: 22px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.6s ease;
}

/* ---------- Buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.btn,
.btn-submit {
  appearance: none;
  border-radius: 0;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 24px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease,
    opacity 0.2s ease, background-color 0.2s ease;
}

.btn:hover:not(:disabled),
.btn-submit:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn:active:not(:disabled),
.btn-submit:active:not(:disabled) {
  opacity: 0.7;
}

.btn:disabled,
.btn-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.copied {
  border-color: var(--accent);
  color: var(--accent);
}

.btn:focus-visible,
.btn-submit:focus-visible,
.toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Email signup ---------- */

.email-section {
  margin-top: 52px;
  width: 100%;
  max-width: 420px;
}

.email-label {
  font-size: 0.9rem;
  color: var(--muted);
  transition: color 0.6s ease;
}

.email-form {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

#email-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  padding: 10px 2px;
  transition: border-color 0.2s ease, color 0.6s ease;
}

#email-input::placeholder {
  color: var(--muted);
}

#email-input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.email-status {
  margin-top: 12px;
  font-size: 0.85rem;
  min-height: 1.4em; /* reserve space so messages don't shift the layout */
  color: var(--accent);
}

.email-status.error {
  color: var(--error);
}

/* ---------- Dark mode toggle ---------- */

.toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.6s ease, color 0.6s ease,
    border-color 0.2s ease;
}

.toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
  .container {
    padding: 32px 20px;
  }

  .prompt-card {
    padding: 28px 22px;
  }

  .actions {
    flex-direction: column;
    width: 100%;
  }

  .actions .btn {
    width: 100%;
    padding: 14px;
  }

  .email-form {
    flex-direction: column;
    gap: 18px;
  }

  .btn-submit {
    width: 100%;
    padding: 14px;
  }

  .toggle {
    right: 16px;
    bottom: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
