/* The demos: faithful replicas of the app's Desk UI, drawn from its own --d-* tokens (themes.js mirrors
   icedcoffee-tracker/src/desk/looks/palettes.ts). Each demo renders into its own mount point ([data-demo]),
   so a real React component can replace any one of them later. */

/* a chapter window's stage: the live app frame, framed by its camera (16:10, like the app's own window) */
.win-stage {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--d-ground);
  background-image: radial-gradient(var(--d-dots) 1px, transparent 1.5px), var(--d-ground); background-size: 22px 22px, auto;
}
/* while the app starts: the shared ice loader (site/assets/loader/ice-loader.css, linked in index.html), 64 px, centered, with a
   short label under it (demos/appframe.js). It shows only after a beat (.on), and crossfades with the app. */
.app-loading {
  position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  color: var(--d-accent, #ffaf43); opacity: 0; transition: opacity 420ms ease; pointer-events: none;
}
.app-loading.on { opacity: 1; }
.app-loading .ic-loader { --ic-loader-size: 64px; }
.app-loading__label { font-size: 14px; line-height: 1.3; color: var(--d-text-dim); white-space: nowrap; }
.win-stage:has(.app-view.is-ready) .app-loading { opacity: 0; }
/* a window with a skeleton: the loader is a tiny "Brewing..." over it, dead center, and only after a long wait (appframe.js) */
.app-loading.is-over-skel { gap: 8px; }
.app-loading.is-over-skel .ic-loader { --ic-loader-size: 40px; }
.app-loading.is-over-skel .app-loading__label { font-size: 12px; }
.win-stage.frame-failed .app-loading, .win-stage.frame-failed .app-skel { display: none; }

/* ---------- the skeleton under a window's app (demos/skeletons.js lists the blocks; appframe.js builds them) ----------
   Low contrast, in the window's own palette: --d-text and --d-accent are the page's tokens, which are the dark palette the window wears
   (or the light ground, for the hub's light window). The whole thing breathes: one slow opacity loop (2.2 s). The real app fades in over it
   (.app-view, z 2) and it fades out once covered (.is-off); Reduce Motion: still. */
.app-skel { position: absolute; inset: 0; container-type: size; overflow: hidden; pointer-events: none; opacity: 1; transition: opacity 420ms ease 280ms, visibility 0s linear 700ms; --sk-ink: var(--d-text); --sk-acc: var(--d-accent); animation: skel-breathe 2.2s ease-in-out infinite; }
.app-skel.is-off { opacity: 0; visibility: hidden; animation: none; }
.app-skel__in { position: absolute; inset: 0; }
.app-skel .sk { position: absolute; display: block; left: calc(var(--x) * var(--u)); top: calc(var(--y) * var(--u)); width: calc(var(--w) * var(--u)); height: calc(var(--h) * var(--u)); border-radius: calc(var(--r, 4) * var(--u)); }
.sk-p { background: color-mix(in srgb, var(--sk-ink) 4.5%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sk-ink) 8%, transparent); }
.sk-g { background: color-mix(in srgb, var(--sk-ink) 9%, transparent); border-radius: calc(var(--r, 4) * var(--u)); }
.sk-l { background: color-mix(in srgb, var(--sk-ink) 10%, transparent); border-radius: 999px; }
.sk-h { background: color-mix(in srgb, var(--sk-ink) 15%, transparent); border-radius: calc(var(--r, 5) * var(--u)); }
.sk-b { background: color-mix(in srgb, var(--sk-ink) 9%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sk-ink) 6%, transparent); }
.sk-a { background: color-mix(in srgb, var(--sk-acc) 22%, transparent); }
.sk-o { background: color-mix(in srgb, var(--sk-ink) 11%, transparent); border-radius: 50%; }
.app-skel.is-light .sk-p { background: rgba(255, 255, 255, .55); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sk-ink) 9%, transparent); }
.app-skel.is-light .sk-g { background: rgba(255, 255, 255, .78); box-shadow: 0 1px 4px rgba(61, 41, 21, .08); }
@keyframes skel-breathe { 0%, 100% { opacity: .62; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .app-skel { animation: none; opacity: 1; } }
.win-stage.frame-failed::after {
  content: "The live app couldn't open here."; position: absolute; left: 50%; top: 50%; translate: -50% -50%; padding: 8px 14px; border-radius: 999px;
  font-size: 13px; color: var(--d-text-dim); background: color-mix(in srgb, var(--d-surface) 80%, transparent); border: 1px solid rgba(255, 255, 255, .08);
  pointer-events: none; white-space: nowrap;
}

/* the live app frame (demos/appframe.js) */
.app-view { position: absolute; inset: 0; overflow: hidden; opacity: 0; transition: opacity 500ms ease; z-index: 2; }
.app-view.is-ready { opacity: 1; }
.app-frame {
  position: absolute; left: 0; top: 0; width: 1440px; height: 900px; border: 0; display: block; background: transparent;
  transform-origin: 0 0; transition: transform 1000ms cubic-bezier(.22, 1, .36, 1); pointer-events: none;
}
/* the hero's live app sits over its screenshots (z 0 to 2), which keep changing color under it during the tour */
.hero-shots .app-view { z-index: 3; }

/* reveal: in place, so nothing reflows */
.rv { opacity: 0; transform: translateY(10px); transition: opacity 420ms ease, transform 620ms var(--spring); }
.rv.on { opacity: 1; transform: none; }
.rv-pop { opacity: 0; transform: scale(.85); transition: opacity 360ms ease, transform 620ms var(--spring); }
.rv-pop.on { opacity: 1; transform: none; }

/* ---------- app pieces ---------- */
.d-card {
  background: var(--d-surface); border: 1px solid var(--d-line); border-radius: 18px; padding: 14px 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 24px 60px -28px rgba(0, 0, 0, .7);
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.d-eye { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 650; color: var(--d-text-faint); white-space: nowrap; overflow: hidden; }
.d-title { font-size: 15px; font-weight: 650; }
.d-dim { color: var(--d-text-dim); }
.d-row { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.d-btn {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 7px 12px; border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .02); color: var(--d-text); white-space: nowrap;
  transition: background 420ms ease, color 300ms ease, transform 520ms var(--spring), border-color 300ms ease;
}
.d-btn svg, .d-ico { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.d-btn.primary, .d-btn.on { background: var(--d-accent); color: var(--d-accent-ink); border-color: transparent; }
.d-btn.press { transform: scale(.94); }
.d-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--d-line-accent); color: var(--d-accent); white-space: nowrap; }
.d-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; padding: 5px 12px 5px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--d-line-accent); color: var(--d-text-dim); background: transparent;
  transition: background 420ms ease, color 300ms ease, border-color 300ms ease, box-shadow 600ms ease;
}
.d-chip .ring { width: 11px; height: 11px; border-radius: 50%; border: 1.5px dashed currentColor; flex: none; }
.d-chip .tick { display: none; width: 12px; height: 12px; fill: none; stroke: var(--d-accent); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.d-chip.got { border-color: color-mix(in srgb, var(--d-accent) 55%, transparent); background: var(--d-accent-soft); color: var(--d-text); }
.d-chip.got .ring { display: none; }
.d-chip.got .tick { display: block; }
.d-chip.flash { box-shadow: 0 0 0 4px color-mix(in srgb, var(--d-accent) 30%, transparent); }
.d-chips { display: flex; flex-wrap: wrap; gap: 7px; min-height: 30px; }
.d-count { font-size: 15px; }
.d-count b { display: inline-block; font-size: 26px; font-weight: 800; font-stretch: 120%; color: var(--d-accent); margin-right: 4px; transition: transform 520ms var(--spring); }
.d-count b.bump { transform: scale(1.25); }
.d-bar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.d-bar > i { display: block; height: 100%; width: var(--w, 0%); background: var(--d-accent); transition: width 700ms var(--settle); }
.d-skel { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); }
.d-input { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px; background: var(--d-surface); border: 1px solid var(--d-line); color: var(--d-text-dim); min-width: 0; }
.d-input.focus { border-color: var(--d-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--d-accent) 18%, transparent); }
.d-kbd { margin-left: auto; font-size: 11px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--d-line); color: var(--d-text-faint); flex: none; }
.typed { white-space: nowrap; overflow: hidden; color: var(--d-text); }
.caret { display: inline-block; width: 1.5px; height: 1.1em; background: var(--d-accent); vertical-align: -2px; margin-left: 1px; animation: caret 1s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.d-mono {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: #F3E9DA; color: #1b1b1b; font-weight: 800; font-size: 15px;
}
.d-mono svg { width: 18px; height: 18px; fill: currentColor; }
.d-file {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 12px; background: var(--d-surface-2);
  border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); color: var(--d-accent); white-space: nowrap; font-size: 13px;
}
.d-file span { color: var(--d-text); }
.d-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--d-accent) 30%, transparent); border-top-color: var(--d-accent); animation: spin 800ms linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- the problem: Mara's resume + the keyword panel ---------- */
.pb-wrap { container-type: inline-size; }
.pb {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 16px;
  border-radius: 20px; border: 1px solid var(--line);
}
.pb-wrap { position: relative; }
.paper {
  background: #fbfaf7; color: #1d1d1f; border-radius: 10px; padding: 26px 28px; box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; gap: 9px; min-width: 0; font-stretch: 92%;
}
.paper-head { display: flex; align-items: center; gap: 12px; border-bottom: 1.5px solid #1d1d1f; padding-bottom: 10px; }
.paper-mq { width: 40px; height: 40px; border: 2px solid #1d1d1f; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.paper-who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.paper-who b { font-size: 16px; }
.paper-who span { font-size: 12px; color: #444; }
.paper-links { font-size: 11px; color: #2a55c9; text-decoration: underline; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.paper h4 { margin: 4px 0 0; font-size: 15px; }
.paper .job { font-size: 13px; font-weight: 700; }
.paper .dates { font-size: 12px; color: #444; margin-top: -6px; font-weight: 600; }
.paper ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.55; display: flex; flex-direction: column; gap: 6px; }
.sw { position: relative; border-radius: 4px; padding: 0 2px; transition: background 500ms ease, box-shadow 500ms ease; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.sw .wd { white-space: nowrap; }
.sw .old { white-space: nowrap; }
.sw .old { position: relative; display: inline-block; transition: opacity 260ms ease, transform 260ms ease; }
.sw .old::after { content: ""; position: absolute; left: -1px; right: -1px; top: 55%; height: 1.5px; background: #b3261e; transform: scaleX(0); transform-origin: left; transition: transform 250ms ease; }
.sw .new { display: none; font-weight: 650; }
.sw .new .ch { display: inline-block; opacity: 0; transform: translateY(.55em); transition: opacity 260ms ease calc(var(--i) * 25ms), transform 520ms var(--spring) calc(var(--i) * 25ms); white-space: pre; }
.sw.lit { background: color-mix(in srgb, var(--d-accent) 38%, transparent); }
.sw.strike .old::after { transform: scaleX(1); }
.sw.fall .old { opacity: .3; transform: translateY(4px); }
.sw.swapped .old { display: none; }
.sw.swapped .new { display: inline; }
.sw.swapped.rise .new .ch { opacity: 1; transform: none; }
.sw.done { background: color-mix(in srgb, var(--d-accent) 16%, transparent); box-shadow: 0 1.5px 0 var(--d-accent); }
.sw.glow { animation: swglow 900ms ease-out; }
@keyframes swglow { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--d-accent) 70%, transparent), 0 1.5px 0 var(--d-accent); } 100% { box-shadow: 0 0 0 7px transparent, 0 1.5px 0 var(--d-accent); } }

.kw {
  border-radius: 14px; padding: 20px; background: var(--d-ground); border: 1px solid rgba(255, 255, 255, .08); color: var(--d-text);
  display: flex; flex-direction: column; gap: 12px; min-width: 0; transition: opacity 400ms ease;
}
.kw.fade { opacity: .0; }
.kw-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.kw-head b { font-size: 17px; }
.kw-head span { font-size: 12px; color: var(--d-text-faint); }
.kw-foot { display: flex; align-items: center; gap: 8px; color: var(--d-text-dim); font-size: 13px; font-weight: 600; padding-top: 2px; }
@container (max-width: 640px) {
  .pb { grid-template-columns: minmax(0, 1fr); }
}


/* pills never wrap: on a narrow card they cut with a fade (the full word is in the title) */
.d-chip { max-width: 100%; min-width: 0; }
.d-chip > span:last-child { min-width: 0; overflow: hidden; white-space: nowrap; }
.d-chip.cut > span:last-child { -webkit-mask-image: linear-gradient(90deg, #000 78%, transparent); mask-image: linear-gradient(90deg, #000 78%, transparent); }
