/* ===========================================================================
   Reusable pieces. Each owns its own block; sections tune them in 05.
   =========================================================================== */

/* ── Heading with a flourish either side ─────────────────────────────── */
.heading-flourished {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.75rem, 3vw, 1.75rem);
}

.heading-flourished__art {
  width: clamp(2.75rem, 7vw, 4.9rem);
  flex: none;
}

/* ── Date band ───────────────────────────────────────────────────────── */
/* Two parts on one line, read RTL: date | time. The vertical rule is a
   border on the trailing part rather than an element of its own, so it
   always matches the row's height exactly. */
.date-band {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-gold);
  margin-top: 3rem;
}

.date-band__side {
  font-size: var(--fs-h3);
  line-height: 1.3;
  white-space: nowrap;
  padding-inline: clamp(0.8rem, 3vw, 1.6rem);
}

/* In RTL this is the left-hand part, so its inline-start edge is the shared
   middle — the one place the rule belongs. */
.date-band__side + .date-band__side {
  border-inline-start: 1px solid var(--c-gold-count);
}

/* The pair stays side by side at every width so the rule between them is
   always vertical. On narrow screens the type steps down rather than the
   parts stacking — both halves are short enough to hold one line. */
@media (max-width: 26rem) {
  .date-band__side {
    padding-inline: clamp(0.6rem, 4vw, 0.9rem);
  }
}

/* ── Countdown ───────────────────────────────────────────────────────── */
.countdown {
  /* Digits read left-to-right even inside this RTL page: days, hours,
     minutes, seconds — same as the original. The Persian labels underneath
     re-inherit RTL from the document. */
  direction: ltr;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(0.25rem, 1.5vw, 0.5rem);
}

.countdown__unit { text-align: center; }

/* Fixed-height window so a flipping digit is masked as it rolls. */
.countdown__window {
  overflow: hidden;
  height: calc(var(--fs-count) * var(--lh-digit));
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown__value {
  font-size: var(--fs-count);
  line-height: var(--lh-digit);
  white-space: nowrap;

  /* Gold gradient painted through the glyphs. */
  background-image: var(--grad-gold);
  background-size: 300% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;

  /* Hidden until revealed — the ink wipe in 06-motion.css uncovers it. */
  clip-path: inset(0 100% 0 0);
}

.countdown__label {
  margin-block-start: var(--s-1);
  font-size: var(--fs-label);
  line-height: 1.2;
  color: var(--c-gold-count);
  opacity: 0;
  transition: opacity 0.8s var(--ease-out);
}

.countdown__sep {
  font-size: calc(var(--fs-count) * 1.15);
  line-height: var(--lh-digit);
  color: var(--c-gold-count);
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}

/* Shown in place of the clock once the date has passed. */
.countdown__done {
  font-size: var(--fs-h2);
  color: var(--c-gold);
}

/* ── Schedule timeline ───────────────────────────────────────────────── */
.timeline {
  --dot: 9px;
  --row-h: 3.75rem;      /* row floor; the rose's travel is measured in these */
  --rows: 5;             /* number of <li>s — the rose's travel depends on it */
  position: relative;
  width: min(24rem, 100%);
  margin-inline: auto;
  text-align: start;
}

/* The connecting rule. Each row draws its own half-segments rather than the
   list drawing one long line: a row's rule is measured against that row's
   real height, so it stays dot-to-dot however tall --fs-h3 grows the rows.
   The first row skips its upper half and the last its lower half, which is
   what makes the line begin and end on a dot. */
.timeline__item::before,
.timeline__item::after {
  content: "";
  position: absolute;
  inset-inline-start: calc(50% - 1px);
  width: 2px;
  background: var(--c-line);
}

.timeline__item::before { inset-block: 0 50%; }   /* row top → centre */
.timeline__item::after  { inset-block: 50% 0; }   /* centre → row bottom */

/* The rose is the list's first child, so :first-child would never match an
   <li> here — these must be of-type. */
.timeline__item:first-of-type::before,
.timeline__item:last-of-type::after { content: none; }

.timeline__item {
  position: relative;   /* anchors the end-row masks over the rule */
  display: grid;
  /* Equal columns either side of the marker, so the line stays centred and
     the two text columns can never collide with it. */
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2.5rem;
  min-height: var(--row-h);
}

/* Label on the start (right) side, time on the end (left) side — matching
   the original, where the two columns straddle the centre line. */
.timeline__label {
  font-size: var(--fs-h3);
  line-height: 1.3;
  color: var(--c-brown);
  text-align: end;
}

.timeline__time {
  font-size: var(--fs-h3);
  line-height: 1.3;
  color: var(--c-brown-soft);
  text-align: start;
}

.timeline__dot {
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  background: var(--c-dot);
  position: relative;
  z-index: 1;
}

/* The rose caps the top of the line. In the original it is an overlay sitting
   above the first dot rather than a marker in its own right, so it is taken
   out of the grid's flow: left in it, its width would set the marker column
   and its height would make the first row taller than the other three. */
.timeline__rose {
  position: absolute;
  inset-inline-start: calc(50% - 1.3rem);   /* half its own width */
  inset-block-start: calc(var(--row-h) / 2 - 1.9rem);
  width: 2.6rem;
  height: auto;
  z-index: 2;
  pointer-events: none;
}

/* ── Map ─────────────────────────────────────────────────────────────── */
.map {
  position: relative;
  width: min(21rem, 100%);
  margin-inline: auto;
  aspect-ratio: 1;
}

.map__frame {
  position: absolute;
  inset: 0;
  border: 1px solid var(--c-gold);
  border-radius: var(--r-map);
  opacity: 0.8;
  pointer-events: none;
}

.map iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--r-map);
  display: block;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.65em 2.5em 0 2.5em;
  border: 0;
  border-radius: var(--r-btn);
  background: var(--c-wine);
  color: var(--c-wine-ink);
  font-family: inherit;
  font-size: var(--fs-body-sm);
  cursor: pointer;
  transition: filter 0.2s ease-in-out;
}

