/* Flinger styles: white page, dark ink, a plain grotesque for text, small grey
   monospace capitals for labels, index codes in the margin (A0, W1…), underlined
   links and a faint "+" grid behind the artworks. Colours and type live here. */
:root {
  --paper: #ffffff;
  --ink: #282633;
  --muted: #6f6e78;
  --label: #a3a2ab;
  --line: #e4e3e8;
  --tint: #f6f6f8;
  --danger: #b3261e;
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --gutter: clamp(1rem, 4vw, 3.25rem);
  --index-col: clamp(2.5rem, 7vw, 6.5rem);
  /* A faint "+" every 34px, drawn as a tiny picture. */
  --plus-grid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34'%3E%3Cpath d='M17 13.5v7M13.5 17h7' stroke='%23c4c3cb' stroke-width='1'/%3E%3C/svg%3E");
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* Hidden parts stay hidden, whatever their layout. */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip; /* Nothing may push the page sideways on phones. */
}
img, svg { max-width: 100%; }
h1, h2, h3 { font-weight: 400; margin: 0; overflow-wrap: break-word; }
h1 {
  font-size: clamp(2rem, 1.2rem + 3.6vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  max-width: 21em;
}
h2 { font-size: 1.25rem; line-height: 1.3; }
p { margin: 0 0 0.75rem; }

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.quiet, .status { color: var(--muted); }
.status { min-height: 1.5em; margin: 1rem 0 0; }
.stack { display: grid; gap: 0.75rem; }

/* Small monospace capitals, like "MISSION" and "CLIENT". */
.eyebrow {
  display: block;
  margin: 0 0 0.6rem;
  font: 0.72rem/1.4 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
}
.eyebrow strong, .eyebrow a { color: var(--ink); font-weight: 400; }
.index, .index-inline { font: 0.72rem/1.4 var(--mono); letter-spacing: 0.05em; color: var(--ink); }
.index { padding-top: 1.9rem; }
.index-inline { margin-right: 1.1em; }
.lede { font-size: clamp(1.1rem, 0.95rem + 0.7vw, 1.5rem); line-height: 1.35; max-width: 32em; }

/* Page layout: a narrow index column on the left, then content. */
.page { width: 100%; max-width: 88rem; margin: 0 auto; padding: 0 var(--gutter); }
.hero { padding: clamp(2.5rem, 9vw, 7rem) 0 clamp(2rem, 6vw, 4.5rem); }
.hero h1 { margin-bottom: clamp(2rem, 5vw, 4rem); }
.hero-grid, .section-grid { display: grid; grid-template-columns: var(--index-col) minmax(0, 1fr); gap: 0 1rem; }
.hero-grid { grid-template-columns: var(--index-col) minmax(0, 1fr) minmax(0, 14rem); gap: 1.5rem 1rem; }
.hero-aside p { margin: 0; }
@media (max-width: 44rem) {
  .hero-grid { grid-template-columns: var(--index-col) minmax(0, 1fr); }
  .hero-aside { grid-column: 2; }
}
.footer { display: flex; flex-wrap: wrap; gap: 0 0.75rem; align-items: baseline; padding-top: 3rem; padding-bottom: max(3rem, env(safe-area-inset-bottom)); color: var(--muted); font-size: 0.9rem; }
.footer .eyebrow { margin: 0; }

/* Buttons: dark pills, plus text-style links. */
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: 0.5; cursor: default; }
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 2.9rem;
  padding: 0.6rem 1.3rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.pill:hover { background: transparent; color: var(--ink); text-decoration: none; }
