/* ===== Lời Bác dạy — stylesheet ===== */
:root {
  --color-cream: #f5ecd9;
  --color-cream-soft: #faf3e3;
  --color-cream-deep: #e8d9b8;
  --color-red: #b91c1c;
  --color-red-deep: #7f1d1d;
  --color-red-light: #dc2626;
  --color-gold: #c69849;
  --color-gold-soft: #d4af6a;
  --color-ink: #4a2511;
  --color-ink-soft: #6b3a23;
  --color-paper: #fffaf0;
  --shadow-soft: 0 10px 40px -10px rgba(90, 30, 0, 0.25);
  --shadow-strong: 0 25px 60px -15px rgba(90, 30, 0, 0.4);
  --font-display: "Playfair Display", "Times New Roman", serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--color-ink);
  background-color: var(--color-cream-soft);
  background-image:
    linear-gradient(135deg, rgba(245, 236, 217, 0.86), rgba(232, 217, 184, 0.78)),
    url("../img/bg.jpg");
  background-size: cover, cover;
  background-position: center, center;
  background-attachment: fixed, fixed;
  background-repeat: no-repeat, no-repeat;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at top, rgba(185, 28, 28, 0.05), transparent 50%),
    radial-gradient(ellipse at bottom, rgba(127, 29, 29, 0.08), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ===== Hero (logo + loibacday banner) ===== */
.hero {
  position: relative;
  z-index: 2;
  width: 100%;
  overflow: hidden;
  isolation: isolate;
}
.hero-bg {
  display: block;
  width: 100%;
  height: clamp(220px, 32vw, 360px);
  object-fit: cover;
  object-position: center 20%;
  filter: saturate(1.05) contrast(1.05);
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(74, 37, 17, 0.15), rgba(74, 37, 17, 0.05) 50%, rgba(245, 236, 217, 0.6)),
    radial-gradient(ellipse at top, rgba(185, 28, 28, 0.1), transparent 60%);
  pointer-events: none;
  z-index: 1;
}
.hero .brand {
  position: absolute;
  top: 0.85rem;
  left: 1rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--color-cream);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  padding: 0.45rem 0.85rem 0.45rem 0.55rem;
  background: rgba(127, 29, 29, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 999px;
  border: 1px solid rgba(255, 250, 240, 0.4);
  box-shadow: 0 6px 18px rgba(74, 37, 17, 0.35);
}
.hero .brand:hover { background: rgba(127, 29, 29, 0.75); }
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.hero .brand-text {
  font-family: var(--font-display);
  font-size: 1.05rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.hero .brand-text small {
  display: block;
  font-size: 0.7rem;
  color: rgba(255, 250, 240, 0.85);
  font-weight: 500;
  letter-spacing: 0.1em;
  font-family: var(--font-body);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.hero .date-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 3;
}

.date-badge {
  background: var(--color-red);
  color: var(--color-cream);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 16px rgba(185, 28, 28, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.date-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-cream);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.3); }
}

/* ===== Main / Quote ===== */
main {
  flex: 1;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem 2rem;
}

.quote-stage {
  width: 100%;
  max-width: 920px;
  background: rgba(255, 250, 240, 0.95);
  backdrop-filter: blur(8px);
  border: 2px solid var(--color-cream-deep);
  border-radius: 24px;
  padding: 2.5rem 1.75rem 2rem;
  box-shadow: var(--shadow-strong);
  position: relative;
  text-align: center;
  isolation: isolate;
}

.quote-stage::before,
.quote-stage::after {
  content: "“";
  position: absolute;
  font-family: var(--font-display);
  color: var(--color-red);
  opacity: 0.12;
  font-size: 8rem;
  line-height: 1;
  z-index: 0;
}
.quote-stage::before { top: 0.5rem; left: 1rem; }
.quote-stage::after { content: "”"; bottom: -2rem; right: 1rem; }

.quote-date {
  font-family: var(--font-body);
  color: var(--color-red);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  display: inline-block;
  padding: 0.4rem 1rem;
  background: rgba(185, 28, 28, 0.08);
  border-radius: 999px;
  position: relative;
  z-index: 1;
}

.quote-text {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  color: var(--color-ink);
  font-size: clamp(1.4rem, 4.2vw, 2.4rem);
  line-height: 1.55;
  letter-spacing: 0.005em;
  margin: 1.25rem auto 1.5rem;
  max-width: 760px;
  position: relative;
  z-index: 1;
}

.quote-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--color-cream-deep);
  position: relative;
  z-index: 1;
}

.quote-topic {
  display: inline-block;
  background: var(--color-red);
  color: var(--color-cream);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  text-transform: uppercase;
}
.quote-year {
  font-size: 0.85rem;
  color: var(--color-ink-soft);
  font-weight: 600;
}
.quote-source {
  font-size: 0.78rem;
  color: var(--color-ink-soft);
  max-width: 640px;
  line-height: 1.6;
  font-style: italic;
  margin-top: 0.25rem;
}
.quote-source a {
  color: var(--color-red);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ===== Bottom action bar ===== */
.bottom-bar {
  position: relative;
  z-index: 2;
  padding: 1.25rem 1.25rem 1.75rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  border: 1.5px solid transparent;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primary {
  background: var(--color-red);
  color: var(--color-cream);
  box-shadow: 0 6px 14px rgba(185, 28, 28, 0.35);
}
.btn-primary:hover { background: var(--color-red-deep); box-shadow: 0 10px 20px rgba(185, 28, 28, 0.45); }

.btn-outline {
  background: rgba(255, 250, 240, 0.85);
  color: var(--color-red);
  border-color: var(--color-red);
}
.btn-outline:hover { background: var(--color-cream); }

.btn-ghost {
  background: rgba(255, 250, 240, 0.6);
  color: var(--color-ink);
  border-color: var(--color-cream-deep);
}
.btn-ghost:hover { background: var(--color-cream); }

.btn-gold {
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-soft));
  color: #fff;
  border: none;
  box-shadow: 0 6px 14px rgba(198, 152, 73, 0.45);
}
.btn-gold:hover { background: linear-gradient(135deg, var(--color-gold-soft), var(--color-gold)); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 37, 17, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 1rem;
}
.modal-overlay[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-paper);
  border-radius: 20px;
  max-width: 460px;
  width: 100%;
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: var(--shadow-strong);
  position: relative;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-overlay[aria-hidden="false"] .modal {
  transform: scale(1) translateY(0);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(185, 28, 28, 0.08);
  color: var(--color-red);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  transition: background 0.2s ease;
}
.modal-close:hover { background: rgba(185, 28, 28, 0.16); }

