/* Left Foot Studios: a sidebar of tools and the living picture of the foot. */

:root {
  --bg: #f4f4f5;
  --panel: #ffffff;
  --text: #18181b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --border: #e4e4e7;
  --hover: rgba(24, 24, 27, 0.05);
  --active: rgba(24, 24, 27, 0.08);
  --brand: #2f4b34;
  --brand-ink: #f4efe4;
  --ring: rgba(47, 75, 52, 0.28);
  --danger: #dc2626;
  --tip: #18181b;
  --tip-text: #fafafa;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --side: 256px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e10;
    --panel: #18181b;
    --text: #f4f4f5;
    --text-2: #d4d4d8;
    --muted: #a1a1aa;
    --faint: #71717a;
    --border: #27272a;
    --hover: rgba(255, 255, 255, 0.06);
    --active: rgba(255, 255, 255, 0.09);
    --brand: #36573c;
    --ring: rgba(134, 190, 143, 0.35);
    --danger: #f87171;
    --tip: #27272a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.43 var(--font); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
svg { display: block; }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-color-scheme: dark) { :focus-visible { outline-color: #86be8f; } }

/* ---------- Layout ---------- */
.site { display: grid; grid-template-columns: var(--side-w, var(--side)) minmax(0, 1fr); height: 100vh; height: 100dvh; transition: grid-template-columns 260ms cubic-bezier(0.4, 0, 0.2, 1); }
.side { min-width: 0; overflow: hidden; }
.side-inner { display: flex; flex-direction: column; width: var(--side); height: 100%; padding: 10px 8px 12px 10px; transition: opacity 200ms; }
.stage { min-width: 0; padding: 8px 8px 8px 0; transition: padding 260ms cubic-bezier(0.4, 0, 0.2, 1); }
@media (min-width: 900px) {
  [data-sidebar='closed'] .site { --side-w: 0px; }
  [data-sidebar='closed'] .side-inner { opacity: 0; visibility: hidden; transition: opacity 120ms, visibility 0s 260ms; }
  [data-sidebar='closed'] .stage { padding-left: 8px; }
  .scrim { display: none; }
}

/* ---------- Sidebar ---------- */
.workspace { display: flex; align-items: center; gap: 4px; padding: 2px 0 2px 2px; }
.ws-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px; border-radius: 8px; color: inherit; text-decoration: none; }
.ws-link:hover { background: var(--hover); }
.logo { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 7px; background: var(--brand); color: var(--brand-ink); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06); }
.logo svg { width: 13px; height: 17px; fill: currentColor; }
.logo.small { width: 24px; height: 24px; border-radius: 6px; }
.logo.small svg { width: 11px; height: 14px; }
.ws-name { overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }

.icon-btn { display: grid; place-items: center; flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--text); }

.nav-section { flex: 1; min-height: 0; margin-top: 14px; overflow-y: auto; }
.nav-label { margin: 0 0 2px; padding: 4px 8px; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
.nav { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 8px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-2); text-align: left; text-decoration: none; cursor: pointer;
}
.nav-item .icon { color: var(--muted); }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item:hover .icon { color: var(--text-2); }
.nav-item[aria-current] { background: var(--active); color: var(--text); font-weight: 500; }
.nav-item[aria-current] .icon { color: var(--text); }
.nav-item:focus-visible { outline-offset: -2px; }
.t-text { display: grid; min-width: 0; }
.t-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* The description is read out, and shown on hover as a tooltip (inline on phones). */
.t-line { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.nav-note { margin: 4px 8px; font-size: 13px; color: var(--muted); }

.side-foot { margin-top: 8px; }
.tagline { margin: 8px 0 0; padding: 0 8px; font-size: 12px; color: var(--muted); }
.copy { margin: 2px 0 0; padding: 0 8px; font-size: 12px; color: var(--faint); }

/* ---------- Tooltip (one, placed by app.js) ---------- */
.tooltip {
  position: fixed; z-index: 50; left: 0; top: 0; max-width: 260px; padding: 5px 8px; border-radius: 6px; background: var(--tip); color: var(--tip-text);
  font-size: 12px; line-height: 1.4; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16); pointer-events: none; opacity: 0; transition: opacity 120ms;
}
.tooltip.on { opacity: 1; }
.tooltip kbd { margin-left: 6px; padding: 0 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); font: inherit; font-size: 11px; color: #d4d4d8; }

