/* ═══════════ Migue & Lili · countdown ═══════════ */
:root {
  --laurel: #A9BA9D;
  --laurel-light: #CDD5C0;
  --cream: #F7F1E6;
  --ink: #23271E;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', 'Helvetica Neue', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--sans); font-weight: 300;
  color: var(--cream); background: var(--ink);
  overflow: hidden; -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }

/* grain */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Preloader ── */
.preloader {
  position: fixed; inset: 0; z-index: 100; background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 1s ease, visibility 1s;
}
.preloader.done { opacity: 0; visibility: hidden; }
.preloader-inner { text-align: center; padding: 0 24px; }
.preloader-monogram { width: 64px; margin: 0 auto 28px; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); opacity: .85; } }
.preloader-line { width: 160px; height: 1px; margin: 0 auto 20px; background: rgba(255,255,255,.15); overflow: hidden; }
.preloader-line span { display: block; height: 100%; width: 0; background: var(--laurel); transition: width .4s ease; }
.preloader-text { color: rgba(255,255,255,.55); font-family: var(--serif); font-style: italic; font-size: 15px; letter-spacing: .08em; }

/* ── Stage ── */
.stage {
  position: relative; height: 100svh; height: 100dvh;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.bg { position: absolute; inset: -6%; z-index: 1; display: block; }
.bg img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 40%;
  transform: scale(1.12);
  animation: drift 24s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: scale(1.02) translate(1.5%, -1%); } }
.veil {
  position: absolute; inset: 0; z-index: 2;
  background: radial-gradient(ellipse at center, rgba(35,39,30,.45) 0%, rgba(35,39,30,.72) 100%);
}
.petals { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

.content {
  position: relative; z-index: 4; text-align: center;
  width: 100%; padding: 0 clamp(16px, 4vw, 40px);
}
.content > * { opacity: 0; transform: translateY(24px); }

.monogram {
  width: clamp(56px, 6vw, 96px); margin: 0 auto clamp(18px, 3vh, 28px);
  filter: drop-shadow(0 10px 30px rgba(0,0,0,.4));
}

.names {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(28px, 4.5vw, 54px); letter-spacing: .12em;
  margin-bottom: clamp(22px, 5vh, 54px);
}
.names .w { display: inline-block; overflow: hidden; vertical-align: bottom; }
.names .ch { display: inline-block; transform: translateY(110%); }
.names .amp { font-style: italic; color: var(--laurel-light); margin: 0 .25em; }

.countdown {
  display: flex; justify-content: center;
  gap: clamp(14px, 6vw, 96px);
}
.unit { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.num {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(44px, 10vw, 128px); line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 10px 50px rgba(0,0,0,.35);
}
.label {
  margin-top: clamp(8px, 1.5vh, 14px);
  font-size: clamp(9px, 1.3vw, 16px); letter-spacing: .28em; text-transform: uppercase;
  color: var(--laurel-light);
}

.date {
  margin-top: clamp(28px, 8vh, 100px);
  font-size: clamp(15px, 1.6vw, 20px); letter-spacing: .2em;
}
.place {
  margin-top: 10px;
  font-size: clamp(13px, 1.5vw, 18px); letter-spacing: .1em;
  color: rgba(247,241,230,.85);
}

/* ── Floating calendar button ── */
.fab {
  position: absolute; z-index: 6;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--cream); background: rgba(35,39,30,.35);
  border: 1px solid rgba(247,241,230,.5); cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
  opacity: 0; animation: fabIn 1s cubic-bezier(.16,1,.3,1) 2.2s forwards;
  transition: background .4s, border-color .4s, transform .3s;
}
@keyframes fabIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
.fab:hover { background: #5C7146; border-color: #5C7146; transform: scale(1.06); }
.fab::before {
  content: ''; position: absolute; inset: -1px; border-radius: 50%;
  border: 1px solid rgba(247,241,230,.5);
  animation: pulse 2.6s ease-out 3.2s infinite;
}
@keyframes pulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.7); opacity: 0; } }
.fab-tip {
  position: absolute; right: calc(100% + 14px); top: 50%; transform: translateY(-50%) translateX(6px);
  white-space: nowrap; pointer-events: none;
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--cream); background: rgba(35,39,30,.85);
  padding: 9px 14px; border-radius: 100px;
  opacity: 0; transition: opacity .3s, transform .3s;
}
.fab:hover .fab-tip { opacity: 1; transform: translateY(-50%) translateX(0); }
@media (hover: none) { .fab-tip { display: none; } }
@media (max-width: 560px) { .fab { width: 50px; height: 50px; right: 16px; bottom: 16px; } }
@media (max-height: 520px) { .fab { width: 42px; height: 42px; right: 12px; bottom: 10px; } }

