#tresc {
  --editorial-sand: #e6dcca;
  --editorial-light: #faf7f0;
  --editorial-navy: #0f1c24;
  --editorial-on-dark: #faf7f0;
  --editorial-inset: clamp(1.05rem, 3.1vw, 2.8rem);
  --editorial-gap: clamp(1rem, 3.2vw, 3.2rem);
  --editorial-space: clamp(1.8rem, 4.5vw, 4.4rem);
  --editorial-width: 77.5rem;
}

#tresc:not(:has(> :is(.brand-surface, .brand-directory, .about-page))) > .page-heading,
#tresc > .reader-header:not(.defocus-ranking-header) {
  width: 100%;
  max-width: none;
  margin-block-end: var(--editorial-space);
  padding: var(--editorial-space) max(var(--gutter), calc((100% - var(--editorial-width)) / 2));
  background: var(--editorial-sand);
}

#tresc:not(:has(> .brand-directory)) > .page-heading h1,
#tresc > .reader-header:not(.defocus-ranking-header) h1 {
  margin-block: 0;
  max-width: 22ch;
  font-family: Archivo, system-ui, sans-serif;
  font-size: clamp(2rem, 4.45vw, 4.45rem);
  font-weight: 680;
  letter-spacing: -.052em;
  line-height: 1.04;
  text-wrap: balance;
}

#tresc:not(:has(> .brand-directory)) > .page-heading > :is(p, .lead),
#tresc > .reader-header:not(.defocus-ranking-header) > :is(p, .lead) {
  margin-block: 1rem 0;
}

html body #tresc:not(:has(> .brand-directory)) > .page-heading p.lead,
html body #tresc > .reader-header:not(.defocus-ranking-header) p.lead {
  max-width: 58ch;
  font-family: Archivo, system-ui, sans-serif;
  font-size: clamp(1.08rem, 1rem + .5vw, 1.4rem) !important;
  font-weight: 520;
  line-height: 1.48;
}

#tresc:has(> [data-development-page="dla-rodzicow"], > [data-development-page="dla-nauczycieli"]) > .page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.23fr) minmax(0, .77fr);
  gap: var(--editorial-gap);
  align-items: start;
  background: var(--editorial-navy);
  color: var(--editorial-on-dark);
}

#tresc:has(> [data-development-page="dla-rodzicow"], > [data-development-page="dla-nauczycieli"]) > .page-heading h1 {
  color: inherit;
  font-size: clamp(1.95rem, 4vw, 3.55rem);
}

html body #tresc:has(> [data-development-page="dla-rodzicow"], > [data-development-page="dla-nauczycieli"]) > .page-heading p.lead {
  margin-block: 0;
  padding-inline-start: 1.15rem;
  border-inline-start: .24rem solid #c7714e;
  color: inherit;
}

#tresc > .guide-chapters {
  width: min(100% - 2 * var(--gutter), var(--editorial-width));
  max-width: none;
}

#tresc .guide-chapter {
  display: grid;
  grid-template-columns: minmax(0, .84fr) minmax(0, 1.36fr);
  column-gap: var(--editorial-gap);
  align-items: start;
  margin-block: 0 1.25rem;
  padding: var(--editorial-inset);
  background: var(--editorial-light);
}

#tresc .guide-chapter > h2 {
  margin: 0;
  max-width: 23ch;
  font-size: clamp(1.5rem, 2.35vw, 2.3rem);
  line-height: 1.13;
  letter-spacing: -.04em;
  text-wrap: balance;
}

#tresc .guide-chapter__body > :first-child { margin-block-start: 0 }
#tresc .guide-chapter__body > :last-child { margin-block-end: 0 }
#tresc .guide-chapter:has(.guide-chapter__questions) { background: var(--editorial-sand) }

#tresc .guide-chapter ul.guide-chapter__questions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
  padding: 0;
  margin: 1.15rem 0;
  list-style: none;
}

#tresc .guide-chapter__questions > li {
  position: relative;
  margin: 0;
  list-style: none;
  padding: .8rem .8rem .8rem 1.9rem;
  background: var(--editorial-light);
}

#tresc .guide-chapter__questions > li:last-child:nth-child(odd) { grid-column: 1 / -1 }

#tresc .guide-chapter__questions > li::before {
  content: "";
  position: absolute;
  inset-block-start: 1.16rem;
  inset-inline-start: .78rem;
  width: .37rem;
  height: .37rem;
  border-radius: 50%;
  background: var(--accent);
}

#tresc .guide-chapter .development-links {
  display: grid;
  gap: .45rem;
  padding: 0;
  margin-block-start: 1rem;
}

#tresc .guide-chapter .development-links > li {
  margin: 0;
  padding: 0;
  max-width: none;
  border: 0;
}

#tresc .guide-chapter .development-links a {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 46px;
  padding: .68rem .8rem;
  border: 1px solid var(--line);
  background: var(--editorial-light);
  text-underline-offset: .2em;
}

#tresc .guide-chapter .development-links a > svg {
  flex: 0 0 1.25rem;
  color: var(--accent);
}

