/* ============================================================
   Liturgical Calendar — Main Stylesheet
   ============================================================ */

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

:root {
  /* Exact LCMS liturgical colors matching the Church Year Calendar PDF */
  --blue:    #0070C0;   /* Advent */
  --white:   #A07820;   /* White seasons (feasts) — gold accent */
  --green:   #00B050;   /* Ordinary Time */
  --purple:  #7030A0;   /* Lent */
  --scarlet: #C00000;   /* Holy Week */
  --red:     #FF0000;   /* Pentecost, Reformation, martyrs */
  --black:   #000000;   /* Ash Wednesday, Good Friday */
  --bg:      #F7F5F0;
  --card-bg: #FFFFFF;
  --border:  #DDD8CE;
  --text:    #2C2C2C;
  --muted:   #777;
  --radius:  6px;
  --shadow:  0 1px 4px rgba(0,0,0,0.10);
}

body {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header ---- */
header {
  background: #1A3A5C;
  color: white;
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 1.15rem;
  font-weight: bold;
  letter-spacing: 0.03em;
  color: #E8D5A3;
}
nav a {
  color: #C8D8E8;
  margin-left: 1.5rem;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
}
nav a:hover { color: white; text-decoration: none; }

/* ---- Main / Footer ---- */
main { flex: 1; padding: 2rem 1.5rem; max-width: 1400px; margin: 0 auto; width: 100%; }
footer {
  background: #1A3A5C;
  color: #AAB8C8;
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
  font-family: Arial, sans-serif;
  margin-top: 3rem;
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 0.45rem 1.1rem;
  background: #1A3A5C;
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 0.875rem;
  text-decoration: none;
  transition: background 0.15s;
}
.btn:hover { background: #2A5A8C; color: white; text-decoration: none; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-outline {
  background: transparent;
  border: 1.5px solid #1A3A5C;
  color: #1A3A5C;
}
.btn-outline:hover { background: #1A3A5C; color: white; }
.btn-pdf { background: #8B0000; }
.btn-pdf:hover { background: #AA0000; }

/* ---- Forms ---- */
label { font-family: Arial, sans-serif; font-size: 0.85rem; display: flex; flex-direction: column; gap: 0.25rem; }
input[type="number"], input[type="date"], select {
  padding: 0.4rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: white;
  font-family: Arial, sans-serif;
}
input:focus, select:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.form-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.checkbox-label { flex-direction: row; align-items: center; gap: 0.4rem; font-size: 0.85rem; }
.checkbox-label input { width: auto; }

/* ---- Hero / Index ---- */
.hero {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
}
.hero h1 {
  font-size: 2rem;
  color: #1A3A5C;
  margin-bottom: 0.3rem;
}
.hero-sub { color: var(--muted); font-size: 1rem; font-family: Arial, sans-serif; margin-bottom: 1.5rem; }

.today-card {
  max-width: 560px;
  margin: 0 auto 2rem;
  background: white;
  border: 2px solid #1A3A5C;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  text-align: left;
}
.today-card.loading { border-color: var(--border); }
.today-label { font-family: Arial, sans-serif; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.5rem; }
.today-loading { color: var(--muted); font-family: Arial, sans-serif; font-size: 0.9rem; }
.today-date { font-family: Arial, sans-serif; font-size: 0.9rem; color: var(--muted); }
.today-name { font-size: 1.3rem; color: #1A3A5C; font-weight: bold; margin: 0.2rem 0; }
.today-meta { font-family: Arial, sans-serif; font-size: 0.82rem; color: #555; }
.today-file { font-family: monospace; font-size: 0.8rem; color: #888; margin-top: 0.5rem; background: #F0F0F0; padding: 0.3rem 0.5rem; border-radius: 4px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.4rem;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1.1rem; color: #1A3A5C; margin-bottom: 0.5rem; }
.card p { font-family: Arial, sans-serif; font-size: 0.875rem; color: #555; margin-bottom: 1rem; }
.quick-form { display: flex; flex-direction: column; gap: 0.75rem; }

/* ---- Page headers ---- */
.page-header { margin-bottom: 1rem; }
.page-header h1 { font-size: 1.6rem; color: #1A3A5C; }
.page-sub { font-family: Arial, sans-serif; font-size: 0.875rem; color: var(--muted); margin-top: 0.2rem; }

/* ---- Toolbar ---- */
.toolbar {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.toolbar-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }

/* ---- Legend ---- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
}
.swatch {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  color: white;
  font-size: 0.75rem;
}

/* ---- Liturgical color classes — exact LCMS PDF colors ---- */
.season-blue   { background-color: #0070C0; }   /* Advent */
.season-white  { background-color: #D4AA40; }   /* White seasons — gold accent */
.season-green  { background-color: #00B050; }   /* Ordinary Time */
.season-purple { background-color: #7030A0; }   /* Lent */
.season-scarlet{ background-color: #C00000; }   /* Holy Week */
.season-red    { background-color: #FF0000; }   /* Pentecost / Reformation */
.season-black  { background-color: #000000; }   /* Ash Wednesday / Good Friday */

/* ---- Calendar Table ---- */
.cal-table-wrap { overflow-x: auto; }
.cal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: white;
  box-shadow: var(--shadow);
  border-radius: 6px;
  overflow: hidden;
}
.cal-table thead tr {
  background: #1A3A5C;
  color: white;
}
.cal-table th {
  padding: 0.5rem 0.6rem;
  font-family: Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.cal-table td {
  padding: 0.35rem 0.5rem;
  vertical-align: top;
  border-bottom: 1px solid #EBEBEB;
  font-size: 0.8rem;
}
.cal-table tr:hover td { background: #F0F5FF !important; }

/* Column widths */
.col-season  { width: 5.5rem; }
.col-date    { width: 6rem; white-space: nowrap; }
.col-name    { width: 13rem; }
.col-reading { width: 11rem; }
.col-psalm   { width: 7rem; }
.col-epistle { width: 10rem; }
.col-gospel  { width: 12rem; }

.season-tag {
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: bold;
  color: white;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  text-align: center;
  vertical-align: top;
}
/* Each season color for the tag cell */
.ev-row.season-blue    .season-tag { background: #0070C0; }
.ev-row.season-white   .season-tag { background: #D4AA40; }
.ev-row.season-green   .season-tag { background: #00B050; }
.ev-row.season-purple  .season-tag { background: #7030A0; }
.ev-row.season-scarlet .season-tag { background: #C00000; }
.ev-row.season-red     .season-tag { background: #FF0000; }
.ev-row.season-black   .season-tag { background: #000000; }

.row-feast td { background: #FFFBF0 !important; }
.row-minor td { opacity: 0.85; }
.cal-table tbody tr:nth-child(even) td { background: #FAFAFA; }

/* Left color stripe matching the PDF's season column */
.ev-row.season-blue    td:first-child { border-left: 4px solid #0070C0; }
.ev-row.season-white   td:first-child { border-left: 4px solid #D4AA40; }
.ev-row.season-green   td:first-child { border-left: 4px solid #00B050; }
.ev-row.season-purple  td:first-child { border-left: 4px solid #7030A0; }
.ev-row.season-scarlet td:first-child { border-left: 4px solid #C00000; }
.ev-row.season-red     td:first-child { border-left: 4px solid #FF0000; }
.ev-row.season-black   td:first-child { border-left: 4px solid #000000; }

.date-main { font-weight: bold; }
.date-year { color: var(--muted); font-size: 0.75rem; display: block; }
.date-dow  { color: var(--muted); font-size: 0.72rem; font-family: Arial, sans-serif; }

.ev-name     { display: block; }
.feast-name  { font-weight: bold; color: #8B0000; }
.proper-tag  { display: inline-block; font-family: Arial, sans-serif; font-size: 0.68rem; color: #888; background: #EEE; border-radius: 3px; padding: 0 4px; margin-top: 2px; }
.alt-tag     { display: block; font-size: 0.72rem; color: #666; font-style: italic; }

.reading-ref {
  color: #1A3A5C;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: Arial, sans-serif;
}
.reading-ref:hover { text-decoration: underline; color: #B22222; }
.reading-alt { font-size: 0.75rem; color: #666; }

.year-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
}

/* ---- Lookup Page ---- */
.lookup-form-wrap {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  max-width: 640px;
}
.lookup-form .form-row { align-items: flex-end; }

.lookup-result {
  max-width: 800px;
}
.result-header {
  padding: 1.25rem 1.5rem;
  border-radius: 8px 8px 0 0;
  color: white;
  margin-bottom: 0;
}
.result-header.season-white { color: #333; }
.result-date { font-family: Arial, sans-serif; font-size: 0.85rem; opacity: 0.9; }
.result-name { font-size: 1.5rem; font-weight: bold; margin: 0.2rem 0; }
.result-meta { font-family: Arial, sans-serif; font-size: 0.82rem; opacity: 0.85; }
.result-meta span { margin-right: 0.75rem; }
.color-dot { padding: 0.1rem 0.5rem; border-radius: 10px; background: rgba(255,255,255,0.2); }

.result-readings, .result-file {
  background: white;
  border: 1px solid var(--border);
  border-top: none;
  padding: 1.25rem 1.5rem;
}
.result-file { border-radius: 0 0 8px 8px; }
.result-readings h3, .result-file h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.75rem;
  font-family: Arial, sans-serif;
}

.readings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}
.reading-item { }
.reading-label {
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.reading-refs { font-size: 0.9rem; }
.reading-ref { font-size: 0.9rem; }
.reading-or { font-family: Arial, sans-serif; font-size: 0.75rem; color: #999; margin: 0 0.25rem; }

.file-label-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #F0F0F0;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-family: monospace;
}
.file-label-box code { font-size: 0.9rem; flex: 1; }

.result-nav { margin-top: 1rem; }

.result-week-note {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-top: 0.25rem;
  font-style: italic;
}

.minor-feast-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: #FFFBF0;
  border-left: 3px solid #B48C32;
  font-size: 0.875rem;
  margin-bottom: 0;
}
.minor-feast-label { color: #666; font-weight: 500; }
.minor-feast-name  { font-weight: 600; color: #333; }
.minor-feast-color { color: #888; font-size: 0.8rem; }

/* ---- Alerts ---- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-family: Arial, sans-serif;
  font-size: 0.875rem;
}
.alert-warn { background: #FFF3CD; border: 1px solid #F0C040; color: #856404; }

.muted { color: var(--muted); font-family: Arial, sans-serif; font-size: 0.85rem; }

/* ---- Scripture Modal ---- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-box {
  background: white;
  border-radius: 10px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #888;
  line-height: 1;
}
.modal-close:hover { color: #333; }
.modal-ref {
  font-size: 1.1rem;
  font-weight: bold;
  color: #1A3A5C;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-body {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 1rem;
  white-space: pre-wrap;
}
.modal-bg-link {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 0.8rem;
  color: var(--blue);
  text-align: right;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .cards { grid-template-columns: 1fr; }
  .col-reading, .col-epistle { display: none; }
  .hero h1 { font-size: 1.4rem; }
  .toolbar-form { flex-direction: column; }
}