/* ── Calendar modal ── */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(35,39,30,.6);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fadeIn .4s ease forwards;
}
.modal-card {
  position: relative; width: min(100%, 400px);
  background: var(--cream); color: var(--ink);
  border-radius: 6px; padding: 44px 32px 30px; text-align: center;
  box-shadow: 0 40px 100px -20px rgba(0,0,0,.6);
  animation: cardIn .55s cubic-bezier(.16,1,.3,1);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(30px) scale(.96); } }
.modal-close {
  position: absolute; top: 10px; right: 14px;
  background: none; border: none; cursor: pointer;
  font-size: 30px; line-height: 1; font-weight: 200; color: var(--ink); opacity: .5;
  transition: opacity .3s;
}
.modal-close:hover { opacity: 1; }
.modal-monogram { width: 44px; margin: 0 auto 18px; filter: invert(1) opacity(.8); }
.modal-title { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.1; }
.modal-sub { margin-top: 8px; font-size: 13px; letter-spacing: .06em; color: #6E7460; }
.modal-options { display: flex; flex-direction: column; gap: 10px; margin: 28px 0 6px; }
.modal-opt {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: 100px;
  border: 1px solid rgba(92,113,70,.35); color: var(--ink);
  font-size: 14px; letter-spacing: .04em; text-decoration: none; cursor: pointer;
  transition: background .35s, border-color .35s, color .35s, transform .3s;
}
.modal-opt svg { flex-shrink: 0; color: #5C7146; transition: color .35s; }
.modal-opt:hover { background: #5C7146; border-color: #5C7146; color: var(--cream); transform: translateY(-1px); }
.modal-opt:hover svg { color: var(--cream); }
@media (max-height: 520px) { .modal-card { padding: 28px 24px 20px; } .modal-monogram { display: none; } .modal-options { margin: 16px 0 12px; } }

/* ── Language switcher ── */
.lang {
  position: absolute; z-index: 5;
  left: 50%; transform: translateX(-50%);
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex; gap: 4px;
  opacity: 0; animation: fadeIn 1.2s ease 2.2s forwards;
}
@keyframes fadeIn { to { opacity: 1; } }
.lang button {
  font-family: var(--sans); font-weight: 400;
  font-size: 11px; letter-spacing: .18em;
  color: rgba(247,241,230,.5);
  background: none; border: none; cursor: pointer;
  padding: 10px 10px;
  transition: color .3s;
}
.lang button:hover, .lang button.active { color: var(--cream); }
.lang button.active { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }

/* ── Responsive: phones ── */
@media (max-width: 560px) {
  .countdown { gap: 12px; }
  .num { font-size: clamp(40px, 13vw, 60px); }
  .label { font-size: 8.5px; letter-spacing: .16em; }
  .names { letter-spacing: .08em; }
}

/* ── Responsive: tablets portrait (iPad) ── */
@media (min-width: 561px) and (max-width: 1024px) and (orientation: portrait) {
  .num { font-size: clamp(64px, 12vw, 110px); }
  .label { font-size: 12px; }
  .countdown { gap: clamp(24px, 6vw, 60px); }
}

/* ── Responsive: short / landscape screens (phone landscape) ── */
@media (max-height: 520px) {
  .monogram { width: 40px; margin-bottom: 10px; }
  .names { font-size: 22px; margin-bottom: 10px; }
  .num { font-size: 44px; }
  .label { margin-top: 4px; font-size: 8px; }
  .date { margin-top: 14px; font-size: 13px; }
  .place { margin-top: 4px; font-size: 12px; }
  .lang { bottom: 6px; }
  .lang button { padding: 4px 8px; }
}

@media (orientation: portrait) {
  .bg img { object-position: center center; }
  .veil { background: radial-gradient(ellipse at center, rgba(35,39,30,.38) 0%, rgba(35,39,30,.7) 100%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .content > * { opacity: 1; transform: none; }
  .names .ch { transform: none; }
  .lang { opacity: 1; }
}
