/* Styles for the pyskins playground. Loaded after site.css, so it shares the
   family palette, fonts and buttons. The playground is an immersive dark band. */

:root {
  --py-bg: #14151f;
  --py-bg2: #1b1d2b;
  --py-panel: #1f2233;
  --py-panel2: #262a3e;
  --py-bar: #2a2e44;
  --py-line: rgba(255, 255, 255, 0.10);
  --py-line-soft: rgba(255, 255, 255, 0.06);
  --py-ink: #e9ecf6;
  --py-dim: #9aa0bd;
  --py-code: #d7dcf5;
  --py-console-bg: #0d0f17;
  --py-green: #7ee787;
  --py-accent: #ff7a33;
}

.mono,
#hero-demo,
#demo-input,
#demo-output,
#demo-console {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* ---- Code window chrome (used in hero and playground) ---- */
.code-window {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--py-line);
  border-radius: 14px;
  background: var(--py-panel);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.code-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  background: var(--py-bar);
  border-bottom: 1px solid var(--py-line-soft);
}

.code-bar .dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #4b4f68;
}

.code-bar .dot:nth-child(1) { background: #ff5f57; }
.code-bar .dot:nth-child(2) { background: #febc2e; }
.code-bar .dot:nth-child(3) { background: #28c840; }

.code-title {
  margin-left: 0.5rem;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--py-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Hero ---- */
.pyskins-hero {
  background:
    radial-gradient(1100px 500px at 80% -10%, rgba(255, 122, 51, 0.18), transparent 60%),
    radial-gradient(900px 500px at 0% 120%, rgba(123, 97, 255, 0.18), transparent 55%),
    linear-gradient(160deg, var(--py-bg2), var(--py-bg));
  border-bottom: 1px solid var(--py-line);
  padding: 3.2rem 0 4.2rem;
}

.pyskins-hero .back a { color: var(--py-dim); }
.pyskins-hero .back a:hover { color: #fff; }

.phero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
}

.phero-copy h1 {
  margin: 0 0 1.2rem;
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 700;
  letter-spacing: -2.5px;
  line-height: 1.02;
  color: #fff;
}

.phero-emoji {
  display: inline-block;
  font-size: 0.62em;
  letter-spacing: 0.06em;
  vertical-align: middle;
}

.phero-copy .lead {
  max-width: 32rem;
  font-size: 1.18rem;
  line-height: 1.6;
  color: var(--py-ink);
}

.phero-copy .lead strong { color: #fff; }

.phero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 1.8rem 0 0;
}

.button.is-ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: none;
}

.button.is-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #fff;
  box-shadow: none;
  transform: translate(-1px, -1px);
}

.phero-note {
  margin: 1.6rem 0 0;
  font-size: 0.88rem;
  color: var(--py-dim);
}

.phero-art { min-width: 0; }

.code-window.is-floating {
  animation: py-float-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes py-float-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

#hero-demo {
  margin: 0;
  padding: 1.1rem 1.2rem;
  min-height: 15.5rem;
  background: var(--py-console-bg);
  color: var(--py-code);
  font-size: 1.02rem;
  line-height: 1.6;
  white-space: pre;
  overflow: hidden;
  tab-size: 4;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#hero-demo.swapping {
  opacity: 0;
  transform: translateY(-4px);
}

/* ---- Playground band ---- */
.section.is-dark.play {
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(123, 97, 255, 0.10), transparent 60%),
    var(--py-bg);
  padding-top: 4rem;
}

.play .section-heading p:not(.eyebrow) { color: var(--py-dim); }
.play .section-heading .eyebrow { color: var(--py-accent); }

.container.wide { max-width: 78rem; }

/* Toolbar */
.play-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.4rem;
  margin: 0 0 0.9rem;
}

.play-modes,
.play-themes,
.play-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.play-themes[hidden] { display: none; }

.play-actions { margin-left: auto; }

.play-sub {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--py-dim);
}

