/* Taskly: journal timeline and journal entries */

.journal-page,
.entry-page {
  max-width: var(--width-page);
  margin: 0 auto;
  padding: clamp(16px, 4vw, 40px) 20px 80px;
}

.page-head h1 {
  font-size: var(--text-3xl);
  font-weight: var(--weight-heavy);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.page-sub {
  margin-top: var(--space-2);
  max-width: 52ch;
  color: var(--ink-soft);
}

/* Timeline: date on the left, memory card on the right */

.timeline {
  list-style: none;
  margin-top: var(--space-8);
}

.entry-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: var(--space-4);
  margin-bottom: 34px;
}

.entry-date {
  position: sticky;
  top: 12px;
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-2) 0;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--rule);
  line-height: 1.1;
}

.entry-month {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.entry-day {
  font-size: var(--text-xl);
  font-weight: var(--weight-heavy);
  letter-spacing: -0.03em;
}

.entry-year {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.entry-boxes {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

/* Box 1: the task */

.entry-task {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 84px;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--tint, var(--margin)) 9%, var(--card));
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-card);
}

/* the task's icon again, large and faint, behind the text */
.entry-task::after {
  content: attr(data-icon);
  position: absolute;
  right: 22%;
  top: 50%;
  transform: translateY(-50%) rotate(-12deg);
  font-size: 5rem;
  line-height: 1;
  opacity: 0.07;
  pointer-events: none;
}

.entry-task > * {
  position: relative;
  z-index: 1;
}

.entry-task:hover .entry-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.entry-emoji {
  font-size: var(--text-2xl);
  line-height: 1;
}

.entry-title {
  flex: 1;
  min-width: 0;
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  overflow-wrap: anywhere;
}

.entry-days {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  line-height: 1;
  /* light mode: a little darker than the tint, so "days ago" reads on the pale box */
  color: color-mix(in srgb, var(--tint, var(--margin)), #000 var(--tint-shade));
}

.entry-days strong {
  font-size: var(--text-2xl);
  font-weight: var(--weight-heavy);
  letter-spacing: -0.03em;
}

.entry-days small {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

/* Box 2: the photo and its caption */

.entry-media {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--card);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-card);
}

.entry-media.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-5);
  background: transparent;
  border: 2px dashed var(--rule);
  box-shadow: none;
  color: var(--ink-soft);
  font-weight: var(--weight-medium);
}

.entry-media.empty:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.entry-cover {
  position: relative;
  aspect-ratio: 2 / 1; /* short and wide, like a photo strip in the timeline */
  background: var(--rule);
}

.entry-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}



.entry-memory-title {
  margin: var(--space-4) var(--space-5) 0;
  font-weight: var(--weight-heavy);
  font-size: var(--text-lg);
  line-height: var(--leading-tight);
}

.entry-memory-title + .entry-caption {
  margin-top: var(--space-1);
}

.entry-caption {
  margin: var(--space-4) var(--space-5) var(--space-4); /* margin, not padding, so exactly two lines show */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* on phones: a narrower date column, so the photo gets the width */
@media (max-width: 560px) {
  .entry-row {
    grid-template-columns: 52px 1fr;
    gap: var(--space-3);
  }
}

.journal-empty {
  padding: var(--space-6) 0;
  color: var(--ink-soft);
}

/* One entry */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  font-weight: var(--weight-bold);
  text-decoration: none;
}

.entry-byline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  color: var(--ink-soft);
}

.photo-add {
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 2px dashed var(--rule);
  color: var(--ink-soft);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  cursor: pointer;
}

.photo-add i {
  font-size: var(--text-xl);
}

.photo-add:hover,
.photo-add:focus-within {
  border-color: var(--ink);
  color: var(--ink);
}

/* no photos yet: Add photos becomes the main button */
.memory-photos .photo-add.first {
  flex-direction: row;
  width: auto;
  height: auto;
  padding: var(--space-4) var(--space-6);
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--text-base);
  box-shadow: var(--shadow-card);
}

.memory-photos .photo-add.first i {
  font-size: var(--text-base);
}

.memory-photos .photo-add.first:hover,
.memory-photos .photo-add.first:focus-within {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.photo-add.busy {
  opacity: 0.6;
  pointer-events: none;
}

.photo-add.busy span::after {
  content: "…";
}

.comments {
  list-style: none;
}

.comment {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.comment-bubble {
  flex: 1;
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--space-1) var(--radius-lg) var(--radius-lg) var(--radius-lg); /* speech-bubble corner */
  background: var(--paper);
}

.comment-meta {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--ink-soft);
}

.comment-body {
  margin-top: var(--space-0-5);
  overflow-wrap: anywhere;
}

.comment-delete:hover {
  color: var(--margin);
  background: var(--danger-bg);
}

