/* TOUCHGRASS. Indoors is a dark room and a screen, set in pixels. Outdoors is daylight, set in marker.
   The page is one walk from the first to the second: the backgrounds are still, the scroll does the moving. */

@font-face { font-family: "Pixel"; src: url("/fonts/pixelify-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pixel"; src: url("/fonts/pixelify-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Marker"; src: url("/fonts/marker-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --room: #0e1030;
  --room-lit: #1d2160;
  --glow: #8e9bff;
  --paper: #fffbe0;
  --sun: #ffd91a;
  --sky: #86d4ff;
  --lawn: #3fbf3a;          /* the one accent: selection, emphasis, the thing to press */
  --dirt: #4a2f18;
  --ink: #14121f;
  --white: #fff;

  --pixel: "Pixel", ui-monospace, Menlo, monospace;
  --marker: "Marker", "Comic Sans MS", cursive;

  --gut: clamp(1.25rem, 5vw, 4rem);
  --s1: 0.5rem; --s2: 1rem; --s3: 1.5rem; --s4: 2.5rem; --s5: 4rem; --s6: clamp(4rem, 12vw, 8rem);

  --ease-out: cubic-bezier(.22, 1, .36, 1);     /* reveals */
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);  /* pops */
}

* { box-sizing: border-box; }
/* a class that sets display would otherwise show an element the page has marked hidden */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--dirt); color: var(--ink); font: 400 1.125rem/1.45 var(--pixel); overflow-x: hidden; -webkit-font-smoothing: antialiased; font-variant-ligatures: none; }
::selection { background: var(--lawn); color: var(--ink); }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--white); outline-offset: 3px; box-shadow: 0 0 0 9px var(--ink); }

/* ------------------------------------------------------------------------------------------------ indoors */

.room {
  position: relative; color: var(--white); min-height: 100svh; display: flex; flex-direction: column; overflow-x: clip;
  padding: var(--s5) var(--gut) 0;
  background: url("/img/grain.png"), radial-gradient(60rem 38rem at 72% 34%, var(--room-lit), transparent 70%), var(--room);
}
.room-in { width: min(100%, 72rem); margin: auto; display: grid; gap: var(--s4); align-items: center; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 56rem) { .room-in { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: var(--s5); } }

