/* ==========================================================================
   NanoMatma: artykuł na blogu (szablony page-<temat>.php)
   Wczytywane warunkowo z functions.php. Zmienne kolorów i klasy .button
   pochodzą z assets/css/screen.css.
   ========================================================================== */

.article-page {
  --acc: var(--blue);
  --acc-soft: rgba(45, 72, 155, .1);
  --teal: #1d8f85;
  background: var(--paper);
  color: var(--ink);
}

/* Wąska kolumna tekstu: długie akapity czyta się źle powyżej ~70 znaków. */
.article-shell {
  width: min(100% - 48px, 760px);
  margin-inline: auto;
}

/* ==========================================================================
   NAGŁÓWEK
   ========================================================================== */

.article-hero {
  position: relative;
  padding: 150px 0 clamp(54px, 7vw, 86px);
  background: var(--navy);
  color: var(--paper);
  isolation: isolate;
  overflow: hidden;
}

.article-hero::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0 0 0 auto;
  width: 42%;
  background: var(--blue);
  border-bottom-left-radius: 46% 34%;
}

.article-hero__inner { position: relative; max-width: 860px; }

.article-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-bottom: 26px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}

.article-crumbs a { color: var(--mint); text-decoration: underline; text-underline-offset: 3px; }
.article-crumbs a:hover { color: var(--paper); }
.article-crumbs span { color: rgba(251, 248, 241, .35); }

.article-hero h1 {
  margin: 0;
  max-width: 16ch;
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 78px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.02;
}

.article-lead {
  max-width: 58ch;
  margin: 28px 0 0;
  color: rgba(251, 248, 241, .78);
  font-size: 18px;
  line-height: 1.68;
}

.article-meta {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 40px;
  margin: 36px 0 0;
  padding: 26px 0 0;
  border-top: 1px solid rgba(251, 248, 241, .18);
}

.article-meta li {
  display: grid;
  gap: 5px;
  font-size: 14px;
  font-weight: 650;
}

.article-meta span {
  color: var(--mint);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ==========================================================================
   TREŚĆ
   ========================================================================== */

.article-body { padding: clamp(54px, 7vw, 88px) 0; }
.article-body--alt { background: var(--cream); }

.article-body h2 {
  margin: 0 0 24px;
  font-family: var(--font-display);
  font-size: clamp(27px, 3.2vw, 40px);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.12;
}

.article-body p {
  margin: 0 0 18px;
  font-size: 16.5px;
  line-height: 1.75;
  color: rgba(16, 47, 73, .86);
}

.article-body p:last-child { margin-bottom: 0; }
.article-body strong { font-weight: 800; color: var(--ink); }
.article-body em { font-style: italic; font-weight: 650; }

/* ==========================================================================
   WZORY
   ========================================================================== */

.formula-block {
  margin: 22px 0;
  padding: 18px 22px;
  background: #fff;
  border: 1px solid rgba(16, 47, 73, .12);
  border-left: 3px solid var(--acc);
  border-radius: 0 6px 6px 0;
  overflow-x: auto;
}

.article-body--alt .formula-block { background: var(--paper); }

.formula-main {
  display: block;
  font-family: "Cambria Math", Cambria, Georgia, serif;
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.7;
  white-space: nowrap;
}

.formula-main sub, .formula-main sup,
.callout sub, .callout sup,
.task sub, .task sup,
.mistake-list sub, .mistake-list sup { font-size: .66em; }

/* Ułamek piętrowy złożony z trzech elementów, bez żadnej biblioteki. */
.frac {
  display: inline-grid;
  grid-template-rows: auto 2px auto;
  justify-items: center;
  gap: 5px;
  vertical-align: middle;
}

.frac__bar { width: 100%; background: currentColor; border-radius: 2px; }
.frac__num, .frac__den { padding: 0 8px; white-space: nowrap; }

.formula-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 6px 0 16px;
  font-family: "Cambria Math", Cambria, Georgia, serif;
  font-size: clamp(26px, 4vw, 38px);
}

.formula-hero__eq { opacity: .45; }
.formula-hero__s { font-weight: 700; }

/* ==========================================================================
   RAMKI Z WYRÓŻNIENIEM
   ========================================================================== */

.callout {
  margin: 28px 0;
  padding: 22px 24px 24px;
  border-radius: 10px;
  background: var(--acc-soft);
  border: 1px solid rgba(45, 72, 155, .22);
}

