/* ---------- #mobile-system ---------- */
/* phones only (max-width 560px): the same phone system as the home and What We Do */
@media (max-width: 559px) {
  /* one rhythm: 48px between sections (the pinned band keeps its own spacing) */
  main > section:not(.hscroll) { padding-block: 48px !important; }
  /* text and buttons centered, buttons stacked */
  section h1, section h2, section h3, section p { text-align: center !important; }
  section h2 + p, section h1 + p { margin-top: 12px; }
  /* nothing spills past the screen */
  img, canvas, svg, video, iframe { max-width: 100%; }
  section h1 { font-size: clamp(28px, 9.2vw, 44px); overflow-wrap: break-word; }
  /* closing (pre-footer): graphic on the top hairline, buttons 24px apart, no box lines */
  section.closing:not(.hero):not(.hscroll) { position: relative; padding-top: 0 !important; padding-bottom: 0 !important; }
  section.closing:not(.hero):not(.hscroll)::before { content: ""; display: block; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--color-border); z-index: 3; pointer-events: none; }
  section.closing .closing__cell, section.closing .closing__cell.is-in { clip-path: none !important; }
  section.closing .closing__art { min-height: 0 !important; height: 160px; margin-inline: -12px !important; }
  section.closing .closing__main { padding-bottom: 0 !important; text-align: center; align-items: center; }
  section.closing .closing__main p { text-align: center !important; }
  .closing__cta, .closing__cta--2 { padding-inline: var(--gutter) !important; }
  .closing__cta { padding: 24px var(--gutter) 12px !important; }
  .closing__cta--2 { padding: 12px var(--gutter) 24px !important; }
  .endgrid .hl--h[style*="left:"] { display: none !important; }
  .endgrid .hl--v.hl--edge[style*="left: 24px"] { left: 12px !important; }
  .endgrid .hl--v.hl--edge[style*="left: 351px"] { left: calc(100% - 13px) !important; }

  /* footer: box between the side lines, one hairline at the page edge */
  footer { padding-top: 24px !important; padding-bottom: 48px !important; background-image: linear-gradient(var(--color-border), var(--color-border)) !important; background-repeat: no-repeat !important; background-size: 100% 1px !important; background-position: 0 100% !important; }
  .footer__inner { margin-inline: 12px !important; width: auto !important; }
  /* ---------- #mobile-hero ---------- */
  /* Why Granule Labs, phones: title, text, button, line, graphic, line; same frame as the home and What We Do */
  main > section.pg-hero--grid { padding-bottom: 0 !important; }
  section.pg-hero--grid { position: relative; display: flex; flex-direction: column; padding-top: 32px !important; background-image: linear-gradient(var(--color-border), var(--color-border)); background-repeat: no-repeat; background-size: 100% 1px; background-position: 0 36px; }
  section.pg-hero--grid::before, section.pg-hero--grid::after { content: ""; display: block; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--color-border); border: 0; pointer-events: none; z-index: 1; }
  section.pg-hero--grid::before { left: 12px; right: auto; }
  section.pg-hero--grid::after { left: auto; right: 12px; }
  section.pg-hero--grid .hlines--spot, section.pg-hero--grid .hl--v:not(.hl--edge), section.pg-hero--grid .hl--h { display: none !important; }   /* only the frame edges and the two hairlines show on phones */
  section.pg-hero--grid > .pg-hero__cell { border: 0 !important; border-top: 0 !important; border-bottom: 0 !important; }   /* the cell borders are the desktop grid, not used on phones */
  section.pg-hero--grid > .pg-hero__cell--text .pg-hero__sub, section.pg-hero--grid > .pg-hero__cell:not(.pg-hero__cell--text) .btn { margin-block: 0 !important; }
  section.pg-hero--grid > .pg-hero__title { padding-bottom: 0 !important; order: 1; text-align: center !important; font-size: clamp(28px, 9.2vw, 40px) !important; padding-inline: 20px; margin: 0 !important; }
  section.pg-hero--grid > .pg-hero__cell--text { order: 2; text-align: center !important; padding: 29px 20px 0 !important; margin-top: 0; }
  section.pg-hero--grid > .pg-hero__cell--text .pg-hero__sub { text-align: center !important; }
  section.pg-hero--grid > .pg-hero__cell:not(.pg-hero__cell--text) { order: 3; display: flex; justify-content: center; padding: 0 20px; margin-top: 31px; }   /* the paragraph line-height adds space above and below its text: this makes the visible gaps equal */
  section.pg-hero--grid > .pg-hero__visual { margin-inline: 0 !important; left: 0; right: 0; width: 100% !important; order: 4; position: relative; width: 100%; height: 240px; margin-top: 72px; padding-top: 24px; border-top: 1px solid var(--color-border); box-sizing: border-box; }
  section.pg-hero--grid > .pg-hero__visual canvas { position: absolute !important; inset: 24px 12px 0 !important; width: calc(100% - 24px) !important; height: calc(100% - 24px) !important; }
  /* ---------- #mobile-feat ---------- */
  /* Why Us, phones: each reason centered, its icon above the title */
  .pg-feat__item { display: flex !important; flex-direction: column; align-items: center; text-align: center; padding: 24px 20px !important; gap: 8px; }
  .pg-feat__item h3, .pg-feat__item p { margin: 0 !important; }
  /* ---------- #mobile-tools ---------- */
  /* Why Granule Labs, phones: tool cards without the empty space around the logo */
  .pg-tool { padding: 24px 20px !important; gap: 16px !important; text-align: center !important; }
  .pg-tool__logo { height: 56px !important; }
  .pg-tool p { margin: 0 !important; }
}


