/* shared/ocm-dock.css
 *
 * The reading dock (shared/ocm-dock.js): the progress bar, the contents rail
 * and chip, and the progress ring with the time left. Every rule is scoped
 * under .ocmd, so the same sheet serves the article page and the shadow root
 * ocm-bridge.js draws the dock into on onchainmind.io.
 */
.ocmd {
  --ocmd-accent: 74, 222, 128;
  --ocmd-ink: #f5f7fa;
  --ocmd-body: rgba(226, 232, 240, 0.84);
  --ocmd-dim: rgba(203, 213, 225, 0.48);
  --ocmd-glass: rgba(24, 26, 33, 0.97);
  --ocmd-glass-strong: rgb(20, 22, 28);
  --ocmd-line: rgba(255, 255, 255, 0.1);
  --ocmd-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ocmd-pop: cubic-bezier(0.34, 1.4, 0.64, 1);
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--ocmd-body);
  line-height: 1.35;
}
.ocmd *, .ocmd *::before, .ocmd *::after { box-sizing: border-box; }
/* Resets at the lowest specificity, so every component rule below wins. */
:where(.ocmd) button {
  font: inherit; color: inherit; background: none; border: 0; margin: 0; padding: 0;
  cursor: pointer; text-align: left; -webkit-tap-highlight-color: transparent;
}
:where(.ocmd) button:focus-visible { outline: 2px solid rgba(var(--ocmd-accent), 0.85); outline-offset: 3px; }
:where(.ocmd) svg { display: block; }

/* Everything moves as one when a lagging dock steps aside. */
.ocmd-inner { position: absolute; inset: 0; transition: opacity 0.12s ease-out; }
.ocmd.is-away .ocmd-inner { opacity: 0; }
.ocmd.is-away .ocmd-inner * { pointer-events: none !important; }
.ocmd.is-back .ocmd-inner { animation: ocmd-back 0.42s var(--ocmd-ease); }
@keyframes ocmd-back {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- the bar */
.ocmd-bar {
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  opacity: 0; transition: opacity 0.3s ease;
}
.ocmd.is-bar .ocmd-bar { opacity: 1; }
.ocmd-bar i {
  position: absolute; inset: 0; border-radius: 0 3px 3px 0;
  transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, rgba(var(--ocmd-accent), 0.35), rgb(var(--ocmd-accent)) 70%, #c9fadb);
  box-shadow: 0 0 14px rgba(var(--ocmd-accent), 0.55);
  transition: transform 0.12s linear;
}

/* --------------------------------------------------- the rail (wide screens) */
.ocmd-rail {
  position: absolute; top: 50%; left: -9999px; width: 220px; max-height: 72%;
  display: flex; flex-direction: column;
  padding: 16px 12px 10px 14px; border-radius: 18px;
  background: var(--ocmd-glass);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--ocmd-line);
  box-shadow: 0 28px 56px -28px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  opacity: 0; visibility: hidden; transform: translate3d(-12px, -50%, 0);
  transition: opacity 0.35s ease, transform 0.55s var(--ocmd-ease), visibility 0s linear 0.35s;
}
.ocmd.is-rail .ocmd-rail {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translate3d(0, -50%, 0);
  transition: opacity 0.35s ease, transform 0.55s var(--ocmd-ease), visibility 0s;
}
.ocmd-rail-head, .ocmd-sheet-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.ocmd-rail-head { padding: 0 4px 12px 2px; border-bottom: 1px solid var(--ocmd-line); margin-bottom: 10px; }
.ocmd-eyebrow {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; color: var(--ocmd-dim);
}
.ocmd-rail-pct, .ocmd-sheet-pct {
  font-size: 0.72rem; font-weight: 800; color: rgb(var(--ocmd-accent)); letter-spacing: 0.3px;
}
.ocmd-rail-body {
  position: relative; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: none; padding-right: 2px;
}
.ocmd-rail-body::-webkit-scrollbar { display: none; }