.callout__label {
  margin: 0 0 10px !important;
  color: var(--acc);
  font-size: 10.5px !important;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.callout__body { margin: 0 !important; font-size: 15px !important; }

.callout--formula {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--paper);
  text-align: center;
}

.callout--formula .callout__label { color: var(--mint); }
.callout--formula .callout__body { color: rgba(251, 248, 241, .72) !important; }

.callout--warn {
  background: rgba(239, 52, 35, .07);
  border-color: rgba(239, 52, 35, .26);
}

.callout--warn .callout__label { color: var(--red); }

.callout--rule {
  background: rgba(29, 143, 133, .1);
  border-color: rgba(29, 143, 133, .3);
}

.callout--rule .callout__label { color: var(--teal); }

/* ==========================================================================
   WYPROWADZENIE
   ========================================================================== */

.derivation {
  list-style: none;
  counter-reset: step;
  margin: 26px 0;
  padding: 0;
  display: grid;
  gap: 18px;
}

.derivation > li {
  position: relative;
  padding-left: 46px;
  counter-increment: step;
}

.derivation > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--acc);
  color: #fff;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
}

.derivation p { margin: 0 0 10px; }
.derivation .formula-block { margin: 0; }

/* ==========================================================================
   FIGURY
   ========================================================================== */

.article-figure {
  margin: 32px 0;
  padding: 24px 24px 20px;
  background: #fff;
  border: 1px solid rgba(16, 47, 73, .12);
  border-radius: 14px;
}

.article-body--alt .article-figure { background: var(--paper); }

.article-figure figcaption {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(16, 47, 73, .1);
  color: rgba(16, 47, 73, .66);
  font-size: 13.5px;
  line-height: 1.65;
}

.fig { display: block; width: 100%; height: auto; overflow: visible; }

.article-figure--pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 26px;
}

.article-figure--pair figcaption { grid-column: 1 / -1; margin-top: 4px; }

/* Kwadrat dzielony na połowy. Kawałki ciemnieją, im są mniejsze, więc widać
   kolejność cięć bez podpisywania ich numerami. */
.fig__piece { fill: var(--acc); stroke: var(--paper); stroke-width: 2; }
.fig__piece[data-step="1"] { fill-opacity: .95; }
.fig__piece[data-step="2"] { fill-opacity: .82; }
.fig__piece[data-step="3"] { fill-opacity: .69; }
.fig__piece[data-step="4"] { fill-opacity: .56; }
.fig__piece[data-step="5"] { fill-opacity: .43; }
.fig__piece[data-step="6"] { fill-opacity: .3; }
.fig__piece[data-step="7"] { fill-opacity: .18; }

.fig__rest { fill: none; }
.fig__frame { fill: none; stroke: var(--ink); stroke-width: 2; }

.fig__frac {
  fill: #fff;
  font-family: "Cambria Math", Cambria, Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  text-anchor: middle;
}

.fig__piece[data-step="6"] ~ .fig__frac,
.fig__piece[data-step="7"] ~ .fig__frac { font-size: 12px; }

.fig__slash { padding: 0 1px; }

.fig__label {
  fill: rgba(16, 47, 73, .6);
  font-size: 13px;
  font-weight: 700;
}

.fig__label--big {
  fill: var(--ink);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
}

/* Oś z sumami częściowymi. */
.fig__axis { stroke: rgba(16, 47, 73, .4); stroke-width: 1.6; }
.fig__limit { stroke: var(--red); stroke-width: 2; stroke-dasharray: 5 5; }
.fig__limit-label { fill: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.fig__limit-value { fill: var(--red); font-family: "Cambria Math", Cambria, Georgia, serif; font-size: 18px; font-weight: 700; }
.fig__hop { stroke: var(--teal); stroke-width: 2.2; stroke-linecap: round; }
.fig__drop { stroke: rgba(29, 143, 133, .4); stroke-width: 1.2; stroke-dasharray: 2 4; }
.fig__dot { fill: var(--teal); }
.fig__sum { fill: rgba(16, 47, 73, .72); font-family: "Cambria Math", Cambria, Georgia, serif; font-size: 12.5px; text-anchor: middle; }
.fig__idx { font-size: 9px; }
.fig__axis-note { fill: rgba(16, 47, 73, .5); font-size: 12px; font-weight: 700; }

/* Dwa zestawy słupków: zbieżny kontra rozbieżny. */
.fig--converge .fig__bar { fill: var(--teal); }
.fig--diverge .fig__bar { fill: var(--red); }
.fig__bars-title { font-family: "Cambria Math", Cambria, Georgia, serif; font-size: 17px; font-weight: 700; text-anchor: middle; fill: var(--ink); }
.fig__bars-note { font-size: 12px; text-anchor: middle; }
.fig--converge .fig__bars-note { fill: var(--teal); }
.fig--diverge .fig__bars-note { fill: var(--red); }

/* ==========================================================================
   TABELA
   ========================================================================== */

.table-wrap { margin: 26px 0; overflow-x: auto; }

.article-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.article-table caption {
  margin-bottom: 12px;
  color: rgba(16, 47, 73, .5);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .14em;
  text-align: left;
  text-transform: uppercase;
}

.article-table th,
.article-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(16, 47, 73, .14);
}

