/* Styles for the generated /explain tutorial pages.
 *
 * Separate from styles.css on purpose: the landing page is a wide marketing
 * layout and these are long-form articles. Keeping them apart means the
 * homepage does not download article typography it never uses, and an article
 * tweak cannot reflow the hero. Both share the tokens declared in styles.css. */

.explain-body {
  background: var(--color-bg);
}

.explain {
  max-width: 44rem;
  padding-top: 6.5rem;
  padding-bottom: var(--space-xl);
}

/* Breadcrumbs ------------------------------------------------------------- */

.explain-crumbs {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

.explain-crumbs a {
  color: var(--color-text-secondary);
  text-decoration: none;
}

.explain-crumbs a:hover {
  text-decoration: underline;
}

.explain-crumbs span {
  margin: 0 0.4rem;
}

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

.explain-article h1 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1.15;
  margin: 0 0 var(--space-sm);
  color: var(--color-text);
}

.explain-article h2 {
  font-size: 1.4rem;
  margin: var(--space-lg) 0 var(--space-sm);
  color: var(--color-text);
}

.explain-article p {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-text);
  margin: 0 0 var(--space-sm);
}

.explain-lede {
  font-size: 1.1875rem !important;
  color: var(--color-text-secondary) !important;
}

/* The rule, stated before it is demonstrated — the same order the app's
 * explanation card uses, and for the same reason. */
.explain-rule {
  background: var(--color-bg-white);
  border-inline-start: 5px solid var(--color-mul);
  border-radius: 14px;
  padding: var(--space-sm) var(--space-md);
  margin: var(--space-md) 0;
  box-shadow: 0 2px 10px rgba(45, 55, 72, 0.06);
}

.explain-rule-label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 0.35rem;
}

.explain-rule p {
  margin: 0;
  font-size: 1.1875rem;
  font-weight: 600;
}

.explain-steps,
.explain-mistakes,
.explain-related {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-text);
  padding-inline-start: 1.4rem;
}

.explain-steps li,
.explain-mistakes li,
.explain-related li {
  margin-bottom: 0.5rem;
}

/* Worked examples --------------------------------------------------------- */

.explain-example {
  background: var(--color-bg-white);
  border-radius: 14px;
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
  border-inline-start: 5px solid var(--color-green);
}

.explain-example-no {
  border-inline-start-color: var(--color-sub);
}

.explain-example p {
  margin: 0 0 0.35rem;
}

.explain-example-q {
  font-weight: 600;
}

/* The working is arithmetic read left to right even on an Arabic page: it is
 * column work derived from the written numeral, not a sentence. */
.explain-example-work {
  font-variant-numeric: tabular-nums;
  white-space: pre-line;
  font-size: 1.125rem !important;
  color: var(--color-text-secondary) !important;
  unicode-bidi: isolate;
}

.explain-example-a {
  font-weight: 600;
}

/* FAQ --------------------------------------------------------------------- */

.explain-faq details {
  background: var(--color-bg-white);
  border-radius: 12px;
  padding: 0.85rem var(--space-sm);
  margin-bottom: 0.6rem;
}

.explain-faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--color-text);
}

.explain-faq p {
  margin: 0.6rem 0 0;
  color: var(--color-text-secondary);
}

/* Hub index --------------------------------------------------------------- */

.explain-index {
  list-style: none;
  padding: 0;
  margin: var(--space-md) 0;
  display: grid;
  gap: 0.6rem;
}

.explain-index a {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--color-bg-white);
  border-radius: 14px;
  padding: 0.85rem var(--space-sm);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 10px rgba(45, 55, 72, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.explain-index a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(45, 55, 72, 0.1);
}

.explain-index-divisor {
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--color-mul-light);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text);
}

.explain-index-text strong {
  display: block;
  font-size: 1.0625rem;
}

.explain-index-text span {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

/* Call to action ---------------------------------------------------------- */

.explain-cta {
  margin-top: var(--space-xl);
  background: var(--color-bg-white);
  border-radius: 18px;
  padding: var(--space-md);
  text-align: center;
  box-shadow: 0 4px 18px rgba(45, 55, 72, 0.08);
}

.explain-cta h2 {
  margin: 0 0 0.5rem;
  font-size: 1.3rem;
}

.explain-cta p {
  margin: 0 auto var(--space-sm);
  max-width: 34rem;
  color: var(--color-text-secondary);
  line-height: 1.65;
}
