/* "sitting at the table with strangers" (with-strangers.html): its own little world, separate from styles.css */
:root {
  --paper: #fbf8f2;   /* warms towards a blush over the first minute (set by with-strangers.js) */
  --ink: #3b2a21;
  --ink-dim: #957a66;
  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --p: 0; /* warmth 0 → 1, set by with-strangers.js */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
/* a little paper grain */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: .22; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55  0 0 0 0 .45  0 0 0 0 .35  0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* The flush: a blush that rises from the tables as the poem ends */
.glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(80% 60% at 50% 85%, rgba(236, 150, 130, .16), transparent 70%);
  opacity: var(--p);
}

.stage {
  position: fixed; inset: 0; z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr clamp(200px, 38vh, 420px);
}
@supports (height: 100svh) { .stage { height: 100svh; } }

/* Top bar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  height: 52px; padding: 0 24px;
  font-size: 13px; color: var(--ink-dim);
}
.back { transition: color .2s; }
.back:hover { color: var(--ink); }

/* Paint */
/* paint sits on top of everything, poem included; multiply lets the ink show through like print under a wash */
.paint { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; mix-blend-mode: multiply; }
.palette { display: flex; align-items: center; gap: 8px; }
.hint { margin-right: 6px; transition: opacity 1.5s ease; }
.hint.gone { opacity: 0; }
.palette button {
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, color-mix(in srgb, var(--c) 70%, white), var(--c) 70%);
  opacity: .75;
  transition: transform .2s, opacity .2s, box-shadow .2s;
}
.palette button:hover { opacity: 1; transform: scale(1.12); }
.palette button[aria-pressed="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--ink-dim); }

/* Poem */
.poem-wrap {
  position: relative;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 5vh 24px 8vh;
  -webkit-mask-image: linear-gradient(#000 82%, transparent);
          mask-image: linear-gradient(#000 82%, transparent);
}
.poem-wrap::-webkit-scrollbar { display: none; }

.poem-title, .poem { max-width: 30em; margin: 0 auto; }
.poem-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(30px, 4vw, 44px); line-height: 1.1; letter-spacing: -0.02em;
  margin-bottom: 28px;
}
.poem {
  font-family: var(--sans);
  font-size: clamp(16px, 1.35vw, 18px);
  line-height: 1.65;
}
.stanza { margin-bottom: 1.6em; }
.line { min-height: 1.65em; }

/* The room: two long tables and the smudges of people sitting at them */
.room { position: relative; touch-action: none; }

/* Laptops and up: the poem sits on the left, all of it on screen at once; the tables fill the right */
@media (min-width: 900px) {
  .poem-wrap { touch-action: none; } /* nothing to scroll here, so touch paints */
  .stage { grid-template-columns: minmax(420px, 44%) 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .poem-wrap {
    grid-column: 1; grid-row: 2;
    padding: 1vh 2vw 3vh clamp(32px, 6vw, 96px);
    -webkit-mask-image: none; mask-image: none;
  }
  .poem-title, .poem { margin-left: 0; }
  .poem-title { font-size: clamp(24px, 3.6vh, 34px); margin-bottom: 2.6vh; }
  .poem { font-size: clamp(14px, 2.2vh, 17px); line-height: 1.6; }
  .stanza { margin-bottom: 1.2em; }
  .line { min-height: 1.6em; }
  .room { grid-column: 2; grid-row: 2; }
}
.room > * { position: absolute; }
.row { inset: 0; }
.table-wash { left: 0; width: 100%; height: 60px; transform: translateY(-50%); filter: blur(.8px); }
.reveal { opacity: 0; transition: opacity 4s ease; }
.reveal.shown { opacity: 1; }

.smudge, .ring { position: absolute; mix-blend-mode: multiply; pointer-events: none; }
.smudge {
  opacity: 0;
  transform: translateX(-50%) scale(.8);
  transform-origin: 50% 85%;
  filter: blur(12px);
  transition: opacity 4.5s ease, transform 6s cubic-bezier(.2, .7, .2, 1), filter 5s ease;
}
.smudge.in {
  opacity: var(--o, .9);
  transform: translateX(-50%) scale(1);
  filter: blur(1px);
  animation: breathe 9s ease-in-out infinite;
}
.smudge.now { transition: none; }
/* leaving: the colour drains to a faint stain, which then dries away */
.smudge.ghost { opacity: .16; filter: blur(4px); transition: opacity 6s ease, filter 6s ease; }
.smudge.gone { opacity: 0; filter: blur(8px); transition: opacity 14s ease, filter 14s ease; }
@keyframes breathe {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) translateY(-1px) scale(1.012); }
}

.ring { opacity: 0; transform: translate(-50%, -50%); transition: opacity 5s ease; }
.ring.in { opacity: .9; }

@media (max-width: 560px) {
  .topbar { padding: 0 16px; }
  .hint { display: none; }
  .palette { gap: 7px; }
  .poem-wrap { padding: 4vh 16px 8vh; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .smudge, .ring { transition: none !important; animation: none !important; }
}
