/* Project pages (src/templates/project-page.html). Tokens and card language match the homepage. */
:root{
  --bg:#1f2d44;--deep:#121b2b;--panel:#283a56;--line:#3b4f6f;--paper:#f1ebde;--paper-2:#e3dac8;
  --text:#e8edf4;--soft:#a6b5cb;--gold:#e6b84f;--rose:#e79a93;
  --display:'Red Hat Display',system-ui,sans-serif;--body:'Red Hat Text',system-ui,sans-serif;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth;scroll-padding-top:96px}
body{margin:0;overflow-x:clip;background:var(--bg);color:var(--text);font-family:var(--body);font-size:18px;line-height:1.6;-webkit-font-smoothing:antialiased}
a{color:inherit}
img,video,iframe{max-width:100%}
.wrap{max-width:1120px;margin:0 auto;padding:0 28px}
:focus-visible{outline:3px solid var(--gold);outline-offset:3px;border-radius:4px}

/* the sticky bar is shared with the homepage: css/bar.css */

/* header: copy beside a tilted cover */
.head{padding:28px 0 20px}
.head-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,.92fr);gap:56px;align-items:center}
h1{font:900 clamp(52px,8.4vw,108px)/.92 var(--display);letter-spacing:-.04em;margin:0 0 20px;text-wrap:balance}
/* the title's own box, measured by js/project-page.js; .flyer is the copy of it that flies into the bar,
   fixed to the screen and set exactly like h1 so it starts on top of it */
.h1-t{display:inline-block}
.flyer{position:fixed;left:0;top:0;z-index:30;margin:0;pointer-events:none;visibility:hidden;transform-origin:0 0;will-change:transform,opacity;
  font-weight:900;line-height:.92;font-family:var(--display);letter-spacing:-.04em;text-wrap:balance;color:var(--text)}
.lede{font-size:21px;line-height:1.45;color:var(--soft);max-width:30em;margin:0}
.tools{list-style:none;display:flex;flex-wrap:wrap;gap:7px;margin:22px 0 0;padding:0}
.tools li{font:500 13.5px/1 var(--display);padding:7px 11px;border-radius:7px;border:1.5px solid var(--line);color:var(--text)}
.actions{display:flex;flex-wrap:wrap;align-items:center;gap:14px;margin-top:30px}
.also{display:flex;flex-wrap:wrap;align-items:center;gap:8px;font:500 14px var(--display);color:var(--soft)}
.also span{margin:0 2px 0 6px}
.also a{display:inline-block;text-decoration:none;color:var(--text);padding:7px 12px;border:2px solid var(--line);border-radius:99px;transition:border-color .15s}
.also a:hover{border-color:var(--text)}

.cover{position:relative;transform:rotate(2deg);margin:0 10px 10px 0}
.cover img{display:block;width:100%;height:auto;aspect-ratio:1080/780;object-fit:cover;border:5px solid var(--deep);border-radius:18px;box-shadow:11px 11px 0 var(--deep)}
.sticker{position:absolute;left:-18px;bottom:20px;background:var(--rose);color:var(--deep);font:700 15px var(--display);padding:7px 14px;border-radius:99px;border:3px solid var(--deep);transform:rotate(-8deg)}

/* the row above the title: role as a gold pill with its hat, then when and team as quiet text */
.meta{list-style:none;display:flex;flex-wrap:wrap;align-items:center;gap:10px 20px;margin:0 0 20px;padding:0;font:500 15px/1.25 var(--display);color:var(--soft)}
.meta li{display:inline-flex;align-items:center;gap:8px}
.meta img{width:16px;height:16px;flex:none;opacity:.75}
.meta .meta-role{color:var(--text);font-weight:700}
.meta .meta-role img{width:20px;height:20px;opacity:.9}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

.btn{display:inline-flex;align-items:center;gap:10px;font:700 17px var(--display);text-decoration:none;padding:13px 22px;border-radius:99px;border:3px solid var(--deep);background:var(--gold);color:var(--deep);box-shadow:5px 5px 0 var(--deep);transition:transform .12s}
.btn.alt{background:transparent;color:var(--text);border-color:var(--text);box-shadow:none}
.btn:hover{transform:translate(-2px,-2px)}
.btn.ext:after{content:"";width:13px;height:13px;background:currentColor;-webkit-mask:var(--ext) center/contain no-repeat;mask:var(--ext) center/contain no-repeat}

/* story: chapters on the left, media on the right */
.story{padding:76px 0 30px}
.story-grid{display:grid;grid-template-columns:minmax(0,1fr)}
/* no media: one column at reading width, centred on the page */
.story-grid.flat{justify-items:center}
.flat .ch{width:min(100%,36em)}
.ch{padding:0 0 26px}
.ch-n{display:inline-block;font:700 14px/1 var(--display);letter-spacing:.06em;color:var(--gold);margin:0 0 14px;padding:6px 10px;border:2px solid var(--gold);border-radius:99px;transition:background .2s,color .2s}
.ch h2{font:900 34px/1.05 var(--display);letter-spacing:-.025em;margin:0 0 18px;text-wrap:balance}
.prose p{margin:0 0 1em;max-width:36em}
.prose p:last-child{margin-bottom:0}
.prose a{text-decoration-color:var(--gold);text-decoration-thickness:2px;text-underline-offset:3px}
.prose a:hover{color:var(--gold)}
/* a track inside a chapter: its title, then the player */
.track{margin:22px 0 0;max-width:36em}
.track figcaption{font:700 15px/1.3 var(--display);color:var(--soft);margin:0 0 8px}
.track audio{display:block;width:100%}
/* code inside a chapter, on paper like the figures */
.prose pre{margin:22px 0 0;max-width:100%;max-height:440px;overflow:auto;background:var(--paper);color:var(--deep);border:4px solid var(--deep);border-radius:14px;box-shadow:6px 6px 0 var(--deep);padding:16px 18px;font:14px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace}
.prose pre+p{margin-top:16px;font-size:15px;color:var(--soft)}

