/* Christmas Raclette Party. Screen 1 is one painted picture with two click zones. Screen 2 is a sign-up sheet on
   painted paper: only the names are live. Colours are sampled from the paintings. {{...}} = picture addresses,
   filled by build_site.py. */

:root {
  --page: #fdebc4;            /* wrapping-paper cream at the picture edges */
  --paper: #fdefd0;           /* the label's paper */
  --green: #17502a;           /* the painted serif */
  --red: #c10e18;             /* the painted script and button faces */
  --red-deep: #9f050a;
  --ivory: #fdefc9;           /* lettering on the red button faces */
  --gold: #d9a441;
  --pencil: rgba(92, 64, 30, .36);
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --hand: "Caveat", "Mali", "Bradley Hand", "Segoe Print", cursive;
  color-scheme: only light;
}

* { box-sizing: border-box; }
html { background: var(--page); scrollbar-color: #d8b77c var(--page); scrollbar-width: thin; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--page); color: var(--green);
  font-family: var(--serif); font-variation-settings: "SOFT" 100; -webkit-font-smoothing: antialiased; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--page); }
::-webkit-scrollbar-thumb { background: #d8b77c; border: 2px solid var(--page); border-radius: 8px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.plain { max-width: 30em; margin: 3em auto; padding: 0 1em; font-size: 18px; line-height: 1.4; text-align: center; }
html[data-view="rsvp"] .invite, html[data-view="invite"] .rsvp { display: none; }
img { -webkit-user-drag: none; user-select: none; }

/* ------------------------------------------------------------------ screen 1: the invitation */
.invite { height: 100vh; height: 100dvh; display: grid; place-items: center; overflow: clip; }
.frame { position: relative; flex: none; width: min(100vw, 150vh); width: min(100vw, 150dvh); aspect-ratio: 3 / 2; }
.frame img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: var(--page); }
@media (orientation: portrait) {
  /* up to 6% of the picture's side margins may fall outside a tall phone screen, so the picture fills its height */
  .invite { place-items: start center; }
  .frame { width: max(100vw, min(56.25vh, 112vw)); width: max(100vw, min(56.25dvh, 112vw)); aspect-ratio: 9 / 16; }
  .frame img { -webkit-mask-image: linear-gradient(to bottom, #000 97.5%, transparent); mask-image: linear-gradient(to bottom, #000 97.5%, transparent); }
}
@media (orientation: landscape) {
  .frame img { -webkit-mask-image: linear-gradient(to right, transparent, #000 1.6%, #000 98.4%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 1.6%, #000 98.4%, transparent); }
}

/* the two date buttons are painted; a zone lies over each. --l --t --w --h = its box in % of the picture */
.zone { position: absolute; left: calc(var(--l) * 1%); top: calc(var(--t) * 1%); width: calc(var(--w) * 1%); height: calc(var(--h) * 1%);
  border-radius: 6.2% / 16.5%; cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; }
.zone[data-date="12"] { --l: 24.9; --t: 56.7; --w: 24.1; --h: 13.4; }
.zone[data-date="24"] { --l: 50.2; --t: 56.9; --w: 23.55; --h: 13.2; }
@media (orientation: portrait) {
  .zone { border-radius: 5.2% / 15%; }
  .zone[data-date="12"] { --l: 17.5; --t: 46.1; --w: 65.35; --h: 12.8; }
  .zone[data-date="24"] { --l: 17.5; --t: 60.4; --w: 65.35; --h: 10.8; }
}
/* the zone's own copy of the same pixels: invisible at rest, lit and lifted when pointed at or pressed */
.zone i { position: absolute; inset: 0; border-radius: inherit; opacity: 0; background-image: var(--pic); background-repeat: no-repeat;
  background-size: calc(10000% / var(--w)) calc(10000% / var(--h));
  background-position: calc(var(--l) / (100 - var(--w)) * 100%) calc(var(--t) / (100 - var(--h)) * 100%);
  transition: opacity .14s ease, transform .14s ease, filter .14s ease; filter: brightness(1.08) saturate(1.08); }
@media (hover: hover) { .zone:hover i { opacity: 1; transform: translateY(-1.4%) scale(1.014); } }
.zone:focus-visible i { opacity: 1; }
.zone:focus-visible { box-shadow: 0 0 0 4px var(--gold); }
.zone:active i { opacity: 1; transform: translateY(.8%) scale(.994); filter: brightness(.95) saturate(1.05); }

/* ------------------------------------------------------------------ screen 2: the sign-up sheet (phone and narrow windows) */
/* --u = 1% of the sheet's width here, 1% of the stage's width on desktop: every size below is counted in it, so the
   whole sheet scales as one piece. Plain viewport units, so phones too old for container units get it right too. */
.rsvp { --u: min(1vw, 5.6px); min-height: 100vh; min-height: 100dvh; display: grid; justify-items: center; align-content: start; overflow-x: clip; }
.stage { position: relative; width: min(100vw, 560px); }
.backdrop { display: none; }
.sheet { position: relative;
  --name: calc(6.5 * var(--u)); --s: calc(3.3 * var(--u)); --m: calc(4.3 * var(--u)); --row: calc(11.6 * var(--u)); --col: calc(12.6 * var(--u)); --num: calc(4.6 * var(--u)); --ring: calc(6 * var(--u));
  --word: calc(13.6 * var(--u)); --book-row: calc(9.4 * var(--u)); --rule: max(1px, calc(.32 * var(--u))); }
.sheet-top, .sheet-foot { display: block; width: 100%; height: auto; background: var(--page); }
.sheet-mid { background: var(--paper) url("/art/phone-mid-1440.777d8401e6.webp") top center / 100% auto repeat-y; padding: 0 calc(14.4 * var(--u)); }
.page { position: relative; z-index: 1; }
.form { margin-top: -calc(9.5 * var(--u)); }
.book { margin-top: calc(3 * var(--u)); margin-bottom: -calc(6.5 * var(--u)); padding-bottom: calc(1 * var(--u)); }

.back { display: inline-block; font: italic 500 var(--s)/1.2 var(--serif); color: var(--green); text-decoration: underline;
  text-decoration-thickness: .07em; text-underline-offset: .22em; opacity: .82; padding: .5em .2em; margin: -.5em -.2em; }
.event { margin: calc(1.2 * var(--u)) 0 0; display: flex; justify-content: center; }
.word { display: block; height: var(--word); width: auto; max-width: 100%; }
.day { margin: .15em 0 0; text-align: center; font: 600 var(--m)/1.2 var(--serif); letter-spacing: .01em; }
.times { margin: .5em 0 0; text-align: center; font: 500 var(--s)/1.4 var(--serif); }
.times b { font-weight: 700; }
.rsvp form { margin: calc(5 * var(--u)) 0 0; }

.row { display: grid; grid-template-columns: var(--num) minmax(0, 1fr) repeat(3, var(--col)); align-items: end; }
.head .yours { grid-column: 1 / -1; align-self: end; }
.head .col { display: none; }
.head .yours .word { height: calc(var(--word) * .66); }
.head .col { text-align: center; font: 650 var(--s)/1.05 var(--serif); padding-bottom: .35em; }
.head .col small { display: block; margin-top: .18em; font: italic 500 .9em/1.1 var(--serif); opacity: .8; }
.head .col.full b { text-decoration: line-through; text-decoration-thickness: .08em; opacity: .55; }
.head .col.full small { color: var(--red-deep); opacity: 1; font-weight: 700; }

.lines { list-style: none; margin: 0; padding: 0; }
/* phone: the name on its own line, the three choices under it, each ring with its word */
.line.row { grid-template-columns: var(--num) max-content max-content minmax(0, 1fr); grid-template-rows: var(--row) calc(10.4 * var(--u)); column-gap: 0;
  padding-bottom: calc(1.6 * var(--u)); }
.line > .num { grid-area: 1 / 1; }
.line > .name-cell { grid-area: 1 / 2 / 2 / -1; }
.line > .pick { grid-row: 2; }
.line > .pick:nth-child(3) { grid-column: 2; }
.line > .pick:nth-child(4) { grid-column: 3; }
.line > .pick:nth-child(5) { grid-column: 4; }
.num { font: 600 var(--s)/1 var(--serif); opacity: .62; padding-bottom: .62em; }
.name-cell { position: relative; align-self: stretch; display: flex; align-items: flex-end; margin-right: 0;
  border-bottom: var(--rule) solid var(--pencil); }
.name { flex: 1; min-width: 0; width: 100%; margin: 0; padding: 0 0 .1em .12em; border: 0; border-radius: 0; background: none; outline: none;
  font: 600 var(--name)/1.05 var(--hand); color: var(--green); -webkit-appearance: none; appearance: none; }
.name::placeholder { font: italic 400 .6em/1.5 var(--serif); color: var(--green); opacity: .4; }
.name-cell:focus-within { border-bottom-color: var(--green); box-shadow: 0 var(--rule) 0 var(--green); }
.line.wrong .name-cell { border-bottom-color: var(--red); box-shadow: 0 var(--rule) 0 var(--red); }
span.name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--red-deep); padding-right: 1.6em; }
.remove { position: absolute; right: -.1em; bottom: 0; width: 1.9em; height: 1.9em; padding: 0; border: 0; background: none; cursor: pointer;
  font: 600 var(--m)/1 var(--serif); color: var(--red); opacity: .55; transition: opacity .12s, transform .12s; }
.remove:hover, .remove:focus-visible { opacity: 1; transform: scale(1.15); outline: none; }

.pick { position: relative; display: flex; align-items: center; justify-content: flex-start; gap: calc(1 * var(--u)); height: 100%; padding-right: calc(2.2 * var(--u));
  cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pick:last-child { padding-right: 0; }
.pick-label { font: 600 calc(3.1 * var(--u))/1 var(--serif); white-space: nowrap; }
.pick.full .pick-label { text-decoration: line-through; opacity: .5; }
.pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ring { position: relative; flex: none; width: var(--ring); height: var(--ring); background: var(--ring-img) center / contain no-repeat;
  transform: rotate(var(--tilt, 0deg)); transition: transform .12s ease, filter .12s ease; }
.ring::after { content: ""; position: absolute; left: -6%; top: -42%; width: 142%; height: 132%; background: var(--tick-img) center / contain no-repeat;
  opacity: 0; transform: scale(.55) rotate(-8deg); transform-origin: 30% 80%; transition: opacity .12s ease, transform .16s ease; }
.pick input:checked + .ring::after { opacity: 1; transform: none; }
@media (hover: hover) { .pick:hover input:not(:disabled) + .ring { transform: rotate(var(--tilt, 0deg)) scale(1.12); filter: brightness(1.2); } }
.pick input:focus-visible + .ring { outline: .16em solid var(--gold); outline-offset: .25em; border-radius: 50%; }
.pick input:disabled { cursor: default; }
.pick input:disabled + .ring { opacity: .22; }
.line.saved .pick.chosen input + .ring { opacity: 1; }
.line.wrong-pick .ring { filter: hue-rotate(-110deg) saturate(2.2) brightness(1.05); }
.line.saved .pick:not(.chosen) { visibility: hidden; }
.line.saved .pick { cursor: default; }

.more-wrap { margin: 0; height: calc(9 * var(--u)); display: flex; align-items: center; padding-left: var(--num); }
.more { padding: .5em .2em; margin: 0 -.2em; border: 0; background: none; cursor: pointer; font: italic 500 var(--s)/1 var(--serif); color: var(--green);
  text-decoration: underline dotted; text-underline-offset: .25em; opacity: .85; }
.more:hover, .back:hover { color: var(--red-deep); opacity: 1; }
.note { margin: calc(2.5 * var(--u)) 0 0; min-height: 4.05em; text-align: center; text-wrap: balance; font: italic 500 var(--s)/1.35 var(--serif); }
.send { margin: calc(3 * var(--u)) 0 0; display: flex; justify-content: center; }

/* a button: the painted blank red face (three slices, so it stretches to any width) with live lettering on it */
.pill { --h: calc(12.6 * var(--u)); position: relative; height: var(--h); min-width: 62%; padding: 0 calc(var(--h) * .72); border: 0; background: none;
  cursor: pointer; font: 700 calc(var(--h) * .43)/1 var(--serif); letter-spacing: .012em; color: var(--ivory); white-space: nowrap;
  -webkit-tap-highlight-color: transparent; transition: transform .1s ease; }
.pill::before { content: ""; position: absolute; inset: 0; border-style: solid; border-width: 0 calc(var(--h) * .554);
  border-image: url("/art/part-pill.6e538bc8a0.webp") 0 170 fill / 0 calc(var(--h) * .554) stretch;
  filter: drop-shadow(0 .1em .1em rgba(104, 62, 18, .32)); transition: filter .12s ease; }
.pill span { position: relative; text-shadow: 0 .04em .05em rgba(110, 0, 6, .45); }
@media (hover: hover) { .pill:hover:not(:disabled)::before { filter: brightness(1.1) saturate(1.05) drop-shadow(0 .14em .14em rgba(104, 62, 18, .36)); } }
.pill:active:not(:disabled) { transform: translateY(.06em) scale(.99); }
.pill:focus-visible { outline: .14em solid var(--gold); outline-offset: .16em; border-radius: 99em; }
.pill:disabled { cursor: default; }
.pill:disabled::before { filter: saturate(.55) brightness(1.08) opacity(.7); }
.pill.small { --h: calc(9.4 * var(--u)); min-width: 0; }

.feedback { min-height: calc(var(--s) * 4.6); margin-top: calc(2.4 * var(--u)); text-align: center; text-wrap: balance; font: 500 var(--s)/1.35 var(--serif); }
.feedback p { margin: 0; }
.feedback .err { font-style: italic; font-weight: 600; color: var(--red-deep); }
.feedback .word { height: calc(var(--word) * .62); margin: 0 auto; }
.feedback .ask { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5em 1.1em; margin-top: .5em; }
.linkish { padding: .4em .2em; border: 0; background: none; cursor: pointer; font: italic 500 var(--s)/1 var(--serif); color: var(--green);
  text-decoration: underline; text-underline-offset: .22em; }
.linkish:hover { color: var(--red-deep); }
.booked { display: grid; justify-items: center; align-content: center; gap: .6em; padding: calc(6 * var(--u)) 0 calc(3 * var(--u)); text-align: center; font: 500 var(--s)/1.35 var(--serif); }
.booked .word { height: calc(var(--word) * 1.05); transform: rotate(-5deg); }
.booked a { color: var(--red-deep); font-weight: 650; text-underline-offset: .22em; }

.book-title { margin: 0; display: flex; justify-content: center; }
.count { margin: .25em 0 0; min-height: 1.3em; text-align: center; font: italic 500 var(--s)/1.3 var(--serif); }
.count button { font: inherit; color: var(--red-deep); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.list { margin-top: calc(4.5 * var(--u)); }
.list h3 { margin: 0 0 .1em; font: 700 var(--m)/1.15 var(--serif); }
.list h3 small { margin-left: .45em; font: italic 500 .82em/1 var(--serif); opacity: .8; }
.list h3 em { float: right; font: italic 500 .76em/1.6 var(--serif); opacity: .8; }
.list h3 em.none { color: var(--red-deep); opacity: 1; font-weight: 700; }
.list ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: column;
  grid-template-rows: repeat(var(--half), auto); column-gap: calc(5 * var(--u)); }
.list li { display: flex; align-items: flex-end; gap: .4em; height: var(--book-row); border-bottom: var(--rule) solid var(--pencil); }
.list .n { min-width: 1.35em; text-align: right; font: 600 calc(var(--s) * .86)/1 var(--serif); opacity: .45; padding-bottom: .5em; }
.list .who { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-bottom: .06em;
  font: 600 var(--name)/1.05 var(--hand); color: var(--green); }
.list .who.mine { color: var(--red-deep); }

/* ------------------------------------------------------------------ screen 2 on a desktop window: one fixed 3:2 stage,
   the painted paper behind, form on the left, that date's guest book on the right. Nothing changes shape. */
@media (min-width: 1000px) and (min-height: 640px) and (min-aspect-ratio: 5/4) {
  .rsvp { --u: min(1vw, 1.5vh); height: 100vh; height: 100dvh; min-height: 0; place-items: center; align-content: center; overflow: clip; }
  @supports (height: 100dvh) { .rsvp { --u: min(1vw, 1.5dvh); } }
  .stage { width: calc(100 * var(--u)); aspect-ratio: 3 / 2; --k: 1; }
  .backdrop { display: block; position: absolute; inset: 0; }
  .backdrop img { display: block; width: 100%; height: 100%; background: var(--page);
    -webkit-mask-image: linear-gradient(to right, transparent, #000 1.6%, #000 98.4%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 1.6%, #000 98.4%, transparent); }
  .sheet { position: static; display: contents;
    --name: calc(calc(1.62 * var(--u)) * var(--k)); --s: calc(calc(.94 * var(--u)) * var(--k)); --m: calc(calc(1.16 * var(--u)) * var(--k)); --row: calc(calc(2.62 * var(--u)) * var(--k));
    --col: calc(calc(5.25 * var(--u)) * var(--k)); --num: calc(calc(1.4 * var(--u)) * var(--k)); --ring: calc(calc(1.62 * var(--u)) * var(--k)); --word: calc(calc(4 * var(--u)) * var(--k));
    --book-row: calc(calc(2.04 * var(--u)) * var(--k)); --rule: max(1px, calc(.085 * var(--u))); }
  .sheet-mid { display: contents; }
  .sheet-top, .sheet-foot { display: none; }
  .page { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); width: calc(var(--w) * 1%); height: calc(var(--h) * 1%);
    margin: 0; padding: 0; display: flex; flex-direction: column; }
  .rsvp[data-paper="card"] .form { --x: 15.4; --y: 19.6; --w: 32.2; --h: 55; }
  .rsvp[data-paper="card"] .book { --x: 52.4; --y: 19.6; --w: 32.2; --h: 55; }
  .rsvp[data-paper="label"] .stage { --k: .86; }
  .rsvp[data-paper="label"] .form { --x: 24.2; --y: 21.2; --w: 24.6; --h: 53; }
  .rsvp[data-paper="label"] .book { --x: 51.2; --y: 21.2; --w: 24.6; --h: 53; }
  .rsvp[data-paper="label"] .back { position: static; align-self: center; margin: 0; padding: 0 .2em .1em; }   /* its corners are clipped */
  .rsvp[data-paper="pair"] .stage { --k: .84; }
  .rsvp[data-paper="pair"] .form { --x: 23.2; --y: 23.4; --w: 23.6; --h: 50.5; }
  .rsvp[data-paper="pair"] .book { --x: 53.2; --y: 23.4; --w: 23.6; --h: 50.5; }
  .rsvp[data-paper="sheet"] .stage { --k: .86; }
  .rsvp[data-paper="sheet"] .form { --x: 24.4; --y: 21.4; --w: 24.2; --h: 49.5; }
  .rsvp[data-paper="sheet"] .book { --x: 51.4; --y: 21.4; --w: 24.2; --h: 49.5; }

  .back { position: absolute; left: 0; top: 0; }
  .event { margin: calc(calc(.3 * var(--u)) * var(--k)) 0 0; }
  .times { display: none; }                              /* here the times stand above the three columns */
  .rsvp form { margin: calc(calc(.5 * var(--u)) * var(--k)) 0 0; flex: 1; display: flex; flex-direction: column; min-height: 0; }
  .head .yours { grid-column: 1 / 3; }
  .head .yours .word { height: calc(var(--word) * .6); }
  .head .col { display: block; white-space: nowrap; font-size: calc(var(--s) * .96); }
  /* six lines are always there (no line is added for most groups); a seventh and eighth share the same room */
  .writing { height: calc(var(--row) * 6.8); display: flex; flex-direction: column; }
  .lines { display: flex; flex-direction: column; min-height: 0; }
  .line.row { flex: 0 1 var(--row); grid-template-columns: var(--num) minmax(0, 1fr) repeat(3, var(--col)); grid-template-rows: 100%;
    height: auto; min-height: 0; padding: 0; }
  .line > .num, .line > .name-cell, .line > .pick, .line > .pick:nth-child(n) { grid-area: auto; }
  .name-cell { margin-right: calc(.7 * var(--u)); }
  .pick, .pick:last-child { justify-content: center; gap: 0; padding: 0; }
  .pick-label { display: none; }
  .ring { margin-top: 14%; }
  .more-wrap { flex: 0 1 calc(var(--row) * .8); height: auto; min-height: 0; }
  .note { margin: 0; min-height: 2.7em; }
  .send { margin: calc(calc(.45 * var(--u)) * var(--k)) 0 0; }
  .pill { --h: calc(calc(2.95 * var(--u)) * var(--k)); min-width: 50%; }
  .pill.small { --h: calc(calc(2.1 * var(--u)) * var(--k)); }
  .feedback { margin-top: calc(calc(.4 * var(--u)) * var(--k)); min-height: 0; flex: 1; }
  .booked { padding: 0; flex: 1; min-height: 0; }
  .book { margin: 0; }
  .lists { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: calc(calc(1.3 * var(--u)) * var(--k)); margin-top: calc(calc(.7 * var(--u)) * var(--k)); }
  .list { margin: 0; }
  .list h3 { text-align: center; margin: 0; }
  .list h3 small { display: block; margin: .2em 0 0; }
  .list h3 em { float: none; font: inherit; opacity: 1; }
  .list h3 em:not(:empty)::before { content: " · "; color: var(--green); font-weight: 500; }
  .list ol { display: block; margin-top: calc(calc(.1 * var(--u)) * var(--k)); }
}
