/* ==========================================================================
   apps-course.css — dedicated stylesheet for the "How Apps Work" course
   (/apps/ index + 11 lessons, layout: apps-course.njk).

   Ports the learning-about-apps series aesthetic (teal / ink / white cards)
   onto the site's foundations (Inter headings, Open Sans body). All classes
   are .ac- prefixed to avoid colliding with the tg- system; this file loads
   alongside endpoint51.css (header/footer) and chapter-styles-v3.css (code
   blocks) — never alongside testing-guide-light.css.
   ========================================================================== */

:root {
  --ac-ink: #1a2332;
  --ac-muted: #5a6678;
  --ac-accent: #0d6e6e;
  --ac-accent-dark: #0a5757;
  --ac-accent-light: #e6f2f2;
  --ac-amber: #b45309;
  --ac-amber-light: #fef3e2;
  --ac-border: #dde3ea;
  --ac-bg: #f7f9fb;
  --ac-card: #ffffff;
}

/* --- Page shell ---------------------------------------------------------- */

/* chapter-styles-v3.css (loaded for its code-block styles) sets a dark
   body background with !important; counter it here since we deliberately
   don't load testing-guide-light.css. */
body.ac-page {
  background: var(--ac-bg) !important;
  color: var(--ac-ink);
}

.ac-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

/* --- Article typography -------------------------------------------------- */

.ac-article {
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ac-ink);
  /* safety net for long unbreakable tokens (API names, URLs) at large
     user font sizes on narrow viewports */
  overflow-wrap: break-word;
}

.ac-article h1,
.ac-article h2,
.ac-article h3 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  color: var(--ac-ink);
}

.ac-article h1 {
  font-size: 1.9rem;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

.ac-article h2 {
  font-size: 1.35rem;
  margin: 2.75rem 0 1rem;
  padding-top: 0.5rem;
  color: var(--ac-accent);
}

.ac-article h3 {
  font-size: 1.08rem;
  margin: 1.75rem 0 0.6rem;
}

.ac-article p { margin: 0 0 1rem; }
.ac-article ul,
.ac-article ol { margin: 0 0 1rem 1.4rem; padding: 0; }
.ac-article ul { list-style: disc; }
.ac-article ol { list-style: decimal; }
.ac-article li { margin-bottom: 0.45rem; }
.ac-article strong { color: var(--ac-ink); font-weight: 700; }

.ac-article a {
  color: var(--ac-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ac-article a:hover { color: var(--ac-accent-dark); }

.ac-article a:focus-visible,
.ac-nav a:focus-visible,
.ac-lesson-card:focus-visible,
.ac-bridge a:focus-visible {
  outline: 2px solid var(--ac-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Inline code pills — outside code blocks only (chapter-styles-v3.css owns
   everything inside .code-block-wrapper). */
.ac-article :not(pre) > code {
  background: var(--ac-accent-light);
  color: var(--ac-accent);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: 'Cascadia Code', Consolas, Menlo, monospace;
  font-size: 0.88em;
  /* long tokens (URLs, header values) must break rather than overflow on
     narrow viewports at large user font sizes */
  overflow-wrap: anywhere;
}

/* the series source often wraps pills in <strong> for list lead-ins; bold
   monospace reads too heavy in the pill, so pills always render at normal
   weight (Simon, Gate 1 review 2026-08-04) */
.ac-article strong > code {
  font-weight: 400;
}

/* --- Lesson header + meta ------------------------------------------------- */

.ac-header {
  margin-bottom: 2.5rem;
  border-bottom: 3px solid var(--ac-accent);
  padding-bottom: 1.5rem;
}

.ac-subtitle {
  color: var(--ac-muted);
  font-size: 1.05rem;
  margin: 0;
}

.ac-meta {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ac-muted);
  margin: 0 0 0.75rem;
}

.ac-meta .ac-meta-num {
  color: var(--ac-accent);
  font-weight: 600;
}

.ac-meta .sep { color: var(--ac-border); margin: 0 0.35rem; }

/* --- Callouts ------------------------------------------------------------- */

.ac-callout {
  background: var(--ac-accent-light);
  border-left: 4px solid var(--ac-accent);
  padding: 1rem 1.25rem;
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
}

.ac-callout.warn {
  background: var(--ac-amber-light);
  border-left-color: var(--ac-amber);
}

.ac-callout p:last-child { margin-bottom: 0; }

/* --- Step cards ----------------------------------------------------------- */

.ac-step {
  background: var(--ac-card);
  border: 1px solid var(--ac-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}

.ac-step h3 { margin-top: 0; }

.ac-who {
  display: inline-block;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ac-accent);
  background: var(--ac-accent-light);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}

/* --- ASCII flow diagrams --------------------------------------------------- */

.ac-flow {
  background: var(--ac-card);
  border: 1px solid var(--ac-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0 1.75rem;
  font-family: 'Cascadia Code', Consolas, Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.85;
  overflow-x: auto;
  white-space: pre;
  color: var(--ac-ink);
}

/* --- Tables ---------------------------------------------------------------- */

.ac-table-scroll {
  overflow-x: auto;
  margin: 1.25rem 0 1.75rem;
}

.ac-table-scroll table {
  width: 100%;
  border-collapse: collapse;
  background: var(--ac-card);
  border: 1px solid var(--ac-border);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.95rem;
  margin: 0;
}

.ac-table-scroll th,
.ac-table-scroll td {
  padding: 0.65rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--ac-border);
  vertical-align: top;
}

.ac-table-scroll th {
  background: var(--ac-accent);
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
}

.ac-table-scroll tr:last-child td { border-bottom: none; }
.ac-table-scroll tbody tr:nth-child(even) { background: #fafbfd; }

/* --- Lesson furniture: outcomes / check / sources -------------------------- */

.ac-outcomes {
  background: var(--ac-card);
  border: 1px solid var(--ac-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 0 0 2rem;
}

.ac-outcomes-title,
.ac-check-title,
.ac-sources-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ac-accent);
  margin: 0 0 0.6rem;
}

.ac-outcomes ul,
.ac-check ul,
.ac-sources ul {
  margin-bottom: 0;
}

.ac-check {
  background: var(--ac-accent-light);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 2.5rem 0 0;
}

.ac-sources {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ac-border);
  font-size: 0.95rem;
}

.ac-sources li { margin-bottom: 0.35rem; }

.ac-reviewed {
  color: var(--ac-muted);
  font-size: 0.88rem;
  margin: 1.5rem 0 0;
  font-family: 'Inter', system-ui, sans-serif;
}

/* --- Prev / home / next navigation ----------------------------------------- */

.ac-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ac-border);
  font-family: 'Inter', system-ui, sans-serif;
}

.ac-nav a {
  flex: 1 1 12rem;
  min-width: 0;
  display: block;
  background: var(--ac-card);
  border: 1px solid var(--ac-border);
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  text-decoration: none;
  color: var(--ac-ink);
  transition: border-color 0.15s;
}

.ac-nav a:hover { border-color: var(--ac-accent); }

.ac-nav .ac-nav-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ac-muted);
  margin-bottom: 0.25rem;
}

