/* diary.css */

body {
  margin: 0;
  font-family: 'Georgia', serif;
  background: radial-gradient(#000015, #000);
  color: #f0f0f0;
  overflow-x: hidden;
  position: relative;
}

canvas#stars {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
}

.diary-container {
  max-width: 800px;
  margin: 100px auto 60px;
  padding: 0 20px;
}

h1 {
  text-align: center;
  font-size: 2.5em;
  color: #f9d6f7;
  margin-bottom: 10px;
}

.diary-intro {
  text-align: center;
  font-size: 1.2em;
  color: #ccccff;
  margin-bottom: 40px;
}

.filter-panel {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

button.tag {
  background-color: transparent;
  border: 1px solid #aaaaff;
  border-radius: 999px;
  color: #aaaaff;
  padding: 6px 14px;
  font-size: 0.9em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

button.tag:hover {
  background-color: #aaaaff22;
}

/* --- Top-left quick navigation --- */
.quick-nav {
  position: fixed;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  z-index: 21; /* above the page overlay; sync badge is 20 */

  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(17, 17, 34, 0.42);
  border: 1px solid rgba(170, 170, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0 0 2px rgba(170, 170, 255, 0.06);
}

/* Make anchor/spans look like the tag pills */
a.tag,
span.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(170, 170, 255, 0.08);
  border: 1px solid rgba(170, 170, 255, 0.55);
  border-radius: 999px;
  color: #aaaaff;
  padding: 6px 14px;
  font-size: 0.9em;
  line-height: 1;
  text-decoration: none;
  user-select: none;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

a.tag:hover {
  background-color: rgba(170, 170, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.55);
}

a.tag:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

/* Current page pill */
.quick-nav span.tag[aria-current="page"] {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.10);
  color: #f2f2ff;
}

@media (max-width: 520px) {
  .quick-nav {
    top: 12px;
    left: 12px;
    gap: 8px;
  }

  a.tag,
  span.tag {
    padding: 6px 12px;
    font-size: 0.85em;
  }
}

/* Selected tag state */
button.tag.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.10);
}

button.tag.active:hover {
  background: rgba(255, 255, 255, 0.16);
}

button.tag:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

.diary-entries {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.entry {
  background-color: #ffffff0a;
  border-left: 4px solid #f6c;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px #f6c2;
  transition: transform 0.2s;
}

.entry:hover {
  transform: translateY(-3px);
}

.entry h2 {
  margin-top: 0;
  color: #ffddee;
  font-size: 1.1em;
}

.entry-title {
  font-size: 0.85em;
  opacity: 0.85;
  margin-left: 8px;
}

.entry p {
  line-height: 1.6;
  font-size: 1em;
  color: #eee;
  white-space: pre-wrap;
}

/* --- Sync badge (top-right) --- */
.sync-badge {
  position: fixed;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.9em;
  line-height: 1;
  z-index: 20;
  user-select: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sync-badge__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.10);
}

.sync-badge__icon {
  font-size: 1.05em;
  opacity: 0.95;
}

.sync-badge__text {
  opacity: 0.95;
}

/* Theme: cute (default) */
.sync-badge--cute {
  background: rgba(170, 170, 255, 0.18);
  border: 1px solid rgba(170, 170, 255, 0.55);
  color: #e9e9ff;
}

/* Theme: pro */
.sync-badge--pro {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #f2f2ff;
}

/* State colors */
.sync-badge.is-syncing .sync-badge__dot {
  background: rgba(255, 255, 255, 0.65);
  animation: syncPulse 1.9s ease-in-out infinite;
}

.sync-badge.is-syncing .sync-badge__icon {
  animation: bearBob 2.2s ease-in-out infinite;
}

.sync-badge.is-ok .sync-badge__dot {
  background: rgba(120, 255, 190, 0.85);
  animation: okPop 260ms ease-out 1;
}

.sync-badge.is-warn .sync-badge__dot {
  background: rgba(255, 220, 120, 0.9);
}

.sync-badge.is-error .sync-badge__dot {
  background: rgba(255, 120, 150, 0.9);
}

@keyframes syncPulse {
  0%   { transform: scale(1.0);   box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.10); }
  50%  { transform: scale(1.18);  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.08); }
  100% { transform: scale(1.0);   box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.10); }
}

@keyframes bearBob {
  0%   { transform: translateY(0px);  opacity: 0.92; }
  50%  { transform: translateY(-1px); opacity: 1.0; }
  100% { transform: translateY(0px);  opacity: 0.92; }
}

@keyframes okPop {
  0% { transform: scale(0.9); }
  70% { transform: scale(1.25); }
  100% { transform: scale(1.0); }
}

/* Small screens */
@media (max-width: 520px) {
  .sync-badge {
    top: 12px;
    right: 12px;
    padding: 7px 10px;
    font-size: 0.85em;
  }
}

