@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-italic.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("fonts/montserrat.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --cream: #F5EDE1;
  --roast: #5C3317;
  --espresso: #3B1F10;
  --dark: #2B1A10;
  --caramel: #A0622D;
  --caramel-l: #C98B4E;
  --tan: #D9A86C;
  --leaf: #7A9A3A;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--dark);
  font-family: Montserrat, system-ui, sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.veil {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 55% at 50% 28%, rgba(217, 168, 108, 0.28), transparent 70%),
    radial-gradient(ellipse 90% 40% at 50% 100%, rgba(59, 31, 16, 0.08), transparent 65%);
  z-index: 0;
  animation: glow 10s ease-in-out infinite alternate;
}

@keyframes glow {
  from { opacity: 0.85; }
  to { opacity: 1; }
}

.card {
  position: relative;
  z-index: 1;
  max-width: 430px;
  margin: 0 auto;
  padding: calc(18px + var(--safe-top)) 22px calc(24px + var(--safe-bot));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: rise 0.85s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.portrait {
  width: 118px;
  height: 118px;
  margin: 4px 0 14px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(43, 26, 16, 0.14);
  animation: float 6.5s ease-in-out infinite;
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

h1 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 2.2rem;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: var(--dark);
}

.title {
  margin: 8px 0 0;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--roast);
}

.org {
  margin: 12px 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.12rem;
  color: var(--espresso);
}

.place {
  margin: 2px 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--caramel);
}

.creds {
  list-style: none;
  margin: 16px 0 0;
  padding: 12px 8px 0;
  width: 100%;
  border-top: 1px solid rgba(217, 168, 108, 0.7);
  animation: rise 0.9s ease 0.12s both;
}

.creds li {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.55;
  color: var(--espresso);
}

.seals {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  align-items: center;
}

.seals li {
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: rise 0.7s ease both;
}

.seals li:nth-child(1) { animation-delay: 0.16s; }
.seals li:nth-child(2) { animation-delay: 0.22s; }
.seals li:nth-child(3) { animation-delay: 0.28s; }
.seals li:nth-child(4) { animation-delay: 0.34s; }
.seals li:nth-child(5) { animation-delay: 0.40s; }
.seals li:nth-child(6) { animation-delay: 0.46s; }

.seals img {
  width: 100%;
  max-width: 58px;
  height: 52px;
  object-fit: contain;
  display: block;
}

.actions {
  margin: 18px 0 0;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  animation: rise 0.85s ease 0.28s both;
}

.action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(160, 98, 45, 0.38);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.55);
  color: var(--dark);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.action-wide {
  grid-column: 1 / -1;
}

.action:active,
.save:active {
  transform: scale(0.98);
}

.action:hover,
.action:focus-visible {
  background: rgba(255, 252, 247, 0.95);
  box-shadow: 0 4px 14px rgba(43, 26, 16, 0.08);
}

.glyph {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--roast);
}

.glyph svg { width: 18px; height: 18px; display: block; }

.save {
  margin-top: 12px;
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  background: var(--espresso);
  color: var(--cream);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 10px 24px rgba(43, 26, 16, 0.18);
  transition: transform 0.2s ease, background 0.2s ease;
  animation: rise 0.85s ease 0.36s both;
}

.save .glyph { color: var(--cream); }

.save:hover,
.save:focus-visible {
  background: var(--dark);
}

.qr {
  margin: 20px 0 0;
  padding: 0;
  animation: rise 0.9s ease 0.44s both;
}

.qr img {
  width: 136px;
  height: 136px;
  display: block;
  margin: 0 auto;
  background: var(--cream);
  border-radius: 12px;
}

.qr figcaption {
  margin: 8px 0 0;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--roast);
  word-break: break-all;
}

@media (prefers-reduced-motion: reduce) {
  .veil, .card, .creds, .seals li, .actions, .save, .qr, .portrait {
    animation: none !important;
  }
}
