/* =============================================================================
   Portfolio v2 — homepage
   -----------------------------------------------------------------------------
   Page-only styles. Everything shared with the case studies (the site nav,
   the tokens, the column grid) lives in system.css.

   Built in sections, matching how the page is being designed. So far:
   the banner. The rest of the homepage arrives underneath it.
   ============================================================================= */


/* ------------------------------------------------- homepage-only tokens --- */

:root {
	--text-name: 100px;               /* "Vivian Zhang" */
	--home-portrait: 140px;           /* the square headshot */
	--home-wash-height: 474px;        /* the purple band; the watercolor goes here later */
	--text-section: 60px;             /* "Notable Projects" and the section titles under it */
	--cs-image-ratio: 1.39;           /* the screenshot box, from the mock's 753 x 541 */
	--cs-image-max: 680px;            /* ...but never taller than this on a big screen */
	--cs-title: 51px;                 /* a one-line case-study title; JS re-measures each one */
	--stack-gap: 4px;                 /* daylight above the topmost pinned title */
	--home-dark: #1D1A28;             /* the dark first screen; Vivian's tuning, a touch
	                                     darker and greyer than --color-banner. Must equal
	                                     the "All dark" background in js/watercolor/params.js */
}


/* --------------------------------------------------------------- banner --- */

/* Three things on one row, borrowing the same columns as a case study's
   banner (--full-width-columns), so the name lines up with the paragraph
   column on a case-study page:

     | margin |      side      | gap |   text ->              | spare | margin |
              ^ the tagline           ^ the name                ^ the headshot,
                                                                  pushed right   */
.home_intro {
	display: grid;
	grid-template-columns: var(--full-width-columns);
	align-items: center;
	/* Lopsided on purpose, following the mock: a lot of air above the name,
	   then it sits down close to the purple. */
	padding: var(--space-60) 0 var(--space-10);
}
/* All three share one row. Without this the browser fills the grid in
   source order and drops the tagline onto a second row, because its column
   is to the LEFT of the name's and it never places an item backwards. */
.home_tagline,
.home_name,
.home_portrait {
	grid-row: 1;
}

/* Left of everything, at the margin. Plain text, deliberately not links. */
.home_tagline {
	grid-column: side;
	font-size: var(--text-body);
	font-weight: var(--weight-light);
	line-height: var(--leading-body);
	color: var(--color-ink);
}

.home_name {
	grid-column: text-start / mid-end;
	font-size: var(--text-name);
	font-weight: var(--weight-bold);
	line-height: var(--leading-tight);
	letter-spacing: var(--tracking-display);
	color: var(--color-banner);
}

.home_portrait {
	grid-column: mid-end / content-end;
	justify-self: end;
	width: var(--home-portrait);
	height: var(--home-portrait);
	overflow: hidden;
}
.home_portrait img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* The purple band under the banner. Still painted, so the banner looks
   finished before the watercolour loads and if it never does. */
.home_wash {
	height: var(--home-wash-height);
	background: var(--color-banner);
}

/* The dotted watercolour (js/home-watercolor.js): one layer behind the
   whole first screen. It reaches up behind the nav row too, so its top
   edge is the top of the window, not the line under the nav. The intro
   sits above it; the purple band sits below it and shows until the dots
   fade in. */
.home_banner {
	position: relative;
}
.home_watercolor {
	position: absolute;
	top: calc(-1 * var(--nav-row-height));
	right: 0;
	bottom: 0;
	left: 0;
	opacity: 0;
	transition: opacity var(--duration-fast) ease;
}
.home_watercolor.is_ready {
	opacity: 1;
}
.home_intro {
	position: relative;
	z-index: 1;
}
/* At its home spot the nav row lets the dots show through. Pinned (you
   scrolled back up) it is white again, like every other page. */
body:has(.home_watercolor) .site_nav:not(.is_pinned) {
	background: transparent;
}

/* An experiment with the whole first screen dark (theme 'dark' in
   params.js, set on <html> by js/home-watercolor.js). The text over it
   turns white, the way it does over a case study's banner. */
