/* ═══════════════════════════════════════════════════════════════════════════
   Lecturas del Dia — Mobile-first responsive stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ──────────────────────────────────────────────────────── */

:root {
  /* Typography */
  --font-body: Georgia, "Times New Roman", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Brand */
  --color-brand: #006b54;
  --color-brand-light: #00a55a;

  /* Colors */
  --color-text: #2c2c2c;
  --color-text-light: #666;
  --color-text-muted: #999;
  --color-bg: #fafaf8;
  --color-surface: #fff;
  --color-border: #e8e8e5;

  /* Liturgical colors */
  --color-purple: #7b5ea7;
  --color-red: #c0392b;
  --color-green: #27ae60;
  --color-white-dot: #bbb;
  --color-pink: #e8a0bf;

  /* Layout */
  --max-width: 720px;
  --spacing: 1.5rem;
}

/* ── Dark mode ──────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  :root {
    --color-brand: #3db88c;
    --color-brand-light: #4cd9a5;
    --color-text: #e0e0e0;
    --color-text-light: #aaa;
    --color-text-muted: #777;
    --color-bg: #1a1a1a;
    --color-surface: #252525;
    --color-border: #3a3a3a;
  }
}

/* ── Reset & Base ───────────────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--color-purple);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── Color band (top of page) ───────────────────────────────────────────── */

body::before {
  content: "";
  display: block;
  height: 4px;
  background: var(--color-purple);
}

body[data-color="purple"]::before {
  background: var(--color-purple);
}

body[data-color="red"]::before {
  background: var(--color-red);
}

body[data-color="green"]::before {
  background: var(--color-green);
}

body[data-color="white"]::before {
  background: linear-gradient(90deg, #b8860b, #daa520, #b8860b);
}

body[data-color="pink"]::before {
  background: var(--color-pink);
}

/* ── Site header ────────────────────────────────────────────────────────── */

header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--spacing);
  text-align: center;
  position: relative;
}

.header-home {
  position: absolute;
  left: var(--spacing);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-brand);
  text-decoration: none;
}

.header-home:hover {
  text-decoration: underline;
}

.site-title {
  font-family: var(--font-ui);
  font-size: 1.4rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-brand);
  text-decoration: none;
}

.site-title:hover {
  color: var(--color-brand-light);
  text-decoration: none;
}


/* ── Search page (/buscar/) ─────────────────────────────────────────────── */

.search-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--spacing);
}

.search-page h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-brand);
  margin-bottom: 1rem;
}

.search-help {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-bottom: 0.4rem;
}

.search-help-list {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin: 0 0 1.25rem 1.2rem;
  line-height: 1.7;
}

.search-help-list strong {
  color: var(--color-text);
}

#search-input {
  width: 100%;
  padding: 0.7rem 1rem;
  font-family: var(--font-ui);
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
}

#search-input:focus {
  border-color: var(--color-purple);
  box-shadow: 0 0 0 2px rgba(123, 94, 167, 0.15);
}

#search-results {
  margin-top: 0.75rem;
}

.search-result {
  display: block;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

.search-result:hover {
  background: var(--color-surface);
  text-decoration: none;
}

.search-result .search-fecha {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.search-result .search-nombre {
  font-weight: 500;
}

.search-result .search-citas {
  color: var(--color-text-light);
  font-size: 0.8rem;
}

.search-empty {
  padding: 1.5rem 0.5rem;
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  text-align: center;
}

.search-back {
  display: inline-block;
  margin-top: 1.5rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--color-brand);
  text-decoration: none;
  font-weight: 600;
}

.search-back:hover {
  text-decoration: underline;
}

/* ── Day navigation ─────────────────────────────────────────────────────── */

.day-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem var(--spacing);
  font-family: var(--font-ui);
  font-size: 1rem;
}

.day-nav a {
  color: var(--color-brand);
  text-decoration: none;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
}

.day-nav a:hover {
  color: var(--color-brand-light);
  background: rgba(0, 107, 84, 0.06);
  text-decoration: none;
}

#calendar-toggle {
  background: none;
  border: 1px solid var(--color-red);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-brand);
  line-height: 1;
}

#calendar-toggle:hover {
  background: rgba(0, 107, 84, 0.06);
}

/* ── Calendar panel ─────────────────────────────────────────────────────── */

#calendar-panel {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.5rem var(--spacing) var(--spacing);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  margin-bottom: 0.5rem;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-family: var(--font-ui);
}

.calendar-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-brand);
}

.calendar-header button {
  background: none;
  border: 1px solid var(--color-brand);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-brand);
}

.calendar-header button:hover {
  background: rgba(0, 107, 84, 0.08);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  max-width: 420px;
  margin: 0 auto;
}

.cal-weekday {
  padding: 0.4rem;
  font-weight: 700;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.4rem 0.2rem;
  text-decoration: none;
  color: var(--color-text);
  border-radius: 6px;
  line-height: 1.3;
  font-weight: 500;
}

.cal-day:hover {
  background: rgba(0, 107, 84, 0.08);
  text-decoration: none;
}

.cal-day.today {
  outline: 2px solid var(--color-brand);
  outline-offset: -1px;
  border-radius: 6px;
  font-weight: 700;
}

