/* Smart-home notifications case study. Per-page sheet, loaded after
   site.css.

   Ported from the smart-home-texture spike (studies/smart-home-texture/,
   Sept 2026, direction J); that README has the reasoning. The study accent,
   Home Assistant blue, is the study's plate in site.css beside the other
   studies. Everything else the page needs is here, under one sh-
   namespace. */

body[data-study="smart-home-notifications"] {
  --sh-app: #18a7e0;          /* the Home Assistant app icon */
  --sh-night-accent: #18bcf2; /* Home Assistant's own blue, on the night band */
  --sh-critical: #dc2626;
}

/* --- Masthead: the phone beside the headline ------------------------------
   The phone plays the problem and the answer on load: single-sensor pings
   pile up until the screen overflows, then clear into the framework's
   order (critical, time sensitive, scheduled summaries). */
/* In the plain opening panel the text sits left and the phone right, as
   it did before the port. The variation is the headline: the claim is
   fewer, calmer alerts, so the type drops to a regular weight (masthead-
   variety spike, s3). */
body[data-study="smart-home-notifications"] .case-hero { text-align: left; padding-top: 0; }
body[data-study="smart-home-notifications"] .case-hero-in {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 38rem); gap: 6.4rem; align-items: center;
  width: auto; margin: 0; padding: 6.4rem 6.4rem 5.6rem 5.6rem;
}
body[data-study="smart-home-notifications"] .case-hero h1 { margin: 1.8rem 0 0; font-weight: 400; font-size: var(--fs-h1-beside); line-height: 1.04; }

.sh-stage { position: relative; }
.sh-phase { display: flex; gap: 0.4rem; margin-bottom: 1.4rem; font-family: var(--mono); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; }
.sh-phase button { font: inherit; letter-spacing: inherit; text-transform: inherit; background: none; cursor: pointer;
  padding: 0.6rem 1rem 0.5rem; border-radius: 0.3rem; color: var(--ink-3); border: 1px solid var(--line);
  transition: color 300ms ease, background-color 300ms ease, border-color 300ms ease; }