[data-home-theme="dark"] .home_name,
[data-home-theme="dark"] .home_tagline,
[data-home-theme="dark"] .site_nav:not(.is_pinned) .site_links a {
	color: var(--color-on-banner);
}
[data-home-theme="dark"] .site_nav:not(.is_pinned) .site_links a:hover {
	color: var(--color-on-banner-muted);
}
/* The VZ square inverts so it still reads against the dark: white square,
   dark letters. Pinned, the row is white again and so is the usual logo. */
[data-home-theme="dark"] .site_nav:not(.is_pinned) .site_logo {
	background: var(--color-on-banner);
	color: var(--color-banner);
}
[data-home-theme="dark"] .site_nav:not(.is_pinned) .site_logo:hover {
	background: var(--color-logo);
}

/* The dark first screen before the watercolour has loaded (and for good,
   if it can't): the banner and the strip behind the nav row go dark, so
   the page doesn't flash white first. The canvas covers both once it
   fades in. data-home-theme is written into index.html's <html> tag for
   exactly this reason — JS would come too late. */
[data-home-theme="dark"] .home_banner {
	background: var(--home-dark);
}
[data-home-theme="dark"] .home_banner::before {
	content: "";
	position: absolute;
	top: calc(-1 * var(--nav-row-height));
	right: 0;
	left: 0;
	height: var(--nav-row-height);
	background: var(--home-dark);
}

/* With no purple band (themes 'light' and 'dark') the banner is the
   first screen: the band collapses, and the intro runs from under the nav
   row to the bottom of the window. Its row centres in the WINDOW, top to
   bottom, not in the space under the nav: the extra nav-row-height of
   padding at the bottom balances the nav row at the top. min-height, so
   on a very short window the content still fits and the page grows.
   svh is the window with a phone's browser bars showing, so the centre
   doesn't jump as they slide away. */
[data-home-theme="light"] .home_wash,
[data-home-theme="dark"] .home_wash {
	height: 0;
}
[data-home-theme="light"] .home_intro,
[data-home-theme="dark"] .home_intro {
	box-sizing: border-box;
	min-height: calc(100vh - var(--nav-row-height));
	min-height: calc(100svh - var(--nav-row-height));
	padding-top: var(--space-10);
	padding-bottom: calc(var(--space-10) + var(--nav-row-height));
	align-content: center;
}


/* ----------------------------------------------------- notable projects --- */

/* Four case studies, each a title in the left column and a big screenshot
   that starts at the paragraph column's line and runs off the right edge of
   the screen.

   The titles pin. As you scroll, the ones you have passed pile up at the top
   of the window and the ones you have not reached yet wait at the bottom.
   That is all `position: sticky` with BOTH a top and a bottom offset: a
   sticky box floats freely between the two and parks against whichever one
   it reaches. js/notable-projects.js sets the offsets, because they depend
   on how tall each title turns out to be once it has wrapped.

   The one structural rule: the titles are flat siblings of the case-study
   bodies inside .case_studies. A sticky box can only travel inside its own
   parent, so a title wrapped up with its own case study could never reach
   the bottom of the screen to wait its turn. */

/* No bottom padding: the last screenshot already carries --space-20 under
   it, which is the same gap that separates one case study from the next.
   Adding the section's own padding on top of that left a long empty run
   before Personal Projects. */
.notable_projects {
	padding: 0;
}
.notable_projects > h2 {
	padding: var(--space-8) var(--gutter);
	font-size: var(--text-section);
	font-weight: var(--weight-bold);
	line-height: var(--leading-tight);
	letter-spacing: var(--tracking-display);
	color: var(--color-ink);
}

.case_studies {
	display: grid;
	grid-template-columns: var(--full-width-columns);
}

/* The pinning title. Opaque, because the case study's own text scrolls
   underneath it. `top` carries --nav-offset so the whole stack slides down
   in step with the nav row appearing, instead of being covered by it; the
   transition matches the row's so they move together. */