.pill-small { min-height: 2.3rem; padding: 0.35rem 1.05rem; font-size: 0.95rem; }
.pill-light { background: transparent; color: var(--ink); }
.pill-light:hover { background: var(--ink); color: var(--paper); }
.link-button { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 0.18em; }
.danger { width: 100%; min-height: 2.9rem; padding: 0.6rem 1rem; border: 1px solid var(--danger); border-radius: 999px; background: none; color: var(--danger); }
.danger.armed { background: var(--danger); color: #fff; }

/* Text boxes. 16px or more stops iPhones zooming in (and the page sliding sideways). */
.field {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: max(16px, 1rem);
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  padding: 0.55rem 0;
}
.field::placeholder { color: var(--label); }
.field:focus-visible { outline: none; border-bottom-width: 2px; padding-bottom: calc(0.55rem - 1px); }
.field-big { font-size: clamp(1.25rem, 1rem + 1.2vw, 1.75rem); }
.field-code { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.2em; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.search-row { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem 1rem; }
.search-row .field { flex: 1 1 12rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: end; }
.inline-form .field { flex: 1 1 10rem; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: max(1rem, env(safe-area-inset-top)) var(--gutter) 1rem;
  background: rgb(255 255 255 / 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; flex: none; }
.brand-mark { font-weight: 700; font-size: 1.2rem; line-height: 1; padding-right: 0.6rem; border-right: 1px solid var(--line); }
.topbar-actions { display: flex; align-items: center; gap: clamp(0.9rem, 3vw, 2.5rem); min-width: 0; }
.nav-button { background: none; border: 0; padding: 0.4rem 0; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.3em; white-space: nowrap; }
.nav-button:hover, .nav-button[aria-expanded="true"] { text-decoration-color: currentColor; }
.nav-link { white-space: nowrap; text-decoration-color: transparent; }
.nav-link:hover { text-decoration-color: currentColor; }
.room-pill { display: inline-flex; align-items: center; gap: 0.5rem; }
.pill-invite { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--label); }
.live-dot { flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #3bb56a; box-shadow: 0 0 0 0 rgb(59 181 106 / 0.5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgb(59 181 106 / 0); } 100% { box-shadow: 0 0 0 0 rgb(59 181 106 / 0); } }
@media (max-width: 26rem) {
  .brand-name, .pill-invite { display: none; }
  .brand-mark { border: 0; padding: 0; }
}

.panel {
  position: absolute;
  top: calc(100% - 0.25rem);
  right: var(--gutter);
  width: min(23rem, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - 5.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: 0.9rem;
  padding: 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgb(40 38 51 / 0.14);
}
.panel > * { min-width: 0; }
.panel .eyebrow { margin: 0; }
.panel .qr { justify-self: center; width: min(220px, 100%); height: auto; aspect-ratio: 1; }
.panel-note { margin: 0; font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }
.room-code { font-family: var(--mono); letter-spacing: 0.15em; }
@media (max-width: 30rem) {
  .panel { left: var(--gutter); right: var(--gutter); width: auto; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  z-index: 30;
  width: max-content;
  max-width: calc(100vw - 2rem);
  margin: 0;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.95rem;
  text-align: center;
  transform: translate(-50%, 180%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* The host's room screen, shown instead of the introduction while hosting */
.hosting .hero { display: none; }
.room-header { padding: clamp(2rem, 7vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem); }
.room-header > .eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.4em; }
.room-header > .eyebrow .live-dot { margin-right: 0.35em; }
.room-header h1 { margin-bottom: 1.5rem; }
.room-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-bottom: clamp(2rem, 5vw, 3rem); }
.room-flung .history { max-width: 40rem; }
.room-flung .history:empty { display: none; }

/* Search and results */
.search-section { padding-bottom: 2rem; border-top: 1px solid var(--line); padding-top: clamp(2rem, 5vw, 3.5rem); }
.search .eyebrow { margin-bottom: 0.25rem; }
.source-switch { border: 0; margin: 0 0 1.5rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.source-switch legend { padding: 0; margin-bottom: 0.6rem; }
.source-switch label { position: relative; }
.source-switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.source-switch span { display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0.4rem 1.1rem; border: 1px solid var(--ink); border-radius: 999px; }
.source-switch input:checked + span { background: var(--ink); color: var(--paper); }
.source-switch input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 3px; }
.fling-hint { margin: 1.25rem 0 0; font-size: 1rem; }
.fling-hint::before { content: "↑"; display: inline-block; margin-right: 0.5rem; font-weight: 700; }
.results {
  list-style: none;
  margin: clamp(1.5rem, 4vw, 3rem) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr));
  gap: clamp(2rem, 4vw, 3.5rem) clamp(1rem, 3vw, 2.5rem);
}
.card { display: flex; flex-direction: column; min-width: 0; }
.card-image { position: relative; margin-bottom: 1rem; aspect-ratio: 1; background: var(--tint) var(--plus-grid) center; }
.card img { position: absolute; inset: 0; margin: auto; display: block; max-width: calc(100% - 2.5rem); max-height: calc(100% - 2.5rem); box-shadow: 0 10px 24px rgb(40 38 51 / 0.14); user-select: none; -webkit-user-select: none; }
.hosting .card img { cursor: grab; }
.card .eyebrow { margin-bottom: 0.4rem; }
.card h2 { font-size: 1.3rem; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; margin-bottom: 0.4rem; }
.card p { margin: 0 0 0.2rem; }
.card .quiet { font-size: 0.9rem; }
.card-actions { margin-top: auto; padding-top: 0.9rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; font-size: 0.95rem; }
/* Without a room the Fling button is outlined; pressing it explains how to start one. */
body:not(.hosting) .fling-button { background: transparent; color: var(--ink); }
.ghost { position: fixed; z-index: 20; object-fit: contain; pointer-events: none; box-shadow: 0 24px 50px rgb(40 38 51 / 0.3); }

/* The "+" grid behind artworks on the flick screen and the guest screen. */
.stage, .landing { background: var(--paper) var(--plus-grid) center; }

/* Full-screen card for flicking on phones */
.stage-open { overflow: hidden; }
.stage {
  position: fixed;
  inset: 0;
  z-index: 25;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  padding: max(0.75rem, env(safe-area-inset-top)) 1rem max(1.25rem, env(safe-area-inset-bottom));
}
.stage-close { justify-self: end; width: 2.75rem; height: 2.75rem; border: 1px solid var(--ink); border-radius: 50%; background: var(--paper); font-size: 1.5rem; line-height: 1; }
.stage-card { margin: 0; width: min(88vw, 30rem); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; will-change: transform; text-align: center; }
.stage-card img { display: block; margin: 0 auto; max-width: 100%; max-height: 58vh; max-height: 58dvh; object-fit: contain; pointer-events: none; box-shadow: 0 24px 50px rgb(40 38 51 / 0.25); }
.stage-card figcaption { display: inline-block; margin-top: 1rem; padding: 0.2rem 0.5rem; background: var(--paper); font-size: 0.95rem; }
.stage-hint {
  display: grid;
  place-items: center;
  align-content: center;
  width: 7.5rem;
  height: 7.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.stage-hint span { display: block; margin-top: 0.3rem; font-size: 1.4rem; text-decoration: none; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-5px); } }

/* Guest screen */
.guest-main { padding-bottom: 3rem; }
.join-form { padding-top: clamp(2.5rem, 9vw, 6rem); }
.join-form h1 { margin-bottom: clamp(1.5rem, 5vw, 3rem); }
.join-form .search-row .field { flex-basis: 8rem; }
.guest-bar { padding-top: clamp(1rem, 4vw, 2.5rem); margin-bottom: 1.25rem; }
.guest-bar .eyebrow { margin-bottom: 0.4rem; }
.guest-bar .eyebrow span:last-child { color: var(--ink); }
.guest-title { font-size: clamp(1.6rem, 1.1rem + 2.4vw, 2.6rem); line-height: 1.15; }
.landing {
  position: relative;
  isolation: isolate;
  overflow: clip; /* The artwork can spin in without pushing the page sideways. */
  min-height: 68vh;
  min-height: 68dvh;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 2.5rem);
  margin: 0 calc(-1 * var(--gutter));
}
.landing > * { grid-area: 1 / 1; }
.waiting { padding: 0.4rem 0.8rem; background: var(--paper); color: var(--muted); text-align: center; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.45; } }
.landed { margin: 0; width: 100%; text-align: center; }
.landed img { display: block; margin: 0 auto; max-width: 100%; max-height: 56vh; max-height: 56dvh; object-fit: contain; box-shadow: 0 24px 50px rgb(40 38 51 / 0.25); }
.landed figcaption { display: inline-grid; gap: 0.2rem; margin-top: 1.25rem; padding: 0.6rem 0.9rem; background: var(--paper); max-width: 100%; }
.landed strong { font-weight: 400; font-size: clamp(1.2rem, 1rem + 1vw, 1.6rem); line-height: 1.2; overflow-wrap: break-word; }
.landed span { color: var(--muted); }
.landed a { font-size: 0.9rem; margin-top: 0.2rem; }
.leaving { pointer-events: none; }
.ended { margin-top: 1.5rem; padding: 1.25rem 0; border-top: 1px solid var(--ink); display: grid; gap: 0.75rem; justify-items: start; }
.ended p { margin: 0; font-size: 1.1rem; }
.ended strong { font-weight: 400; text-decoration: underline; text-underline-offset: 0.18em; }
.history-heading { margin-top: 2.5rem; }
.history { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(4.75rem, 1fr)); gap: 0.6rem; }
.history img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }

