/* ============================================================
   7. Today's Page — daily conversational journal
   ============================================================ */

.today-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 16px 40px;
}

.today-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.today-topbar-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;                                /* equal-width sides so the date stays centered */
}
.today-topbar-side--left  { justify-content: flex-start; }
.today-topbar-side--right { justify-content: flex-end; }

/* Date cluster in the center with prev / next arrows. */
.today-date-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.day-arrow {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ink);
  background: var(--bg-page);
  border: 2px solid var(--ink);
  border-radius: 4px;
  box-shadow: 2px 2px 0 var(--ink);
  padding: 0;
  min-width: 30px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.day-arrow:hover { background: var(--highlight); }
.day-arrow:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

/* Day-page top nav: prev / today / next arrows. */
.day-page-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}
/* "Close for the night" button sits at the very bottom of Today's Page
   and opens the good-night overlay. */
.today-tuck-in {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}
.today-tuck-in-btn {
  background: #2e3d65;
  color: #f4e6c8;
  border-color: var(--ink);
}
.today-tuck-in-btn:hover {
  background: #3b5180;
}

/* Night mode — dims and cools the whole library but keeps it visible
   and interactive. The page content sits under this filter, and a
   floating badge at the bottom shows today's count + a wake button. */
body.is-night-mode #app {
  filter: brightness(0.62) saturate(0.78) hue-rotate(-10deg);
  transition: filter 0.5s ease;
}
body.is-night-mode #app::after {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(30,42,72,0.25) 0%, rgba(14,19,40,0.35) 100%);
  pointer-events: none;
  z-index: 1;
}
/* Floating badge during night mode — centered along the bottom. */
.goodnight-badge {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  background: #1f2a48;
  color: #f4e6c8;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 0.9rem;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 9999;
}
.goodnight-badge.is-open {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.goodnight-badge-moon {
  width: 14px;
  height: 14px;
  background: #f4e6c8;
  border-radius: 50%;
  box-shadow:
    0 0 8px rgba(244, 230, 200, 0.55),
    inset -4px 2px 0 #1f2a48;
}
.goodnight-badge-wake {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 0.85rem;
  background: #f4e6c8;
  color: #1f2a48;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
  letter-spacing: 0.04em;
}
.goodnight-badge-wake:hover { background: #fff2c6; }

.today-date {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--highlight);                  /* softer seasonal chip — matches section headers */
  border: 2px solid var(--ink);
  border-radius: 3px;
  padding: 4px 12px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.25);
  letter-spacing: 0.03em;
}

.today-book {
  background: var(--bg-page);
  border: 2px solid var(--ink);
  border-top: 10px solid var(--accent);
  border-radius: 6px;
  box-shadow: 4px 6px 0 var(--ink);
  padding: 24px 26px 28px;
  position: relative;
}
/* (center crease removed — clean sticky-note look) */

.today-header {
  text-align: center;
  margin-bottom: 18px;
}
.today-icon {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 2px;
}
.today-header h1 {
  margin: 0;
  font-size: 1.4rem;
  display: inline-block;
  background: var(--highlight);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 3px;
  padding: 4px 14px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.25);
  letter-spacing: 0.03em;
}
.today-header-date {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 4px 0 0;
  letter-spacing: 0.04em;
}

/* Daily goals block at the top of Today's Page */
.today-goals {
  border: 1px dashed var(--ink-soft);
  border-radius: 6px;
  padding: 12px 14px 6px;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.3);
}
.today-goals-title {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 1rem;
  margin: 0 0 12px;
  color: var(--ink);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  /* Seasonal chip so "today's aims" pops the same as other section headings */
  display: inline-block;
  background-color: var(--highlight);
  border: 2px solid var(--ink);
  border-radius: 3px;
  padding: 3px 10px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.25);
}
.goal-domain-chip {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 0.65rem;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.today-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}
.thread-entry {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 12px;
}
.thread-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.thread-entry-actions {
  display: flex;
  gap: 4px;
}
.thread-prompt {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0;
}
.thread-response {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--ink);
}

.today-current {
  border-top: 1px dashed var(--ink-soft);
  padding-top: 16px;
}
.today-prompt {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 1.2rem;
  color: var(--ink);
  margin: 0 0 12px;
  text-align: center;
}

#today-input {
  width: 100%;
  min-height: 110px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  /* Notebook-page feel: cream base with a soft horizontal rule every
     line. Line-height and background-size match so the text sits on
     the rules instead of drifting between them. */
  background-color: #fdf6e3;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(1.8em - 1px),
    rgba(74, 58, 42, 0.16) calc(1.8em - 1px),
    rgba(74, 58, 42, 0.16) 1.8em
  );
  background-position: 0 13px;
  color: var(--ink);
  line-height: 1.8;
  resize: vertical;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

/* One-shot "ink landing" animation for a newly saved thread entry on
   Today's Page — pairs with the .goal-sparkle model used elsewhere. */
@keyframes today-entry-land {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.thread-entry.is-landing { animation: today-entry-land 260ms ease-out; }

.today-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}


/* ============================================================
   8. Journal archive
   ============================================================ */

