/* Owner 1 Nov: illustrated "why it is built this way" sections and project hubs.
   Generated by site/tools/casestudy_design.py from site/tools/casestudy/<id>.json.
   Every block inherits the reading theme (--ink, --rule, --muted, --paper) so night mode works;
   --dn-accent is each project's own brand colour. */
.dn { --dn-accent: #8a5a2b; --dn-paper: color-mix(in srgb, var(--paper, #f6efe3) 70%, #fff); margin: 64px 0 72px; }
.dn-kicker { font: 600 .68rem/1.6 ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--dn-accent); margin: 0 0 10px; }
.dn-title { font-size: clamp(1.6rem, 3.2vw, 2.4rem); line-height: 1.2; margin: 0 0 14px; max-width: 26ch; }
.dn-lead { font-size: 1.05rem; max-width: 70ch; color: var(--muted); margin: 0 0 40px; }
.dn-block { margin: 0 0 64px; }
.dn-block__head { display: flex; align-items: baseline; gap: 16px; margin: 0 0 22px; }
.dn-block__head h3 { margin: 0; font-size: 1.25rem; }
.dn-block__head::after { content: ''; flex: 1; border-top: 1px dashed var(--rule); transform: translateY(-4px); }
.dn-num { font: 600 .7rem/1 ui-monospace, Menlo, Consolas, monospace; color: var(--dn-accent); }