/* the spine: a line through every section's node, filled to the reader's place */
.ocmd-spine {
  position: absolute; left: 7px; top: 0; width: 2px; height: 100%;
  border-radius: 2px; background: rgba(255, 255, 255, 0.07); overflow: hidden;
}
.ocmd-spine i {
  position: absolute; inset: 0; transform-origin: 50% 0; transform: scaleY(0);
  background: linear-gradient(180deg, rgba(var(--ocmd-accent), 0.55), rgb(var(--ocmd-accent)));
  box-shadow: 0 0 10px rgba(var(--ocmd-accent), 0.6);
  transition: transform 0.14s linear;
}
.ocmd-steps { position: relative; list-style: none; margin: 0; padding: 0; }
.ocmd-step { position: relative; }
.ocmd-step button, .ocmd-sheet-item {
  position: relative; display: grid; grid-template-columns: 18px 22px minmax(0, 1fr); align-items: start;
  width: 100%; border-radius: 11px;
  transition: background 0.25s ease;
}
.ocmd-step button { padding: 8px 8px 8px 0; }
.ocmd-step button:hover, .ocmd-sheet-item:hover { background: rgba(255, 255, 255, 0.04); }
.ocmd-node {
  grid-column: 1; justify-self: start; margin: 4px 0 0 3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #16181e; border: 2px solid rgba(255, 255, 255, 0.22);
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.35s ease, transform 0.35s var(--ocmd-pop);
}
.ocmd-num {
  grid-column: 2; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.6px; padding-top: 2px;
  color: rgba(203, 213, 225, 0.32); transition: color 0.3s ease;
}
.ocmd-title {
  grid-column: 3; font-size: 0.78rem; font-weight: 600; color: var(--ocmd-dim);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  transition: color 0.3s ease;
}
[data-state="done"] > .ocmd-node, [data-state="done"] > button > .ocmd-node {
  background: rgb(var(--ocmd-accent)); border-color: rgb(var(--ocmd-accent));
}
[data-state="done"] .ocmd-num { color: rgba(var(--ocmd-accent), 0.6); }
[data-state="done"] .ocmd-title { color: var(--ocmd-body); }
[data-state="now"] .ocmd-node {
  border-color: rgb(var(--ocmd-accent)); transform: scale(1.15);
  box-shadow: 0 0 0 4px rgba(var(--ocmd-accent), 0.16), 0 0 14px rgba(var(--ocmd-accent), 0.6);
}
[data-state="now"] .ocmd-num { color: rgb(var(--ocmd-accent)); }
[data-state="now"] .ocmd-title { color: var(--ocmd-ink); }
.ocmd-step[data-state="now"] button, .ocmd-sheet-item[data-state="now"] { background: rgba(var(--ocmd-accent), 0.07); }
.ocmd-step button:hover .ocmd-title, .ocmd-sheet-item:hover .ocmd-title { color: var(--ocmd-ink); }

/* ------------------------------------------------ the chip (narrow screens) */
.ocmd-chip {
  position: absolute; left: 20px; bottom: 28px; height: 44px; max-width: min(62%, 320px);
  display: flex; align-items: center; gap: 9px; padding: 0 13px 0 11px; border-radius: 22px;
  background: var(--ocmd-glass);
  -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--ocmd-line);
  box-shadow: 0 16px 34px -16px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  color: var(--ocmd-ink); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.2px;
  opacity: 0; visibility: hidden; transform: translate3d(0, 14px, 0) scale(0.96);
  transition: opacity 0.3s ease, transform 0.5s var(--ocmd-ease), border-color 0.25s ease, visibility 0s linear 0.3s;
}
.ocmd.is-chip .ocmd-chip {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity 0.3s ease, transform 0.5s var(--ocmd-ease), border-color 0.25s ease, visibility 0s;
}
.ocmd-chip:hover, .ocmd.is-sheet .ocmd-chip { border-color: rgba(var(--ocmd-accent), 0.35); }
.ocmd-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ocmd-chip > svg:last-child {
  width: 14px; height: 14px; flex: none; fill: none; stroke: var(--ocmd-dim); stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round; transition: transform 0.35s var(--ocmd-ease);
}
.ocmd.is-sheet .ocmd-chip > svg:last-child { transform: rotate(180deg); }
.ocmd-mini { width: 20px; height: 20px; flex: none; transform: rotate(-90deg); }
.ocmd-mini-track { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 2.5; }
.ocmd-mini-fill {
  fill: none; stroke: rgb(var(--ocmd-accent)); stroke-width: 2.5; stroke-linecap: round;
  transition: stroke-dashoffset 0.12s linear;
}

.ocmd-sheet {
  position: absolute; left: 16px; bottom: 84px; width: min(340px, calc(100% - 32px)); max-height: 58%;
  overflow-y: auto; overscroll-behavior: contain; padding: 14px 8px 8px;
  border-radius: 18px; background: var(--ocmd-glass-strong);
  -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--ocmd-line);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8);
  opacity: 0; visibility: hidden; transform: translate3d(0, 10px, 0) scale(0.98); transform-origin: 0 100%;
  transition: opacity 0.22s ease, transform 0.35s var(--ocmd-ease), visibility 0s linear 0.22s;
}
.ocmd.is-sheet.is-chip .ocmd-sheet {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity 0.22s ease, transform 0.35s var(--ocmd-ease), visibility 0s;
}
.ocmd-sheet-head { padding: 0 10px 10px 10px; }
.ocmd-sheet-meta { display: flex; align-items: baseline; gap: 10px; }
.ocmd-sheet-time { display: none; font-size: 0.7rem; font-weight: 700; color: var(--ocmd-dim); white-space: nowrap; }
.ocmd-sheet-time strong { color: var(--ocmd-body); font-weight: 800; margin-right: 3px; }
.ocmd-sheet-item { padding: 10px 10px 10px 4px; }
.ocmd-sheet-item .ocmd-title { font-size: 0.86rem; -webkit-line-clamp: 3; }