/* ---------- #gap-fixes ---------- */

/* ---------- #tablet-why ---------- */
/* Why Granule Labs, tablet only (561px to 900px): centered hero, headings, text and buttons, buttons in a row, the frame lines 12px in, the same closing and footer as the home */
@media (min-width: 560px) and (max-width: 759px) {
  section.pg-hero--grid { position: relative; display: flex; flex-direction: column; padding-top: 48px !important; padding-bottom: 0 !important; background-image: linear-gradient(var(--color-border), var(--color-border)); background-repeat: no-repeat; background-size: 100% 1px; background-position: 0 0; }
  section.pg-hero--grid > .pg-hero__cell { border: 0 !important; }
  section.pg-hero--grid > .pg-hero__title { order: 1; text-align: center !important; padding-inline: 36px; margin: 0 auto !important; max-width: none !important; width: 100%; box-sizing: border-box; padding-bottom: 0 !important; justify-self: stretch; grid-column: auto !important; }
  section.pg-hero--grid > .pg-hero__cell--text { order: 2; text-align: center !important; padding: 24px 36px 0 !important; margin-top: 0; }
  section.pg-hero--grid > .pg-hero__cell--text .pg-hero__sub { text-align: center !important; margin-inline: auto; }
  section.pg-hero--grid > .pg-hero__cell:not(.pg-hero__cell--text) { order: 3; display: flex; justify-content: center; padding: 0 36px; margin-top: 32px; }
  section.pg-hero--grid > .pg-hero__visual { order: 4; position: relative; width: 100% !important; height: 260px; margin: 56px 0 0 !important; left: 0; right: 0; border-top: 1px solid var(--color-border); }
  section.pg-feat .pg-feat__head { text-align: center; }
  section.pg-rows .pg-head, section.pg-tools .pg-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding-inline: 36px; }
  section.pg-rows .pg-intro { margin-inline: auto; }
  section.pg-tools .pg-tool { text-align: center !important; }
  section.pg-tools .pg-tool__logo { margin-inline: auto; }
  section.pg-partner-sec { position: relative; }
  section.pg-partner-sec > .hlines > i[style*="width: 1px"] { display: none !important; }
  section.pg-partner-sec::before, section.pg-partner-sec::after { content: ""; display: block; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--color-border); border: 0; pointer-events: none; z-index: 1; }
  section.pg-partner-sec::before { left: 12px; right: auto; }
  section.pg-partner-sec::after { left: auto; right: 12px; }
  section.pg-tools > .hlines > i[style*="width: 1px"] { display: none !important; }
  /* hero spacing: 48px above the heading and 48px between the buttons and the graphic line */
  section.pg-hero--grid { padding-top: 92px !important; }
  section.pg-hero--grid > .pg-hero__visual { margin-top: 92px !important; }
  /* ---------- #tablet-fixes ---------- */
  /* tablet (561px to 900px): the footer box has a hairline on its bottom edge and one on the top edge of the footer, both across the whole screen width (as on Contact); the hero's script-drawn hairlines are hidden (the frame is the 12px lines only) */
  section.pg-hero .hlines { display: none !important; }
  main > section:not(.hscroll) > .hlines > i:not([class]) { display: none !important; }
  /* 821px to 900px: the same as 561px to 820px: sections are the full width with no own side borders, the stray vertical hairlines and the desktop column lines are hidden */
  /* ---------- #tablet-from-mobile-system ---------- */
  /* phones only (max-width 560px): the same phone system as the home and What We Do */
  /* one rhythm: 48px between sections (the pinned band keeps its own spacing) */
  main > section:not(.hscroll) { padding-block: 48px !important; }
  /* text and buttons centered, buttons stacked */
  section:not(.pg-feat) h1, section:not(.pg-feat) h2, section:not(.pg-feat) h3, section:not(.pg-feat) p, section.pg-feat .pg-feat__head h2 { text-align: center !important; }
  section h2 + p, section h1 + p { margin-top: 12px; }
  /* nothing spills past the screen */
  img, canvas, svg, video, iframe { max-width: 100%; }
  section h1 { font-size: clamp(28px, 9.2vw, 44px); overflow-wrap: break-word; }
  /* ---------- #tablet-from-mobile-hero ---------- */
  /* Why Granule Labs, phones: title, text, button, line, graphic, line; same frame as the home and What We Do */
  main > section.pg-hero--grid { padding-bottom: 0 !important; }
  section.pg-hero--grid { position: relative; display: flex; flex-direction: column; padding-top: 32px !important; background-image: linear-gradient(var(--color-border), var(--color-border)); background-repeat: no-repeat; background-size: 100% 1px; background-position: 0 36px; }
  section.pg-hero--grid::before, section.pg-hero--grid::after { content: ""; display: block; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--color-border); border: 0; pointer-events: none; z-index: 1; }
  section.pg-hero--grid::before { left: 12px; right: auto; }
  section.pg-hero--grid::after { left: auto; right: 12px; }
  section.pg-hero--grid .hlines--spot, section.pg-hero--grid .hl--v:not(.hl--edge), section.pg-hero--grid .hl--h { display: none !important; }   /* only the frame edges and the two hairlines show on phones */
  section.pg-hero--grid > .pg-hero__cell { border: 0 !important; border-top: 0 !important; border-bottom: 0 !important; }   /* the cell borders are the desktop grid, not used on phones */
  section.pg-hero--grid > .pg-hero__cell--text .pg-hero__sub, section.pg-hero--grid > .pg-hero__cell:not(.pg-hero__cell--text) .btn { margin-block: 0 !important; }
  section.pg-hero--grid > .pg-hero__title { padding-bottom: 0 !important; order: 1; text-align: center !important; font-size: clamp(28px, 9.2vw, 40px) !important; padding-inline: 20px; margin: 0 !important; }
  section.pg-hero--grid > .pg-hero__cell--text { order: 2; text-align: center !important; padding: 29px 20px 0 !important; margin-top: 0; }
  section.pg-hero--grid > .pg-hero__cell--text .pg-hero__sub { text-align: center !important; }
  section.pg-hero--grid > .pg-hero__cell:not(.pg-hero__cell--text) { order: 3; display: flex; justify-content: center; padding: 0 20px; margin-top: 31px; }   /* the paragraph line-height adds space above and below its text: this makes the visible gaps equal */
  section.pg-hero--grid > .pg-hero__visual { margin-inline: 0 !important; left: 0; right: 0; width: 100% !important; order: 4; position: relative; width: 100%; height: 240px; margin-top: 72px; padding-top: 24px; border-top: 1px solid var(--color-border); box-sizing: border-box; }
  section.pg-hero--grid > .pg-hero__visual canvas { position: absolute !important; inset: 24px 12px 0 !important; width: calc(100% - 24px) !important; height: calc(100% - 24px) !important; }
  /* ---------- #tablet-from-mobile-tools ---------- */
  /* Why Granule Labs, phones: tool cards without the empty space around the logo */
  .pg-tool { padding: 24px 20px !important; gap: 16px !important; text-align: center !important; }
  .pg-tool__logo { height: 56px !important; }
  .pg-tool p { margin: 0 !important; }
  /* ---------- #feat-821-900-padding ---------- */
  /* Why Granule Labs, 821px to 900px: no padding above or below the "Delivered by engineers" section */
  /* ---------- #partner-821-lines ---------- */
  /* Why Granule Labs, 821px to 900px: the ClickHouse section shows its hairlines again, as from 901px up */
  /* ---------- #hero-tablet-spacing ---------- */
  /* Why Granule Labs, 561px to 900px: less space above the hero heading and between the hero text and its graphic */
  main > section.pg-hero--grid > .pg-hero__title { padding-top: 32px !important; }
  main > section.pg-hero--grid > .pg-hero__visual { margin-top: 46px !important; }
  /* the hero graphic fills its whole space, up to the top of its box */
  main > section.pg-hero--grid > .pg-hero__visual canvas { inset: 0 12px 0 !important; width: calc(100% - 24px) !important; height: 100% !important; }
}
/* the closing section, with the footer frame and lines it shares, stays stacked up to 939px, where its button first fits two columns (a section breakpoint) */
@media (min-width: 560px) and (max-width: 939px) {
  section.closing .closing__cell { display: flex !important; flex-wrap: wrap !important; justify-content: center !important; align-items: center !important; column-gap: 16px !important; grid-template-columns: none !important; }
  section.closing .closing__cell > .closing__art, section.closing .closing__cell > .closing__main { flex: 0 0 100% !important; width: 100% !important; grid-area: auto !important; }
  section.closing .closing__cell > .closing__cta, section.closing .closing__cell > .closing__cta--2 { flex: 0 0 auto !important; grid-area: auto !important; padding: 48px 24px 24px !important; }
  section.closing .closing__cta .btn, section.closing .closing__cta--2 .btn { width: auto !important; }
  section.closing .closing__art { min-height: 0 !important; height: 160px; margin-inline: -12px !important; border-bottom: 1px solid var(--color-border) !important; }
  section.closing .closing__main { padding-bottom: 0 !important; text-align: center; }
  .endgrid > .hlines > .hl--v:not(.hl--edge) { display: none !important; }
  .endgrid > .hlines > .hl--v.hl--edge:nth-child(6) { left: 12px !important; right: auto !important; top: 0 !important; bottom: 0 !important; height: auto !important; translate: none !important; }
  .endgrid > .hlines > .hl--v.hl--edge:nth-child(7) { left: auto !important; right: 12px !important; top: 0 !important; bottom: 0 !important; height: auto !important; translate: none !important; }
  /* the pre-footer: no line between the body text and the buttons */
  .endgrid > .hlines > .hl--h[style*="top: 380px"] { display: none !important; }
  footer { position: relative !important; padding-top: 24px !important; padding-bottom: 48px !important; }
  footer::before { content: ""; display: block; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--color-border); pointer-events: none; }
  footer::after { content: ""; display: block; position: absolute; left: 0; right: 0; bottom: 48px; height: 1px; background: var(--color-border); pointer-events: none; }
  /* closing (pre-footer): graphic on the top hairline, buttons 24px apart, no box lines */
  section.closing:not(.hero):not(.hscroll) { position: relative; padding-top: 0 !important; padding-bottom: 0 !important; }
  section.closing:not(.hero):not(.hscroll)::before { content: ""; display: block; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--color-border); z-index: 3; pointer-events: none; }
  section.closing .closing__cell, section.closing .closing__cell.is-in { clip-path: none !important; }
  section.closing .closing__art { min-height: 0 !important; height: 160px; margin-inline: -12px !important; }
  section.closing .closing__main { padding-bottom: 0 !important; text-align: center; align-items: center; }
  section.closing .closing__main p { text-align: center !important; }
  .closing__cta, .closing__cta--2 { padding-inline: var(--gutter) !important; }
  .closing__cta { padding: 24px var(--gutter) 12px !important; }
  .closing__cta--2 { padding: 12px var(--gutter) 24px !important; }
  .endgrid .hl--h[style*="left:"] { display: none !important; }
  .endgrid .hl--v:not(.hl--edge) { display: none !important; }
  .endgrid .hl--v.hl--edge[style*="left: 24px"] { left: 12px !important; }
  .endgrid .hl--v.hl--edge[style*="left: 351px"] { left: calc(100% - 13px) !important; }

  /* footer: box between the side lines, one hairline at the page edge */
  footer { padding-top: 24px !important; padding-bottom: 48px !important; background-image: linear-gradient(var(--color-border), var(--color-border)) !important; background-repeat: no-repeat !important; background-size: 100% 1px !important; background-position: 0 100% !important; }
  .footer__inner { margin-inline: 12px !important; width: auto !important; }
  /* ---------- #prefooter-phone-look ---------- */
  /* What We Do, 561px to 635px: the pre-footer buttons look as they do on the phone: stacked, the same width, 24px apart */
  /* ---------- #prefooter-art-full ---------- */
  /* What We Do, 561px to 900px: the pre-footer graphic fills the space between the two 12px edge lines */
  section.closing .closing__cell > .closing__art { flex: none !important; align-self: stretch !important; width: calc(100% + 24px) !important; margin-inline: -12px !important; }
  section.closing .closing__art canvas { left: 1px !important; right: 1px !important; width: calc(100% - 2px) !important; }
  /* no empty space between the pre-footer buttons and the footer box */
  footer { padding-top: 0 !important; }
  /* 24px of space between the last pre-footer button and the footer box */
  section.closing .closing__cell > .closing__cta--2 { padding-bottom: 24px !important; }
  section.closing .closing__cell > .closing__cta:not(.closing__cta--2) { padding-bottom: 0 !important; }
    section.closing .closing__cell > .closing__cta:not(.closing__cta--2), section.closing .closing__cell > .closing__cta--2 { padding: 24px 24px 48px !important; }
  /* the two 12px edge lines: the left one stays on the left, whatever its position in the list */
  .endgrid > .hlines > .hl--v.hl--edge[style*="left: 12px"] { left: 12px !important; right: auto !important; }
  .endgrid > .hlines > .hl--v.hl--edge:not([style*="left: 12px"]) { left: auto !important; right: 12px !important; }
}

