/* 
   ==========================================================================
   THE DAILY SAINTS CHRONICLE: Vintage 1930s Design System & Stylesheet
   ==========================================================================
*/

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

/* --- Modern Custom Properties (HSL Design System) --- */
:root {
  /* Vintage Paper Colors */
  --paper-bg-base: hsl(38, 44%, 86%);
  --paper-grain: hsl(38, 38%, 81%);
  --paper-lighter: hsl(38, 52%, 91%);
  --paper-border: hsl(35, 30%, 70%);

  /* Weathered Print Inks */
  --ink-primary: hsl(0, 0%, 11%);
  --ink-weathered: hsl(0, 0%, 25%);
  --accent-gold: hsl(28, 45%, 32%);
  --accent-red: hsl(0, 56%, 28%);
  
  /* Shadow and Overlay */
  --shadow-newspaper: 0 15px 35px rgba(45, 35, 20, 0.25), 0 5px 15px rgba(0, 0, 0, 0.1);
  --shadow-stamp: inset 0 0 4px rgba(0,0,0,0.2);
  
  /* Typography */
  --font-masthead: 'Cinzel Decorative', serif;
  --font-headline: 'Cinzel', serif;
  --font-body: 'Lora', serif;
  --font-stamp: 'Special Elite', system-ui;
  
  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- Base Resets & Layout Mechanics --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: hsl(32, 20%, 15%);
  background-image: radial-gradient(circle, hsl(32, 20%, 20%) 0%, hsl(32, 20%, 10%) 100%);
  color: var(--ink-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  padding: 2.5rem 1rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: scroll;
}

/* --- Vintage Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: hsl(32, 20%, 10%);
}
::-webkit-scrollbar-thumb {
  background: var(--paper-border);
  border: 2px solid hsl(32, 20%, 10%);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--paper-grain);
}

/* --- Newspaper Sheet Container (Physical Vibe) --- */
.newspaper-sheet {
  background-color: var(--paper-bg-base);
  background-image: 
    linear-gradient(rgba(0,0,0,0.015) 50%, rgba(255,255,255,0.015) 50%),
    radial-gradient(var(--paper-lighter) 15%, transparent 20%),
    radial-gradient(rgba(0,0,0,0.02) 15%, transparent 20%);
  background-size: 100% 4px, 8px 8px, 12px 12px;
  max-width: 1120px;
  width: 100%;
  padding: 2rem;
  border: 1px solid var(--paper-border);
  box-shadow: var(--shadow-newspaper);
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

/* --- Aged Paper Edge Distress (Subtle Vignette) --- */
.newspaper-sheet::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  box-shadow: inset 0 0 100px rgba(78, 56, 32, 0.25);
  pointer-events: none;
  z-index: 5;
}

/* --- Chronicle Classified Utility Box in Sidebar --- */
.sidebar-classified-box {
  border: 2px solid var(--ink-primary);
  padding: 0.75rem;
  margin-top: 1.25rem;
  text-align: center;
  background-color: rgba(0,0,0,0.015);
  box-shadow: inset 0 0 5px rgba(0,0,0,0.05);
}

.classified-heading {
  font-family: var(--font-headline);
  font-size: 0.95rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-red);
  border-bottom: 2px double var(--ink-primary);
  padding-bottom: 0.25rem;
  margin-bottom: 0.5rem;
}

.classified-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.classified-btn {
  background: none;
  border: 1px solid var(--ink-primary);
  color: var(--ink-primary);
  padding: 0.4rem 0.6rem;
  font-family: var(--font-headline);
  font-weight: bold;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: var(--transition-smooth);
}

.classified-btn:hover {
  background: var(--ink-primary);
  color: var(--paper-bg-base);
}

.classified-btn:active {
  transform: scale(0.98);
}

.vintage-btn {
  background: var(--ink-primary);
  color: var(--paper-bg-base);
  border: 2px solid var(--paper-border);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-headline);
  font-weight: bold;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}

.vintage-btn:hover {
  background: var(--accent-gold);
  color: var(--paper-lighter);
  transform: translateY(-2px);
}

.vintage-btn:active {
  transform: translateY(1px);
}

/* --- Header Section (Three Column Layout) --- */
.newspaper-header {
  border-bottom: 5px double var(--ink-primary);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

/* Row 1: Issue Details, Pricing and Stamps */
.header-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--ink-primary);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
  font-family: var(--font-stamp);
  font-size: 0.9rem;
}

