:is(
  .profile-page, .profile-index, .gmp-tool-page, .gmp-tools-index,
  .gmp-dossier, .gmp-guide, .gmp-guides-library, .blog-hub, .blog-article-page,
  .gmp-cases, .gmp-lex-surface,
  [data-page-route="/thematiques/"] .gmp-model-surface
) {
  --gmp-section-space: clamp(36px, 4.6vw, 64px);
  --gmp-content-gap: clamp(20px, 2.4vw, 32px);
}

/* Profils */
.profile-page > .profile-hero,
.profile-page > :is(.profile-reading, .profile-faq, .profile-priorities, .profile-path),
.gmp-family > .section,
.gmp-family .practice > .section,
.gmp-family .gmp-family-contact-inner {
  padding-block: var(--gmp-section-space);
}

.profile-page .profile-hero .n1-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 16px;
}

.profile-page > .profile-jump {
  --gmp-profile-nav-bg: #e4ece3;
  padding-inline: 0;
  border-image: linear-gradient(var(--gmp-profile-nav-bg), var(--gmp-profile-nav-bg)) 0 fill / 0 / 0 100vmax;
}

.profile-page > .profile-priorities {
  margin-top: 0;
  padding-top: var(--gmp-content-gap);
}

.profile-page > .profile-path {
  margin-bottom: 0;
}

.profile-page > .profile-path:has(+ .n2-continue) {
  padding-bottom: 0;
}

.profile-page :is(.profile-priorities .section-heading, #ressources-associees > .section-title),
.profile-index > header {
  margin-bottom: var(--gmp-content-gap);
}

.profile-page .profile-path-list {
  margin-top: var(--gmp-content-gap);
  gap: var(--gmp-content-gap);
}

.profile-page .profile-path-list > li,
.profile-page .profile-faq > div {
  min-width: 0;
}

.profile-page .profile-faq summary {
  overflow-wrap: anywhere;
}

.profile-index {
  padding-block: var(--gmp-section-space);
}

.profile-index .theme-card-grid,
.profile-page .profile-priorities .theme-card-grid,
.gmp-family .cards {
  gap: var(--gmp-content-gap);
}

.profile-index .profile-index-next {
  margin-top: var(--gmp-section-space);
}

.gmp-family > :is(.section, .practice) {
  scroll-margin-top: 0;
}

/* « resources » sert aussi aux sections pleine largeur. */
.gmp-family #ressources-associees > .cards.resources {
  padding: 0;
  background: transparent;
  border: 0;
}

/* Annuaire et pages de calcul */
.gmp-tools-index > .gmp-model-hero {
  padding-block: var(--gmp-content-gap) var(--gmp-section-space);
}

.gmp-tools-index > .gmp-model-section,
.gmp-tools-index > .gmp-model-band,
.gmp-tools-index > .gmp7-directory {
  padding-block: var(--gmp-section-space);
}

.gmp-tools-index > section > .gmp-model-section {
  padding-block: var(--gmp-section-space);
}

.gmp-tools-index > .gmp-model-band > .gmp-model-section {
  padding-block: 0;
}

.gmp-tools-index > section:not(.gmp-model-band, .gmp7-directory) + section:not(.gmp-model-band) > .gmp-model-section,
.gmp-tools-index > section:not(.gmp-model-band, .gmp7-directory) + .gmp-model-section {
  padding-top: 0;
}

.gmp-tools-index :is(.gmp-model-grid, .prototype-grid) {
  gap: var(--gmp-content-gap);
}

.gmp-tools-index .gmp7-directory .prototype-grid {
  padding-block: 0;
}

.gmp-tools-index :is(.gmp-model-section > h2, .gmp7-directory .gmp7-directory-heading) {
  margin-bottom: var(--gmp-content-gap);
}

.gmp-tool-page > :is(.gmp-tool-layout, .gmp-salary-layout, .gmp-savings-workspace, .gmp-preparation-layout) {
  gap: var(--gmp-content-gap);
  margin-block-end: 0;
  padding-block-end: 0;
}

.gmp-tool-page > :is(.gmp-tool-layout, .gmp-savings-workspace, .gmp-preparation-layout, .gmp-salary-layout):last-child {
  margin-bottom: var(--gmp-section-space);
}

.gmp-tool-page > :is(.gmp-credit-schedule, .gmp-credit-next, .gmp-salary-reading, .gmp-tool-sources) {
  margin-block: 0;
  padding-block: var(--gmp-content-gap) 0;
}

.gmp-tool-page > :is(.gmp-tool-sources, .gmp-salary-reading, .gmp-credit-next):last-child {
  padding-bottom: var(--gmp-section-space);
}

