/* Wang Tiles: page specific layer (loops, map playground, texture strip). */

.opening h1, .metric b { font-variation-settings: 'wght' 700, 'wdth' 100; font-weight: 700; letter-spacing: -0.035em; }

/* ---------- Loops ---------- */
.loops { padding: 0.5rem 0 3rem; }
.loop-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.loop { margin: 0; }
.loop video { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 12px; background: var(--panel); }
.loop figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.7rem 0.15rem 0; font-size: 0.95rem; }
.loop figcaption b { font-weight: 600; color: var(--ink); }
.loop figcaption a { color: var(--muted); text-decoration: none; font-size: 0.875rem; }
.loop figcaption a:hover, .loop figcaption a:focus-visible { color: var(--accent); }

/* ---------- Playground ---------- */
.playground { padding: 3.5rem 0 1rem; border-top: 1px solid var(--line); }
.play-tools { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; margin: 1.75rem 0 1rem; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.25rem; border: 1px solid var(--line); border-radius: 999px; }
.seg-loose { border-color: transparent; padding-left: 0; padding-right: 0; gap: 0.5rem; }
.seg button {
  min-height: 2.5rem; padding: 0 1rem; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); font: 500 0.9rem / 1 var(--sans, 'Instrument Sans', sans-serif); cursor: pointer;
}
.seg-loose button { border: 1px solid var(--line); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--bg); }
.seg-loose button[aria-pressed='true'] { border-color: var(--ink); }
.seg button:focus-visible, #map:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stage-map { position: relative; }
#map {
  display: block; width: 100%; aspect-ratio: 2 / 1; border-radius: 12px; background: var(--panel);
  cursor: grab; touch-action: pan-y; image-rendering: pixelated;
}
#map.dragging { cursor: grabbing; }
.map-hint {
  position: absolute; right: 0.9rem; bottom: 0.8rem; margin: 0; padding: 0.4rem 0.7rem; border-radius: 999px;
  background: var(--glass); color: var(--ink); font-size: 0.8rem; pointer-events: none; transition: opacity 0.4s;
}
.stage-map.touched .map-hint { opacity: 0; }

.strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 0; }
.strip figure { margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 0.8rem; }
.strip img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; image-rendering: pixelated; background: var(--panel); border-radius: 6px; }
.strip figcaption { font-size: 0.875rem; color: var(--muted); display: flex; gap: 0.6rem; align-items: baseline; }
.strip figcaption span { color: var(--accent); font-weight: 600; }

@media (max-width: 67.5rem) {
  .loop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 51.25rem) {
  /* below the house breakpoint the header is two rows and covers more of the page: keep text under it from reading through */
  .bar { background: color-mix(in srgb, var(--bg) 94%, transparent); }
}
@media (max-width: 47.5rem) {
  #map { aspect-ratio: 4 / 5; }
  .strip { grid-template-columns: minmax(0, 1fr); }
  .strip figure { grid-template-columns: 5.5rem minmax(0, 1fr); align-items: center; }
}
@media (max-width: 35rem) {
  .loop-grid { grid-template-columns: minmax(0, 1fr); }
  /* each group takes a full row and its buttons share it, so no group wraps into an oval */
  .play-tools { gap: 0.6rem; }
  .seg { display: flex; flex-wrap: nowrap; width: 100%; }
  .seg button { flex: 1 1 0; min-width: 0; padding: 0 0.4rem; font-size: 0.85rem; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .map-hint { transition: none; }
}
