/*
 * exercise.css -- shared layout for ex2 Verilog exercise pages.
 * Depends on poster.css for tokens and chrome components.
 */

.ex-main {
  max-width: 60rem;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 3vw, 2.5rem) 4rem;
}

.ex-main > section { margin-bottom: 2.5rem; }

.ex-prose {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.85;
}

.ex-prose strong { color: var(--text); font-weight: 700; }
.ex-prose a,
.ex-questions a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

.ex-code {
  margin: 0;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.75;
}

.ex-code .kw  { color: #93c5fd; }
.ex-code .cm  { color: #7c8598; }
.ex-code .pn  { color: #fde68a; }
.ex-code .num { color: #fdba74; }
.ex-code .op  { color: #c4b5fd; }

/* two-column "before / after" comparison */
.ex-compare { display: grid; gap: 0.9rem; }
@media (min-width: 720px) { .ex-compare { grid-template-columns: 1fr 1fr; } }

/* Panel eyebrow. Scoped to panels rather than to .ex-compare so a label
   reads the same whether or not the panel sits in a comparison grid.
   Deliberately NOT uppercased: these labels mix Japanese with product
   names ("Python", "Path A"), and uppercasing mangles the latter. */
.poster-panel > .label,
.ex-compare .label,
.ex-optional {
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.poster-panel > .label,
.ex-compare .label { display: block; margin-bottom: 0.4rem; }

.ex-compare .body {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.8;
}

/* step-by-step derivation (2's complement, instruction decode, ...) */
.ex-steps { display: grid; gap: 0.45rem; }

.ex-steps .row {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.9rem;
  align-items: baseline;
  padding: 0.45rem 0.2rem;
  border-bottom: 1px dashed #dcdcd6;
}

.ex-steps .row:last-child { border-bottom: 0; }

.ex-steps .k {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
}

.ex-steps .v {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

.ex-steps .note {
  margin-left: 0.8rem;
  color: var(--muted-soft);
  font-family: var(--font-body);
  font-size: 0.78rem;
}

.ex-steps .is-result .k,
.ex-steps .is-result .v { color: var(--accent); font-weight: 700; }

.ex-questions {
  margin: 0;
  padding-left: 1.6rem;
  list-style: decimal;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.9;
}

.ex-questions li { margin-bottom: 0.55rem; padding-left: 0.2rem; }
.ex-questions li::marker {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
}
.ex-questions strong { color: var(--text); }

.ex-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.9rem;
}

.ex-footnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.2rem;
  border-top: 2px solid var(--line);
  font-size: 0.88rem;
  font-weight: 600;
}

.ex-footnav a { text-decoration: none; }
.ex-footnav a:hover { text-decoration: underline; text-underline-offset: 3px; }

details.ex-details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

details.ex-details > summary {
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  list-style: none;
}

details.ex-details > summary::-webkit-details-marker { display: none; }
details.ex-details > summary::before { content: "\25B8  "; color: var(--accent); }
details.ex-details[open] > summary::before { content: "\25BE  "; }
details.ex-details > div { padding: 0 1.1rem 1.1rem; }

.ex-footer {
  padding: 2rem 1.5rem;
  border-top: 2px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.hidden { display: none !important; }