.article-table thead th {
  border-bottom-width: 2px;
  border-bottom-color: rgba(16, 47, 73, .3);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.article-table td:first-child { font-family: "Cambria Math", Cambria, Georgia, serif; white-space: nowrap; }
.article-table tbody tr.is-convergent td:nth-child(3) { color: var(--teal); font-weight: 800; }
.article-table tbody tr.is-divergent td:nth-child(3) { color: var(--red); font-weight: 800; }

/* ==========================================================================
   ZADANIA
   ========================================================================== */

.task-list {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.task {
  padding: 24px 26px;
  background: var(--paper);
  border: 1px solid rgba(16, 47, 73, .13);
  border-radius: 12px;
}

.article-body--alt .task { background: #fff; }

.task__level {
  margin: 0 0 12px !important;
  color: var(--acc);
  font-size: 10.5px !important;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.task__body { margin: 0 !important; font-size: 16px !important; line-height: 1.68 !important; }

.task__no {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
}

.task__solution { margin-top: 18px; }

.task__solution summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 15px;
  background: var(--navy);
  color: var(--paper);
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 700;
}

.task__solution summary::-webkit-details-marker { display: none; }
.task__solution summary i { font-size: 16px; font-style: normal; transition: transform .25s ease; }
.task__solution[open] summary i { transform: rotate(45deg); }
.task__solution[open] summary span::after { content: "Ukryj rozwiązanie"; }
.task__solution[open] summary span { font-size: 0; }
.task__solution[open] summary span::after { font-size: 13px; }

.task__steps {
  list-style: none;
  counter-reset: tstep;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.task__steps > li {
  position: relative;
  padding-left: 38px;
  counter-increment: tstep;
}

.task__steps > li::before {
  content: counter(tstep);
  position: absolute;
  left: 0;
  top: 1px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: rgba(45, 72, 155, .14);
  color: var(--acc);
  border-radius: 50%;
  font-size: 11.5px;
  font-weight: 800;
}

.task__steps strong { display: block; margin-bottom: 4px; font-size: 14.5px; }
.task__steps p { margin: 0 !important; font-size: 14.5px !important; color: rgba(16, 47, 73, .76) !important; }

.task__answer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin: 20px 0 0 !important;
  padding: 14px 16px;
  background: rgba(29, 143, 133, .11);
  border-left: 3px solid var(--teal);
  border-radius: 0 6px 6px 0;
  font-family: "Cambria Math", Cambria, Georgia, serif;
  font-size: 17px !important;
  font-weight: 700;
}

.task__answer span {
  color: var(--teal);
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.task__note {
  margin: 14px 0 0 !important;
  color: rgba(16, 47, 73, .62) !important;
  font-size: 13.5px !important;
}

/* ==========================================================================
   BŁĘDY
   ========================================================================== */

.mistake-list {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.mistake-list li {
  position: relative;
  padding: 18px 20px 18px 50px;
  background: rgba(239, 52, 35, .05);
  border-left: 3px solid var(--red);
}

.mistake-list li::before {
  content: "×";
  position: absolute;
  left: 19px;
  top: 16px;
  color: var(--red);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.mistake-list strong { display: block; margin-bottom: 5px; font-size: 15.5px; }
.mistake-list p { margin: 0 !important; font-size: 14.5px !important; color: rgba(16, 47, 73, .74) !important; }

/* ==========================================================================
   CTA
   ========================================================================== */

.article-cta {
  padding: clamp(56px, 7vw, 92px) 0;
  background: var(--navy);
  color: var(--paper);
}

.article-cta h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.2vw, 40px);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.1;
}

.article-cta p {
  max-width: 56ch;
  margin: 0 0 28px;
  color: rgba(251, 248, 241, .74);
  font-size: 16px;
  line-height: 1.7;
}

.article-cta__actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ==========================================================================
   INTERAKCJE I RESPONSYWNOŚĆ
   ========================================================================== */

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .task__solution summary { transition: background .2s ease, transform .2s ease; }
  .task__solution summary:hover { background: var(--red); transform: translateY(-1px); }
  .article-page .button span { transition: transform .25s ease; }
  .article-page .button:hover span { transform: rotate(45deg); }
}

@media (max-width: 860px) {
  .article-hero { padding: 120px 0 54px; }
  .article-hero::before { inset: auto 0 0 0; width: 100%; height: 34%; border-radius: 40% 40% 0 0 / 14% 14% 0 0; }
  .article-figure--pair { grid-template-columns: 1fr; }
  .article-meta { gap: 16px 28px; }
}

@media (max-width: 620px) {
  .article-shell { width: calc(100% - 36px); }
  .article-body p { font-size: 16px; }
  .formula-main { font-size: 15px; }
  .task { padding: 20px 18px; }
  .task__steps > li { padding-left: 32px; }
  .article-page .button { width: 100%; }
}

/* ==========================================================================
   DO SAMODZIELNEGO ROZWIĄZANIA
   ========================================================================== */

.practice-list {
  list-style: none;
  counter-reset: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.practice {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 16px;
  padding: 20px 22px;
  background: var(--paper);
  border-left: 3px solid rgba(16, 47, 73, .16);
}

.article-body--alt .practice { background: #fff; }

.practice__no {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: rgba(16, 47, 73, .08);
  border-radius: 50%;
  color: rgba(16, 47, 73, .6);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
}

.practice__main { min-width: 0; }

.practice__task {
  margin: 0 !important;
  font-size: 15.5px !important;
  line-height: 1.68 !important;
}

/* Podpowiedź i odpowiedź to zwykłe details, żeby działały bez JavaScriptu. */
.practice__hint,
.practice__answer { margin-top: 12px; }

.practice__hint summary,
.practice__answer summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}

.practice__hint summary::-webkit-details-marker,
.practice__answer summary::-webkit-details-marker { display: none; }

.practice__hint summary::before,
.practice__answer summary::before {
  content: "+";
  font-size: 14px;
  line-height: 1;
}

.practice__hint[open] summary::before,
.practice__answer[open] summary::before { content: "-"; }

.practice__hint summary {
  background: transparent;
  border: 1px solid rgba(16, 47, 73, .26);
  color: rgba(16, 47, 73, .66);
}

.practice__hint summary:hover { border-color: var(--acc); color: var(--acc); }

.practice__answer summary {
  background: rgba(29, 143, 133, .13);
  border: 1px solid rgba(29, 143, 133, .34);
  color: var(--teal);
}

.practice__answer summary:hover { background: rgba(29, 143, 133, .2); }

.practice__hint > p,
.practice__answer > p {
  margin: 10px 0 0 !important;
  padding: 12px 15px;
  border-radius: 6px;
  font-size: 14.5px !important;
  line-height: 1.62 !important;
}

.practice__hint > p {
  background: rgba(16, 47, 73, .05);
  color: rgba(16, 47, 73, .72) !important;
}

.practice__answer > p {
  background: rgba(29, 143, 133, .1);
  border-left: 3px solid var(--teal);
  border-radius: 0 6px 6px 0;
  font-family: "Cambria Math", Cambria, Georgia, serif;
  font-size: 16px !important;
  font-weight: 700;
  color: var(--ink) !important;
}

/* Kolejne zadania są coraz trudniejsze, więc pasek z lewej ciemnieje. */
.practice:nth-child(1) { border-left-color: rgba(29, 143, 133, .55); }
.practice:nth-child(2) { border-left-color: rgba(29, 143, 133, .75); }
.practice:nth-child(3) { border-left-color: rgba(45, 72, 155, .55); }
.practice:nth-child(4) { border-left-color: rgba(45, 72, 155, .75); }
.practice:nth-child(5) { border-left-color: rgba(239, 52, 35, .55); }
.practice:nth-child(6) { border-left-color: rgba(239, 52, 35, .75); }
.practice:nth-child(7) { border-left-color: var(--red); }

.practice-foot {
  margin-top: 26px !important;
  padding-top: 20px;
  border-top: 1px solid rgba(16, 47, 73, .14);
  font-size: 14.5px !important;
  color: rgba(16, 47, 73, .7) !important;
}

.practice-foot a {
  color: var(--acc);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 620px) {
  .practice { grid-template-columns: 1fr; gap: 10px; padding: 18px; }
  .practice__no { width: 26px; height: 26px; font-size: 12px; }
}
