/* Each product page's own look, so the pages do not read as one template. scripts/product_worlds.py
   lays out each hero and draws its motif; this file gives every page its colours, type and motion. Every drawing
   rests in its finished state, so it still shows when motion is reduced and the animations are off. */

/* What every world shares. */
:root:has(.product-detail), .world-card { --header: color-mix(in srgb, var(--paper) 88%, transparent); --header-solid: color-mix(in srgb, var(--paper) 96%, transparent); --p-accent: var(--brand-orange); --p-accent-text: var(--accent-text); --p-line: #0000001f; --p-label: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace; }
:root[data-theme='dark']:has(.product-detail), :root[data-theme='dark'] .world-card { --p-line: #ffffff21; }
/* The generic grid gives way to the page's own drawing. */
.product-detail .detail-hero::after { display: none; }
.detail-motif { position: absolute; z-index: -1; top: -16px; left: calc(50% - 50vw); width: 100vw; height: 780px; color: var(--p-line); pointer-events: none; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 14%, transparent 34%, transparent 66%, #000 86%), linear-gradient(#000 55%, transparent 96%); -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, #000 14%, transparent 34%, transparent 66%, #000 86%), linear-gradient(#000 55%, transparent 96%); mask-composite: intersect; }
.hero-left .detail-motif { -webkit-mask-image: radial-gradient(58% 72% at 80% 26%, #000 30%, transparent 78%); mask-image: radial-gradient(58% 72% at 80% 26%, #000 30%, transparent 78%); }
.detail-motif > svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
@keyframes world-draw { from { stroke-dashoffset: 1; } }
@keyframes world-pop { from { opacity: 0; transform: scale(.4); } }
@keyframes world-fade { from { opacity: 0; } }
@keyframes world-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes world-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* A left-hand hero leaves the right of the stage to the drawing. */
.hero-left .detail-hero-heading { justify-items: start; margin-inline: 0; text-align: left; }
.hero-left :is(.detail-links, .detail-notes, .note-links) { justify-content: flex-start; margin-inline: 0; }
.hero-left .cli-hero { margin-inline: 0; }

/* Claims are numbered in the page's own type, with a hairline after the number. */
.claim-index { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; color: var(--p-accent-text); font: 600 13px/1 var(--p-label); letter-spacing: .14em; font-variant-numeric: tabular-nums; }
.claim-index::after, .detail-claim-plain .claim-index::before { content: ''; width: 44px; height: 1px; background: currentColor; opacity: .45; }
.detail-claim-plain .claim-index { justify-content: center; }

/* The install command reads as typed at a prompt; the prompt and cursor are not copied. */
.cli-hero code::before { content: '$ '; color: var(--muted); }
.cli-hero code::after { content: ''; display: inline-block; width: .55em; height: 1.15em; margin-left: 3px; vertical-align: -.24em; border-radius: 1px; background: var(--p-accent); animation: world-blink 1.1s linear infinite; }

/* The hero screen of a desktop tool sits in its own window. */
.window-chrome { overflow: hidden; border: 1px solid var(--hairline-strong); border-radius: 16px; background: var(--surface-1); box-shadow: var(--shadow-lg); }
.window-chrome .capture-link, .window-chrome .product-capture { border: 0; border-radius: 0; box-shadow: none; }
.chrome-bar { position: relative; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-bottom: 1px solid var(--hairline); background: var(--surface-2); color: var(--muted); font: 500 12px/1 ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace; }
.chrome-bar i { flex: none; width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.chrome-bar i:nth-child(2) { background: #febc2e; }
.chrome-bar i:nth-child(3) { background: #28c840; }
.chrome-bar > span { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.chrome-address { min-width: min(34%, 340px); padding: 7px 18px; border-radius: 999px; background: var(--surface-1); text-align: center; }

/* AgentHub: the control room. A field of agent cells, a few busy, with signals running between them. */
:root:has(.agenthub-detail), .world-agenthub { --p-label: AgentHubWordmark, ui-monospace, monospace; }
:root[data-theme='light']:has(.agenthub-detail), :root[data-theme='light'] .world-agenthub { --paper: #f8f7f5; }
:root[data-theme='dark']:has(.agenthub-detail), :root[data-theme='dark'] .world-agenthub { --paper: #000; }
.motif-agenthub .lit { fill: var(--p-accent); stroke: none; opacity: 0; animation: agenthub-busy 8s ease-in-out calc(var(--i) * .85s) infinite; }
@keyframes agenthub-busy { 0%, 100% { opacity: 0; } 12%, 40% { opacity: .85; } 62% { opacity: 0; } }
.motif-agenthub .signal { stroke: var(--p-accent); stroke-width: 2; stroke-dasharray: .14 1; stroke-dashoffset: .14; animation: agenthub-signal 5.6s ease-in-out calc(var(--i) * 1.4s + .6s) infinite; }
@keyframes agenthub-signal { 0% { stroke-dashoffset: .14; } 55%, 100% { stroke-dashoffset: -1; } }

/* Intent CLI: a terminal tool. Commit graphs branch and merge beside the title; the heads are the mark's orange node. */
:root[data-theme='light']:has(.intent-detail), :root[data-theme='light'] .world-intent { --paper: #f6f7f8; }
:root[data-theme='dark']:has(.intent-detail), :root[data-theme='dark'] .world-intent { --paper: #020304; }
.motif-intent .lane { stroke-width: 1.5; stroke-dasharray: 1; animation: world-draw 1.8s var(--ease) calc(var(--i) * .22s + .2s) both; }
.motif-intent :is(.node, .head) { transform-box: fill-box; transform-origin: center; }
.motif-intent .node { fill: var(--paper); animation: world-pop .5s var(--ease) calc(var(--i) * .07s + 1.1s) both; }
.motif-intent .head { fill: var(--p-accent); stroke: none; animation: world-pop .5s var(--ease) 2.1s both, intent-head 2.8s ease-in-out 2.6s infinite; }
@keyframes intent-head { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* IntHub: Intent's GitHub. Workspaces push to the hub and pull from it; its own blue marks what is moving. */
:root:has(.inthub-detail), .world-inthub { --p-label: 'Avenir Next', Avenir, 'PingFang SC', sans-serif; }
:root[data-theme='light']:has(.inthub-detail), :root[data-theme='light'] .world-inthub { --p-accent: #2f6fde; --p-accent-text: #2456b8; --paper: #f7f8fa; --glow: #2f6fde1a; --glow-strong: #2f6fde2e; }
:root[data-theme='dark']:has(.inthub-detail), :root[data-theme='dark'] .world-inthub { --p-accent: #6d9bff; --p-accent-text: #8ab4ff; --paper: #020306; --glow: #2f6fde24; --glow-strong: #2f6fde3d; }
.motif-inthub .spoke { stroke-width: 1.4; stroke-dasharray: 2 6; }
.motif-inthub :is(.hub, .place) { stroke-width: 1.4; }
.motif-inthub .pulse { stroke: var(--p-accent); stroke-width: 2; stroke-dasharray: .12 1; stroke-dashoffset: .12; animation: inthub-pulse 4.8s ease-in-out calc(var(--i) * .8s) infinite; }
@keyframes inthub-pulse { 0% { stroke-dashoffset: .12; } 50%, 100% { stroke-dashoffset: -1; } }
.motif-inthub :is(.hub, .place) { fill: var(--paper); }
.motif-inthub .place { animation: inthub-place 4.8s ease-in-out calc(var(--i) * .8s) infinite; }
@keyframes inthub-place { 0%, 100% { stroke: currentColor; } 45% { stroke: var(--p-accent); } }
.motif-inthub .mark-ink { fill: var(--ink); stroke: none; }
.motif-inthub .mark-grey { fill: #858585; stroke: none; }

/* Caret: an editor in the browser. Lines of code on either side, one just edited, the caret blinking after it. */
:root[data-theme='light']:has(.caret-detail), :root[data-theme='light'] .world-caret { --paper: #fbfbfa; }
:root[data-theme='dark']:has(.caret-detail), :root[data-theme='dark'] .world-caret { --paper: #050505; }
.motif-caret :is(.code, .ln) { fill: currentColor; stroke: none; }
.motif-caret .ln { font: 500 11px ui-monospace, 'SF Mono', Menlo, monospace; text-anchor: end; }
.motif-caret .code.edited { fill: var(--p-accent); opacity: .6; }
.motif-caret .band { fill: var(--p-accent); stroke: none; opacity: .08; }
.motif-caret .cursor { fill: var(--p-accent); stroke: none; animation: world-blink 1.06s linear infinite; }
.caret-detail .detail-display .title-line > span::after { content: ''; display: inline-block; width: .07em; height: .86em; margin-left: .12em; vertical-align: -.06em; border-radius: 2px; background: var(--p-accent); animation: world-blink 1.06s linear infinite; }

/* Yew: warm paper and forest green, sprigs of yew in the corners, and the mascot greeting from beside the title. */
:root:has(.yew-detail), .world-yew { --p-accent: #c8323f; --p-label: Georgia, 'Songti SC', serif; }
:root[data-theme='light']:has(.yew-detail), :root[data-theme='light'] .world-yew { --p-accent-text: #1f3a2e; --p-line: #1f3a2e47; --paper: #f6f4ee; --surface-1: #fcfbf7; --surface-2: #efece4; --glow: #1f3a2e12; --glow-strong: #c8323f24; --p-leaf: #1f3a2e66; }
:root[data-theme='dark']:has(.yew-detail), :root[data-theme='dark'] .world-yew { --p-accent-text: #c9d6cd; --p-line: #e3e8e433; --paper: #040705; --surface-1: #0a100c; --surface-2: #101913; --glow: #3d6b521f; --glow-strong: #c8323f30; --p-leaf: #c9d6cd47; }
.motif-yew .stem { stroke-width: 1.6; stroke-dasharray: 1; animation: world-draw 1.4s var(--ease) .2s both; }
.motif-yew .needle { fill: var(--p-leaf); stroke: none; animation: world-fade .8s ease calc(var(--i) * .045s + .4s) both; }
.motif-yew .berry { fill: var(--p-accent); stroke: none; }
.motif-yew .seed { fill: #1f3a2e; stroke: none; }
.motif-yew .aril { transform-box: fill-box; transform-origin: 50% 0; animation: world-pop .7s var(--ease) calc(var(--i) * .15s + 1.3s) both, yew-sway 5s ease-in-out calc(var(--i) * .7s + 2.2s) infinite; }
@keyframes yew-sway { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(5deg); } }
/* Yew in the hero. On a wide screen she stands in full at the right of the title, the screen's edge across her
   skirt; on a narrower one she peeks over the screen's top edge. Whichever the width hides is never fetched. */
.detail-portrait { display: none; }
.detail-hero-visual:has(.detail-mascot) > .detail-figure { position: relative; z-index: 1; }
.detail-hero-visual:has(.detail-mascot) { margin-top: 32px; }
.detail-mascot { position: relative; z-index: 0; display: block; width: 136px; height: auto; margin: 0 auto -34px; filter: drop-shadow(0 16px 26px #1f3a2e24); animation: world-bob 5.5s ease-in-out infinite; }
@media (min-width: 1280px) {
  /* Anchored to the top of the screen, which always covers the last part of her, however tall the title runs. */
  .detail-portrait { display: block; position: absolute; z-index: 0; bottom: calc(100% - 150px); right: clamp(0px, 3vw, 48px); width: auto; height: clamp(540px, 42vw, 640px); pointer-events: none; filter: drop-shadow(0 24px 40px #1f3a2e26); animation: world-bob 6.5s ease-in-out infinite; }
  .hero-left:has(.detail-portrait) .detail-hero-heading { max-width: calc(100% - clamp(300px, 24vw, 360px)); }
  /* A two-line English title breaks at a space, never inside multi-agent, as balancing would. */
  .detail-hero:has(.detail-portrait) .detail-display { text-wrap: wrap; }
  .detail-hero:has(.detail-portrait) .detail-mascot { display: none; }
  .detail-hero:has(.detail-portrait) .detail-hero-visual { margin-top: 56px; }
}
.claim-mascot { display: block; width: clamp(96px, 8.5vw, 124px); height: auto; margin-top: 24px; animation: world-bob 6s ease-in-out infinite; }
.detail-claim-plain .claim-mascot { margin-inline: auto; }
/* A mascot with the line she says in the product, drawn the way the interface draws it (Yew's sidebar). */
.mascot-scene { display: flex; align-items: center; justify-content: center; gap: clamp(12px, 2vw, 24px); margin: 0; padding: clamp(28px, 5vw, 64px) clamp(20px, 4vw, 48px); border-radius: 24px; background: var(--surface-2); }
/* The scene needs less width than a screen, so its copy gets half the row and the long sentence breaks at its punctuation. */
@media (min-width: 801px) {
  .detail-claim:has(> .mascot-scene) { grid-template-columns: minmax(340px, 1fr) minmax(0, 1fr); }
  .detail-claim-reverse:has(> .mascot-scene) { grid-template-columns: minmax(0, 1fr) minmax(340px, 1fr); }
}
.scene-mascot { flex: none; width: clamp(140px, 15vw, 220px); height: auto; animation: world-bob 5.5s ease-in-out infinite; }
.scene-bubble { max-width: 320px; margin: 0; padding: 16px 22px; border: 1px solid var(--hairline-strong); border-radius: 18px; background: var(--surface-1); box-shadow: var(--shadow-lg); color: var(--ink); font-size: clamp(16px, 1.6vw, 21px); line-height: 1.55; }
/* One line per sentence, as the interface sets them. */
.scene-bubble span { display: block; white-space: nowrap; }
.closing-mascot { width: 116px; height: auto; margin-bottom: 4px; animation: world-bob 6s ease-in-out infinite; }

/* WeSaid: paper and a muted rose, two rings drawing close and apart like the two people exchanging answers. */
:root:has(.wesaid-detail) body { background-image: var(--paper-grain); }
:root:has(.wesaid-detail), .world-wesaid { --p-accent: #b4748c; --glow: #b4748c1f; --glow-strong: #b4748c38; --p-label: WeSaidWordmark, Georgia, 'Songti SC', serif;
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .23 0 0 0 0 .14 0 0 0 0 .16 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url%28%23n%29'/%3E%3C/svg%3E"); }
:root[data-theme='light']:has(.wesaid-detail), :root[data-theme='light'] .world-wesaid { --p-accent-text: #8a4a63; --p-line: #3b1f2a33; --paper: #f4efe6; --surface-1: #faf6ef; --surface-2: #ebe3d6; }
:root[data-theme='dark']:has(.wesaid-detail), :root[data-theme='dark'] .world-wesaid { --p-accent-text: #e3b5c5; --p-line: #f4e9e72e; --paper: #171315; --surface-1: #211b1e; --surface-2: #292125; }
.wesaid-detail :is(.detail-display, .detail-title) { font-family: WeSaidWordmark, 'Songti SC', 'Noto Serif SC', 'Source Han Serif SC', serif; letter-spacing: -.02em; }
.wesaid-detail .detail-motif { -webkit-mask-image: radial-gradient(56% 64% at 50% 34%, #000 30%, transparent 76%); mask-image: radial-gradient(56% 64% at 50% 34%, #000 30%, transparent 76%); }
.motif-wesaid circle { stroke-width: 1.2; }
.motif-wesaid .ring-two circle { stroke: var(--p-accent); }
.motif-wesaid .echo { opacity: .5; stroke-dasharray: 3 8; }
.motif-wesaid .ring-one { animation: wesaid-near 10s ease-in-out infinite; }
.motif-wesaid .ring-two { animation: wesaid-near-two 10s ease-in-out infinite; }
@keyframes wesaid-near { 50% { transform: translateX(28px); } }
@keyframes wesaid-near-two { 50% { transform: translateX(-28px); } }

/* PassBy: a ruled notebook page with its margin line; the mark drawn large, a password being written on its last line. */
:root:has(.passby-detail), .world-passby { --p-accent: #f56b2c; --glow: #f56b2c1a; --glow-strong: #f56b2c30; --p-label: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
:root[data-theme='light']:has(.passby-detail), :root[data-theme='light'] .world-passby { --paper: #fdfcf9; }
:root[data-theme='dark']:has(.passby-detail), :root[data-theme='dark'] .world-passby { --paper: #000; }
.passby-detail .detail-motif { background: repeating-linear-gradient(transparent 0 39px, var(--p-line) 39px 40px); -webkit-mask-image: linear-gradient(#000 50%, transparent 95%); mask-image: linear-gradient(#000 50%, transparent 95%); }
.passby-detail .detail-hero-heading { position: relative; }
.passby-detail .detail-hero-heading::before { content: ''; position: absolute; top: -40px; bottom: -40px; left: -28px; width: 1.5px; background: var(--p-accent); opacity: .5; }
.motif-passby .bar { fill: var(--paper); stroke-width: 1.4; }
.motif-passby .faint { opacity: .55; }
.motif-passby .dot { fill: var(--p-accent); stroke: none; }
.motif-passby .dot { animation: passby-type 5s steps(1) infinite; animation-delay: calc(var(--i) * .3s); }
@keyframes passby-type { 0% { opacity: 0; } 4%, 70% { opacity: 1; } 72%, 100% { opacity: 0; } }
.motif-passby .cursor { fill: var(--p-accent); stroke: none; animation: world-blink 1.06s linear infinite; }

/* The product list: each card is a small window onto its product's page, in its colours with its drawing behind
   the screen; the drawings hold still here. */
.world-card { background: var(--paper); }
.world-card .v2-product-shot { position: relative; isolation: isolate; background: var(--paper); }
.card-motif { position: absolute; inset: 0; z-index: -1; color: var(--p-line); }
.card-motif > svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.card-motif svg * { vector-effect: non-scaling-stroke; animation: none !important; }
.card-motif .motif-agenthub .lit:nth-of-type(3n) { opacity: .8; }
.world-passby .card-motif { background: repeating-linear-gradient(transparent 0 23px, var(--p-line) 23px 24px); }
.world-card .v2-product-shot > img:not(.card-mascot) { position: absolute; z-index: 1; left: 44px; top: 40px; width: calc(100% - 44px); height: calc(100% - 40px); border: 1px solid var(--hairline-strong); border-width: 1px 0 0 1px; border-radius: 12px 0 0 0; box-shadow: 0 18px 44px -20px #00000059; transform-origin: top left; }
.world-card:hover { border-color: color-mix(in srgb, var(--p-accent) 40%, var(--hairline-strong)); box-shadow: 0 22px 60px -30px var(--glow-strong); }
.world-card .v2-product-shot > .card-mascot { position: absolute; z-index: 0; top: 10px; right: 28px; width: 84px; height: auto; object-fit: contain; transform: none; }
.world-card .v2-product-shot > .card-mascot ~ img:not(.card-mascot) { top: 70px; height: calc(100% - 70px); }

@media (max-width: 800px) {
  .detail-motif { height: 560px; }
  /* A narrow hero has no empty side: the drawing keeps to the top corner, clear of the title. */
  .hero-left .detail-motif { -webkit-mask-image: radial-gradient(60% 34% at 100% 0%, #000 15%, transparent 72%); mask-image: radial-gradient(60% 34% at 100% 0%, #000 15%, transparent 72%); }
  .chrome-bar { height: 32px; gap: 6px; padding: 0 12px; font-size: 11px; }
  .chrome-bar i { width: 9px; height: 9px; }
  .chrome-address { padding: 5px 12px; }
  .passby-detail .detail-hero-heading::before { left: -14px; }
  .claim-mascot { margin-inline: auto; }
}
@media (max-width: 520px) {
  .mascot-scene { flex-direction: column; }
  .window-chrome { border-radius: 12px; }
  .chrome-bar > span { display: none; }
  .detail-mascot { width: 116px; margin-bottom: -28px; }
}
@media (prefers-reduced-motion: reduce) {
  .detail-motif *, .detail-mascot, .detail-portrait, .claim-mascot, .closing-mascot, .scene-mascot, .cli-hero code::after, .caret-detail .detail-display .title-line > span::after { animation: none !important; }
}
