/* Section: events — "Lễ cưới" */
#events {
  text-align: center;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(217,195,154,.28) 0%, rgba(251,247,240,0) 60%),
    radial-gradient(90% 40% at 50% 100%, rgba(233,225,210,.25) 0%, rgba(251,247,240,0) 70%),
    var(--cream);
}

/* ---------- Đầu trang ---------- */
#events .ev-kicker {
  margin: 0 0 6px;
  font-family: var(--font-sans);
  font-size: 11px; font-weight: 500;
  letter-spacing: .38em; text-transform: uppercase;
  color: var(--gold-deep);
}
#events .ev-kicker::before, #events .ev-kicker::after {
  content: ""; display: inline-block; vertical-align: middle;
  width: 28px; height: 1px; margin: 0 10px 2px;
  background: var(--gold-light);
}
#events .ev-title {
  margin: 0;
  font-size: clamp(40px, 12vw, 58px);
  white-space: nowrap;
  line-height: 1.25;
  padding: 0 .15em;
}
#events .ev-date {
  margin: 14px 0 4px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(38px, 11.5vw, 52px);
  line-height: 1;
  color: var(--ink);
  letter-spacing: .02em;
  display: flex; justify-content: center; align-items: baseline; gap: .22em;
}
#events .ev-date i { font-style: normal; color: var(--gold); font-size: .7em; }
#events .ev-weekday {
  margin: 10px 0 0;
  font-size: 20px; font-style: italic;
  color: var(--ink-soft);
}
#events .ev-lunar {
  display: block;
  font-style: normal; font-size: 16px;
  color: var(--rose);
  margin-top: 2px;
}

/* ---------- Đếm ngược ---------- */
#events .ev-count { margin: 34px auto 0; max-width: 360px; }
#events .ev-count-tiles {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
#events .ev-count-tiles[hidden], #events .ev-count-msg[hidden] { display: none; }
#events .ev-tile { display: flex; flex-direction: column; align-items: center; min-width: 0; }
#events .ev-tile-win {
  position: relative;
  width: 100%;
  height: 84px;
  border: 1px solid var(--gold-light);
  border-radius: 50% 50% 10px 10px / 38px 38px 10px 10px;
  background: linear-gradient(180deg, var(--ivory) 0%, #F8F1E5 100%);
  box-shadow: inset 0 0 0 4px var(--ivory), inset 0 0 0 5px rgba(217,182,110,.45), 0 8px 18px -12px rgba(138,98,36,.5);
  overflow: hidden;
}
#events .ev-tile-num {
  position: absolute; left: 0; right: 0; bottom: 12px;
  font-family: var(--font-display);
  font-size: clamp(26px, 8vw, 32px);
  line-height: 1;
  color: var(--red-deep);
  font-variant-numeric: tabular-nums;
}
#events .ev-tile-num.is-in  { animation: ev-num-in .6s var(--ease-out) both; }
#events .ev-tile-num.is-out { animation: ev-num-out .6s var(--ease-out) both; }
@keyframes ev-num-in  { from { opacity: 0; transform: translateY(70%) rotateX(-70deg); } to { opacity: 1; transform: none; } }
@keyframes ev-num-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-70%) rotateX(70deg); } }
#events .ev-tile-lbl {
  margin-top: 8px;
  font-family: var(--font-sans);
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-soft);
}
#events .ev-count-msg { margin: 0; font-size: clamp(34px, 10vw, 44px); line-height: 1.3; }