.issue-stamp {
  color: var(--accent-red);
  font-weight: bold;
  letter-spacing: 0.5px;
}

.price-tag {
  border: 2px dashed var(--accent-red);
  padding: 0.2rem 0.5rem;
  font-weight: bold;
  color: var(--accent-red);
  transform: rotate(-3deg);
  box-shadow: var(--shadow-stamp);
}

/* Row 2: Epic Newspaper Masthead */
.masthead-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 0;
  position: relative;
}

.masthead-emblem-left, .masthead-emblem-right {
  max-width: 90px;
  height: auto;
  filter: contrast(1.2) sepia(0.3) grayscale(0.2);
  transition: var(--transition-smooth);
}

.masthead-emblem-left { margin-right: 1.5rem; }
.masthead-emblem-right { margin-left: 1.5rem; }

.masthead-title {
  font-family: var(--font-masthead);
  font-size: 4rem;
  text-align: center;
  line-height: 1;
  letter-spacing: -1px;
  color: var(--ink-primary);
  text-shadow: 1px 1px 0 var(--paper-lighter);
}

/* Row 3: Vintage Double-Rule Date and Weather Banner */
.date-weather-banner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-top: 4px double var(--ink-primary);
  border-bottom: 4px double var(--ink-primary);
  padding: 0.4rem 0;
  font-family: var(--font-headline);
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  text-align: center;
}

.banner-left { text-align: left; }
.banner-right { text-align: right; }
.banner-center {
  font-size: 1.05rem;
  color: var(--accent-gold);
}

/* --- Main Layout Grid --- */
.newspaper-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  position: relative;
}

/* Left Sidebar: "Also Today" Section */
.also-today-sidebar {
  border-right: 1px solid rgba(0, 0, 0, 0.15);
  padding-right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-heading {
  font-family: var(--font-headline);
  font-size: 1.3rem;
  border-bottom: 2px solid var(--ink-primary);
  padding-bottom: 0.3rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-red);
  text-align: center;
}

.sidebar-headline-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-item {
  border-bottom: 1px dashed rgba(0, 0, 0, 0.12);
  padding-bottom: 0.75rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.sidebar-item:last-child {
  border-bottom: none;
}

.sidebar-item-title {
  font-family: var(--font-headline);
  font-size: 1.05rem;
  font-weight: bold;
  line-height: 1.25;
  margin-bottom: 0.25rem;
  transition: var(--transition-smooth);
}

.sidebar-item:hover .sidebar-item-title,
.sidebar-item.active .sidebar-item-title {
  color: var(--accent-gold);
}

.sidebar-item-sub {
  font-size: 0.8rem;
  color: var(--ink-weathered);
  font-style: italic;
  display: block;
}

.sidebar-advertisement {
  border: 3px double var(--ink-primary);
  padding: 0.75rem;
  margin-top: auto;
  text-align: center;
  background-color: rgba(0,0,0,0.02);
}

.sidebar-advertisement p {
  font-family: var(--font-headline);
  font-size: 0.85rem;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  color: var(--accent-gold);
}

.sidebar-advertisement span {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--ink-weathered);
}

/* --- Right Side: Main Article Layout --- */
.main-article-area {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Saint Main Headline Section */
.article-headline-block {
  text-align: center;
  border-bottom: 1px solid rgba(0,0,0,0.15);
  padding-bottom: 1rem;
}

.article-category-stamp {
  font-family: var(--font-stamp);
  color: var(--accent-red);
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: bold;
  letter-spacing: 2px;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.article-main-title {
  font-family: var(--font-headline);
  font-size: 2.8rem;
  font-weight: bold;
  line-height: 1.1;
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
}

.article-sub-title {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink-weathered);
}

/* Main Content Structure: Layout & Text Columns */
.article-grid-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

/* Two Column Text Layout representing actual Print Columns */
.article-columns-container {
  column-count: 2;
  column-gap: 1.75rem;
  column-rule: 1px solid rgba(0, 0, 0, 0.12);
  text-align: justify;
}

.article-p {
  margin-bottom: 1rem;
  text-indent: 1.5rem;
}

.article-p:first-of-type {
  text-indent: 0;
}

/* Majestic Drop-Cap for the very first letter of the article */
.article-p:first-of-type::first-letter {
  font-family: var(--font-headline);
  font-size: 3.8rem;
  float: left;
  line-height: 0.85;
  padding: 0.1rem 0.5rem 0 0;
  margin-top: 0.1rem;
  color: var(--accent-red);
  font-weight: bold;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.1);
}