.gmp-tool-page > .gmp-lead-section {
  margin-block: var(--gmp-content-gap) 0;
  padding: clamp(20px, 3.4vw, 44px);
  align-items: start;
  gap: var(--gmp-content-gap);
}

.gmp-tool-page > .gmp-model-section {
  padding-block: var(--gmp-section-space);
}

.gmp-tool-page > .gmp-tax-result-guides {
  padding-block: var(--gmp-content-gap);
}

.gmp-tool-page .gmp-tax-result-guides .gmp-model-grid {
  gap: var(--gmp-content-gap);
}

/* Dossiers, guides et bibliothèques */
:is(.gmp-dossier, [data-page-route="/thematiques/"] .gmp-model-surface) > .gmp-model-hero,
.gmp-guide > .gmp-guide-hero,
.gmp-guides-library > .gmp-guides-hero {
  padding-block: var(--gmp-content-gap) var(--gmp-section-space);
}

:is(.gmp-dossier, [data-page-route="/thematiques/"] .gmp-model-surface) > .gmp-model-section,
[data-page-route="/thematiques/"] .gmp-model-surface > .gmp-model-band,
:is(.gmp-dossier, .gmp-guide) > :is(.gmp-context-tools, #parcours-fiscal),
[data-page-route="/thematiques/fiscalite/girardin-industriel/"] .gmp-cases > .gmp-case-more {
  padding-block: var(--gmp-section-space);
}

:is(.gmp-dossier, [data-page-route="/thematiques/"] .gmp-model-surface) > .gmp-model-hero + .gmp-model-section,
.gmp-guides-library > .gmp-guide-library {
  padding-top: 0;
}

.gmp-dossier > .gmp-dossier-questions:has(+ .n2-continue) {
  padding-bottom: 0;
}

:is(.gmp-dossier, .gmp-guide) > .gmp-reader-wide,
.gmp-guides-library > .gmp-guide-library,
[data-page-route="/thematiques/fiscalite/girardin-industriel/"] .gmp-cases > .gmp-case-layout {
  padding-bottom: var(--gmp-section-space);
}

.gmp-dossier > #parcours-fiscal + .gmp-reader-wide {
  padding-top: var(--gmp-section-space);
}

.gmp-dossier > .gmp-reader-wide:has(+ .gmp-dossier-questions) {
  padding-bottom: var(--gmp-content-gap);
}

.gmp-dossier .gmp-dossier-body > .gmp-model-cta:last-child {
  margin-bottom: 0;
}

[data-page-route="/thematiques/"] .gmp-model-surface > .wrap > .gmp-model-cta {
  margin-block: 0 var(--gmp-section-space);
}

