/* ImagineIf — the layout floor.
 *
 * WHY THIS FILE EXISTS. `site.css` is the client's own 117 KB of hand-written CSS with its
 * selectors renamed off Divi (1,081 of 1,095 rules). Those rules were written to layer ON TOP OF
 * Divi's base stylesheet — its reset, its flexbox grid, its module defaults — and a selector
 * rename does not bring that base across. This is the replacement for it: the smallest floor
 * those 1,081 rules need in order to mean what they meant.
 *
 * SCOPE DISCIPLINE. Nothing here is a design choice. Every value is either measured from the
 * live site (the 1080px content width, the 767px breakpoint, the gutter) or is the arithmetic a
 * column fraction requires. §5.1: a token we invent is a visual change we were not paid to make.
 *
 * COLUMN VARIANTS. Exactly the nine that appear in the migrated content, no more:
 *   4_4 (144x)  1_2 (144x)  1_3 (93x)  1_5 (85x)  1_6 (12x)  1_4 (6x)  2_5 (3x)  3_5 (3x)  2_3 (1x)
 * A variant with no width rule is a column that collapses, so `build.py` guard 1 asserts every
 * variant used has a rule here.
 */

/* ---- reset: only what Divi's base provided and site.css assumes ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img, video, iframe { max-width: 100%; height: auto; border: 0; }
a { text-decoration: none; color: inherit; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
p { margin: 0 0 1em; }
h1, h2, h3, h4, h5, h6 { margin: 0 0 0.5em; font-weight: 500; }
table { border-collapse: collapse; width: 100%; }

/* ---- the section / row / column skeleton ----
 * Divi's own measurements: a section is full-bleed with vertical padding, a row is a centred
 * 1080px track, columns are flex children separated by a 5.5% gutter (Divi's gutter width 3).
 */
.sec { position: relative; padding: 4% 0; }
.row {
  width: 80%;
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  /* NOWRAP on purpose — this is what Divi's .iif-row does, measured at 1440 on the live site:
   * 4 rows nowrap/flex, 4 nowrap/block, 1 wrap/flex; ours had all 9 wrapping. A Divi column is a
   * flex item that SHRINKS to fit the line (flex-shrink:1), so three 1/3 columns whose images are
   * intrinsically 527+404+437 = 1368 get squeezed into the 1238 row as 458+351+380. With wrap they
   * instead keep their content width and spill onto extra lines: on the-happy-homeworkers-club
   * that turned live's tidy 3-across gallery into 2+1+1+1 and the page ran +866px. Nineteen
   * desktop pages carried an excess in the same 820-890px band.
   * Mobile re-enables wrap below, because live wraps there too (5 wrap/flex at 390) — that is how
   * the 100%-width columns stack instead of overflowing. */
  flex-wrap: nowrap;
  align-items: flex-start;
  position: relative;
}
/* no clearfix: .row is a flex container, so a float clear would be dead code. (Flagged by an
 * independent reviewer — it was carried over from habit, not from anything Divi needed.) */
.row-inner { width: 100%; max-width: none; margin: 0; }

/* Divi's "equal columns" row stretches its columns to the row's height. That is not cosmetic:
   a column whose only content is a background image (iif-column-empty) collapses to 1px
   without it, which is how the hero photo on /bespoke-education-experience/ went missing. */
.row.iif-equal-columns { align-items: stretch; }

/* Our generic list typography is for CONTENT lists. Divi resets lists to margin:0;padding:0 and
   builds the nav out of <ul>/<li>, so letting the content rule through added 1em under the menu
   and 1.25em of indent inside the header bar -- 28px of header height on all 98 pages. */
header ul, header ol, footer ul, footer ol,
nav ul, nav ol, .iif-menu, .iif-menu ul, .mobile-menu, .mobile-menu ul {
  margin: 0;
  padding-left: 0;
}

.col { position: relative; min-height: 1px; margin-right: 5.5%; }
.col:last-child, .col.is-last { margin-right: 0; }

/* widths = (100% - gutters) x fraction, the arithmetic Divi's grid does */
.col-4_4 { width: 100%;   margin-right: 0; }
.col-1_2 { width: 47.25%; }
.col-1_3 { width: 29.6667%; }
.col-2_3 { width: 64.8333%; }
.col-1_4 { width: 20.875%; }
.col-1_5 { width: 15.6%; }
.col-1_6 { width: 12.0833%; }
.col-2_5 { width: 36.7%; }
.col-3_5 { width: 57.8%; }
.col-empty { width: auto; margin-right: 0; }

/* gutter scale — site.css addresses these by name after the rename */
.gutters-1 > .col { margin-right: 0; }
.gutters-2 > .col { margin-right: 3%; }
.gutters-3 > .col { margin-right: 5.5%; }
.gutters-4 > .col { margin-right: 8%; }