@media (max-width: 560px) {
  .entry-row {
    grid-template-columns: 52px 1fr;
    gap: var(--space-3);
  }

  .entry-task {
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  .entry-emoji {
    font-size: var(--text-xl);
  }

  .entry-title {
    font-size: var(--text-md);
  }

  .entry-days strong {
    font-size: var(--text-xl);
  }

  .entry-day {
    font-size: var(--text-lg);
  }
}

/* Notifications */

.notes {
  list-style: none;
  margin-top: var(--space-6);
}

.note {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
  padding: var(--space-4) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--card);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 0 var(--rule);
}

.note:hover strong {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.note.unread {
  box-shadow: inset 4px 0 0 var(--margin), 0 1px 0 var(--rule);
}


.note-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-wrap: anywhere;
}

.note-text span {
  color: var(--ink-soft);
}

.note time {
  flex: none;
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.notes-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-20) var(--space-4);
}

.notes-empty i {
  font-size: 2.6rem;
  color: var(--highlight);
  margin-bottom: var(--space-4);
}

.notes-empty p {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}

.notes-empty .notes-empty-btn {
  margin-top: var(--space-6);
}

.notes-empty .notes-empty-btn i {
  margin: 0;
  font-size: var(--text-base);
  color: inherit;
}

.journal-empty .btn {
  margin-top: var(--space-4);
}

.notes-empty .notes-empty-sub {
  margin-top: var(--space-2);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  color: var(--ink-soft);
}

/* Edit screen */

.edit-page {
  max-width: var(--width-narrow);
  margin: 0 auto;
  padding: var(--space-4) var(--space-5) var(--space-10);
}

.screen-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
}

.preview {
  pointer-events: none;
}

.edit-form-page {
  margin-top: var(--space-6);
}

/* three groups: the task itself, who it's shared with, the memory.
   Tight inside a group, a clear gap and a line between groups. */
.edit-group + .edit-group {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--rule);
}

.edit-group > .edit-row:first-child .field-label,
.edit-group > .field-label:first-child {
  margin-top: 0;
}

.edit-group .field-label {
  margin: var(--space-4) 0 var(--space-1);
}

.group-label {
  margin: 0 0 var(--space-3);
  font-size: var(--text-md);
  font-weight: var(--weight-heavy);
}

.open-memory-text[data-count]:not([data-count=""])::after {
  content: attr(data-count);
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.edit-row {
  display: flex;
  gap: var(--space-3);
}

.edit-grow {
  flex: 1;
  min-width: 0;
}

.icon-choice {
  display: grid;
  place-items: center;
  width: 48px;
  height: 46px;
  border: 2px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--field);
  font-size: var(--text-xl);
  cursor: pointer;
}

.icon-choice:hover {
  border-color: var(--ink);
}

.icon-grid {
  justify-content: center;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: var(--tint);
  box-shadow: inset 0 0 0 3px var(--card);
  cursor: pointer;
}

.swatch[data-color=""] {
  background: linear-gradient(135deg, var(--margin) 50%, var(--navy) 50%);
}

.swatch[aria-checked="true"] {
  border-color: var(--ink);
}

.memory-actions {
  display: flex;
  gap: var(--space-3);
}

.memory-action {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  text-align: center;
  padding: var(--space-4);
  border: 2px dashed var(--rule);
  border-radius: var(--radius-lg);
  color: var(--ink-soft);
  font-weight: var(--weight-bold);
  text-decoration: none;
  cursor: pointer;
}

.memory-action:hover,
.memory-action:focus-within {
  border-color: var(--ink);
  color: var(--ink);
}

.memory-action.busy {
  opacity: 0.6;
  pointer-events: none;
}

.memory-action.busy span::after {
  content: "…";
}

/* Save stays on screen at the bottom while you scroll the form */
.save-big {
  position: sticky;
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  z-index: 5;
  width: 100%;
  margin-top: var(--space-8);
  padding: var(--space-4);
  font-size: var(--text-md);
  box-shadow: var(--shadow-raised);
}

/* Memory page */

body.memory {
  padding-bottom: calc(84px + env(safe-area-inset-bottom)); /* room for the comment bar */
}

.memory-page {
  max-width: var(--width-page);
  margin: 0 auto;
}

.memory-hero {
  position: relative;
  min-height: 160px;
  background: color-mix(in srgb, var(--tint, var(--margin)) 16%, var(--card));
  overflow: hidden;
}

.memory-hero.has-photo {
  background: var(--photo-bg);
}

.memory-hero-img {
  display: block;
  width: 100%;
  max-height: 62vh;
  object-fit: cover;
}

.memory-hero-empty {
  display: grid;
  place-items: center;
  height: 200px;
  font-size: 4.5rem;
}

.memory-hero-bar {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 14px 14px;
}

.memory-hero.has-photo .round-btn {
  background: var(--scrim);
  color: var(--white);
  backdrop-filter: blur(6px);
}