/* Palette: chips sized by their share of the page, each with its job. */
.dn-palette { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 16px; }
.dn-chip { border: 1px solid var(--rule); background: var(--dn-paper); display: flex; flex-direction: column; min-width: 0; }
.dn-chip__swatch { height: 96px; position: relative; border-bottom: 1px solid var(--rule); }
.dn-chip__swatch span { position: absolute; left: 10px; bottom: 8px; font: .62rem/1 ui-monospace, Menlo, Consolas, monospace; padding: 4px 6px; background: #ffffffd9; color: #2a211b; }
.dn-chip__body { padding: 12px 14px 14px; font-size: .78rem; line-height: 1.55; }
.dn-chip__body strong { display: block; font-size: .86rem; margin-bottom: 4px; }
.dn-chip__body p { margin: 0; color: var(--muted); }
.dn-share { display: flex; height: 14px; margin: 18px 0 6px; border: 1px solid var(--rule); overflow: hidden; }
.dn-share span { display: block; height: 100%; }
.dn-share-note { font-size: .72rem; color: var(--muted); margin: 0; }

/* Type: specimens in close system stand-ins (the brand fonts are not loaded on this site). */
.dn-type { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.dn-spec { border: 1px solid var(--rule); padding: 20px 20px 18px; background: var(--dn-paper); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dn-spec__sample { font-size: 2.6rem; line-height: 1.05; color: var(--ink); overflow-wrap: anywhere; }
.dn-spec__name { font: 600 .7rem/1.4 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; color: var(--dn-accent); text-transform: uppercase; }
.dn-spec p { margin: 0; font-size: .8rem; line-height: 1.6; color: var(--muted); }
.dn-standin { font-size: .68rem; color: var(--muted); margin: 10px 0 0; font-style: italic; }

/* Decisions: illustrated cards. */
.dn-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.dn-card { border: 1px solid var(--rule); background: var(--dn-paper); padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; min-width: 0; transition: transform .2s ease, box-shadow .2s ease; }
.dn-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(40, 28, 18, .1); }
.dn-ill { width: 120px; height: 96px; display: block; margin: -2px 0 6px -6px; }
.dn-card h4 { margin: 0; font-size: 1rem; line-height: 1.35; }
.dn-card p { margin: 0; font-size: .8rem; line-height: 1.65; }
.dn-card .dn-why { color: var(--muted); }
.dn-card .dn-why b { color: var(--dn-accent); font-weight: 600; }
.dn-tag { align-self: flex-start; margin-top: auto; font: .6rem/1.5 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--rule); padding: 2px 7px; }

/* Annotated screenshot: numbered pins on the image, notes beside it. */
.dn-annot { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.dn-annot__fig { position: relative; margin: 0; border: 1px solid var(--rule); background: #fff; }
.dn-annot__fig img { display: block; width: 100%; height: auto; }
.dn-pin { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: var(--dn-accent); color: #fff; font: 700 .78rem/30px ui-monospace, Menlo, Consolas, monospace; text-align: center; box-shadow: 0 0 0 4px #ffffffcc, 0 4px 10px rgba(0, 0, 0, .25); }
.dn-pin::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--dn-accent); opacity: 0; animation: dn-ping 2.8s ease-out infinite; }
@keyframes dn-ping { 0% { transform: scale(.8); opacity: .7; } 70%, 100% { transform: scale(1.9); opacity: 0; } }
.dn-annot__notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: none; }
.dn-annot__notes li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; font-size: .8rem; line-height: 1.6; }
.dn-annot__notes li > span { width: 30px; height: 30px; border-radius: 50%; background: var(--dn-accent); color: #fff; font: 700 .78rem/30px ui-monospace, Menlo, Consolas, monospace; text-align: center; }
.dn-annot__notes strong { display: block; font-size: .88rem; margin-bottom: 2px; }
.dn-annot__notes p { margin: 0; color: var(--muted); }
.dn-annot__cap { font-size: .7rem; color: var(--muted); margin: 8px 0 0; }

/* Flow: how it works, as a drawn path. */
.dn-flow { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; align-items: stretch; counter-reset: dnflow; }
.dn-step { position: relative; padding: 18px 26px 18px 18px; border: 1px solid var(--rule); background: var(--dn-paper); margin-right: 22px; min-width: 0; }
.dn-step:last-child { margin-right: 0; }
.dn-step::before { counter-increment: dnflow; content: counter(dnflow, decimal-leading-zero); display: block; font: 600 .7rem/1 ui-monospace, Menlo, Consolas, monospace; color: var(--dn-accent); margin-bottom: 10px; }
.dn-step:not(:last-child)::after { content: ''; position: absolute; right: -23px; top: 50%; width: 22px; height: 2px; background: var(--dn-accent); }
.dn-step strong { display: block; font-size: .92rem; line-height: 1.35; margin-bottom: 6px; }
.dn-step p { margin: 0; font-size: .76rem; line-height: 1.55; color: var(--muted); }
.dn-flow-note { font-size: .74rem; color: var(--muted); margin: 14px 0 0; }

/* Numbers that matter. */
.dn-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 16px; }
.dn-stat { border-top: 3px solid var(--dn-accent); padding: 14px 0 0; }
.dn-stat b { display: block; font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.1; }
.dn-stat span { display: block; font-size: .76rem; line-height: 1.55; color: var(--muted); margin-top: 6px; }

/* Project hub: one card per part. */
.dn-hub { margin: 40px 0 72px; }
.dn-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 24px; }
.dn-part { position: relative; display: flex; flex-direction: column; border: 1px solid var(--rule); background: var(--dn-paper); color: var(--ink); text-decoration: none; overflow: hidden; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.dn-part:hover { text-decoration: none; transform: translateY(-4px); box-shadow: 0 16px 36px rgba(40, 28, 18, .14); border-color: var(--dn-accent); }
.dn-part:focus-visible { outline: 3px solid var(--dn-accent); outline-offset: 3px; }
.dn-part__shot { aspect-ratio: 16/10; overflow: hidden; border-bottom: 1px solid var(--rule); background: #fff; position: relative; }
.dn-part__shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform .5s ease; }
.dn-part:hover .dn-part__shot img { transform: scale(1.03); }
.dn-part__ill { position: absolute; right: 12px; bottom: -6px; width: 96px; height: 77px; background: var(--dn-paper); border: 1px solid var(--rule); border-bottom: 0; padding: 4px; }
.dn-part__ill .dn-ill { width: 100%; height: 100%; margin: 0; }
.dn-part__body { padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.dn-part__no { font: 600 .66rem/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; color: var(--dn-accent); }
.dn-part__body h3 { margin: 0; font-size: 1.3rem; }
.dn-part__body p { margin: 0; font-size: .82rem; line-height: 1.65; }
.dn-part__go { margin-top: auto; padding-top: 8px; font: 600 .7rem/1.4 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; color: var(--dn-accent); }
.dn-also { margin: 22px 0 0; font-size: .8rem; color: var(--muted); }

/* Part pages: breadcrumb back links and part-to-part navigation. */
.dn-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .75rem; margin-bottom: 24px; }
.dn-crumbs a { display: inline-flex; align-items: center; min-height: 44px; }
.dn-crumbs span { color: var(--muted); }
.dn-partnav { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; margin: 56px 0 24px; }
.dn-partnav a { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--rule); color: var(--ink); text-decoration: none; min-height: 44px; }
.dn-partnav a:hover { border-color: var(--dn-accent); text-decoration: none; }
.dn-partnav a[aria-current="page"] { border-color: var(--dn-accent); background: var(--dn-paper); }
.dn-partnav small { font: .62rem/1.4 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--dn-accent); }

