/* ==========================================================================
   Elder Salviejo • Weekly Journal View
   Archival Editorial Edition — redesigned for clarity and typographic strength
   ========================================================================== */

body.week-view {
  background-color: var(--bg-canvas);
  color: var(--color-ink);
}

/* --------------------------------------------------------------------------
   Journal Sheet — each day's card
   -------------------------------------------------------------------------- */
.journal-sheet {
  background-color: #ffffff;
  border: 1px solid var(--border-archival);
  border-radius: 10px;
  box-shadow: 0 2px 12px -2px rgba(0, 0, 0, 0.04);
  padding: clamp(24px, 4vw, 48px);
  position: relative;
}

/* Subtle paper texture top-edge line */
.journal-sheet::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 5%, var(--border-archival) 20%, var(--border-archival) 80%, transparent 95%);
  border-radius: 10px 10px 0 0;
  opacity: 0.5;
}

/* --------------------------------------------------------------------------
   Day Divider Rule — "— MONDAY —"
   -------------------------------------------------------------------------- */
.day-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.day-divider-line {
  flex: 1;
  height: 1px;
  background: #e2ded9;
}

.day-divider-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #57534e;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
}

/* --------------------------------------------------------------------------
   Reflection Body Typography
   -------------------------------------------------------------------------- */
.journal-sheet p {
  font-family: var(--font-sans);
  font-size: clamp(14px, 1.5vw, 16px);
  line-height: 1.78;
  color: #44403c;
}

/* Drop-cap for the first letter of the first entry */
.docket-dropcap::first-letter {
  font-family: var(--font-serif);
  font-size: 3.6em;
  line-height: 0.78;
  float: left;
  margin: 0.05em 0.12em 0 0;
  font-weight: 700;
  color: var(--color-ink);
}

/* --------------------------------------------------------------------------
   Polaroid Card (weekly view) — big photo, text caption below
   -------------------------------------------------------------------------- */
.polaroid-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto 32px;
  background-color: #ffffff;
  padding: 10px 10px 0 10px;
  border-radius: 3px;
  border: 1px solid #dbd7d2;
  box-shadow:
    0 14px 28px -6px rgba(0, 0, 0, 0.1),
    0 4px 10px -2px rgba(0, 0, 0, 0.06),
    2px 2px 0 rgba(0,0,0,0.04);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease;
}

.polaroid-card:hover {
  transform: translateY(-3px) rotate(0.3deg);
  box-shadow:
    0 22px 44px -8px rgba(0, 0, 0, 0.14),
    0 6px 16px -3px rgba(0, 0, 0, 0.08),
    2px 2px 0 rgba(0,0,0,0.04);
}

