/* =========================================================
   The Garden (v6): reply.css
   Owner: reply coder. #reply: parchment sheet,
   RSVP form, done panel, colophon.
   Plain text only in comments. Tokens come from styles.css.
   Reveal start states apply only under html.js-rv (set by
   reply.js), so without JS every block shows in its final state.
   ========================================================= */

/* 1. Sections and sheet card ------------------------------ */
/* Each section is a flow-root so the sheet margins stay inside it. */
#reply {
  display: flow-root;
  padding: 0 16px;
  padding-right: calc(16px + var(--rail-w, 0px));
}

/* Sheet: paper card, gold double rule inset, deep soft shadow so it floats over the film. */
.sheet {
  position: relative;
  width: 100%;
  max-width: 680px;
  margin: 18vh auto;
  padding: 64px 56px;
  border-radius: 4px;
  background-color: var(--paper, #fbf7f1);
  /* Layers, top first: champagne edge glows, an ivory wash over the texture (no brown), then the paper tile. */
  background-image:
    radial-gradient(ellipse 26% 16% at 0% 50%, rgba(217, 191, 138, .22), rgba(217, 191, 138, 0) 100%),
    radial-gradient(ellipse 26% 16% at 100% 50%, rgba(217, 191, 138, .22), rgba(217, 191, 138, 0) 100%),
    linear-gradient(rgba(251, 247, 241, .93), rgba(251, 247, 241, .93)),
    url(assets/paper.webp);
  /* Paper tile 683 CSS px (2048 source px at 3 source px per CSS px), repeated, so phones do not upscale it. */
  background-size: 100% 240%, 100% 240%, 100% 100%, 683px 683px;
  background-position: 50% 0%, 50% 0%, 0 0, center;
  background-repeat: no-repeat, no-repeat, no-repeat, repeat;
  border: 1px solid rgba(140, 106, 58, .55);
  box-shadow: 0 24px 60px rgba(28,10,13, .55), 0 2px 6px rgba(28,10,13, .35);
}

/* The last sheet leaves room for the index bar and a little more air below. */
#reply .sheet {
  margin-bottom: calc(var(--index-h, 0px) + 12vh);
}

/* 2. Title and subtitle ----------------------------------- */
.sheet__title {
  margin: 0;
  font-family: var(--f-script);
  font-style: italic;
  font-size: clamp(40px, 6.4vw, 58px);
  font-weight: 500;
  /* Script stays unspaced: letter-spacing would break the joins. The reveal is a clip-path ink write (reply.js). */
  letter-spacing: 0 !important;
  /* background-clip: text paints only inside the padding box, so the italic overhang and descenders need room. */
  padding-left: .18em;
  padding-right: .26em;
  padding-bottom: .2em;
  line-height: 1.35;
  padding-top: .12em;
  text-align: center;
  text-wrap: balance;
  color: transparent;
  -webkit-text-fill-color: transparent;
  background-image: var(--foil-script-paper);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
}

