/* Home Page - Book Cover Design */

.home-page {
  min-height: 100vh;
  background: 
    radial-gradient(circle at 20% 50%, rgba(139, 115, 85, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(101, 67, 33, 0.1) 0%, transparent 50%),
    linear-gradient(135deg, #f5f1e8 0%, #e8e0d1 50%, #f5f1e8 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: var(--space-xl);
  font-family: var(--font-serif);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* User onboarding and first Check-in guidance */
.quick-write--onboarding {
  border-left: 4px solid var(--leather-brown);
}

.quick-write--onboarding::after {
  display: none;
}

.quick-write--onboarding .quick-write__destination {
  max-width: 66ch;
  line-height: 1.55;
}

.quick-write--onboarding .quick-write__destination strong {
  color: var(--ink-dark);
}

.first-checkin-success {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  color: var(--ink-dark);
  background: linear-gradient(135deg, var(--paper-aged), var(--paper-warm));
  border: 1px solid var(--sepia-line);
  border-left: 4px solid var(--success);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.first-checkin-success__icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  background: color-mix(in srgb, var(--success) 12%, var(--paper-aged));
  border-radius: 50%;
}

.first-checkin-success__copy h2,
.first-checkin-success__copy p {
  margin: 0;
}

.first-checkin-success__copy h2 {
  font: 600 var(--text-lg) var(--font-serif);
}

.first-checkin-success__copy p {
  margin-top: var(--space-xs);
  color: var(--ink-soft);
  font: var(--text-sm) / 1.5 var(--font-sans);
}

.first-checkin-success__action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  color: var(--paper-aged);
  background: var(--leather-brown);
  border-radius: 8px;
  font: 600 var(--text-sm) var(--font-sans);
  text-decoration: none;
}

.first-checkin-success__action:focus-visible {
  outline: 3px solid var(--sepia-line);
  outline-offset: 3px;
}

.mood-tracker-card:has(.mood-tracker-help[open]) {
  z-index: 5;
  overflow: visible;
}

.mood-tracker-help {
  position: relative;
  font-family: var(--font-sans);
}

.mood-tracker-help summary {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: var(--space-sm) 12px;
  color: var(--ink-soft);
  background: var(--paper-aged);
  border: 1px solid var(--sepia-line);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.mood-tracker-help summary::-webkit-details-marker {
  display: none;
}

.mood-tracker-help summary:focus-visible {
  outline: 2px solid var(--action-primary);
  outline-offset: 2px;
}

.mood-tracker-help__content {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 48px));
  padding: var(--space-md);
  color: var(--ink-dark);
  background: var(--paper-aged);
  border: 1px solid var(--sepia-line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

.mood-tracker-help__content h4 {
  margin: 0 0 var(--space-sm);
  font: 600 var(--text-md) var(--font-serif);
}

.mood-tracker-help__content ol {
  margin: 0;
  padding-left: var(--space-lg);
  color: var(--ink-soft);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.mood-tracker-help__content p {
  margin: var(--space-sm) 0 0;
  padding-top: var(--space-sm);
  color: var(--ink-soft);
  border-top: 1px solid var(--sepia-line);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.mood-tracker-help__guide {
  color: var(--action-primary);
  font-weight: 600;
  text-underline-offset: 3px;
}

.mood-tracker-guidance {
  margin: 0;
  padding: 10px 12px;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--action-primary) 8%, var(--paper-aged));
  border-left: 3px solid var(--action-primary);
  border-radius: 8px;
  font: var(--text-xs) / 1.5 var(--font-sans);
}

.mood-tracker-empty {
  display: grid;
  justify-items: center;
  gap: var(--space-sm);
  padding: var(--space-xl) var(--space-md);
  text-align: center;
}

.mood-tracker-empty__icon {
  font-size: var(--text-xl);
}

.mood-tracker-empty h4,
.mood-tracker-empty p {
  margin: 0;
}

.mood-tracker-empty h4 {
  color: var(--ink-dark);
  font: 600 var(--text-lg) var(--font-serif);
}

.mood-tracker-empty p {
  max-width: 58ch;
  color: var(--ink-soft);
  font: var(--text-sm) / 1.55 var(--font-sans);
}

.mood-tracker-empty .empty-action-btn {
  min-height: 44px;
  margin-top: var(--space-xs);
  border: 1px solid var(--leather-brown);
  font: 600 var(--text-sm) var(--font-sans);
  cursor: pointer;
}

.mood-tracker-empty .empty-action-btn:focus-visible {
  outline: 3px solid var(--sepia-line);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .first-checkin-success {
    grid-template-columns: auto 1fr;
    padding: var(--space-md);
  }

  .first-checkin-success__action {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .mood-tracker-help__content {
    position: fixed;
    top: 84px;
    right: var(--space-md);
    left: var(--space-md);
    width: auto;
  }
}

.home-page::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(139, 115, 85, 0.03) 2px,
      rgba(139, 115, 85, 0.03) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(139, 115, 85, 0.03) 2px,
      rgba(139, 115, 85, 0.03) 4px
    );
  pointer-events: none;
  z-index: 0;
}

.home-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 1;
}

.home-notebook {
  position: relative;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 3 / 4;
  perspective: 2000px;
}

.home-notebook__cover {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, var(--leather-brown) 0%, #4A2E1F 50%, var(--leather-brown) 100%),
    radial-gradient(ellipse at 30% 40%, rgba(255, 255, 255, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 60%, rgba(0, 0, 0, 0.15) 0%, transparent 60%);
  border-radius: 8px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 8px 24px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  transform-origin: left center;
  backface-visibility: hidden;
  border: 1px solid rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

/* Decorative cover elements */
.home-notebook__cover::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0, 0, 0, 0.1) 0%, transparent 50%),
    repeating-linear-gradient(45deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.03) 2px,
      rgba(0, 0, 0, 0.03) 4px);
  pointer-events: none;
}

.home-notebook__spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 12px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.3), transparent);
  border-radius: 8px 0 0 8px;
}

.home-notebook__author-link {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.home-notebook__author-section {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  z-index: 2;
  width: 100%;
}

.home-notebook__avatar-container {
  margin-bottom: var(--space-xs);
}

.home-notebook__avatar-image {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--paper-aged);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  object-fit: cover;
}

.home-notebook__email-input {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  color: var(--paper-aged);
  opacity: 0.9;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.home-notebook__email-input:hover {
  opacity: 1;
  text-decoration: underline;
}

.home-notebook__content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  z-index: 1;
}

