/* =========================================================
   Separate Diary Page
   ライト暗幕なし。日記はスクロール本体から独立。
========================================================= */

:root {
  --bg: #111115;
  --ink: #f2eee7;
  --muted: rgba(242, 238, 231, .72);
  --red: #d21b36;
}

html {
  background: var(--bg);
}

body.diary-page {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(210,27,54,.16), transparent 30rem),
    radial-gradient(circle at 90% 80%, rgba(255,255,255,.08), transparent 28rem),
    linear-gradient(180deg, #15151a, #101014);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
}

.diary-page .global-noise {
  opacity: .06 !important;
}

.diary-page .global-scanline {
  opacity: .16 !important;
}

.diary-header {
  background: rgba(14,14,18,.84) !important;
  color: var(--ink);
}

.diary-main {
  padding: 150px clamp(22px, 6vw, 90px) 70px;
}

.diary-hero {
  max-width: 1060px;
  margin-bottom: 40px;
}

.diary-hero h1 {
  font-size: clamp(48px, 9vw, 128px);
  line-height: .92;
  letter-spacing: -.075em;
  margin: 0 0 28px;
}

.diary-page .section-lead {
  max-width: 820px;
  color: var(--muted) !important;
  line-height: 2.1;
  letter-spacing: .055em;
}

.diary-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 18px;
  position: relative;
}

.diary-index {
  display: grid;
  gap: 10px;
  align-content: start;
  position: sticky;
  top: 120px;
}

.diary-tab {
  cursor: pointer;
  text-align: left;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(238,233,221,.16);
  background: rgba(255,255,255,.055);
  color: var(--ink);
  padding: 14px;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.diary-tab:hover,
.diary-tab.is-active {
  transform: translateX(4px);
  border-color: rgba(210,27,54,.68);
  background: rgba(210,27,54,.15);
}

.diary-tab span {
  color: rgba(210,27,54,.92);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 900;
}

.diary-reader {
  border: 1px solid rgba(238,233,221,.16);
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), transparent 36%),
    rgba(255,255,255,.055);
  backdrop-filter: blur(16px);
  min-height: 620px;
  padding: clamp(24px, 5vw, 56px);
  box-shadow: 0 24px 90px rgba(0,0,0,.22);
  position: relative;
  overflow: hidden;
}

.diary-reader::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: .28;
}

.diary-reader > * {
  position: relative;
}

.diary-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  color: rgba(245,242,232,.52);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .16em;
  font-size: 12px;
  margin-bottom: 28px;
}

.diary-reader h2 {
  font-size: clamp(34px, 6vw, 76px);
  line-height: 1;
  letter-spacing: -.06em;
  margin-bottom: 30px;
}

.diary-body {
  max-width: 860px;
  color: rgba(245,242,232,.86);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 2.25;
  letter-spacing: .055em;
}

.diary-body p {
  margin-bottom: 1.25em;
}

.diary-body .redacted {
  display: inline-block;
  background: rgba(245,242,232,.84);
  color: transparent;
  min-width: 7em;
  height: 1.05em;
  transform: translateY(.18em);
}

.diary-body .broken {
  display: inline-block;
  color: rgba(210,27,54,.92);
  animation: diaryBroken 1.6s steps(2) infinite;
}

@keyframes diaryBroken {
  0%, 100% { transform: translate(0,0); opacity: .78; }
  50% { transform: translate(2px,-1px); opacity: 1; }
}

.diary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.diary-actions button {
  cursor: pointer;
  border: 1px solid rgba(238,233,221,.16);
  background: rgba(255,255,255,.055);
  color: var(--ink);
  padding: 12px 14px;
  letter-spacing: .12em;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.diary-actions button:hover {
  transform: translateY(-2px);
  background: rgba(210,27,54,.16);
  border-color: rgba(210,27,54,.62);
}

.diary-afterword {
  margin-top: 18px;
  border: 1px solid rgba(238,233,221,.12);
  background: rgba(255,255,255,.055);
  padding: 18px;
  color: rgba(245,242,232,.70);
  line-height: 1.9;
  font-size: 13px;
}

/* メモ帳特殊演出 */
.memo-effect {
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  opacity: 0;
}

.memo-effect.is-show {
  opacity: 1;
  pointer-events: auto;
}

.memo-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(210,27,54,.22), transparent 34rem),
    rgba(0,0,0,.82);
  opacity: 0;
}

.memo-effect.is-show .memo-backdrop {
  animation: memoBackdrop 4.6s ease both;
}