.cs_title {
	grid-column: side;
	/* don't stretch to the row: the screenshot beside it is far taller */
	align-self: start;
	position: sticky;
	/* Where this title parks at the top, and how far it can rise.

	   --cs-before / --cs-after are the stacked heights of the titles above
	   and below it. --stack-anchor is where the stack hangs from: normally
	   the top of the window (--nav-offset for the nav row, --stack-gap for
	   the daylight above the first line), but while the section's own top
	   edge is still on screen, that edge instead. That is what makes the
	   titles arrive one under another as the section scrolls in, rather
	   than all landing on the section's top edge in a pile. Once the stack
	   has formed, the anchor reaches the top of the window and the first
	   title pulls away from the rest.

	   js/notable-projects.js measures the three of them. */
	top: calc(var(--stack-anchor, calc(var(--nav-offset) + var(--stack-gap))) + var(--cs-before, 0px));
	bottom: var(--cs-after, 0px);
	z-index: 3;
	display: flex;
	/* the space between number and name — and, on hover, between the
	   arrow and the number */
	--cs-title-gap: var(--space-5);
	gap: var(--cs-title-gap);
	padding: var(--space-3) 0 var(--space-4);
	background: var(--color-paper);
	font-size: var(--text-body);
	font-weight: var(--weight-bold);
	line-height: var(--leading-snug);
	color: var(--color-ink);
	transition: top var(--duration-fast) ease, color var(--duration-fast);
}
/* While the stack hangs off the section's moving top edge, the anchor
   changes every frame — easing it would leave the titles lagging behind the
   scroll. The easing is only there for the nav row sliding in. */
.case_studies.is_anchored .cs_title {
	transition: color var(--duration-fast);
}
/* A band of page colour sitting just above the line, the height of the
   gap. Only the first title needs it: it is the only one that parks with
   daylight above it, and without the band the case study would be seen
   scrolling through that gap. On the others it showed as a white strip
   clipping the text above the line. A shadow rather than padding, because
   it must sit outside the line, and it changes nothing about the layout. */
.cs_title:first-child {
	box-shadow: 0 calc(-1 * var(--stack-gap)) 0 var(--color-paper);
}
/* The rule above the title. Drawn rather than a border, because the title's
   white has to reach both screen edges — the case study scrolls underneath
   it — while the rule itself keeps the page's margin at each end. */
.cs_title::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: var(--stroke-hairline);
	background: var(--color-ink);
}
.cs_title:hover {
	color: var(--color-brand);
}

/* The hover arrow. It waits, invisible, just left of the number — one
   arrow-width plus the usual gap — and on hover fades in as the arrow, the
   number and the name all slide right by that same distance. So the arrow
   seems to push the row along, and it ends up as far from the number as
   the number is from the name.

   Sliding rather than adding real space, so the title never re-wraps or
   changes height mid-hover: the pinned stack is measured from those
   heights. Only where there is a real pointer. */
@media (hover: hover) {
	.cs_title {
		--cs-arrow-shift: calc(1em + var(--cs-title-gap));
	}
	/* --icon-arrow-right, one line of text tall so it sits level with the
	   first line of a title that wraps */
	.cs_title::after {
		content: "";
		order: -1;
		flex-shrink: 0;
		width: 1em;
		height: 1lh;
		background: currentColor;
		-webkit-mask: var(--icon-arrow-right) center / 1em no-repeat;
		mask: var(--icon-arrow-right) center / 1em no-repeat;
		margin-left: calc(-1 * var(--cs-arrow-shift));
		opacity: 0;
	}
	.cs_title::after,
	.cs_number,
	.cs_name {
		transition:
			transform var(--duration-fast) ease,
			opacity var(--duration-fast) ease;
	}
	.cs_title:hover::after,
	.cs_title:hover .cs_number,
	.cs_title:hover .cs_name {
		transform: translateX(var(--cs-arrow-shift));
	}
	.cs_title:hover::after {
		opacity: 1;
	}
}
/* Two digits wide even when it holds something narrower — the grid icon
   on More Projects — so every name starts on the same line. */
.cs_number {
	flex-shrink: 0;
	min-width: 2ch;
}

/* More Projects. Until it is clicked, the case studies after it are not
   there at all; js/notable-projects.js then adds .is_open to
   .case_studies, which shows them and removes the More Projects row
   itself. One way only — there is no closing it again. */