#tresc .guide-chapter .development-links a:hover { border-color: var(--accent) }

#tresc .guide-chapter:is(#cos-przeszkadza, #powrot-do-gabinetu) {
  background: var(--editorial-navy);
  color: var(--editorial-on-dark);
}

#tresc .guide-chapter:is(#cos-przeszkadza, #powrot-do-gabinetu) > h2 { color: inherit }
#tresc .guide-chapter:is(#cos-przeszkadza, #powrot-do-gabinetu) .development-links a { color: var(--ink) }

/* Media and directory listings retain their image proportions and card order. */
#tresc > :is(.video-library, .ranking-entry-list),
#tresc > .section--early:not(.brand-directory) > :is(.story-grid, .technology-list),
#tresc > .needs-field .needs-grid {
  gap: clamp(.9rem, 2.5vw, 2rem);
}

#tresc > :is(.video-library, .ranking-entry-list, .letters-index) > article,
#tresc > .section--early:not(.brand-directory) > :is(.story-grid, .technology-list) > article {
  min-width: 0;
  padding: clamp(.9rem, 2.5vw, 1.65rem);
  border-block-start: .18rem solid var(--line);
  background: var(--editorial-light);
}

#tresc > :is(.video-library, .ranking-entry-list) > article:nth-of-type(3n + 2),
#tresc > .section--early:not(.brand-directory) > .technology-list > article:nth-of-type(even) {
  background: var(--editorial-sand);
}

#tresc > :is(.video-library, .ranking-entry-list) > article :is(h2, h3),
#tresc > .section--early:not(.brand-directory) > .technology-list h3 {
  line-height: 1.2;
  text-wrap: balance;
}

/* Long-form reading, separate from comparison tools and product rooms. */
#tresc > .article-cover {
  background: var(--editorial-light);
  padding: var(--editorial-inset);
}

#tresc > .article-layout > .prose > .prose-section,
#tresc > .editorial-reading:not(.progressive-reading) > .editorial-section {
  margin-block: 0 1.25rem;
  padding: var(--editorial-inset);
  background: var(--editorial-light);
}

#tresc > .article-layout > .prose > .prose-section:nth-of-type(even),
#tresc > .editorial-reading:not(.progressive-reading) > .editorial-section:nth-of-type(even) {
  background: var(--editorial-sand);
}

#tresc > .article-layout > .prose > .prose-section > h2:first-child,
#tresc > .editorial-reading:not(.progressive-reading) > .editorial-section > h2:first-child {
  margin-block-start: 0;
}

#tresc > .article-layout > .prose > .prose-section > :last-child,
#tresc > .editorial-reading:not(.progressive-reading) > .editorial-section > :last-child {
  margin-block-end: 0;
}

#tresc > .narrow.prose:not(.development-page) {
  background: var(--editorial-light);
  padding: var(--editorial-inset);
  margin-block-end: var(--editorial-space);
}

#tresc > .narrow.prose:not(.development-page) > h2 {
  padding-block-start: .85rem;
  border-block-start: 2px solid var(--line);
  max-width: none;
  text-wrap: balance;
}

#tresc > .narrow.prose:not(.development-page) > :first-child,
#tresc > .narrow.prose:not(.development-page) > section:first-child > :first-child {
  margin-block-start: 0;
}

#tresc .glossary-terms > div {
  margin-block: .65rem;
  padding: var(--editorial-inset);
  border-block-start: 0;
  background: var(--editorial-light);
}

#tresc .glossary-terms > div:nth-child(even) { background: var(--editorial-sand) }

#tresc > .disease-intro {
  margin-block-end: 1.15rem;
  padding: var(--editorial-inset);
  background: var(--editorial-light);
}

#tresc > .disease-posts > h2 { padding-block-start: .9rem; border-block-start: 2px solid var(--line) }

#tresc .home-purpose {
  padding: 1rem var(--editorial-inset);
  border-inline-start: .22rem solid var(--accent);
  background: var(--editorial-sand);
  font-family: Archivo, system-ui, sans-serif;
  font-weight: 540;
}

@media (max-width: 850px) {
  #tresc:has(> [data-development-page="dla-rodzicow"], > [data-development-page="dla-nauczycieli"]) > .page-heading,
  #tresc .guide-chapter { grid-template-columns: minmax(0, 1fr); gap: 1rem }
}

@media (max-width: 570px) {
  #tresc .guide-chapter ul.guide-chapter__questions {
    grid-template-columns: minmax(0, 1fr);
  }
}

html[data-large-text="true"] #tresc .guide-chapter,
html[data-large-text="true"] #tresc .guide-chapter ul.guide-chapter__questions,
html[data-large-text="true"] #tresc:has(> .guide-chapters) > .page-heading {
  grid-template-columns: minmax(0, 1fr);
}

html[data-contrast="true"] #tresc {
  --editorial-light: #fff;
  --editorial-sand: #fff;
  --editorial-navy: #000;
  --editorial-on-dark: #fff;
}