/* Created At in Top Right */
.home-notebook__created-at {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  color: var(--paper-aged);
  opacity: 0.8;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.home-notebook__flash {
  position: absolute;
  top: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 400px;
  z-index: 10;
}

.home-notebook__flash-message {
  padding: var(--space-sm) var(--space-md);
  border-radius: 4px;
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  line-height: 1.6;
  margin-bottom: var(--space-xs);
  border-left: 3px solid;
  background-color: rgba(255, 255, 255, 0.95);
}

.home-notebook__flash-message:last-child {
  margin-bottom: 0;
}

.home-notebook__flash-message p {
  margin: 0;
  color: var(--ink-dark);
}

.home-notebook__flash-message--alert {
  border-left-color: #d32f2f;
  background-color: rgba(211, 47, 47, 0.1);
}

.home-notebook__flash-message--alert p {
  color: #b71c1c;
}

.home-notebook__flash-message--notice,
.home-notebook__flash-message--success {
  border-left-color: #388e3c;
  background-color: rgba(56, 142, 60, 0.1);
}

.home-notebook__flash-message--notice p,
.home-notebook__flash-message--success p {
  color: #2e7d32;
}

.home-notebook__form {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Journal Name in Top Section (Second Quarter) */
.home-notebook__journal-name {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 400px;
  z-index: 2;
}

.home-notebook__journal-input {
  width: 100%;
  padding: 0;
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 400;
  text-align: center;
  color: var(--paper-aged);
  background-color: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  transition: all 0.3s ease;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  resize: none;
  overflow: hidden;
  /* Hide scrollbars */
  field-sizing: content;
  /* Modern CSS to auto-resize height */
  min-height: 1.5em;
  /* Ensure at least one line */
}

.home-notebook__journal-input:focus {
  outline: none;
  border: none;
  box-shadow: none;
  opacity: 1;
}

.home-notebook__journal-input::placeholder {
  color: var(--paper-aged);
  font-style: italic;
  opacity: 0.6;
}

/* Buttons */
.home-notebook__actions {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  width: 80%;
  max-width: 300px;
  z-index: 2;
}

.home-notebook__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--paper-aged);
  background: linear-gradient(135deg, var(--leather-brown) 0%, #4A2E1F 100%);
  border: none;
  border-radius: 4px;
  cursor: var(--cursor-pointer);
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.home-notebook__button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.home-notebook__button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.home-notebook__button[disabled],
.home-notebook__button.blocked {
  background: #A8A49D; /* ink-disabled */
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.7;
}

.home-notebook__button--outline {
  background: transparent;
  border: 1px solid var(--paper-aged);
  color: var(--paper-aged);
  box-shadow: none;
}

.home-notebook__button--outline:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.home-notebook__button--outline svg {
  stroke: var(--paper-aged);
}

.home-notebook__button[disabled]:hover,
.home-notebook__button.blocked:hover {
  transform: none;
  box-shadow: none;
  background: #A8A49D;
}

.home-notebook__button svg {
  width: 18px;
  height: 18px;
  stroke: var(--paper-aged);
  fill: none;
  stroke-width: 2;
}

/* Author Section (Avatar + Name) in Bottom Right */
.home-notebook__author-section {
  position: absolute;
  bottom: var(--space-lg);
  right: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  z-index: 2;
}

.home-notebook__avatar-container {
  position: relative;
  flex-shrink: 0;
}

.home-notebook__avatar-label {
  display: block;
  padding: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: transparent;
  overflow: hidden;
  cursor: var(--cursor-pointer);
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.home-notebook__avatar-label:hover {
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.home-notebook__avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


.home-notebook__avatar-input {
  display: none;
}

.home-notebook__email-input {
  flex: 0 0 auto;
  width: auto;
  min-width: 20px;
  max-width: 200px;
  padding: 0;
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  color: var(--paper-aged);
  background-color: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  transition: width 0.1s ease;
  text-align: right;
  opacity: 0.8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.home-notebook__email-input:focus {
  outline: none;
  border: none;
  box-shadow: none;
  opacity: 1;
}

.home-notebook__email-input::placeholder {
  color: var(--paper-aged);
  font-style: italic;
  opacity: 0.6;
}

/* Background Theme Selector */
.home-notebook__background-selector {
  position: absolute;
  bottom: var(--space-lg);
  left: var(--space-lg);
  z-index: 2;
}

.home-notebook__background-select {
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-serif);
  font-size: var(--text-xs);
  color: var(--paper-aged);
  background-color: rgba(90, 62, 43, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: var(--cursor-pointer);
  transition: all 0.2s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  opacity: 0.8;
}

.home-notebook__background-select:hover {
  opacity: 1;
  background-color: rgba(90, 62, 43, 0.9);
}

.home-notebook__background-select:focus {
  outline: none;
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.4);
}

.home-notebook__background-select option {
  background-color: var(--leather-brown);
  color: var(--paper-aged);
}

/* Responsive */
@media (max-width: 768px) {
  .home-page {
    padding: var(--space-md);
  }

  .home-notebook {
    max-width: 100%;
  }

  .home-notebook__journal-name {
    width: 90%;
  }

  .home-notebook__journal-input {
    font-size: var(--text-lg);
    padding: 0;
  }

  .home-notebook__actions {
    width: 90%;
    gap: var(--space-sm);
  }

  .home-notebook__button {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
  }

  .home-notebook__author-section {
    bottom: var(--space-md);
    right: var(--space-md);
    gap: var(--space-xs);
  }

  .home-notebook__avatar-label {
    width: 40px;
    height: 40px;
  }

  .home-notebook__avatar-placeholder svg {
    width: 22px;
    height: 22px;
  }

  .home-notebook__email-input {
    min-width: 0;
    max-width: 150px;
    font-size: var(--text-xs);
    padding: 0;
  }

  .home-notebook__created-at {
    top: var(--space-md);
    right: var(--space-md);
    font-size: var(--text-xs);
  }

  .home-notebook__background-selector {
    bottom: var(--space-md);
    left: var(--space-md);
  }

  .home-notebook__background-select {
    font-size: 10px;
    padding: 2px var(--space-xs);
  }
}

/* Journals Index Page - Modern Design */
.journals-index-page {
  min-height: 100vh;
  background: 
    radial-gradient(circle at 20% 50%, rgba(139, 115, 85, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(101, 67, 33, 0.1) 0%, transparent 50%),
    linear-gradient(135deg, #f5f1e8 0%, #e8e0d1 50%, #f5f1e8 100%);
  font-family: var(--font-sans);
  position: relative;
}

.journals-index-page::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(139, 115, 85, 0.03) 2px,
      rgba(139, 115, 85, 0.03) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(139, 115, 85, 0.03) 2px,
      rgba(139, 115, 85, 0.03) 4px
    );
  pointer-events: none;
  z-index: 0;
}

/* Header uses guest-header styles from messages.css */

/* Container */
.journals-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-xxl) var(--space-xl);
  position: relative;
  z-index: 1;
}

/* Grid Layout */
.journals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-xl);
}

/* Journal Card - Modern */
.journal-card {
  position: relative;
  background: #ffffff;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: var(--cursor-pointer);
}

.journal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /* background: rgba(255, 255, 255, 0.5); */
  z-index: 0;
  transition: background 0.3s ease;
}

.journal-card:hover::before {
  background: rgba(255, 255, 255, 0.6);
}

.journal-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
}

.journal-card:hover .journal-card__actions {
  opacity: 1;
  visibility: visible;
}

.journal-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: var(--space-xl);
  position: relative;
  z-index: 1;
}

.journal-card__header {
  margin-bottom: var(--space-lg);
}

.journal-card__title {
  font-family: 'Dancing Script', cursive;
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--ink-dark);
  margin: 0 0 var(--space-xs) 0;
  line-height: 1.3;
}

.journal-card__description {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.5;
}

.journal-card__body {
  margin-bottom: var(--space-lg);
}

.journal-card__metadata {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.journal-card__meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
}

.journal-card__meta-label {
  color: var(--ink-soft);
  font-weight: 400;
}

.journal-card__meta-value {
  color: var(--ink-dark);
  font-weight: 500;
}

