/* Mind Poems — one poem a day, calendar grid + pop-up poems. Loaded only
   on /mind-poems/ (v3). Site fonts: Fraunces for day numbers and poem
   text, Newsreader for labels and small text, gold/silver/bronze rotating
   accents — the same three colours as the thumbnails and quote cards. */

:root {
  --poem-gold: #e8c87a;
  --poem-silver: #c0c0c0;
  --poem-bronze: #cd7f32;
}

/* Day: warm paper, never white — deepen the accents so they still read. */
html[data-theme="light"] {
  --poem-gold: #7a5a10;
  --poem-silver: #6e6e6e;
  --poem-bronze: #8a5a1d;
}

.mind-poems__intro {
  font-family: "Fraunces", Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 500;
  font-size: 1.3rem;
  line-height: 1.45;
  margin: 0.5rem 0 1.5rem;
}

.mind-poems__note {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 1.5rem 0 0;
}

/* One poem a day — the default view: a single poem card, like the pop-up
   but inline. Only one article is visible at a time; the rest (and the
   calendar, when JS hides it) stay hidden. */
.mind-poems__today-poem[hidden],
.mind-poems__calendar[hidden] {
  display: none;
}

.mind-poems__today-label {
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 1rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.mind-poems__today-poem {
  background: var(--chip-bg);
  border: 1px solid var(--line);
  border-top: 3px solid var(--poem-gold);
  border-radius: 10px;
  padding: 1.5rem 1.5rem 1.25rem;
  margin: 0 0 1rem;
}

/* Rotating accents, in poem order: gold, silver, bronze, repeat. */
.mind-poems__today-poem:nth-of-type(3n + 2) {
  border-top-color: var(--poem-silver);
}

.mind-poems__today-poem:nth-of-type(3n) {
  border-top-color: var(--poem-bronze);
}

.mind-poems__today-day {
  font-family: "Fraunces", Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--poem-gold);
  margin: 0 0 1rem;
}

.mind-poems__today-poem:nth-of-type(3n + 2) .mind-poems__today-day {
  color: var(--poem-silver);
}

.mind-poems__today-poem:nth-of-type(3n) .mind-poems__today-day {
  color: var(--poem-bronze);
}

/* Day 4 is boxed in ink on the paper — same hand-drawn border here. */
.mind-poems__today-poem.mind-poems__today-poem--boxed {
  border: 2px solid var(--text);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
}

.mind-poems__poem--today {
  font-size: 1.6rem;
  margin-bottom: 0;
}

.mind-poems__today-nav {
  margin: 0 0 1.5rem;
}

.mind-poems__calendar-link {
  margin: 0 0 1.5rem;
}

.mind-poems__calendar-toggle {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.mind-poems__calendar-toggle:hover,
.mind-poems__calendar-toggle:focus-visible {
  background: var(--chip-bg);
}

/* The calendar grid: 7 columns like the paper page, at every width. */
.mind-poems__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0;
}

.mind-poems__day {
  position: relative;
  display: block;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.35rem 0.4rem;
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text);
  font: inherit;
}

.mind-poems__num {
  font-family: "Fraunces", Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Days with a poem: a little fuller, with an ink dot. Tap to read. */
button.mind-poems__day {
  cursor: pointer;
}

button.mind-poems__day:hover,
button.mind-poems__day:focus-visible {
  background: var(--chip-bg);
}

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

.mind-poems__day--filled {
  background: var(--chip-bg);
}

.mind-poems__day--filled .mind-poems__num {
  font-size: 1.05rem;
  font-weight: 600;
}

/* Rotating accents, in filled-day order: gold, silver, bronze, repeat. */
button.mind-poems__day:nth-of-type(3n + 1) .mind-poems__num {
  color: var(--poem-gold);
}

button.mind-poems__day:nth-of-type(3n + 2) .mind-poems__num {
  color: var(--poem-silver);
}

button.mind-poems__day:nth-of-type(3n) .mind-poems__num {
  color: var(--poem-bronze);
}

.mind-poems__dot {
  position: absolute;
  right: 0.45rem;
  bottom: 0.45rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--poem-gold);
}

button.mind-poems__day:nth-of-type(3n + 2) .mind-poems__dot {
  background: var(--poem-silver);
}

button.mind-poems__day:nth-of-type(3n) .mind-poems__dot {
  background: var(--poem-bronze);
}

/* Day 4 is boxed in ink on the paper — same here, a hand-drawn border. */
.mind-poems__day--boxed {
  border: 2px solid var(--text);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
}

/* The pop-up: a native dialog, poem in Fraunces like the site headings. */
.mind-poems__dialog {
  border: 1px solid var(--line);
  border-top: 3px solid var(--poem-gold);
  background: var(--bg);
  color: var(--text);
  border-radius: 10px;
  padding: 1.75rem 1.5rem 1.5rem;
  max-width: 26rem;
  width: calc(100vw - 2.5rem);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.35);
}

.mind-poems__dialog:nth-of-type(3n + 2) {
  border-top-color: var(--poem-silver);
}

.mind-poems__dialog:nth-of-type(3n) {
  border-top-color: var(--poem-bronze);
}

.mind-poems__dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.mind-poems__dialog h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.mind-poems__poem {
  font-family: "Fraunces", Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 1.4rem;
  line-height: 1.65;
  margin: 0 0 1.5rem;
}

.mind-poems__nav {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
}

.mind-poems__nav button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.mind-poems__nav button:disabled {
  opacity: 0.35;
  cursor: default;
}

.mind-poems__close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem;
}

@keyframes mind-poems-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
}

.mind-poems__dialog[open] {
  animation: mind-poems-pop 0.25s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .mind-poems__dialog[open] {
    animation: none;
  }

  button.mind-poems__day:active {
    transform: none;
  }
}

@media (min-width: 40rem) {
  .mind-poems__day {
    min-height: 4.5rem;
  }
}