.btn:hover { filter: brightness(1.15); }

/* Keyboard focus must stay visible: the button sits on cream, so the ring is
   drawn outside the shape rather than tinting it. */
.btn:focus-visible {
  outline: 2px solid var(--c-wine);
  outline-offset: 3px;
}

/* ── RSVP dialog ─────────────────────────────────────────────────────── */
.dialog {
  width: min(34rem, calc(100vw - 2rem));
  padding: clamp(1.5rem, 5vw, 2.5rem);
  border: 0;
  border-radius: var(--r-field);
  background: var(--c-popup-bg);
  color: var(--c-brown);
}

.dialog::backdrop { background: rgb(0 0 0 / 0.55); }

.dialog__close {
  position: absolute;
  inset-block-start: 0.5rem;
  inset-inline-end: 0.75rem;
  border: 0;
  background: none;
  color: var(--c-brown);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.dialog__title {
  font-size: var(--fs-h3);
  text-align: center;
}

.dialog__note {
  margin-block-start: var(--s-1);
  font-size: var(--fs-small);
  text-align: center;
  opacity: 0.75;
}

/* ── Form ────────────────────────────────────────────────────────────── */
.field { margin-block-start: var(--s-3); }

.field__label {
  display: block;
  margin-block-end: 0.35em;
  font-size: var(--fs-body-sm);
  line-height: 1.4;
}

.field__hint {
  display: block;
  font-size: var(--fs-small);
  opacity: 0.7;
}

.field__input {
  width: 100%;
  padding: 0.5em 0.75em;
  border: 1px solid var(--c-field-border);
  border-radius: var(--r-field);
  background: transparent;
  color: var(--c-field-ink);
  font-family: inherit;
  font-size: var(--fs-body-sm);
  line-height: 1.8;
}

.field__input:focus-visible { border-color: var(--c-gold); }

.field__choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-3);
}

.field__choice {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: var(--fs-body-sm);
  cursor: pointer;
}

.field__choice input { accent-color: var(--c-wine); }

.field__error {
  display: block;
  margin-block-start: 0.25em;
  font-size: var(--fs-small);
  color: var(--c-error);
}

.field.has-error .field__input { border-color: var(--c-error); }

.form__actions {
  margin-block-start: var(--s-4);
  text-align: center;
}

.form__success {
  margin-block-start: var(--s-3);
  font-size: var(--fs-body-sm);
  color: var(--c-gold);
  text-align: center;
}

/* Same slot, used when the submission failed — colour is the only difference,
   so the message never moves the dialog's layout as it changes. */
.form__success.is-error { color: var(--c-error); }