/* ---------- Lịch tháng ---------- */
#events .ev-cal {
  margin: 44px auto 0;
  max-width: 340px;
  padding: 22px 16px 18px;
  background: var(--ivory);
  border: 1px solid rgba(217,182,110,.6);
  border-radius: 6px;
  box-shadow: 0 0 0 5px var(--ivory), 0 0 0 6px rgba(217,182,110,.35), 0 18px 34px -24px rgba(138,98,36,.45);
}
#events .ev-cal-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 6px 12px;
  border-bottom: 1px solid rgba(217,182,110,.45);
  margin-bottom: 10px;
}
#events .ev-cal-month { font-family: var(--font-display); font-style: italic; font-size: 22px; color: var(--ink); }
#events .ev-cal-year { font-family: var(--font-sans); font-size: 12px; letter-spacing: .3em; color: var(--gold-deep); }
#events .ev-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 4px; }
#events .ev-cal-wd {
  font-family: var(--font-sans); font-size: 11px; font-weight: 500;
  color: var(--gold-deep); letter-spacing: .06em;
  padding-bottom: 6px;
}
#events .ev-cal-cell {
  position: relative;
  height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 17px; color: var(--ink);
}
#events .ev-cal-wd.is-sun, #events .ev-cal-cell.is-sun { color: var(--rose); }
#events .ev-cal-num { position: relative; z-index: 1; }
#events .ev-cal-cell.is-day .ev-cal-num { font-family: var(--font-display); font-weight: 700; color: var(--red-deep); }
#events .ev-heart {
  position: absolute; left: 50%; top: 50%;
  width: 46px; height: 44px;
  transform: translate(-50%, -48%);
  overflow: visible;
  pointer-events: none;
}
#events .ev-heart path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
}
#events .ev-cal.is-in .ev-heart path { animation: ev-draw 1.8s .6s var(--ease-in-out) forwards; }
#events .ev-cal.is-in .ev-cal-cell.is-day .ev-cal-num { animation: ev-beat 1s 2.3s var(--ease-out) both; }
@keyframes ev-draw { to { stroke-dashoffset: 0; } }
@keyframes ev-beat { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.25); } }

/* ---------- Thẻ sự kiện (vòm) ---------- */
#events .ev-cards { display: grid; gap: 30px; margin: 52px auto 0; max-width: 360px; }
#events .ev-card {
  position: relative;
  padding: 7px;
  border: 1px solid var(--gold-light);
  border-radius: 50% 50% 14px 14px / 150px 150px 14px 14px;
  background: var(--ivory);
  box-shadow: 0 22px 40px -28px rgba(138,98,36,.55);
}
#events .ev-card-inner {
  position: relative; z-index: 1;
  border: 1px solid rgba(217,182,110,.55);
  border-radius: 50% 50% 10px 10px / 144px 144px 10px 10px;
  padding: 58px 20px 24px;
  background: linear-gradient(180deg, rgba(217,195,154,.18) 0%, rgba(255,253,248,0) 45%);
}
#events .ev-card-flower {
  position: absolute; z-index: 2;
  left: -14px; bottom: -14px;
  width: 92px; height: auto;
  pointer-events: none;
}
#events .ev-card-wrap { perspective: 1000px; }
#events .ev-card-wrap:nth-child(even) .ev-card-flower { left: auto; right: -14px; transform: scaleX(-1); }
#events .ev-card-tbd {
  display: inline-block; margin: 6px 0 0; padding: 6px 16px;
  border-top: 1px solid rgba(184,137,59,.45); border-bottom: 1px solid rgba(184,137,59,.45);
  font-family: var(--font-serif); font-style: italic; font-size: 18px; line-height: 1.3; color: var(--gold-deep);
}
#events .ev-card.is-tbd .ev-card-inner { padding-bottom: 30px; }
#events .ev-card-kicker {
  margin: 0;
  font-family: var(--font-sans); font-size: 10.5px; letter-spacing: .34em; text-transform: uppercase;
  color: var(--gold-deep);
}
#events .ev-card-title { word-spacing: .16em; margin: 4px 0 2px; font-size: clamp(36px, 11vw, 44px); line-height: 1.3; padding: 0 .1em; }
#events .ev-card-time {
  margin: 0;
  font-family: var(--font-display); font-size: 30px; font-weight: 500; line-height: 1.1;
  color: var(--ink);
}
#events .ev-card-date { margin: 4px 0 0; font-size: 16px; font-style: italic; color: var(--ink-soft); }
/* Lịch trình buổi tiệc */
#events .ev-sched {
  list-style: none; margin: 16px auto 2px; padding: 0; max-width: 280px;
  position: relative; text-align: left;
}
#events .ev-sched::before { /* đường dọc vàng nối các mốc */
  content: ""; position: absolute; left: 61px; top: 12px; bottom: 12px; width: 1px;
  background: linear-gradient(180deg, transparent, var(--gold-light) 15%, var(--gold-light) 85%, transparent);
}
#events .ev-sched li {
  position: relative; display: grid; grid-template-columns: 50px 22px 1fr; align-items: baseline;
  padding: 5px 0;
}
#events .ev-sched-time {
  font-family: var(--font-display); font-size: 17px; font-weight: 500; color: var(--gold-deep);
  text-align: right; font-variant-numeric: tabular-nums;
}
#events .ev-sched-dot {
  justify-self: center; width: 7px; height: 7px; transform: translateY(-1px) rotate(45deg);
  background: var(--ivory); border: 1px solid var(--gold); position: relative; z-index: 1;
}
/* mốc chính (khai tiệc): hình thoi đỏ son viền vàng + giờ đỏ son */
#events .ev-sched li:last-child .ev-sched-dot {
  width: 9px; height: 9px; background: var(--red); border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--ivory), 0 0 0 3px rgba(184,137,59,.6);
}
#events .ev-sched li:last-child .ev-sched-time { color: var(--red-deep); font-weight: 600; }
#events .ev-sched-text { font-size: 16px; line-height: 1.35; color: var(--ink); }
#events .ev-sched li:last-child .ev-sched-text { font-weight: 600; }
#events .ev-card-rule {
  display: block; width: 64px; height: 1px; margin: 14px auto;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
