/* Good Night — shared design system.
   Mirrors apps/ios/goodnaight/DesignSystem/ 1:1. */

:root {
  /* Background — from AppBackground.swift */
  --bg-top: #0D1224;        /* rgb(0.05, 0.07, 0.14) */
  --bg-bottom: #050811;     /* rgb(0.02, 0.03, 0.07) */

  /* Text — from AppColors.swift */
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.8);
  --text-tertiary: rgba(255, 255, 255, 0.6);
  --text-quaternary: rgba(255, 255, 255, 0.4);

  /* Surfaces */
  --card-bg: rgba(255, 255, 255, 0.1);
  --card-bg-hover: rgba(255, 255, 255, 0.15);
  --card-border: rgba(255, 255, 255, 0.1);
  --divider: rgba(255, 255, 255, 0.06);

  /* Accents — from AppColors.swift */
  --accent: #6EBAFF;        /* rgb(0.43, 0.73, 1.0) — soft sky-blue */
  --favorite: #F28C99;      /* rgb(0.95, 0.55, 0.6) — dusty rose */
  --highlight: #FFCC66;     /* rgb(1.0, 0.8, 0.4) — moon/amber */
  --moon-top: #FFEDB3;      /* rgb(1.0, 0.93, 0.7) */

  --ease-press: cubic-bezier(0.32, 0.72, 0.48, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100vh; }

body {
  font-family: 'Avenir Next', 'Avenir', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  background-attachment: fixed;
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.82; }

/* ===== Atmosphere (ambient particles + moon) ===== */

.sky {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
}
.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  opacity: var(--base-opacity);
  animation: twinkle var(--duration) ease-in-out infinite alternate;
}
/* Per-star "breathing" — each star fades between its own base opacity and
   base + breath. Keeps the sky alive without the harsh flicker of everyone
   sharing 0.1→0.5. Staggered via negative animation-delay so stars don't
   all hit peak brightness at the same moment. */
@keyframes twinkle {
  from { opacity: var(--base-opacity); }
  to   { opacity: calc(var(--base-opacity) + var(--breath)); }
}

.moon {
  position: fixed; top: 44px; right: 8%;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--moon-top), var(--highlight));
  box-shadow:
    0 0 32px rgba(255, 204, 102, 0.35),
    0 0 72px rgba(255, 204, 102, 0.12);
  z-index: 0;
  opacity: 0.55;
  animation: moonFloat 3.2s ease-in-out infinite alternate;
}
@keyframes moonFloat {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

.content { position: relative; z-index: 1; }

/* ===== Cards ===== */

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 28px;
  transition: transform 0.3s, background 0.3s, box-shadow 0.3s;
}
.card-hover:hover,
a.card:hover {
  background: var(--card-bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  opacity: 1;
}

/* ===== Buttons ===== */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #081018;
  padding: 14px 28px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 16px;
  transition: transform 0.2s var(--ease-press), opacity 0.2s;
}
.btn-primary:hover { opacity: 0.92; }
.btn-primary:active { transform: scale(0.97); opacity: 0.88; }

/* ===== Link-in-bio tiles ===== */

.link-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 20px 22px;
  color: var(--text-primary);
  transition: transform 0.25s var(--ease-press), background 0.25s, box-shadow 0.25s;
}
.link-tile:hover {
  background: var(--card-bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(0,0,0,0.3);
  opacity: 1;
}
.link-tile:active { transform: scale(0.97); }
.link-tile-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  font-size: 22px;
  flex-shrink: 0;
}
.link-tile-text { flex: 1; min-width: 0; }
.link-tile-text h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.link-tile-text p {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.4;
}
.link-tile-arrow {
  color: var(--text-tertiary);
  font-size: 18px;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-press);
}
.link-tile:hover .link-tile-arrow { transform: translateX(2px); }

/* ===== Back link (used on sub-pages) ===== */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 32px;
}

/* ===== Text defaults ===== */

h1, h2, h3 { color: var(--text-primary); font-weight: 700; }

/* ===== Container ===== */

.container-narrow {
  max-width: 700px;
  margin: 0 auto;
  padding: 56px 24px;
}

/* ===== Responsive ===== */

@media (max-width: 600px) {
  .moon {
    width: 44px; height: 44px;
    top: 24px; right: 6%;
  }
  .container-narrow { padding: 36px 20px; }
}
