/* =============================================
   PARCHMENT THEME — Heelie Faes Journal
   ============================================= */

:root {
  --parchment:      #f5e9cc;
  --parchment-warm: #edd9a3;
  --parchment-dark: #e0c882;
  --parchment-edge: #c4a055;
  --ink:            #1c1208;
  --ink-faded:      #4a2e14;
  --ink-light:      #6b4226;
  --gold:           #8b6914;
  --gold-light:     #c9a84c;
}

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

body {
  background-color: #0c0a07;
  background-image: url('../images/texture.png');
  background-repeat: repeat;
  min-height: 100vh;
  font-family: 'Crimson Text', serif;
  color: var(--ink);
  padding: clamp(18px, 4vw, 40px) clamp(10px, 3vw, 20px);
  overflow-x: hidden;
}

/* =============================================
   CANDLELIGHT ATMOSPHERE
   ============================================= */
.candlelight {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background:
    radial-gradient(
      ellipse 70% 55% at 50% 0%,
      rgba(255, 155, 30, 0.22) 0%,
      rgba(210, 105, 20, 0.10) 38%,
      rgba(180, 80, 10, 0.03) 58%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 90% 90% at 50% 50%,
      transparent 35%,
      rgba(0, 0, 0, 0.28) 100%
    );
  animation: candleFlicker 9s ease-in-out infinite;
}

/* =============================================
   SITE HEADER
   ============================================= */
.site-header {
  text-align: center;
  margin-bottom: 14px;
  animation: fadeIn 1.5s ease forwards;
}

.site-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.85rem, 6vw, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 12px;
}

.site-title a {
  color: var(--gold-light);
  text-decoration: none;
  text-shadow:
    0 0 20px rgba(201, 168, 76, 0.55),
    0 0 60px rgba(201, 168, 76, 0.20),
    0 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.header-divider {
  width: 220px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-light), transparent);
  margin: 14px auto;
  opacity: 0.5;
}

.site-subtitle {
  font-family: 'Bad Script', cursive;
  font-size: 1.2rem;
  color: rgba(201, 168, 76, 0.45);
  font-style: italic;
  letter-spacing: 1px;
}

/* =============================================
   NAVIGATION
   ============================================= */
.site-nav {
  text-align: center;
  margin-bottom: 40px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 26px;
  padding: 0 8px;
}

.site-nav a {
  font-family: 'Bad Script', cursive;
  font-size: 1.1rem;
  color: rgba(201, 168, 76, 0.55);
  text-decoration: none;
  transition: color 0.2s, text-shadow 0.2s;
}

.site-nav a:hover {
  color: var(--gold-light);
  text-shadow: 0 0 12px rgba(201, 168, 76, 0.35);
}

/* =============================================
   SITE LAYOUT
   ============================================= */
.site-layout {
  width: min(100%, 780px);
  margin: 0 auto;
}

.site-main {
  width: 100%;
  min-width: 0;
}

/* =============================================
   SIDEBAR — fixed, takes no layout space
   ============================================= */
.journal-sidebar {
  position: fixed;
  left: max(12px, calc(50vw - 530px));
  top: 120px;
  width: 120px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  scrollbar-width: none;
}

.journal-sidebar::-webkit-scrollbar { display: none; }

.sidebar-label {
  font-family: 'Cinzel Decorative', serif;
  font-size: 0.58rem;
  font-weight: 700;
  color: rgba(201, 168, 76, 0.5);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(201, 168, 76, 0.12);
}

.sidebar-day {
  display: block;
  font-family: 'Crimson Text', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(201, 168, 76, 0.52);
  text-decoration: none;
  padding: 4px 0;
  line-height: 1.35;
  transition: color 0.2s;
  white-space: nowrap;
}

.sidebar-day:hover { color: rgba(201, 168, 76, 0.7); }

.sidebar-day.active {
  color: var(--gold-light);
  text-shadow: 0 0 8px rgba(201, 168, 76, 0.25);
}

/* =============================================
   JOURNAL CONTAINER
   ============================================= */
.journal-container {
  max-width: none;
  margin: 0;
}

/* =============================================
   JOURNAL PAGE (entry card)
   ============================================= */
.journal-page {
  position: relative;
  overflow: hidden;
  background-color: var(--parchment);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 10% 90%, rgba(160, 100, 20, 0.22) 0%, transparent 45%),
    radial-gradient(ellipse at 90% 10%, rgba(190, 140, 50, 0.18) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 50%, rgba(255, 240, 180, 0.25) 0%, transparent 60%),
    linear-gradient(160deg, #f7edd3 0%, #edd8a0 40%, #f3e5c2 65%, #e6d095 100%);
  border-radius: 1px;
  padding: clamp(36px, 7vw, 60px) clamp(24px, 7vw, 70px);
  margin-bottom: 50px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.7),
    0 6px 20px rgba(0, 0, 0, 0.8),
    0 18px 55px rgba(0, 0, 0, 0.6),
    0 35px 90px rgba(0, 0, 0, 0.35),
    inset 0 0 100px rgba(190, 110, 20, 0.12),
    inset 0 -30px 50px rgba(140, 70, 10, 0.08),
    inset 2px 0 8px rgba(100, 60, 10, 0.08);
  animation: pageReveal 0.9s ease forwards;
  opacity: 0;
  transform: translateY(20px);
}