.sh-phase button:hover { color: var(--ink); border-color: var(--ink-3); }
.sh-phase button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sh-stage[data-phase="before"] .sh-phase [data-p="before"] { color: #fff; background: var(--ink); border-color: var(--ink); }
.sh-stage[data-phase="after"] .sh-phase [data-p="after"] { color: #fff; background: var(--accent);
  border-color: var(--accent); }

.sh-phone { position: relative; aspect-ratio: 680 / 1000; border: 1.1rem solid #1c1d1f; border-bottom: 0;
  border-radius: 5.8rem 5.8rem 0 0; overflow: hidden;
  background: linear-gradient(165deg, #aab4bd 0%, #6f7d89 45%, #34404a 100%);
  -webkit-mask-image: linear-gradient(#000 88%, transparent); mask-image: linear-gradient(#000 88%, transparent); }
.sh-island { position: absolute; top: 1.4rem; left: 50%; width: 30%; height: 2.8rem; transform: translateX(-50%);
  background: #0b0b0c; border-radius: 2rem; z-index: 2; }
/* Type inside the phone scales with the phone (container units), so it
   reads the same at 380px beside the headline and 340px on a phone. */
.sh-feed { position: absolute; inset: 6.4rem 1.4rem 0; container-type: inline-size; }
.sh-noise, .sh-calm { position: absolute; inset: 0; display: flex; flex-direction: column; opacity: 0; visibility: hidden;
  transition: opacity 500ms ease, transform 500ms ease, filter 500ms ease; }

/* Which layer shows. Intro and calm both rest on the settled phone; the
   intro shows the pile only while it plays. */
.sh-stage[data-at="noise"] .sh-noise,
.sh-stage[data-at="intro"] .sh-phone.is-playing .sh-noise,
.sh-stage[data-at="intro"] .sh-phone:not(.is-playing) .sh-calm,
.sh-stage[data-at="calm"] .sh-calm { opacity: 1; visibility: visible; }

.sh-ping { max-height: 30cqw; margin-bottom: 1.6cqw; }
.sh-ping-in { display: flex; gap: 2.6cqw; align-items: flex-start; background: rgba(255, 255, 255, 0.8);
  border-radius: 4cqw; padding: 2.4cqw 3cqw; }
.sh-ping-in > div { flex: 1; min-width: 0; }
.sh-ping-t { margin: 0; font-size: 3.35cqw; line-height: 1.3; font-weight: 600; color: #17181a; }
.sh-ping-in b { display: block; height: 1.6cqw; width: 70%; margin-top: 1.4cqw; border-radius: 1cqw;
  background: rgba(23, 24, 26, 0.14); }
.sh-ping:nth-child(3n) .sh-ping-in b { width: 46%; }
.sh-ping-now { font-size: 2.8cqw; color: #6b6e73; }
.sh-feed .sh-app { width: 5.2cqw; height: 5.2cqw; }

.sh-grp { margin: 1.4cqw 0 1.4cqw 1cqw; font-size: 2.7cqw; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: rgba(255, 255, 255, 0.86); }
.sh-c:first-child .sh-grp { margin-top: 0; }
.sh-c > .sh-note { margin-bottom: 1.6cqw; }
.sh-feed .sh-note { padding: 2.6cqw 3cqw; gap: 2.6cqw; border-radius: 4cqw; }
.sh-feed .sh-note p { font-size: 3.35cqw; line-height: 1.3; }
.sh-feed .sh-note .sh-note-k { font-size: 2.6cqw; }
.sh-note.is-summary .sh-note-text p:not(.sh-note-t) { color: #45484d; }
.sh-note.is-summary .sh-note-text p:not(.sh-note-t):not(.sh-more)::before { content: "\00b7\00a0"; }
.sh-note.is-summary .sh-note-text .sh-more { color: #6b6e73; }

/* The play: each ping pops in on top and pushes the rest down, then the
   pile blurs out and the settled phone staggers in. */
.sh-phone.is-playing .sh-ping { max-height: 0; margin-bottom: 0; opacity: 0; transform: scale(0.9) translateY(-0.6rem);
  transition: max-height 260ms cubic-bezier(.2, .8, .2, 1), margin 260ms, opacity 200ms ease,
    transform 320ms cubic-bezier(.3, 1.4, .5, 1); }
.sh-phone.is-playing .sh-ping.is-in { max-height: 30cqw; margin-bottom: 1.6cqw; opacity: 1; transform: none; }
.sh-phone.is-settling .sh-noise { opacity: 0; transform: translateY(-4%) scale(0.97); filter: blur(0.4rem); }
@keyframes sh-in { from { opacity: 0; transform: translateY(1rem) scale(0.97); } to { opacity: 1; transform: none; } }
.sh-phone.is-calm .sh-c { animation: sh-in 480ms cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 70ms); }

.sh-under { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.6rem; margin-top: 1.6rem; }
.sh-cap { margin: 0; font-size: var(--fs-caption); line-height: 1.45; font-weight: 500; color: var(--ink); max-width: 34ch; min-height: 2.9em; }
.sh-fine { margin: 0.6rem 0 0; font-family: var(--mono); font-size: var(--fs-xs); line-height: 1.5; letter-spacing: 0.04em; color: var(--ink-3); }
.sh-replay { flex: none; font-family: var(--mono); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink); background: none; border: 1px solid var(--line); border-radius: 0.3rem;
  padding: 0.6rem 1rem; cursor: pointer; }
.sh-replay:hover { border-color: var(--ink); }
.sh-replay:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.is-flat .sh-replay { display: none; }

/* --- Notification chrome: only for text the system really sent ----------- */
.sh-app { width: 2rem; height: 2rem; flex: none; color: #fff; }
.sh-app rect { fill: var(--sh-app); }
.sh-note { display: flex; gap: 1rem; align-items: flex-start; background: rgba(255, 255, 255, 0.94); color: #17181a;
  border-radius: 1.6rem; padding: 1.1rem 1.3rem; text-align: left;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1rem 2.4rem -1.4rem rgba(0, 0, 0, 0.35); }
.sh-note p { margin: 0; font-size: 1.35rem; line-height: 1.35; color: inherit; }
.sh-note .sh-note-t { font-weight: 600; }
.sh-note .sh-note-k { font-size: 1.05rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #6b6e73; }
.sh-note.is-critical .sh-note-k { color: #d92d20; }
.sh-note-text { flex: 1; min-width: 0; }
/* The porch alert's camera snapshot, cropped from its own screenshot to the
   delivery driver (a 180px square at x 240, y 400 of the 680x1061 render),
   where iOS puts a notification's image. */
.sh-thumb { flex: none; width: 12cqw; aspect-ratio: 1; border-radius: 1.8cqw;
  background: #6f7d89 url("case-studies/smart-home-notifications/porch-detection.png") 48% 45.4% / 377.8% auto no-repeat; }

/* --- Figures: both sit in the shared .exhibit shell ----------------------- */
.sh-fig-flt .exhibit-plate, .sh-fig-mx .exhibit-plate { display: block; }
.sh-k { margin: 0 0 1.4rem; font-family: var(--mono); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-3); }

/* Fig. 01: logged, scored, what reaches a phone. The bars are drawn at the
   true 5:1 ratio of the 80% and carry no daily counts until real ones exist. */
.sh-flt { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sh-flt-col { padding: 0 2.8rem; position: relative; }
.sh-flt-col:first-child { padding-left: 0; }
.sh-flt-col:last-child { padding-right: 0; }
.sh-flt-col + .sh-flt-col { border-left: 1px solid var(--line); }
/* The flow reads left to right: a hairline chevron on each divider. */
.sh-flt-col + .sh-flt-col::before { content: ""; position: absolute; left: -0.6rem; top: 50%; width: 1rem; height: 1rem;
  border-top: 1px solid var(--ink-3); border-right: 1px solid var(--ink-3);
  transform: translateY(-50%) rotate(45deg); background: #fff; }
.sh-big { margin: 0; font-family: var(--mono); font-size: var(--fs-number); font-weight: 500;
  letter-spacing: -0.03em; line-height: 1; color: var(--ink); white-space: nowrap; }
.sh-l { margin: 1rem 0 0; font-size: var(--fs-caption); line-height: 1.45; color: var(--ink-2); max-width: 22ch; }
.sh-qs { list-style: none; margin: 0; padding: 0 0 0 1.4rem; border-left: 1px solid var(--line); display: grid; gap: 1.5rem;
  counter-reset: q; }
.sh-qs li { counter-increment: q; font-size: var(--fs-caption); line-height: 1.35; color: var(--ink); }
.sh-qs li::before { content: counter(q, decimal-leading-zero); margin-right: 1rem; font-family: var(--mono);
  font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); }
.sh-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin-bottom: 1.8rem; }
.sh-bar-l { width: 100%; font-size: var(--fs-caption); color: var(--ink-2); }
.sh-fill { display: block; flex: none; width: 100%; height: 1.4rem; border-radius: 2px; background: var(--ink-3); opacity: 0.45; }
.sh-fill.is-after { width: 20%; background: var(--accent); opacity: 1; }
.sh-delta { font-family: var(--mono); font-size: var(--fs-label); font-weight: 600; color: var(--accent); }

/* Fig. 02: seven events, profiled. The grid shows which channels each event
   can reach; how it escalates across them is the Interruption column's job.
   Red is spent on the one channel that overrides the phone's own rules; the
   grid position says everything else. */
.sh-mx { display: grid; width: 100%; font-size: var(--fs-caption); }
.sh-mx-row { display: grid; align-items: center; gap: 0 1.2rem; padding: 1.2rem 0; border-top: 1px solid var(--line);
  grid-template-columns: minmax(0, 2.1fr) 9.2rem repeat(5, minmax(0, 0.62fr)) minmax(0, 1.25fr); }
.sh-mx-head { border-top: 0; padding-top: 0; font-family: var(--mono); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); align-items: end; }
.sh-mx-head .sh-mx-ch { text-align: center; }
.sh-mx-ev { color: var(--ink); font-weight: 500; line-height: 1.35; }
.sh-mx small { display: block; font-weight: 400; font-size: var(--fs-label); color: var(--ink-3); margin-top: 2px; }
.sh-mx-int { color: var(--ink-2); line-height: 1.35; }
.sh-dot { display: flex; justify-content: center; }
.sh-dot i { width: 0.9rem; height: 0.9rem; border-radius: 50%; border: 1px solid var(--line); }
.sh-dot.is-on i { background: var(--ink); border-color: var(--ink); }
.sh-dot.is-critical i { background: var(--sh-critical); border-color: var(--sh-critical);
  box-shadow: 0 0 0 0.4rem rgba(220, 38, 38, 0.14); }
.sh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* --- The pivot: the page's thesis, between the method and the tuning ------ */
.sh-pivot { position: relative; z-index: 1; padding: 11.2rem 0; background: var(--accent); }
/* Both bands run edge to edge out of the reading column; their content
   keeps the column (the pivot) or the figure width (the night band). */
.sec.sh-pivot, .sec.sh-night { width: 100vw; margin-left: calc(50% - 50vw); }
.sec.sh-pivot { padding-inline: max(var(--gut), (100vw - var(--read)) / 2); }
.sec.sh-night { padding: 10.4rem max(var(--gut), (100vw - var(--wide)) / 2) 11.2rem; }
.sec.sh-night > :is(.sec-k, h2, p) { max-width: var(--read); }
.sec.sh-night > .sh-group { margin-top: 5.6rem; }
.sh-pivot-quote { margin: 0; }
.sh-pivot-quote blockquote { margin: 0; padding: 0; border: 0; max-width: 24ch; font-size: clamp(3rem, 4.2vw, 5.6rem);
  line-height: 1.08; font-weight: 600; letter-spacing: -0.03em; color: #fff; text-wrap: balance; }

/* --- Tuning: the round is an eyebrow, the finding is the heading ---------- */
.sh-finding-head { display: flex; flex-direction: column; gap: 0.8rem; }
.fixes .sh-round { margin: 0 0 0.8rem; }
.sh-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; max-width: 52rem; margin-top: 2rem; }
.sh-pair-k { margin: 0 0 0.6rem; font-family: var(--mono); font-size: var(--fs-xs); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-3); }
.sh-pair .sh-note { background: #fff; border: 1px solid var(--line); border-radius: 1.2rem; padding: 1rem 1.2rem;
  box-shadow: none; }
.sh-pair .sh-app { width: 1.8rem; height: 1.8rem; margin-top: 1px; }
.sh-pair .sh-app rect { fill: var(--accent); }
.sh-note.is-before { opacity: 0.6; }
.sh-note.is-before .sh-app rect { fill: var(--ink-3); }

/* --- Final design, on the night band -------------------------------------
   The renders are alpha-cut, so they stand on the ground with no plate. Each
   How Might We question heads its row. */
.sh-night {
  --ink: #eef0f1;
  --accent: var(--sh-night-accent);
  --ink-2: rgba(238, 240, 241, 0.78);
  --ink-3: rgba(238, 240, 241, 0.56);
  --line: rgba(238, 240, 241, 0.16);
  position: relative;
  z-index: 1;
  background: #0d1115;
  color: var(--ink);
}
.sh-group { display: flex; flex-direction: column; gap: 3.6rem; padding-top: 4rem; border-top: 1px solid var(--line); }
.sh-group-head { display: flex; flex-direction: column; gap: 1rem; }
.sh-hmw { margin: 0; display: flex; gap: 1.2rem; font: 600 var(--fs-label)/1.35 var(--mono);
  letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-3); }
.sh-hmw span { color: var(--accent); }
.sh-group-head h3 { margin: 0; max-width: 28ch; color: var(--ink); }
.sh-shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5.6rem 4rem; align-items: end; }
.sh-shot { margin: 0; display: flex; flex-direction: column; gap: 1.8rem; }
.sh-crop { width: 100%; }
.sh-shot img { display: block; width: 100%; height: auto; filter: drop-shadow(0 1.8rem 3rem rgba(0, 0, 0, 0.5)); }
/* A phone render is 680x1061 with its notification between y 150 and 700.
   Crop to that band so the alert reads at column width. Margin percentages
   resolve against width, so -22% is 150px of 680. */
.sh-shot.is-phone .sh-crop { position: relative; aspect-ratio: 680 / 560; overflow: hidden; }
/* The fade at the foot of the crop is an overlay in the band's colour, not
   a mask-image: Safari does not repaint a masked box when a lazy image
   inside it finishes loading, so the crop stayed empty. */
.sh-shot.is-phone .sh-crop::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 24%;
  background: linear-gradient(rgba(13, 17, 21, 0), #0d1115); pointer-events: none; }
.sh-shot.is-phone img { margin-top: -22%; filter: none; }
.sh-shot.is-watch .sh-crop, .sh-shot.is-screen .sh-crop { max-width: 25rem; margin-inline: auto; }
/* .fig figcaption is centred; these read as text, not photo credits. */
.sh-shot figcaption { display: flex; flex-direction: column; gap: 0.6rem; max-width: 40ch; margin: 0; text-align: left;
  font-size: var(--fs-caption); line-height: 1.5; color: var(--ink-2); }
.sh-shot figcaption strong { display: block; color: var(--ink); font-size: var(--fs-item); line-height: 1.3; font-weight: 600; letter-spacing: -0.015em; }
.sh-ch { font-family: var(--mono); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); }

/* --- Motion ---------------------------------------------------------------- */
body.is-flat .sh-noise, body.is-flat .sh-calm { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .sh-noise, .sh-calm, .sh-phase button { transition: none; }
  .sh-c { animation: none !important; }
}

@media (max-width: 991px) {
  body[data-study="smart-home-notifications"] .case-hero-in { grid-template-columns: minmax(0, 1fr); gap: 4rem; padding: 5.6rem 4rem; }
  .sh-stage { max-width: 34rem; width: 100%; margin: 0 auto; }
  .sh-flt { grid-template-columns: minmax(0, 1fr); }
  .sh-flt-col { padding: 2.2rem 0; }
  .sh-flt-col:first-child { padding-top: 0; }
  .sh-flt-col + .sh-flt-col { border-left: 0; border-top: 1px solid var(--line); }
  .sh-flt-col + .sh-flt-col::before { left: 50%; top: -0.6rem; transform: translateX(-50%) rotate(135deg); }
  .sh-shots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .sh-fig-flt .exhibit-plate, .sh-fig-mx .exhibit-plate { padding: 2rem 1.6rem; }
  /* On a phone the grid cannot carry the channel, so the channel names itself. */
  .sh-mx-head { display: none; }
  .sh-mx-row { grid-template-columns: minmax(0, 1fr) auto; gap: 0.8rem 1.2rem; padding: 1.4rem 0; }
  .sh-mx-row:nth-child(2) { border-top: 0; }
  .sh-dot { display: none; }
  .sh-dot.is-on { display: inline-flex; grid-column: 1 / -1; justify-content: flex-start; align-items: center; gap: 0.8rem;
    font-family: var(--mono); font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
  .sh-dot.is-on .sh-sr { position: static; width: auto; height: auto; clip: auto; }
  .sh-mx-int { grid-column: 1 / -1; }
  .sh-pivot { padding: 6.4rem 0; }
  .sec.sh-pivot { padding-inline: var(--gut); }
  .sec.sh-night { padding: 7.2rem var(--gut) 8rem; }
  body[data-study="smart-home-notifications"] .case-hero-in { padding: 4.8rem 2rem 4rem; }
  .sh-pair { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .sh-shots { grid-template-columns: minmax(0, 1fr); gap: 4rem; }
}