.polaroid-photo-frame {
  width: 100%;
  background-color: #18181b;
  border-radius: 1px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.polaroid-photo-frame img {
  width: 100%;
  height: auto;
  max-height: 540px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  user-select: none;
}

/* Caption area — the thick white polaroid bottom */
.polaroid-caption {
  padding: 12px 6px 14px;
  text-align: center;
}

.polaroid-caption span:first-child {
  display: block;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: #292524;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.polaroid-caption .font-mono,
.polaroid-caption span:last-child {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: #a8a29e;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Scripture / Verse Callout Card
   -------------------------------------------------------------------------- */
.scripture-card {
  background-color: #fdfcfb;
  border: 1px solid var(--border-archival);
  border-left: 3px solid var(--color-crimson);
  border-radius: 8px;
  padding: clamp(20px, 3vw, 36px);
  margin: 32px 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.scripture-text {
  font-family: var(--font-serif);
  font-size: clamp(15px, 2vw, 19px);
  font-style: italic;
  line-height: 1.65;
  color: #1c1917;
  margin: 0 0 12px;
}

.scripture-ref {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-crimson);
  display: block;
}

/* --------------------------------------------------------------------------
   Week header archival card
   -------------------------------------------------------------------------- */
.week-header-card {
  background: #ffffff;
  border: 1px solid var(--border-archival);
  border-radius: 12px;
  padding: clamp(24px, 4vw, 48px);
  text-align: center;
  box-shadow: 0 2px 12px -2px rgba(0,0,0,0.04);
}

/* --------------------------------------------------------------------------
   Print & PDF
   -------------------------------------------------------------------------- */
@media print {
  *, *:before, *:after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    box-sizing: border-box !important;
  }

  html, body, body.week-view {
    background: #ffffff !important;
    color: #0c0a09 !important;
    font-size: 10pt !important;
    line-height: 1.5 !important;
  }

  .no-print { display: none !important; }

  .journal-sheet {
    box-shadow: none !important;
    border: 1px solid #d6d3d1 !important;
    padding: 18px !important;
    break-inside: avoid !important;
  }

  .journal-sheet::after { display: none !important; }

  .polaroid-card {
    box-shadow: none !important;
    border: 1px solid #d6d3d1 !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .scripture-card {
    box-shadow: none !important;
    border: 1px solid #e7e5e4 !important;
    border-left: 2px solid #991b1b !important;
  }
}

/* ==========================================================================
   True US Letter Scrapbook Sheet (8.5in x 11in)
   Exact match to the Reference Implementation
   ========================================================================== */

/* Fixed US Letter Canvas (8.5in x 11in) */
.sheet {
  width: 8.5in;
  height: 11in;
  max-width: 8.5in;
  background: #fbf7ee;
  padding: 0.32in 0.38in 0.28in 0.38in;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
  margin: 0 auto;
  font-family: 'Special Elite', monospace;
  color: #2b2b2b;
  box-sizing: border-box;
}

@page {
  size: letter portrait;
  margin: 0;
}

@media print {
  body.week-view {
    background: none !important;
    padding: 0 !important;
  }
  .no-print {
    display: none !important;
  }
  .sheet {
    box-shadow: none !important;
    width: 100% !important;
    height: 100vh !important;
    max-width: none !important;
    padding: 0.32in 0.38in 0.28in 0.38in !important;
    margin: 0 !important;
  }
}

/* Masthead */
.sheet-masthead {
  border-bottom: 2px dashed #9ca3af;
  padding-bottom: 4px;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.masthead-title h1 {
  font-family: 'Playfair Display', serif;
  font-size: 21px;
  letter-spacing: 0.5px;
  color: #1f2937;
  line-height: 1.1;
  font-weight: 700;
  margin: 0;
}

.masthead-title span {
  font-size: 8.5px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  font-weight: 700;
  color: #6b7280;
  display: block;
}

.masthead-meta {
  text-align: right;
  font-size: 9px;
  color: #6b7280;
  line-height: 1.35;
  font-family: 'Special Elite', monospace;
}

.masthead-meta strong {
  color: #111827;
  font-size: 10px;
}

/* Scripture Reflection Strip */
.scripture-strip {
  background: #efe8db;
  border-left: 3px solid #78350f;
  border-radius: 0 3px 3px 0;
  padding: 4px 8px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8.8px;
  line-height: 1.25;
}

.scripture-quote {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  color: #374151;
  max-width: 78%;
}

.scripture-ref {
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #78350f;
  text-align: right;
}

/* ========================================================
   Adaptive Justified Rows Scrapbook Layout (Gapless, Aspect-Ratio Locked)
   ======================================================== */
.scrapbook-adaptive-container {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  justify-content: space-between;
}

.scrapbook-row {
  display: flex;
  gap: 7px;
  width: 100%;
  min-height: 0;
  align-items: stretch;
}

.polaroid-card {
  background: #ffffff;
  border: 1px solid #dfd8cc;
  border-radius: 2px;
  padding: 4px 4px 5px 4px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  min-height: 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.polaroid-card:hover {
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.12);
  border-color: #cbd5e1;
}

.polaroid-card .photo-frame {
  flex: 1 1 0%;
  min-height: 0;
  width: 100%;
  background-color: #f8fafc;
  border-radius: 1px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.polaroid-card .photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Full uncropped frame preserved */
  display: block;
}

.polaroid-card .polaroid-chin {
  margin-top: 3px;
  padding: 2px 2px 0 2px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  flex-shrink: 0;
  border-top: 1px solid #f1f5f9;
}

.polaroid-card .chin-badge {
  font-family: 'Special Elite', monospace;
  font-size: 8px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.polaroid-card .chin-time {
  font-family: 'Special Elite', monospace;
  font-size: 7px;
  color: #64748b;
  margin-left: 2px;
  white-space: nowrap;
}

.polaroid-card .chin-caption {
  font-family: 'Caveat', cursive;
  font-size: 12px;
  line-height: 1;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  flex: 1;
  min-width: 0;
}

/* 12-Column x 12-Row Bento Grid */
.scrapbook-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(12, 1fr);
  gap: 7px;
  min-height: 0;
}

/* Polaroid Frame */
.polaroid {
  background: #ffffff;
  border: 1px solid #dfd8cc;
  border-radius: 2px;
  padding: 5px 5px 6px 5px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  min-height: 0;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.polaroid:hover {
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
}

/* Masking Tape Accent */
.tape {
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 12px;
  background: rgba(229, 221, 196, 0.78);
  border-radius: 1px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  z-index: 2;
}

/* Photo Frame inside Polaroid */
.photo-frame {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 1px;
  background-color: #e5e7eb;
  position: relative;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Polaroid Bottom Chin with Handwritten Details */
.polaroid-chin {
  margin-top: 5px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chin-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 7.5px;
  color: #6b7280;
  font-family: 'Special Elite', monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chin-header strong {
  color: #1f2937;
}

.chin-caption {
  font-family: 'Caveat', cursive;
  font-size: 13.5px;
  line-height: 1.1;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Natural Scrapbook Rotations */
.tilt-left  { transform: rotate(-0.7deg); }
.tilt-right { transform: rotate(0.8deg); }
.tilt-subtle { transform: rotate(-0.3deg); }

/* Grid Coordinates (Mon-Sun) */
.cell-mon { grid-column: span 6; grid-row: span 4; }
.cell-tue { grid-column: span 6; grid-row: span 4; }

.cell-wed { grid-column: span 4; grid-row: span 5; }
.cell-thu { grid-column: span 4; grid-row: span 5; }
.cell-fri { grid-column: span 4; grid-row: span 5; }

.cell-sat { grid-column: span 6; grid-row: span 3; }
.cell-sun { grid-column: span 6; grid-row: span 3; }

/* Split-Row Layout for Sat & Sun to Preserve Full Photo Details */
.cell-sat, .cell-sun {
  flex-direction: row;
  gap: 7px;
  padding: 5px 6px;
}
.cell-sat .photo-frame, .cell-sun .photo-frame {
  width: 48%;
  height: 100%;
}
.cell-sat .polaroid-chin, .cell-sun .polaroid-chin {
  width: 52%;
  margin-top: 0;
  justify-content: center;
}
.cell-sat .chin-caption, .cell-sun .chin-caption {
  white-space: normal;
  font-size: 13px;
}

/* Page Footer */
.sheet-footer {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  color: #9ca3af;
  margin-top: 5px;
  padding-top: 3px;
  border-top: 1px solid #e5e7eb;
  letter-spacing: 0.5px;
  font-family: 'Special Elite', monospace;
}

/* Mobile & Tablet Scaled Layout */
@media screen and (max-width: 860px) {
  .sheet {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 850px;
    padding: 16px 12px 14px 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  }
  .scrapbook-grid {
    gap: 5px;
    height: 700px;
  }
  .tape {
    width: 32px;
    height: 9px;
  }
  .chin-caption {
    font-size: 11px;
  }
  .cell-sat .chin-caption, .cell-sun .chin-caption {
    font-size: 10.5px;
  }
}

@media screen and (max-width: 540px) {
  .scrapbook-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: auto;
  }
  .sheet {
    height: auto;
    min-height: 0;
  }
  .polaroid {
    transform: none !important;
  }
  .cell-sat, .cell-sun {
    flex-direction: column;
  }
  .cell-sat .photo-frame, .cell-sun .photo-frame {
    width: 100%;
    height: 200px;
  }
  .cell-sat .polaroid-chin, .cell-sun .polaroid-chin {
    width: 100%;
    margin-top: 5px;
  }
  .photo-frame {
    height: 220px;
  }
}