/* Khatam over a gold hairline under the title. */
.sheet__title::after {
  content: "";
  display: block;
  width: min(180px, 60%);
  height: 10px;
  margin: 14px auto 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpolygon fill='%23a8874a' points='6,0 7.38,2.67 10.24,1.76 9.33,4.62 12,6 9.33,7.38 10.24,10.24 7.38,9.33 6,12 4.62,9.33 1.76,10.24 2.67,7.38 0,6 2.67,4.62 1.76,1.76 4.62,2.67'/%3E%3C/svg%3E"),
    linear-gradient(90deg, transparent 0%, #b8955a 22%, #b8955a 78%, transparent 100%);
  background-size: 10px 10px, 100% 1px;
  background-position: center, center;
  background-repeat: no-repeat;
}

/* Titles take focus from script to move the reader; the box ring is not wanted here. */
.sheet__title:focus { outline: none; }

.sheet__sub {
  margin: 18px 0 26px;
  text-align: center;
  font-family: var(--f-italic);
  font-weight: 300;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--ink-soft, #5e4245);
}

/* The deadline: crimson, upright and larger, on a line of its own. */
.sheet__due {
  display: block;
  margin-top: 4px;
  font-family: var(--f-display, inherit);
  font-style: normal;
  font-weight: 700;
  font-size: 1.6em;
  letter-spacing: .02em;
  color: var(--crimson, #9b1c2c);
}

/* 4. Reply form ------------------------------------------- */
.reply-card {
  max-width: 480px;
  margin: 0 auto;
  padding: 0;
}

.field {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0 0 20px;
}

.field > label:not(.check),
.attend legend,
.days legend {
  font-family: var(--f-body);
  font-variant-caps: normal;
  font-size: .9rem;
  font-weight: 500;
  letter-spacing: .06em;
  color: var(--emerald, #3d0f17);
}

/* Underline-only inputs on the parchment. Font is 17.6px so iOS does not zoom. */
.field input:not([type="radio"]):not([type="checkbox"]),
.field textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 8px 2px 6px;
  font: 400 1.1rem/1.4 var(--f-body);
  color: var(--ink, #2a1215);
  background: transparent;
  border: 0;
  border-bottom: 1px solid #8f3a44;
  border-radius: 0;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:not([type="radio"]):not([type="checkbox"]):focus,
.field textarea:focus {
  outline: none;
  border-bottom-color: var(--emerald, #3d0f17);
  box-shadow: 0 1px 0 0 var(--emerald, #3d0f17);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-bottom-color: var(--crimson, #9b1c2c);
  box-shadow: 0 1px 0 0 var(--crimson, #9b1c2c);
}

.rsvp__greet {
  margin: 0 0 18px;
  text-align: center;
  font-family: var(--f-italic);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--emerald, #3d0f17);
}
.rsvp__greet[hidden] { display: none; }

.field__help {
  margin: 2px 0 0;
  font-family: var(--f-italic);
  font-weight: 300;
  font-style: italic;
  font-size: .98rem;
  color: var(--ink-soft, #5e4245);
}

.field__error {
  margin: 0;
  font-family: var(--f-italic);
  font-style: italic;
  font-size: .98rem;
  font-weight: 600;
  color: var(--crimson, #9b1c2c);
}

.field__error:empty { display: none; }

/* Attendance and days: grouped rows, each a 44px target. */
.attend,
.days {
  display: grid;
  gap: 4px;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.attend legend,
.days legend {
  padding: 0;
  margin-bottom: 6px;
}

.check {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  margin: 0;
  padding: 6px 0;
  font-family: var(--f-body);
  font-size: 1.1rem;
  color: var(--ink, #2a1215);
  cursor: pointer;
}

/* Native inputs kept for keyboard and screen readers; drawn with background images (no pseudo-elements on inputs). */
.check input[type="radio"],
.check input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1.5px solid #8c6a3a;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: inset 0 1px 2px rgba(28,10,13, .12);
  cursor: pointer;
}

.check input[type="radio"] { border-radius: 50%; }
.check input[type="checkbox"] { border-radius: 4px; background-size: 14px 14px; }

.check input[type="radio"]:checked {
  border-color: var(--emerald, #3d0f17);
  background-image: radial-gradient(circle, #b8955a 0, #b8955a 4.5px, transparent 5.5px);
}

.check input[type="checkbox"]:checked {
  border-color: var(--emerald, #3d0f17);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5 6.5 12 13 4.5' fill='none' stroke='%233d0f17' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.check input[aria-invalid="true"] {
  border-color: var(--crimson, #9b1c2c);
}

.check input:focus-visible {
  outline: 2px solid var(--emerald, #3d0f17);
  outline-offset: 3px;
}

.check input:checked ~ span { color: var(--emerald, #3d0f17); }

/* Phones: keep focused fields clear of the bottom bar. */
.field input,
.field textarea,
.check input,
#rsvp-submit {
  scroll-margin-bottom: calc(var(--index-h, 0px) + 24px);
}

/* Submit: the seal button full width. */
#rsvp-submit.btn--seal {
  width: 100%;
  min-height: 50px;
  margin-top: 6px;
}

.rsvp__status {
  min-height: 1.4em;
  margin: 12px 0 0;
  text-align: center;
  font-family: var(--f-italic);
  font-weight: 300;
  font-style: italic;
  color: var(--ink-soft, #5e4245);
}

/* Done: centred italic message, fades in once when shown (app.js toggles hidden). */
.rsvp__done {
  padding: 28px 12px 8px;
  text-align: center;
}

.rsvp__done:not([hidden]) {
  animation: rsvp-done-in 1s var(--ease-out, cubic-bezier(.16, 1, .3, 1)) both;
}

@keyframes rsvp-done-in {
  from { opacity: 0; transform: translateY(14px); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: none; }
}

#rsvp-done-text {
  margin: 0;
  font-family: var(--f-italic);
  font-weight: 300;
  font-size: 1.25rem;
  font-style: italic;
  color: var(--emerald, #3d0f17);
  white-space: pre-line;   /* one line per person (app.js joins them with newlines) */
}

/* 5. Colophon --------------------------------------------- */
.colophon {
  position: relative;
  margin-top: 44px;
  padding-top: 26px;
  text-align: center;
}

.colophon::before {
  content: "";
  position: absolute;
  top: 0;
  left: 30%;
  right: 30%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, #b8955a 25%, #b8955a 75%, transparent 100%);
}

.colophon p {
  margin: 0 0 8px;
}

.colophon > p:first-child {
  font-family: var(--f-italic);
  font-weight: 300;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-soft, #5e4245);
}

.coords {
  font-family: var(--f-body);
  font-weight: 500;
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft, #5e4245);
}

/* Wax well: a pressed ring in the parchment that holds the 84px seal. */
.wax-well {
  position: relative;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 18px auto 0;
  border-radius: 50%;
  /* No disc: the seal sits pressed on the paper with only a soft contact shadow beneath it. */
  background: radial-gradient(ellipse 46% 40% at 50% 62%, rgba(28,10,13, .10) 0%, rgba(28,10,13, 0) 100%);
}

.wax-seal {
  display: block;
  width: 84px;
  height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(28,10,13, .35));
}

/* 6. Reveal start states (only when reply.js sets html.js-rv) */
html.js-rv .sheet:not(.is-in) {
  opacity: 0;
  transform: translateY(48px);
}

html.js-rv .sheet__title:not(.is-in) {
  opacity: 0;
  clip-path: inset(-.4em 100% -.4em -.4em);
  filter: blur(3px);
}

html.js-rv .sheet__sub:not(.is-in) { opacity: 0; }

html.js-rv #rsvp-form > :not(.is-in) { opacity: 0; }

html.js-rv .colophon > p:not(.is-in),
html.js-rv .wax-seal:not(.is-in) { opacity: 0; }

/* 7. Phones ----------------------------------------------- */
@media (max-width: 599px) {
  #reply {
    padding: 0 16px;
  }

  .field > label:not(.check),
  .attend legend,
  .days legend {
    font-size: 1rem;
  }

  .sheet {
    padding: 36px 44px;
  }

  .sheet__title::after {
    margin-top: 12px;
  }
}

@media (max-width: 443px) {
  .sheet {
    padding: 36px 32px;
  }
}

/* Still mode: no reveal start states, no running transitions on the chevron. */
html.still .rsvp__done:not([hidden]) { animation: none; }

/* 8. Print --------------------------------------------- */
@media print {
  #reply { padding: 0; }

  html.js-rv .sheet, html.js-rv .sheet__title, html.js-rv .sheet__sub,
  html.js-rv #rsvp-form > *, html.js-rv .colophon > p,
  html.js-rv .wax-seal {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
    letter-spacing: normal;
  }

  .sheet {
    position: static !important;
    margin: 0 0 24px !important;
    max-width: none;
    padding: 24px 32px !important;
    box-shadow: none !important;
    background-image: none !important;
    background-color: #fff !important;
    color: #000;
    break-inside: avoid;
  }

  .sheet__title, .sheet__sub,
  .field > label:not(.check), .attend legend, .days legend, .check, .colophon p {
    color: #000 !important;
  }

  /* Script foil heading: the gradient is clipped to text (background-clip), so print the fill as solid black. */
  .sheet__title {
    -webkit-text-fill-color: #000 !important;
    background: none !important;
    color: #000 !important;
  }

  .sheet__title::after, .colophon::before { display: none; }

  .field input:not([type="radio"]):not([type="checkbox"]),
  .field textarea {
    border: 1px solid #000 !important;
    background: #fff !important;
    min-height: 2em;
    color: #000 !important;
  }

  .check input[type="radio"], .check input[type="checkbox"] {
    border: 1px solid #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #rsvp-submit, .wax-well, .wax-seal, .rsvp__done { display: none !important; }
  .rsvp__done:not([hidden]) { display: block !important; }
}

/* People: one block per person. The name is the block's heading; that person's days sit indented under it on a
   gold rule. Each day row keeps the .attend/.check look; the two answers sit side by side when they fit. */
.rsvp-people__help { margin: 0 0 14px; text-align: center; }
.rsvp-people { display: grid; gap: 22px; margin: 0 0 22px; }
.rsvp-person {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.rsvp-person__name {
  display: block;
  width: 100%;
  padding: 0 0 6px;
  margin: 0 0 10px;
  font-family: var(--f-italic);
  font-style: italic;
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.25;
  color: var(--emerald, #3d0f17);
  border-bottom: 1px solid rgba(140, 106, 58, .45);
  overflow-wrap: anywhere;
}
.rsvp-person__days {
  display: grid;
  gap: 10px;
  padding-left: 14px;
  border-left: 1px solid rgba(184, 149, 90, .6);
}
.rsvp-person .rsvp-row { margin: 0; gap: 4px; }
.rsvp-person .rsvp-row legend { margin-bottom: 4px; }
/* The two answers side by side as pills (about 66px per day instead of 114px), equal width when there is room;
   they wrap onto two lines rather than overflow. Each label is the tap target (40px tall). The native radio stays
   inside its label for semantics and the keyboard, visually hidden; the pill (the span) shows its state. */
.rsvp-row__opts { display: flex; flex-wrap: wrap; gap: 6px; }
.rsvp-row__opts .check {
  flex: 1 1 0;
  min-width: max-content;
  min-height: 0;
  padding: 0;
  gap: 0;
  font-size: .95rem;
}
.rsvp-row__opts .check input[type="radio"] {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 1px;
  margin: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.rsvp-row__opts .check > span {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 8px;
  text-align: center;
  line-height: 1.15;
  border: 1px solid rgba(140, 106, 58, .55);
  border-radius: 22px;
  background: rgba(140, 106, 58, .05);
  color: var(--ink, #2a1215);
}
.rsvp-row__opts .check input:checked ~ span {
  background: var(--emerald, #3d0f17);
  border-color: var(--emerald, #3d0f17);
  color: #fbf7f1;
}
.rsvp-row__opts .check input:focus-visible ~ span {
  outline: 2px solid var(--emerald, #3d0f17);
  outline-offset: 2px;
}
/* Unanswered rows add no height: the error text is for screen readers only, and the row is marked instead
   (crimson day label, crimson outline and tint on both pills). One summary (#err-answers) sits above Send. */
.rsvp-row__err {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.rsvp-row.is-invalid > legend { color: var(--crimson, #9b1c2c); }
.rsvp-row__opts .check input[aria-invalid="true"] ~ span {
  border-color: var(--crimson, #9b1c2c);
  box-shadow: inset 0 0 0 1px var(--crimson, #9b1c2c);
  background: rgba(155, 28, 44, .07);
}
.rsvp__summary { margin: 0 0 10px; text-align: center; }
@media print {
  .rsvp-row__opts .check input:checked ~ span { background: none !important; color: #000 !important; border: 2px solid #000 !important; }
}
/* iOS 14.0-14.4 ignores flex gap; "inset" arrived in the same Safari release (14.1), so this targets exactly those. */
@supports not (inset: 0) {
  .rsvp-row__opts .check + .check { margin-left: 6px; }
}
/* Narrow phones (320px): a little less side padding so both pills fit on one line with the indent. */
@media (max-width: 359px) {
  .sheet { padding-left: 24px; padding-right: 24px; }
  .rsvp-person__days { padding-left: 10px; }
}
/* v37. The first unanswered row's note, laid over the gap under the row (app.js; no height, no pointer events). */
.rsvp-row { position: relative; }
.rsvp-row__tip {
  position: absolute;
  z-index: 2;
  top: calc(100% + 2px);
  left: 0;
  max-width: 100%;
  margin: 0;
  padding: 3px 10px 4px;
  font-family: var(--f-italic);
  font-style: italic;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.25;
  color: #fbf7f1;
  background: var(--crimson, #9b1c2c);
  border-radius: 6px;
  box-shadow: 0 3px 8px -3px rgba(28,10,13, .45);
  pointer-events: none;
}
.rsvp-row__tip::before {   /* arrow up at the pills */
  content: "";
  position: absolute;
  bottom: 100%;
  left: 18px;
  border: 6px solid transparent;
  border-top: 0;
  border-bottom-color: var(--crimson, #9b1c2c);
}
html:not(.still) .rsvp-row__tip { animation: rsvp-tip-in .25s ease-out both; }
@keyframes rsvp-tip-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media print { .rsvp-row__tip { display: none; } }

/* "You replied on ..." above the blocks, and the note's character count. */
.rsvp__prior { margin: -6px 0 16px; text-align: center; min-height: 3em; }   /* two lines either message: no jump on edit */
.rsvp__prior[hidden] { display: none; }
.rsvp__prior:focus { outline: none; }
.rsvp__count { margin: 2px 0 0; text-align: right; font-size: .9rem; }
.rsvp__count.is-near { color: var(--crimson, #9b1c2c); font-weight: 600; }

/* Try again / Send again / Email instead, and Change my reply: outlined pills like Add, 44px targets. */
.rsvp__status .btn-line,
.rsvp__change {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 8px 4px 0;
  padding: 8px 18px;
  font-family: var(--f-italic);
  font-style: italic;
  font-weight: 500;
  font-size: 1.02rem;
  line-height: 1.25;
  color: var(--emerald, #3d0f17);
  text-decoration: none;
  background: rgba(140, 106, 58, .08);
  border: 1px solid rgba(140, 106, 58, .55);
  border-radius: 22px;
  cursor: pointer;
}
.rsvp__status .btn-line:hover,
.rsvp__change:hover { background: rgba(140, 106, 58, .18); }
.rsvp__status .btn-line:focus-visible,
.rsvp__change:focus-visible { background: rgba(140, 106, 58, .18); }
.rsvp__change { margin-top: 18px; }

/* Seal & send: a larger, heavier, lighter champagne label (7.6:1 against the gradient's lightest stop, #6e1a28).
   The solid plum under the gradient is its own middle stop, so contrast tools that skip gradients measure the right
   colour. Not while sending: that state is styles.css's dashed outline. Hover keeps styles.css's ivory. */
#rsvp-submit.btn--seal {
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .14em;
}
#rsvp-submit.btn--seal:not([aria-disabled="true"]):not(:disabled) {
  color: #e6d2a4;
  background-color: #3d0f17;
}
@media (hover: hover) {
  #rsvp-submit.btn--seal:not([aria-disabled="true"]):not(:disabled):hover { color: #fbf7f1; }
}
@media print { .rsvp__change { display: none; } }


/* v22 perf (paint only, no layout change). The scroll-driven edge glow moved off the sheet's background into two
   narrow strips that reply.js moves by transform, so scrolling the reply no longer repaints the whole sheet every
   frame. .has-glow (set by reply.js) drops the two glow background layers; without JS the sheet keeps them.
   Each strip is the glow ellipse's own box: 26% wide (the ellipse x radius) and 76.8% tall (2 x 16% of 240%). */
.sheet.has-glow {
  background-image:
    linear-gradient(rgba(251, 247, 241, .93), rgba(251, 247, 241, .93)),
    url(assets/paper.webp);
  background-size: 100% 100%, 683px 683px;
  background-position: 0 0, center;
  background-repeat: no-repeat, repeat;
}
.sheet__glow {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0; inset: 0;
  z-index: -1;
  overflow: hidden;
  border-radius: 3px;
  pointer-events: none;
}
.sheet__glow-l,
.sheet__glow-r {
  position: absolute;
  top: 0;
  width: 26%;
  height: 76.8%;
  transform: translate3d(0, 106.25%, 0);
  will-change: transform;
}
.sheet__glow-l {
  left: 0;
  background: radial-gradient(ellipse 100% 50% at 0% 50%, rgba(217, 191, 138, .22), rgba(217, 191, 138, 0) 100%);
}
.sheet__glow-r {
  right: 0;
  background: radial-gradient(ellipse 100% 50% at 100% 50%, rgba(217, 191, 138, .22), rgba(217, 191, 138, 0) 100%);
}
@media print { .sheet__glow { display: none; } }

/* iOS Safari can stop painting a very tall composited layer about 8192 CSS px down the page (seen on an iPhone: the sheet cut off below the dietary field). Its own layer keeps the sheet out of that page-sized layer. (Live hotfix fff58c7, carried into the working site.) */
.sheet { will-change: transform; }