/* ---------- logo sizes (were inline styles; !important keeps them as strong) ---------- */
img[src="img/logo-openai.png"] { width: 97px !important; height: 27px !important; }
img[src="img/logo-aws.png"] { width: 66px !important; height: 39px !important; }
img[src="img/logo-dbt.png"] { width: 85px !important; height: 31px !important; }
img[src="img/logo-cube.png"] { width: 93px !important; height: 28px !important; }
img[src="img/logo-anthropic.png"] { width: 152px !important; height: 17px !important; }
img[src="img/logo-factory-ai.png"] { width: 131px !important; height: 20px !important; }
img[src="img/logo-cognition.png"] { width: 110px !important; height: 24px !important; }

/* Section hand-offs (fix G10): the page runs dark, lighter, dark. The ClickHouse section sits on the lifted surface,
   closes on a full-width band of customer logos, and the tools section opens with a diagram of how the stack fits. */
.pg-partner-sec { background: var(--color-surface-2); }
.pg-partner-sec > .pg-ch__block:has(.pg-users__grid) { margin: 0 calc(-1 * var(--pad)) calc(-1 * var(--space-24));
  padding: var(--space-12) var(--pad); border-top: 1px solid var(--color-border); background: var(--color-surface-0); text-align: center; }
.pg-partner-sec > .pg-ch__block:has(.pg-users__grid) .pg-ch__sub { margin-bottom: var(--space-8); }
.pg-partner-sec .pg-users__grid, .pg-partner-sec .pg-users__grid li { border: 0; }
.pg-partner-sec .pg-users__grid a { height: 120px; }
.pg-partner-sec .pg-users__mark svg { width: 38px; height: 38px; }
.pg-partner-sec .pg-users__grid li:nth-child(3) .pg-users__mark svg { width: 66px; height: 66px; }   /* Visa */
.pg-partner-sec .pg-users__grid li:nth-child(5) .pg-users__mark svg { width: 78px; height: 78px; }   /* Sony */
.pg-partner-sec .pg-users__grid li:nth-child(7) .pg-users__mark svg { width: 58px; height: 58px; }   /* Cisco */
@media (max-width: 759px) {
  .pg-partner-sec > .pg-ch__block:has(.pg-users__grid) { margin-inline: -12px; margin-bottom: -48px; padding: 40px 12px; }
  .pg-partner-sec .pg-users__grid a { height: auto; }
}
/* the stack diagram: wide from 1100px, side-by-side from 760px, a compact side-by-side below */
.pg-tools__dia { grid-column: 1 / -1; margin: var(--space-12) var(--pad) 0; }
.pg-tools__dia svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.pg-tools__dia-wide { max-width: 1000px; }
.pg-tools__dia-mid, .pg-tools__dia-tall { display: none !important; }
.pg-tools__dia-mid { max-width: 680px; }
.pg-tools__dia-tall { max-width: 520px; }
/* tablets: a column of agents beside the stack, so the agents still sit to the side of every layer, as on desktop */
@media (min-width: 760px) and (max-width: 1099px) {
  .pg-tools__dia-wide { display: none !important; }
  .pg-tools__dia-mid { display: block !important; }
}
/* phones and small tablets: the same layout, compact, with smaller labels */
@media (max-width: 759px) {
  .pg-tools__dia-wide { display: none !important; }
  .pg-tools__dia-tall { display: block !important; }
}
/* the tool cards share one hairline grid: five across on wide screens */
.pg-tools__grid { gap: 1px; background: var(--color-border); border: 1px solid var(--color-border); }
.pg-tools .pg-tool { border: 0; background: var(--color-surface-1); }
.pg-tools .pg-tool:hover { background: color-mix(in srgb, var(--color-off-white) 4%, var(--color-surface-1)); }
@media (min-width: 1100px) { .pg-tools__grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 760px) and (max-width: 1099px) {
  /* three then two, as in the stack diagram above: the agents and the cloud, then the semantic layer (dbt, Cube);
     no card sits alone on a row */
  .pg-tools__grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .pg-tools .pg-tool { grid-column: span 2; }
  .pg-tools .pg-tool:nth-child(n+4) { grid-column: span 3; }
}
@media (max-width: 759px) { .pg-tools__grid { grid-template-columns: minmax(0, 1fr); } }   /* one column until three fit across */

/* Section spacing (fix G10): every section keeps 48px between its edge and its content on phones and 96px from 760px
   up, unless something runs to the edge. The rule is in CLAUDE.md; tests/section-spacing.spec.mjs checks it. */
@media (max-width: 759px) {
  body main > section.pg-hero--grid > .pg-hero__visual { margin-bottom: 48px !important; }
  body main > section.pg-feat .pg-feat__head { padding-top: 0 !important; }
  body main > section.pg-feat { padding-bottom: 24px !important; }   /* the last item keeps 24px of its own */
}
/* the ecosystem intro runs the width its heading does, not the narrow intro column */
.pg-tools .pg-intro { max-width: 46em; }
