/* ==========================================================================
   THE GRID
   One unit drives everything: the baseline (--line), the height of one line
   of text. Margins, gutters, text positions and image sizes are all whole
   lines (or half a line), so every element sits on the same structure.

   Desktop: 12 columns, 2-line margins, half-line gutters.
   Phone:    4 columns, 1-line margins, half-line gutters.
   grid.js fills in --rows (how many whole lines fit between the margins)
   and the image size/position, which depend on the window height.
   ========================================================================== */

:root {
	--line: 14px;                       /* baseline: one line of text */
	--margin: calc(var(--line) * 2);    /* 28px around the page */
	--gutter: calc(var(--line) / 2);    /* 7px between columns and between images */
	--cols: 12;
	--bottom-gap: var(--margin);        /* set by grid.js so the last line sits on a baseline */
	--sig-size: 2.4;                    /* signature height, in lines (2 lines + 20%) */
	--sig-lines: 3;                     /* whole lines kept clear for it; text starts below */
}
@media (max-width: 767px) {
	:root { --margin: var(--line); --cols: 4; }
}

/* text: 10.5px type on an exact 14px line */
body { font-size: 10.5px; line-height: var(--line); }

/* ---------- text on the grid ----------
   lines 1-3: signature (--sig-size lines tall, inside --sig-lines), column 1. Nothing else on these lines.
   line 3: project title (column 1) and role (ending at column 12)
   last two lines: Contact / Selected Clients (column 1), Index (ending at column 12) */
.tl  { top: var(--margin); left: var(--margin); }
.tl2 { top: calc(var(--margin) + var(--line) * var(--sig-lines)); left: var(--margin); }
.tr  { top: calc(var(--margin) + var(--line) * var(--sig-lines)); right: var(--margin); }

/* the signature: a whole number of lines tall, so the grid below it stays intact */
.tl, .tl .signature { display: block; }
.tl .signature { height: calc(var(--line) * var(--sig-size)); width: auto; }
.bl  { bottom: var(--bottom-gap); left: var(--margin); }
.br  { bottom: var(--bottom-gap); right: var(--margin); }

/* clients page: the list starts on line 3, under the signature, on column 1 */
.clients-page { padding: calc(var(--margin) + var(--line) * var(--sig-lines)) var(--margin) calc(var(--line) * 6); }

/* pop-up lists: white box sits half a line around the text, so the text itself
   stays on column 1 and on baselines, with one empty line above Contact */
.pop {
	margin: 0 0 calc(var(--line) / 2) calc(var(--gutter) * -1);
	padding: calc(var(--line) / 2) var(--line) calc(var(--line) / 2) var(--gutter);
}

/* ---------- project images on the grid ----------
   height = a whole number of lines, top edge on a baseline, first image on column 1,
   gaps = one gutter */
.project .strip {
	align-items: flex-start;
	gap: var(--gutter);
	padding: var(--img-top, 0) var(--margin) 0;
}
.project .item .media { height: var(--img-h, 56vh); }

/* ---------- grid overlay (press G) ---------- */
.grid-overlay {
	position: fixed;
	inset: 0;
	z-index: 15;
	pointer-events: none;
}
.grid-overlay[hidden] { display: none; }
.grid-overlay .cols {
	position: absolute;
	inset: 0 var(--margin);
	display: grid;
	grid-template-columns: repeat(var(--cols), 1fr);
	column-gap: var(--gutter);
}
.grid-overlay .cols i { background: rgba(255, 40, 90, 0.07); border-left: 1px solid rgba(255, 40, 90, 0.18); border-right: 1px solid rgba(255, 40, 90, 0.18); }
.grid-overlay .rows {
	position: absolute;
	left: 0; right: 0;
	top: var(--margin);
	height: calc(var(--rows, 40) * var(--line));
	background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line) - 1px), rgba(0, 140, 255, 0.35) calc(var(--line) - 1px), rgba(0, 140, 255, 0.35) var(--line));
	border-top: 1px solid rgba(0, 140, 255, 0.35);
}
