/* Interactive playground article. Builds on the variables in style.css. */

h4 { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; font-size: 1.05rem; line-height: 1.3; font-weight: 600; margin: 0 0 0.4em; }

.pg-lede { max-width: var(--measure); }

/* How-to box and filter bar */
.howto {
  background: var(--accent-soft); border-radius: var(--radius);
  padding: 1.2rem 1.4rem; max-width: var(--measure); margin: 1.6rem 0 1rem;
}
.howto h3 { margin-top: 0; font-size: 1.1rem; }
.howto ul { margin: 0; padding-left: 1.2rem; }
.howto li { margin-bottom: 0.3em; }
.dot-key {
  display: inline-block; vertical-align: -0.2em; width: 1rem; height: 1rem; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.35);
}
.glossary { max-width: var(--measure); margin: 0 0 1rem; }
.glossary summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.glossary dl { margin: 0.8rem 0 0; }
.glossary dt { font-weight: 600; margin-top: 0.7rem; }
.glossary dd { margin: 0; color: var(--muted); }

.filter-bar {
  position: sticky; top: var(--hdr, 0px); z-index: 4;
  background: var(--bg); border-bottom: 1px solid var(--border);
  padding: 0.45rem 0; margin: 1rem 0 0;
}
.filter-bar .label { font-size: 0.8rem; color: var(--muted); margin: 0 0 0.3rem; max-width: none; line-height: 1.3; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 0.1rem 0.75rem; font: inherit; font-size: 0.85rem; line-height: 1.5; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .chip[aria-pressed="true"] { color: #10201c; } }
.filter-status { font-size: 0.82rem; color: var(--muted); margin: 0.3rem 0 0; max-width: none; line-height: 1.3; }
.filter-status:empty { display: none; }
html:not(.js) .filter-bar { display: none; }
@media (max-width: 40rem) {
  /* One scrolling row keeps the sticky bar slim on phones. */
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.25rem; -webkit-overflow-scrolling: touch; }
  .chip { flex: none; }
}

/* Figures */
.hs-fig { position: relative; margin: 1.6rem 0 2.6rem; }
.hs-stage { position: relative; overflow: hidden; border-radius: var(--radius); line-height: 0; background: var(--warm); max-width: 56rem; }
.hs-fig.portrait .hs-stage { max-width: 26rem; }
.hs-stage img { display: block; width: 100%; height: auto; }
.hs-fig figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 0.6rem; max-width: var(--measure); }
.hs-fig.portrait figcaption { max-width: 26rem; }