/* Link on the home screen reading desk */
.journal-link {
  margin-top: 14px;
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 0.9rem;
  background: var(--bg-page);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 6px 14px;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.journal-link:hover { background: var(--highlight); }

.reading-desk {
  flex-direction: column;
  align-items: center;
}

.journal-view {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px 40px;
}

.journal-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 14px;
}

.journal-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "date meta"
    "snippet snippet";
  gap: 4px 12px;
  text-align: left;
  background: var(--bg-page);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  width: 100%;
}
.journal-row:hover {
  transform: translateY(-1px);
  box-shadow: 2px 4px 0 var(--ink);
}
.journal-row-date {
  grid-area: date;
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 0.95rem;
}
.journal-row-meta {
  grid-area: meta;
  color: var(--ink-soft);
  font-size: 0.8rem;
  align-self: center;
}
.journal-row-snippet {
  grid-area: snippet;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.35;
}

/* --- "To buy" checklist on Today's Page --- */
.today-tobuy .tobuy-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.tobuy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  transition: opacity 280ms ease;
}
.tobuy-row.is-bought { opacity: 0.72; }
/* Custom pixel-styled checkbox so the list feels handcrafted, not formy.
   Native checkbox is hidden via appearance:none; :checked state paints a
   tick using a rotated rectangle trick. */
.tobuy-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin: 0;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--bg-page);
  cursor: pointer;
  position: relative;
  transition: background 180ms ease;
}
.tobuy-row input[type="checkbox"]:checked { background: var(--ink); }
.tobuy-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 2px;
  top: -1px;
  width: 4px;
  height: 8px;
  border: solid var(--bg-page);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.tobuy-row input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.tobuy-text {
  flex: 1;
  color: var(--ink);
  font-size: 0.95rem;
  text-decoration: line-through transparent;
  transition: color 280ms ease, text-decoration-color 280ms ease;
}
.tobuy-row.is-bought .tobuy-text {
  text-decoration-color: var(--ink-soft);
  color: var(--ink-soft);
}
.tobuy-add {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.tobuy-input {
  flex: 1;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 4px 8px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--bg-page);
  color: var(--ink);
}


/* ==========================================================
   "Plans" section at the bottom of a day page — a small sticky-
   note-style list of things scheduled for that date (holidays,
   birthdays via user-added holidays, anchor days, upcoming finance
   entries, inventory expiring). Reads as soft cream notes on the
   page, not as a form.
   ========================================================== */
.today-plans {
  margin-top: 22px;
}
.today-plans-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.today-plans-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fdf6e3;
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.18);
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--ink);
  transition: transform 140ms ease, box-shadow 140ms ease;
  /* Slight alternating tilt so the cards look hand-placed on the page,
     like someone pinned little notes of what's coming up. */
}
.today-plans-item:nth-child(even) { transform: rotate(-0.4deg); }
.today-plans-item:nth-child(odd)  { transform: rotate(0.3deg); }
.today-plans-item:hover {
  transform: translateY(-1px) rotate(0);
  box-shadow: 2px 4px 0 rgba(0,0,0,0.2);
}
.today-plans-icon {
  font-size: 1.1rem;
  width: 24px;
  flex-shrink: 0;
  text-align: center;
}
.today-plans-label {
  flex: 1;
  color: var(--ink);
}


/* ==========================================================
   Mobile — Today's Page and Day Page at ≤480px.
   ========================================================== */
@media (max-width: 480px) {
  /* Clock lives only on the home page on mobile — Today/Day pages stay
     focused on the date + writing area. */
  .today-topbar .stardew-clock { display: none; }

  .today-page, .day-page { padding: 8px 10px; }
  .today-book { padding: 16px 14px; border-top-width: 6px; }

  /* Top bar: date + arrows + weather + clock — allow wrap. */
  .today-topbar {
    flex-wrap: wrap;
    gap: 6px 10px;
  }
  .today-date { font-size: 1rem; }

  /* Day arrows: thumb-sized tap targets. */
  .day-arrow {
    min-width: 40px;
    min-height: 40px;
    font-size: 1.2rem;
    padding: 4px 10px;
  }

  /* Action row at the bottom of the intention prompt: stack full-width
     so both buttons are easy to tap and the copy doesn't truncate. */
  .today-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .today-actions .small-btn,
  .today-actions .modal-submit {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
  }

  /* To-buy rows: bigger tap area for the checkbox and delete X. */
  .tobuy-row { min-height: 40px; }
  .tobuy-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }
  .tobuy-row input[type="checkbox"]:checked::after {
    left: 4px;
    top: -1px;
    width: 6px;
    height: 11px;
  }
  .tobuy-add { flex-wrap: wrap; gap: 8px; }
  .tobuy-input { flex-basis: 100%; min-width: 0; }
  .tobuy-add .small-btn { width: 100%; }

  /* Section titles slightly smaller to keep vertical rhythm tight. */
  .today-subsection-title { font-size: 1rem; }

  /* Thread entries breathe less on small screens. */
  .thread-entry { padding: 3px 0 3px 10px; }
  .thread-response { font-size: 0.95rem; }

  /* Weather widget + clock shrink slightly. */
  .today-weather, .clock-widget { font-size: 0.8rem; }
}
