/* party.css - the room behind a front door, the clearing at the Community
   Gate, and the things that lead there. Colors and fonts are the variables
   defined at the top of style.css. */

/* ---------- ways in ---------- */

button.front-door { padding: 0; border: 0; background: none; cursor: pointer; }
/* The swinging part of the door. "fill-box" makes left mean the door's own
   left edge, where its hinges are. Squeezing it sideways reads as swinging. */
.front-door .leaf { transform-box: fill-box; transform-origin: left center; transition: transform 450ms cubic-bezier(.2, .7, .2, 1); }
button.front-door:hover .leaf, button.front-door:focus-visible .leaf { transform: scaleX(0.8); }
button.front-door.is-opening .leaf { transform: scaleX(0.16); }

.meadow { position: relative; }
/* See-through buttons lying over the drawn signs (see fieldHtml in app.js;
   the numbers are the sign's place in the 400 x 200 meadow drawing). */
.sign-button { position: absolute; border: 0; border-radius: 8px; background: none; cursor: pointer; }
.sign-button.gate { left: 57%; top: 44%; width: 41%; height: 55%; }
.sign-button.plans { left: 3%; top: 45%; width: 39%; height: 54%; }
.sign-button:hover { box-shadow: 0 0 0 3px var(--glow), 0 0 24px 6px rgba(249, 215, 119, 0.5); }