.journal-card__footer {
  display: flex;
  align-items: center;
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.journal-card__status {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.journal-card__status--private {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink-soft);
}

.journal-card__status--shared {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.journal-card__status--public {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

/* Action Icons - Hidden by default, shown on hover */
.journal-card__actions {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  display: flex;
  gap: var(--space-xs);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 2;
}

.journal-card__action {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  color: var(--ink-dark);
  text-decoration: none;
  cursor: var(--cursor-pointer);
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.journal-card__action:hover {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  transform: scale(1.05);
}

.journal-card__action svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Empty State */
.journals-empty {
  text-align: center;
  padding: var(--space-4xl) var(--space-lg);
  max-width: 500px;
  margin: 0 auto;
}

.journals-empty__illustration {
  margin-bottom: var(--space-xl);
  opacity: 0.3;
}

.journals-empty__illustration svg {
  width: 80px;
  height: 80px;
  stroke: var(--ink-soft);
  fill: none;
  stroke-width: 1.5;
}

.journals-empty__title {
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--ink-dark);
  margin: 0 0 var(--space-md) 0;
  line-height: 1.4;
}

.journals-empty__message {
  font-size: var(--text-md);
  color: var(--ink-soft);
  margin: 0 0 var(--space-xl) 0;
  line-height: 1.6;
}

.journals-empty__button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-size: var(--text-md);
  font-weight: 500;
  color: #ffffff;
  background: var(--ink-dark);
  border: none;
  border-radius: 6px;
  text-decoration: none;
  cursor: var(--cursor-pointer);
  transition: all 0.2s ease;
}

.journals-empty__button:hover {
  background: var(--ink-900);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.journals-empty__button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Responsive */
@media (max-width: 1024px) {
  .journals-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
  }
}

@media (max-width: 768px) {
  .journals-index-page {
    background: 
      radial-gradient(circle at 20% 50%, rgba(139, 115, 85, 0.1) 0%, transparent 50%),
      radial-gradient(circle at 80% 80%, rgba(101, 67, 33, 0.1) 0%, transparent 50%),
      linear-gradient(135deg, #f5f1e8 0%, #e8e0d1 50%, #f5f1e8 100%);
  }


  .journals-container {
    padding: var(--space-xl) var(--space-md);
  }

  .journals-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .journal-card__link {
    padding: var(--space-lg);
  }

  .journal-card__actions {
    opacity: 1;
    visibility: visible;
  }
}

/* Footer */
.journals-footer {
  margin-top: var(--space-4xl);
  padding: var(--space-xl) 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  position: relative;
  z-index: 1;
}

/* Journal List Enhancements */
.journal-list-header {
  max-width: 1400px;
  margin: 0 auto var(--space-xl) auto;
  padding: 0 var(--space-xl);
  display: flex;
  justify-content: flex-end;
}

.search-container {
  width: 100%;
  max-width: 400px;
}

.journal-search-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-serif);
  font-size: var(--text-md);
  color: var(--ink-dark);
  background-color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(139, 115, 85, 0.2);
  border-radius: 8px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.journal-search-input:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--leather-brown);
  box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

.journal-card-wrapper {
  position: relative;
  transition: transform 0.2s ease;
}

.journal-card-wrapper:hover {
  z-index: 10;
}

.journal-card__pin {
  position: absolute;
  top: -2px;
  right: var(--space-xl);
  width: 22px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-shadow); /* Parchment color for better visibility */
  backdrop-filter: blur(4px);
  color: var(--leather-brown);
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 50% 80%, 0% 100%);
  filter: drop-shadow(0 0 1px rgba(139, 115, 85, 0.5));
  cursor: pointer;
  z-index: 20;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  border: none;
}

.journal-card__pin.is-pinned {
  background: var(--leather-brown);
  color: #ffffff;
  opacity: 1;
  height: 44px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.2));
}

.journal-card-wrapper:hover .journal-card__pin {
  opacity: 1;
  background: var(--leather-brown); /* Matches pinned color on hover */
  color: #ffffff;
  filter: drop-shadow(0 0 4px rgba(139, 115, 85, 0.6));
  animation: bookmark-pulse 2s infinite ease-in-out;
}

.journal-card-wrapper:hover .journal-card__pin.is-pinned {
  filter: drop-shadow(0 0 6px rgba(139, 115, 85, 0.4));
  animation: bookmark-pinned-pulse 2s infinite ease-in-out;
}

@keyframes bookmark-pulse {
  0% { filter: drop-shadow(0 0 1px rgba(139, 115, 85, 0.3)); }
  50% { filter: drop-shadow(0 0 5px rgba(139, 115, 85, 0.6)); }
  100% { filter: drop-shadow(0 0 1px rgba(139, 115, 85, 0.3)); }
}

@keyframes bookmark-pinned-pulse {
  0% { filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.2)); }
  50% { filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5)); }
  100% { filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.2)); }
}

.sortable-ghost {
  opacity: 0.4;
  background: var(--paper-base);
}

.journals-footer {
  margin-top: var(--space-4xl);
  padding: var(--space-xl) 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  position: relative;
  z-index: 1;
}

.journals-footer__container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.journals-footer__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  text-align: center;
}

.journals-footer__copyright {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  margin: 0;
}

.journals-footer__links {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
}

.journals-footer__link {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.2s ease;
}

.journals-footer__link:hover {
  color: var(--ink-dark);
  text-decoration: underline;
}

.journals-footer__separator {
  color: rgba(0, 0, 0, 0.2);
  font-size: var(--text-sm);
}

@media (max-width: 768px) {
  .journals-footer {
    margin-top: var(--space-xxl);
    padding: var(--space-lg) 0;
  }

  .journals-footer__container {
    padding: 0 var(--space-md);
  }
}

.hidden {
  display: none !important;
}

/* --- HOME INTERACTIVE DASHBOARD STYLES --- */
.home-dashboard {
  max-width: var(--dashboard-page-max-width, 1000px);
  margin: 0 auto;
  padding: 12px;
}

.home-progressive-sections {
  display: grid;
  gap: var(--space-xl);
}

.home-progressive-sections > turbo-frame {
  display: block;
  min-width: 0;
}

/* Primary home action: one click into today's page */
.quick-write {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(200, 184, 154, 0.13) 1px, transparent 1px),
    linear-gradient(135deg, var(--paper-aged), #fcfaf5);
  background-size: 28px 100%, auto;
  border: 1px solid var(--sepia-line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.quick-write::after {
  content: "";
  position: absolute;
  inset: 0;
  border-left: 4px solid var(--leather-brown);
  pointer-events: none;
}

.quick-write__date {
  display: flex;
  width: 58px;
  min-height: 64px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-dark);
  background: var(--paper-warm);
  border: 1px solid var(--sepia-line);
  border-radius: 8px;
  font-family: var(--font-serif);
  line-height: 1;
}

.quick-write__day {
  font-size: var(--text-xl);
}

.quick-write__month {
  margin-top: var(--space-xs);
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quick-write__eyebrow {
  margin: 0 0 var(--space-xs);
  color: var(--leather-brown);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quick-write__title {
  margin: 0;
  color: var(--ink-dark);
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
}

.quick-write__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.quick-write__destination {
  margin: var(--space-xs) 0 0;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

.quick-write__status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-sm);
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
}

.quick-write__status-dot {
  width: 8px;
  height: 8px;
  background: var(--sepia-line);
  border-radius: 50%;
}

.quick-write__status-dot--complete {
  background: #5f7d61;
  box-shadow: 0 0 0 3px rgba(95, 125, 97, 0.14);
}

.quick-write__journal {
  color: var(--ink-dark);
  font-weight: 600;
}

.quick-write__action {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: var(--space-xs);
}

.quick-write__button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  color: var(--paper-aged);
  background: var(--leather-brown);
  border: 1px solid var(--leather-brown);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.home-consolidated-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr);
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.home-return-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.4fr);
  align-items: stretch;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.home-return-grid > .continue-writing-section,
.home-return-grid > turbo-frame,
.home-return-grid .random-memory-card {
  min-width: 0;
  height: 100%;
  margin-bottom: 0;
}