.fig{margin:0 0 64px;width:100%;max-width:560px;background:var(--paper-2);border:4px solid var(--deep);border-radius:18px;overflow:hidden;box-shadow:10px 10px 0 var(--deep)}
.fig.tall{max-width:340px}
.frame{position:relative;aspect-ratio:var(--ar);background:var(--deep);border-bottom:4px solid var(--deep)}
.frame>img,.frame>video,.frame>iframe{display:block;width:100%;height:100%;object-fit:cover;border:0}
.fig figcaption{display:flex;align-items:center;gap:12px;color:#2c3a52;font:500 14px/1.3 var(--display);padding:11px 14px}
.fig-n{flex:none;font-weight:700;color:var(--deep)}
.fig-c{flex:1;min-width:0}
/* a cutout of an app's UI (media.cutout): no frame, the transparent image sits on the page and its
   caption is a separate speech bubble under it, pointing up at the image */
.fig.cut{background:none;border:0;border-radius:0;overflow:visible;box-shadow:none}
.fig.cut .frame{background:none;border:0}
.fig.cut .frame>img{object-fit:contain}
.fig.cut figcaption{position:relative;width:fit-content;max-width:100%;box-sizing:border-box;margin:20px 0 0;background:var(--paper);border:3px solid var(--deep);border-radius:14px;box-shadow:5px 5px 0 var(--deep)}
.fig.cut figcaption:before{content:"";position:absolute;top:-10px;left:24px;width:14px;height:14px;background:var(--paper);border:3px solid var(--deep);border-right:0;border-bottom:0;transform:rotate(45deg)}
.snd{all:unset;box-sizing:border-box;cursor:pointer;flex:none;display:inline-flex;align-items:center;gap:6px;font:700 13px/1 var(--display);color:var(--paper);background:var(--deep);padding:7px 11px;border-radius:99px}
.snd:before{content:"";width:12px;height:12px;background:currentColor;-webkit-mask:var(--snd-off) center/contain no-repeat;mask:var(--snd-off) center/contain no-repeat}
.snd[aria-pressed=true]:before{-webkit-mask-image:var(--snd-on);mask-image:var(--snd-on)}
.snd:focus-visible{outline:3px solid var(--deep);outline-offset:2px}
:root{
  --ext:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7M9 7h8v8'/%3E%3C/svg%3E");
  --snd-off:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9h4l5-5v16l-5-5H3z'/%3E%3Cpath d='M16 9l6 6M22 9l-6 6' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  --snd-on:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9h4l5-5v16l-5-5H3z'/%3E%3Cpath d='M16 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* the stage: on wide screens every figure sits in one sticky spot beside the chapters
   and the chapter being read decides which one shows. Needs JS (html.js), otherwise figures stay inline. */
@media (min-width:980px){
  .js .story-grid{--stage-h:calc(100vh - 210px);grid-template-columns:minmax(0,1fr) min(46%,560px,calc(var(--stage-h) * var(--stage-ar)));column-gap:64px}
  .js .ch{grid-column:1;min-height:max(62vh,440px);padding:0 0 60px}
  .js .ch:last-of-type{min-height:max(70vh,480px)}
  /* --fig-top (set by the JS from the figure's height) centres it in the screen below the bar */
  .js .fig{grid-column:2;grid-row:1/span var(--n);position:sticky;top:var(--fig-top,100px);align-self:start;justify-self:center;margin:0;
    width:min(100%,calc(var(--stage-h) * var(--fig-ar) + 8px));max-width:none;
    opacity:0;visibility:hidden;transform:translateY(14px) rotate(.6deg);transition:opacity .35s,transform .35s,visibility 0s .35s}
  .js .fig.on{opacity:1;visibility:visible;transform:none;transition:opacity .35s,transform .35s,visibility 0s}
  .js .ch.on .ch-n{background:var(--gold);color:var(--deep)}
  /* no media, no stage: plain chapters at reading width */
  .js .story-grid.flat{grid-template-columns:minmax(0,1fr)}
  .js .flat .ch,.js .flat .ch:last-of-type{min-height:0}
}

/* end */
.end{display:flex;flex-wrap:wrap;gap:14px;padding:40px 0 30px;border-top:1px solid var(--line)}
footer{color:var(--soft);font-size:14px;padding:26px 0 40px;border-top:1px solid var(--line)}

@media (min-width:1600px){.wrap{max-width:1280px}}
@media (max-width:900px){
  .head-grid{grid-template-columns:1fr;gap:40px}
  .cover{max-width:560px;transform:rotate(1.5deg)}
  .story{padding-top:56px}
}
@media (max-width:640px){
  body{font-size:17px}
  .wrap{padding:0 18px}
  .head{padding:18px 0 10px}
  .lede{font-size:19px}
  .sticker{left:-8px;font-size:13px}
  .ch h2{font-size:28px}
  .fig{margin-bottom:52px}
  .fig.tall{max-width:300px}
  .fig{box-shadow:6px 6px 0 var(--deep)}
}
@media (max-width:400px){
  .btn{font-size:16px;padding:12px 18px}
}
@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  .btn,.also a,.js .fig,.js .fig.on{transition:none}
  .btn:hover{transform:none}
  .js .fig{transform:none}
}