.memory-body {
  padding: var(--space-5) var(--space-5) var(--space-6);
}

.memory-meta {
  color: var(--ink-soft);
  font-weight: var(--weight-medium);
}

.memory-title {
  margin-top: var(--space-2);
  font-size: var(--text-2xl);
  font-weight: var(--weight-heavy);
  line-height: 1.1;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.memory-caption {
  margin-top: var(--space-3);
  font-size: var(--text-md);
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.caption-prompt {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 2px dashed var(--rule);
  border-radius: var(--radius-md);
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-weight: var(--weight-medium);
  cursor: pointer;
}

.caption-prompt:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.memory-body .entry-byline {
  gap: var(--space-2);
}

.memory-body .entry-byline .nav-avatar,
.memory-body .entry-byline .avatar-fallback {
  width: 24px;
  height: 24px;
  font-size: var(--text-xs);
}

.memory-photos {
  display: flex;
  align-items: flex-end;
  gap: var(--space-6);
  margin: var(--space-8) 0 var(--space-2);
}

/* tilted stack of photo cards */
.photo-stack {
  position: relative;
  width: 160px;
  height: 200px;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
}

.photo-stack img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 4px solid var(--card);
  box-shadow: var(--shadow-raised);
}

.photo-stack img:nth-last-of-type(1) { transform: rotate(-5deg); }
.photo-stack img:nth-last-of-type(2) { transform: rotate(4deg) translateX(14px); }
.photo-stack img:nth-last-of-type(3) { transform: rotate(10deg) translateX(26px); }


.memory-photos .photo-add {
  width: 110px;
  height: 110px;
}

.memory-comments {
  margin-top: var(--space-8);
}

/* the bubble is a white card, so it reads as one piece with the face beside it */
.memory-comments .comment {
  align-items: center;
  gap: var(--space-2);
}

.memory-comments .comment-bubble {
  flex: 0 1 auto;
  border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-4);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.memory-comments .comment-meta {
  margin-top: var(--space-0-5);
  font-weight: var(--weight-medium);
  font-size: var(--text-xs);
}

.memory-comments .comment-body {
  margin: 0;
  font-weight: var(--weight-medium);
}

/* messages appear above the comment bar */
body.memory .toast {
  bottom: calc(84px + env(safe-area-inset-bottom));
}

/* comment bar fixed at the bottom of the screen */
.comment-bar {
  position: fixed;
  z-index: 15;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: var(--space-3);
  max-width: var(--width-page);
  margin: 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 1px solid var(--rule);
}

.comment-bar .field {
  border-radius: var(--radius-full);
  padding-left: var(--space-5);
}

.comment-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--text-md);
  cursor: pointer;
}

/* full-screen photo viewer */
dialog.viewer {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: none;
  background: var(--photo-bg);
  color: var(--white);
}

dialog.viewer::backdrop {
  background: var(--photo-bg);
}

.viewer-bar {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  background: linear-gradient(rgba(0, 0, 0, 0.6), transparent);
}

.viewer-count {
  font-weight: var(--weight-bold);
}

.viewer-actions {
  display: flex;
  gap: var(--space-2);
}

.viewer-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
  font-size: var(--text-base);
  text-decoration: none;
  cursor: pointer;
}

.viewer-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.viewer-strip {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.viewer-strip::-webkit-scrollbar {
  display: none;
}

.viewer-slide {
  flex: 0 0 100%;
  display: grid;
  place-items: center;
  scroll-snap-align: center;
}

.viewer-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

@media (min-width: 761px) {
  .memory-page {
    padding-top: var(--space-3);
  }

  .memory-hero {
    border-radius: var(--radius-xl);
  }
}

/* sharing */

.owner-fields {
  border: none;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.owner-fields:disabled {
  opacity: 0.6;
}

.shared-note {
  display: flex;
  gap: var(--space-3);
  margin: 0 0 var(--space-6);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--highlight) 22%, var(--card));
  font-size: var(--text-base);
}

.people-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.people-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.person-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
  border-radius: var(--radius-full);
  background: var(--card);
  border: 1px solid var(--rule);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
}

.person-chip .nav-avatar,
.person-chip .avatar-fallback {
  width: 28px;
  height: 28px;
  font-size: var(--text-sm);
}

.share-list {
  display: flex;
  flex-direction: column;
  max-height: 50vh;
  overflow-y: auto;
}

.share-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-0-5);
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}

.share-row:last-child {
  border-bottom: none;
}

.share-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.share-name {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-weight: var(--weight-bold);
}

.share-name small {
  font-weight: var(--weight-regular);
  color: var(--ink-soft);
}


.viewer-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.viewer-by {
  font-size: var(--text-sm);
  opacity: 0.8;
}

.entry-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.entry-name .entry-title {
  flex: none;
  align-self: stretch;
}
