/* Journal: a grimoire lying open on a candlelit desk. Everything is scoped to this page. */
body[data-page="journal"] {
  --jr-paper: #f2e6c9;
  --jr-paper-deep: #e6d3aa;
  --jr-ink: #33210f;
  --jr-ink-soft: #5e4328;
  --jr-ink-faint: rgba(71, 45, 20, 0.22);
  --jr-rule: rgba(92, 62, 32, 0.2);
  --jr-wax: #8e1f17;
  --jr-wax-hi: #c2412f;
  --jr-focus: #0f7f9c;
  --jr-hand: 'Kalam', 'Segoe Print', 'Bradley Hand', cursive;
  background:
    radial-gradient(60% 50% at 88% 6%, rgba(255, 176, 84, 0.2), transparent 70%),
    radial-gradient(120% 80% at 50% 110%, rgba(0, 0, 0, 0.55), transparent 70%),
    repeating-linear-gradient(92deg, rgba(0, 0, 0, 0.1) 0 2px, transparent 2px 9px, rgba(255, 220, 170, 0.025) 9px 10px, transparent 10px 23px),
    linear-gradient(180deg, #2a1a10 0%, #1f130b 50%, #150d07 100%);
  background-attachment: fixed;
  color: #eadcc0;
}
body[data-page="journal"] .sky { display: none; }
body[data-page="journal"] .home-link { color: #d8c49d; }
body[data-page="journal"] .home-link:hover { color: #fff3dc; }
body[data-page="journal"] :focus-visible { outline: 2px solid var(--neon); outline-offset: 3px; }

/* ---------- the desk: title and candle ---------- */
body[data-page="journal"] .jr-hero { position: relative; max-width: none; padding-bottom: 18px; }
body[data-page="journal"] .jr-hero h1 {
  color: #f4e3c1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 170, 80, 0.3);
}
body[data-page="journal"] .jr-hero .lede { color: #d9c7a6; max-width: 58ch; }

.jr-candle { position: absolute; right: clamp(8px, 6vw, 80px); bottom: 6px; width: 34px; height: 150px; pointer-events: none; }
.jr-candle::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -40px;
  width: 260px;
  height: 260px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 190, 100, 0.34), rgba(255, 150, 60, 0.1) 40%, transparent 68%);
  animation: jr-glow 3.2s ease-in-out infinite alternate;
}
.jr-wax {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 108px;
  border-radius: 6px 6px 3px 3px / 4px 4px 3px 3px;
  background: linear-gradient(90deg, #cdb58a, #f4e7c8 38%, #e9d7b0 60%, #a98d62);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.55);
}
.jr-wax::before { /* a drip */
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  width: 7px;
  height: 26px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(90deg, #e2cfa4, #f6ead0);
}
.jr-wax::after { /* the wick */
  content: '';
  position: absolute;
  left: 50%;
  top: -8px;
  width: 2px;
  height: 10px;
  background: #2b1a0e;
  transform: translateX(-50%);
}
.jr-flame {
  position: absolute;
  left: 50%;
  bottom: 112px;
  width: 14px;
  height: 30px;
  margin-left: -7px;
  border-radius: 50% 50% 45% 45% / 70% 70% 30% 30%;
  background: radial-gradient(ellipse at 50% 78%, #fff 0 18%, #ffe08a 35%, #ff9d2e 70%, rgba(255, 110, 20, 0) 100%);
  box-shadow: 0 0 18px 6px rgba(255, 170, 70, 0.4);
  transform-origin: 50% 90%;
  animation: jr-flicker 2.4s ease-in-out infinite;
}
@keyframes jr-flicker {
  0%, 100% { transform: rotate(-2deg) scaleY(1); }
  30% { transform: rotate(3deg) scaleY(1.07); }
  60% { transform: rotate(-1deg) scaleY(0.95); }
}
@keyframes jr-glow { to { opacity: 0.78; transform: translateX(-50%) scale(0.96); } }

/* ---------- week heading and page turns ---------- */
.jr-desk-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; margin: 8px 0 18px; }
.jr-week { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(1.35rem, 3vw, 1.8rem); color: #f1dfbb; }
.jr-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.jr-turn {
  appearance: none;
  font: 500 0.98rem var(--serif);
  color: #ecdcbc;
  background: linear-gradient(180deg, rgba(70, 44, 24, 0.9), rgba(40, 25, 14, 0.9));
  border: 1px solid rgba(214, 180, 120, 0.35);
  border-radius: 4px;
  padding: 0.42rem 0.9rem;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 230, 190, 0.1), 0 3px 8px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s, color 0.2s;
}
.jr-turn:hover { border-color: rgba(255, 206, 140, 0.75); color: #fff4df; }
.jr-turn.now { font-style: italic; }

.jr-status { margin: 0 0 12px; color: #ffc4ad; }
.jr-status:empty { display: none; }

/* ---------- sign-in slip tucked into the book ---------- */
.jr-slip {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: 0 auto -14px;
  padding: 16px 20px 18px;
  color: var(--jr-ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 40%),
    #f7eed6;
  border-radius: 2px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
  transform: rotate(-0.8deg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}
.jr-slip p { margin: 0; flex: 1 1 300px; font-size: 1rem; line-height: 1.45; }
.jr-seal-btn {
  display: inline-block;
  padding: 0.5rem 1.05rem;
  font-weight: 700;
  font-size: 0.98rem;
  color: #fff2e6;
  text-decoration: none;
  background: radial-gradient(circle at 35% 30%, var(--jr-wax-hi), var(--jr-wax) 70%);
  border-radius: 999px 860px 940px 900px / 900px 980px 880px 960px;
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.3), inset 0 2px 2px rgba(255, 200, 180, 0.25), 0 2px 4px rgba(60, 10, 5, 0.4);
}
.jr-seal-btn:hover { filter: brightness(1.1); }
.jr-slip :focus-visible { outline-color: var(--jr-focus); }

/* ---------- the book ---------- */
.jr-book {
  --fibre: repeating-linear-gradient(92deg, rgba(90, 56, 20, 0.035) 0 1px, transparent 1px 7px), repeating-linear-gradient(178deg, rgba(90, 56, 20, 0.03) 0 1px, transparent 1px 11px);
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  color: var(--jr-ink);
  padding: 0;
  filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.6));
}
.jr-book::before { /* leather cover peeking out around the pages */
  content: '';
  position: absolute;
  inset: -12px -14px -16px;
  z-index: -1;
  border-radius: 10px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 170, 90, 0.12), transparent 60%),
    linear-gradient(180deg, #4a2515, #2c140a);
  box-shadow: inset 0 0 0 2px rgba(196, 150, 90, 0.25), inset 0 0 30px rgba(0, 0, 0, 0.6);
}
.jr-leaf {
  position: relative;
  min-width: 0;
  padding: 34px clamp(22px, 3vw, 44px) 40px;
  background-color: var(--jr-paper);
  background-image:
    var(--fibre),
    radial-gradient(90% 60% at 20% 10%, rgba(255, 250, 235, 0.55), transparent 70%),
    radial-gradient(40% 30% at 80% 85%, rgba(160, 110, 50, 0.12), transparent 70%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.jr-leaf.left {
  border-radius: 6px 2px 2px 6px;
  background-image:
    linear-gradient(90deg, transparent 82%, rgba(90, 58, 25, 0.1) 93%, rgba(60, 36, 14, 0.38) 100%),
    var(--fibre),
    radial-gradient(90% 60% at 20% 10%, rgba(255, 250, 235, 0.55), transparent 70%),
    radial-gradient(40% 30% at 80% 85%, rgba(160, 110, 50, 0.12), transparent 70%);
  box-shadow: -1px 2px 0 #e4d1a8, -3px 4px 0 #d9c396, -5px 6px 0 #cfb887, -7px 8px 0 #b89e6e;
}
.jr-leaf.right {
  border-radius: 2px 6px 6px 2px;
  background-image:
    linear-gradient(270deg, transparent 82%, rgba(90, 58, 25, 0.1) 93%, rgba(60, 36, 14, 0.38) 100%),
    var(--fibre),
    radial-gradient(90% 60% at 80% 10%, rgba(255, 250, 235, 0.55), transparent 70%),
    radial-gradient(40% 30% at 20% 85%, rgba(160, 110, 50, 0.12), transparent 70%);
  box-shadow: 1px 2px 0 #e4d1a8, 3px 4px 0 #d9c396, 5px 6px 0 #cfb887, 7px 8px 0 #b89e6e;
}
.jr-book::after { /* the gutter where the pages dip into the binding */
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(50, 28, 10, 0.55), rgba(50, 28, 10, 0.3) 50%, rgba(50, 28, 10, 0.55));
}
.jr-book :focus-visible { outline: 2px solid var(--jr-focus); outline-offset: 2px; }

/* ---------- a day ---------- */
.jr-day { position: relative; padding: 12px 0 18px; }
.jr-day + .jr-day, .jr-day + .jr-panel { border-top: 1px solid transparent; border-image: linear-gradient(90deg, transparent, rgba(92, 62, 32, 0.4) 15%, rgba(92, 62, 32, 0.4) 85%, transparent) 1; }
.jr-day-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 14px; }
.jr-num {
  font-family: var(--display);
  font-size: 2.6rem;
  line-height: 1;
  color: var(--jr-wax);
  min-width: 1.4em;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}
.jr-titles h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.35rem; line-height: 1.15; color: var(--jr-ink); }
.jr-today { font-family: var(--serif); font-size: 0.95rem; color: #0c6f89; font-weight: 500; }
.jr-date { margin: 0; font-size: 0.92rem; font-style: italic; color: var(--jr-ink-soft); }
.jr-moon { margin: 0; display: grid; justify-items: center; gap: 2px; font-size: 0.78rem; line-height: 1.15; color: var(--jr-ink-soft); text-align: center; max-width: 6.5em; }
.jr-moon-dark { fill: #3a2614; }
.jr-moon-lit { fill: #fbf3dd; }
.jr-moon-rim { fill: none; stroke: #3a2614; stroke-width: 1.1; }
.jr-moon-svg { display: block; transform: rotate(-4deg); }

.jr-gods { margin: 8px 0 0; font-size: 0.98rem; color: var(--jr-ink-soft); }
.jr-gods a { color: var(--jr-ink); font-weight: 500; text-decoration: underline; text-decoration-color: rgba(142, 31, 23, 0.55); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.jr-gods a:hover { color: var(--jr-wax); text-decoration-thickness: 2px; }

/* holy days: wax seals */
.jr-holy { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.jr-seal { display: inline-flex; align-items: center; gap: 8px; color: var(--jr-wax); font-weight: 700; font-style: italic; text-decoration: none; line-height: 1.2; }
.jr-seal::before {
  content: 'ᛉ';
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font: 400 0.9rem var(--runic);
  font-style: normal;
  color: rgba(255, 220, 200, 0.85);
  background: radial-gradient(circle at 38% 32%, var(--jr-wax-hi), var(--jr-wax) 62%, #5f120c);
  border-radius: 52% 48% 55% 45% / 47% 55% 45% 53%;
  box-shadow: inset 0 0 0 3px rgba(95, 18, 12, 0.5), inset 0 0 0 4px rgba(230, 120, 100, 0.25), 1px 2px 2px rgba(60, 10, 5, 0.35);
  transform: rotate(-8deg);
}
.jr-seal:hover { text-decoration: underline; text-underline-offset: 3px; }

/* entries on ruled lines */
.jr-entries { list-style: none; margin: 10px 0 0; padding: 0; }
.jr-entries li {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 2.1rem;
  border-bottom: 1px solid var(--jr-rule);
}
.jr-entries label { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; cursor: pointer; padding: 2px 0; }
.jr-hand { font-family: var(--jr-hand); font-weight: 500; font-size: 1.42rem; line-height: 1.2; color: #2a2a55; overflow-wrap: anywhere; }
.jr-entries li.done .jr-hand {
  color: rgba(42, 42, 85, 0.55);
  text-decoration: line-through;
  text-decoration-color: rgba(42, 30, 20, 0.7);
  text-decoration-thickness: 2px;
}
.jr-check {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  margin: 0;
  width: 20px;
  height: 20px;
  border: 1.6px solid var(--jr-ink);
  border-radius: 3px 5px 2px 4px;
  background: transparent center / 26px 26px no-repeat;
  transform: rotate(-3deg);
  cursor: pointer;
}
.jr-check:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cpath d='M5 13.5c2 1.5 3.5 3.5 4.6 6 3-6.5 7.5-12 13.5-16.5' fill='none' stroke='%232a1a0c' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: 3px -3px;
}
.jr-remove {
  appearance: none;
  flex: none;
  align-self: center;
  width: 30px;
  height: 30px;
  border: 0;
  background: none;
  color: rgba(94, 67, 40, 0.5);
  font: 400 1.3rem/1 var(--serif);
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.jr-remove:hover, .jr-remove:focus-visible { color: var(--jr-wax); background: rgba(142, 31, 23, 0.08); }

/* the blank line to write on */
.jr-add { display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; }
.jr-line-input {
  flex: 1;
  min-width: 0;
  font: 500 1.38rem/1.2 var(--jr-hand);
  color: #2a2a55;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(92, 62, 32, 0.4);
  border-radius: 0;
  padding: 6px 2px 3px;
}
.jr-line-input::placeholder { color: rgba(94, 67, 40, 0.62); }
.jr-line-input:focus { outline: none; border-bottom: 2px solid var(--jr-focus); padding-bottom: 2px; background: rgba(47, 201, 237, 0.06); }
.jr-line-input:disabled { cursor: not-allowed; }
.jr-line-input:disabled::placeholder { color: rgba(94, 67, 40, 0.5); font-style: normal; }
.jr-ink-btn {
  appearance: none;
  flex: none;
  font: 700 0.95rem var(--serif);
  color: var(--jr-paper);
  background: var(--jr-ink);
  border: 0;
  border-radius: 3px 5px 3px 6px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
}
.jr-ink-btn:hover { background: #4a2f16; }
.jr-ink-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* quick-add notes pencilled in the margin */
.jr-ideas { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 8px; }
.jr-idea {
  appearance: none;
  border: 0;
  background: none;
  padding: 3px 0;
  font: italic 400 0.92rem var(--serif);
  color: var(--jr-ink-soft);
  cursor: pointer;
  text-decoration: underline dashed rgba(94, 67, 40, 0.45) 1px;
  text-underline-offset: 4px;
}
.jr-idea::before { content: '+'; margin-right: 4px; font-style: normal; font-weight: 700; color: var(--jr-wax); }
.jr-idea:hover { color: var(--jr-ink); text-decoration-style: solid; }

/* today's ribbon bookmark */
.jr-day.is-today { background: linear-gradient(90deg, transparent, rgba(47, 201, 237, 0.07) 30%, rgba(47, 201, 237, 0.07) 70%, transparent); }
.jr-book { position: relative; }
/* A silk ribbon bookmark: it runs from under the top edge of the book, down the outer margin of
   today's page, and its forked tail hangs out below the bottom edge. */
.jr-bookmark {
  position: absolute;
  top: -6px;
  bottom: -44px;
  width: 16px;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(90deg, #0b6883, #2fc9ed 45%, #1aa6c8 62%, #0a5f78);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 12px), 0 100%);
  filter: drop-shadow(1px 2px 1.5px rgba(40, 20, 5, 0.4));
}
.jr-bookmark.on-left { left: 16px; }
.jr-bookmark.on-right { right: 16px; }


/* ---------- moon and holy days panel ---------- */
.jr-panel {
  margin-top: auto;
  padding: 18px 18px 16px;
  border: 1px solid rgba(92, 62, 32, 0.35);
  outline: 1px solid rgba(92, 62, 32, 0.2);
  outline-offset: 3px;
  background: rgba(214, 190, 140, 0.18);
}
.jr-panel h3 { margin: 0 0 8px; font-family: var(--display); font-weight: 400; font-size: 1.15rem; color: var(--jr-ink); }
.jr-panel h3 + .jr-panel-note, .jr-panel h3 + .jr-holylist { margin-top: 0; }
.jr-panel .jr-moonrow + .jr-panel-note + h3 { margin-top: 14px; }
.jr-moonrow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.jr-moonrow li { display: grid; justify-items: center; gap: 3px; padding: 5px 0 4px; border-radius: 3px; }
.jr-moonrow .wd { font-size: 0.82rem; color: var(--jr-ink-soft); }
.jr-moonrow li.is-today { background: rgba(47, 201, 237, 0.13); box-shadow: inset 0 -2px 0 #1aa6c8; }
.jr-moonrow li.is-today .wd { color: var(--jr-ink); font-weight: 700; }
.jr-panel-note { margin: 8px 0 0; font-size: 0.95rem; font-style: italic; color: var(--jr-ink-soft); line-height: 1.45; }
.jr-holylist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.jr-holylist .when { color: var(--jr-ink-soft); font-size: 0.95rem; }
.jr-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

body[data-page="journal"] .site-foot { color: #bba684; }

/* ---------- one page on small screens ---------- */
@media (max-width: 860px) {
  .jr-book { grid-template-columns: 1fr; display: flex; flex-direction: column; background-color: var(--jr-paper); border-radius: 4px; }
  .jr-book::after { display: none; }
  .jr-book::before { display: none; }
  .jr-leaf.left, .jr-leaf.right { display: contents; }
  .jr-book {
    padding: 26px 20px 30px;
    background-image:
      linear-gradient(90deg, rgba(60, 36, 14, 0.25), transparent 6%),
      var(--fibre),
      radial-gradient(90% 40% at 20% 5%, rgba(255, 250, 235, 0.55), transparent 70%);
    box-shadow: 2px 3px 0 #e0cc9f, 4px 6px 0 #cfb887, 6px 8px 0 #b89e6e, 0 0 0 8px #3a1c0f, 0 0 0 9px rgba(196, 150, 90, 0.3);
    margin: 0 2px;
  }
  .jr-panel { order: 99; margin-top: 18px; }
  .jr-leaf.right .jr-day:first-child { border-top: 1px solid transparent; border-image: linear-gradient(90deg, transparent, rgba(92, 62, 32, 0.4) 15%, rgba(92, 62, 32, 0.4) 85%, transparent) 1; }
  .jr-bookmark.on-left, .jr-bookmark.on-right { left: auto; right: 6px; width: 12px; }
  .jr-candle { right: 4px; transform: scale(0.72); transform-origin: bottom right; }
  body[data-page="journal"] .jr-hero h1, body[data-page="journal"] .jr-hero .lede { padding-right: 48px; }
}
@media (max-width: 480px) {
  .jr-book { padding: 22px 14px 26px; }
  .jr-num { font-size: 2.1rem; }
  .jr-day-head { gap: 4px 10px; }
  .jr-nav { width: 100%; }
  .jr-turn { flex: 1 1 auto; padding: 0.42rem 0.5rem; font-size: 0.92rem; }
  .jr-moonrow { gap: 1px; }
  .jr-candle { display: none; }
  body[data-page="journal"] .jr-hero h1, body[data-page="journal"] .jr-hero .lede { padding-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .jr-flame, .jr-candle::before { animation: none; }
  .jr-turn, .jr-remove { transition: none; }
}

/* the fixed home link floats over the book when scrolling, so give it a little desk behind it */
body[data-page="journal"] .home-link { padding: 0.3rem 0.7rem 0.3rem 0.55rem; margin: -0.3rem 0 0 -0.55rem; border-radius: 6px; background: rgba(26, 16, 9, 0.82); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
