/* Structural rails for the editorial modules only. The approved opening and
   interactive media keep their own layout, painting, and motion systems. */
body.editorial {
  --ruled-width: 92%;
  --ruled-max: 1440px;
  --ruled-columns: 12;
  --ruled-gutter: clamp(20px, 2.2vw, 32px);
  --ruled-inset: clamp(18px, 2vw, 28px);
  --ruled-space: clamp(48px, 5.2vw, 76px);
  --ruled-line: #bcb7ad;
}

/* One outer rail pair. Borders occupy the module edges, never its images. */
body.editorial:is(.homepage-reorganized, .moving-edit) :is(.story-editorial, .featured-albums, .social-showcase,
  .album-directory, .album-page, .studio-opening, .studio-process,
  .studio-films, .studio-faq, .editorial-ending, .es-wrap,
  .contact-inner, .folio-footer) {
  box-sizing: border-box;
  position: relative;
  width: var(--ruled-width);
  max-width: var(--ruled-max);
  margin-inline: auto;
  padding-inline: var(--ruled-inset);
  border-inline: 1px solid var(--ruled-line);
}

/* The same tracks govern copy and module headings, including the form/footer. */
body.editorial :is(.story-editorial, .collection-intro, .video-intro,
  .album-page-heading, .studio-opening, .studio-process, .studio-faq,
  .editorial-section-heading, .editorial-ending, .es-hero-heading,
  .es-approach, .es-brief, .es-process, .es-faq, .es-section-top,
  .es-service-index, .contact-inner, .folio-footer) {
  display: grid;
  grid-template-columns: repeat(var(--ruled-columns), minmax(0, 1fr));
  column-gap: var(--ruled-gutter);
  align-items: start;
}

/* A spine occupies a real empty gutter. It ends before photographic bands. */
body.editorial :is(.story-editorial, .studio-process, .studio-faq,
  .es-approach, .es-brief, .es-process, .es-faq, .contact-inner)::before {
  content: '';
  position: absolute;
  inset-block: 0;
  left: calc(25% + var(--ruled-inset) * .5 - var(--ruled-gutter) * .25);
  width: 1px;
  background: var(--ruled-line);
  pointer-events: none;
}

/* Four approved paragraphs, one continuous reading area, unchanged body type. */
body.editorial.homepage-reorganized .story-editorial {
  grid-template-rows: auto;
  row-gap: 0;
  padding-block: var(--ruled-space);
  border-top: 1px solid var(--ruled-line);
  height: auto;
  min-height: 0;
}
body.editorial.homepage-reorganized .story-editorial .home-story-heading {
  display: block;
  grid-column: 1 / span 3;
  grid-row: 1;
}
body.editorial.homepage-reorganized .story-editorial .story-reading {
  grid-column: 4 / -1;
  grid-row: 1;
  width: 100%;
  max-width: 72ch;
  margin: 0;
  font-size: clamp(16px, 1.45vw, 18px);
  line-height: 1.62;
}
body.editorial.homepage-reorganized .story-reading p + p { margin-top: 24px; }
body.editorial.homepage-reorganized .home-story h2 {
  font-size: clamp(44px, 4.2vw, 64px);
  line-height: .94;
  margin: 22px 0 24px;
}
body.editorial.homepage-reorganized .home-story-founders { margin-bottom: 0; }

/* Collection and motion headings share the Story spine; media stays unruled. */
body.editorial.homepage-reorganized :is(.featured-albums, .social-showcase) {
  padding-block: var(--ruled-space);
  border-top: 1px solid var(--ruled-line);
}
body.editorial.homepage-reorganized :is(.collection-intro, .video-intro) {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0 0 30px;
  padding: 0 0 28px;
  border-bottom: 1px solid var(--ruled-line);
}
body.editorial.homepage-reorganized :is(.collection-intro, .video-intro)::before {
  content: '';
  position: absolute;
  inset-block: calc(-1 * var(--ruled-space)) 0;
  left: calc(25% - var(--ruled-gutter) * .25);
  width: 1px;
  background: var(--ruled-line);
  pointer-events: none;
}
body.editorial.homepage-reorganized .collection-kicker { grid-column: 1 / span 3; }
body.editorial.homepage-reorganized .collection-intro h2 { grid-column: 4 / span 6; }
body.editorial.homepage-reorganized .album-directory-link { grid-column: 10 / span 3; align-self: end; }
body.editorial.homepage-reorganized .social-showcase h2 { grid-column: 4 / -1; }

