/* AI DIY Project (#prompts in portal.js): the intro, one folding card per project in its accent colour (--accent),
   its build animation (diy-motion.js), prompts and tutorial videos, then the Prompt library archive. The animation
   stage reuses the walkthrough player's classes (ow-… in visuals.css); everything that moves stops for reduced motion. */
.diy-page { max-width: 1100px; }
.diy-page h1 .new-pill { margin: 0 0 0 12px; vertical-align: .55em; }
.diy-intro { display: grid; gap: 10px; max-width: 70ch; margin-top: 4px; }
.diy-intro p { margin: 0; font-size: 16px; line-height: 1.65; color: var(--muted); }
.diy-intro p:first-child { color: rgba(242,244,248,.86); font-size: 17px; }
.diy-intro b { color: var(--ink); font-weight: 600; }
.diy-lab { padding: 12px 16px; border-radius: 14px; background: rgba(92,255,157,.05); box-shadow: inset 0 0 0 1px rgba(92,255,157,.22); }
.diy-lab b { color: #7CFFB2; font-family: var(--mono); font-size: 13px; letter-spacing: .06em; }
.diy-list { display: grid; gap: 16px; margin-top: 28px; }

/* A project: the header folds the rest away; the newest day's projects start open */
.diy-card { --accent: #8CC8FF; border-radius: var(--r); background: radial-gradient(70% 90% at 0% 0%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%), var(--glass); box-shadow: inset 0 0 0 1px var(--line2); scroll-margin-top: 90px; }
.diy-head { position: relative; display: grid; gap: 8px; padding: 22px 64px 22px 24px; border-radius: var(--r); }
.diy-card > summary { cursor: pointer; list-style: none; }
.diy-card > summary::-webkit-details-marker { display: none; }
.diy-card > summary::after { content: ""; position: absolute; right: 26px; top: 28px; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
.diy-card[open] > summary::after { transform: translate(0, 4px) rotate(-135deg); }
.diy-card > summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.diy-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font: 500 11px/1.2 var(--mono); letter-spacing: .06em; color: var(--faint); }
.diy-meta .new-pill { margin-right: 0; padding: 4px 7px; }
.diy-kind { padding: 4px 8px; border-radius: var(--pill); color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); text-transform: uppercase; }
.diy-card h2 { margin: 2px 0 0; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.2; text-wrap: balance; }
/* The summary holds only phrasing content, so the text and the parts list are spans laid out as blocks */
.diy-sum { display: block; max-width: 70ch; font-size: 16px; line-height: 1.6; color: var(--muted); }
.diy-need { display: grid; gap: 3px; margin-top: 4px; font-size: 14px; line-height: 1.55; color: var(--muted); }
.diy-need b { margin-bottom: 2px; font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.diy-item { position: relative; padding-left: 1.1em; }
.diy-item::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.diy-body { padding: 0 24px 24px; }
.diy-body > .ov { margin-top: 0; }
.diy-body h3 { margin: 26px 0 6px; font-size: 20px; }
.diy-small { margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: var(--faint); }
.diy-prompts .prompt-box { margin: 12px 0 0; }
.diy-prompts .prompt-box p { margin: 0; font-size: 14px; line-height: 1.75; }
.diy-videos ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.diy-videos a { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; border-radius: 14px; color: var(--ink); text-decoration: none; background: rgba(255,255,255,.03); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s, background .2s; }
.diy-videos a:hover, .diy-videos a:focus-visible { background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1px rgba(140,200,255,.45); }
.diy-play { position: relative; width: 40px; height: 28px; border-radius: 8px; background: #f03; }
.diy-play::after { content: ""; position: absolute; left: 16px; top: 8px; border-left: 10px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.diy-videos a b { display: block; font-weight: 600; font-size: 15px; line-height: 1.35; }
.diy-videos a small { display: block; margin-top: 2px; font-size: 13px; color: var(--faint); }

/* The view's skeleton (skeleton.js): the animation's box and the video rows in their real sizes */
.diy-skel-stage { height: 529px; margin-bottom: 8px; border-radius: var(--r); }
.diy-skel-video { height: 56px; margin-top: 8px; border-radius: 14px; }
.diy-skel-archive { padding: 22px 0 8px; }
.diy-skel-archive h2 { margin: 6px 0 0; font-size: clamp(22px, 2.4vw, 28px); }

/* The lesson prompts, kept as an archive under the projects */
.prompt-archive { margin-top: 44px; border-top: 1px solid var(--line2); }
.prompt-archive > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 22px 0 8px; cursor: pointer; list-style: none; }
.prompt-archive > summary::-webkit-details-marker { display: none; }
.prompt-archive > summary h2 { margin: 0; font-size: clamp(22px, 2.4vw, 28px); }
.prompt-archive > summary .eyebrow { flex-basis: 100%; }
.prompt-archive > summary em { font: 600 13px var(--sans); font-style: normal; padding: 8px 14px; border-radius: var(--pill); box-shadow: inset 0 0 0 1px var(--line2); }
.prompt-archive > summary em::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 2px 3px 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.prompt-archive[open] > summary em { background: rgba(255,255,255,.06); }
.prompt-archive[open] > summary em::after { margin-bottom: -1px; transform: rotate(-135deg); }
.prompt-archive > summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; border-radius: 8px; }
.prompt-archive > .muted { max-width: 68ch; }
/* The lesson prompts keep the old page's look: the search, then each lesson's title over its prompt */
.prompt-archive .search { display: block; width: 100%; margin-top: 8px; }
.prompt-archive #prompt-results > h3 { margin-top: 28px; font-weight: 600; }

/* The build animation: steps on the left, the terminal on the right, the result card over its corner */
.ow-stage.dm-stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; height: 340px; padding: 18px; background: radial-gradient(110% 120% at 0% 0%, color-mix(in srgb, var(--accent) 34%, #0a1a4d) 0%, #0b1638 55%, #070d22 100%); color: var(--ink); font-family: var(--sans); }
.dm-steps { display: grid; align-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.dm-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 10px; padding: 7px 10px 7px 7px; border-radius: 12px; font-size: 13.5px; line-height: 1.35; color: rgba(242,244,248,.5); background: rgba(255,255,255,.03); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); transition: color .35s, background .35s, box-shadow .35s; }
.dm-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.06); transition: background .35s, color .35s; }
.dm-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dm-step.on { color: var(--ink); background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent); }
.dm-step.on .dm-ico { color: #05070C; background: var(--accent); }
.dm-term { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border-radius: 12px; background: #0b0d12; box-shadow: 0 0 0 1px rgba(255,255,255,.1), 0 24px 50px -24px rgba(0,0,0,.9); }
.dm-bar { flex: none; display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; background: #171a22; font: 12px var(--mono); color: rgba(242,244,248,.55); }
.dm-bar i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.dm-bar i:nth-child(2) { background: #febc2e; }
.dm-bar i:nth-child(3) { background: #28c840; margin-right: 8px; }
.dm-bar span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ow-screen.dm-screen { color: #d5dbe8; font-size: 12.5px; }
.dm-screen .ow-l + .ow-l { margin-top: 6px; }
/* A line that wraps lines up under its text, not under the tick */
.dm-screen .ow-l { padding-left: 19px; text-indent: -19px; }
.dm-dim { color: var(--accent); font-weight: 700; }
.dm-ok { display: inline-block; width: 6px; height: 11px; margin: 0 10px 0 3px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(45deg) translate(-1px, -2px); }
.dm-result { position: absolute; right: 26px; bottom: 26px; z-index: 4; display: grid; justify-items: center; gap: 10px; width: min(250px, 44%); padding: 14px 14px 12px; border-radius: 16px; background: rgba(10,14,23,.94); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent), 0 26px 60px -20px rgba(0,0,0,.9), 0 0 40px -10px color-mix(in srgb, var(--accent) 60%, transparent); text-align: center; }
.dm-result b { font-size: 14px; font-weight: 600; }
.dm-art { position: relative; display: block; width: 100%; height: 96px; overflow: hidden; border-radius: 10px; background: #111827; }
/* A game: pieces falling into a tray, with the score in the corner */
.dm-fall { position: absolute; top: 8px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); }
.dm-fall:nth-child(1) { left: 18%; top: 22px; }
.dm-fall:nth-child(2) { left: 44%; top: 8px; border-radius: 4px; }
.dm-fall:nth-child(3) { left: 66%; top: 40px; }
.dm-fall:nth-child(4) { left: 82%; top: 16px; border-radius: 4px; }
.dm-fall.dm-bad { background: #ef4444; border-radius: 50% 50% 50% 0; }
.dm-tray { position: absolute; left: 34%; bottom: 8px; width: 30%; height: 10px; border-radius: 3px 3px 8px 8px; background: #f2f4f8; }
.dm-game em { position: absolute; right: 8px; top: 6px; font: 700 12px var(--mono); font-style: normal; color: var(--accent); }
/* A tool: form rows and its send button */
.dm-tool { display: grid; align-content: center; gap: 8px; padding: 12px; }
.dm-row { display: block; height: 10px; border-radius: 4px; background: rgba(255,255,255,.18); }
.dm-row.dm-short { width: 60%; }
.dm-send { display: block; height: 22px; margin-top: 4px; border-radius: var(--pill); background: var(--accent); }
/* A device: a board with its LED, and a phone with a switch */
.dm-board { position: absolute; left: 12%; top: 22px; width: 40%; height: 52px; border-radius: 6px; background: #0f3d2e; box-shadow: inset 0 0 0 2px #1f6b50; }
.dm-led { position: absolute; right: 10px; top: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px 4px var(--accent); }
.dm-phone { position: absolute; right: 14%; top: 10px; width: 26%; height: 76px; border-radius: 9px; background: #1f2937; box-shadow: inset 0 0 0 2px #374151; }
.dm-switch { position: absolute; left: 50%; top: 28px; width: 28px; height: 16px; margin-left: -14px; border-radius: 8px; background: var(--accent); }
.dm-switch::after { content: ""; position: absolute; right: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; }

@media (prefers-reduced-motion: no-preference) {
  .ow-live .dm-result.on { animation: dm-pop .5s cubic-bezier(.2,1.4,.4,1) both; }
  .ow-live .dm-screen .ow-l.on { animation: ow-appear .25s ease both; }
  .ow-live .dm-result.on .dm-fall { animation: dm-fall 1.6s linear infinite; }
  .ow-live .dm-result.on .dm-fall:nth-child(2) { animation-delay: -.5s; }
  .ow-live .dm-result.on .dm-fall:nth-child(3) { animation-delay: -1.1s; animation-duration: 2s; }
  .ow-live .dm-result.on .dm-fall:nth-child(4) { animation-delay: -.8s; animation-duration: 1.3s; }
  .ow-live .dm-result.on .dm-tray { animation: dm-tray 2.4s ease-in-out infinite alternate; }
  .ow-live .dm-result.on .dm-send { animation: dm-pulse 1.4s ease-in-out infinite; }
  .ow-live .dm-result.on .dm-led { animation: dm-blink 1.2s steps(1) infinite; }
  .diy-card > summary::after { transition: transform .25s; }
}
@keyframes dm-pop { from { opacity: 0; transform: translateY(14px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes dm-fall { from { transform: translateY(-30px); } to { transform: translateY(110px); } }
@keyframes dm-tray { from { transform: translateX(-60%); } to { transform: translateX(80%); } }
@keyframes dm-pulse { 50% { opacity: .55; } }
@keyframes dm-blink { 50% { opacity: .25; box-shadow: none; } }
@media (prefers-reduced-motion: reduce) {
  .dm-step, .dm-ico { transition: none; }
}

@media (max-width: 640px) {
  .diy-head { padding: 18px 50px 18px 16px; }
  .diy-card > summary::after { right: 20px; top: 24px; }
  .diy-body { padding: 0 12px 18px; }
  .diy-body > .ov { padding: 14px 12px; }
  .diy-intro p:first-child { font-size: 16px; }
  .ow-stage.dm-stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 10px; height: 470px; padding: 12px; }
  .dm-steps { gap: 5px; }
  .dm-step { grid-template-columns: 28px minmax(0, 1fr); gap: 8px; padding: 4px 8px 4px 4px; font-size: 12.5px; }
  .dm-ico { width: 28px; height: 28px; border-radius: 8px; }
  .dm-ico svg { width: 15px; height: 15px; }
  .ow-screen.dm-screen { font-size: 11px; }
  .dm-result { right: 50%; bottom: 18px; width: min(220px, 70%); gap: 8px; padding: 10px 10px 9px; transform: translateX(50%); }
  .dm-art { height: 70px; }
  .dm-board { top: 12px; height: 44px; }
  .dm-phone { top: 6px; height: 58px; }
  .dm-switch { top: 20px; }
  .diy-skel-stage { height: 650px; }
  .diy-card { scroll-margin-top: 150px; }
  .diy-videos a { grid-template-columns: 34px minmax(0, 1fr); padding: 10px 12px; }
  .diy-videos a > svg { display: none; }
  .diy-play { width: 34px; height: 24px; }
  .diy-play::after { left: 13px; top: 6px; }
}
@media (max-width: 640px) and (prefers-reduced-motion: no-preference) { .ow-live .dm-result.on { animation-name: dm-pop-phone; } }
@keyframes dm-pop-phone { from { opacity: 0; transform: translate(50%, 14px) scale(.9); } to { opacity: 1; transform: translateX(50%); } }