.home-return-grid .continue-writing-grid {
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

.home-return-grid .continue-writing-section {
  padding: var(--space-md);
  background: rgba(252, 250, 245, 0.72);
  border: 1px solid var(--paper-shadow);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.home-consolidated-grid > .home-card,
.home-consolidated-grid > turbo-frame,
.home-consolidated-grid .full-width-card {
  min-width: 0;
  margin-bottom: 0;
}

/* Compact diary composer, rendered as a bottom sheet on mobile. */
.diary-create-modal[hidden] {
  display: none;
}

.diary-create-modal {
  position: fixed;
  z-index: 1200;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: rgba(42, 37, 32, 0.55);
  opacity: 0;
  backdrop-filter: blur(4px);
  transition: opacity 180ms ease;
}

.diary-create-modal.is-open {
  opacity: 1;
}

.diary-create-modal__sheet {
  --checkin-sheet-padding: var(--space-lg);
  width: min(680px, 100%);
  max-height: min(860px, calc(100vh - 32px));
  overflow-y: auto;
  padding: var(--space-lg);
  color: var(--ink-dark);
  background: var(--paper-aged);
  background-image: linear-gradient(rgba(200, 184, 154, 0.18) 1px, transparent 1px);
  background-size: 100% 32px;
  border: 1px solid var(--sepia-line);
  border-radius: 14px;
  box-shadow: var(--shadow-xl);
  transform: translateY(12px) scale(0.98);
  transition: transform 180ms ease;
}

.diary-create-modal.is-open .diary-create-modal__sheet {
  transform: translateY(0) scale(1);
}

.diary-create-modal__header {
  position: sticky;
  top: calc(-1 * var(--checkin-sheet-padding));
  z-index: 30;
  margin: calc(-1 * var(--checkin-sheet-padding)) calc(-1 * var(--checkin-sheet-padding)) var(--space-md);
  padding: var(--checkin-sheet-padding);
  background: var(--paper-aged);
  border-bottom: 1px solid var(--sepia-line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.diary-create-modal__eyebrow {
  margin: 0 0 2px;
  color: var(--ink-soft);
  font: var(--text-xs) var(--font-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.diary-create-modal__header h2 {
  margin: 0;
  font: 600 var(--text-xl) var(--font-serif);
}

.diary-create-modal__close {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid var(--sepia-line);
  border-radius: 50%;
  font-size: 26px;
  cursor: pointer;
}

.diary-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
}

.diary-create-form__field {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-xs);
}

.diary-create-form__field[hidden] {
  display: none;
}

.diary-create-form label,
.diary-create-form__label-row label {
  color: var(--ink-dark);
  font: 600 var(--text-sm) var(--font-sans);
}

.diary-create-form textarea,
.diary-create-form input[type="text"],
.diary-create-form input[type="datetime-local"] {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  color: var(--ink-dark);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--sepia-line);
  border-radius: 8px;
  font: var(--text-md) var(--font-serif);
}

.diary-create-form textarea {
  min-height: 164px;
  resize: vertical;
  line-height: 2rem;
  background-image: linear-gradient(transparent 31px, rgba(107, 98, 88, 0.13) 32px);
  background-size: 100% 32px;
}

.diary-create-form input[type="datetime-local"] {
  min-height: 44px;
  font-family: var(--font-sans);
}

.diary-create-form textarea:focus,
.diary-create-form input:focus-visible,
.diary-create-form button:focus-visible,
.diary-create-modal__close:focus-visible {
  outline: 3px solid rgba(158, 42, 43, 0.24);
  outline-offset: 2px;
}

.diary-create-form__label-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
}

.diary-create-form__label-row output {
  color: var(--leather-brown);
  font: 600 var(--text-sm) var(--font-sans);
}

.diary-create-form input[type="range"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 0;
  accent-color: var(--leather-brown);
  cursor: pointer;
}

.diary-create-form__range-labels {
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
  font: var(--text-xs) var(--font-sans);
}

.diary-create-form__details {
  padding: var(--space-sm) 0;
  border-block: 1px solid rgba(200, 184, 154, 0.65);
}

.diary-create-form__details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--leather-brown);
  font: 600 var(--text-sm) var(--font-sans);
  cursor: pointer;
}

.diary-create-form__details summary > span:first-child {
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.diary-create-form__details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  overflow: hidden;
}

.diary-create-form__field--wide {
  grid-column: 1 / -1;
}

.checkin-form__emotion-picker {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  min-width: 0;
}

.diary-create-form__emotions {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  gap: var(--space-xs);
  padding: 2px 0 var(--space-sm);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--sepia-line) transparent;
  scrollbar-width: thin;
}

.diary-create-form__emotion {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  min-height: 58px;
  padding: 0;
  place-items: center;
  gap: 2px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.diary-create-form__emotion:hover {
  color: var(--ink-dark);
  background: color-mix(in srgb, var(--paper-warm) 58%, transparent);
}

.diary-create-form__emotion-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  background: var(--paper-warm);
  border: 1px solid var(--sepia-line);
  border-radius: 50%;
  font: 400 var(--text-md) var(--font-sans);
  overflow: hidden;
  white-space: nowrap;
}

.diary-create-form__emotion-label {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  font: 500 var(--text-xs) var(--font-sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diary-create-form__emotion.selected {
  color: var(--leather-brown);
}

.diary-create-form__emotion.selected .diary-create-form__emotion-icon {
  color: var(--paper-aged);
  background: var(--leather-brown);
  border-color: var(--leather-brown);
}

.diary-create-form__emotion--more {
  color: var(--leather-brown);
}

.diary-create-form__emotion--more .diary-create-form__emotion-icon {
  background: transparent;
  border-style: dashed;
  letter-spacing: 1px;
}

.checkin-form__emotion-custom {
  flex: 0 0 48px;
  min-width: 0;
}

.checkin-form__emotion-custom.is-open {
  flex-basis: 200px;
}

.diary-create-form .checkin-form__emotion-custom .checkin-form__emotion-search {
  width: 100%;
  max-width: none;
}

.checkin-form__emotion-custom > [hidden] {
  display: none;
}

.diary-create-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  color: var(--ink-soft);
  font: var(--text-xs) var(--font-sans);
}

.diary-create-form__submit {
  min-height: 44px;
  padding: 10px var(--space-lg);
  color: var(--paper-aged);
  background: var(--leather-brown);
  border: 0;
  border-radius: 8px;
  font: 600 var(--text-sm) var(--font-sans);
  cursor: pointer;
}

.diary-create-form__submit:disabled {
  color: var(--ink-soft);
  background: var(--paper-warm);
  border: 1px solid var(--sepia-line);
  cursor: not-allowed;
  opacity: 0.78;
}

.quick-write__button:hover {
  color: var(--paper-aged);
  background: var(--ink-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.quick-write__button:focus-visible {
  outline: 3px solid var(--sepia-line);
  outline-offset: 3px;
}

.quick-write__button--secondary {
  color: var(--leather-brown);
  background: transparent;
}

.quick-write__hint {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
}

@media (prefers-reduced-motion: reduce) {
  .quick-write__button,
  .diary-create-modal,
  .diary-create-modal__sheet,
  .diary-create-form__details summary > span:first-child {
    transition: none;
  }
}

/* 1. Welcome & Streak Banner */
.home-welcome-banner {
  background: linear-gradient(135deg, #FCFAF5 0%, #F5EFEB 100%);
  border: 1px solid var(--paper-shadow);
  border-left: 4px solid var(--action-primary, #9E2A2B);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.welcome-banner-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}


.welcome-title {
  font-family: var(--font-serif);
  font-size: 26px;
  color: var(--ink-dark);
  margin: 0 0 6px 0;
  font-weight: 700;
}

.welcome-subtitle {
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0 0 16px 0;
  font-family: var(--font-sans);
}

.welcome-stats {
  display: flex;
  gap: 12px;
}

.welcome-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(201, 168, 106, 0.08);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--ink-primary);
  font-family: var(--font-sans);
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #FF6B6B, #FF8E53);
  padding: 10px 20px;
  border-radius: 50px;
  color: white;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.2);
}

.streak-fire {
  font-size: 24px;
}

.streak-details {
  display: flex;
  flex-direction: column;
}

.streak-number {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.streak-label {
  font-family: var(--font-sans);
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.95;
}

/* 2. Main Dashboard Grid */
.home-grid {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr;
  gap: 12px;
  margin-bottom: 16px;
  align-items: start;
}

.home-main-col,
.home-side-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}


.home-card {
  background: #FFFFFF;
  border: 1px solid var(--paper-shadow);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.home-card:hover {
  box-shadow: var(--shadow-md);
}

.home-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px dashed rgba(200, 184, 154, 0.3);
  padding-bottom: 12px;
}

.home-card-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}


.home-card-icon {
  font-size: 20px;
}

.home-card-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-dark);
  margin: 0;
  flex: 1;
}