@keyframes memoBackdrop {
  0% { opacity: 0; }
  16%, 78% { opacity: 1; }
  100% { opacity: 0; }
}

.memo-paper {
  position: absolute;
  left: 50%;
  top: 58%;
  width: min(520px, 86vw);
  min-height: 420px;
  transform: translate(-50%, -50%) translateY(80px) scale(.92) rotate(-4deg);
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(235,232,220,.98));
  color: #1a1a1a;
  border: 1px solid rgba(0,0,0,.14);
  box-shadow: 0 24px 100px rgba(0,0,0,.55);
  opacity: 0;
  overflow: hidden;
}

.memo-effect.is-show .memo-paper {
  animation: memoRiseBurn 4.6s cubic-bezier(.18,.86,.16,1) both;
}

.memo-title {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0,0,0,.12);
  background: rgba(235,235,230,.92);
  font-family: "MS PGothic", system-ui, sans-serif;
  font-size: 14px;
}

.memo-lines {
  position: absolute;
  inset: 78px 34px 48px;
  display: grid;
  gap: 34px;
  align-content: start;
}

.memo-lines span {
  border-bottom: 1px solid rgba(30,30,30,.14);
}

.memo-help {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%) rotate(-7deg) scale(.72);
  color: #b40018;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Comic Sans MS", cursive;
  font-weight: 900;
  font-size: clamp(58px, 14vw, 120px);
  letter-spacing: .08em;
  opacity: 0;
  text-shadow:
    2px 2px 0 rgba(80,0,0,.24),
    0 0 16px rgba(180,0,24,.38);
}

.memo-effect.is-show .memo-help {
  animation: tasuketeWrite 4.6s steps(7) both;
}

.memo-burn {
  position: absolute;
  inset: auto -20% -20% -20%;
  height: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,230,130,.9), transparent 10%),
    radial-gradient(circle at 35% 18%, rgba(255,80,0,.85), transparent 18%),
    radial-gradient(circle at 68% 22%, rgba(210,0,20,.8), transparent 16%),
    linear-gradient(0deg, rgba(40,0,0,.96), rgba(210,0,20,.8), transparent);
  filter: blur(1px);
  mix-blend-mode: multiply;
}

.memo-effect.is-show .memo-burn {
  animation: burnUp 4.6s ease-in both;
}

.memo-ash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 70%, rgba(0,0,0,.5) 0 2px, transparent 3px),
    radial-gradient(circle at 50% 65%, rgba(0,0,0,.38) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 74%, rgba(0,0,0,.42) 0 2px, transparent 3px);
  background-size: 32px 28px, 41px 35px, 24px 24px;
  opacity: 0;
}

.memo-effect.is-show .memo-ash {
  animation: ashAppear 4.6s ease both;
}

@keyframes memoRiseBurn {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(100px) scale(.85) rotate(-8deg);
    filter: blur(8px);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(0) scale(1) rotate(-2deg);
    filter: blur(0);
  }
  46% {
    transform: translate(-50%, -50%) translateY(-10px) scale(1.02) rotate(1deg);
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(235,232,220,.98));
  }
  66% {
    background: linear-gradient(180deg, rgba(255,230,230,.98), rgba(170,10,25,.92));
    filter: saturate(1.6) contrast(1.1);
  }
  82% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(-22px) scale(.96) rotate(4deg);
    filter: contrast(1.6) brightness(.72);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(-80px) scale(.42) rotate(18deg);
    filter: blur(14px) brightness(.2);
  }
}

@keyframes tasuketeWrite {
  0%, 20% { opacity: 0; clip-path: inset(0 100% 0 0); }
  28% { opacity: 1; clip-path: inset(0 82% 0 0); }
  36% { clip-path: inset(0 64% 0 0); }
  44% { clip-path: inset(0 48% 0 0); }
  52% { clip-path: inset(0 29% 0 0); }
  60%, 88% { opacity: 1; clip-path: inset(0 0 0 0); }
  100% { opacity: 0; clip-path: inset(0 0 0 0); }
}

@keyframes burnUp {
  0%, 50% { height: 0; opacity: 0; }
  62% { height: 35%; opacity: .9; }
  78% { height: 82%; opacity: 1; }
  100% { height: 120%; opacity: 0; }
}

@keyframes ashAppear {
  0%, 66% { opacity: 0; transform: translateY(0); }
  82% { opacity: .7; }
  100% { opacity: 0; transform: translateY(-60px); }
}

@media (max-width: 900px) {
  .diary-layout {
    grid-template-columns: 1fr;
  }

  .diary-index {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .diary-main {
    padding-top: 180px;
  }

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