:root {
  --wine: #5e0b12;
  --wine-2: #8f1119;
  --wine-dk: #1c0306;
  --red: #d62a33;
  --gold: #b8923f;
  --gold-d: #7d5f1e;
  --gold-l: #e3cc8c;
  --ivory: #fbf8f0;
  --ink: #2a1215;
  --muted: #695558;
  --serif: "Cormorant Garamond", Cormorant, Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100svh;
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--wine-dk);
  background-image: radial-gradient(1100px 640px at 50% -8%, #8a1219 0%, var(--wine-dk) 66%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Lluvia de código ---------- */
.rain { display: block; pointer-events: none; }
.rain--page { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .6; }
.rain--head { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .5; }

.stage {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: clamp(14px, 4vw, 44px) 14px;
}
.stage > * { min-width: 0; }
.org, .event-title, .honoree, .degree { overflow-wrap: anywhere; }

/* ---------- Tarjeta ---------- */
.card {
  width: min(100%, 720px);
  background: var(--ivory);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 34px 90px rgba(0, 0, 0, .6), 0 0 60px rgba(214, 42, 51, .18), 0 0 0 1px rgba(227, 204, 140, .3);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .8s ease, transform .8s ease;
}
.is-ready .card { opacity: 1; transform: none; }

.card__head {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 30px 20px 28px;
  color: var(--gold-l);
  background: linear-gradient(180deg, var(--wine-2), #3a060b);
  box-shadow: inset 0 -3px 0 var(--gold), inset 0 -6px 0 #3a060b, inset 0 -7px 0 rgba(184, 146, 63, .6);
}
.head__content { position: relative; z-index: 1; }

.seal-wrap { position: relative; width: 136px; height: 136px; margin: 0 auto; display: grid; place-items: center; }
.orbit {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px dashed rgba(227, 204, 140, .65);
  animation: spin 26s linear infinite;
}
.orbit::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  border-radius: 50%;
  background: var(--gold-l);
  box-shadow: 0 0 12px var(--gold-l);
}
@keyframes spin { to { transform: rotate(360deg); } }

.logo {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(227, 204, 140, .55), 0 0 30px rgba(255, 60, 60, .55);
  animation: logoIn 1.1s cubic-bezier(.2, .8, .2, 1) both, glow 3.4s ease-in-out 1.2s infinite;
}
.seal { width: 100px; height: 100px; color: var(--gold-l); }
@keyframes logoIn { from { opacity: 0; transform: scale(.55) rotate(-120deg); } to { opacity: 1; transform: none; } }
@keyframes glow {
  50% { box-shadow: 0 0 0 2px rgba(227, 204, 140, .8), 0 0 46px rgba(255, 70, 70, .85); }
}

.org {
  margin-top: 14px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.15rem, 3.8vw, 1.6rem);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .5);
}
.org-sub {
  margin-top: 6px;
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold-l);
}