.case_studies:not(.is_open) .cs_more,
.case_studies.is_open .cs_toggle {
	display: none;
}
/* Its icon: a grid, in the number's slot, at the size of the words and in
   their colour (it turns brand on hover with them). Drawn exactly like the
   hover arrow beside it (.cs_title::after): a box one line tall with the
   icon centred in it at 1em, so the two share a middle and line up. */
.cs_icon_grid::before {
	content: "";
	display: block;
	width: 1em;
	height: 1lh;
	background: currentColor;
	-webkit-mask: var(--icon-grid) center / 1em no-repeat;
	mask: var(--icon-grid) center / 1em no-repeat;
}

/* Left column: the summary and the Company / Role / Year row. Ordinary
   content — it scrolls, and slides under the title above it.

   It is also a link into the case study, and part of one hover area with
   the screenshot: anywhere over the words, the empty space under them, or
   the screenshot shows the same label, with no gap where it drops out.
   So the box is bigger than the words in it: it stretches to the full
   height of the case study, and runs right across the gap until it meets
   the screenshot. The words keep to the side column (padding-right) and
   to the paragraph measure (on the children, not the box). */
.cs_text {
	display: block;   /* a link: inline on a phone, where the grid is off */
	grid-column: side-start / text-start;
	align-self: stretch;
	padding-top: var(--space-10);
	padding-right: var(--gutter);
	/* The same gap the screenshot carries below it. Either of the two can
	   be the taller, and whichever it is has to hold the next case study
	   off: on a narrow window the words run on well past the screenshot. */
	padding-bottom: var(--space-20);
}
.cs_text > * {
	max-width: var(--measure-text);
}
.cs_summary {
	font-size: var(--text-caption);
	font-weight: var(--weight-light);
	line-height: var(--leading-body);
}
.cs_meta {
	display: flex;
	gap: var(--space-8);
	padding-top: var(--space-10);
	font-size: var(--text-caption);
}
.cs_meta dt {
	font-weight: var(--weight-bold);
}
.cs_meta dd {
	font-weight: var(--weight-light);
}

/* The screenshot: starts on the paragraph column's line — the same line the
   nav links and "Vivian Zhang" sit on — and runs off the right edge of the
   screen. Inset from the top and left of its backdrop, bleeding off the
   right, the way the mock crops it. The whole thing is the link into the
   case study. */
.cs_image {
	/* It is a link, so it is inline unless told otherwise. The grid makes
	   it a block anyway, but on a phone the grid is off and without this it
	   falls back to inline and quietly ignores its width and margins. */
	display: block;
	grid-column: text-start / edge-end;
	/* The screenshot sits in the summary's row, then is pulled up by
	   exactly the height of the title above it, so its top edge lands level
	   with the rule rather than below the title. The title's height depends
	   on whether its name wraps, so js/notable-projects.js measures it and
	   overrides this default. Being the tallest thing here, the screenshot
	   also sets how tall the case study is, and its bottom margin is the
	   gap before the next one starts. */
	margin-top: calc(-1 * var(--cs-title));
	/* Scales with whatever width its column has, rather than a fixed height
	   that crops differently at every window size. The cap stops it growing
	   absurdly tall on a very wide screen; past that point the extra width
	   just shows more of the screenshot. */
	aspect-ratio: var(--cs-image-ratio);
	max-height: var(--cs-image-max);
	margin-bottom: var(--space-20);
	padding: var(--space-5) 0 0 var(--space-5);
	background: var(--color-surface);
	/* Clip at the inside of the padding rather than the outside, so the
	   screenshot never strays over the inset it sits in, whichever way the
	   hover scales it. Browsers without overflow-clip-margin just clip a
	   little wider. */
	overflow: clip;
	overflow-clip-margin: content-box;
}
.cs_image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 0 0;
}
/* .bare: no backdrop and no inset — the screenshot fills the whole box.
   For screenshots that carry their own background (Vivian's call, per
   image). Two classes, so it still wins over the breakpoints' .cs_image
   rules at the foot of the file. */
.cs_image.bare {
	padding: 0;
	background: none;
}

/* ---------------------------------------------------- personal projects --- */