.gmp-guides-library > .gmp-guides-next.wrap {
  padding: var(--gmp-section-space) 0;
  margin-bottom: 0;
  border-image: linear-gradient(#e5ece1, #e5ece1) 0 fill / 0 / 0 100vmax;
}

:is(.gmp-dossier, .gmp-guide, .gmp-guides-library, [data-page-route="/thematiques/"] .gmp-model-surface)
  :is(.gmp-model-grid, .gmp-context-tools-grid, .gmp-guide-grid) {
  gap: var(--gmp-content-gap);
}

:is(.gmp-dossier, .gmp-guide, [data-page-route="/thematiques/"] .gmp-model-surface)
  :is(.gmp-model-section > .section-heading, .gmp-model-section > h2, .gmp-context-tools-heading) {
  margin-bottom: var(--gmp-content-gap);
}

@media (min-width: 651px) and (max-width: 850px) {
  :is(.gmp-dossier, .gmp-guide) .gmp-context-tools-grid[data-card-count="3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  :is(.gmp-dossier, .gmp-guide) .gmp-context-tools-grid[data-card-count="3"] .gmp-home-tool > a {
    display: flex;
  }

  :is(.gmp-dossier, .gmp-guide) .gmp-context-tools-grid[data-card-count="3"] .gmp-home-tool img {
    height: auto;
    min-height: 0;
    max-height: 240px;
    aspect-ratio: 8 / 5;
  }
}

/* Blog et archives */
.blog-hub {
  padding-bottom: 0;
}

.blog-hub > .blog-hub-intro,
.blog-article-page > .blog-article-hero {
  padding-block: var(--gmp-content-gap) var(--gmp-section-space);
}

.blog-hub > .blog-hub-intro {
  gap: var(--gmp-content-gap);
}

.blog-hub > .blog-hub-library {
  padding-bottom: var(--gmp-section-space);
}

.blog-hub :is(.blog-hub-grid, .blog-hub-toolbar) {
  gap: var(--gmp-content-gap);
}

.blog-hub .blog-hub-toolbar {
  margin-bottom: var(--gmp-content-gap);
}

.blog-hub .blog-hub-picture img {
  aspect-ratio: 3 / 2;
}

.blog-hub .blog-card-copy {
  padding: clamp(20px, 2.2vw, 28px);
}

.blog-hub .blog-card-copy h3 {
  font-size: clamp(22px, 2.1vw, 28px);
}

.blog-hub .blog-card-copy > p {
  margin-block: 12px 16px;
  line-height: 1.7;
}

.blog-hub .gmp-pagination {
  margin-block: var(--gmp-content-gap) 0;
}

.blog-hub > .wrap > .gmp-model-cta {
  --gmp-blog-cta-bg: #153e35;
  margin-block: 0;
  padding: var(--gmp-section-space) 0;
  gap: var(--gmp-content-gap);
  border-image: linear-gradient(var(--gmp-blog-cta-bg), var(--gmp-blog-cta-bg)) 0 fill / 0 / 0 100vmax;
}

.blog-article-page > .blog-article-layout {
  row-gap: var(--gmp-content-gap);
  padding-bottom: var(--gmp-section-space);
}

.blog-article-page .blog-article-body > .gmp-model-cta:last-child {
  margin-bottom: 0;
}

@media screen and (min-width: 801px) {
  .blog-article-page > .blog-article-layout {
    grid-template-columns: minmax(188px, 1fr) minmax(0, 4fr);
    column-gap: clamp(22px, 3.5vw, 52px);
  }
}

@media (min-width: 1051px) {
  .blog-hub-archive .blog-hub-grid:has(> .blog-hub-card:nth-child(3)) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 601px) and (max-width: 1050px) {
  .blog-hub .blog-hub-grid:not(:has(> .blog-hub-card:only-child)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .blog-hub .blog-hub-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .blog-hub .blog-hub-toolbar {
    gap: 12px;
  }
}

/* Cas concrets et lexique */
[data-page-route^="/cas-concrets/"] .gmp-cases > :is(.gmp-case-hub-hero, .gmp-case-hero),
.gmp-lex-surface > .gmp-model-title {
  padding-block: var(--gmp-content-gap) var(--gmp-section-space);
}

[data-page-route^="/cas-concrets/"] .gmp-cases > :is(.gmp-case-list, .gmp-case-more) {
  padding-block: var(--gmp-section-space);
}

[data-page-route^="/cas-concrets/"] .gmp-cases > .gmp-case-layout {
  row-gap: var(--gmp-content-gap);
  padding-bottom: var(--gmp-section-space);
}

[data-page-route^="/cas-concrets/"] .gmp-cases .gmp-case-body > .gmp-case-section {
  margin-top: clamp(28px, 3vw, 42px);
}

[data-page-route^="/cas-concrets/"] .gmp-cases :is(.gmp-case-list, .gmp-case-more) h2 {
  margin-bottom: var(--gmp-content-gap);
}

.gmp-cases > .gmp-case-list .gmp-model-grid,
[data-page-route^="/cas-concrets/"] .gmp-cases .gmp-case-more .gmp-cases-grid {
  gap: var(--gmp-content-gap);
}

.gmp-cases > .gmp-case-list .gmp-model-grid {
  grid-auto-rows: auto;
}

.gmp-cases .gmp-case-list .gmp-case-card-copy {
  padding: clamp(20px, 2.2vw, 28px);
}

.gmp-lex-surface:has(> .gmp-lexicon-index) > .gmp-model-title {
  padding-bottom: var(--gmp-content-gap);
}

.gmp-lex-surface > .gmp-model-title > p {
  margin-block: clamp(12px, 2vw, 24px) 0;
}

.gmp-lex-surface > :is(.gmp-guide-body.gmp-lex-entry, .gmp-guide-body.gmp-lexicon-index) {
  padding-bottom: var(--gmp-section-space);
}

.gmp-lex-surface > .gmp-guide-body.gmp-lex-entry {
  --lex-column-gap: var(--gmp-content-gap);
  --lex-content-space: var(--gmp-content-gap);
  --lex-resources-space: var(--gmp-content-gap);
}

.gmp-lex-surface > .gmp-guide-body.gmp-lex-entry > :is(.gmp-lex-definition, .gmp-lex-example) {
  margin-bottom: var(--gmp-content-gap);
  padding: clamp(18px, 2.4vw, 30px);
  overflow-wrap: anywhere;
}

.gmp-lex-surface > .gmp-guide-body.gmp-lex-entry > .gmp-lex-definition {
  background: #ecf1e9;
}

.gmp-lex-surface > .gmp-guide-body.gmp-lex-entry > .gmp-lex-example {
  background: #f0e9db;
}

.gmp-lex-surface .gmp-lex-entry > section > h2 {
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.2;
}

.gmp-lex-surface .gmp-lex-directory .gmp-lex-grid {
  gap: var(--gmp-content-gap);
}

.gmp-lex-surface .gmp-lex-directory .gmp-lex-section {
  margin-block: var(--gmp-section-space) 0;
}

.gmp-lex-surface .gmp-lex-directory .gmp-lex-search {
  margin-bottom: var(--gmp-content-gap);
}

@media (min-width: 701px) {
  .gmp-lex-surface > .gmp-guide-body.gmp-lex-entry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gmp-lex-surface > .gmp-guide-body.gmp-lex-entry > :is(.gmp-lex-definition, .gmp-lex-example) {
    grid-column: auto;
    align-self: stretch;
  }
}

@media (max-width: 790px) {
  [data-page-route^="/cas-concrets/"] .gmp-case-hero .gmp-case-hero-video--responsive {
    width: min(100%, 380px);
    justify-self: center;
  }
}

@media (min-width: 601px) and (max-width: 1050px) {
  .gmp-cases > .gmp-case-list .gmp-model-grid,
  [data-page-route^="/cas-concrets/"] .gmp-case-more .gmp-cases-grid,
  .gmp-lex-surface .gmp-lex-directory .gmp-lex-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .gmp-cases > .gmp-case-list .gmp-model-grid,
  [data-page-route^="/cas-concrets/"] .gmp-case-more .gmp-cases-grid,
  .gmp-lex-surface .gmp-lex-directory .gmp-lex-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Les cartes s’alignent sur l’en-tête du carrousel et le reste du contenu. */
:is(.profile-page, .gmp-tool-page, .gmp-dossier, .gmp-guide, .blog-article-page) > #ressources-associees.n2-continue {
  margin-block: 0;
  padding: var(--gmp-section-space) 0;
}

.gmp-tool-page > :is(.gmp-credit-next, .gmp-tool-sources) + #ressources-associees.n2-continue {
  margin-top: var(--gmp-content-gap);
}

:is(.profile-page, .gmp-tool-page, .gmp-dossier, .gmp-guide, .blog-article-page) > #ressources-associees .section-heading {
  margin-bottom: var(--gmp-content-gap);
}

