/* sumairha.com design system, part 3: the case-study page (8 Oct 2026). Built only from tokens.css and components.css.
 * A case study is a top screen (problem, role and outcome before the first scroll), a frosted section nav, and numbered
 * sections whose title stays beside the text. Pictures follow the theme: dark artwork inverts in light mode (.shot--ink),
 * and a picture with two versions shows the one for the theme (img.v-light / img.v-dark). Press a .shot to open it at full
 * size (lib/lightbox.js); a [data-switch] pill shows one view of several (lib/view-switch.js).
 * Every gap follows the spacing rule in tokens.css: distance follows meaning. */
html{scroll-behavior:smooth}
@media (prefers-reduced-motion: reduce){ html{scroll-behavior:auto} }
.cs{gap:var(--space-2xl)}   /* section to section: 120 */
.cs p,.cs .surface,.cs dl,.cs blockquote{pointer-events:auto}   /* text can be selected; the gaps still let the cursor through to the fluid */

/* the top screen: problem, role and outcome before the first scroll */
.cs-hero{width:min(var(--column),100%);margin:0 auto;display:grid;gap:var(--space-md);padding-top:var(--space-sm)}
.cs-hero__title{display:grid;gap:var(--space-xs)}   /* the eyebrow labels the title */
.cs-hero .cs-figure{margin-top:calc(var(--space-xl) - var(--space-md))}   /* the top screen's text to its picture is a new group: 24 + 56 = 80 */
.cs-hero .type-case{max-width:17ch}
.cs-eyebrow{margin:0;font:var(--type-meta);color:var(--text)}
.cs-lede{max-width:62ch;color:var(--text-strong)}
.cs-facts{display:grid;grid-template-columns:repeat(4,max-content);gap:var(--space-sm) var(--space-lg);margin:0}
.cs-facts dt{font:var(--type-small);color:var(--text)}
.cs-facts dd{margin:var(--space-2xs) 0 0;font:var(--type-meta);color:var(--text-strong)}
@media (max-width:620px){ .cs-facts{grid-template-columns:repeat(2,minmax(0,1fr))} }
.cs-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--space-md);margin:0;padding:var(--space-md) 0 0;list-style:none;border-top:1px solid var(--surface-line)}
.cs-stats li{display:grid;gap:4px;align-content:start}
@media (max-width:520px){ .cs-stats{gap:var(--space-sm)} .cs-hero .cs-stats{order:4} .cs-hero .cs-facts{order:5} .cs-hero .cs-figure,.cs-hero .frame{order:6} }   /* on a phone the outcomes come before the facts, so they stay on the first screen */   /* three across even on a phone, so all three outcomes land on the first screen */
/* pictures follow the theme: the dark wireframes and blueprints turn light in light mode, the way her dark boards would
   look printed, and the ground behind every picture matches */
