/*
 * Panda Systems editorial page system.
 * Organises the production-derived page library with the Supertree/Adeco
 * container geometry and an unframed reading surface.
 */

/* Give Panda's longer homepage title the native 1200px page frame and the
   shared hero's 22.5ch title measure, rather than squeezing it into 640px.
   Padding, responsive font sizes and the 36/24/48px rhythm remain native. */
.hero .hero-content {
  width: 100%;
  max-width: var(--max-width);
}
.hero .hero-content h1 {
  max-width: 22.5ch;
  margin: 24px auto;
}

.standard-page--default .standard-page__hero {
  min-height: clamp(390px, 52vh, 540px) !important;
}
/* Use the homepage's roomier native rhythm in the shared page hero too.
   Keep its type size, container/gutters, colours and badge artwork intact. */
.standard-page--default .standard-page__hero-eyebrow { margin-bottom: 36px; }
.standard-page--default .standard-page__hero h1 {
  margin-bottom: 24px;
  line-height: 1.15;
}
.standard-page--default .standard-page__hero-subtitle { margin-bottom: 48px; }

.panda-standard-page__content {
  padding: 0 !important;
  background: var(--panda-haze);
}

.panda-editorial-page {
  /* Supertree's terms-content reading measure; the outer frame is .container. */
  --panda-reading-width: 780px;
  /* Native .services--consulting section rhythm, with Panda colour aliases. */
  padding: clamp(72px, 9vw, 120px) 0;
  background: var(--bg-primary);
}

/* Inherit Supertree's real .container: max 1200px including the 80/40/20px
   responsive gutters. Do not substitute an unrelated fixed-width wrapper. */
.panda-editorial-page__inner,
.panda-site-index__inner {
  width: 100%;
}

.panda-editorial-page__intro {
  max-width: var(--panda-reading-width);
  margin-bottom: 48px;
}

.panda-editorial-page__intro .section-label {
  margin: 0 0 16px;
}

/* The heading uses Supertree's actual .section-title component in page.php. */
.panda-editorial-page__intro .section-title { margin: 0; }

/* One reading column aligned with the intro and native container gutter.
   No inset or independent centering left over from the rejected outer card. */