/* Directory and album photographs remain complete native-ratio compositions. */
body.editorial :is(.album-directory, .album-page) { padding-block: 128px var(--ruled-space); }
body.editorial .album-page-heading {
  position: relative;
  row-gap: 18px;
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--ruled-line);
}
body.editorial .album-page-heading .folio-kicker { grid-column: 1 / span 3; grid-row: auto; }
body.editorial .album-page-heading h1 { grid-column: 4 / -1; }
body.editorial .album-page-heading #portfolio-count { grid-column: 4 / -1; margin: 0; }
body.editorial .album-back { grid-column: 1 / -1; margin-bottom: 8px; }
body.editorial .directory-grid {
  grid-template-columns: repeat(var(--ruled-columns), minmax(0, 1fr));
  gap: var(--ruled-space) var(--ruled-gutter);
}
body.editorial .directory-album { grid-column: 1 / span 6; }
body.editorial .directory-album:nth-child(even) { grid-column: 7 / span 6; margin-top: 72px; }
body.editorial .album-cover { width: calc(75% - var(--ruled-gutter) * .25); margin-bottom: var(--ruled-space); }
body.editorial .album-photo-grid { column-gap: var(--ruled-gutter); }
body.editorial .album-return {
  margin-top: var(--ruled-space);
  padding-top: 22px;
  border-top: 1px solid var(--ruled-line);
}

/* Studio: a six/six opening, then the consistent label/reading split. */
body.editorial .studio-opening { padding-block: 128px var(--ruled-space); row-gap: 28px; }
body.editorial .studio-heading { grid-column: 1 / span 6; grid-row: 1; }
body.editorial .studio-work-image { grid-column: 8 / -1; grid-row: 1 / span 2; padding-top: 0; }
body.editorial .studio-story { grid-column: 1 / span 6; grid-row: 2; padding-top: 0; }
body.editorial :is(.studio-process, .studio-faq, .studio-films, .editorial-ending) {
  padding-block: var(--ruled-space);
  border-top: 1px solid var(--ruled-line);
}
body.editorial :is(.studio-process, .studio-faq) > div:first-child { grid-column: 1 / span 3; }
body.editorial :is(.studio-process, .studio-faq) > :last-child { grid-column: 4 / -1; }
body.editorial :is(.studio-process, .studio-faq) h2 { font-size: clamp(38px, 3.7vw, 56px); }
body.editorial .editorial-section-heading { row-gap: 12px; margin-bottom: 32px; }
body.editorial .editorial-section-heading > .folio-kicker { grid-column: 1 / span 3; grid-row: 1; }
body.editorial .editorial-section-heading > h2 { grid-column: 4 / -1; grid-row: 1; margin: 0; }
body.editorial .editorial-section-heading > p:last-child { grid-column: 4 / -1; }
body.editorial .studio-film-grid { grid-template-columns: 6fr 3fr 3fr; gap: var(--ruled-gutter); }
body.editorial .editorial-ending > h2 { grid-column: 1 / span 6; }
body.editorial .editorial-ending > a { grid-column: 8 / -1; justify-self: end; align-self: end; }

/* Services keep their existing prose, photography, clips and native frames. */
body.editorial .es-page .es-hero { padding-top: 128px; padding-bottom: var(--ruled-space); }
body.editorial .es-page .es-hero-heading { max-width: none; row-gap: 16px; }
body.editorial .es-page .es-hero-heading > .es-kicker { grid-column: 1 / span 3; }
body.editorial .es-page .es-hero-heading > h1 { grid-column: 4 / -1; margin-top: 0; }
body.editorial .es-page .es-hero-spread { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--ruled-gutter); }
body.editorial .es-page .es-hero-spread > .es-cover { grid-column: 1 / span 8; }
body.editorial .es-page .es-hero-spread > .es-cover-note { grid-column: 9 / -1; }
body.editorial .es-page .es-hero--portrait .es-cover { grid-column: 1 / span 6; margin-inline: auto; }
body.editorial .es-page .es-hero--portrait .es-cover-note { grid-column: 8 / -1; }
body.editorial .es-page :is(.es-approach, .es-brief, .es-process, .es-faq) {
  padding-block: var(--ruled-space);
  border-top-color: var(--ruled-line);
}
body.editorial .es-page :is(.es-approach, .es-brief, .es-process, .es-faq) > :first-child { grid-column: 1 / span 3; }
body.editorial .es-page :is(.es-approach, .es-brief, .es-process, .es-faq) > :last-child { grid-column: 4 / -1; }
body.editorial .es-page :is(.es-approach, .es-brief, .es-process, .es-faq) h2 { font-size: clamp(38px, 3.7vw, 56px); }
body.editorial .es-page :is(.es-objectives, .es-selection, .es-motion) { padding-block: var(--ruled-space); border-top-color: var(--ruled-line); }
body.editorial .es-page .es-section-top { row-gap: 20px; margin-bottom: 36px; }
body.editorial .es-page .es-section-top > :first-child { grid-column: 1 / span 6; }
body.editorial .es-page .es-section-top > :last-child { grid-column: 8 / -1; }
body.editorial .es-page .es-photo-spreads { column-gap: var(--ruled-gutter); }
body.editorial .es-page .es-motion { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--ruled-gutter); }
body.editorial .es-page .es-motion-copy { grid-column: 1 / span 6; }
body.editorial .es-page .es-film { grid-column: 8 / -1; }
body.editorial .es-page .es-service-index { margin-bottom: 0; border-bottom: 0; border-top-color: var(--ruled-line); }
body.editorial .es-page .es-service-index > span { grid-column: 1 / span 3; }
body.editorial .es-page .es-service-index > div { grid-column: 4 / -1; }

