:root {
  --bg: #f4f1eb;
  --bg-wash: #e8efe9;
  --ink: #1f2a24;
  --muted: #5a675f;
  --accent: #3d6b4f;
  --accent-soft: #dce8e0;
  --card: #fffdf9;
  --line: #d6d2c8;
  --shadow: 0 12px 32px rgba(47, 58, 50, 0.06);
  --radius: 18px;
  --max: 40rem;
  --font: "Literata", Georgia, serif;
}

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

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-weight: 400;
  font-optical-sizing: auto;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--bg-wash), transparent 60%),
    var(--bg);
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 0.8rem;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page {
  width: min(var(--max), calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2.25rem 0 3rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  margin-bottom: 1.75rem;
}

.wordmark {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.tagline {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.date {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  letter-spacing: 0.01em;
}

.daily {
  flex: 1;
}

.cards {
  display: grid;
  gap: 0.85rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.25rem;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.category {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.affirmation {
  margin: 0;
  font-family: "Literata", Georgia, serif;
  font-size: clamp(1.25rem, 3.2vw, 1.65rem);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.heart {
  appearance: none;
  border: 0;
  background: transparent;
  width: 44px;
  height: 44px;
  margin: -0.4rem -0.45rem -0.4rem 0;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--accent);
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0;
  line-height: 0;
}

.heart:hover {
  background: var(--accent-soft);
}

.heart svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.heart[aria-pressed="true"] svg {
  fill: currentColor;
  stroke: currentColor;
}

.heart:focus-visible,
.favorites summary:focus-visible,
.journal-past summary:focus-visible,
.journal-save:focus-visible,
.journal-entry:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.journal {
  margin-top: 0.85rem;
}

.journal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 0.35rem;
}

.journal-prompt {
  margin: 0.45rem 0 0;
  font-size: clamp(1.12rem, 2.8vw, 1.4rem);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.journal-entry {
  display: block;
  width: 100%;
  min-height: 9rem;
  margin-top: 0.9rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7f4ee;
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.55;
  resize: vertical;
}

.journal-entry::placeholder {
  color: var(--muted);
}

.journal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.9rem;
  margin-top: 0.85rem;
}

.journal-save {
  appearance: none;
  border: 1px solid transparent;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.98rem;
  font-weight: 500;
  min-height: 44px;
  padding: 0.5rem 1.15rem;
  border-radius: 999px;
  cursor: pointer;
}

.journal-save:hover {
  border-color: var(--accent);
}

.journal-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.journal-status:empty {
  display: none;
}

.journal-past {
  margin-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.journal-past summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 48px;
  padding: 0.2rem 0;
  font-weight: 500;
}

.journal-past summary::-webkit-details-marker {
  display: none;
}

.journal-past summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-left: auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.journal-past[open] summary::after {
  transform: rotate(225deg);
  translate: 0 0.15rem;
}

.journal-empty,
.journal-list {
  margin: 0 0 0.85rem;
}

.journal-empty {
  color: var(--muted);
  font-size: 0.95rem;
}

.journal-empty[hidden],
.journal-list:empty {
  display: none;
}

.journal-list {
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.65rem;
}

.journal-item {
  padding: 0.85rem 0.9rem;
  background: #f7f4ee;
  border-radius: 14px;
}

.journal-item-date {
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.journal-item-prompt {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.journal-item-text {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.favorites-wrap {
  margin-top: 1.75rem;
}

.favorites {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.35rem 0.35rem 0.5rem;
}

.favorites summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 48px;
  padding: 0.35rem 0.9rem;
  font-weight: 500;
}

.favorites summary::-webkit-details-marker {
  display: none;
}

.favorites summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-left: auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.favorites[open] summary::after {
  transform: rotate(225deg);
  translate: 0 0.15rem;
}

.fav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
}

.favorites-hint,
.favorites-list {
  margin: 0 0.9rem 0.9rem;
}

.favorites-hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.favorites-hint[hidden],
.favorites-list:empty {
  display: none;
}

.favorites-list {
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.65rem;
}

.favorite-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 0.75rem;
  align-items: start;
  padding: 0.85rem 0.7rem 0.85rem 0.9rem;
  background: #f7f4ee;
  border-radius: 14px;
}

.favorite-copy {
  min-width: 0;
}

.favorite-category {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
}

.favorite-item p {
  margin: 0;
  font-family: "Literata", Georgia, serif;
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.45;
}

.site-footer {
  margin-top: 1.15rem;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 640px) {
  .page {
    width: min(var(--max), calc(100% - 1.75rem));
    padding-top: 1.6rem;
  }

  .site-header {
    margin-bottom: 1.35rem;
  }

  .card,
  .journal-card {
    padding: 1rem 1rem 0.35rem;
  }

  .card {
    padding-bottom: 1.1rem;
  }

  .journal-save,
  .journal-status {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .favorites summary::after,
  .journal-past summary::after {
    transition: none;
  }
}