.modal-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-red-deep);
  text-align: center;
  margin-bottom: 0.4rem;
}
.modal-subtitle {
  text-align: center;
  color: var(--color-ink-soft);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* Date picker */
.date-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.date-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.date-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-ink-soft);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.date-field select,
.date-field input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--color-cream-deep);
  border-radius: 10px;
  background: var(--color-cream-soft);
  color: var(--color-ink);
  font-size: 1rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.date-field select:focus,
.date-field input:focus {
  outline: none;
  border-color: var(--color-red);
  background: var(--color-paper);
}

.date-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.date-quick button {
  flex: 1 1 calc(50% - 0.25rem);
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--color-cream-deep);
  border-radius: 10px;
  background: var(--color-cream-soft);
  color: var(--color-ink-soft);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.18s ease;
}
.date-quick button:hover {
  background: var(--color-red);
  color: var(--color-cream);
  border-color: var(--color-red);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
}
.modal-actions .btn { flex: 1; justify-content: center; }

/* QR Donate */
.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0 0.5rem;
}
.qr-frame {
  width: 240px;
  height: 240px;
  border-radius: 16px;
  background: var(--color-cream-soft);
  padding: 12px;
  box-shadow: 0 6px 20px rgba(127, 29, 29, 0.18);
  border: 2px solid var(--color-cream-deep);
}
.qr-frame img,
.qr-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 8px;
}
.qr-info {
  width: 100%;
  background: var(--color-cream-soft);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--color-ink);
}
.qr-info b { color: var(--color-red-deep); font-weight: 700; }
.qr-info .copyable {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--color-cream-deep);
}
.qr-info .copyable:last-child { border-bottom: none; }
.qr-info .copyable button {
  background: transparent;
  border: 1px solid var(--color-red);
  color: var(--color-red);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
}
.qr-info .copyable button:hover { background: var(--color-red); color: var(--color-cream); }

/* Download options */
.download-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.download-card {
  border: 1.5px solid var(--color-cream-deep);
  border-radius: 14px;
  padding: 1rem 0.85rem;
  text-align: center;
  background: var(--color-cream-soft);
  text-decoration: none;
  color: var(--color-ink);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
}
.download-card:hover {
  background: var(--color-paper);
  border-color: var(--color-red);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(185, 28, 28, 0.15);
}
.download-card svg { width: 36px; height: 36px; color: var(--color-red); }
.download-card .dl-name { font-weight: 700; font-size: 0.95rem; }
.download-card .dl-meta { font-size: 0.75rem; color: var(--color-ink-soft); }
.download-card[disabled] { opacity: 0.6; cursor: not-allowed; }
.download-card[disabled]:hover { transform: none; box-shadow: none; border-color: var(--color-cream-deep); background: var(--color-cream-soft); }

.download-note {
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-ink-soft);
  margin-top: 0.75rem;
  font-style: italic;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--color-red);
  color: var(--color-cream);
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  box-shadow: var(--shadow-strong);
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  z-index: 200;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Footer */
footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0.75rem 1rem 1.25rem;
  font-size: 0.78rem;
  color: var(--color-ink-soft);
}
footer a { color: var(--color-red); text-decoration: none; font-weight: 600; }
footer a:hover { text-decoration: underline; }
.footer-sep { margin: 0 0.35rem; color: var(--color-cream-deep); }
.footer-domain { color: var(--color-red-deep) !important; font-weight: 700 !important; }

/* Animations */
.quote-stage { animation: fadeUp 0.6s ease-out; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 640px) {
  .hero .brand { top: 0.6rem; left: 0.6rem; padding: 0.35rem 0.7rem 0.35rem 0.45rem; }
  .hero .date-badge { top: 0.6rem; right: 0.6rem; }
  .hero .brand-text { font-size: 0.9rem; }
  .hero .brand-text small { font-size: 0.6rem; letter-spacing: 0.08em; }
  .brand-logo { width: 32px; height: 32px; }
  main { padding: 0.75rem 0.85rem 1rem; }
  .quote-stage { padding: 1.75rem 1.1rem 1.4rem; border-radius: 18px; }
  .quote-stage::before, .quote-stage::after { font-size: 5rem; }
  .quote-text { font-size: 1.15rem; margin: 1rem 0; }
  .bottom-bar { padding: 0.85rem 0.85rem 1.1rem; gap: 0.5rem; }
  .btn { padding: 0.65rem 1rem; font-size: 0.88rem; }
  .btn svg { width: 16px; height: 16px; }
  .date-badge { font-size: 0.78rem; padding: 0.45rem 0.85rem; }
  .modal { padding: 1.5rem 1.1rem 1.1rem; }
  .modal-title { font-size: 1.15rem; }
  .download-grid { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .bottom-bar .btn { flex: 1 1 calc(50% - 0.35rem); }
  .bottom-bar .btn.btn-primary { flex: 1 1 100%; }
}