#events .ev-card-place { margin: 0; font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.35; text-wrap: balance; }
#events .ev-card-addr { margin: 4px 0 0; font-size: 16.5px; color: var(--ink-soft); line-height: 1.45; text-wrap: balance; }

#events .ev-card-actions {
  margin-top: 20px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
}
#events .ev-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--gold-deep);
  /* QA2: gradient sẫm hơn để chữ trắng đạt tương phản (dải sáng #F3DEA4 của --gold-gradient làm chữ chìm) */
  background: linear-gradient(135deg, #7A5520 0%, #9C722F 45%, #B8893B 70%, #8A6224 100%);
  color: #fff;
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 500; letter-spacing: .04em;
  text-decoration: none;
  text-shadow: 0 1px 1px rgba(138,98,36,.45);
  box-shadow: 0 6px 14px -8px rgba(138,98,36,.7);
  transition: transform .25s var(--ease-out), opacity .25s;
  -webkit-tap-highlight-color: transparent;
}
#events .ev-btn--ghost { background: var(--ivory); color: var(--gold-deep); text-shadow: none; }
#events .ev-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#events .ev-btn:active { transform: scale(.96); }
#events .ev-btn:focus-visible, #events .ev-menu-item:focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; }

#events .ev-cal-add { position: relative; }
#events .ev-menu {
  position: absolute; z-index: 5;
  bottom: calc(100% + 8px); left: 50%;
  width: 230px; margin-left: -115px;
  padding: 6px;
  background: var(--ivory);
  border: 1px solid var(--gold-light);
  border-radius: 14px;
  box-shadow: 0 18px 36px -16px rgba(59,51,43,.35);
  opacity: 0; transform: translateY(6px) scale(.97);
  transition: opacity .25s var(--ease-out), transform .25s var(--ease-out);
}
#events .ev-menu.is-open { opacity: 1; transform: none; }
#events .ev-menu[hidden] { display: none; }
#events .ev-menu-item {
  display: block; width: 100%;
  padding: 10px 12px;
  border: 0; border-radius: 10px;
  background: transparent;
  text-align: left; text-decoration: none;
  font-family: var(--font-sans); font-size: 14px; color: var(--ink);
}
#events .ev-menu-item small { display: block; font-size: 11.5px; color: var(--ink-soft); margin-top: 1px; }
#events .ev-menu-item:hover, #events .ev-menu-item:active { background: rgba(217,195,154,.35); }

@media (max-width: 370px) {
  #events .ev-count-tiles { gap: 7px; }
  #events .ev-tile-win { height: 76px; }
  #events .ev-btn { padding: 0 14px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  #events .ev-heart path { stroke-dashoffset: 0; }
}