:root{--shot-bg:#f2f2f2;--ink:invert(1) hue-rotate(180deg)}
:root[data-theme="dark"]{--shot-bg:#0d0d0d;--ink:none}
.frame{margin:0;border-radius:var(--radius-s);overflow:hidden;background:var(--shot-bg);box-shadow:var(--shadow-card)}
.frame img{display:block;width:100%;height:auto}

/* a section: its number and title stay beside the text; wide pictures take the whole column */
.cs-sec{width:min(var(--column),100%);margin:0 auto;display:grid;gap:var(--space-xl);scroll-margin-top:84px}   /* the text column to the wide pictures: 80 */
.cs-sec__main{display:grid;grid-template-columns:minmax(0,250px) minmax(0,1fr);gap:var(--space-xl)}   /* the title column to its text: 80 */   /* the sticky title stops where the text ends, before any wide picture */
.cs-sec__head{position:sticky;top:84px;align-self:start;display:grid;gap:var(--space-xs)}
.cs-sec__body{display:grid;gap:var(--space-md);min-width:0;max-width:720px}
.cs-sec__wide{display:grid;gap:var(--space-sm);min-width:0}
@media (max-width:860px){ .cs-sec,.cs-sec__main{grid-template-columns:minmax(0,1fr);gap:var(--space-md)} .cs-sec__head{position:static} }
.cs-num{margin:0;font:var(--type-meta);color:var(--text)}
.caption{margin:0;max-width:72ch;font:var(--type-small);color:var(--text)}

/* a picture that opens at full size (lib/lightbox.js) */
.shot{display:block;width:100%;padding:0;border:0;border-radius:var(--radius-s);overflow:hidden;background:var(--shot-bg);box-shadow:var(--shadow-card);cursor:zoom-in}
.shot--ink img{filter:var(--ink)}
img.v-dark{display:none !important}
:root[data-theme="dark"] img.v-dark{display:block !important}
:root[data-theme="dark"] img.v-light{display:none !important}
.shot img{display:block;width:100%;height:100%;object-fit:contain}
.shot:focus-visible{outline:2px solid var(--focus);outline-offset:3px}
.shot--matrix{max-width:440px}
.cs-figure--matrix{max-width:440px}   /* the bullseye and its caption share one width */

/* research */
.personas{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-sm);margin:0;padding:0;list-style:none}
@media (max-width:620px){ .personas{grid-template-columns:1fr} }
.persona{padding:var(--space-md);display:grid;gap:4px;align-content:start}
.persona blockquote{margin:var(--space-2xs) 0 0;font:var(--type-small);color:var(--text-strong)}
.persona__who{margin:0;font:var(--type-small);color:var(--text)}   /* who this persona stands for, under the roles */
.persona blockquote{margin-top:var(--space-xs)}
.persona__cares{margin:var(--space-xs) 0 0;padding-top:var(--space-xs);border-top:1px solid var(--surface-line);font:var(--type-small);color:var(--text-strong);display:grid;gap:2px}
.persona__cares span{font:var(--type-meta);color:var(--text)}
.cs-insight{max-width:24ch}
/* a topic inside a section (her note, 29 Oct): Personas, What I learned, a finding. One step below the section's own title and one step above a
   card's title, so a section reads as section, then topics, then cards. A topic opens a group (80 above, from the rules below) and sits 16 from what it heads */
.cs-topic{margin:0;max-width:30ch;font:600 clamp(19px,1.9vw,23px)/1.25 var(--font-display);letter-spacing:-.01em;color:var(--text-strong);text-wrap:balance}
.cs-sec__body > .cs-topic + *{margin-top:calc(var(--space-xs) * -1)}
.cs-sec__body > .cs-topic + p + :not(p):not(.cs-topic){margin-top:0}   /* a topic's own short intro and its cards are one group: 24, not 80 */

/* the design: each screen is the pain it answers, the decision, and the screen, with a switch between wireframe and final */
.screens{display:grid;gap:var(--space-xl);margin:0;padding:0;list-style:none}   /* one screen to the next: 80 */
.screen{display:grid;gap:var(--space-sm)}
.screen__head{display:grid;gap:var(--space-xs);justify-items:start}
.screen__head .pill{margin-top:var(--space-xs)}   /* the text to its own switch: 8 + 8 = 16 */
[data-views] .shot{aspect-ratio:4/3}
[data-views="routing"] .shot,[data-views="dashboard"] .shot{aspect-ratio:16/10}   /* the shape of their Final cards */
.phases [data-views] .shot{aspect-ratio:2.24/1}
.switch-row{display:flex;justify-content:flex-start}
.switch{display:flex;flex-wrap:wrap;gap:6px}   /* each view is its own glass pill, like the filters (her call, 22 Oct); they wrap on a phone instead of pushing the page sideways */
.switch .pill{padding:4px}

/* impact and lessons */
.lessons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-sm);margin:0;padding:0;list-style:none}
@media (max-width:620px){ .lessons{grid-template-columns:1fr} }
.lesson{padding:var(--space-md);display:grid;gap:var(--space-xs);align-content:start}
.lessons > li:last-child:nth-child(odd){grid-column:1 / -1}   /* an odd card out spans the row instead of leaving a hole */
.cs-foot{width:min(var(--column),100%);margin:0 auto;display:flex;justify-content:center;padding-bottom:var(--space-lg)}
.cs-foot__nav{display:flex;flex-wrap:wrap;justify-content:center;gap:6px}   /* the end of a case study: back, the next project, and a way to get in touch, each its own pill */
.cs-foot__nav .pill{padding:4px}
.cs-next{width:min(var(--column),100%);margin:0 auto;text-align:center;color:var(--text-strong)}   /* one line before Back to Work, pointing at the audit */

/* the picture at full size. A modal dialog sits above the custom cursor, so the system cursor comes back while it is open */
.zoom{width:100vw;height:100vh;height:100dvh;max-width:none;max-height:none;margin:0;padding:0;border:0;background:rgba(0,0,0,.88)}
.zoom::backdrop{background:transparent}
.zoom__bar{position:fixed;top:16px;right:16px;z-index:1}
/* the Close button sits on the dark view in either theme, so it is drawn white with dark text: the theme's own pill colours made it
   near-invisible there in light mode (her note, 29 Oct: no way out of the blueprint) */