/* Retro Illustration Frame (Quarter-Page Etching) */
.article-illustration-frame {
  float: none;
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 0 1.5rem 0;
  border: 4px double var(--ink-primary);
  padding: 0.4rem;
  background-color: var(--paper-lighter);
  box-shadow: 3px 3px 10px rgba(0,0,0,0.1);
  text-align: center;
  break-inside: avoid;
}

.article-illustration-frame img {
  width: 100%;
  height: auto;
  filter: contrast(1.2) sepia(0.2) grayscale(0.2);
  border: 1px solid rgba(0,0,0,0.15);
  display: block;
}

.illustration-caption {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-style: italic;
  margin-top: 0.5rem;
  line-height: 1.3;
  color: var(--ink-weathered);
  border-top: 1px dashed rgba(0,0,0,0.15);
  padding-top: 0.4rem;
}

/* Patronage and Miracles Section */
.saint-metadata-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
  border-top: 1px solid rgba(0,0,0,0.15);
  border-bottom: 1px solid rgba(0,0,0,0.15);
  padding: 1.25rem 0;
  margin-top: 0.5rem;
}

.metadata-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.metadata-label {
  font-family: var(--font-headline);
  font-size: 1rem;
  font-weight: bold;
  text-transform: uppercase;
  color: var(--accent-gold);
  border-bottom: 1px dashed rgba(0,0,0,0.15);
  padding-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.patron-badges-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.patron-badge {
  background-color: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0,0,0,0.15);
  font-family: var(--font-headline);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  font-weight: bold;
  text-transform: uppercase;
  color: var(--ink-primary);
}

.miracle-description {
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: justify;
}

/* Vintage Devotional Prayer Card Block */
.devotional-prayer-card {
  border: 6px double var(--ink-primary);
  padding: 1.5rem;
  background-color: var(--paper-lighter);
  background-image: radial-gradient(ellipse at center, rgba(255,255,255,0.4) 0%, transparent 100%);
  margin: 0.5rem 0;
  position: relative;
  text-align: center;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.03);
}

.prayer-card-header {
  font-family: var(--font-headline);
  font-weight: bold;
  text-transform: uppercase;
  font-size: 1rem;
  letter-spacing: 2px;
  color: var(--accent-red);
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.prayer-text {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto;
  color: var(--ink-weathered);
}

/* Editorial Highlight Box: Fun Fact */
.fun-fact-box {
  border: 2px dashed var(--accent-gold);
  background-color: rgba(175, 120, 45, 0.04);
  padding: 1rem;
  position: relative;
}

.fun-fact-label {
  font-family: var(--font-stamp);
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--accent-gold);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.fun-fact-content {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-primary);
}

/* Bottom References & Citations Column */
.editorial-references-section {
  border-top: 3px double var(--ink-primary);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.references-heading {
  font-family: var(--font-headline);
  font-size: 0.9rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-weathered);
}

.references-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.reference-link-btn {
  background: none;
  border: none;
  border-bottom: 1px solid var(--accent-red);
  font-family: var(--font-body);
  color: var(--accent-red);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.1rem 0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition-smooth);
}

.reference-link-btn:hover {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
}

/* --- Popovers & Dialog Overlays (Vintage Library Catalog Theme) --- */
dialog.vintage-dialog {
  border: 3px double var(--ink-primary);
  background-color: var(--paper-bg-base);
  background-image: linear-gradient(rgba(0,0,0,0.01) 50%, rgba(255,255,255,0.01) 50%), radial-gradient(var(--paper-lighter) 15%, transparent 20%);
  background-size: 100% 4px, 8px 8px;
  color: var(--ink-primary);
  padding: 0;
  margin: auto;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  border-radius: 0;
  animation: dialog-fade-in 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: clip;
}

dialog.vintage-dialog::backdrop {
  background-color: rgba(22, 16, 8, 0.65);
  backdrop-filter: blur(4px) sepia(0.25);
  animation: backdrop-fade-in 0.3s ease;
}

