/* home.html: Mum's Health Diary case (article.case[data-project="mum-diary"]). Loads last.
   Uses the site grammar as is (.tile w / p, .pair, .card.text, .md-figure). Rework 29.10 evening
   (backup home-mum.before-rework.css): no grey boxes, words beside the clips, each screen once.
     .md-phone    one phone screen or clip, whole (nothing cropped), with the one corner rule --md-r
     .md-screen   a 3:4 tile with one phone standing in it (half the column)
     .md-strip    a wide tile with a row of three phones of one path, a caption under each (a swipeable row on a phone)
     .md-beside   a .pair: words in one half, a 3:4 tile in the other (the tile left on wide screens, the words first on a phone)
     .md-quote    mum's words, large, at the start of Research
     .md-notes    Research: what she said or what could go wrong, then what I designed (plain text, labels once)
     .md-diagram  "How it runs": a 3:1 band on wide screens, its own ground brought to the site grey
     .md-figure   tiles with a caption under them
   Grounds, from the app itself: app ground (screens, clips), the app's soft gradient (the morning), site grey (diagram). */

.case[data-project="mum-diary"] {
  --md-grey: #f0f0f0;     /* the grey cards' rgba(0,0,0,.04) on the #fafafa page, as a solid */
  --md-app: #f7f3f7;      /* the app's own ground */
  --md-rule: rgba(0, 0, 0, .1);
  /* one corner for every screen and clip: the iPhone display's own, 55 pt on the 430 × 932 pt screen the case is shot
     on = 12.79% of the width. Percent radii run against height vertically, so 12.79% × 430/932 = 5.90% (110px on an
     860 × 1864 shot). That is the circular fallback; where corner-shape works (below) the corner is iOS's continuous curve. */
  --md-r: 12.79% / 5.9%;
  --md-shape: round;
  /* a phone is 88% of its tile's height, standing 6% above the foot:
     in a 3:4 tile 88% × 4/3 × 860/1864 = 54.1% of the width; in a 3:2 tile 88% × 2/3 × 860/1864 = 27.1% */
  --md-w-p: 54.1%;
  --md-w-w: 27.1%;
}

/* iOS draws its screen corners as a continuous curve, not a quarter circle. A CSS squircle (superellipse, n = 4)
   matches that curve within 2 pt at 93 pt on the 430 pt screen: 21.63% of the width, 9.98% of the height. The bigger
   number does not cut deeper: the squircle bends later and tighter, its 45° point lands where the 55 pt corner's
   does, and it leaves the edge about where iOS's does (88 pt). Browsers without corner-shape keep the circle above. */
@supports (corner-shape: squircle) {
  .case[data-project="mum-diary"] { --md-r: 21.63% / 9.98%; --md-shape: squircle; }
}

/* ---------- phones: screens and clips ---------- */
.md-phone {
  display: block;
  width: 100%; height: auto;
  aspect-ratio: 860 / 1864;
  object-fit: cover;
  border-radius: var(--md-r);
  corner-shape: var(--md-shape);
  /* the screens' ground is the app ground too: a soft lift lets the screen's edge and corner read on it */
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 12px 32px -12px rgba(0, 0, 0, .14);
}
.tile.md-screen > .md-phone {
  position: absolute; inset: auto auto 6% 50%;
  width: var(--md-w-p); height: auto;
  translate: -50% 0;
}