.hs {
  position: absolute; padding: 0; margin: 0; border: 0; background: transparent;
  cursor: pointer; border-radius: 14px; color: inherit;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
html:not(.js) .hs { display: none; }
.hs-dot {
  position: absolute; left: 50%; top: 50%; width: 1.1rem; height: 1.1rem; margin: -0.55rem 0 0 -0.55rem;
  border-radius: 50%; background: var(--accent); border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,0.5);
}
.hs-dot::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid #fff;
  animation: hs-pulse 2.2s ease-out infinite;
}
@keyframes hs-pulse { from { transform: scale(1); opacity: 0.9; } to { transform: scale(2.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hs-dot::after { animation: none; opacity: 0; } }

/* Spotlight: darken the rest of the photo while a spot is active. The stage clips the shadow. */
.hs:hover, .hs.is-open, .hs:focus-visible {
  z-index: 3; outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(0,0,0,0.55), 0 0 0 100vmax rgba(0,0,0,0.38);
}
.hs.is-dim .hs-dot { opacity: 0.3; filter: grayscale(1); }
.hs.is-dim .hs-dot::after { animation: none; opacity: 0; }

/* Popover */
.hs-pop {
  position: absolute; z-index: 6; width: min(22rem, calc(100% - 1rem));
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.9rem 1.05rem 1rem;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25); font-size: 0.9rem; line-height: 1.5;
}
.hs-pop[hidden] { display: none; }
.hs-pop p, .hs-note p { margin: 0 0 0.6rem; max-width: none; }
.hs-pop .x {
  display: none; position: absolute; top: 0.3rem; right: 0.5rem; border: 0; background: transparent;
  color: var(--muted); font-size: 1.6rem; line-height: 1; padding: 0.2rem 0.5rem; cursor: pointer;
}
@media (max-width: 40rem) {
  .hs-pop {
    position: fixed; left: 0.5rem !important; right: 0.5rem; top: auto !important; bottom: 0.5rem;
    width: auto; max-height: 62vh; overflow: auto; z-index: 20; padding-right: 2.4rem;
  }
  .hs-pop .x { display: block; }
}

.tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tags span {
  font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: 0.05rem 0.55rem; border-radius: 999px;
}
.try { background: var(--accent-soft); border-radius: 10px; padding: 0.5rem 0.7rem; font-size: 0.9rem; margin-bottom: 0 !important; }

/* Notes as a plain list under each photo */
.hs-text { margin-top: 0.8rem; max-width: 56rem; }
.hs-text summary { cursor: pointer; font-size: 0.9rem; color: var(--accent); }
.hs-notes { margin-top: 0.8rem; display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.hs-note { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; font-size: 0.95rem; }

/* Framework and open-ended sections */
.pillars { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.plays { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.pillars .card h3, .plays .card h3 { font-size: 1.1rem; }
.pillars ul, .plays ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.pillars li, .plays li { margin-bottom: 0.3em; max-width: none; }
.plays .card p { max-width: none; }
.plays .more { font-size: 0.88rem; color: var(--muted); margin-top: 0.8rem; padding-top: 0.7rem; border-top: 1px solid var(--border); }
.download { background: var(--accent-soft); border-radius: var(--radius); padding: 1.3rem 1.5rem; max-width: var(--measure); margin: 2rem 0; }
.download h3 { margin-top: 0; }

/* Video clip slot at the top of a popover. Until a real clip exists, a slow pan over the photo stands in for it. */
.clip { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; margin: 0 0 0.7rem; background: #222; }
.clip-pan {
  position: absolute; inset: 0; background: url(img/tiong-bahru/swings.jpg) no-repeat;
  background-position: 25% 55%; background-size: 150% auto; animation: clip-pan 7s ease-in-out infinite alternate;
}
@keyframes clip-pan { to { background-position: 75% 48%; background-size: 190% auto; } }
@media (prefers-reduced-motion: reduce) { .clip-pan { animation: none; } }
.clip-play {
  position: absolute; left: 50%; top: 50%; width: 2.6rem; height: 2.6rem; margin: -1.3rem 0 0 -1.3rem;
  border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff; font-size: 1rem; line-height: 2.6rem; text-align: center; padding-left: 0.15rem;
}
.clip-badge {
  position: absolute; left: 0.5rem; top: 0.5rem; background: rgba(0,0,0,0.6); color: #fff;
  font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.1rem 0.5rem; border-radius: 999px;
}
video.hs-clip { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; margin: 0 0 0.7rem; background: #222; }
.test-box { background: var(--warm); border-radius: var(--radius); padding: 1.2rem 1.4rem; max-width: var(--measure); margin: 1.4rem 0; }
.test-box h3 { margin-top: 0; font-size: 1.1rem; }
.test-box ol { margin: 0; padding-left: 1.2rem; }
.split { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); margin: 1.2rem 0; max-width: 56rem; }
.split .card h3 { font-size: 1.1rem; }
.split ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.split li { margin-bottom: 0.4em; max-width: none; }
.reading { list-style: none; padding: 0 !important; }
.reading li { border-top: 1px solid var(--border); padding: 0.7rem 0; margin: 0; }
.reading .why { display: block; color: var(--muted); font-size: 0.92rem; }

/* Article labels: small tracked sans, to match the site's headings and body type. */
.pg-article .article-head .meta {
  text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem; font-weight: 600; color: var(--muted);
}
.pg-article .pg-lede { font-size: inherit; line-height: inherit; color: var(--text); }
.pg-article h2 { margin-top: 2.2em; }
.pg-article .filter-bar .label, .pg-article .hs-fig figcaption { letter-spacing: 0.04em; }
.pg-article .pull { font-style: normal; }

/* Fade and rise: sections ease in as they scroll into view. Only applied when JavaScript is on. */
.js .reveal { opacity: 0; transform: translateY(14px); }
.js .reveal.is-in { opacity: 1; transform: none; transition: opacity 0.6s ease, transform 0.6s ease; }
@media (prefers-reduced-motion: reduce) { .js .reveal, .js .reveal.is-in { opacity: 1; transform: none; transition: none; } }

/* A plain source screenshot with a credit line */
.src-fig { margin: 1.4rem 0 1.8rem; max-width: 46rem; }
.src-fig img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.src-fig figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 0.6rem; max-width: var(--measure); }

/* More room between the framework cards and the list that follows */
.pg-article .pillars { margin-bottom: 1rem; }
.pg-article .pillars + h3 { margin-top: 3.4rem; }
.src-fig a { display: block; }

/* Phones: bigger tap targets and a calmer popover */
@media (max-width: 40rem) {
  .pg-article .filter-bar .label { font-size: 0.85rem; }
  .chip { font-size: 0.95rem; padding: 0.4rem 1rem; min-height: 40px; }
  .hs::before { content: ""; position: absolute; inset: -10px; }
  .hs-pop { max-height: 55vh; font-size: 0.95rem; }
  .hs-pop .x { top: 0; right: 0; min-width: 44px; min-height: 44px; font-size: 1.9rem; padding: 0.3rem 0.8rem; }
  .pg-article .pillars + h3 { margin-top: 2.6rem; }
}

/* The filter bar stops sticking once the photo tour has ended. */
.filter-bar.is-done { position: static; }

/* Phones: more room at the end of the photo note panel, and shorter photos */
@media (max-width: 40rem) {
  .hs-pop { bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)); padding-bottom: 1.4rem; scroll-padding-bottom: 1.5rem; }
  .hs-pop::after { content: ""; display: block; height: 1.2rem; }
  .hs-fig.portrait .hs-stage { width: 74%; margin-left: auto; margin-right: auto; }
  .hs-fig.portrait figcaption { text-align: center; max-width: none; }
}

/* The opening paragraph reads like the ones below it, with the same gap between them. */
.pg-article .article-head { padding-bottom: 0; }
.pg-article .article-head .pg-lede { margin-bottom: 0; }
.pg-article .article-body { padding-top: 1.2rem; }

/* Section dividers: a fine line with a small rose diamond, between the main parts of the article. */
.pg-article .divider { position: relative; width: 100%; max-width: var(--measure); height: 1px; margin: 3.2rem 0 2.6rem; background: linear-gradient(90deg, var(--border), var(--border)); }
.pg-article .divider span {
  position: absolute; left: 50%; top: 50%; width: 0.6rem; height: 0.6rem;
  background: var(--rose-deep, #ddb9aa); border: 4px solid var(--bg); box-sizing: content-box;
  transform: translate(-50%, -50%) rotate(45deg);
}
.pg-article .divider + h2, .pg-article .divider + p { margin-top: 0; }
.pg-article .divider + .howto { margin-top: 0; }
