/* Namora Alpha — Website 2.0 design validation */

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

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

.namora-body {
  font-family: "DM Sans", system-ui, sans-serif;
  color: #4a5568;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* World layer — recedes, never dominates */
.namora-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: #e8eef8;
  background-image: url("assets/backgrounds/namora-bg-mobile.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  animation: namora-breathe 14s ease-in-out infinite;
}

.namora-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    165deg,
    rgba(232, 238, 248, 0.55) 0%,
    rgba(237, 230, 245, 0.45) 50%,
    rgba(228, 236, 250, 0.5) 100%
  );
  pointer-events: none;
}

@keyframes namora-breathe {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.025); }
}

/* Sparse CSS particles — life from runtime, not background */
.namora-particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.namora-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(180, 198, 230, 0.35);
  animation: namora-drift 18s ease-in-out infinite;
}

.namora-particle:nth-child(1) { left: 12%; top: 22%; animation-delay: 0s; animation-duration: 20s; }
.namora-particle:nth-child(2) { left: 78%; top: 18%; animation-delay: -4s; animation-duration: 22s; }
.namora-particle:nth-child(3) { left: 45%; top: 65%; animation-delay: -8s; animation-duration: 19s; }
.namora-particle:nth-child(4) { left: 88%; top: 72%; animation-delay: -2s; animation-duration: 24s; }
.namora-particle:nth-child(5) { left: 24%; top: 80%; animation-delay: -6s; animation-duration: 21s; }
.namora-particle:nth-child(6) { left: 62%; top: 38%; animation-delay: -10s; animation-duration: 23s; }

@keyframes namora-drift {
  0%, 100% { transform: translate(0, 0); opacity: 0.2; }
  50% { transform: translate(6px, -10px); opacity: 0.45; }
}

.namora-page {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

/* Subtle sea-tone overlay — unifies page without dimming background */
.namora-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    175deg,
    rgba(168, 205, 220, 0.07) 0%,
    rgba(155, 195, 215, 0.11) 45%,
    rgba(170, 210, 228, 0.08) 100%
  );
}

/* Header */
.namora-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0 1.25rem;
  flex-shrink: 0;
}

.namora-logo {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #64748b;
  text-decoration: none;
}

.namora-logo:hover {
  color: #475569;
}

.namora-memory {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(100, 116, 139, 0.55);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.35);
}

/* Scene — dialogue zone anchored lower on page */
.namora-scene {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  min-height: 0;
  padding-top: 2.5rem;
}

/* Stage: unified scene — NANA + dialogue */
.namora-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 0;
  padding: 0 0 1.25rem;
}

.namora-stage {
  width: 100%;
  max-width: 680px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto;
  align-items: end;
  gap: 0.15rem 0.35rem;
  margin-bottom: 1.75rem;
}

.namora-chat {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  justify-self: end;
  padding-bottom: 1.25rem;
}

.namora-messages {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: min(42vh, 360px);
  overflow-y: auto;
  padding: 0.25rem 0.5rem 0.25rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.namora-msg {
  max-width: 100%;
  padding: 0.7rem 0.95rem;
  border-radius: 1.15rem;
  font-size: 0.9rem;
  line-height: 1.55;
  animation: namora-msg-in 0.35s ease-out;
}

@keyframes namora-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.namora-msg--nana {
  position: relative;
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(186, 200, 224, 0.45);
  color: #475569;
  box-shadow: 0 2px 10px rgba(148, 163, 184, 0.1);
  border-radius: 1.15rem 1.15rem 0.45rem 1.15rem;
  margin-right: 0.15rem;
}

.namora-msg--nana::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: 14px;
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid rgba(186, 200, 224, 0.45);
  border-bottom: 1px solid rgba(186, 200, 224, 0.45);
  transform: rotate(-45deg);
  border-radius: 0 0 2px 0;
}

.namora-msg--nana p + p {
  margin-top: 0.35rem;
}

.namora-msg--user p + p {
  margin-top: 0.35rem;
}

.namora-msg--user {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(186, 200, 224, 0.35);
  color: #334155;
}

/* NANA — natural presence in scene */
.namora-nana {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  flex-shrink: 0;
  width: clamp(96px, 24vw, 132px);
  margin: 0;
}

.namora-nana img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  animation: namora-float 7s ease-in-out infinite;
}

@keyframes namora-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* Compose row — input and shell as separate world objects */
.namora-compose {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

.namora-input-wrap {
  flex: 1;
  min-width: 0;
}

.namora-input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  font-family: inherit;
  font-size: 0.9375rem;
  color: #475569;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(186, 200, 224, 0.5);
  border-radius: 999px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.namora-input::placeholder {
  color: rgba(100, 116, 139, 0.55);
}

.namora-input:focus {
  border-color: rgba(148, 163, 184, 0.65);
  box-shadow: 0 0 0 3px rgba(186, 200, 224, 0.25);
}

.namora-send {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: transform 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.namora-send img {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: contain;
  pointer-events: none;
}

.namora-send:active {
  transform: scale(0.95);
}

.namora-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (min-width: 640px) {
  .namora-page {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .namora-bg {
    background-image: url("assets/backgrounds/namora-bg-desktop.webp");
  }

  .namora-scene {
    padding-top: 3rem;
  }

  .namora-main {
    padding-bottom: 1.5rem;
  }

  .namora-stage {
    max-width: 700px;
    gap: 0.1rem 0.5rem;
    margin-bottom: 2rem;
  }

  .namora-chat {
    padding-bottom: 1.75rem;
  }

  .namora-messages {
    max-height: min(46vh, 400px);
  }

  .namora-msg {
    font-size: 0.9375rem;
    padding: 0.75rem 1rem;
  }

  .namora-nana {
    width: clamp(140px, 17vw, 176px);
  }

  .namora-compose {
    max-width: 660px;
  }
}
