/* Buttons, from the TechFabric design system. Three filled tiers share pill
   geometry; ghost is a link rather than a pill. Every value here comes from a
   token, so the whole set follows a palette change. */

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-pill);
  border: 0;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  line-height: 1.5;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.button:hover {
  text-decoration: none;
}

.button__arrow {
  width: 1em;
  height: 1em;
  flex: none;
  color: var(--sg-brand);
}

/* Primary: solid charcoal pill, white label, crimson arrow. The leading action. */
.button--primary {
  background: var(--sg-surface);
  color: var(--sg-text);
}

.button--primary:hover {
  background: var(--sg-card);
  color: var(--sg-text);
}

.button--primary:active {
  background: var(--sg-page);
}

/* Secondary: the quieter of a pair, deferring all color emphasis to the arrow. */
.button--secondary {
  background: var(--sg-light-2);
  color: var(--sg-ink);
  border: 2px solid var(--sg-light-3);
  padding: calc(var(--space-4) - 2px) calc(var(--space-6) - 2px);
}

.button--secondary:hover {
  background: var(--sg-light-border);
  color: var(--sg-ink);
}

.button--secondary:active {
  background: var(--sg-light-3);
}

/* Tertiary: full-width crimson pill for a single-action block. */
.button--tertiary {
  background: var(--sg-brand);
  color: var(--sg-text);
  font-weight: 500;
  width: 100%;
  justify-content: center;
}

.button--tertiary:hover {
  background: var(--sg-brand-hover);
  color: var(--sg-text);
}

.button--tertiary:active {
  background: var(--sg-brand-active);
}

.button--tertiary .button__arrow {
  display: none;
}

/* Ghost: a link, not a pill. Used inline where a filled button would be loud. */
.button--ghost {
  background: none;
  border: 0;
  border-radius: var(--radius-sharp);
  padding: var(--space-2) 0;
  font-family: var(--font-sans);
  font-size: 1.15rem;
  line-height: 1.6;
  font-weight: 700;
  color: var(--ink);
}

.button--ghost:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.button--ghost .button__arrow {
  color: var(--accent);
}

.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.button[disabled],
.button[aria-disabled="true"] {
  opacity: 0.4;
  pointer-events: none;
}

/* A pair of buttons, as they appear at the end of a chapter. */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-6) 0;
}