.play-mode {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem 1.05rem;
  border: 1px solid var(--py-line);
  background: var(--py-panel2);
  color: var(--py-ink);
  border-radius: 999px;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.play-mode:hover { border-color: rgba(255, 255, 255, 0.4); }

.play-mode.is-active {
  background: linear-gradient(180deg, #ff8a45, var(--py-accent));
  border-color: transparent;
  color: #1b1200;
}

.play-chip {
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.32rem 0.8rem;
  border: 1px solid var(--py-line);
  background: transparent;
  color: var(--py-ink);
  border-radius: 999px;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s;
}

.play-chip:hover { border-color: rgba(255, 255, 255, 0.4); background: var(--py-panel2); }

.play-chip.is-active {
  background: #fff;
  color: #14151f;
  border-color: #fff;
}

.play-run {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0.5rem 1.2rem;
  border: 0;
  border-radius: 999px;
  color: #06220a;
  background: linear-gradient(180deg, #6ee87a, #35c85a);
  box-shadow: 0 6px 18px -6px rgba(53, 200, 90, 0.7);
  line-height: 1;
  transition: transform 0.1s, filter 0.15s;
}

.play-run:hover { filter: brightness(1.06); transform: translateY(-1px); }
.play-run:disabled { opacity: 0.6; cursor: progress; filter: grayscale(0.3); }
.play-run .run-icon { font-size: 0.85em; }

.play-mode:focus-visible,
.play-chip:focus-visible,
.play-run:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

.play-note {
  margin: 0 0 1.25rem;
  min-height: 1.5em;
  max-width: 60rem;
  color: var(--py-dim);
  font-size: 0.95rem;
}

/* Grid: palette | editor+skin | console */
.play-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.play-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.play-stack .code-window { flex: 1; }

/* Palette */
.play-palette {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid var(--py-line);
  border-radius: 14px;
  background: var(--py-panel);
}

.play-palette h3 {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--py-dim);
}

.palette-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 0.4rem;
}

.palette-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.45rem 0.2rem;
  border: 1px solid var(--py-line-soft);
  border-radius: 9px;
  background: var(--py-panel2);
  cursor: pointer;
  font: inherit;
  color: var(--py-ink);
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}

.palette-tile:hover {
  transform: translateY(-2px);
  border-color: var(--py-accent);
  background: #2d3250;
}

.palette-tile:focus-visible { outline: 2px solid var(--sun); outline-offset: 2px; }
.palette-tile[disabled] { cursor: default; opacity: 0.85; }
.palette-tile[disabled]:hover { transform: none; border-color: var(--py-line-soft); background: var(--py-panel2); }

.palette-tile .pt-emoji { font-size: 1.3rem; line-height: 1; }
.palette-tile .pt-word { font-size: 0.68rem; color: var(--py-dim); font-family: ui-monospace, Menlo, monospace; }

.palette-hint {
  margin: 0.8rem 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--py-dim);
}

/* Editors + output */
#demo-input,
#demo-output,
#demo-console {
  margin: 0;
  padding: 1rem 1.1rem;
  border: 0;
  background: var(--py-console-bg);
  color: var(--py-code);
  font-size: 0.98rem;
  line-height: 1.55;
  min-height: 17rem;
  white-space: pre;
  overflow: auto;
  tab-size: 4;
}

#demo-input {
  flex: 1;
  width: 100%;
  resize: vertical;
  outline: none;
}

#demo-input:focus { box-shadow: inset 0 0 0 2px rgba(255, 122, 51, 0.4); }

#demo-output { flex: 1; color: #eef1ff; }

.play-console { min-height: 100%; }

#demo-console {
  flex: 1;
  color: var(--py-green);
  white-space: pre-wrap;
  word-break: break-word;
}

#demo-console .console-idle { color: var(--py-dim); }
#demo-console .console-idle b { color: var(--py-ink); }
#demo-console .console-err { color: #ff8b8b; }
#demo-console .console-sys { color: var(--py-dim); font-style: italic; }

.play-copy {
  margin-left: auto;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.22rem 0.65rem;
  border: 1px solid var(--py-line);
  background: var(--py-panel2);
  color: var(--py-ink);
  border-radius: 7px;
}

.play-copy:hover { border-color: rgba(255, 255, 255, 0.5); }

.play-caveat {
  margin: 1.6rem 0 0;
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--py-accent);
  border-radius: 0 8px 8px 0;
  background: rgba(255, 255, 255, 0.04);
  color: var(--py-dim);
  font-size: 0.92rem;
  line-height: 1.6;
}

.play-caveat code { color: var(--py-ink); }

/* "How it works" code blocks: let long comments scroll instead of clipping */
.page-block pre { overflow-x: auto; }
.page-block pre code { white-space: pre; }

/* ---- Responsive ---- */
@media (max-width: 68rem) {
  .play-grid { grid-template-columns: 1fr; }
  .play-palette { order: -1; }
  .palette-tiles { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }
}

@media (max-width: 48rem) {
  .phero-grid { grid-template-columns: 1fr; gap: 1.6rem; }
  .phero-copy .lead { max-width: none; }
  .play-actions { margin-left: 0; width: 100%; }
}
