/* ============================================================
   journal.css — the PIN-locked finale journal
   ============================================================ */

.journal {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: oklch(9% 0.02 275 / 0.82);
  backdrop-filter: blur(24px) saturate(1.1);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease-out-expo), visibility var(--dur);
}
.journal.is-open { opacity: 1; visibility: visible; }

.journal__frame {
  width: min(100%, 620px);
  max-height: min(88dvh, 860px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: var(--r-xl);
  border: 1px solid var(--hairline-2);
  background:
    radial-gradient(120% 80% at 50% -10%, oklch(30% 0.06 285 / 0.42), transparent 60%),
    var(--glass-2);
  box-shadow: var(--shadow-deep);
  padding: clamp(1.5rem, 1rem + 3vw, 2.6rem);
  transform: translateY(20px) scale(0.98);
  transition: transform var(--dur-slow) var(--ease-out-expo);
  position: relative;
}
.journal.is-open .journal__frame { transform: none; }

.jstage { display: none; }
.jstage.is-active { display: block; animation: stage-in var(--dur-slow) var(--ease-out-expo); }
@media (prefers-reduced-motion: reduce) { .jstage.is-active { animation: none; } }
body[data-motion="off"] .jstage.is-active { animation: none; }

.jstage h2 { font-size: var(--text-xl); margin-bottom: 0.5rem; }
.jstage .lede { color: var(--text-muted); margin-bottom: 1.6rem; max-width: 40ch; }
.jstage .eyebrow { display: block; margin-bottom: 1rem; }

/* PIN dots */
.pin { display: flex; gap: 0.9rem; justify-content: center; margin: 0.5rem 0 1.6rem; }
.pin i {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--hairline-2);
  transition: all var(--dur-fast) var(--ease-spring);
}
.pin i.filled {
  background: var(--grad-gold);
  border-color: transparent;
  box-shadow: var(--glow-gold);
  transform: scale(1.1);
}

/* PIN pad */
.pinpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  max-width: 300px;
  margin: 0 auto;
}
.pinpad button {
  aspect-ratio: 1.4;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: linear-gradient(160deg, oklch(28% 0.04 285 / 0.4), oklch(17% 0.03 275 / 0.5));
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-spring), border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.pinpad button:hover { border-color: var(--gold-deep); transform: translateY(-2px); box-shadow: var(--glow-gold); }
.pinpad button:active { transform: scale(0.95); }
.pinpad button.pad-fn { font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-muted); }

.pin-msg { text-align: center; margin-top: 1.1rem; min-height: 1.2em; font-size: var(--text-sm); }
.pin-msg.ok { color: var(--aqua); }
.pin-msg.err { color: var(--rose); }
.pin-note {
  text-align: center; margin-top: 1.4rem;
  font-size: var(--text-xs); color: var(--text-faint);
  display: flex; align-items: center; gap: 0.4rem; justify-content: center;
}

/* Entries */
.journal__head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.4rem; gap: 1rem; }
.journal__list { display: grid; gap: 0.9rem; margin-bottom: 1.6rem; }
.jentry {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: linear-gradient(160deg, oklch(26% 0.04 285 / 0.34), oklch(16% 0.03 275 / 0.5));
  padding: 1.1rem 1.2rem;
  position: relative;
  overflow: hidden;
}
.jentry::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--grad-aurora);
}
.jentry__top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; margin-bottom: 0.5rem; }
.jentry__date { font-size: var(--text-xs); color: var(--text-faint); letter-spacing: 0.06em; text-transform: uppercase; }
.jentry__score { font-family: var(--font-display); color: var(--gold-soft); font-size: var(--text-sm); }
.jentry__role { font-size: var(--text-xs); color: var(--iris); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.jentry h4 { font-family: var(--font-display); font-weight: 500; font-size: var(--text-base); margin: 0.3rem 0; }
.jentry p { color: var(--text-muted); font-size: var(--text-sm); }
.jentry textarea {
  width: 100%; margin-top: 0.7rem; min-height: 54px; resize: vertical;
  padding: 0.6rem 0.8rem; border-radius: var(--r-sm);
  border: 1px solid var(--hairline); background: oklch(10% 0.02 275 / 0.6);
  color: var(--text); font-size: var(--text-sm);
}
.jentry textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-color: var(--gold); }
.jentry__del {
  position: absolute; top: 0.7rem; right: 0.7rem;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--hairline); background: var(--glass);
  color: var(--text-faint); cursor: pointer; font-size: 0.8rem;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.jentry__del:hover { color: var(--rose); border-color: var(--rose); }
.journal__empty { text-align: center; color: var(--text-muted); padding: 2rem 0; }