.home-shuffle-btn {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--action-primary);
  background: rgba(158, 42, 43, 0.05);
  border: 1px solid rgba(158, 42, 43, 0.15);
  padding: 4px 10px;
  border-radius: 15px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
}

.home-shuffle-btn:hover {
  background: var(--action-primary);
  color: white !important;
  border-color: var(--action-primary);
}

/* Card items styling */
.on-this-day-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.on-this-day-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  padding-bottom: 16px;
}

.on-this-day-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-soft);
  font-family: var(--font-sans);
}

.item-year {
  background: var(--action-primary);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.item-title {
  margin: 8px 0;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
}

.memory-title-link {
  display: inline-block;
  min-width: 24px;
  min-height: 24px;
  max-width: 100%;
  color: var(--ink-primary);
  text-decoration: none !important;
}

.memory-title-link:hover {
  color: var(--leather-brown);
}

.item-preview {
  padding: 12px 16px;
  background-color: var(--paper-base);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-primary);
  max-height: 100px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(0,0,0,0.03);
}

.item-preview::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 35px;
  background: linear-gradient(to top, var(--paper-base), transparent);
  pointer-events: none;
}

.empty-dashboard-state {
  text-align: center;
  padding: 24px 12px;
  color: var(--ink-soft);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
}

.empty-action-btn {
  display: inline-block;
  margin-top: 12px;
  background-color: var(--paper-base);
  border: 1.5px dashed var(--sepia-line);
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--action-primary);
  text-decoration: none !important;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.empty-action-btn:hover {
  border-style: solid;
  border-color: var(--action-primary);
  background-color: rgba(158, 42, 43, 0.03);
}

/* Weekly Mood list */
.mood-tracker-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mood-tracker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mood-day-label {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink-muted);
  width: 32px;
}

.mood-emoji {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.mood-tracker-bar-wrapper {
  flex: 1;
  height: 8px;
  background-color: var(--paper-base);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.mood-tracker-bar-fill {
  height: 100%;
  border-radius: 4px;
}

.mood-score-text {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  width: 36px;
  text-align: right;
}

/* Photo Grid widget */
.home-snapshots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.home-polaroid-link {
  text-decoration: none;
  display: block;
  transition: transform 0.2s ease;
}

.home-polaroid-link:hover {
  transform: scale(1.05) rotate(2deg);
}

.home-polaroid {
  padding: 6px 6px 16px 6px;
  background: white;
  border: 1px solid var(--paper-shadow);
  box-shadow: 0 4px 8px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.home-polaroid-img-wrapper {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background-color: var(--paper-base);
  border: 1px solid rgba(0,0,0,0.04);
}

.home-polaroid-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.encrypted-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: var(--paper-base);
  color: var(--ink-soft);
  font-size: 16px;
}

/* 3. Bottom Journal Shelf */
.journal-shelf-section {
  border-top: 1px dashed var(--sepia-line);
  padding-top: 32px;
  margin-top: 16px;
}

.journal-shelf-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.journal-shelf-icon {
  font-size: 24px;
}

.journal-shelf-title {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--ink-dark);
  margin: 0;
  font-weight: 600;
}

.shelf-book-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 16px;
}

.shelf-book-row .journal-card-wrapper {
  width: 160px;
}

.shelf-book-row .journal-card {
  width: 160px;
  height: auto;
}

.shelf-book-row .journal-card__cover {
  height: 180px;
}

/* Side-by-side "On This Day" Grid */
.on-this-day-section-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
}

/* --- RESPONSIVE --- */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* MOBILE — Home Dashboard (≤ 768px)                       */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 768px) {

  /* ── Container ─────────────────────────────────────────── */
  .home-dashboard {
    padding: 10px 12px 24px;
  }

  .quick-write {
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--space-sm) var(--space-md);
    padding: var(--space-md);
  }

  .quick-write__action {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  .quick-write__button {
    width: 100%;
  }

  .home-consolidated-grid {
    grid-template-columns: 1fr;
  }

  .home-return-grid {
    grid-template-columns: 1fr;
  }

  .diary-create-modal {
    align-items: flex-end;
    padding: 0;
  }

  .diary-create-modal__sheet {
    --checkin-sheet-padding: var(--space-md);
    width: 100%;
    max-height: 92dvh;
    padding: var(--space-md);
    border-radius: 18px 18px 0 0;
    transform: translateY(28px);
  }

  .diary-create-form__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .diary-create-modal .diary-create-form__footer {
    position: sticky;
    z-index: 20;
    bottom: calc(-1 * var(--space-md));
    margin: 0 calc(-1 * var(--space-md)) calc(-1 * var(--space-md));
    padding: var(--space-md);
    background: var(--paper-aged);
    border-top: 1px solid var(--sepia-line);
    box-shadow: 0 -10px 18px rgba(42, 37, 32, 0.06);
  }

  .diary-create-modal .diary-protection {
    align-self: flex-start;
  }

  .diary-create-form__submit {
    width: 100%;
  }

  /* ── Welcome Banner ─────────────────────────────────────── */
  .home-welcome-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
    border-left-width: 3px;
    border-radius: 10px;
  }

  .welcome-title {
    font-size: 20px;
    margin-bottom: 4px;
  }

  .welcome-subtitle {
    font-size: 12px;
    margin-bottom: 10px;
  }

  .welcome-stats {
    flex-wrap: wrap;
    gap: 8px;
  }

  .welcome-stat-pill {
    font-size: 12px;
    padding: 5px 10px;
    gap: 4px;
  }

  .welcome-right {
    display: flex;
    justify-content: flex-start;
  }

  .streak-badge {
    padding: 8px 14px;
    gap: 8px;
    align-self: flex-start;
  }

  .streak-fire {
    font-size: 20px;
  }

  .streak-number {
    font-size: 18px;
  }

  /* ── Main Two-Column → Single Column ────────────────────── */
  .home-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
  }

  /* ── Home Cards ─────────────────────────────────────────── */
  .home-card {
    padding: 14px;
    border-radius: 10px;
  }

  .home-card-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
    gap: 8px;
  }

  .home-card-icon {
    font-size: 18px;
  }

  .home-card-title {
    font-size: 16px;
  }

  /* ── Memory / On This Day items ─────────────────────────── */
  .item-title {
    font-size: 15px;
    margin: 6px 0;
  }

  .item-preview {
    font-size: 13px;
    padding: 9px 12px;
    max-height: 80px;
  }

  .on-this-day-list {
    gap: 14px;
  }

  .on-this-day-item {
    padding-bottom: 12px;
  }

  /* ── On This Day: 2-col inner grid → 1-col on mobile ───── */
  .on-this-day-section-wrapper {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* ── Mood Tracker ───────────────────────────────────────── */
  .mood-tracker-header {
    align-items: flex-start;
  }

  .mood-tracker-header-left {
    align-items: flex-start;
  }

  .mood-tracker-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 16px;
  }

  .mood-tracker-subtitle {
    font-size: 11px;
    max-width: none;
  }

  .mood-share-button {
    display: none;
  }

  .mood-range-selector {
    align-self: flex-start;
    width: 100%;
    overflow-x: auto;
    padding: 4px;
    gap: 4px;
  }

  .mood-range-btn {
    flex: 1 0 auto;
    text-align: center;
    padding: 6px 12px;
  }

  .mood-tracker-summary {
    gap: 6px;
  }

  .mood-tracker-chip {
    font-size: 10px;
    padding: 6px 9px;
  }

  .mood-tracker-caption {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .mood-tracker-caption__muted {
    font-size: 10px;
  }

  .mood-chart-container {
    padding: 12px 8px 10px;
    border-radius: 18px;
  }

  .chart-day-label {
    font-size: 7.5px;
  }

  .chart-y-axis-number {
    font-size: 7px;
  }

  .chart-point-emoji {
    font-size: 10px;
  }

  .mood-tracker-legend {
    justify-content: flex-start;
    gap: 6px;
  }

  .mood-tracker-legend-item {
    font-size: 9px;
    padding: 4px 7px;
  }

  /* ── Diary Highlights: 3-col → 2-col ───────────────────── */
  .diary-highlights-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
  }

  /* First child spans full width when there are 3 items */
  .diary-highlights-row .diary-highlight-card:first-child:nth-last-child(3) {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .diary-highlight-card {
    padding: 10px;
    border-radius: 8px;
    gap: 5px;
  }

  .diary-highlight-score-value {
    font-size: 20px;
  }

  .diary-highlight-emoji {
    font-size: 18px;
  }

  .diary-highlight-date {
    font-size: 10px;
  }

  .diary-highlight-note {
    font-size: 11px;
    -webkit-line-clamp: 1;
  }

  /* ── Snapshots Grid ─────────────────────────────────────── */
  .home-snapshots-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  /* ── Journal Shelf ──────────────────────────────────────── */
  .journal-shelf-section {
    padding-top: 18px;
    margin-top: 10px;
  }

  .journal-shelf-title {
    font-size: 17px;
  }

  .shelf-book-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .shelf-book-row::-webkit-scrollbar {
    display: none;
  }

  .shelf-book-row .journal-card-wrapper {
    flex: 0 0 auto;
    width: 130px;
  }

  .shelf-book-row .journal-card {
    width: 130px;
    height: auto;
  }

  .journal-card__cover {
    height: 140px;
  }

  .journal-card__info {
    padding: 10px 12px;
    min-height: 56px;
  }

  .journal-card__title {
    font-size: 13px;
  }

  .journal-card__meta {
    font-size: 11px;
  }

  /* ── Following Feed ─────────────────────────────────────── */
  .following-feed-item {
    padding: 10px 0;
    gap: 10px;
  }

  .following-feed-avatar {
    width: 30px;
    height: 30px;
    font-size: 12px;
    flex-shrink: 0;
  }

  .following-feed-title {
    font-size: 13px;
    -webkit-line-clamp: 1;
  }

  .following-feed-journal {
    max-width: 90px;
  }
}