.ticker { color: var(--lawn); font-weight: 700; font-size: 1.25rem; margin-bottom: var(--s1); }
h1 { font: 700 clamp(2.9rem, 12.5vw, 5.5rem)/0.9 var(--pixel); letter-spacing: -0.01em; text-shadow: 0.06em 0.06em 0 var(--ink); }
@media (min-width: 56rem) { h1 { font-size: clamp(3rem, 6.1vw, 5.6rem); } }
.line { margin-top: var(--s3); font-size: clamp(1.125rem, 2.2vw, 1.5rem); max-width: 24rem; color: #d5d9ff; }

/* the screen everyone is shouting from */
.screen { position: relative; background: #f4f5ff; color: var(--ink); border: 4px solid var(--ink); box-shadow: 0 0 0 4px var(--glow), 0 0 5rem 0.5rem rgba(142, 155, 255, 0.35); max-width: 30rem; width: 100%; justify-self: center; }
.bar { display: flex; justify-content: space-between; background: var(--ink); color: var(--white); font-weight: 700; padding: 0.35rem 0.75rem; }
.count { color: var(--lawn); }
.replies { padding: 0.75rem; display: grid; gap: 0.6rem; }
.reply, .quote { display: grid; grid-template-columns: auto 1fr; column-gap: 0.65rem; align-items: center; }
.reply { background: var(--white); border: 3px solid var(--ink); padding: 0.5rem 0.65rem; }
.face { grid-row: span 2; width: 2.25rem; height: 2.25rem; border: 3px solid var(--ink); background: var(--glow); }
.f2 { background: #ff8db4; } .f3 { background: #ffb347; } .f4 { background: #b9f08a; } .f5 { background: #c8c8d4; }
.who { font-size: 0.85rem; color: #5a5d7a; line-height: 1.1; }
.said { font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.cursor { position: absolute; right: clamp(-1.5rem, -2vw, -0.25rem); bottom: -2.25rem; width: clamp(4.5rem, 14vw, 6.5rem); rotate: -14deg; }

/* the way out: a door of daylight at the bottom of the room */
.door { margin-top: var(--s5); align-self: center; display: grid; justify-items: center; gap: var(--s2); text-decoration: none; }
.fine { font-weight: 700; font-size: 1.5rem; }
.fine::after { content: ""; display: inline-block; width: 0.6em; height: 1em; margin-left: 0.2em; vertical-align: -0.15em; background: var(--lawn); }
.doorway { display: grid; place-content: center; justify-items: center; gap: var(--s1); width: clamp(8rem, 30vw, 11rem); height: clamp(9rem, 32vw, 12rem); background: var(--paper); color: var(--ink); border: 4px solid var(--ink); border-bottom: 0; font-weight: 700; box-shadow: 0 0 4rem 1rem rgba(255, 251, 224, 0.28); }
.arrow { font-size: 2rem; line-height: 1; }

/* ---------------------------------------------------------------------------------- stepping out: too bright */

.glare { min-height: 80svh; padding: var(--s6) var(--gut); display: grid; place-content: center; justify-items: center; gap: var(--s3); text-align: center;
  background: url("/img/grain.png"), linear-gradient(var(--paper) 0%, #fff6b8 30%, #eef8ff 62%, var(--sky) 100%); }
.sun { position: relative; width: clamp(11rem, 40vw, 17rem); aspect-ratio: 1; }
.sun img { position: absolute; inset: 0; width: 100%; height: 100%; }
.aside { font: 400 clamp(1.75rem, 6vw, 3.25rem)/1.1 var(--marker); rotate: -2deg; }

/* ------------------------------------------------------------------------------------------------ the sky */

.sky { padding: var(--s5) var(--gut) calc(var(--s6) + 3rem); background: url("/img/grain.png"), var(--sky); }
.sky-in { width: min(100%, 46rem); margin: 0 auto; }
h2 { font: 400 clamp(2.25rem, 8vw, 4.5rem)/1 var(--marker); }
.steps { counter-reset: step; margin-top: var(--s4); display: grid; gap: var(--s3); }
.steps li { counter-increment: step; display: grid; grid-template-columns: auto 1fr; gap: var(--s2); align-items: baseline; font: 400 clamp(1.4rem, 4.6vw, 2.25rem)/1.15 var(--marker); }
.steps li::before { content: counter(step); display: grid; place-content: center; width: 1.6em; height: 1.6em; font: 700 0.8em/1 var(--pixel); background: var(--white); border: 4px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); }
.rules { margin-top: var(--s4); display: inline-block; font-weight: 700; background: var(--ink); color: var(--white); padding: 0.5rem 0.9rem; rotate: -1deg; }

/* ------------------------------------------------------------------------------------------------ the lawn */

.lawn { position: relative; padding: var(--s4) var(--gut) 0; background: url("/img/grain.png"), var(--lawn); }
/* the blades stand up into the sky above */
.lawn::before { content: ""; position: absolute; left: 0; right: 0; top: -58px; height: 90px; background: url("/img/blades.svg") repeat-x left top / 480px 90px; pointer-events: none; }
.lawn-in { position: relative; width: min(100%, 72rem); margin: 0 auto; display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); align-items: end; }
@media (min-width: 56rem) { .lawn-in { grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr); } }
.comeback { padding-bottom: var(--s3); display: grid; gap: var(--s3); justify-items: start; }
.quote { background: var(--white); border: 3px solid var(--ink); padding: 0.5rem 0.9rem 0.5rem 0.65rem; rotate: -2deg; }
.did { font-size: clamp(3.25rem, 13vw, 7.5rem); line-height: 0.92; }
.soon { font-weight: 700; background: var(--ink); color: var(--white); padding: 0.5rem 0.9rem; }

.card { width: 100%; max-width: 34rem; background: var(--white); border: 4px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); padding: 1.25rem; }
h3 { font: 700 1.25rem/1.2 var(--pixel); display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.75rem; }
.chip { border: 3px solid var(--ink); font-size: 0.8rem; padding: 0.05rem 0.4rem; }
/* an address is one long unbroken word: let it wrap anywhere, or it pushes a phone screen sideways */
.ca { margin-bottom: 1rem; overflow-wrap: anywhere; line-height: 1.3; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
button, .button { font: 700 1.125rem/1 var(--pixel); color: var(--ink); background: var(--lawn); border: 4px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); padding: 0.7rem 1.1rem; cursor: pointer; text-decoration: none; display: inline-block; transition: transform 0.12s var(--ease-out), box-shadow 0.12s var(--ease-out); }
.button.quiet { background: var(--white); }
button:active, .button:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.small { font-size: 0.9rem; margin-top: 0.9rem; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 1rem; }
.figures dt { font-size: 0.9rem; color: #4d4f66; }
.figures dd { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* the proof: the cursor, outside, on the grass, with the bag */
.proof { position: relative; justify-self: center; width: min(100%, 26rem); aspect-ratio: 13 / 10; }
.proof img { position: absolute; }
.touch { width: 52%; left: 30%; bottom: 3%; rotate: 8deg; transform-origin: 50% 100%; }
.bag { width: 40%; left: 0; bottom: 4%; rotate: -8deg; }
.tuft { width: 46%; bottom: -1%; }
.t1 { left: 18%; } .t2 { left: 52%; width: 40%; scale: -1 1; }

/* ------------------------------------------------------------------------------------------------ the dirt */

.dirt { background: url("/img/grain.png"), var(--dirt); color: #f1dfc8; padding: var(--s4) var(--gut) var(--s5); font-size: 0.9rem; display: grid; gap: var(--s2); justify-items: start; }
.dirt p { max-width: 44rem; }
.x { font-weight: 700; font-size: 1.125rem; }

/* the hidden field the Copy button falls back to */
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* the 404 page: still indoors */
.lost { min-height: 100svh; padding: var(--s5) var(--gut); justify-content: center; align-items: flex-start; gap: var(--s3); }
.lost .line { margin: 0; }
.lost .button { margin-top: var(--s2); }

/* ------------------------------------------------------------------------------------------------ motion */
/* Only transform and opacity move. Everything rests visible: the hidden starting states apply only when scripts run
   and the visitor hasn't asked for less motion. */

@media (prefers-reduced-motion: no-preference) {
  .js .reply { opacity: 0; transform: translateY(0.8rem) scale(0.92); }
  .js .reply.in { opacity: 1; transform: none; transition: opacity 0.2s linear, transform 0.45s var(--ease-pop); }
  .js .pop { opacity: 0; transform: scale(0.86); will-change: transform, opacity; }
  .js .pop.in { opacity: 1; transform: none; transition: opacity 0.18s linear, transform 0.5s var(--ease-pop); }

  /* idle loops run only while their scene is on screen (.live is set by the script) */
  .rays { animation: turn 48s linear infinite paused; }
  .live .rays { animation-play-state: running; }
  .touch { animation: pat 1.5s var(--ease-out) infinite paused; }
  .live .touch { animation-play-state: running; }
  .fine::after { animation: blink 1.1s steps(1) 12; }
}
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes pat { 0%, 55%, 100% { transform: none; } 22% { transform: translateY(-7%) rotate(-3deg); } 34% { transform: translateY(1.5%); } }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