/* The actual contact module owns its rails, not the surrounding full-width band.
   No form fields, controls, consent, or interaction rules are restyled here. */
body.editorial .contact,
body.editorial.homepage-reorganized .home-inquiry .contact { padding-block: 0; border-top: 0; }
body.editorial .contact-inner {
  row-gap: 32px;
  padding-block: var(--ruled-space);
  border-top: 1px solid var(--ruled-line);
}
body.editorial .inquiry-page .contact-inner { padding-top: 128px; }
body.editorial .contact-inner > .contact-copy { grid-column: 1 / span 3; }
body.editorial .contact-inner > .inquiry { grid-column: 4 / -1; min-width: 0; }
body.editorial .contact-copy :is(h1, h2),
body.editorial .es-page .contact .contact-copy .display { font-size: clamp(38px, 3.7vw, 56px); }
body.editorial .contact-copy .email-link { max-width: 100%; overflow-wrap: anywhere; }
body.editorial .folio-footer {
  padding-block: 30px 22px;
  row-gap: 24px;
  border-top: 1px solid var(--ruled-line);
}
body.editorial .folio-footer > div:first-child {
  grid-column: 1 / span 3;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}
body.editorial .folio-footer > nav {
  grid-column: 4 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 var(--ruled-gutter);
  min-width: 0;
}
body.editorial .folio-footer > nav { position: relative; }
body.editorial .folio-footer > nav::before {
  content: '';
  position: absolute;
  inset-block: -30px -24px;
  left: calc(var(--ruled-gutter) * -.5);
  width: 1px;
  background: var(--ruled-line);
  pointer-events: none;
}
body.editorial .folio-footer > .folio-footer-end {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 20px;
  border-top: 1px solid var(--ruled-line);
}