/* ── Tiny phones (≤ 390px) ──────────────────────────────── */
@media (max-width: 390px) {
  .home-dashboard {
    padding: 8px 10px 20px;
  }

  .quick-write__date {
    width: 50px;
    min-height: 58px;
  }

  .quick-write__title {
    font-size: var(--text-md);
  }

  .quick-write__action {
    grid-template-columns: 1fr;
  }

  .quick-write__hint {
    grid-column: auto;
  }

  .diary-create-form__details-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .diary-create-form__field--wide {
    grid-column: auto;
  }

  .home-card {
    padding: 12px;
  }

  .welcome-title {
    font-size: 18px;
  }

  .diary-highlights-row {
    grid-template-columns: 1fr;
  }

  .diary-highlights-row .diary-highlight-card:first-child:nth-last-child(3) {
    grid-column: auto;
    flex-direction: column;
  }

  .home-snapshots-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* On This Day - Lane details and Badges */
.item-type-badge {
  font-family: var(--font-sans);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.memory-badge {
  background-color: rgba(200, 184, 154, 0.25);
  color: var(--ink-primary);
}

.diary-badge {
  background-color: rgba(158, 42, 43, 0.08);
  color: var(--action-primary);
}

.diary-checkin-quick-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-muted);
  margin: 8px 0;
  align-items: center;
  font-family: var(--font-sans);
}

.diary-emotion {
  font-weight: 600;
  color: var(--ink-dark);
}

.diary-mood-score {
  background: rgba(0, 0, 0, 0.03);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.02);
}

.diary-location {
  color: var(--ink-soft);
}

.journal-shelf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.journal-shelf-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.journal-shelf-view-all {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--action-primary);
  text-decoration: none !important;
  font-weight: 600;
  transition: color 0.2s;
}

.journal-shelf-view-all:hover {
  color: var(--ink-dark);
}



/* Text Word wrapping safety for long unbroken strings (e.g. text viết liền, URLs) */
.home-card,
.random-memory-item,
.on-this-day-item,
.item-title,
.item-preview {
  word-wrap: break-word !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  max-width: 100% !important;
}

/* Mood Tracker Modern Surface */
.full-width-mood-tracker {
  margin-bottom: 12px;
  width: 100%;
  box-sizing: border-box;
}

.mood-tracker-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98) 0%, rgba(250, 245, 238, 0.96) 100%);
  border-color: rgba(158, 42, 43, 0.08);
}

.mood-tracker-card::before,
.mood-tracker-card::after {
  content: "";
  position: absolute;
  inset: auto;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(2px);
  opacity: 0.8;
}

.mood-tracker-card::before {
  width: 160px;
  height: 160px;
  top: -72px;
  right: -56px;
  background: radial-gradient(circle, rgba(158, 42, 43, 0.12) 0%, rgba(158, 42, 43, 0) 72%);
}

.mood-tracker-card::after {
  width: 220px;
  height: 220px;
  left: -110px;
  bottom: -120px;
  background: radial-gradient(circle, rgba(243, 196, 89, 0.16) 0%, rgba(243, 196, 89, 0) 72%);
}

.mood-tracker-header {
  align-items: flex-start;
}

.mood-tracker-header-left {
  align-items: flex-start;
}

.mood-tracker-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(158, 42, 43, 0.08);
  border: 1px solid rgba(158, 42, 43, 0.14);
  box-shadow: 0 12px 22px -18px rgba(158, 42, 43, 0.6);
  flex: 0 0 auto;
}

.mood-tracker-heading {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mood-tracker-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.mood-share-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) 12px;
  border: 1px solid var(--sepia-line);
  border-radius: 999px;
  background: var(--paper-aged);
  color: var(--ink-dark);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.mood-share-button:hover {
  border-color: var(--leather-brown);
  background: var(--paper-warm);
  transform: translateY(-1px);
}

.mood-share-button:focus-visible {
  outline: 2px solid var(--action-primary);
  outline-offset: 2px;
}

.mood-share-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.mood-share-status {
  min-width: 0;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
}

.mood-tracker-subtitle {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 34ch;
}

.mood-tracker-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.mood-tracker-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  border-radius: 0 0 18px 18px;
  background: rgba(250, 245, 238, 0.82);
  backdrop-filter: blur(3px);
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.mood-tracker-loading__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(158, 42, 43, 0.18);
  border-top-color: var(--action-primary);
  border-radius: 50%;
  animation: mood-tracker-spin 700ms linear infinite;
}

