/* --- Reset & Variables --- */

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

:root {
  --bg:           #000000;
  --text:         #c9c5d3;
  --accent:       #87848b;
  --accent-bright:#dfd7e9;
  --muted:        #666669;
  --glow:         rgba(144, 135, 145, 0.07);
}

[hidden] { display: none !important; }

* { font-variant-emoji: text; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Spectral', Georgia, serif;
  min-height: 100vh;
  overflow-x: hidden;
}


/* --- Tab Nav --- */

#tab-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.25rem 2rem;
}

.tab {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: color 0.2s;
  display: flex;
  align-items: center;
}

.tab-icon {
  width: 2rem;
  height: 2rem;
}

.tab:hover,
.tab.active {
  color: var(--accent-bright);
}

a.tab {
  text-decoration: none;
}


/* --- Star Canvas --- */

#stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}


/* --- Layout --- */

main {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 4rem 2rem 8rem;
  display: flex;
  flex-direction: column;
  gap: 5rem;
}


/* --- Header --- */

header {
  text-align: center;
  padding-top: 2rem;
}

header h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 4rem;
  font-weight: 600;
  letter-spacing: 0.5em;
  color: var(--accent-bright);
  text-shadow: 0 0 60px rgba(196, 168, 232, 0.25);
  margin-bottom: 0.75rem;
}

.alias {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  letter-spacing: 0.35em;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.tagline {
  font-style: italic;
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: 0.08em;
}


/* --- Exodus Animation --- */

.exodus-anim {
  display: block;
  margin: 0 auto;
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
}


/* --- Hymns --- */

.hymn {
  text-align: center;
}

.hymn p {
  font-style: italic;
  font-size: 1.05rem;
  line-height: 2;
  color: var(--text);
  opacity: 0.65;
}


/* --- Ephemeris Widget --- */


.eph-tab-widget {
  display: flex;
  margin-left: auto;
}


.eph-widget {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

#eph-data {
  padding: 1rem 1rem;
  min-width: 200px;
}

.moon-widget {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.moon-phase-glyph {
  font-size: 1.5rem;
  line-height: 1;
}

.moon-details {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.moon-phase-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--text);
}

.moon-sign {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--accent);
}


/* --- Music Player --- */

.player {
  border-top: 1px solid rgba(155, 138, 184, 0.1);
  padding-top: 2rem;
}

.player-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.25rem;
}

.track-title {
  font-style: italic;
  color: var(--text);
  font-size: 0.95rem;
}

.track-artist {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#play-btn {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  font-size: 0.65rem;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

#play-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

.progress-bar {
  flex: 1;
  height: 1px;
  background: var(--muted);
  cursor: pointer;
  position: relative;
}

.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--accent);
}


/* --- Invocation & Revoir --- */

.revoir {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  align-self: center;
}

.revoir .invocation {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  text-align: center;
  text-wrap: balance;
}

.revoir p {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
  opacity: 0.75;
}


/* --- Footer --- */

footer {
  text-align: center;
  color: var(--muted);
  font-size: 1.4rem;
  padding-bottom: 2rem;
}


/* --- Chat Page --- */

main[data-page="chat"] {
  max-width: 640px;
  padding-top: 5rem;
  padding-bottom: 1.5rem;
  padding-left: 2rem;
  padding-right: 2rem;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.chat-name-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  margin-top: auto;
  margin-bottom: auto;
}

.chat-prompt-label {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.1rem;
  letter-spacing: 0.3em;
  color: var(--muted);
}

#chat-name-form input {
  background: none;
  border: none;
  border-bottom: 1px solid var(--muted);
  color: var(--accent-bright);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  text-align: center;
  padding: 0.25rem 0;
  width: 200px;
}

#chat-name-form button {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

#chat-name-form button:hover {
  background: var(--accent);
  color: var(--bg);
}

#chat-name-form input:focus {
  outline: none;
  border-bottom-color: var(--accent-bright);
}

.chat-room {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

.chat-date-separator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0.25rem 0;
}

.chat-date-separator::before,
.chat-date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(135, 132, 139, 0.2);
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.chat-meta {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.chat-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  color: var(--accent-bright);
}

.chat-time {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-family: 'Cormorant Garamond', serif;
}

.chat-body {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text);
  opacity: 0.85;
  word-break: break-word;
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-top: 1px solid rgba(135, 132, 139, 0.2);
  padding-top: 1rem;
  padding-bottom: 0.5rem;
}

#chat-input {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 1px solid var(--muted);
  color: var(--accent-bright);
  font-family: 'Spectral', serif;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  padding: 0.25rem 0;
}

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

.chat-send {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.chat-send:hover {
  background: var(--accent);
  color: var(--bg);
}


/* --- Mobile --- */

@media (max-width: 600px) {
  #tab-bar {
    gap: 1rem;
    padding: 1rem 1.25rem;
    flex-wrap: nowrap;
  }

  .eph-tab-widget {
    margin-left: auto;
    flex-shrink: 0;
  }

  .moon-details {
    display: flex;
  }

  .moon-phase-name,
  .moon-sign {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
  }

  #eph-data {
    min-width: unset;
    padding: 0;
  }


  header h1 {
    font-size: 2.4rem;
    letter-spacing: 0.2em;
  }

  .alias {
    font-size: 1.15rem;
    letter-spacing: 0.2em;
  }

  .hymn {
    text-wrap: balance;
  }

  .revoir {
    text-wrap: balance;
    align-items: center;
  }

  .revoir .invocation {
    text-align: center;
    text-wrap: balance;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
  }


  main {
    padding: 3.5rem 1.25rem 6rem;
    gap: 3rem;
  }

  main[data-page="chat"] {
    height: 100dvh;
    padding-top: 4rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  main[data-page="ephemeris"] {
    padding-top: 4rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .eph-name {
    font-size: 0.78rem;
  }

  .eph-glyph {
    font-size: 0.9rem;
  }

  .eph-phase {
    font-size: 0.65rem;
    padding-left: 1.5rem;
  }

  .eph-phase-glyph {
    font-size: 0.78rem;
  }

  .eph-phase-name {
    font-size: 0.65rem;
  }

  .eph-sign {
    font-size: 0.75rem;
  }

  .eph-orb {
    font-size: 0.72rem;
  }
}


/* --- Ephemeris Page --- */

main[data-page="ephemeris"] {
  gap: 0;
  min-height: 100vh;
  padding-top: 5rem;
  padding-bottom: 4rem;
  justify-content: center;
}

.eph-list {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.eph-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(135, 132, 139, 0.25);
  font-family: 'Cormorant Garamond', serif;
}

.eph-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.eph-left {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.eph-glyph {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-bright);
  width: 1.5rem;
  text-align: center;
  font-family: 'Cormorant Garamond', 'Noto Sans Symbols 2', serif;
}

.eph-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.1em;
}

.eph-phase {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
  padding-left: 1.9rem;
}

.eph-phase-glyph  { font-size: 1.1rem; font-weight: 700; }
.eph-phase-name   { color: var(--accent); letter-spacing: 0.05em; font-size: 0.95rem; font-weight: 700; }
.eph-phase-angle  { color: var(--muted); }
.eph-waxwane      { font-style: italic; }

.eph-right {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-shrink: 0;
}

.eph-sign {
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.eph-orb {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 400;
}

.eph-retro {
  color: var(--accent);
  font-size: 0.75rem;
  margin-left: 0.1rem;
}