.journal-page:nth-child(1) { animation-delay: 0.2s; }
.journal-page:nth-child(2) { animation-delay: 0.5s; }
.journal-page:nth-child(3) { animation-delay: 0.8s; }
.journal-page:nth-child(4) { animation-delay: 1.1s; }
.journal-page:nth-child(5) { animation-delay: 1.4s; }

/* Session banner — only appears when frontmatter has session: */
.session-banner {
  font-family: 'Crimson Text', serif;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-faded);
  letter-spacing: 0.4px;
  background: rgba(120, 70, 15, 0.07);
  border-bottom: 1px solid rgba(140, 80, 20, 0.18);
  padding: 9px clamp(24px, 7vw, 70px);
  margin: calc(clamp(36px, 7vw, 60px) * -1) calc(clamp(24px, 7vw, 70px) * -1) 36px calc(clamp(24px, 7vw, 70px) * -1);
  position: relative;
  z-index: 2;
}

/* Binding / spine shadow */
.journal-page::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 50px;
  background: linear-gradient(to right, rgba(140, 80, 20, 0.28), rgba(140, 80, 20, 0.07), transparent);
  border-radius: 1px 0 0 1px;
  pointer-events: none;
}

/* Aged corner curl */
.journal-page::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, transparent 45%, rgba(180, 120, 40, 0.40) 100%);
  opacity: 0.5;
  border-radius: 0 0 1px 0;
  pointer-events: none;
}

/* =============================================
   INK STAINS
   ============================================= */
.stain {
  position: absolute;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 42% 38%,
    rgba(70, 35, 8, 0.14) 0%,
    rgba(70, 35, 8, 0.07) 50%,
    rgba(70, 35, 8, 0.02) 75%,
    transparent 100%
  );
}

/* Blob shapes — assigned per entry by weight in the template */
.blob-1 { border-radius: 30% 70% 60% 40% / 50% 30% 70% 50%; }
.blob-2 { border-radius: 60% 40% 30% 70% / 40% 60% 70% 30%; }
.blob-3 { border-radius: 40% 60% 70% 30% / 60% 40% 30% 70%; }
.blob-4 { border-radius: 70% 30% 50% 50% / 30% 60% 40% 70%; }
.blob-5 { border-radius: 50% 50% 30% 70% / 60% 40% 70% 30%; }
.blob-6 { border-radius: 35% 65% 55% 45% / 45% 55% 35% 65%; }
.blob-7 { border-radius: 65% 35% 45% 55% / 55% 45% 65% 35%; }
.blob-8 { border-radius: 45% 55% 65% 35% / 35% 65% 45% 55%; }

/* =============================================
   ENTRY HEADER
   ============================================= */
.entry-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(180, 120, 40, 0.4);
  position: relative;
  z-index: 1;
}

.entry-day {
  font-family: 'Bad Script', cursive;
  font-size: clamp(1.9rem, 6vw, 2.4rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  overflow-wrap: anywhere;
}

.entry-meta {
  font-family: 'Bad Script', cursive;
  font-size: 1rem;
  color: var(--ink-light);
  font-style: italic;
}

.entry-stats {
  margin-left: auto;
  font-family: 'Crimson Text', serif;
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 400;
  color: var(--ink);
  opacity: 0.45;
  white-space: nowrap;
  align-self: flex-end;
}

/* =============================================
   ENTRY BODY
   ============================================= */
.entry-body {
  font-family: 'Bad Script', cursive;
  font-size: clamp(1.08rem, 2.4vw, 1.25rem);
  line-height: 1.85;
  color: var(--ink);
  position: relative;
  z-index: 1;
  overflow-wrap: break-word;
}

.entry-body img,
.entry-body video,
.entry-body iframe {
  max-width: 100%;
  height: auto;
}

.entry-body p { margin-bottom: 1.2em; }
.entry-body p:last-child { margin-bottom: 0; }

.entry-body a {
  overflow-wrap: anywhere;
}

.entry-body pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
}

.entry-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.entry-body ul,
.entry-body ol { margin: 0.4em 0 1.2em 1.6em; }
.entry-body li { margin-bottom: 0.3em; }

.entry-body blockquote {
  margin: 1.2em 0 1.2em 1em;
  padding: 0.6em 1em;
  border-left: 2px solid rgba(180, 120, 40, 0.45);
  color: var(--ink-faded);
  font-size: 1.1rem;
  background: rgba(140, 80, 20, 0.04);
}

/* Narrative CSS classes */
.silence {
  display: block;
  text-align: center;
  color: var(--ink-light);
  font-size: 1.4rem;
  letter-spacing: 8px;
  margin: 1.5em 0;
}