.ac-nav .ac-nav-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ac-accent);
}

.ac-nav .ac-nav-next { text-align: right; }
.ac-nav .ac-nav-home { text-align: center; flex: 0 1 auto; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }

/* --- Course index ----------------------------------------------------------- */

.ac-part {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ac-accent);
  margin: 2.5rem 0 0.9rem;
}

/* beat the generic .ac-article a underline/color for card links */
.ac-article a.ac-lesson-card,
.ac-article a.ac-lesson-card:hover {
  text-decoration: none;
  color: var(--ac-ink);
}

.ac-lesson-card {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  background: var(--ac-card);
  border: 1px solid var(--ac-border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 0.6rem 0;
  text-decoration: none;
  color: var(--ac-ink);
  transition: border-color 0.15s, transform 0.1s;
}

.ac-lesson-card:hover {
  border-color: var(--ac-accent);
  transform: translateX(3px);
  color: var(--ac-ink);
}

.ac-lesson-card .ac-num {
  font-family: 'Cascadia Code', Consolas, Menlo, monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ac-accent);
  background: var(--ac-accent-light);
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  flex-shrink: 0;
}

.ac-lesson-card .ac-card-body { min-width: 0; }

.ac-lesson-card .ac-card-title {
  display: block;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
}

.ac-lesson-card .ac-card-desc {
  display: block;
  color: var(--ac-muted);
  font-size: 0.9rem;
  margin-top: 0.15rem;
}

/* --- Book bridge band -------------------------------------------------------- */

.ac-bridge {
  background: var(--ac-card);
  border: 1px solid var(--ac-border);
  border-top: 3px solid var(--ac-accent);
  border-radius: 10px;
  padding: 1.75rem 1.5rem;
  margin-top: 3rem;
}

.ac-bridge h2 {
  margin: 0 0 0.75rem;
  padding-top: 0;
  font-size: 1.2rem;
  color: var(--ac-ink);
}

.ac-bridge p { margin-bottom: 1.25rem; }

.ac-bridge-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.ac-bridge-ctas a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.7rem 1.4rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.ac-bridge-ctas .ac-cta-primary {
  background: var(--ac-accent);
  color: #fff;
}
.ac-bridge-ctas .ac-cta-primary:hover { background: var(--ac-accent-dark); color: #fff; }

.ac-bridge-ctas .ac-cta-secondary {
  border: 1px solid var(--ac-border);
  color: var(--ac-ink);
  background: var(--ac-card);
}
.ac-bridge-ctas .ac-cta-secondary:hover { border-color: var(--ac-accent); }

/* --- Email capture (course index) -------------------------------------------- */

.ac-capture {
  background: var(--ac-card);
  border: 1px solid var(--ac-border);
  border-radius: 10px;
  padding: 1.75rem 1.5rem;
  margin-top: 3rem;
}

.ac-capture h2 {
  margin: 0 0 0.5rem;
  padding-top: 0;
  font-size: 1.2rem;
  color: var(--ac-ink);
}

.ac-capture p { margin-bottom: 1rem; }

.ac-capture form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ac-capture input[type="email"] {
  flex: 1 1 220px;
  min-width: 0;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  font-family: 'Open Sans', system-ui, sans-serif;
  border: 1px solid var(--ac-border);
  border-radius: 6px;
  color: var(--ac-ink);
  background: var(--ac-card);
}

.ac-capture input[type="email"]:focus-visible {
  outline: 2px solid var(--ac-accent);
  outline-offset: 1px;
}

.ac-capture button {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: 6px;
  background: var(--ac-accent);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s;
}

.ac-capture button:hover { background: var(--ac-accent-dark); }
.ac-capture button:focus-visible { outline: 2px solid var(--ac-ink); outline-offset: 2px; }

/* --- Mobile ------------------------------------------------------------------ */

@media (max-width: 640px) {
  .ac-container { padding: 1.5rem 0.9rem 3rem; }
  .ac-article h1 { font-size: 1.5rem; }
  .ac-step { padding: 1.1rem 1.15rem; }
  .ac-nav a { flex-basis: 100%; }
  .ac-nav .ac-nav-next { text-align: left; }
}