/* ---------- The picture ---------- */
.plate {
  position: relative; height: 100%; margin: 0; overflow: hidden; isolation: isolate; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  /* A tiny copy of the picture, blurred by scaling, while the real one arrives. */
  background: #b9c6cc url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDABIMDRANCxIQDhAUExIVGywdGxgYGzYnKSAsQDlEQz85Pj1HUGZXR0thTT0+WXlaYWltcnNyRVV9hnxvhWZwcm7/2wBDARMUFBsXGzQdHTRuST5Jbm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm7/wAARCAAbADADASIAAhEBAxEB/8QAGQAAAwEBAQAAAAAAAAAAAAAAAQQFAwIG/8QAKxAAAgIBAwIEBQUAAAAAAAAAAQIDEQAEEiExcQUTIlEUUmGB0TJBQpGh/8QAGAEAAwEBAAAAAAAAAAAAAAAAAQIDAAT/xAAaEQADAQEBAQAAAAAAAAAAAAAAARECIRIx/9oADAMBAAIRAxEAPwDTReLRSlFlA3qObo3+cleI6r4rV+aq7Y14Wva+uZPCpPpViu6wdtHvhkjJTy2flmsMTw3tzirdUGeYyn4ZqysOwRlkDWaF13ymuqh2xkFbJo30755/w2do3KxnYx4oAGu+MwzShzzsbcQQPm/cfj3wY354/gdZ9dLy6mBuFMVr+qm69sYXUwxx+YygRj+W4G/tkFZZ2IdLLD5aFffA+oMhPxiPJXNK22v6yzdRNKCMmoGoBkedfNkUDaYxbcVfHOcLBsnKsa3EFeaBv2J7YlIAs07AAHYcZktNOjKSCRZ5NZzSF7QvGN7zRzopABYnoTfXjC8spkdnkQsVCk17dD3zjRu3nF79S8g+1jKMESayUNqEDsOhqj/mNKLYYo8nmbY5Ga/VaEV0uj7dTxjWnlldL1YULyCx4I+v17ZElYrqDtO2yQa4vNNdNIdOqljXHGZaScA6+n//2Q==') 48% 50% / cover no-repeat;
}
.plate picture, .plate img, .plate canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.plate img { object-fit: cover; object-position: 48% 50%; transition: opacity 600ms ease; }
.plate canvas { opacity: 0; transition: opacity 800ms ease; }
.js .plate img { opacity: 0; }
.js .plate.still img { opacity: 1; }
.plate.live canvas { opacity: 1; }
/* If the script never arrives, show the picture anyway (harmless under the moving one). */
.js .plate:not(.still) img { animation: reveal 0s 5s forwards; }
@keyframes reveal { to { opacity: 1; } }

