/* ==========================================================================
   WICHTELHAUS MAGISCHES TAGEBUCH - SECURE LOGIN & HALF-STRENGTH BACKGROUND BLUR
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700&family=MedievalSharp&family=Caveat:wght@600;700&family=Merriweather:ital,wght@0,300;0,400;0,700;1,300&display=swap');

:root {
  --color-ink-dark: #231208;
  --color-ink-medium: #422312;
  --color-gold: #c59b27;
  --color-gold-glow: #ffd700;
  --color-crimson: #8b1e1e;
  --font-title: 'MedievalSharp', 'Cinzel Decorative', cursive, serif;
  --font-script: 'Caveat', cursive, serif;
  --font-body: 'Merriweather', Georgia, serif;
}

/* Reset & Global */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--color-ink-dark);
  line-height: 1.8;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background-color: #120b07;
}

/* Fixed Depth-of-field Background Layer (Half-strength Blur: 2.5px) */
body::before {
  content: '';
  position: fixed;
  top: -10px;
  left: -10px;
  width: calc(100vw + 20px);
  height: calc(100vh + 20px);
  z-index: 0;
  pointer-events: none;

  background-image: url('Hintergrund01.jpg');
  background-position: top center;
  background-size: 100% auto;
  background-repeat: no-repeat;
  background-attachment: fixed;

  /* Atmospheric Half-Strength Blur (2.5px) & Soft Opacity */
  filter: blur(2.5px) opacity(0.85) brightness(0.92);
  transform: scale(1.02);
}

/* Magic Canvas for ambient sparkles/snow */
#magic-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}

.site-wrapper {
  position: relative;
  z-index: 2;
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 6rem 1.25rem;
}

/* Header Banner with Freigestelltem Header.png */
.header-banner {
  text-align: center;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  background: transparent;
  border: none;
  box-shadow: none;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.site-header-img {
  max-width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.95));
  transition: transform 0.3s ease;
}

.site-header-img:hover {
  transform: scale(1.015);
}

/* Control Toolbar */
.toolbar-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3rem;
  background: rgba(20, 12, 7, 0.92);
  padding: 0.85rem 1.25rem;
  border-radius: 30px;
  border: 1px solid rgba(197, 155, 39, 0.65);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.75);
}