@media (max-width: 760px) {
  .dn-annot { grid-template-columns: 1fr; }
  .dn-flow { grid-auto-flow: row; grid-auto-columns: auto; gap: 18px; }
  .dn-step { margin-right: 0; }
  .dn-step:not(:last-child)::after { right: auto; left: 28px; top: auto; bottom: -19px; width: 2px; height: 18px; }
  .dn-pin { width: 24px; height: 24px; margin: -12px 0 0 -12px; font-size: .68rem; line-height: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .dn-pin::after { animation: none; }
  .dn-card, .dn-part, .dn-part__shot img { transition: none; }
  .dn-card:hover, .dn-part:hover { transform: none; }
  .dn-part:hover .dn-part__shot img { transform: none; }
}
:root[data-theme="night"] .dn { --dn-paper: color-mix(in srgb, var(--paper, #141a2a) 85%, #fff); }
:root[data-theme="night"] .dn-pin, :root[data-theme="night"] .dn-annot__notes li > span { box-shadow: 0 0 0 3px #0008; }

/* Watch the film: click to play, poster first. */
.dn-film { margin: 48px 0 8px; }
.dn-film video { display: block; width: 100%; height: auto; aspect-ratio: 16/9; background: #111; border: 1px solid var(--rule); }
.dn-film figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-top: 10px; font-size: .8rem; color: var(--muted); }
.dn-film .dn-kicker { margin: 0; }

/* Illustrations draw in the theme ink, so night mode keeps them readable. */
.dn-ill { color: var(--ink, #3b2a22); }

/* At a glance: results before design detail. */
.dn-glance { margin: 40px 0 24px; }
.dn-glance__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.dn-glance__cell { border: 1px solid var(--rule); border-top: 3px solid var(--dn-accent); background: var(--dn-paper); padding: 14px 18px 18px; }
.dn-glance__cell .dn-ill { width: 64px; height: 52px; margin: 0 0 6px -4px; }
.dn-glance__cell h3 { margin: 0 0 6px; font-size: .78rem; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--dn-accent); }
.dn-glance__cell p { margin: 0; font-size: .86rem; line-height: 1.6; }

/* Film transcript. */
.dn-transcript { margin-top: 10px; font-size: .82rem; }
.dn-transcript summary { cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; color: var(--dn-accent, var(--accent)); }
.dn-transcript p { margin: 0 0 8px; max-width: 75ch; color: var(--muted); }

/* Touch screens: no hover lift that sticks after a tap. */
@media (hover: none) { .dn-card:hover, .dn-part:hover { transform: none; box-shadow: none; } .dn-part:hover .dn-part__shot img { transform: none; } }

/* Print: keep cards and chips whole, drop motion and players. */
@media print {
  .dn-card, .dn-step, .dn-chip, .dn-spec, .dn-glance__cell, .dn-annot, .dn-part, .dn-stat { break-inside: avoid; }
  .dn-pin::after { display: none; }
  .dn-film video { display: none; }
}
