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

:root {
  --parchment:      #f5e9cc;
  --parchment-warm: #edd9a3;
  --parchment-dark: #e0c882;
  --parchment-edge: #c4a055;
  --ink:            #1c1208;
  --ink-faded:      #4a2e14;
  --ink-light:      #7a5230;
  --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: 40px 20px;
}

/* =============================================
   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: 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: 2px;
}

.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;
}

.site-nav a {
  font-family: 'Bad Script', cursive;
  font-size: 1.1rem;
  color: rgba(201, 168, 76, 0.55);
  text-decoration: none;
  margin: 0 16px;
  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 (sidebar + main)
   ============================================= */
.site-layout {
  display: flex;
  max-width: 980px;
  margin: 0 auto;
  gap: 40px;
  align-items: flex-start;
}

.site-main {
  flex: 1;
  min-width: 0;
}

/* =============================================
   SIDEBAR
   ============================================= */
.journal-sidebar {
  width: 120px;
  flex-shrink: 0;
  position: sticky;
  top: 40px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  scrollbar-width: none;
}

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

.sidebar-label {
  font-family: 'Cinzel Decorative', serif;
  font-size: 0.58rem;
  color: rgba(201, 168, 76, 0.35);
  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: 'Bad Script', cursive;
  font-size: 0.9rem;
  color: rgba(201, 168, 76, 0.38);
  text-decoration: none;
  padding: 3px 0;
  line-height: 1.5;
  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: 60px 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; }

/* 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%
  );
}

/* Default positions */
.stain-1 {
  width: 110px; height: 95px;
  top: 22px; right: 70px;
  transform: rotate(-14deg);
  border-radius: 30% 70% 60% 40% / 50% 30% 70% 50%;
}
.stain-2 {
  width: 68px; height: 60px;
  bottom: 70px; left: 90px;
  transform: rotate(9deg);
  border-radius: 60% 40% 30% 70% / 40% 60% 70% 30%;
  opacity: 0.8;
}
.stain-3 {
  width: 42px; height: 38px;
  top: 55%; right: 110px;
  transform: rotate(-5deg);
  border-radius: 40% 60% 70% 30% / 60% 40% 30% 70%;
  opacity: 0.6;
}

/* Per-entry variations */
.journal-page:nth-child(2) .stain-1 {
  width: 95px; height: 88px;
  top: 35%; left: 55px; right: auto;
  transform: rotate(11deg);
  border-radius: 70% 30% 50% 50% / 30% 60% 40% 70%;
}
.journal-page:nth-child(2) .stain-2 {
  width: 78px; height: 66px;
  bottom: 50px; right: 80px; left: auto;
  transform: rotate(-7deg);
  border-radius: 50% 50% 30% 70% / 60% 40% 70% 30%;
}
.journal-page:nth-child(2) .stain-3 { display: none; }

.journal-page:nth-child(3) .stain-1 {
  width: 130px; height: 115px;
  top: 30px; right: 40px;
  transform: rotate(-8deg);
  border-radius: 35% 65% 55% 45% / 45% 55% 35% 65%;
  opacity: 0.75;
}
.journal-page:nth-child(3) .stain-2 {
  width: 52px; height: 46px;
  bottom: 100px; left: 120px;
  transform: rotate(20deg);
  border-radius: 65% 35% 45% 55% / 55% 45% 65% 35%;
  opacity: 0.6;
}
.journal-page:nth-child(3) .stain-3 {
  width: 34px; height: 30px;
  top: 40%; left: 80px;
  transform: rotate(-15deg);
  border-radius: 45% 55% 65% 35% / 35% 65% 45% 55%;
  opacity: 0.5;
}

.journal-page:nth-child(4) .stain-1 {
  width: 88px; height: 80px;
  top: 60px; left: 70px; right: auto;
  transform: rotate(6deg);
  border-radius: 55% 45% 35% 65% / 65% 35% 55% 45%;
}
.journal-page:nth-child(4) .stain-2 {
  width: 105px; height: 90px;
  bottom: 40px; right: 60px; left: auto;
  transform: rotate(-12deg);
  border-radius: 30% 70% 60% 40% / 60% 40% 30% 70%;
  opacity: 0.7;
}
.journal-page:nth-child(4) .stain-3 {
  width: 44px; height: 40px;
  top: 25%; right: 150px;
  border-radius: 70% 30% 40% 60% / 40% 70% 60% 30%;
  opacity: 0.55;
}