/* ------------------------------------- the corner: time left, ring, to top */
.ocmd-corner {
  position: absolute; right: 28px; bottom: 28px; display: flex; align-items: center; gap: 10px;
  opacity: 0; visibility: hidden; transform: translate3d(0, 16px, 0) scale(0.94); transform-origin: 100% 100%;
  transition: opacity 0.3s ease, transform 0.55s var(--ocmd-ease), visibility 0s linear 0.3s;
}
.ocmd.is-corner .ocmd-corner {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 0.3s ease, transform 0.55s var(--ocmd-ease), visibility 0s;
}
.ocmd-time {
  height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 13px 0 10px; border-radius: 17px;
  background: var(--ocmd-glass);
  -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--ocmd-line);
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.7);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.3px; white-space: nowrap; color: var(--ocmd-body);
}
.ocmd-time svg { width: 13px; height: 13px; fill: none; stroke: var(--ocmd-dim); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ocmd-time strong { color: rgb(var(--ocmd-accent)); font-weight: 800; margin-right: 3px; }
.ocmd.is-done .ocmd-time { color: rgb(var(--ocmd-accent)); border-color: rgba(var(--ocmd-accent), 0.3); }
.ocmd.is-done .ocmd-time svg { stroke: rgb(var(--ocmd-accent)); }

.ocmd-top {
  position: relative; width: 56px; height: 56px; border-radius: 50%; pointer-events: auto;
  display: grid; place-items: center;
  background: var(--ocmd-glass);
  -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 0.35s var(--ocmd-ease), box-shadow 0.35s ease;
}
.ocmd-top:hover { transform: translateY(-3px); box-shadow: 0 20px 38px -14px rgba(0, 0, 0, 0.85), 0 0 22px rgba(var(--ocmd-accent), 0.18); }
.ocmd-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ocmd-ring-track { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 3; }
.ocmd-ring-fill {
  fill: none; stroke-width: 3; stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(var(--ocmd-accent), 0.5));
  transition: stroke-dashoffset 0.12s linear;
}
.ocmd-g0 { stop-color: rgb(var(--ocmd-accent)); }
.ocmd-g1 { stop-color: #c9fadb; }
.ocmd-pct, .ocmd-icon {
  grid-area: 1 / 1; transition: opacity 0.22s ease, transform 0.3s var(--ocmd-ease);
}
.ocmd-pct { font-size: 0.8rem; font-weight: 800; color: var(--ocmd-ink); letter-spacing: -0.2px; }
.ocmd-pct small { font-size: 0.56rem; font-weight: 800; color: var(--ocmd-dim); margin-left: 1px; }
.ocmd-icon { opacity: 0; transform: translate3d(0, 5px, 0); }
.ocmd-icon svg { width: 20px; height: 20px; fill: none; stroke: var(--ocmd-ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ocmd-done svg { stroke: rgb(var(--ocmd-accent)); }
.ocmd-top:hover .ocmd-pct, .ocmd-top:focus-visible .ocmd-pct { opacity: 0; transform: translate3d(0, -5px, 0); }
.ocmd-top:hover .ocmd-up, .ocmd-top:focus-visible .ocmd-up { opacity: 1; transform: none; }
.ocmd.is-done .ocmd-pct { opacity: 0; transform: scale(0.6); }
.ocmd.is-done .ocmd-done { opacity: 1; transform: none; animation: ocmd-pop 0.5s var(--ocmd-pop); }
.ocmd.is-done .ocmd-top:hover .ocmd-done, .ocmd.is-done .ocmd-top:focus-visible .ocmd-done { opacity: 0; animation: none; }
.ocmd.is-done .ocmd-ring-fill { filter: drop-shadow(0 0 7px rgba(var(--ocmd-accent), 0.75)); }
@keyframes ocmd-pop {
  from { opacity: 0; transform: scale(0.4); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- phones */
@media (max-width: 600px) {
  /* the time left moves into the contents list, so the chip has the room */
  .ocmd-time { display: none; }
  .ocmd-sheet-time { display: inline; }
  .ocmd-chip { left: 14px; bottom: 22px; height: 42px; max-width: calc(100% - 96px); }
  .ocmd-sheet { left: 12px; bottom: 70px; width: calc(100% - 24px); }
  .ocmd-corner { right: 14px; bottom: 18px; gap: 8px; }
  .ocmd-top { width: 50px; height: 50px; }
  .ocmd-time { height: 30px; padding: 0 11px 0 9px; font-size: 0.68rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ocmd *, .ocmd-inner { transition: none !important; animation: none !important; }
}

@media print {
  .ocmd { display: none !important; }
}