#home-mood[busy] .mood-tracker-loading,
#mood-tracker-card[busy] .mood-tracker-loading {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#home-mood[busy] .mood-range-btn,
#mood-tracker-card[busy] .mood-range-btn {
  pointer-events: none;
}

@keyframes mood-tracker-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mood-tracker-loading,
  .mood-tracker-loading__spinner {
    animation: none;
    transition: none;
  }
}

.mood-range-selector {
  display: flex;
  align-self: center;
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(200, 184, 154, 0.32);
  box-shadow: 0 10px 18px -18px rgba(0, 0, 0, 0.35);
}

.mood-range-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.mood-range-btn:hover,
.mood-range-btn:focus-visible {
  color: var(--ink-dark);
  background: rgba(255, 255, 255, 0.88);
}

.mood-range-btn.is-active {
  color: var(--action-primary);
  background: #fff;
  box-shadow: 0 6px 14px -12px rgba(158, 42, 43, 0.6);
}

.mood-tracker-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mood-tracker-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(200, 184, 154, 0.34);
  background: rgba(255, 255, 255, 0.76);
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1;
  color: var(--ink-muted);
  box-shadow: 0 12px 18px -18px rgba(0, 0, 0, 0.35);
}

.mood-tracker-chip strong {
  color: var(--ink-dark);
  font-weight: 700;
}

.mood-tracker-chip--accent {
  background: rgba(158, 42, 43, 0.08);
  color: var(--action-primary);
  border-color: rgba(158, 42, 43, 0.16);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* Diary Highlights (Best / Lowest / Most Photos)          */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.diary-highlights-title {
  margin: var(--space-lg) 0 var(--space-sm);
  color: var(--ink-soft);
  font: 500 var(--text-sm) var(--font-sans);
}

.diary-highlights-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
  border-top: 1px dashed rgba(200, 184, 154, 0.35);
  padding-top: 16px;
}

.diary-highlight-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 12px 10px;
  background: var(--paper-base);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  text-decoration: none !important;
  color: inherit !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

.diary-highlight-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* Label badge pill */
.diary-highlight-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  align-self: flex-start;
  margin-bottom: 2px;
}

.diary-highlight-badge--high {
  background: rgba(250, 204, 21, 0.15);
  color: #b45309;
  border: 1px solid rgba(250, 204, 21, 0.35);
}

.diary-highlight-badge--low {
  background: rgba(99, 102, 241, 0.1);
  color: #4338ca;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.diary-highlight-badge--photos {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.diary-highlight-icon {
  font-size: 11px;
}

.diary-highlight-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Mood score row: emoji + number */
.diary-highlight-score {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.diary-highlight-emoji {
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.08));
}

.diary-highlight-score-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-dark);
  font-family: var(--font-sans);
  line-height: 1;
}

.diary-highlight-score-max {
  font-size: 11px;
  color: var(--ink-muted);
  font-weight: 500;
}

.diary-highlight-date {
  font-size: 11px;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-weight: 500;
}

.diary-highlight-note {
  font-family: var(--font-serif);
  font-size: 12px;
  color: var(--ink-body);
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-style: italic;
}

.diary-highlight-photo-count {
  font-size: 10px;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: auto;
  padding-top: 4px;
}

/* Revisit Memory card link styles */
.random-memory-item-link {
  text-decoration: none !important;
  color: inherit !important;
  display: block;
}

.random-memory-item-link:hover .random-memory-item {
  transform: translateY(-2px);
}

.random-memory-item {
  transition: transform 0.2s ease;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* Following Feed                                           */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.following-feed-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Each row is a clickable memory card from the feed */
.following-feed-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  text-decoration: none !important;
  color: inherit !important;
  transition: background 0.15s ease;
  border-radius: 6px;
  position: relative;
}

.following-feed-item:last-child {
  border-bottom: none;
}

.following-feed-item:hover {
  background: rgba(0, 0, 0, 0.02);
  padding-left: 6px;
  padding-right: 6px;
  margin-left: -6px;
  margin-right: -6px;
}

/* Circle avatar with initial */
.following-feed-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #9E2A2B 0%, #C8874A 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-serif);
  box-shadow: 0 2px 6px rgba(158, 42, 43, 0.25);
  letter-spacing: 0;
}

.following-feed-content {
  flex: 1;
  min-width: 0;
}

.following-feed-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 3px;
}

.following-feed-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-dark);
  font-family: var(--font-sans);
}

.following-feed-separator {
  font-size: 10px;
  color: var(--ink-muted);
}

.following-feed-journal {
  font-size: 11px;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.following-feed-title {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-dark);
  margin: 0 0 3px 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.following-feed-time {
  font-size: 11px;
  color: var(--ink-muted);
  font-family: var(--font-sans);
}

/* All Snapshots Page Styling */
.snapshots-page-container {
  padding: 0 var(--space-md) var(--space-md);
  max-width: 1200px;
  margin: 0 auto;
}

.snapshots-page-header { margin-bottom: var(--space-lg); }
.snapshots-page-title { margin: 0; color: var(--ink-dark); font: 400 var(--text-xl)/1.4 var(--font-serif); }

.snapshots-page-body .home-snapshots-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: var(--space-md) !important;
}

@media (max-width: 992px) {
  .snapshots-page-body .home-snapshots-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 576px) {
  .snapshots-page-body .home-snapshots-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--space-sm) !important;
  }
}

/* Redesigned On This Day Section (Mobile-First) */
.on-this-day-dashboard-card {
  margin-bottom: 24px;
}

.on-this-day-subtitle-badge {
  font-size: 11px;
  background: var(--paper-shadow);
  color: var(--ink-soft);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
}

.on-this-day-grid-redesigned {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.otd-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px dashed var(--sepia-line);
}

.otd-column:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.otd-column-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.otd-column-emoji {
  font-size: 20px;
}

.otd-column-title-box {
  display: flex;
  flex-direction: column;
}

.otd-column-title {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--ink-dark);
  margin: 0;
  font-weight: 600;
}

.otd-column-date {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-soft);
}

.otd-column-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.otd-more-entries {
  border-top: 1px dashed var(--sepia-line);
  padding-top: var(--space-xs);
}

.otd-more-entries__summary {
  align-items: center;
  color: var(--ink-dark);
  cursor: pointer;
  display: flex;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  justify-content: space-between;
  list-style: none;
  min-height: 44px;
}

.otd-more-entries__summary::-webkit-details-marker {
  display: none;
}

.otd-more-entries__summary:focus-visible {
  outline: 2px solid var(--ink-dark);
  outline-offset: 2px;
}

.otd-more-entries__chevron {
  font-size: 18px;
  line-height: 1;
  transition: transform 180ms ease;
}

.otd-more-entries[open] .otd-more-entries__chevron {
  transform: rotate(180deg);
}

.otd-more-entries__content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .otd-more-entries[open] > .otd-more-entries__content {
    animation: otd-more-entries-reveal 180ms ease-out;
  }
}

@keyframes otd-more-entries-reveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Empty State */
.otd-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px dashed rgba(200, 184, 154, 0.5);
  border-radius: 6px;
  text-align: center;
}

.otd-empty-emoji {
  font-size: 18px;
  opacity: 0.6;
  margin-bottom: 6px;
}

.otd-empty-text {
  font-size: 12px;
  color: var(--ink-muted);
  margin: 0;
}

/* Cards (Diary and Memory) */
.otd-entry-card {
  background: #ffffff;
  border: 1px solid var(--paper-shadow);
  border-radius: 6px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.otd-entry-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.otd-card-inner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.otd-card-main {
  flex: 1;
  min-width: 0;
}

.otd-card-header-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 4px;
}

.otd-card-time {
  font-family: var(--font-sans);
}

.otd-card-mood {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
  font-weight: 500;
}