.more-stops { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* The warm light that fills the space under the header between the street and the room. */
#party-glow { position: fixed; inset: var(--head) 0 0; z-index: 60; background: #F9D777; opacity: 0; pointer-events: none; }
.is-zooming { overflow-x: hidden; }
.is-zooming .street { z-index: 50; }              /* over the caption, under the header and footer */
.is-zooming .snowfall { display: none; }
/* Inside, the room fills the space between a slimmer header and the footer. */
.is-inside body { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.is-inside :is(.street, .hero) { display: none; }
.is-inside .masthead { padding-block: 12px 8px; flex: none; }
.is-inside .masthead h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
.is-inside .masthead .tagline { font-size: 1.1rem; margin: 0; }

/* How it works has two parts: one for the street, one for inside. */
html:not(.is-inside) .info-inside, .is-inside .info-street { display: none; }
@media (max-width: 560px) { .is-inside .masthead .tagline { font-size: 0.95rem; white-space: nowrap; } }

/* ---------- the room ---------- */

.room {
  --vx: 0; --vy: 0; --vw: 1200; --vh: 780;        /* the part of the drawing on show */
  position: relative; flex: 1 1 0; min-height: 0; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(330px, 29vw, 440px); gap: 20px;
  padding: 0 clamp(12px, 2vw, 28px) 0 0;
  background: linear-gradient(#F9EEDC, #F3E2C8);      /* plain painted walls, a warm cream */
}
.room[hidden] { display: none; }
#party-leave { position: absolute; left: 14px; top: 12px; z-index: 4; min-height: 44px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35); }
.garland { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; }
.garland svg { display: block; position: relative; }
.garland svg.stars { position: absolute; left: 0; top: 0; width: 100%; height: 80dvh; }
.room:not(.is-gate) .snowfall { display: none; }

/* The stage is as big as fits, keeps the drawing's shape, and stands on the
   footer. "cqw" and "cqh" are 1% of the scene's width and height. Its floor
   is drawn far wider than the stage, so it runs on under the playlist. */
.scene { container-type: size; min-width: 0; }
.stage { position: absolute; left: 50cqw; bottom: 0; width: max(790px, min(100cqw, 100cqh * 1200 / 780)); aspect-ratio: 1200 / 780; transform: translateX(-50%); }
.scene { position: relative; }
.stage-art { position: absolute; width: calc(1200 / var(--vw) * 100%); left: calc(0px - var(--vx) / var(--vw) * 100%); top: calc(0px - var(--vy) / var(--vh) * 100%); height: auto; overflow: visible; display: block; }
.stage.low { display: none; }

/* The TV, in stage units: 570 x 332 from (315, --tv-top). YouTube requires
   its player to be at least 200 x 200 pixels, and fully in view (that is
   where the stage's smallest width, 790px, comes from). */
.room { --tv-top: 30; }
.room.is-gate { --tv-top: 206; }
.tv {
  position: absolute;
  left: calc((315 - var(--vx)) / var(--vw) * 100%); top: calc((var(--tv-top) - var(--vy)) / var(--vh) * 100%);
  width: calc(570 / var(--vw) * 100%); height: calc(332 / var(--vh) * 100%);
  padding: calc(14 / var(--vw) * 100%);
  background: linear-gradient(#4A2A16, #2B170B); border-radius: 12px;
  box-shadow: inset 0 0 0 2px rgba(255, 248, 236, 0.25), 0 8px 22px rgba(0, 0, 0, 0.4);
}
.tv-screen { width: 100%; height: 100%; border-radius: 5px; overflow: hidden; background: #10131A; }
.tv-screen iframe { display: block; width: 100%; height: 100%; border: 0; }
.is-gate .tv { background: var(--icing); border-radius: 4px; box-shadow: 0 0 40px 8px rgba(255, 246, 214, 0.45), 0 4px 14px rgba(0, 0, 0, 0.5); }

/* ---------- the reader by the fire, and the newspaper stand ---------- */

.reader {
  position: absolute; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; border-radius: 12px;
  left: calc((912 - var(--vx)) / var(--vw) * 100%); top: calc((476 - var(--vy)) / var(--vh) * 100%); width: calc(232 / var(--vw) * 100%);
}
.is-gate .reader { left: calc((938 - var(--vx)) / var(--vw) * 100%); top: calc((486 - var(--vy)) / var(--vh) * 100%); width: calc(250 / var(--vw) * 100%); }
.reader:disabled { cursor: default; }
.reader svg { display: block; width: 100%; height: auto; overflow: visible; transition: filter 150ms ease, transform 150ms ease; }
/* On hover (or keyboard focus) it glows, and a note says how many links there are. */
.reader:not(:disabled):is(:hover, :focus-visible) svg { filter: drop-shadow(0 0 5px #FFF3C9) drop-shadow(0 0 14px var(--light)); transform: translateY(-3px); }
.reader-tag {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translate(-50%, 6px); white-space: nowrap; padding: 4px 14px;
  border: 2px solid var(--red); border-radius: 12px;
  background: var(--icing); color: var(--red);
  font-family: var(--font-sub); font-weight: var(--sub-weight); font-size: 1.35rem; line-height: 1.15;
  opacity: 0; pointer-events: none; transition: opacity 150ms ease, transform 150ms ease;
}
.reader:is(:hover, :focus-visible) .reader-tag { opacity: 1; transform: translate(-50%, 0); }
/* A touch screen has no hover, so there the note is always up. */
@media (hover: none) { .reader-tag { opacity: 1; transform: translate(-50%, 0); font-size: 1.1rem; } }

/* Snow outside the windows, when Falling snow is on. */
.pane-flake { display: none; animation: pane-fall linear infinite; }
.has-snow .pane-flake { display: inline; }
@keyframes pane-fall { from { transform: translateY(0); } to { transform: translateY(48px); } }

.flame { transform-box: fill-box; transform-origin: center bottom; animation: flicker 700ms ease-in-out infinite alternate; }
.flame.slow { animation-duration: 1100ms; }
@keyframes flicker { from { transform: scale(1, 0.92) skewX(-2deg); } to { transform: scale(0.95, 1.08) skewX(3deg); } }
.bulb { animation: tree-twinkle 1.8s ease-in-out infinite alternate; }   /* gentle, so red never dims to brown on the green */
@keyframes tree-twinkle { from { opacity: 0.85; } to { opacity: 1; } }
.bulb-1 { animation-delay: -0.6s; }
.bulb-2 { animation-delay: -1.2s; }
.steam { animation: steam 2.2s ease-in-out infinite alternate; }
@keyframes steam { from { opacity: 0.35; transform: translateY(2px); } to { opacity: 1; transform: translateY(-3px); } }

/* ---------- the playlist ---------- */

.songs {
  position: relative; z-index: 2; min-height: 0; max-height: calc(100% - 32px); align-self: start; margin-block: 16px;
  display: flex; flex-direction: column;
  background: var(--card); border-top: 8px solid var(--red); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); overflow: hidden;
}
.songs-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 12px; padding: 10px 16px 8px; }
.songs-head h2 { font-family: var(--font-title); font-weight: var(--title-weight); font-size: 1.55rem; line-height: 1.15; color: var(--title-2); }
.songs-head p { margin: 0; color: var(--muted); font-family: var(--font-sub); font-weight: 500; font-size: 1.25rem; line-height: 1.2; }
/* What is playing, and the buttons. The song's title is a step smaller than the
   playlist's own, so the order of importance is clear. */
.console {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none;
  padding: 10px 14px 10px 16px; border-block: 1px solid var(--line);
}
.now { min-width: 0; flex: 1; }
.now p { margin: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }   /* two lines at most */
.now-title { font-family: var(--font-title); font-weight: var(--title-weight); font-size: 1.25rem; line-height: 1.2; min-height: 1.2em; color: var(--title-2); }
.now-artist { font-family: var(--font-sub); font-weight: 500; font-size: 1.2rem; line-height: 1.15; min-height: 1.15em; color: var(--muted); }
.knobs { display: flex; align-items: center; gap: 7px; flex: none; }
.knob { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--green); color: #fff; cursor: pointer; transition: background 150ms ease; }
.knob.big { width: 56px; height: 56px; }
.knob:hover:not(:disabled) { background: var(--green-dark); }
.knob:disabled { opacity: 0.45; cursor: default; }
.knob svg { width: 52%; height: 52%; fill: currentColor; }
.knob .pause-shape, .knob.is-playing .play-shape { display: none; }
.knob.is-playing .pause-shape { display: inline; }
.room :focus-visible { outline-color: var(--light); }

/* Two small icon buttons over the list: shuffle on the left, and the arrow
   for the date order on the right, above the dates. */
.sorts { display: flex; justify-content: space-between; padding: 2px 14px 2px 12px; border-bottom: 1px solid var(--line); flex: none; }
.sort { display: grid; place-items: center; width: 44px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--title-2); cursor: pointer; }
.sort:hover:not(:disabled) { background: var(--paper); }
.sort:disabled { opacity: 0.4; cursor: default; }
.sort svg, .info-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 200ms ease; }
.sort .parallel, .sort.is-on .crossing { display: none; }
.sort.is-on .parallel { display: inline; }
.sort.is-on { background: var(--green); color: #fff; }
.sort.is-old svg { transform: rotate(180deg); }
.sort.is-faded { opacity: 0.4; }
.info-icon svg { vertical-align: -4px; color: var(--title-2); }
.song-list { margin: 0; padding: 4px 8px 8px; list-style: none; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.song {
  display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; gap: 10px; align-items: center;
  width: 100%; min-height: 48px; padding: 6px 10px;
  border: 0; border-radius: 8px; background: none; color: inherit; text-align: left; cursor: pointer;
}
.song:hover { background: var(--paper); }
.song-number { font-family: var(--font-title); font-weight: var(--title-weight); font-size: 1.25rem; line-height: 1; text-align: right; color: var(--title); }
.song-words { display: grid; line-height: 1.3; min-width: 0; }
.song-title { font-weight: 600; overflow-wrap: anywhere; }
.song-artist { color: var(--muted); font-size: 0.875rem; overflow-wrap: anywhere; }
.song-date { max-width: 6.5em; color: var(--muted); font-family: var(--font-sub); font-weight: 500; font-size: 1.15rem; line-height: 1.05; text-align: right; }
/* The "!" of a stand-in video, at the end of its row. */
.song-list li { display: flex; align-items: center; border-radius: 8px; }
.song-list .song { flex: 1; min-width: 0; width: auto; }
/* The two thumbs at the end of every row: grey until hovered or chosen. */
.row-votes { flex: none; display: flex; gap: 2px; padding-right: 6px; }
.thumb { justify-content: center; width: 38px; height: 38px; padding: 0; border-color: transparent; background: none; font-size: 1rem; }
.thumb span { filter: grayscale(1); opacity: 0.75; }
.thumb:hover span, .thumb[aria-pressed="true"] span { filter: none; opacity: 1; }
/* The row that is playing is red all the way across. */
.song-list li:has([aria-current]) { background: var(--red); }
li:has([aria-current]) .thumb span { filter: none; opacity: 1; }
li:has([aria-current]) .thumb[aria-pressed="true"] { border-color: #fff; }
.swap-mark {
  display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 2px solid var(--green); border-radius: 50%; background: var(--card); color: var(--title-2);
  font: 700 0.85rem/1 Georgia, serif; cursor: help; vertical-align: 2px;
}
.song-list .swap-mark { margin: 0 10px 0 2px; }
.swap-mark:hover, .swap-mark:focus-visible { background: var(--green); color: #fff; }
#hint {
  position: fixed; z-index: 200; width: min(270px, 80vw); padding: 10px 12px; pointer-events: none;
  border: 1px solid var(--green-tint); border-left: 4px solid var(--green); border-radius: 6px;
  background: var(--card); color: var(--ink); font-size: 0.875rem; line-height: 1.4; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.song-rated { padding: 0 6px; border-radius: 4px; background: var(--fur); color: var(--green-deep); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.song[aria-current] { background: var(--red); color: #fff; }
.song[aria-current] :is(.song-number, .song-artist, .song-date) { color: #fff; }
.song[aria-current] .song-rated { background: #fff; color: var(--red); }
.song.is-broken .song-title { text-decoration: line-through; opacity: 0.6; }

/* The newspaper: the same cream paper and dark ink in light and dark mode. */
.paper {
  width: min(820px, 94vw); padding: 18px clamp(16px, 4vw, 36px) 26px; border: 0; color: #2A241B;
  background: radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.7), transparent 60%), linear-gradient(90deg, transparent 49.6%, rgba(94, 53, 23, 0.1) 50%, transparent 50.4%), #F3EBD8;
  box-shadow: 0 2px 0 #E3D7BC, 0 4px 0 #F3EBD8, 0 5px 0 #D9CCAE, 0 20px 60px rgba(0, 0, 0, 0.5);      /* a few sheets thick */
  font-family: Georgia, "Times New Roman", serif;
}
.paper .icon-button { position: absolute; top: 6px; right: 6px; color: #5E5443; }
.paper .icon-button:hover { background: rgba(94, 53, 23, 0.12); color: #2A241B; }
.paper h2 { font-family: var(--font-title); font-weight: var(--title-weight); font-size: clamp(2.1rem, 8vw, 3.6rem); line-height: 1.1; text-align: center; color: #2A241B; }
.paper-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 16px; margin: 6px 0 16px; padding: 3px 2px; border-block: 4px double #2A241B; font-size: 0.85rem; font-style: italic; }
.paper-columns { display: grid; grid-template-columns: 1fr 1fr; }
.paper section + section { padding-left: 22px; border-left: 1px solid #2A241B; }
.paper section:first-child { padding-right: 22px; }
.paper h3 button { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: help; text-decoration: underline dotted #8A7D66 2px; text-underline-offset: 5px; }
.paper h3 { margin: 0 0 10px; padding-bottom: 4px; border-bottom: 2px solid #2A241B; font-size: 1.3rem; text-align: center; }
.paper ul { margin: 0; padding: 0; list-style: none; }
.paper li { display: grid; padding: 8px 0; border-bottom: 1px dotted #8A7D66; line-height: 1.3; overflow-wrap: anywhere; }
.paper li:last-child { border-bottom: 0; }
.paper li a { color: #8C1515; font-weight: 700; }
.paper li span { font-style: italic; }
.paper li small { margin-top: 2px; color: #5E5443; font-size: 0.82rem; }
.paper :focus-visible { outline-color: #8C1515; }
@media (max-width: 620px) {
  .paper-columns { grid-template-columns: 1fr; }
  .paper section:first-child { padding-right: 0; }
  .paper section + section { margin-top: 18px; padding: 14px 0 0; border-left: 0; border-top: 4px double #2A241B; }
}

/* ---------- the suggestion box ---------- */

/* A wooden box with a slot along its top edge. The slip of paper (the form)
   stands in the slot; "slip-window" hides whatever has dropped below it. */
.plans { width: min(460px, 94vw); padding: 0; border: 0; background: none; color: #2A241B; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.5)); }
.slip-window { overflow: hidden; padding: 0 26px; }
.slip {
  position: relative; padding: 16px 20px 24px; border-radius: 4px 4px 0 0;
  background: repeating-linear-gradient(transparent 0 33px, rgba(48, 120, 190, 0.14) 33px 34px), #FBF6E6;
}
.slip.is-dropping { animation: drop 520ms cubic-bezier(.6, 0, .9, .5) forwards; }
.slip.is-rising { animation: drop 420ms cubic-bezier(.2, .7, .2, 1) reverse; }
@keyframes drop { to { transform: translateY(101%); } }
.slip .icon-button { position: absolute; top: 2px; right: 2px; z-index: 1; padding: 2px 10px; color: #5E5443; }
.slip .icon-button:hover { background: rgba(94, 53, 23, 0.12); color: #2A241B; }
.elf-note { display: flex; align-items: center; gap: 12px; margin: 0 26px 12px 0; color: #8C1515; font-family: var(--font-sub); font-weight: 700; font-size: 1.5rem; line-height: 1.12; }
.elf-note svg { flex: none; width: 54px; height: 54px; }
.slip .control { margin-top: 8px; color: #2A241B; }
.slip .control input { width: 100%; background: #fff; color: #2A241B; border-color: #8A7D66; color-scheme: light; }
.slip .error { margin: 10px 0 0; color: #8C1515; }
.slip .error:empty { display: none; }
.slip .elf-small { margin: 0; font-family: var(--font-sub); font-weight: 500; font-size: 1.35rem; line-height: 1.2; }
.elf-small span { white-space: nowrap; }
.box-front {
  position: relative; padding: 30px 24px 22px; text-align: center; color: var(--icing);
  background: repeating-linear-gradient(transparent 0 50px, rgba(0, 0, 0, 0.28) 50px 52px), linear-gradient(90deg, #7A4520, var(--ginger-dark) 30%, #7A4520);
  border-radius: 6px 6px 12px 12px; box-shadow: inset 0 0 0 5px var(--ginger-deep), inset 0 0 0 7px rgba(255, 248, 236, 0.25);
}
.box-front::before { content: ""; position: absolute; left: 18px; right: 18px; top: -5px; height: 13px; border-radius: 7px; background: #1E0C06; box-shadow: 0 2px 0 rgba(255, 248, 236, 0.35); }   /* the slot */
.box-front h2 { font-family: var(--font-title); font-weight: var(--title-weight); font-size: 2.1rem; line-height: 1.1; color: var(--icing); }
.box-front h2 small { display: block; color: var(--light); font-family: var(--font-sub); font-weight: 700; font-size: 1.3rem; }
.box-front .button { margin-top: 12px; min-height: 44px; box-shadow: 0 0 0 2px var(--icing); }
.plans :focus-visible { outline-color: var(--light); }
.slip :focus-visible { outline-color: var(--green); }

/* ---------- outside the town hall, at the Community Gate ---------- */

.room.is-gate { background: linear-gradient(#0E1B30, #1D3557 60%); }

/* ---------- narrower windows: TV, then playlist, then the rest of the room ---------- */

@media (max-width: 1100px), (max-height: 650px) {
  .room { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden auto; }
  #party-leave { position: static; align-self: flex-start; flex: none; margin: 8px 10px; }
  .scene { container-type: normal; flex: none; align-self: center; width: min(100%, 640px, max(388px, (100dvh - var(--head) - var(--foot) - 66px) * 1.44)); }
  .stage { --vx: 308; --vy: 16; --vw: 584; --vh: 406; position: relative; left: auto; bottom: auto; width: 100%; aspect-ratio: var(--vw) / var(--vh); transform: none; overflow: hidden; }
  .stage > .reader { display: none; }
  .is-gate .stage { --vy: 160; --vh: 400; }
  .songs { flex: none; align-self: center; width: min(100% - 20px, 620px); margin: 0 0 8px; max-height: max(380px, 62dvh); }
  .stage.low { --vx: 0; --vy: 380; --vw: 1200; --vh: 400; display: block; flex: none; }
  .is-gate .stage.low { --vy: 480; --vh: 300; }
  .stage.low > .reader { display: block; }
  .stage.low .reader-tag { left: auto; right: 0; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .flame, .bulb, .steam, .slip.is-dropping, .slip.is-rising { animation: none; }
  .front-door .leaf, .reader-tag, .reader svg, .sort svg { transition: none; }
}