.interrupted::after {
  content: '';
  display: inline-block;
  width: 60px;
  height: 1px;
  background: var(--ink-faded);
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0.4;
}

.loud {
  font-weight: 700;
  font-size: 1.35rem;
}

.whisper {
  display: block;
  font-size: 0.95rem;
  color: var(--ink-light);
  font-style: italic;
  margin-bottom: 1.2em;
}

.underline {
  text-decoration: underline;
  text-decoration-color: rgba(100, 60, 15, 0.55);
  text-underline-offset: 3px;
}

.verse {
  text-align: center;
  font-style: italic;
  color: var(--ink-faded);
  margin: 1.5em 2em;
  line-height: 2.1;
  font-size: 1.1rem;
}

.redacted {
  background-color: var(--ink);
  color: var(--ink);
  border-radius: 1px;
  padding: 0 3px;
  user-select: none;
  cursor: default;
}

/* =============================================
   BACK LINK
   ============================================= */
.back-link {
  display: inline-block;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
  font-family: 'Bad Script', cursive;
  font-size: 1.05rem;
  color: rgba(201, 168, 76, 0.55);
  text-decoration: none;
  transition: color 0.2s, text-shadow 0.2s;
}

.back-link:hover {
  color: var(--gold-light);
  text-shadow: 0 0 12px rgba(201, 168, 76, 0.3);
}

/* =============================================
   ENTRY NAVIGATION (single pages)
   ============================================= */
.entry-nav {
  position: relative;
  margin-top: 2rem;
  font-family: 'Bad Script', cursive;
  font-size: 1.05rem;
  line-height: 2;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  text-align: center;
}

.entry-nav-all {
  color: rgba(201, 168, 76, 0.55);
  text-decoration: none;
  transition: color 0.2s, text-shadow 0.2s;
}

.entry-nav-prev,
.entry-nav-next {
  font-size: 1.4rem;
  color: rgba(201, 168, 76, 0.55);
  text-decoration: none;
  transition: color 0.2s, text-shadow 0.2s;
}

.entry-nav-prev { grid-column: 1; }
.entry-nav-all { grid-column: 2; }
.entry-nav-next { grid-column: 3; }

.entry-nav-prev:hover,
.entry-nav-next:hover,
.entry-nav-all:hover {
  color: var(--gold-light);
  text-shadow: 0 0 12px rgba(201, 168, 76, 0.3);
}

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
  text-align: center;
  padding: 2rem;
  font-family: 'Bad Script', cursive;
  font-style: italic;
  font-size: 0.9rem;
  color: rgba(201, 168, 76, 0.25);
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pageReveal {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes candleFlicker {
  0%, 100% { opacity: 1; }
  8%        { opacity: 0.92; }
  18%       { opacity: 1; }
  32%       { opacity: 0.87; }
  46%       { opacity: 0.96; }
  58%       { opacity: 0.84; }
  72%       { opacity: 0.98; }
  84%       { opacity: 0.90; }
  91%       { opacity: 0.95; }
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1050px) {
  .journal-sidebar { display: none; }
}

@media (max-width: 760px) {
  .site-header { margin-bottom: 10px; }
  .site-nav { margin-bottom: 26px; }

  .journal-page {
    margin-bottom: 34px;
    box-shadow:
      0 1px 3px rgba(0, 0, 0, 0.65),
      0 8px 28px rgba(0, 0, 0, 0.65),
      inset 0 0 70px rgba(190, 110, 20, 0.10);
  }

  .journal-page::before { width: 26px; }
  .journal-page::after {
    width: 48px;
    height: 48px;
  }

  .entry-header {
    display: block;
    margin-bottom: 24px;
  }

  .entry-meta {
    display: block;
    margin-top: 8px;
    line-height: 1.35;
  }

  .entry-body blockquote {
    margin-left: 0;
    padding-right: 0.8em;
  }

  .verse {
    margin-left: 0.5em;
    margin-right: 0.5em;
  }
}

@media (max-width: 480px) {
  .header-divider { width: min(220px, 70vw); }
  .site-subtitle { font-size: 1.05rem; }
  .site-nav a { font-size: 1rem; }
  .journal-page { padding: 32px 20px; }
  .session-banner { padding: 8px 20px; margin: -32px -20px 24px -20px; }
  .entry-body { line-height: 1.78; }
  .silence {
    font-size: 1.15rem;
    letter-spacing: 4px;
  }
  .interrupted::after { width: 34px; }
  .stain-3,
  .stain-4 { display: none; }
}

@media (max-width: 360px) {
  body { padding-left: 6px; padding-right: 6px; }
  .journal-page { padding-left: 16px; padding-right: 16px; }
  .session-banner { padding-left: 16px; padding-right: 16px; margin-left: -16px; margin-right: -16px; }
  .entry-nav { grid-template-columns: 34px 1fr 34px; }
}