.otd-card-journal {
  font-family: var(--font-sans);
  font-weight: 500;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.otd-mood-badge-num {
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(43, 42, 39, 0.05);
}

/* Specific score styles (warm tones consistent with mood heatmap) */
.otd-mood-badge-num.mood-score-10,
.otd-mood-badge-num.mood-score-9 {
  background: #E2F0D9;
  color: #385723;
}
.otd-mood-badge-num.mood-score-1,
.otd-mood-badge-num.mood-score-2 {
  background: #FCE4D6;
  color: #C65911;
}

.otd-card-note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-dark);
  margin-bottom: 8px;
  max-height: 80px;
  overflow-y: auto;
}

.otd-card-location-whom {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  opacity: 0.85;
}

.otd-card-actions {
  display: none;
  gap: 8px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed rgba(0, 0, 0, 0.04);
}

.otd-entry-card:hover .otd-card-actions,
.otd-entry-card:focus-within .otd-card-actions {
  display: flex;
}

@media (hover: none) {
  .otd-card-actions {
    display: flex;
  }
}

.otd-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: none;
  padding: var(--space-xs) var(--space-sm);
  font-size: 11px;
  font-family: var(--font-sans);
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.2s;
}

.otd-action-btn:hover {
  opacity: 1;
}

.otd-action-edit {
  color: var(--ink-primary);
}

.otd-action-delete {
  color: var(--danger);
}

/* Image styling */
.otd-card-photo-wrapper {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1.5px solid white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transform: rotate(2deg);
  background: var(--paper-shadow);
}

/* Memory title */
.otd-memory-title {
  font-family: var(--font-serif);
  font-size: 13px;
  margin: 0 0 6px 0;
  line-height: 1.4;
}

.otd-memory-title .memory-title-link {
  color: var(--ink-dark);
  text-decoration: none;
  font-weight: 600;
}

.otd-memory-title .memory-title-link:hover {
  color: var(--leather-brown);
}

/* Upgraded Grid on Desktop/Large Screen Devices */
@media (min-width: 769px) {
  .on-this-day-grid-redesigned {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .otd-column {
    border-bottom: none;
    border-right: 1px dashed var(--sepia-line);
    padding-bottom: 0;
    padding-right: 16px;
  }

  .otd-column:last-child {
    border-right: none;
    padding-right: 0;
  }
}

/* Continue Writing Section (Drafts) */
.continue-writing-section {
  margin-bottom: 28px;
}

.continue-writing-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 6px;
}

.continue-writing-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-dark);
  margin: 0;
}

.continue-writing-subtitle {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-soft);
  font-style: italic;
}

.continue-writing-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.continue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #ffffff;
  border: 1.5px solid var(--paper-shadow);
  border-radius: 8px;
  text-decoration: none;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.01);
  min-width: 0;
  max-width: 100%;
}

.continue-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.04);
  border-color: var(--sepia-line);
}

.continue-card-badge {
  position: absolute;
  top: 8px;
  right: 12px;
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
}

.continue-card-badge.text-journal {
  background: rgba(142, 68, 173, 0.08);
  color: #8e44ad;
}

.continue-card-badge.text-memory {
  background: rgba(230, 126, 34, 0.08);
  color: #d35400;
}

.continue-card-badge.text-diary {
  background: rgba(39, 174, 96, 0.08);
  color: #27ae60;
}

.continue-card-body-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.continue-card-cover-mini {
  width: 32px;
  height: 42px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1.5px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.06);
}

.continue-card-icon-mini {
  width: 32px;
  height: 42px;
  border-radius: 3px;
  background: rgba(230, 126, 34, 0.04);
  border: 1.5px dashed rgba(230, 126, 34, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.continue-card-mood-mini {
  width: 32px;
  height: 42px;
  border-radius: 3px;
  background: rgba(39, 174, 96, 0.04);
  border: 1.5px dashed rgba(39, 174, 96, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.continue-mood-emoji {
  font-size: 13px;
  line-height: 1.1;
}

.continue-mood-score {
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 700;
  color: #27ae60;
  line-height: 1.1;
}

.continue-card-info {
  flex: 1;
  min-width: 0;
  padding-top: 6px;
}

.continue-card-name {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-dark);
  margin: 0 0 3px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 50px; /* Space for absolute badge */
}

.continue-card-meta {
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.continue-card-arrow {
  font-size: 13px;
  color: var(--ink-muted);
  transition: transform 0.2s ease, color 0.2s ease;
  margin-left: 8px;
}

.continue-card:hover .continue-card-arrow {
  transform: translateX(3px);
  color: var(--ink-dark);
}

@media (min-width: 769px) {
  .continue-writing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

/* Embedded styles inside Welcome Banner */
.home-welcome-banner .continue-writing-section {
  border-top: 1px solid rgba(200, 184, 154, 0.22);
  padding-top: 16px;
  margin-bottom: 0;
}

.home-welcome-banner .continue-writing-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  font-family: var(--font-sans);
}

.home-welcome-banner .continue-writing-subtitle {
  font-size: 10px;
}

.home-welcome-banner .continue-card {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(200, 184, 154, 0.25);
  box-shadow: none;
}

.home-welcome-banner .continue-card:hover {
  background: #ffffff;
  border-color: var(--action-primary, #9E2A2B);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

/* Final mobile overrides: these must follow the base highlight styles above. */
@media (max-width: 768px) {
  #quick-write-today {
    grid-template-columns: 48px minmax(0, 1fr);
    column-gap: 12px;
    padding: 12px;
  }

  #quick-write-today .quick-write__date {
    width: 46px;
    min-height: 54px;
  }

  #quick-write-today .quick-write__day {
    font-size: 23px;
  }

  #quick-write-today .quick-write__eyebrow {
    margin-bottom: 2px;
    font-size: 10px;
  }

  #quick-write-today .quick-write__title {
    font-size: 17px;
    line-height: 1.2;
  }

  #quick-write-today .quick-write__status {
    margin-top: 6px;
    line-height: 1.3;
  }

  #quick-write-today .quick-write__destination {
    display: -webkit-box;
    margin-top: 6px;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  #quick-write-today .quick-write__journal {
    overflow-wrap: anywhere;
  }

  #quick-write-today .quick-write__action {
    grid-column: 1 / -1;
    min-width: 0;
  }

  #quick-write-today .quick-write__button {
    min-width: 0;
    padding-inline: 10px;
    line-height: 1.25;
    text-align: center;
  }

  .diary-highlights-row {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
  }

  .diary-highlights-row .diary-highlight-card,
  .diary-highlights-row .diary-highlight-card:first-child:nth-last-child(3) {
    display: grid;
    grid-template-columns: minmax(100px, 1fr) auto auto;
    grid-column: auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px 10px;
  }

  .diary-highlight-badge {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    white-space: nowrap;
  }

  .diary-highlight-label {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .diary-highlight-score {
    gap: 3px;
    white-space: nowrap;
  }

  .diary-highlight-emoji {
    font-size: 17px;
  }

  .diary-highlight-score-value {
    font-size: 18px;
  }

  .diary-highlight-date {
    white-space: nowrap;
    font-size: 10px;
  }

  .diary-highlight-note,
  .diary-highlight-photo-count {
    display: none;
  }
}

@media (max-width: 560px) {
  #quick-write-today .quick-write__action {
    grid-template-columns: 1fr;
  }

  #quick-write-today .quick-write__hint {
    display: none;
  }
}

@media (max-width: 360px) {
  .diary-highlights-row .diary-highlight-card,
  .diary-highlights-row .diary-highlight-card:first-child:nth-last-child(3) {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .diary-highlight-date {
    grid-column: 1 / -1;
    padding-left: 2px;
  }
}