@media (max-width: 1100px) and (min-width: 761px) {
  body.editorial { --ruled-columns: 6; --ruled-gutter: 24px; --ruled-inset: 22px; }
  body.editorial.homepage-reorganized .story-editorial { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  body.editorial.homepage-reorganized .story-editorial .story-reading { font-size: 17px; }
  body.editorial.homepage-reorganized .home-story h2 { font-size: 44px; }
  body.editorial.homepage-reorganized :is(.collection-intro, .video-intro),
  body.editorial :is(.album-page-heading, .studio-process, .studio-faq, .editorial-section-heading,
    .es-hero-heading, .es-approach, .es-brief, .es-process, .es-faq, .es-service-index,
    .contact-inner, .folio-footer) { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  body.editorial .directory-album { grid-column: 1 / span 3; }
  body.editorial .directory-album:nth-child(even) { grid-column: 4 / span 3; }
  body.editorial .studio-heading, body.editorial .studio-story { grid-column: 1 / span 3; }
  body.editorial .studio-work-image { grid-column: 4 / -1; }
  body.editorial .studio-heading h1 { font-size: 58px; }
  body.editorial .editorial-ending > h2 { grid-column: 1 / span 3; }
  body.editorial .editorial-ending > a { grid-column: 4 / -1; }
  body.editorial .es-page .es-section-top > :first-child { grid-column: 1 / span 3; }
  body.editorial .es-page .es-section-top > :last-child { grid-column: 4 / -1; }
  body.editorial .folio-footer > nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.editorial .contact-copy :is(h1, h2),
  body.editorial .es-page .contact .contact-copy .display { font-size: 38px; }
}

@media (max-width: 760px) {
  body.editorial { --ruled-width: 92%; --ruled-columns: 4; --ruled-gutter: 18px; --ruled-inset: 16px; --ruled-space: 42px; }
  /* On a narrow screen only the outside rails and real section breaks remain. */
  body.editorial :is(.story-editorial, .studio-process, .studio-faq, .es-approach,
    .es-brief, .es-process, .es-faq, .contact-inner)::before,
  body.editorial.homepage-reorganized :is(.collection-intro, .video-intro)::before,
  body.editorial .folio-footer > nav::before { content: none; }
  body.editorial :is(.story-editorial, .collection-intro, .video-intro,
    .album-page-heading, .studio-opening, .studio-process, .studio-faq,
    .editorial-section-heading, .editorial-ending, .es-hero-heading,
    .es-approach, .es-brief, .es-process, .es-faq, .es-section-top,
    .es-service-index, .contact-inner, .folio-footer) { grid-template-columns: minmax(0, 1fr); row-gap: 24px; }
  body.editorial.homepage-reorganized .story-editorial { grid-template-columns: minmax(0, 1fr); }
  body.editorial.homepage-reorganized .story-editorial .home-story-heading { grid-column: 1; grid-row: 1; }
  body.editorial.homepage-reorganized .story-editorial .story-reading { grid-column: 1; grid-row: 2; max-width: none; font-size: 17px; line-height: 1.6; }
  body.editorial.homepage-reorganized .home-story h2 { font-size: 46px; margin-block: 18px 20px; }
  body.editorial.homepage-reorganized :is(.collection-intro, .video-intro) { padding-bottom: 24px; margin-bottom: 24px; }
  body.editorial.homepage-reorganized :is(.collection-kicker, .collection-intro h2, .album-directory-link, .social-showcase h2) { grid-column: 1; margin: 0; }
  body.editorial.homepage-reorganized .album-directory-link { justify-content: start; }
  body.editorial :is(.album-directory, .album-page, .studio-opening) { padding-top: 98px; }
  body.editorial .album-page-heading > :is(.folio-kicker, h1, #portfolio-count, .album-back) { grid-column: 1; grid-row: auto; margin: 0; }
  body.editorial .album-page-heading h1 { font-size: clamp(44px, 12vw, 58px); }
  body.editorial .directory-grid { grid-template-columns: minmax(0, 1fr); }
  body.editorial .directory-album, body.editorial .directory-album:nth-child(even) { grid-column: 1; width: 100%; margin: 0; }
  body.editorial .album-cover { width: 100%; }
  body.editorial .album-photo-grid { grid-template-columns: minmax(0, 1fr); }
  body.editorial .studio-opening { display: grid; }
  body.editorial :is(.studio-heading, .studio-story, .studio-work-image) { grid-column: 1; grid-row: auto; }
  body.editorial .studio-work-image { width: min(100%, 420px); justify-self: end; }
  body.editorial .studio-heading h1 { font-size: clamp(43px, 11.5vw, 55px); }
  body.editorial :is(.studio-process, .studio-faq, .editorial-ending) > *,
  body.editorial .editorial-section-heading > :is(.folio-kicker, h2, p:last-child) { grid-column: 1; grid-row: auto; }
  body.editorial .editorial-ending > a { justify-self: start; }
  body.editorial .studio-film-grid { grid-template-columns: minmax(0, 1fr); row-gap: 32px; }
  body.editorial .studio-film-grid > figure:first-child { width: 100%; }
  body.editorial .studio-film-grid > figure { grid-column: 1; }
  body.editorial .es-page .es-hero { padding-top: 98px; }
  body.editorial .es-page .es-hero-heading > :is(.es-kicker, h1) { grid-column: 1; }
  body.editorial .es-page .es-hero-spread { display: flex; gap: 28px; }
  body.editorial .es-page :is(.es-approach, .es-brief, .es-process, .es-faq, .es-section-top, .es-service-index) > * { grid-column: 1; }
  body.editorial .es-page .es-motion { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  body.editorial .es-page :is(.es-motion-copy, .es-film) { grid-column: 1; }
  body.editorial .contact-inner > :is(.contact-copy, .inquiry) { grid-column: 1; }
  body.editorial .inquiry-page .contact-inner { padding-top: 98px; }
  body.editorial .folio-footer > div:first-child,
  body.editorial .folio-footer > nav,
  body.editorial .folio-footer > .folio-footer-end { grid-column: 1; }
  body.editorial .folio-footer > nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.editorial .folio-footer > .folio-footer-end { flex-direction: column; align-items: start; }
}

/* Mobile photo width repair: undo only this module's 92% shell, text insets,
   and two rail borders. Percentages resolve against the actual page content
   width, so a desktop scrollbar never adds the overflow that 100vw would. */
@media (max-width: 760px) {
  body.editorial.homepage-reorganized .featured-albums { overflow: visible; }
  body.editorial.homepage-reorganized .featured-albums > #collection-carousel {
    --photo-page-width: calc((100% + 2 * var(--ruled-inset) + 2px) / .92);
    width: var(--photo-page-width);
    max-width: none;
    margin-inline: calc((100% - var(--photo-page-width)) / 2);
  }
}