/* ---- module wrappers ---- */
.m { position: relative; }
.m-image img { display: block; }
.m-text > :last-child { margin-bottom: 0; }
.has-border { border-style: solid; }
.container { width: 80%; max-width: 1080px; margin: 0 auto; }

/* ---- header / footer chrome ---- */
header, footer { position: relative; }
header .row, footer .row { width: 90%; }

/* the 26-item menu: a real <nav> with nested lists, no framework */
.nav-list, .nav-list ul { list-style: none; margin: 0; padding: 0; }
.nav-list { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2em; }
.nav-list li { position: relative; }
.nav-list > li > ul {
  position: absolute; top: 100%; left: 0; min-width: 16em;
  display: none; z-index: 20; padding: 0.5em 0;
}
.nav-list > li:hover > ul,
.nav-list > li:focus-within > ul { display: block; }
.nav-list > li > ul li a { display: block; padding: 0.4em 1em; }

/* mobile nav — §5.3 names the 26-item menu as the single most likely point of visual failure,
 * so it is a <details> element: it opens with no JavaScript at all and cannot fail to open. */
.mobile-nav { display: none; }
.mobile-nav summary { cursor: pointer; list-style: none; padding: 0.6em 0; }
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-menu, .mobile-menu ul { list-style: none; margin: 0; padding: 0; }
.mobile-menu a { display: block; padding: 0.5em 0; }
.mobile-menu ul { padding-left: 1em; }

/* ---- blog listing ---- */
.blog-grid { display: flex; flex-wrap: wrap; gap: 5.5%; }
/* The client's own stylesheet turns this into a flex ROW —
 * `.blog_section .row .blog-grid-inner { display:flex; width:100% }` (specificity 0,3,0) beats
 * our `display:contents`. On the LIVE site that row's children are salvattore's `.column`
 * wrappers (Divi's blog grid ships a JS masonry script that re-parents the posts into columns:
 * 3 on desktop, 1 on mobile). Our static build has no salvattore, so the 9 post cards become the
 * flex items DIRECTLY — and nothing sets flex-wrap, so they all sat on one line, shrank, and
 * overflowed. Chrome then shrink-to-fits the whole page: at a 390px device our mobile
 * innerWidth measured 863 against live's 390, with 28 overflowing elements against live's 0.
 * That is why every mobile page read short (resource-blog live 5880px vs ours 1197px) and why
 * mobile scored 79.00 against desktop's 87.62.
 * So the inner carries the wrap and gap the grid was holding; where the client rule does not
 * match, `display:contents` still wins and these are inert. */
.blog-grid-inner { display: contents; flex-wrap: wrap; gap: 5.5%; align-items: flex-start; }
/* Scoped to the listing on purpose. Divi's `iif-post` names TWO different things -
 * the <article> on a single-post page and a card in the blog grid - and migrate.py
 * renames both to .post-card. Unscoped, this 3-column card width was sizing the article
 * on all 48 single posts to 236px inside an 855px column, wrapping the body text into
 * ~4x the lines and making every post page roughly TWICE the live height (atomic-habits
 * live 2910px vs ours 6009px). The above-the-fold instrument could not see it: the top
 * 900px still scored 94%. Same collision class as v1 cycle 3's `.col.i-2`.
 * Scoping here rather than renaming the wrapper, because the translated Divi rules that
 * legitimately target .post-card DO apply to single posts on the live site too. */
.blog-grid .post-card { width: 29.6667%; margin-bottom: 5.5%; }
.post-card img { display: block; width: 100%; }
.pagination { display: flex; gap: 1em; margin: 2em 0; }

/* ---- toggle / accordion: state classes the recovered JS drives ---- */
.m-toggle .toggle-body { display: none; }
.m-toggle.is-open .toggle-body { display: block; }

/* ---- the one breakpoint that carries the responsive behaviour ----
 * Measured: max-width:767px has 1,708 declarations behind it and min-width:768px has 700.
 * Everything else in the recovered CSS is a one-off targeted fix, already carried in site.css.
 */
@media (max-width: 767px) {
  .row { width: 90%; flex-wrap: wrap; }   /* live wraps at 390; that is how columns stack */
  .col,
  .col-1_2, .col-1_3, .col-2_3, .col-1_4, .col-1_5, .col-1_6, .col-2_5, .col-3_5 {
    width: 100%;
    margin-right: 0;
    margin-bottom: 30px;
  }
  .col:last-child { margin-bottom: 0; }
  .nav-list { display: none; }
  .mobile-nav { display: block; }
  .blog-grid .post-card { width: 100%; }
}