/* ---------- Terminal ---------- */
.term {
  max-width: 470px;
  margin: 20px auto 0;
  text-align: left;
  background: rgba(20, 3, 5, .88);
  border: 1px solid rgba(227, 204, 140, .35);
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  overflow: hidden;
}
.term__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .05);
  border-bottom: 1px solid rgba(227, 204, 140, .18);
  font: 500 .66rem/1 var(--mono);
  color: rgba(255, 255, 255, .55);
}
.term__bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); }
.term__bar i:nth-child(2) { background: var(--gold-l); }
.term__bar i:nth-child(3) { background: #f3ece0; opacity: .7; }
.term__bar span { margin-left: 8px; }
.term__code {
  margin: 0;
  padding: 12px 14px 14px;
  font: 400 .76rem/1.65 var(--mono);
  color: #f0e4e4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.term__code .c { color: #9b7a7e; }
.term__code .k { color: #ff6b73; }
.term__code .v { color: #f6e3a8; }
.term__code .s { color: #ffb4a8; }
.term__code .f { color: #e3cc8c; }
.term__code .p { color: #d8c8c9; }
.caret {
  display: inline-block;
  width: .55em;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--gold-l);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Cuerpo ---------- */
.card__body {
  position: relative;
  text-align: center;
  padding: clamp(36px, 6vw, 60px) clamp(26px, 7vw, 64px) clamp(34px, 5vw, 52px);
}
.card__body::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(184, 146, 63, .55);
  pointer-events: none;
}
.card__body::after {
  content: "";
  position: absolute;
  inset: 17px;
  border: 1px solid rgba(184, 146, 63, .22);
  pointer-events: none;
}
.card__body > * { animation: rise .8s cubic-bezier(.2, .7, .2, 1) both; animation-delay: var(--d, 0ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--gold-d);
}
.event-title {
  margin: .5rem 0 .2rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.1rem, 7.4vw, 3.3rem);
  line-height: 1.08;
  color: var(--wine);
}
.rule { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 1.1rem 0 1.5rem; }
.rule span { width: 64px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.rule span:last-child { transform: scaleX(-1); }
.rule i { width: 7px; height: 7px; background: var(--red); transform: rotate(45deg); }

.greet { font-size: .72rem; font-weight: 500; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); }
.greet-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: .2rem .6rem;
  margin: 0 0 1.1rem;
}
.guest {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.7rem, 6vw, 2.5rem);
  line-height: 1.15;
  color: var(--wine);
  overflow-wrap: anywhere;
}
.msg {
  max-width: 38ch;
  margin: 0 auto;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 3.6vw, 1.32rem);
  line-height: 1.55;
  color: #3d2529;
}
.honoree {
  margin: 1.3rem 0 .35rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2rem, 7.6vw, 3.2rem);
  line-height: 1.08;
  color: var(--wine);
}
.degree { font-size: .78rem; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }

/* ---------- Detalles ---------- */
.details {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  margin: 2.1rem 0 0;
  border-top: 1px solid rgba(184, 146, 63, .6);
  border-bottom: 1px solid rgba(184, 146, 63, .6);
}
.details__cell { padding: 18px 12px; }
.details__cell + .details__cell { border-left: 1px solid rgba(184, 146, 63, .35); }
.details dt { font-size: .66rem; font-weight: 600; letter-spacing: .26em; text-transform: uppercase; color: var(--gold-d); }
.details dd { margin-top: 6px; font-family: var(--serif); font-weight: 600; font-size: 1.28rem; line-height: 1.25; color: var(--wine); }
.details dd strong { display: block; font-weight: 700; }
.details dd span { display: block; margin-top: 3px; font-family: var(--sans); font-weight: 400; font-size: .8rem; line-height: 1.4; color: var(--muted); }

/* ---------- Cuenta regresiva ---------- */
.countdown { display: flex; justify-content: center; gap: 10px; margin-top: 1.7rem; }
.countdown__unit {
  min-width: 74px;
  padding: 10px 8px 8px;
  border: 1px solid rgba(184, 146, 63, .55);
  background: rgba(94, 11, 18, .04);
}
.countdown b { display: block; font-family: var(--mono); font-weight: 500; font-size: 1.75rem; line-height: 1.1; color: var(--wine); font-variant-numeric: tabular-nums; }
.countdown small { display: block; margin-top: 4px; font-size: .6rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }

.pases {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 7px 18px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 500;
  letter-spacing: .08em;
  color: var(--wine);
}

/* ---------- Botones ---------- */
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 1.7rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid var(--wine);
  border-radius: 2px;
  background: transparent;
  color: var(--wine);
  font: 600 .74rem/1 var(--sans);
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.btn:hover { background: var(--wine); color: var(--ivory); }
.btn--primary { background: var(--wine); color: var(--ivory); }
.btn--primary:hover { background: var(--wine-2); border-color: var(--wine-2); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.note { margin-top: 1.4rem; font-size: .78rem; letter-spacing: .04em; color: var(--muted); }

.card__foot {
  padding: 16px 20px;
  text-align: center;
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .78);
  background: #3a060b;
  box-shadow: inset 0 3px 0 var(--gold);
}

.error {
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 28px;
  max-width: 420px;
  text-align: center;
  color: var(--ivory);
}
.error .btn { color: var(--ivory); border-color: var(--gold-l); }

/* ---------- Responsive ---------- */
@media (max-width: 620px) {
  .details { grid-template-columns: 1fr; }
  .details__cell + .details__cell { border-left: 0; border-top: 1px solid rgba(184, 146, 63, .35); }
  .countdown__unit { min-width: 66px; }
  .actions .btn { width: 100%; }
  .term__code { font-size: .7rem; }
  .org { letter-spacing: .08em; }
  .degree { letter-spacing: .14em; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .card__body > *, .logo, .orbit { animation: none; transition: none; opacity: 1; transform: none; }
  .caret { animation: none; }
}

@media print {
  body { background: #fff; }
  .rain, .term, .orbit { display: none; }
  .stage { padding: 0; }
  .card { box-shadow: none; opacity: 1; transform: none; }
  .actions, .countdown, .note { display: none; }
  .card__body > * { animation: none; }
}
