/* project.css: PathLENS only. The palette is in theme.css and the common layout is the shared stylesheet
   (https://khosrofar.me/shared/shared.css, source Portfolio/_shared/shared.css); nothing here redefines those. */

/* Sections are cards; the body text column stays readable. */
.card-body p, .card-body li { max-width: 78ch; }
.card-body table { font-size: .85rem; }
.card-body table th, .card-body table td { padding: .25rem .6rem; }
.card-body table { border-collapse: collapse; margin: .5rem 0 1rem; }
.card-body table th { text-align: left; border-bottom: 1px solid var(--line); }
.card-body table td { border-bottom: 1px solid #e6e8eb; font-variant-numeric: tabular-nums; }

figure { margin: 1rem 0 0; }
figure svg, figure canvas, figure img { max-width: 100%; height: auto; }
figure figcaption { font-size: .8rem; color: #6c757d; padding-top: .5rem; }
svg.hierarchy { width: 100%; height: auto; background: #fff; border: 1px solid var(--line); }

/* The clinic and the other live widgets. */
[data-widget] canvas, [data-widget] img { border: 1px solid var(--line); background: #fff; }
.todo-author { border-left: 3px solid var(--brick); background: #f8f6f5; padding: .6rem .8rem; font-size: .9rem; }

pre { background: #17293f; color: #eef1f5; padding: .85rem; border-radius: .2rem; overflow-x: auto; }
pre code { color: inherit; }

@media (max-width: 991.98px) { aside .position-sticky { position: static !important; } }


/* Buttons: the widgets' plain <button>s follow the shared look (navy, as .btn-primary / .btn-outline-secondary in theme.css). */
[data-widget] button, .overlay-toggle button {
  display: inline-block;
  font-size: .875rem;
  line-height: 1.5;
  padding: .25rem .6rem;
  margin: 0 .25rem .35rem 0;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--navy);
  border-radius: .25rem;
  cursor: pointer;
}
[data-widget] button:hover { background: #eef1f5; }
[data-widget] button[aria-pressed="true"],
[data-widget] button[data-role="ig-start"] { color: #fff; background: var(--navy); border-color: #1c1e21; }
[data-widget] button[aria-pressed="true"]:hover,
[data-widget] button[data-role="ig-start"]:hover { background: var(--navy-deep); }
[data-widget] button:disabled { opacity: .55; cursor: default; }
[data-widget] button:focus-visible { outline: 0; box-shadow: 0 0 0 .2rem rgba(31, 58, 92, .25); }

/* The patch picker: thumbnails as a row of small framed buttons. */
.picker { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 1rem; }
.picker button { padding: 2px; margin: 0; background: #fff; border-color: var(--line); line-height: 0; }
.picker button:hover { border-color: var(--navy); }
.picker img { display: block; width: 56px; height: 56px; image-rendering: pixelated; }

.overlay-toggle { display: flex; flex-wrap: wrap; align-items: center; margin-bottom: .75rem; }
.overlay-toggle [data-role="ig-status"] { font-size: .8rem; color: #6c757d; margin-left: .5rem; }

/* Links: in-text links follow the shared a / a:hover rules; downloads and the stream status stay plain. */
.card-body a { text-underline-offset: .15em; }


/* Stain lab */
[data-widget="stain-lab"] .controls { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; margin-bottom: .5rem; }
[data-widget="stain-lab"] .controls label { font-size: .875rem; }
[data-widget="stain-lab"] output { display: inline-block; min-width: 2.5rem; font-variant-numeric: tabular-nums; }
.lab-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; align-items: start; }
.lab-grid h3 { font-size: 1rem; font-weight: 600; }
.lab-grid .patch { width: 192px; height: 192px; image-rendering: pixelated; border: 1px solid var(--line); }
.lab-grid .stack { position: relative; width: 192px; height: 192px; }
.lab-grid .stack .cam { position: absolute; inset: 0; width: 192px; height: 192px; opacity: .6; border: 0; }
.lab-grid .bar { width: 192px; height: .6rem; background: #e6e8eb; margin: .4rem 0; }
.lab-grid .bar span { display: block; height: 100%; background: var(--navy); }
.neighbours { display: flex; flex-wrap: wrap; gap: .25rem; max-width: 260px; }
.neighbours figure { margin: 0; text-align: center; }
.neighbours img { width: 48px; height: 48px; border: 1px solid var(--line); }
.neighbours figcaption { font-size: .65rem; padding: 0; }

/* Server work you can see. A panel with data-busy sweeps a scan line while the request is out; the integrated-gradients
   button fills as each of its steps arrives (--p runs 0 to 1) and flashes when the stream completes. */
[data-busy] { position: relative; overflow: hidden; }
[data-busy]::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 28%;
  background: linear-gradient(to bottom, rgba(31, 58, 92, 0), rgba(31, 58, 92, .22) 70%, rgba(31, 58, 92, .5) 98%, rgba(31, 58, 92, 0));
  pointer-events: none; animation: pl-scan 1.1s ease-in-out infinite;
}
[data-busy] canvas, [data-busy] img { animation: pl-pulse 1.1s ease-in-out infinite; }
@keyframes pl-scan { from { transform: translateY(-100%); } to { transform: translateY(360%); } }
@keyframes pl-pulse { 50% { filter: saturate(.55) brightness(1.06); } }

[data-widget] button[data-role="ig-start"] { position: relative; overflow: hidden; z-index: 0; transition: box-shadow .2s; }
[data-widget] button[data-role="ig-start"][data-running] { cursor: progress; }
[data-widget] button[data-role="ig-start"][data-running]::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--p, 0) * 100%); z-index: -1;
  background: linear-gradient(90deg, #3d6ba3, #7fb0e6);
  background-size: 200% 100%; animation: pl-flow .9s linear infinite; transition: width .25s ease-out;
}
[data-widget] button[data-role="ig-start"][data-running] { font-variant-numeric: tabular-nums; min-width: 14rem; }
[data-widget] button[data-role="ig-start"][data-done] { animation: pl-done .9s ease-out; }
@keyframes pl-flow { to { background-position: -200% 0; } }
@keyframes pl-done { 0% { box-shadow: 0 0 0 0 rgba(61, 107, 163, .7); } 100% { box-shadow: 0 0 0 .8rem rgba(61, 107, 163, 0); } }

@media (prefers-reduced-motion: reduce) {
  [data-busy]::after, [data-busy] canvas, [data-busy] img,
  [data-widget] button[data-role="ig-start"][data-running]::before,
  [data-widget] button[data-role="ig-start"][data-done] { animation: none; }
  [data-busy]::after { height: 100%; background: rgba(31, 58, 92, .12); transform: none; }
}