.panda-prose-card {
  width: 100%;
  max-width: var(--panda-reading-width);
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.panda-prose {
  max-width: var(--panda-reading-width);
  margin-inline: auto;
  color: var(--panda-body);
  /* Native .media-split .ms-text narrative type, not a new miniature UI. */
  font-size: 17px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.panda-prose > :first-child {
  margin-top: 0 !important;
}

.panda-prose > :last-child {
  margin-bottom: 0 !important;
}

.panda-prose > p:first-child {
  color: var(--panda-ink);
  font-size: 18px;
  line-height: 1.8;
}

.panda-prose p,
.panda-prose ul,
.panda-prose ol,
.panda-prose figure,
.panda-prose .wp-block-embed {
  margin-top: 0;
  margin-bottom: 18px;
}

.panda-prose h2,
.panda-prose h3,
.panda-prose h4 {
  scroll-margin-top: 120px;
  color: var(--panda-ink) !important;
}

/* Supertree section-title type. Legal-document dividers must not become
   mandatory decoration on every corporate/product section. */
.panda-prose h2 {
  margin: 72px 0 20px;
  padding: 0;
  border: 0;
  font-size: 36px;
  font-weight: 400;
  line-height: 1.25;
}

/* Legacy imported headings sometimes contain redundant <strong> wrappers.
   Let the heading component set their weight; body emphasis stays untouched. */
.panda-prose h2 strong { font-weight: inherit; }

.panda-prose h3 {
  margin: 34px 0 14px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
}

.panda-prose h4 {
  margin: 28px 0 12px;
  font-size: 18px;
  font-weight: 700;
}

.panda-prose a {
  color: var(--panda-green-700);
  font-weight: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.panda-prose ul,
.panda-prose ol {
  padding: 0 0 0 1.25em;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.panda-prose li + li {
  margin-top: 14px;
}

.panda-prose .wp-block-separator {
  width: 100%;
  margin: 42px 0;
  border: 0;
  border-top: 1px solid var(--panda-hairline);
}

.panda-prose .wp-block-image,
.panda-prose .wp-block-gallery,
.panda-prose .wp-block-embed {
  overflow: hidden;
  border-radius: var(--card-radius);
}

.panda-prose .wp-block-image img,
.panda-prose .wp-block-gallery img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.panda-prose .wp-block-embed__wrapper {
  position: relative;
  min-height: 240px;
  padding-top: 56.25%;
  background: var(--panda-haze-deep);
}

.panda-prose .wp-block-embed__wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.panda-prose .wp-block-columns {
  gap: 20px;
  margin: 28px 0;
}

.panda-prose .wp-block-column {
  min-width: 0;
}

/* Supertree's terms-content rhythm belongs to policies, not all pages. */
.panda-page--policy .panda-prose h2 {
  margin: 34px 0 14px;
  padding-top: 34px;
  border-top: 1px solid var(--panda-hairline);
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 400;
  line-height: 1.2;
}

/* Existing Gutenberg separators already provide the legal section divider. */
.panda-page--policy .panda-prose .wp-block-separator + h2 {
  padding-top: 0;
  border-top: 0;
}

/* Long guides/policies get a collapsed outline in the reading flow, never
   a permanent side column. Corporate/product overviews get no outline. */
.panda-document-outline {
  max-width: var(--panda-reading-width);
  margin: 0 auto 34px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--panda-body);
  font-size: 14px;
  line-height: 1.65;
}
.panda-document-outline summary {
  color: var(--panda-ink);
  font-weight: 650;
  cursor: pointer;
}
.panda-document-outline ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 28px;
  margin: 18px 0 0;
  padding-left: 20px;
}
.panda-document-outline li,
.panda-document-links li { font-size: 14px; line-height: 1.65; }
.panda-document-outline a,
.panda-document-links a {
  color: var(--panda-green-700);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.panda-document-links {
  max-width: var(--panda-reading-width);
  margin: 36px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--panda-hairline);
  font-size: 14px;
  line-height: 1.65;
}
.panda-document-links p { margin: 0 0 12px; font-size: 14px; font-weight: 650; }
.panda-document-links ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Complete page index. */
.panda-site-index {
  padding: clamp(72px, 8vw, 112px) 0 clamp(88px, 10vw, 136px);
  background: var(--panda-haze);
}

.panda-site-index__intro {
  max-width: 820px;
  margin-bottom: clamp(64px, 8vw, 96px);
}

.panda-site-index__intro .section-label {
  margin: 0 0 16px;
}

.panda-site-index__intro h2 {
  margin: 0 0 20px;
  color: var(--panda-ink);
  font-size: 36px;
  font-weight: 400;
  line-height: 1.25;
}

.panda-site-index__intro > p:last-child {
  max-width: 700px;
  margin: 0;
  color: var(--panda-body);
  font-size: 18px;
  line-height: 1.75;
}

.panda-index-group + .panda-index-group {
  margin-top: 72px;
  padding-top: 64px;
  border-top: 1px solid var(--panda-hairline);
}

.panda-index-group__heading {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 30px;
}

.panda-index-group__heading > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--panda-hairline);
  border-radius: 50%;
  color: var(--panda-green-700);
  background: var(--panda-paper);
  font-size: 12px;
  font-weight: 800;
}

.panda-index-group__heading p,
.panda-index-group__heading h2 {
  margin: 0;
}

.panda-index-group__heading p {
  margin-bottom: 4px;
  color: var(--panda-green-700);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.panda-index-group__heading h2 {
  color: var(--panda-ink);
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 500;
}

.panda-index-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.panda-index-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 260px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid var(--panda-hairline);
  border-radius: 20px;
  background: var(--panda-paper);
  box-shadow: var(--card-shadow);
  color: var(--panda-body);
  text-decoration: none;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.panda-index-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--panda-green-600) 40%, var(--panda-hairline));
  box-shadow: 0 24px 52px -26px rgba(199, 53, 87, 0.30);
}

.panda-index-card__type {
  margin-bottom: 34px;
  color: var(--panda-green-700);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panda-index-card h3 {
  margin: 0 0 12px;
  color: var(--panda-ink);
  font-size: 22px;
  line-height: 1.3;
}

.panda-index-card p {
  display: -webkit-box;
  margin: 0 0 24px;
  overflow: hidden;
  color: var(--panda-muted);
  font-size: 14px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.panda-index-card__path {
  margin-top: auto;
  padding-right: 34px;
  overflow: hidden;
  color: var(--panda-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panda-index-card__arrow {
  position: absolute;
  right: 26px;
  bottom: 24px;
  color: var(--panda-coral);
  font-size: 19px;
}

@media (max-width: 980px) {
  .panda-index-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .panda-document-outline ol { grid-template-columns: minmax(0, 1fr); }

  .panda-index-grid {
    grid-template-columns: 1fr;
  }

  .panda-index-card {
    min-height: 230px;
  }
}

@media (max-width: 640px) {
  .panda-editorial-page { padding: 64px 0; }
  .panda-prose { font-size: 16px; }
  .panda-prose h2 { font-size: 28px; }
  .panda-page--policy .panda-prose h2 { font-size: 26px; }
}

@media (max-width: 480px) {
  .panda-site-index { padding-top: 56px; }

  .panda-index-group__heading {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 14px;
  }

  .panda-index-card {
    padding: 24px;
  }
}