/* My rooms */
.guest-main > section > h1 { padding-top: clamp(2.5rem, 9vw, 6rem); margin-bottom: clamp(1.5rem, 5vw, 3rem); }
#room-detail > .eyebrow { padding-top: clamp(1.5rem, 5vw, 3rem); margin-bottom: 0; }
#room-detail > h1 { padding-top: 0.75rem; }
.room-list { list-style: none; margin: 2rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.room-list li { display: grid; grid-template-columns: var(--index-col) minmax(0, 1fr); gap: 0 1rem; border-bottom: 1px solid var(--line); }
.room-list .index { padding-top: 1.35rem; }
.room-list a { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 1rem; align-items: center; padding: 1rem 0; text-decoration: none; }
.room-list a:hover strong { text-decoration-thickness: 2px; }
.room-list .thumbs { grid-row: span 2; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 4.5rem; height: 4.5rem; background: var(--tint); overflow: hidden; }
.room-list .thumbs img { width: 100%; height: 100%; object-fit: cover; }
.room-list .thumbs img:only-child { grid-column: span 2; grid-row: span 2; }
.room-list strong { font-weight: 400; font-size: 1.25rem; line-height: 1.25; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; align-self: end; overflow-wrap: break-word; }
.room-list span { font: 0.72rem/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--label); align-self: start; margin-top: 0.3rem; }
.saved-artworks { list-style: none; margin: 2rem 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(11rem, 100%), 1fr)); gap: 2rem 1.25rem; }
.saved-artworks li { display: grid; gap: 0.25rem; align-content: start; min-width: 0; }
.saved-artworks img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--tint); padding: 0.75rem; margin-bottom: 0.6rem; }
.saved-artworks .eyebrow { margin: 0; }
.saved-artworks strong { font-weight: 400; font-size: 1.1rem; line-height: 1.25; overflow-wrap: break-word; }
.saved-artworks span { color: var(--muted); font-size: 0.9rem; }
.saved-artworks a { font-size: 0.9rem; }

/* Staff page and simple pages (404, offline, AR examples) */
.feedback-list { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.feedback-list li { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.feedback-list time { font: 0.72rem/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--label); margin-left: 0.5rem; }
.feedback-list p { margin: 0.25rem 0 0; }
main.page > h1:first-child { margin-bottom: 1.5rem; }

@media (prefers-reduced-motion: reduce) {
  .live-dot, .waiting, .stage-hint span { animation: none; }
  .toast, .pill { transition: none; }
}