.zoom__bar .pill{padding:4px;background:#fff;border-color:rgba(255,255,255,.6);box-shadow:0 4px 16px rgba(0,0,0,.35)}
.zoom__bar .pill button{padding:10px 18px;color:#0d0d0d;font:var(--type-label);letter-spacing:var(--track-label)}
.zoom__bar .pill button:focus-visible{outline:2px solid #ffa51b;outline-offset:2px}
.zoom__scroll{width:100%;height:100%;overflow:auto;display:flex;padding:var(--space-xl) var(--space-sm) var(--space-sm)}
.zoom__scroll img{display:block;margin:auto;max-width:none;height:auto}
html.zoom-open.has-cursor,html.zoom-open.has-cursor *{cursor:auto !important}
html.zoom-open .cursor-small,html.zoom-open .cursor-glass{display:none !important}

/* small cards in a row that wraps: role groups, workstreams, quotes */
.cs-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:var(--space-sm);margin:0;padding:0;list-style:none}
.cs-grid--wide{grid-template-columns:repeat(auto-fit,minmax(240px,1fr))}
.cs-card{padding:var(--space-md);display:grid;gap:var(--space-xs);align-content:start}
.cs-card .type-title{line-height:1}
/* a quote is a person's voice, so it is type and not a card: a surface holds things (the outcomes above it are cards), type says. A hairline marks where it starts. */
.cs-quote{margin:0;padding:var(--space-md) 0 0;border-top:1px solid var(--surface-line);display:grid;gap:var(--space-sm);align-content:start}   /* the rule to the quote: 24; the quote to its source: 16 */
.cs-quote p{margin:0;font:var(--type-card-title);line-height:1.35;color:var(--text-strong);text-wrap:pretty}
.cs-quote footer{font:var(--type-meta);color:var(--text)}
.cs-figure{display:grid;gap:var(--space-xs);margin:0}   /* a picture with a caption under it */

/* ---- the contents rail (9 Oct 2026, lib/contents-rail.js): where you are in the case study. Progress is a line that fills,
        never a chip: the chip means something you chose, and your place on the page is not a choice. On a wide screen it is a
        column beside the sections: the current section's number and title, then the list with the line filling down it.
        On a narrow screen it is a bar across the top that holds the current section's name, with the line filling along its
        bottom edge; a bar that holds information is a rounded rectangle, not a capsule. ---- */
.cs-body{width:min(var(--column),100%);margin:0 auto;display:grid;grid-template-columns:minmax(0,250px) minmax(0,1fr);gap:var(--space-xl);align-items:start}   /* the contents rail to the sections: 80 */
.cs-flow{display:grid;gap:var(--space-2xl);min-width:0}   /* one section to the next: 120 */
.cs-body .cs-sec{width:auto;margin:0;scroll-margin-top:var(--space-lg)}
.cs-body .cs-sec__main{grid-template-columns:minmax(0,1fr)}
.cs-num__name{margin-left:var(--space-xs)}   /* the section's name beside its number ("01 Problem"); shown wherever the head shows, which is on a phone */
.cs-body .cs-sec__head{position:static}
.cs-body .cs-sec__main{gap:var(--space-md)}   /* the head to its text: 24 */   /* her note, 29 Oct: each part of the write-up opens with its name and title in the text itself ("01 Problem", then the heading); the rail beside it is only the contents list and the line */
.cs-rail{position:sticky;top:var(--space-lg);display:grid;gap:var(--space-lg)}
.cs-rail__now{display:grid;gap:var(--space-xs)}
.cs-rail__now p{margin:0}
@media (min-width:861px){ .cs-rail__now{display:none} }   /* on a wide screen the head in the text carries the number and title, so the rail does not repeat them */
.cs-rail__name{display:none}
.cs-rail__list{position:relative;padding-left:var(--space-sm)}
.cs-rail__list ol{list-style:none;margin:0;padding:0 0 var(--space-sm);display:grid;gap:var(--space-sm)}   /* five equal slots, so the line meets each name as you reach its section */
.cs-rail__list a{display:flex;gap:var(--space-xs);align-items:baseline;font:var(--type-meta);color:var(--text);text-decoration:none;transition:color var(--dur-fast)}
.cs-rail__list a .cs-num{color:inherit}
.cs-rail__list a:hover,.cs-rail__list li.is-current a{color:var(--text-strong)}
.cs-rail__list a:focus-visible{outline:2px solid var(--focus);outline-offset:3px;border-radius:4px}
.cs-rail__track{position:absolute;left:0;top:0;bottom:0;width:2px;border-radius:2px;background:var(--surface-line)}
.cs-rail__fill{position:absolute;left:0;top:0;width:100%;height:calc(var(--p, 0) * 100%);border-radius:2px;background:var(--text-strong)}
@media (max-width:860px){
  .cs-body{grid-template-columns:minmax(0,1fr);gap:var(--space-md)}
  .cs-body .cs-sec{scroll-margin-top:88px}
  .cs-body .cs-sec__head{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto;white-space:normal}
  .cs-rail{top:12px;z-index:5;margin-right:96px;gap:0;overflow:hidden;padding:12px var(--space-sm) 14px;   /* clear of the theme switch in the corner */
    border-radius:var(--radius-s);background:var(--surface-3);border:1px solid var(--surface-line);-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px)}
  .cs-rail__now{grid-auto-flow:column;justify-content:start;align-items:baseline}
  .cs-rail__title,.cs-rail__list ol{display:none}
  .cs-rail__name{display:block;font:var(--type-meta);color:var(--text-strong)}
  .cs-rail__list{position:absolute;left:0;right:0;bottom:0;height:2px;padding:0}
  .cs-rail__track{top:auto;width:100%;height:2px;border-radius:0}
  .cs-rail__fill{width:calc(var(--p, 0) * 100%);height:100%;border-radius:0}
  /* the site menu turns into this bar (her call, 29 Oct; lib/contents-rail.js). When the menu pill reaches the top of the screen the bar takes
     over from it: it starts at the menu's own size and place, as a capsule, and widens into the reading bar while the menu's links fade out and
     the section name fades in. Scrolling back up runs it in reverse. The script sets the starting box inline; this is the end state */
  .cs-rail.can-dock{position:fixed;top:12px;left:var(--gutter,16px);right:96px;margin:0;height:44px;display:flex;align-items:center;padding:0 18px;
    border-radius:var(--radius-pill);opacity:0;pointer-events:none;
    transition:left var(--dur-base) var(--ease-zoom,ease),right var(--dur-base) var(--ease-zoom,ease),top var(--dur-base) var(--ease-zoom,ease),opacity .15s}
  .cs-rail.can-dock .cs-rail__now{transition:opacity var(--dur-fast) .12s;opacity:0}
  .cs-rail.can-dock.is-docked{opacity:1;pointer-events:auto}
  .cs-rail.can-dock.is-docked.is-open .cs-rail__now{opacity:1}
  .bar nav.is-handed-over{opacity:0;transition:opacity .12s}
}
@media (prefers-reduced-motion: reduce){ .cs-rail__list a,.cs-rail.can-dock,.cs-rail.can-dock .cs-rail__now{transition:none} }

/* ---- the air in a section's text column (9 Oct 2026, widened 10 Oct: her notes were that the body of a case study felt packed, then that it still lacked breathing space) ----
   Paragraphs sit 24 apart (blocks of one text). Anything that is not text (a list of cards, a picture, a switch, the screens) is a new group, so it is
   80 from the text above and below it: 56 added here to the 24 the column's gap already gives, the same distance as a wide picture outside the column. A sub-heading
   opens a group too, 80 above and 16 to its own text. Lines are held to about 75 characters and the leading opens from 1.6 to 1.7. */
.cs-sec__body > p:not(.type-title) + :not(p),
.cs-sec__body > :not(p) + :not(p),
.cs-sec__body > :not(p) + p,
.cs-sec__body > p.type-title:not(:first-child){margin-top:calc(var(--space-xl) - var(--space-md))}
.cs-sec__body > p.type-title + p,.cs-sec__body > p.type-title + .lessons{margin-top:calc(var(--space-xs) * -1)}   /* its own text, or its own cards: 24 - 8 = 16 */
.cs-sec__body > p.type-body{max-width:62ch;line-height:1.7}
/* on a phone the new distances are one step smaller: a screen 375 wide cannot spend 120 on a gap */
@media (max-width:860px){
  .cs-flow{gap:var(--space-xl)}
  .cs-sec{gap:var(--space-lg)}
  .cs-sec__body > p:not(.type-title) + :not(p),
  .cs-sec__body > :not(p) + :not(p),
  .cs-sec__body > :not(p) + p,
  .cs-sec__body > p.type-title:not(:first-child){margin-top:var(--space-md)}
  .screens{gap:var(--space-lg)}
}