.dialog-card {
  padding: 1.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dialog-header {
  border-bottom: 2px solid var(--ink-primary);
  padding-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.dialog-stamp {
  font-family: var(--font-stamp);
  font-size: 0.75rem;
  color: var(--accent-red);
  text-transform: uppercase;
  border: 1px solid var(--accent-red);
  padding: 0.1rem 0.4rem;
  font-weight: bold;
}

.dialog-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-weathered);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.dialog-close-btn:hover {
  color: var(--accent-red);
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dialog-title {
  font-family: var(--font-headline);
  font-size: 1.4rem;
  font-weight: bold;
  line-height: 1.2;
}

.dialog-publisher {
  font-family: var(--font-headline);
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: bold;
  color: var(--accent-gold);
}

.dialog-text {
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: justify;
  color: var(--ink-weathered);
}

.dialog-actions {
  border-top: 1px dashed rgba(0,0,0,0.15);
  padding-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

/* Calendar Archive Modal Styling */
dialog#archive-dialog {
  max-width: 600px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.calendar-day-header {
  font-family: var(--font-headline);
  font-weight: bold;
  font-size: 0.75rem;
  text-align: center;
  color: var(--accent-gold);
  text-transform: uppercase;
}

.calendar-cell {
  background: var(--paper-lighter);
  border: 1px solid rgba(0,0,0,0.12);
  padding: 0.75rem 0.25rem;
  text-align: center;
  font-family: var(--font-headline);
  font-size: 0.9rem;
  font-weight: bold;
  cursor: not-allowed;
  color: rgba(0,0,0,0.3);
  transition: var(--transition-smooth);
}

.calendar-cell.selectable {
  cursor: pointer;
  color: var(--ink-primary);
  border: 1px solid var(--ink-primary);
}

.calendar-cell.selectable:hover {
  background: var(--accent-gold);
  color: var(--paper-lighter);
}

.calendar-cell.active-day {
  background: var(--accent-red);
  color: var(--paper-lighter);
  border-color: var(--accent-red);
}

/* --- Custom Animations --- */
@keyframes dialog-fade-in {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes backdrop-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-transition {
  animation: fade-content 0.4s ease-in-out;
}

@keyframes fade-content {
  from { opacity: 0.2; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Responsive Adaptations (Media Queries) --- */
@media (max-width: 900px) {
  body {
    padding: 1rem 0.5rem;
  }
  
  .newspaper-sheet {
    padding: 1.25rem;
  }
  
  .masthead-title {
    font-size: 2.8rem;
  }
  
  .masthead-emblem-left, .masthead-emblem-right {
    max-width: 60px;
  }

  .newspaper-body {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .also-today-sidebar {
    border-right: none;
    border-bottom: 2px dashed var(--ink-primary);
    padding-right: 0;
    padding-bottom: 1.25rem;
  }
  
  .sidebar-advertisement {
    display: none;
  }
}

@media (max-width: 600px) {
  .header-meta-row {
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    text-align: center;
  }
  
  .date-weather-banner {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  
  .banner-left, .banner-right {
    text-align: center;
  }

  .article-columns-container {
    column-count: 1;
  }
  
  .article-illustration-frame {
    float: none;
    width: 100%;
    margin-left: 0;
    max-width: 320px;
    margin: 0 auto 1.25rem auto;
  }
  
  .saint-metadata-row {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   PRINT EDITION MEDIA QUERIES (Cmd+P Re-formatting)
   ========================================================================== */
@media print {
  @page {
    size: letter;
    margin: 0.5in;
  }
  
  /* Reset Background Styles for clean B&W printout */
  body {
    background: white;
    color: black;
    padding: 0;
    font-size: 12pt;
  }
  
  .newspaper-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  
  .newspaper-sheet::before {
    display: none !important;
  }
  
  /* Hide Interactive Web Components */
  .controls-dock,
  .also-today-sidebar,
  .editorial-references-section,
  dialog {
    display: none !important;
  }
  
  /* Expand Newspaper Layout to single full sheet */
  .newspaper-body {
    grid-template-columns: 1fr !important;
  }
  
  .masthead-title {
    font-size: 3.5rem !important;
  }
  
  .article-main-title {
    font-size: 2.2rem !important;
  }
  
  .article-columns-container {
    column-count: 2 !important;
    column-gap: 20pt !important;
    column-rule: 1px solid #333 !important;
  }
  
  /* Format Prayer card and facts for grayscale printing */
  .devotional-prayer-card {
    border: 3px double black !important;
    background: transparent !important;
    page-break-inside: avoid;
  }
  
  .fun-fact-box {
    border: 1px dashed black !important;
    background: transparent !important;
    page-break-inside: avoid;
  }
  
  .article-illustration-frame {
    border: 2px solid black !important;
    background: transparent !important;
  }
}