/* grounds */
.tile.md-screen, .tile.md-app, .tile.md-strip { background: var(--md-app); }
.tile.md-grad { background: #f6e9f1 url("media/mum-diary/bg/hero-banner-bg.webp") 50% 50% / cover no-repeat; }
.tile.md-grad > .md-phone { box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 16px 40px -12px rgba(0, 0, 0, .18); }

/* a row of phones, each the size of a 3:2 tile's phone, a one-line caption under each, all on one foot line */
.tile.md-strip {
  aspect-ratio: auto;
  display: flex; justify-content: center; align-items: flex-start;
  gap: 4%;
  padding: 4% 0 3%;
}
.md-strip > .md-step { flex: 0 0 var(--md-w-w); min-width: 0; margin: 0; }
.md-step > .md-shot { position: relative; display: block; }
.md-step > figcaption {
  margin-top: 14px;
  color: #666;   /* 5:1 on the app ground */
  font-size: var(--fs-small); line-height: 1.4;
  text-align: center; text-wrap: balance;
}
a.md-shot { cursor: zoom-in; border-radius: var(--md-r); corner-shape: var(--md-shape); transition: opacity .2s ease; }   /* the link's box is the screen's box: same corner */
@media (hover: hover) { a.md-shot:hover { opacity: .92; } }
a.md-shot:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

@media (max-width: 760px) {
  /* the row scrolls sideways, one phone at the size of a 3:4 tile's, the next one peeking in */
  .tile.md-strip {
    justify-content: flex-start;
    gap: 16px;
    padding: 8% 22.95% 6%;   /* 22.95% centres the first phone */
    overflow-x: auto; overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 22.95%;
  }
  /* the content box is 100% − 2 × 22.95% = 54.1% of the tile: one phone fills it */
  .md-strip > .md-step { flex-basis: 100%; scroll-snap-align: center; }
}
@media (max-width: 760px) and (hover: none) {
  .tile.md-strip { scrollbar-width: none; }
  .tile.md-strip::-webkit-scrollbar { display: none; }
}

/* ---------- words beside a picture: plain text, no card ---------- */
.case[data-project="mum-diary"] .md-beside { margin-top: var(--text-pause); }
.case[data-project="mum-diary"] .card.text + .md-beside { margin-top: 0; }
.case[data-project="mum-diary"] .md-beside > .card.text,
.md-plain {
  width: auto; min-width: 0;
  padding: 0; background: none; border: 0; border-radius: 0; overflow: visible;
  font-size: var(--fs-body); line-height: 1.55; color: var(--ink);
}
.md-beside > .card.text p + p, .md-plain p + p { margin-top: 1em; }
.md-plain h3 { margin: 0 0 4px; font: inherit; color: var(--muted); }
.md-plain p { margin: 0; max-width: 52ch; }   /* text-wrap: typography.css */
.md-plain p + h3 { margin-top: 24px; }
.md-plain .md-asof { margin-top: 24px; color: var(--muted); font-size: var(--fs-small); }
@media (min-width: 761px) {
  /* the picture in the left half, the words in the right, from the tile's top, tight to the picture (only the pair's gap);
     the same as .crm-beside in _crm-case.css — keep the two in step */
  .case[data-project="mum-diary"] .md-beside > :not(.tile):not(.md-figure) { order: 2; padding: 0; }
}
@media (max-width: 760px) {
  .md-beside > .card.text { margin-bottom: 24px; }
  .md-beside > .md-plain { margin-bottom: 24px; }
}

/* ---------- Research ---------- */
.case .card.text .md-quote { margin: 8px 0 32px; }
.case .card.text .md-quote p {
  font-size: clamp(1.5rem, 1.15rem + 1.2vw, 2.125rem);   /* 24 → 34px */
  line-height: 1.2;
  text-wrap: balance;
  text-indent: -0.45em;   /* the opening quote hangs */
}
.md-quote footer { margin-top: 12px; color: var(--muted); }

.md-notes {
  justify-self: center;
  width: min(720px, 100%);
  display: grid; gap: 40px 32px;
  grid-template-columns: minmax(0, 1fr);
  font-size: var(--fs-body); line-height: 1.55;
}
@media (min-width: 761px) { .md-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.md-group h3 { margin: 0 0 12px; font: inherit; color: var(--muted); }
.md-note { padding-top: 12px; border-top: 1px solid var(--md-rule); }
.md-note + .md-note { margin-top: 24px; }
.md-note p { margin: 0; }
/* what I designed: under her words, an arrow hanging in the margin */
.md-note p + p { margin-top: 8px; position: relative; padding-left: 1.4em; }
.md-note p + p::before { content: "→"; position: absolute; left: 0; color: var(--muted); }

/* ---------- How it runs: the diagram ---------- */
.tile.md-diagram { background: var(--md-grey); aspect-ratio: 3 / 1; }
.tile.md-diagram > picture > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* the diagram's own ground is #f6f6f6; a 2.4% darkening brings it to the tiles' #f0f0f0 (white boxes stay near white) */
.tile.md-diagram > picture > img { filter: brightness(.976); }
@media (max-width: 760px) { .tile.md-diagram { aspect-ratio: 3 / 4; } }

/* paper diaries: photos keep their own 4:3, nothing cropped */
.tile.md-photo { aspect-ratio: 4 / 3; }

/* tiles with a caption */
.md-figure { margin: 0; min-width: 0; }
.md-figure figcaption { margin-top: 8px; color: var(--muted); font-size: var(--fs-small); line-height: 1.5; }

/* typography pass 29.10 evening: the Next list takes the paragraphs' 68ch measure (it ran 83 characters a line
   at 720px); the little labels and the caption under each phone break evenly, not with one word left over */
.case[data-project="mum-diary"] .md-next ul { max-width: 68ch; }
