/* Jack Pong's Self-Care Creative Project
   Felt-green everywhere, balls free-floating in the green, keywords marked
   in ball colours. Bold modern system sans. Whitespace still carries the
   structure: tight inside a cluster, a long exhale between. */

:root {
  --felt: #0c6b43;
  --cue: #faf8f2;
  --caption: #cfe3d8;

  /* billiard ball colours (solids 1 through 8) */
  --ball-yellow: #f4b21a;
  --ball-blue:   #1f5fae;
  --ball-red:    #d62631;
  --ball-purple: #6a2c91;
  --ball-orange: #e8721c;
  --ball-green:  #16a35e;
  --ball-maroon: #7c2233;
  --ball-black:  #141414;
  --ink: #1c1b19;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --measure: 34rem;
  --pad-x: 1.35rem;
  --gap-caption: 0.7rem;
  --gap-figure: 2.25rem;
  --gap-cluster: 5.5rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--felt);
  color: #fff;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Faint felt grain over the green, behind everything, never touches contrast. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img,
video {
  display: block;
  width: 100%;
  height: auto;
}

video {
  background: #111;
  object-fit: cover;
}

.fig-video video { aspect-ratio: 9 / 16; }

/* ---------- A glossy billiard ball, reused throughout ---------- */
.ball {
  display: inline-block;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  flex: none;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}
.ball::after {
  content: "";
  position: absolute;
  top: 15%;
  left: 19%;
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
}
.b-yellow { background: var(--ball-yellow); }
.b-blue   { background: var(--ball-blue); }
.b-red    { background: var(--ball-red); }
.b-purple { background: var(--ball-purple); }
.b-orange { background: var(--ball-orange); }
.b-green  { background: var(--ball-green); }
.b-maroon { background: var(--ball-maroon); }
.b-black  { background: var(--ball-black); }

/* ---------- Free-floating balls ----------
   They ride a layer behind text and photos, only ever in the gaps between
   clusters or in the side gutters, so they can never sit under a word. */
.floater {
  position: absolute;
  width: var(--s, 3rem);
  height: var(--s, 3rem);
  z-index: -1;
  pointer-events: none;
  opacity: 0.95;
}

@media (prefers-reduced-motion: no-preference) {
  .floater {
    animation: drift var(--d, 12s) ease-in-out var(--delay, 0s) infinite;
  }
  @keyframes drift {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(var(--dx, 5px), var(--dy, -12px)); }
  }
}

/* ---------- Keyword highlights in ball colours ---------- */
.hl {
  padding: 0.02em 0.34em;
  border-radius: 0.18em;
  font-weight: 600;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hl-yellow { background: var(--ball-yellow); color: var(--ink); }
.hl-orange { background: var(--ball-orange); color: var(--ink); }
.hl-green  { background: var(--ball-green);  color: var(--ink); }
.hl-red    { background: var(--ball-red);    color: #fff; }
.hl-blue   { background: var(--ball-blue);   color: #fff; }
.hl-purple { background: var(--ball-purple); color: #fff; }
.hl-maroon { background: var(--ball-maroon); color: #fff; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  color: var(--cue);
  padding: clamp(3rem, 9vw, 5.5rem) var(--pad-x) clamp(2.6rem, 7vw, 4rem);
}
.hero-inner {
  position: relative;
  max-width: 46rem;
  margin-inline: auto;
}
.rack {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1.9rem;
  padding: 0;
}
.hero-title {
  margin: 0;
  color: #fff;
  font-weight: 800;
  font-size: clamp(2.5rem, 9vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}
.hero-sub {
  margin: 1.15rem 0 0;
  color: var(--cue);
  font-weight: 600;
  font-size: clamp(1rem, 3.4vw, 1.2rem);
  letter-spacing: 0.004em;
}

/* ---------- Page ---------- */
.page {
  position: relative;
  max-width: 46rem;
  margin-inline: auto;
  padding: 0 var(--pad-x) 4.5rem;
}

.lede {
  max-width: var(--measure);
  margin: clamp(2.6rem, 7vw, 3.5rem) 0 0;
  font-size: clamp(1.2rem, 4.6vw, 1.45rem);
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: -0.01em;
}

/* ---------- Clusters ---------- */
.cluster {
  position: relative;
  margin-top: var(--gap-cluster);
}

h2 {
  margin: 0 0 1.6rem;
  color: #fff;
  font-weight: 800;
  font-size: clamp(1.55rem, 6vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* each cluster opens with its own ball */
h2::before {
  content: "";
  display: block;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  margin-bottom: 1.1rem;
  box-shadow:
    inset 0.13em 0.13em 0.16em rgba(255, 255, 255, 0.5),
    inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.c-pool    h2::before { background: var(--ball-red); }
.c-arcade  h2::before { background: var(--ball-blue); }
.c-friends h2::before { background: var(--ball-orange); }

/* ---------- Figures: photo on the green, caption beneath. No boxes, no lift. ---------- */
figure { margin: 0 0 var(--gap-figure); }

figcaption {
  margin-top: var(--gap-caption);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--caption);
}

.pair { margin: 0; }

/* ---------- Outro, closed by the 8 ball ---------- */
.outro {
  position: relative;
  margin-top: var(--gap-cluster);
  font-size: 1.1rem;
}
.outro p {
  max-width: var(--measure);
  margin: 0;
}
.eight {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  margin-bottom: 1.2rem;
  background: var(--ball-black);
  box-shadow:
    inset 0.13em 0.13em 0.18em rgba(255, 255, 255, 0.22),
    inset 0 0 0 1px rgba(0, 0, 0, 0.5);
}
.eight::before {
  content: "8";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60%;
  height: 60%;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 0.72rem;
  font-weight: 800;
}

/* ---------- Wider screens ---------- */
/* Portrait shots stay contained and leave air; wide shots run the full
   column; the two trick-shot videos sit together as a pair. */
@media (min-width: 46rem) {
  :root {
    --pad-x: 2rem;
    --gap-cluster: 7rem;
  }

  .fig-tall img { max-width: 25rem; }

  .pair {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
  }
  .pair .fig-video {
    flex: 1 1 0;
    min-width: 0;
    margin-bottom: 0;
  }
}

/* Honour a stated preference for less motion. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