.journal-page:nth-child(5) .stain-1 {
  width: 115px; height: 100px;
  top: 28px; right: 100px;
  transform: rotate(16deg);
  border-radius: 40% 60% 30% 70% / 70% 30% 60% 40%;
}
.journal-page:nth-child(5) .stain-2 {
  width: 58px; height: 52px;
  bottom: 85px; left: 70px;
  transform: rotate(-8deg);
  border-radius: 60% 40% 70% 30% / 30% 70% 40% 60%;
  opacity: 0.65;
}
.journal-page:nth-child(5) .stain-3 {
  width: 40px; height: 36px;
  top: 50%; right: 90px;
  transform: rotate(12deg);
  border-radius: 35% 65% 50% 50% / 50% 50% 65% 35%;
  opacity: 0.5;
}

.journal-page:nth-child(6) .stain-1 {
  width: 125px; height: 110px;
  top: 40px; left: 60px; right: auto;
  transform: rotate(-5deg);
  border-radius: 65% 35% 40% 60% / 55% 45% 65% 35%;
  opacity: 0.65;
}
.journal-page:nth-child(6) .stain-2 {
  width: 72px; height: 62px;
  bottom: 60px; right: 70px; left: auto;
  transform: rotate(14deg);
  border-radius: 40% 60% 65% 35% / 35% 65% 40% 60%;
}
.journal-page:nth-child(6) .stain-3 { display: none; }

.journal-page:nth-child(7) .stain-1 {
  width: 105px; height: 92px;
  top: 50px; right: 55px;
  transform: rotate(-20deg);
  border-radius: 50% 50% 70% 30% / 30% 70% 50% 50%;
  opacity: 0.8;
}
.journal-page:nth-child(7) .stain-2 {
  width: 88px; height: 76px;
  bottom: 45px; left: 110px;
  transform: rotate(5deg);
  border-radius: 70% 30% 35% 65% / 65% 35% 70% 30%;
  opacity: 0.6;
}
.journal-page:nth-child(7) .stain-3 {
  width: 36px; height: 32px;
  top: 30%; right: 130px;
  transform: rotate(-10deg);
  border-radius: 30% 70% 60% 40% / 40% 60% 30% 70%;
  opacity: 0.5;
}

.journal-page:nth-child(8) .stain-1 {
  width: 98px; height: 86px;
  top: 35px; left: 80px; right: auto;
  transform: rotate(8deg);
  border-radius: 60% 40% 45% 55% / 55% 45% 60% 40%;
}
.journal-page:nth-child(8) .stain-2 {
  width: 74px; height: 65px;
  bottom: 75px; right: 90px; left: auto;
  transform: rotate(-15deg);
  border-radius: 45% 55% 30% 70% / 70% 30% 55% 45%;
  opacity: 0.7;
}
.journal-page:nth-child(8) .stain-3 {
  width: 38px; height: 34px;
  top: 55%; left: 130px;
  transform: rotate(18deg);
  border-radius: 55% 45% 70% 30% / 30% 70% 45% 55%;
  opacity: 0.45;
}

/* =============================================
   ENTRY HEADER
   ============================================= */
.entry-header {
  display: flex;
  align-items: baseline;
  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: 2.4rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

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

/* =============================================
   ENTRY BODY
   ============================================= */
.entry-body {
  font-family: 'Bad Script', cursive;
  font-size: 1.25rem;
  line-height: 1.9;
  color: var(--ink);
  position: relative;
  z-index: 1;
}

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

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

/* 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;
}

/* =============================================
   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 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2rem;
  font-family: 'Bad Script', cursive;
  font-size: 1.05rem;
}

.entry-nav-prev,
.entry-nav-next,
.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;
}

.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: 768px) {
  .journal-sidebar { display: none; }
  .site-layout     { display: block; }
}

@media (max-width: 600px) {
  body            { padding: 20px 12px; }
  .journal-page   { padding: 40px 28px; }
  .site-title     { font-size: 1.9rem; }
  .entry-day      { font-size: 1.9rem; }
  .entry-body     { font-size: 1.1rem; }
  .stain-3        { display: none; }
}