/* Not built like Notable Projects, on purpose. There is one project, so
   nothing pins and nothing stacks: the heading sits alone out at the
   margin and the project is set in from the paragraph column, the two of
   them on one row.

   A tinted band runs the full width of the screen behind the whole
   section. That colour change is what marks the boundary, which is why
   there is no rule above the heading (system.css: a line only where
   nothing else already marks the boundary).

   The project starts on the paragraph column, the same line the nav links
   and "Vivian Zhang" sit on and the Notable Projects screenshots start
   from. What sets this section apart is the band and the heading out on
   its own, not a different left edge. */
.personal_projects {
	display: grid;
	grid-template-columns: var(--full-width-columns);
	align-items: start;
	background: var(--color-image-bg);
	padding: var(--space-10) 0 var(--space-30);
}
.personal_projects > h2 {
	grid-column: side;
	grid-row: 1;
	font-size: var(--text-section);
	font-weight: var(--weight-bold);
	line-height: var(--leading-tight);
	letter-spacing: var(--tracking-display);
	color: var(--color-ink);
}
/* Paragraph column to the right margin - the width a case study calls
   .to-right-edge. The top padding is the drop between the top of the
   "Personal Projects" heading beside it and the rule: enough that the rule
   is clearly not level with the heading's top edge, not so much that it
   falls to the heading's baseline. */
.pp_project {
	grid-column: text-start / content-end;
	grid-row: 1;
	padding-top: var(--space-8);
}

/* The title under a rule running the project's full width. Same treatment
   as a case-study title in Notable Projects. */
.pp_title {
	display: block;
	border-top: var(--stroke-hairline) solid var(--color-ink);
	/* The padding is split top and bottom exactly as .cs_title splits it,
	   and .pp_body picks up the same --space-10 that .cs_text does, so the
	   gap between a title and its description is the same 56px in both
	   sections. Change one, change the other. */
	padding: var(--space-3) 0 var(--space-4);
	font-size: var(--text-body);
	font-weight: var(--weight-bold);
	line-height: var(--leading-snug);
	color: var(--color-ink);
	transition: color var(--duration-fast);
}
.pp_title:hover {
	color: var(--color-brand);
}

.pp_body {
	margin-top: var(--space-10);
}
.pp_summary {
	max-width: var(--measure-text);
	font-size: var(--text-caption);
	font-weight: var(--weight-light);
	line-height: var(--leading-body);
}

/* The screenshot: shown whole, filling the project's width. No outline -
   it carries its own pale chrome, which reads against the band
   (system.css: frames are the exception, not the default).

   On a big screen it stops where the Notable Projects screenshots stop:
   theirs are capped at --cs-image-max tall, which at their box shape is
   this wide. Change their cap or shape and this follows. */
.pp_image {
	display: block;
	max-width: calc(var(--cs-image-max) * var(--cs-image-ratio));
	margin-top: var(--space-3);
}
.pp_image img {
	width: 100%;
}


/* ---------------------------------------------------------------- about --- */

/* The page above About is one opaque layer (.home_page), stacked over it.
   Same arrangement as a case study's .body_wrapper and More Work footer. */
.home_page {
	position: relative;
	z-index: 1;
	background: var(--color-paper);
}

/* Peek, then scroll — the More Work footer's reveal. Near the end of the
   page About waits pinned underneath it, with only its top strip
   (--about-peek: the heading and the hello line) showing at the bottom of
   the window. Scrolling lifts the page off it; once it is all uncovered it
   scrolls like anything else.

   The footer can do this in CSS alone because it has a fixed height. About
   is as tall as its words, which changes with the width, so
   js/about-reveal.js measures it into --about-height. Without the script
   the offset is invalid and About is simply an ordinary section. */
.about {
	--about-peek: var(--space-60);
	position: sticky;
	bottom: calc(var(--about-peek) - var(--about-height));
	z-index: 0;
	display: grid;
	grid-template-columns: var(--full-width-columns);
	align-items: start;
	padding: var(--space-10) 0 var(--space-12);   /* top: the same as Personal Projects */
	background: var(--color-banner);
	color: var(--color-on-banner);
}
.about > h2 {
	grid-column: side;
	grid-row: 1;
	font-size: var(--text-section);
	font-weight: var(--weight-bold);
	line-height: var(--leading-tight);
	letter-spacing: var(--tracking-display);
}
.about_body {
	grid-column: text;
	grid-row: 1;
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
	font-size: var(--text-body);
	line-height: var(--leading-body);
}
/* "Hey! I'm Vivian" — the banner question's size, so it reads as the
   opening line rather than one more paragraph */
