/* ============================================
   HigherFrequency — Style
   Dark, minimal, premium spiritual aesthetic
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0a0a0a;
  color: #e8e8e8;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Slow-moving background gradient (landing page) --- */
@keyframes bgShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Film grain texture overlay --- */
@keyframes grainShift {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -2%); }
  75% { transform: translate(-1%, 2%); }
}

body::after {
  content: '';
  position: fixed;
  inset: -5%;
  width: 110%;
  height: 110%;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  animation: grainShift 6s ease-in-out infinite;
}

/* --- Landing Page --- */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  transition: opacity 0.5s ease;
  background: linear-gradient(135deg, #0a0a0a 0%, #0f1218 25%, #0a0a0a 50%, #100d14 75%, #0a0a0a 100%);
  background-size: 400% 400%;
  animation: bgShift 20s ease infinite;
}

/* --- Site Header --- */
.site-header {
  text-align: center;
  margin-bottom: 4rem;
}

.site-title {
  font-size: clamp(1.4rem, 5vw, 3.5rem);
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffffff;
  margin-bottom: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

.site-logo {
  width: 0.7em;
  height: 0.9em;
  opacity: 0.85;
  flex-shrink: 0;
}

.site-tagline {
  font-size: clamp(0.75rem, 2vw, 0.9rem);
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.35);
  max-width: 28rem;
  margin: 0 auto;
}

/* --- Mood Grid --- */
.mood-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
  max-width: 64rem;
}