.glass {
  position: absolute; z-index: 2; display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(20, 20, 22, 0.42); color: #fafafa;
  backdrop-filter: blur(12px) saturate(1.4); -webkit-backdrop-filter: blur(12px) saturate(1.4); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); cursor: pointer; transition: background 150ms, opacity 200ms;
}
.glass:hover { background: rgba(20, 20, 22, 0.6); }
.glass:focus-visible { outline-color: #fafafa; }
.open-side { top: 12px; left: 12px; height: 36px; padding: 0 10px 0 6px; border-radius: 8px; font-size: 13px; font-weight: 500; }
.open-side .icon { margin-left: 2px; opacity: 0.8; }
@media (min-width: 900px) {
  .open-side { opacity: 0; visibility: hidden; pointer-events: none; transition: background 150ms, opacity 120ms, visibility 0s 120ms; }
  [data-sidebar='closed'] .open-side { opacity: 1; visibility: visible; pointer-events: auto; transition: background 150ms, opacity 200ms 160ms, visibility 0s; }
}
.round { right: 12px; bottom: 12px; width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 8px; }
.round .icon { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.round .i-play, [data-motion='paused'] .round .i-pause { display: none; }
[data-motion='paused'] .round .i-play { display: block; }

/* ---------- The key prompt ---------- */
dialog.modal {
  width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.06);
  opacity: 0; transform: scale(0.98); transition: opacity 150ms, transform 150ms, overlay 150ms allow-discrete, display 150ms allow-discrete;
}
dialog.modal[open] { opacity: 1; transform: none; }
@starting-style { dialog.modal[open] { opacity: 0; transform: scale(0.98); } }
dialog.modal::backdrop { background: rgba(0, 0, 0, 0); transition: background 150ms, overlay 150ms allow-discrete, display 150ms allow-discrete; }
dialog.modal[open]::backdrop { background: rgba(0, 0, 0, 0.4); }
@starting-style { dialog.modal[open]::backdrop { background: rgba(0, 0, 0, 0); } }
.modal form { padding: 20px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.modal-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-2); }
.modal-icon .icon { width: 18px; height: 18px; }
.modal-title { flex: 1; min-width: 0; }
.modal-title h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 20px; }
.modal-title p { margin: 2px 0 0; font-size: 13px; line-height: 18px; color: var(--muted); }
.close { margin: -4px -6px 0 0; }
label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.field { position: relative; }
.field input { width: 100%; height: 36px; padding: 0 38px 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); font-size: 14px; transition: border-color 120ms, box-shadow 120ms; }
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.field-btn { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.field-btn:hover { background: var(--hover); color: var(--text); }
.field-btn .i-eye-off, .field-btn[aria-pressed='true'] .i-eye { display: none; }
.field-btn[aria-pressed='true'] .i-eye-off { display: block; }
.hint { margin: 8px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.hint.error { color: var(--danger); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: background 120ms, opacity 120ms;
}
.btn:hover { background: var(--hover); }
.btn.primary { min-width: 76px; border-color: var(--text); background: var(--text); color: var(--panel); }
.btn.primary:hover { opacity: 0.88; }
.btn:disabled { cursor: default; }
.btn .spinner, .btn .i-check { display: none; }
.btn[data-state='busy'] .spinner { display: block; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 650ms linear infinite; }
.btn[data-state='done'] .i-check { display: block; width: 15px; height: 15px; }
.shake { animation: shake 360ms ease; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* ---------- Phones and small tablets: the picture fills the screen, the tools slide in over it ---------- */
@media (max-width: 899px) {
  .site { display: block; height: 100dvh; }
  .stage { position: fixed; inset: 0; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); }
  .side {
    position: fixed; z-index: 20; top: 0; bottom: 0; left: 0; width: min(84vw, 300px); border-right: 1px solid var(--border); background: var(--panel); box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    transform: translateX(-102%); visibility: hidden; transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 240ms;
  }
  [data-drawer='open'] .side { transform: none; visibility: visible; transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s; }
  .side-inner { width: 100%; padding: max(10px, env(safe-area-inset-top)) 8px max(12px, env(safe-area-inset-bottom)) 10px; }
  .scrim { position: fixed; inset: 0; z-index: 15; background: rgba(0, 0, 0, 0.35); opacity: 0; pointer-events: none; transition: opacity 240ms; }
  [data-drawer='open'] .scrim { opacity: 1; pointer-events: auto; }
  /* No hover on touch: the descriptions sit under the names. */
  .nav-item.tool { height: auto; min-height: 40px; padding: 8px; align-items: flex-start; }
  .nav-item.tool .icon { margin-top: 2px; }
  .t-name { white-space: normal; }
  .t-line { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; font-size: 12.5px; line-height: 17px; color: var(--muted); text-wrap: pretty; }
}