.about_body .about_hello {
	font-size: var(--text-lead);
	font-weight: var(--weight-semibold);
	line-height: var(--leading-snug);
}
/* The reset strips every link; inside running text they need to look like
   links again (as .main_panel p a does on a case study) */
.about_body p a {
	text-decoration: underline;
	text-underline-offset: 0.15em;
	transition: color var(--duration-fast);
}
.about_body a:hover {
	color: var(--color-on-banner-muted);
}
/* LinkedIn, Medium and email as Font Awesome 4 icons, then "CV" as a word.
   The plain "in" and the solid envelope rather than their boxed versions,
   whose corners are rounded (icons are sharp: refresh-v2.md). */
.about_links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2) var(--space-6);
	padding-top: var(--space-5);
	font-weight: var(--weight-semibold);
}
.about_links a {
	transition: color var(--duration-fast);
}
.about_icon::before {
	font-family: var(--font-icon);
	font-size: var(--text-h3);
	font-weight: var(--weight-regular);
	line-height: 1;
}
.icon_linkedin::before { content: "\f0e1"; }
.icon_medium::before { content: "\f23a"; }
.icon_email::before { content: "\f0e0"; }


/* ---------------------------------------------------------- 1000px --- */

@media (max-width: 1000px) {
	:root {
		--text-name: 64px;
		--home-wash-height: 360px;
		--text-section: 40px;
		--cs-image-max: 460px;
	}

	/* There is still room for two columns here, so the side-by-side design
	   stays; only the proportions change. What it stops doing is borrowing
	   the page's full-width columns, because below 1000px those park the
	   content on the right and leave the spare room as an empty lane down
	   the left. Its own two columns start at the left margin instead, and
	   the screenshot still runs off the right edge of the screen. */
	.case_studies {
		grid-template-columns: clamp(220px, 36%, 320px) minmax(0, 1fr);
		column-gap: var(--gutter);
		padding-left: var(--gutter);
	}
	/* smaller and tighter, so the long titles keep to two lines in a
	   narrower column — four wrapped titles is a lot of pinned stack */
	.cs_title {
		--cs-title-gap: var(--space-3);
		font-size: var(--text-caption);
	}
	.notable_projects > h2 {
		padding-left: var(--gutter);
	}
	.cs_title,
	.cs_text {
		grid-column: 1;
	}
	/* Here the space between the columns is a column-gap, not a column, so
	   the text block reaches across it with a negative margin to meet the
	   screenshot (one hover area — see .cs_text above). */
	.cs_text {
		margin-right: calc(-1 * var(--gutter));
	}
	.cs_image {
		grid-column: 2;
	}

	/* The side column has collapsed to nothing here (see system.css), so
	   the three pieces stack at the body's text inset instead: headshot,
	   name, tagline. */
	.home_intro {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: var(--space-6);
		padding-left: var(--lane-offset);
		padding-right: var(--gutter);
		padding-top: var(--space-30);
	}
	.home_portrait {
		order: -1;
	}
	/* Centred in the window, as above. The intro is a column here, so
	   the centring runs down it. Repeated with the theme in front so it
	   outranks this band's own padding-top. */
	[data-home-theme="light"] .home_intro,
	[data-home-theme="dark"] .home_intro {
		padding-top: var(--space-10);
		justify-content: center;
	}

	/* Same move as the case studies above: stop borrowing the page's
	   full-width columns, which below 1000px park the content on the right
	   and leave an empty lane down the left. The heading and the project
	   keep their two columns, starting at the left margin instead. */
	.personal_projects {
		grid-template-columns: clamp(220px, 36%, 320px) minmax(0, 1fr);
		column-gap: var(--gutter);
		padding-left: var(--gutter);
		padding-right: var(--gutter);
	}
	.personal_projects > h2 {
		grid-column: 1;
	}
	.pp_project {
		grid-column: 2;
	}

	/* About follows Personal Projects: two columns from the left margin */
	.about {
		grid-template-columns: clamp(220px, 36%, 320px) minmax(0, 1fr);
		column-gap: var(--gutter);
		padding-left: var(--gutter);
		padding-right: var(--gutter);
	}
	.about > h2 {
		grid-column: 1;
	}
	.about_body {
		grid-column: 2;
		max-width: var(--measure-text);
	}
}