:is(.profile-page, .gmp-tool-page, .gmp-dossier, .gmp-guide, .blog-article-page) > #ressources-associees .n2-resource-track {
  gap: var(--gmp-content-gap);
  padding: 0;
  scroll-padding-inline: 0;
}

:is(.profile-page, .gmp-tool-page, .gmp-dossier, .gmp-guide, .blog-article-page) > #ressources-associees .n2-resource-card:focus-visible {
  outline-offset: -3px;
}

:is(.profile-page, .gmp-tool-page, .gmp-dossier, .gmp-guide, .blog-article-page) > #ressources-associees .n2-carousel-controls:has(button:disabled + button:disabled) {
  display: none;
}

@media (min-width: 1051px) {
  .profile-index .theme-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  :is(.profile-page, .gmp-tool-page, .gmp-dossier, .gmp-guide, .blog-article-page) > #ressources-associees .n2-resource-track > li {
    flex-basis: calc((100% - 2 * var(--gmp-content-gap)) / 3);
  }
}

@media (min-width: 601px) and (max-width: 1050px) {
  :is(.profile-page, .gmp-tool-page, .gmp-dossier, .gmp-guide, .blog-article-page) > #ressources-associees .n2-resource-track > li {
    flex-basis: calc((100% - var(--gmp-content-gap)) / 2);
  }
}

@media (max-width: 750px) {
  .gmp-tool-page > .gmp-lead-section > div:first-child {
    font-size: .9375rem;
  }

  .gmp-tool-page > .gmp-lead-section > div:first-child > :is(h2, ul) {
    margin-bottom: 14px;
  }

  .gmp-tool-page > .gmp-lead-section > div:first-child > ul {
    margin-top: 14px;
  }

  :is(.profile-page, .gmp-tool-page, .gmp-dossier, .gmp-guide, .blog-article-page) > #ressources-associees .section-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
  }

  :is(.profile-page, .gmp-tool-page, .gmp-dossier, .gmp-guide, .blog-article-page) > #ressources-associees .section-heading h2 {
    font-size: clamp(24px, 6.8vw, 32px);
  }

  :is(.profile-page, .gmp-tool-page, .gmp-dossier, .gmp-guide, .blog-article-page) > #ressources-associees .n2-carousel-controls {
    gap: 4px;
  }
}

@media (max-width: 600px) {
  .profile-page .profile-hero .n1-byline {
    display: grid;
  }

  :is(.profile-page, .gmp-tool-page, .gmp-dossier, .gmp-guide, .blog-article-page) > #ressources-associees .n2-resource-track > li {
    flex-basis: 88%;
  }
}