.toolbar-actions-left,
.toolbar-actions-right {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.btn-magic {
  background: linear-gradient(135deg, #4d2b17 0%, #683a20 100%);
  color: #fff2d0;
  border: 1px solid var(--color-gold);
  padding: 0.5rem 1.1rem;
  border-radius: 20px;
  font-family: var(--font-title);
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.btn-magic:hover {
  background: linear-gradient(135deg, #683a20 0%, #874929 100%);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(255, 215, 0, 0.4);
}

.btn-magic.active {
  border-color: var(--color-gold-glow);
  box-shadow: 0 0 14px var(--color-gold-glow);
}

.btn-magic-subtle {
  background: rgba(38, 22, 12, 0.85);
  color: #eedca4;
  border: 1px dashed rgba(197, 155, 39, 0.6);
  padding: 0.45rem 1rem;
  border-radius: 20px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-magic-subtle:hover {
  background: var(--color-crimson);
  color: #ffffff;
  border-style: solid;
}

/* Story Feed */
.story-feed {
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

/* ==========================================================================
   PURE PARCHMENT CARD (BRIEF.PNG) WITH REAL FREIGESTELLTES WAX SEAL (SIEGEL.PNG)
   ========================================================================== */

.parchment-scroll-wrapper {
  position: relative;
  margin: 0;
  filter: drop-shadow(0 22px 40px rgba(0, 0, 0, 0.9));
}

.parchment-scroll {
  position: relative;
  z-index: 5;

  /* Freigestellte Brief.png with transparent outer background */
  background-image: url('Brief.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center center;
  background-color: transparent;

  /* Comfortable padding directly on Brief.png paper surface */
  padding: 4.8rem 4.2rem 4.5rem 4.2rem;

  transition: transform 0.3s ease, filter 0.3s ease;
}

.parchment-scroll-wrapper:hover .parchment-scroll {
  transform: scale(1.006);
}

/* Direct Ink Text Container - Clean, No borders, No background fill */
.scroll-inner-content {
  background: transparent;
  padding: 0;
  border: none;
}

/* Header inside Scroll */
.scroll-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.2rem;
  border-bottom: 1px solid rgba(85, 42, 18, 0.25);
  padding-bottom: 1.2rem;
  margin-bottom: 1.8rem;
}

.story-meta {
  flex: 1;
}

.story-date-badge {
  display: inline-block;
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--color-crimson);
  letter-spacing: 0.5px;
  background: transparent;
  padding: 0;
  margin-bottom: 0.5rem;
}

.story-title {
  font-family: var(--font-title);
  font-size: 2.15rem;
  color: var(--color-ink-dark);
  line-height: 1.3;
  text-shadow: none;
}

/* Authentic Freigestelltes Siegel Image (Siegel.png) */
.wax-seal-img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(2px 5px 12px rgba(0, 0, 0, 0.55));
  transition: transform 0.3s ease, filter 0.3s ease;
}

.wax-seal-img:hover {
  transform: scale(1.08) rotate(4deg);
  filter: drop-shadow(3px 8px 16px rgba(0, 0, 0, 0.65));
}

/* Image Frame */
.story-image-container {
  margin: 1.8rem 0;
  text-align: center;
}

.story-img {
  max-width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: 4px;
  border: 4px solid rgba(253, 248, 230, 0.9);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  transition: transform 0.3s ease;
}

.story-img:hover {
  transform: scale(1.015);
}

.story-caption {
  font-family: var(--font-script);
  font-size: 1.35rem;
  color: var(--color-ink-medium);
  margin-top: 0.5rem;
}

/* Text Body - Looks written directly on parchment */
.story-body {
  font-size: 1.15rem;
  color: var(--color-ink-dark);
  white-space: pre-line;
  line-height: 1.85;
  font-family: var(--font-body);
}

.story-body p {
  margin-bottom: 1.2rem;
}

.scroll-footer {
  margin-top: 2.2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(85, 42, 18, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-script);
  font-size: 1.4rem;
  color: var(--color-ink-medium);
}

.story-actions-inline {
  display: flex;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--color-ink-medium);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.btn-icon:hover {
  background: rgba(139, 30, 30, 0.12);
  color: var(--color-crimson);
}

/* Empty Feed State */
.empty-feed {
  background: rgba(251, 244, 216, 0.95);
  padding: 3rem 2rem;
  text-align: center;
  border-radius: 12px;
  border: 2px dashed var(--color-gold);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Footer Section */
.site-footer {
  margin-top: 4.5rem;
  text-align: center;
  color: #eedca4;
  padding: 2rem 1rem;
  border-top: 1px solid rgba(197, 155, 39, 0.35);
}

.footer-admin-trigger {
  margin-top: 1rem;
}

.btn-admin {
  background: rgba(28, 16, 10, 0.85);
  color: var(--color-gold);
  border: 1px dashed var(--color-gold);
  padding: 0.45rem 1.1rem;
  border-radius: 18px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-admin:hover {
  background: var(--color-crimson);
  color: #ffffff;
  border-style: solid;
}

/* Modal / Scriptorium Admin Drawer */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 5, 3, 0.88);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: linear-gradient(135deg, #fbf4d8 0%, #ebdaaf 100%);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 16px;
  padding: 2rem 2.2rem;
  border: 2px solid var(--color-gold);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.85), 0 0 30px rgba(197, 155, 39, 0.4);
  position: relative;
}

.modal-card-sm {
  max-width: 420px;
}

.login-error-msg {
  background: rgba(139, 30, 30, 0.15);
  border: 1px solid var(--color-crimson);
  color: var(--color-crimson);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-top: 0.8rem;
  text-align: center;
  font-weight: 600;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--color-gold);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: var(--color-ink-dark);
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--color-ink-medium);
  line-height: 1;
}

.btn-close:hover {
  color: var(--color-crimson);
}

/* Form Controls */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--color-ink-dark);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-family: var(--font-body);
  font-size: 1rem;
  border: 1px solid #c8b98e;
  border-radius: 8px;
  background: #ffffff;
  color: var(--color-ink-dark);
  outline: none;
}

.form-control:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 8px rgba(197, 155, 39, 0.4);
}

textarea.form-control {
  min-height: 140px;
  resize: vertical;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(107, 67, 27, 0.25);
}

.btn-primary {
  background: linear-gradient(135deg, #8b1e1e 0%, #5d1212 100%);
  color: #ffffff;
  border: 1px solid var(--color-gold);
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-family: var(--font-title);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #a62626 0%, #701717 100%);
  box-shadow: 0 4px 12px rgba(139, 30, 30, 0.4);
}

.btn-secondary {
  background: #eae0c0;
  color: var(--color-ink-dark);
  border: 1px solid #baaa7c;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #dfd2ac;
}

/* Responsive */
@media (max-width: 650px) {
  .parchment-scroll {
    padding: 3.2rem 1.8rem;
  }
  .wax-seal-img {
    width: 62px;
    height: 62px;
  }
  .story-title {
    font-size: 1.5rem;
  }
  .toolbar-container {
    flex-direction: column;
    align-items: stretch;
  }
}