@media (min-width: 600px) {
  .mood-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

@media (min-width: 960px) {
  .mood-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

/* --- Mood Card --- */
.mood-card {
  display: block;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  text-align: left;
  outline: none;
}

.mood-card__inner {
  position: relative;
  padding: 2.5rem 2rem;
  border-radius: 1rem;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  min-height: 10rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.mood-card:hover .mood-card__inner,
.mood-card:focus-visible .mood-card__inner {
  transform: translateY(-4px) scale(1.02);
}

.mood-card__name {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #ffffff;
  margin-bottom: 0.4rem;
}

.mood-card__desc {
  font-size: 0.85rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.02em;
  line-height: 1.5;
}

/* --- Card Gradients & Hover Glows --- */
.mood-card--calm {
  background: linear-gradient(135deg, #1a3a4a 0%, #0d4f5e 50%, #1a6b7a 100%);
}
.mood-card:hover .mood-card--calm,
.mood-card:focus-visible .mood-card--calm {
  box-shadow: 0 8px 40px rgba(26, 107, 122, 0.35), 0 0 0 1px rgba(26, 107, 122, 0.15);
}

.mood-card--playful {
  background: linear-gradient(135deg, #6b2a5e 0%, #c44a6c 50%, #e07850 100%);
}
.mood-card:hover .mood-card--playful,
.mood-card:focus-visible .mood-card--playful {
  box-shadow: 0 8px 40px rgba(196, 74, 108, 0.35), 0 0 0 1px rgba(196, 74, 108, 0.15);
}

.mood-card--bold {
  background: linear-gradient(135deg, #2a0a0a 0%, #6b1a1a 50%, #a02020 100%);
}
.mood-card:hover .mood-card--bold,
.mood-card:focus-visible .mood-card--bold {
  box-shadow: 0 8px 40px rgba(160, 32, 32, 0.35), 0 0 0 1px rgba(160, 32, 32, 0.15);
}

.mood-card--cosmic {
  background: linear-gradient(135deg, #0d0a2e 0%, #2a1a5e 50%, #1a3a8a 100%);
}
.mood-card:hover .mood-card--cosmic,
.mood-card:focus-visible .mood-card--cosmic {
  box-shadow: 0 8px 40px rgba(42, 26, 94, 0.45), 0 0 0 1px rgba(42, 26, 94, 0.15);
}

.mood-card--joyful {
  background: linear-gradient(135deg, #5e3a0a 0%, #c48a20 50%, #e0a830 100%);
}
.mood-card:hover .mood-card--joyful,
.mood-card:focus-visible .mood-card--joyful {
  box-shadow: 0 8px 40px rgba(196, 138, 32, 0.35), 0 0 0 1px rgba(196, 138, 32, 0.15);
}

.mood-card--expansive {
  background: linear-gradient(135deg, #1a3a5a 0%, #4a8ab0 50%, #b0d8f0 100%);
}
.mood-card:hover .mood-card--expansive,
.mood-card:focus-visible .mood-card--expansive {
  box-shadow: 0 8px 40px rgba(74, 138, 176, 0.35), 0 0 0 1px rgba(74, 138, 176, 0.15);
}

/* --- Quote Overlay --- */
.quote-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.quote-overlay.is-active {
  opacity: 1;
  pointer-events: all;
}

.quote-overlay[aria-hidden="true"] {
  visibility: hidden;
}

.quote-overlay[aria-hidden="false"] {
  visibility: visible;
}

.quote-overlay__bg {
  position: absolute;
  inset: 0;
  background: #0a0a0a;
  z-index: -1;
  background-size: 300% 300%;
  animation: bgShift 60s ease infinite;
}

/* Quote overlay watermark */
.quote-overlay__watermark {
  position: absolute;
  top: 1.5rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.25);
  font-weight: 300;
  z-index: 2;
}

/* Dark overlay for text readability on gradient/image backgrounds */
.quote-overlay__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.quote-overlay__content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem 1.5rem;
  max-width: 48rem;
  width: 100%;
}

/* --- Quote Text --- */
.quote-text {
  font-size: clamp(1.25rem, 4vw, 2.25rem);
  font-weight: 300;
  line-height: 1.6;
  color: #ffffff;
  letter-spacing: 0.01em;
  margin-bottom: 1.5rem;
  quotes: none;
}

.quote-text::before {
  content: '\201C';
  display: block;
  font-size: 3rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.2);
  margin-bottom: 0.5rem;
}

.quote-author {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  font-style: normal;
  margin-bottom: 3rem;
}

.quote-author::before {
  content: '\2014\00a0';
}

/* --- Buttons --- */
.quote-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 100px;
  padding: 0.85rem 2rem;
  transition: all 0.25s ease;
  outline: none;
}

.btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.btn--primary {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn--primary:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn--secondary {
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn--secondary:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.btn--icon {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.7rem;
  border-radius: 50%;
  width: 2.75rem;
  height: 2.75rem;
}

.btn--icon:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.quote-share {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* --- Mood-specific overlay backgrounds --- */
.quote-overlay__bg.mood-calm {
  background: linear-gradient(135deg, #0d2a35 0%, #0a3d4d 50%, #1a5a6a 100%);
}

.quote-overlay__bg.mood-playful {
  background: linear-gradient(135deg, #4a1a3e 0%, #a03858 50%, #c06040 100%);
}

.quote-overlay__bg.mood-bold {
  background: linear-gradient(135deg, #1a0505 0%, #4a0e0e 50%, #7a1818 100%);
}

.quote-overlay__bg.mood-cosmic {
  background: linear-gradient(135deg, #08061e 0%, #1e1248 50%, #142a6a 100%);
}

.quote-overlay__bg.mood-joyful {
  background: linear-gradient(135deg, #3a2505 0%, #8a5a12 50%, #b08020 100%);
}

.quote-overlay__bg.mood-expansive {
  background: linear-gradient(135deg, #0e2a42 0%, #3a6a8a 50%, #80b8d8 100%);
}

/* --- Vignette overlay for premium feel --- */
.landing::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.4) 100%);
  z-index: 0;
}

.landing > * {
  position: relative;
  z-index: 1;
}

/* --- Small screen refinements (<480px) --- */
@media (max-width: 479px) {
  .landing {
    padding: 2rem 1rem;
    justify-content: flex-start;
    padding-top: 3rem;
  }

  .site-header {
    margin-bottom: 2.5rem;
  }

  .mood-card__inner {
    padding: 2rem 1.5rem;
    min-height: 8rem;
  }

  .quote-overlay__content {
    padding: 1.5rem 1rem;
  }

  .quote-actions {
    flex-wrap: wrap;
  }

  .quote-actions .btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  .quote-author {
    margin-bottom: 2rem;
  }
}

/* --- Story Export (offscreen for html2canvas) --- */
.story-export {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1080px;
  height: 1920px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px;
}
.story-export__text {
  font-size: 64px;
  font-weight: 300;
  line-height: 1.5;
  color: #fff;
}
.story-export__author {
  font-size: 28px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-top: 40px;
}
.story-export__watermark {
  position: absolute;
  bottom: 40px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 18px;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.3);
  font-weight: 300;
}

/* --- Daily Alignment --- */
.daily-alignment {
  text-align: center;
  margin-top: 3rem;
}
.daily-alignment__btn {
  font-size: 1rem;
  padding: 1rem 2.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
}
.daily-alignment__btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.daily-alignment__desc {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.1em;
}

/* --- Card Zoom Transition --- */
.card-zoom-overlay {
  position: fixed;
  z-index: 99;
  border-radius: 1rem;
  pointer-events: none;
}

/* --- Last-used mood card indicator --- */
@keyframes lastMoodPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
  50% { box-shadow: 0 0 20px 2px rgba(255, 255, 255, 0.08); }
}

.mood-card--last .mood-card__inner {
  animation: lastMoodPulse 3s ease-in-out infinite;
}

/* --- Calibrating Overlay --- */
.calibrating-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.calibrating-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}
@keyframes calibratePulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.8); opacity: 0.08; }
}
.calibrating-pulse {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: calibratePulse 2s ease-in-out infinite;
  margin-bottom: 2rem;
}
.calibrating-text {
  font-size: 0.85rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

/* --- Footer --- */
.site-footer {
  text-align: center;
  padding: 2rem 1rem 1rem;
  position: relative;
  z-index: 2;
  margin-top: auto;
  width: 100%;
}
.footer-link {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.2);
  text-decoration: none;
  transition: color 0.2s ease;
}
.footer-link:hover {
  color: rgba(255, 255, 255, 0.5);
}

/* --- Favorites Link --- */
.favorites-link {
  text-align: center;
  margin-top: 2rem;
}

/* --- Favorites Overlay --- */
.favorites-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  overflow-y: auto;
}
.favorites-overlay.is-active {
  opacity: 1;
  pointer-events: all;
}
.favorites-overlay[aria-hidden="true"] { visibility: hidden; }
.favorites-overlay[aria-hidden="false"] { visibility: visible; }
.favorites-overlay__bg {
  position: fixed;
  inset: 0;
  background: #0a0a0a;
  z-index: -1;
}
.favorites-overlay__content {
  position: relative;
  z-index: 1;
  max-width: 48rem;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.favorites-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.favorites-title {
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
}
.btn--sm {
  padding: 0.5rem 1.25rem;
  font-size: 0.75rem;
}
.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.favorite-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem;
  padding: 1.5rem;
  position: relative;
}
.favorite-card__text {
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  quotes: none;
  margin-bottom: 0.75rem;
}
.favorite-card__author {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  font-style: normal;
}
.favorite-card__mood {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