/* --- Holiday easter egg button (Gale Day: cute bear meteor) --- */
.holiday-egg {
  margin: 14px 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.holiday-caption {
  font-size: 0.92em;
  opacity: 0.92;
  color: #e9e9ff;
  text-align: center;
}

.star-button {
  --bg-color: rgba(17, 17, 34, 0.88);
  --border-color: rgba(170, 170, 255, 0.55);
  --glow-color: rgba(170, 170, 255, 0.65);
  --star-color: rgba(255, 255, 255, 0.92);

  position: relative;
  height: 44px;
  padding: 0 18px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: #f2f2ff;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.star-button__label {
  font-size: 0.95em;
  letter-spacing: 0.4px;
  position: relative;
  z-index: 1;
}

.star-button:active {
  transform: scale(0.97);
}

.star-button:hover {
  border-color: rgba(255, 255, 255, 0.55);
}

/* center glow */
.star-button .glow {
  position: absolute;
  width: 40px;
  height: 40px;
  background: var(--glow-color);
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0;
  transition: opacity 0.45s ease, transform 0.45s ease;
  z-index: 0;
}

.star-button:hover .glow {
  opacity: 1;
  transform: scale(2.1);
}

/* meteors */
.star-button .star {
  position: absolute;
  background: linear-gradient(45deg, transparent, var(--star-color));
  width: 44px;
  height: 2px;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.star-button:hover .star {
  animation: gather 0.85s ease-in forwards;
}

@keyframes gather {
  0% {
    opacity: 0;
    transform: translate(var(--startX), var(--startY)) rotate(var(--angle));
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(0, 0) rotate(var(--angle)) scale(0.1);
  }
}

@media (max-width: 520px) {
  .star-button {
    height: 42px;
    padding: 0 16px;
  }
}

/* --- Gale Day click FX: time tunnel + spotlight --- */
body.gale-day-open::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  background:
    radial-gradient(circle at 50% 50%, rgba(170, 170, 255, 0.22) 0%, rgba(170, 170, 255, 0.10) 22%, transparent 56%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.08) 0%, transparent 62%),
    conic-gradient(from 180deg at 50% 50%, rgba(255, 180, 230, 0.10), rgba(170, 170, 255, 0.10), rgba(255, 180, 230, 0.10));
  mix-blend-mode: screen;
  filter: blur(0.2px);
  opacity: 0;
  animation: galeWarp 1.4s ease-out 1;
}

@keyframes galeWarp {
  0% {
    opacity: 0;
    transform: scale(0.86);
  }
  28% {
    opacity: 1;
    transform: scale(1.02);
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

.entry.entry--spotlight {
  box-shadow:
    0 0 24px rgba(255, 180, 230, 0.28),
    0 0 52px rgba(170, 170, 255, 0.14);
  border-left-color: #ffd6f6;
  transform: translateY(-2px) scale(1.01);
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  body.gale-day-open::after {
    animation: none;
    opacity: 0;
  }
  .entry.entry--spotlight {
    transform: none;
  }
}


/* --- Gale Day whole-page skins (applied by diary.js) --- */
body.gale-day-theme::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:5; /* sync badge is 20+ */
  opacity:0;
  transition:opacity 260ms ease;
}
body.gale-day-theme::before{ opacity:1; }

/* Purple skin */
body.gale-day-theme.gale-skin-purple::before{
  background:
    radial-gradient(circle at 20% 15%, rgba(170,170,255,.18), transparent 55%),
    radial-gradient(circle at 80% 25%, rgba(255,180,230,.10), transparent 60%),
    radial-gradient(circle at 50% 80%, rgba(170,170,255,.08), transparent 65%);
}

/* Gale gray skin */
body.gale-day-theme.gale-skin-gray::before{
  background:
    radial-gradient(circle at 25% 20%, rgba(230,230,240,.12), transparent 55%),
    radial-gradient(circle at 75% 65%, rgba(200,200,215,.08), transparent 60%),
    radial-gradient(circle at 55% 85%, rgba(255,255,255,.05), transparent 70%);
}

/* Rose skin */
body.gale-day-theme.gale-skin-rose::before{
  background:
    radial-gradient(circle at 18% 18%, rgba(255,180,230,.18), transparent 55%),
    radial-gradient(circle at 78% 30%, rgba(170,170,255,.10), transparent 60%),
    radial-gradient(circle at 50% 85%, rgba(255,180,230,.07), transparent 70%);
}

/* Cosmic skin */
body.gale-day-theme.gale-skin-cosmic::before{
  background:
    conic-gradient(from 180deg at 50% 50%,
      rgba(170,170,255,.10),
      rgba(255,180,230,.08),
      rgba(170,170,255,.10)),
    radial-gradient(circle at 30% 18%, rgba(255,255,255,.06), transparent 55%),
    radial-gradient(circle at 72% 78%, rgba(170,170,255,.10), transparent 65%);
  mix-blend-mode: screen;
}

/* dress up container a bit */
body.gale-day-theme .diary-container{
  box-shadow:0 0 40px rgba(170,170,255,.10);
}

/* festive accents */
body.gale-day-theme button.tag.active{
  box-shadow:0 0 0 2px rgba(170,170,255,.10), 0 0 16px rgba(255,180,230,.10);
}
body.gale-day-theme .sync-badge--cute{
  box-shadow:0 0 0 2px rgba(170,170,255,.08), 0 0 22px rgba(170,170,255,.08);
}

/* Hint the browser for smoother fade-in/out (safe outside reduced-motion) */
body.gale-day-theme::before { will-change: opacity; }

@media (prefers-reduced-motion: reduce){
  body.gale-day-theme::before { transition: none; }
}


/* --- Gale Day: after first open, keep the easter egg calm (no extra “flash”) --- */
.holiday-egg.is-seen .star-button {
  filter: saturate(0.95);
}

/* Calm down the hover glow/meteors a bit after it's been opened today */
.holiday-egg.is-seen .star-button:hover .glow {
  opacity: 0.55;
  transform: scale(1.6);
}

.holiday-egg.is-seen .star-button:hover .star {
  animation-duration: 1.15s;
  opacity: 0.6;
}

.holiday-egg.is-seen .holiday-caption {
  opacity: 0.9;
}