.cal-day.muted {
  color: var(--color-text-muted);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 3px;
}

.calendar-legend {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  flex-wrap: wrap;
}

.calendar-legend span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* ── Day page ───────────────────────────────────────────────────────────── */

article.day-page,
article[data-date] {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing) var(--spacing);
}

/* ── Liturgical header ──────────────────────────────────────────────────── */

.day-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: var(--spacing);
  padding-bottom: var(--spacing);
  border-bottom: 1px solid var(--color-border);
}

.day-header .date-day {
  font-family: var(--font-ui);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0;
}

.day-header .date {
  font-family: var(--font-ui);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.day-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-brand);
  margin-bottom: 0.5rem;
}

/* ── Meta pills ────────────────────────────────────────────────────────── */

.meta-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  list-style: none;
  margin-bottom: 0.6rem;
}

.pill {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-light);
  white-space: nowrap;
}

.pill.season-pill {
  font-weight: 600;
  border: none;
  color: #fff;
}

.pill.season-pill.color-purple { background: var(--color-purple); color: #fff; }
.pill.season-pill.color-red { background: var(--color-red); color: #fff; }
.pill.season-pill.color-green { background: var(--color-green); color: #fff; }
.pill.season-pill.color-white { background: #fff; color: var(--color-brand); border: 1.5px solid var(--color-brand); }
.pill.season-pill.color-pink { background: var(--color-pink); color: #fff; }

/* ── Memorial note ─────────────────────────────────────────────────────── */

.memorial-note {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-text-light);
  background: rgba(0, 107, 84, 0.05);
  border-left: 3px solid var(--color-brand);
  padding: 0.5rem 0.75rem;
  border-radius: 0 6px 6px 0;
}

.memorial-icon {
  color: var(--color-brand);
  margin-right: 0.2rem;
}

.memorial-rank {
  color: var(--color-text-muted);
}

/* ── Alternative readings link ─────────────────────────────────────────── */

.alt-readings-link {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-brand);
  text-decoration: underline;
  cursor: pointer;
}

/* ── Color badges ───────────────────────────────────────────────────────── */

.color-badge {
  font-weight: 600;
}

.color-purple {
  color: var(--color-purple);
}

.color-red {
  color: var(--color-red);
}

.color-green {
  color: var(--color-green);
}

.color-white {
  color: #b8860b;
}

.color-pink {
  color: var(--color-pink);
}

/* ── Readings ───────────────────────────────────────────────────────────── */

.readings {
  list-style: none;
}

.reading {
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.reading:last-child {
  border-bottom: none;
}

.reading-header {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.75rem 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  gap: 0.5rem;
}

.reading-header:hover {
  color: var(--color-purple);
}

.reading-label {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-brand);
  white-space: nowrap;
}

.reading-cita {
  font-weight: 500;
  flex: 1;
}

.chevron {
  font-size: 0.6rem;
  color: var(--color-text-muted);
  transition: transform 0.2s ease;
}

.reading-header[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

/* ── Reading text ───────────────────────────────────────────────────────── */

.reading-text {
  font-size: 1.1rem;
  line-height: 1.8;
  padding: 0 0 1rem 0;
}

.reading-text p {
  margin-bottom: 0.8rem;
}

.reading-text .titulo {
  font-style: italic;
  font-size: 0.95rem;
  color: var(--color-text-light);
  margin-bottom: 0.5rem;
}

.reading-text .antifona {
  font-style: italic;
  font-weight: 600;
  border-left: 3px solid var(--color-brand);
  padding-left: 0.75rem;
  margin-bottom: 1rem;
}


/* ── Aclamación ────────────────────────────────────────────────────────── */

.aclamacion-section {
  border-top: 1px solid var(--color-border);
}

.aclamacion-section .reading {
  border-bottom: none;
}

.aclamacion-verso {
  font-style: italic;
  color: var(--color-text-light);
}

/* ── Day actions ────────────────────────────────────────────────────────── */

.actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.actions button {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text-light);
  cursor: pointer;
}

.actions button:hover,
.actions .action-link:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.actions .action-link {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text-light);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* ── Site footer ────────────────────────────────────────────────────────── */

footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem var(--spacing) 1rem;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}

footer p {
  margin-bottom: 0.3rem;
}

footer a {
  color: var(--color-text-muted);
}

footer a:hover {
  color: var(--color-text-light);
}

footer .footer-brand {
  color: var(--color-brand);
  font-weight: 600;
  font-size: 0.85rem;
}

footer .footer-brand:hover {
  color: var(--color-brand-light);
}

/* ── Error page ─────────────────────────────────────────────────────────── */

.error-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem var(--spacing);
  text-align: center;
}

.error-page h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.error-page p {
  color: var(--color-text-light);
  margin-bottom: 0.5rem;
}

/* ── Responsive (small screens) ─────────────────────────────────────────── */

@media (max-width: 480px) {
  header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
  }

  .header-home {
    position: static;
    transform: none;
    align-self: flex-start;
  }

  .day-header h1 {
    font-size: 1.3rem;
  }

  .reading-text {
    font-size: 1rem;
  }

  .actions {
    flex-direction: column;
  }

  .actions button {
    width: 100%;
  }
}
