/* =====================================================================
   CodeGrove landing pages (/codegrove/<slug>). Loaded after guide.css, whose
   reading layout (.gd-*) they use. This adds only what guide pages lack: the
   hero buttons and screenshot, code samples with an "Open in CodeGrove"
   button, the example cards, numbered steps and the cross-link cards.
   ===================================================================== */

.cgp-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 22px 0 0; }
.cgp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border-radius: 12px; border: 1.5px solid var(--nav);
  background: var(--nav); color: #fff; font: 700 15px/1 var(--font-body); text-decoration: none; white-space: nowrap;
}
.cgp-btn--ghost { background: #fff; color: var(--nav); border-color: var(--line); }
@media (hover: hover) {
  .cgp-btn:hover { text-decoration: none; filter: brightness(1.12); }
  .cgp-btn--ghost:hover { border-color: var(--nav); filter: none; }
}
.cgp-btn:focus-visible, .cgp-open:focus-visible, .cgp-more a:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.cgp-shot { max-width: 1040px; margin: 34px auto 0; padding: 0 24px; }
.cgp-shot img {
  display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid #1D2C46;
  box-shadow: 0 24px 60px rgba(12, 21, 56, .22);
}
.cgp-shot figcaption { font: var(--text-body-sm); color: var(--tx); text-align: center; margin-top: 12px; }

/* A program: dark like the editor it opens in, with its button underneath. */
.cgp-code { margin: 0 0 18px; max-width: var(--gd-measure); }
.cgp-code pre {
  margin: 0; padding: 16px 18px; overflow-x: auto; border-radius: 12px; background: #0F1A2C; color: #DCE6F4;
  font: 14px/1.6 var(--font-mono); tab-size: 4;
}
.cgp-code code { font: inherit; color: inherit; background: none; padding: 0; }
.cgp-open {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 16px; border-radius: 10px;
  background: #1F6FE5; color: #fff; font: 700 14px/1 var(--font-body); text-decoration: none;
}
@media (hover: hover) { .cgp-open:hover { text-decoration: none; background: #1A5FC4; } }
.gd-body p code, .gd-body li code, .gd-body td code {
  font: 0.92em var(--font-mono); background: #EEF2F8; color: var(--ink); padding: 1px 5px; border-radius: 5px;
}

/* Example cards: the drawing, then the program that makes it. */
.cgp-examples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin: 6px 0 18px; }
.cgp-ex { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; min-width: 0; }
.cgp-ex img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); }
.cgp-ex h3 { font-family: var(--font-display); font-weight: 800; font-size: 19px; color: var(--ink); margin: 14px 0 8px; }
.cgp-ex .cgp-code { margin-bottom: 10px; }
.cgp-ex .cgp-code pre { font-size: 13px; }
.cgp-ex p { font: var(--text-body-sm); }

/* Numbered steps. */
.gd-body .cgp-steps { list-style: none; counter-reset: cgp; padding: 0; margin: 0 0 18px; max-width: var(--gd-measure); }
.cgp-steps li { counter-increment: cgp; position: relative; padding: 0 0 0 46px; margin: 0 0 16px; }
.cgp-steps li::before {
  content: counter(cgp); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--nav); color: #fff; font: 800 15px/32px var(--font-body); text-align: center;
}
.cgp-steps li strong { display: block; color: var(--ink); margin-bottom: 2px; }

/* Yes/no table: the answer column reads first. Its colors need the td in the selector to beat the column rule. */
.cgp-facts td:nth-child(2) { white-space: nowrap; font-weight: 700; color: var(--ink); }
.cgp-facts td.cgp-yes { color: #0E7350; }
.cgp-facts td.cgp-no { color: #9A3412; }

/* The other CodeGrove pages. */
.cgp-more { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 6px 0 0; }
.cgp-more a {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
  text-decoration: none; min-width: 0;
}
.cgp-more b { display: block; font: 800 16px/1.3 var(--font-display); color: var(--ink); margin-bottom: 6px; }
.cgp-more span { display: block; font: var(--text-body-sm); color: var(--tx); }
@media (hover: hover) { .cgp-more a:hover { border-color: var(--nav); text-decoration: none; } }

@media (max-width: 860px) {
  .cgp-more { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
  .cgp-actions .cgp-btn { width: 100%; }
  .cgp-shot { padding: 0 16px; margin-top: 26px; }
  .cgp-examples { grid-template-columns: minmax(0, 1fr); }
  /* The yes/no table stacks: the question, then the answer and its details, one row per block. */
  .cgp-facts thead { display: none; }
  .cgp-facts tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .cgp-facts tr:last-child { border-bottom: none; }
  .cgp-facts td { display: inline; padding: 0; border: 0; white-space: normal; }
  .gd-table.cgp-facts td:first-child { display: block; white-space: normal; margin-bottom: 4px; }
  .cgp-facts td:nth-child(2) { margin-right: 6px; }
}

/* Long addresses (madlyproductivepathways.com/codegrove/grade) wrap on a phone instead of running off the edge. */
.gd-body p, .gd-body li { overflow-wrap: break-word; }