/* ------------------------------------------------- 800px (homepage) --- */

/* A third breakpoint, this page only — the site's other two are 1000px and
   640px (see system.css). The case studies keep their two columns here, but
   the left one is down to about 230–280px, which is too tight for the text
   to breathe at the spacing the wide layout uses.

   It stops at 641px rather than running to zero, because the phone layout
   below has the full width back and keeps its own spacing. */
@media (min-width: 641px) and (max-width: 800px) {
	/* half the space between the title, the summary and the credits -
	   and .pp_body follows it, so Roots' title-to-description gap keeps
	   matching a case study's at this width too */
	.cs_text {
		padding-top: var(--space-3);
	}
	.pp_body {
		margin-top: var(--space-3);
	}
	.cs_meta {
		padding-top: var(--space-5);
		/* Company and Role side by side, Year on a row of its own beneath
		   them — all three will not fit across a column this narrow.

		   Company takes what it needs and Role takes the rest, instead of
		   both taking what they need: a long role ("Lead Designer
		   (Contractor)") is wider than the column and would otherwise run
		   out of it and across the screenshot. Given a share of the column
		   it wraps onto a second line instead. */
		display: grid;
		grid-template-columns: minmax(0, auto) minmax(0, 1fr);
		justify-content: start;
		gap: var(--space-5) var(--space-6);
	}
}


/* ----------------------------------------------------------- 640px --- */

@media (max-width: 640px) {
	:root {
		/* A tighter margin on a phone, Vivian's call. It is the page's one
		   margin token, so the nav row and the banner follow it too — but
		   only on the homepage, since the case studies do not load this
		   file. */
		--gutter: var(--space-4);
		--text-name: 44px;
		--home-portrait: 96px;
		--home-wash-height: 280px;
		--text-section: 30px;
	}

	/* One column at last. The screenshot stops running off the right edge
	   here and keeps the same margin as everything else, so the section has
	   matching space down both sides of the phone. */
	.case_studies {
		display: block;
		padding-left: 0;
	}
	.notable_projects > h2,
	.cs_title,
	.cs_text {
		padding-left: var(--gutter);
		padding-right: var(--gutter);
	}
	/* The title's white still reaches both edges, but its rule stops at the
	   margin like everything else on the page. */
	.cs_title::before {
		left: var(--gutter);
		right: var(--gutter);
	}

	/* The screenshots are shown whole here rather than cropped to a fixed
	   box: at this size a crop of a dense UI screenshot says nothing. Each
	   one keeps its own shape and simply fills the width. */
	.cs_image {
		/* stacked under the summary now, so it is not pulled up level */
		margin: var(--space-4) var(--gutter) var(--space-12);
		aspect-ratio: auto;
		max-height: none;
		padding: var(--space-3);
	}
	.cs_image img {
		height: auto;
		object-fit: contain;
	}

	/* half the space between the rows of text. No gap under them either:
	   the screenshot sits below the words here and carries that itself.
	   .pp_body follows, as it does at every other width. */
	.cs_text {
		padding-top: var(--space-5);
		padding-bottom: 0;
		margin-right: 0;   /* stacked: nothing beside it to reach */
	}
	.pp_body {
		margin-top: var(--space-5);
	}
	.cs_meta {
		padding-top: var(--space-5);
		/* the Company / Role / Year row wraps rather than squeezing */
		flex-wrap: wrap;
		gap: var(--space-4) var(--space-6);
	}

	/* One column at last, like everything else on the phone. The section
	   already carries the margin from the 1000px block above.

	   No margin on .pp_project: stacked, its --space-8 padding is the whole
	   gap between the heading and the rule, and a margin on top of that put
	   the rule a long way from the heading. */
	.personal_projects {
		display: block;
	}

	/* stacked: heading, then the words */
	.about {
		display: block;
	}
	.about_body {
		padding-top: var(--space-6);
	}
}
