/* ============================================================
   Musette Labs LLC · musettelabs.com
   Drenched sage-linen (light) / nocturne racing pine (dark)
   OKLCH hue-tinted tokens · exponential ease-out motion
   ============================================================ */

:root {
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-quart: cubic-bezier(0.25, 1, 0.5, 1);

  --font-ui: "Archivo Narrow", -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --font-code: "Azeret Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Light: drenched woven sage-linen + deep racing pine ink + vermilion accent */
  --bg: oklch(0.865 0.044 128);
  --bg-ledge: oklch(0.825 0.048 128);
  --surface: oklch(0.935 0.028 118);
  --ink: oklch(0.21 0.032 146);
  --ink-soft: oklch(0.35 0.036 142);
  --ink-faint: oklch(0.47 0.034 136);
  --line: oklch(0.21 0.032 146 / 0.16);
  --line-strong: oklch(0.21 0.032 146 / 0.32);
  --accent: oklch(0.55 0.195 30);
  --accent-ink: oklch(0.97 0.012 85);

  --pill-bg: oklch(0.955 0.020 106);
  --pill-email-bg: oklch(0.55 0.195 30);
  --pill-email-ink: oklch(0.975 0.012 85);

  --bag-shadow: oklch(0.16 0.035 142 / 0.34);
  --icon-shadow: 0 16px 30px oklch(0.20 0.04 142 / 0.25), 0 2px 6px oklch(0.20 0.04 142 / 0.14);
  --icon-shadow-lift: 0 22px 38px oklch(0.20 0.04 142 / 0.30), 0 4px 10px oklch(0.20 0.04 142 / 0.16);
  --weave-a: oklch(0.20 0.025 142 / 0.024);
  --weave-b: oklch(0.20 0.025 142 / 0.018);
}

[data-theme="dark"] {
  /* Dark: nocturne racing pine + unbleached cotton bone + bright vermilion */
  --bg: oklch(0.20 0.036 152);
  --bg-ledge: oklch(0.16 0.032 152);
  --surface: oklch(0.25 0.038 150);
  --ink: oklch(0.935 0.022 94);
  --ink-soft: oklch(0.77 0.026 115);
  --ink-faint: oklch(0.58 0.028 130);
  --line: oklch(0.935 0.022 94 / 0.14);
  --line-strong: oklch(0.935 0.022 94 / 0.28);
  --accent: oklch(0.66 0.19 32);
  --accent-ink: oklch(0.16 0.024 152);

  --pill-bg: oklch(0.275 0.038 150);
  --pill-email-bg: oklch(0.66 0.19 32);
  --pill-email-ink: oklch(0.16 0.024 152);

  --bag-shadow: oklch(0.05 0.02 152 / 0.74);
  --icon-shadow: 0 18px 34px oklch(0.06 0.02 152 / 0.65), 0 2px 6px oklch(0.06 0.02 152 / 0.4);
  --icon-shadow-lift: 0 24px 44px oklch(0.04 0.02 152 / 0.78), 0 6px 12px oklch(0.04 0.02 152 / 0.48);
  --weave-a: oklch(0.94 0.02 95 / 0.024);
  --weave-b: oklch(0.94 0.02 95 / 0.018);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
}
body {
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(0deg, transparent 0, transparent 3px, var(--weave-a) 3px, var(--weave-a) 4px),
    repeating-linear-gradient(90deg, transparent 0, transparent 3px, var(--weave-b) 3px, var(--weave-b) 4px);
  color: var(--ink);
  font-family: var(--font-ui);
  transition: background-color 0.35s var(--ease-expo), color 0.35s var(--ease-expo);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
img { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Page Shell ---------- */
.page-shell {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  position: relative;
}

/* ---------- Top Bar ---------- */
.topbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(18px, 3vw, 28px) clamp(20px, 4vw, 44px);
}

.mark-link {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
}
.mark-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  transform: rotate(0deg);
  transition: transform 0.38s var(--ease-expo);
}
.mark-icon svg {
  width: 30px;
  height: 30px;
}
.mark-link:hover .mark-icon,
.mark-link:focus-visible .mark-icon {
  transform: rotate(-11deg);
}
.mark-wordmark {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.9;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pack-pill {
  font-family: var(--font-code);
  font-size: 11px;
  letter-spacing: 0.03em;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.28s var(--ease-expo), transform 0.28s var(--ease-expo), background-color 0.2s;
}
.page-shell.is-dumped .pack-pill {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.pack-pill:hover {
  background: var(--bg-ledge);
}

.theme-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in oklch, var(--surface) 70%, transparent);
  display: grid;
  place-items: center;
  color: var(--ink);
  transition: border-color 0.2s var(--ease-quart), transform 0.28s var(--ease-expo), background-color 0.2s;
}
.theme-btn:hover {
  border-color: var(--line-strong);
  transform: scale(1.05);
}
.theme-btn svg {
  width: 16px;
  height: 16px;
}
[data-theme="light"] .t-sun { display: none; }
[data-theme="dark"] .t-moon { display: none; }

/* ---------- Centered Studio Object Stage ---------- */
.studio-stage {
  position: relative;
  min-height: clamp(460px, 72svh, 700px);
  width: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.bag-rig {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 368px;
  height: 368px;
  margin-left: -184px;
  margin-top: -196px;
  transform-origin: 50% 14%;
  cursor: grab;
  z-index: 10;
  will-change: transform, opacity;
  touch-action: none;
}
.bag-rig:active { cursor: grabbing; }
.bag-rig.is-empty { cursor: default; }
.bag-rig.is-settling {
  transition: transform 0.65s var(--ease-expo), opacity 0.4s var(--ease-expo);
}

.bag-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.35s var(--ease-expo);
}
.bag-layer--back {
  z-index: 1;
  filter: drop-shadow(0 12px 18px var(--bag-shadow));
}
.bag-layer--front {
  z-index: 3;
  filter: drop-shadow(0 26px 34px var(--bag-shadow));
}
.bag-layer--light { opacity: 1; }
.bag-layer--dark { opacity: 0; }
[data-theme="dark"] .bag-layer--light { opacity: 0; }
[data-theme="dark"] .bag-layer--dark { opacity: 1; }
[data-theme="dark"] .bag-layer--front {
  filter: drop-shadow(0 28px 42px var(--bag-shadow));
}
[data-theme="dark"] .bag-layer--back {
  filter: drop-shadow(0 14px 24px var(--bag-shadow));
}

.bag-peek {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  transition: transform 0.4s var(--ease-expo), opacity 0.25s var(--ease-quart);
}
.bag-rig:hover:not(.is-empty) .bag-peek,
.bag-rig:focus-visible:not(.is-empty) .bag-peek {
  transform: translateY(-20px);
}
.bag-rig.is-empty .bag-peek {
  opacity: 0;
  transform: translateY(-28px) scale(0.85);
}

.peek-icon {
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 16px;
  overflow: hidden;
  background: oklch(0.99 0.002 90);
  border: 1px solid oklch(0.18 0.01 70 / 0.14);
  box-shadow: 0 8px 18px oklch(0.10 0.01 70 / 0.28);
}
.peek-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.peek-icon--bidon { top: 130px; left: 106px; transform: rotate(-9deg); }
.peek-icon--marbles { top: 133px; right: 106px; transform: rotate(8deg); }

.bag-whisper {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  font-family: var(--font-code);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  opacity: 0.78;
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.35s var(--ease-expo);
  white-space: nowrap;
}
.page-shell.is-dumped .bag-whisper {
  opacity: 0;
}

/* ---------- Spilled Physics Layer ---------- */
.phys-layer {
  position: absolute;
  inset: 0;
  z-index: 14;
  pointer-events: none;
}

.phys-body {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  cursor: grab;
  will-change: transform, opacity;
  touch-action: none;
  opacity: 0;
  transition: opacity 0.2s var(--ease-quart);
}
.phys-body.is-live { opacity: 1; }
.phys-body:active { cursor: grabbing; }

.spilled-app {
  width: 88px;
  height: 88px;
  border-radius: 21px;
  overflow: hidden;
  background: oklch(0.99 0.002 90);
  border: 1px solid oklch(0.18 0.01 70 / 0.14);
  box-shadow: var(--icon-shadow);
  transform: scale(1);
  transition: transform 0.28s var(--ease-expo), box-shadow 0.28s var(--ease-expo);
}
.phys-body:hover .spilled-app,
.phys-body:focus-visible .spilled-app {
  transform: scale(1.07);
  box-shadow: var(--icon-shadow-lift);
}
.phys-body.is-selected .spilled-app {
  transform: scale(1.06);
  box-shadow: var(--icon-shadow-lift);
}
.spilled-app img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.spilled-pill {
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  background: var(--pill-bg);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: var(--icon-shadow);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transform: scale(1);
  transition: transform 0.28s var(--ease-expo), box-shadow 0.28s var(--ease-expo);
}
.phys-body:hover .spilled-pill,
.phys-body:focus-visible .spilled-pill {
  transform: scale(1.05);
  box-shadow: var(--icon-shadow-lift);
}
.spilled-pill--email {
  background: var(--pill-email-bg);
  color: var(--pill-email-ink);
  border-color: transparent;
  font-family: var(--font-code);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
}

/* ---------- Inline Non-Modal App Inspector Rail ---------- */
.inspector-rail {
  position: relative;
  z-index: 22;
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.36s var(--ease-expo);
  background: var(--surface);
  border-top: 1px solid transparent;
}
.inspector-rail.is-open {
  grid-template-rows: 1fr;
  border-top-color: var(--line);
}
.inspector-overflow { overflow: hidden; }
.inspector-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px clamp(20px, 4vw, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.inspector-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1 1 280px;
}
.inspector-thumb {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: oklch(0.99 0.002 90);
  flex-shrink: 0;
}
.inspector-thumb img { width: 100%; height: 100%; object-fit: cover; }
.inspector-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.inspector-tag {
  font-family: var(--font-code);
  font-size: 10.5px;
  color: var(--ink-soft);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.01em;
}
.inspector-desc {
  margin: 4px 0 0;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 58ch;
  line-height: 1.5;
}
[data-theme="dark"] .inspector-desc { line-height: 1.58; }
.inspector-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.action-btn {
  font-family: var(--font-code);
  font-size: 11.5px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  transition: background-color 0.2s, opacity 0.2s;
}
.action-btn:hover { background: var(--bg-ledge); }
.action-btn--solid {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.action-btn--solid:hover { opacity: 0.88; background: var(--ink); }
.inspector-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  font-size: 18px;
}
.inspector-close:hover { background: var(--bg-ledge); color: var(--ink); }

/* ---------- Quiet Floor Footer ---------- */
.floor-footer {
  position: relative;
  z-index: 20;
  padding: 18px clamp(20px, 4vw, 44px) 24px;
  border-top: 1px solid var(--line);
}
.floor-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.floor-apps {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.floor-app-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  padding: 4px 11px 4px 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in oklch, var(--surface) 74%, transparent);
  transition: transform 0.26s var(--ease-expo);
}
.floor-app-link:hover {
  transform: scale(1.04);
}
.floor-app-link img {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: oklch(0.99 0.002 90);
}
.floor-legal {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-family: var(--font-code);
  font-size: 11px;
  color: var(--ink-soft);
}
.floor-legal a:hover,
.copy-email-link:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.copy-email-link {
  color: inherit;
  transition: color 0.15s;
}
.copy-email-link.is-copied {
  color: var(--ink);
}

/* ---------- Legal / Privacy Page ---------- */
.legal-main {
  max-width: 68ch;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) clamp(20px, 4vw, 44px) clamp(48px, 8vw, 88px);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
}
[data-theme="dark"] .legal-main { line-height: 1.68; }
.legal-eyebrow {
  font-family: var(--font-code);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 10px;
}
.legal-main h1 {
  font-family: var(--font-ui);
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.08;
  margin: 0 0 10px;
  text-transform: uppercase;
}
.legal-updated {
  font-family: var(--font-code);
  font-size: 11.5px;
  color: var(--ink-soft);
  margin: 0 0 32px;
}
.legal-main h2 {
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 32px 0 10px;
}
.legal-main p {
  margin: 0 0 14px;
  color: var(--ink);
}
.legal-main ul {
  margin: 0 0 16px;
  padding-left: 20px;
}
.legal-main li {
  margin-bottom: 8px;
}
.legal-main a,
.copy-email-inline {
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--ink);
}
.legal-main a:hover,
.copy-email-inline:hover {
  color: var(--accent);
}
.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-code);
  font-size: 11.5px;
  color: var(--ink-soft);
  text-decoration: none !important;
  margin-bottom: 24px;
}
.legal-back:hover { color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  .theme-btn {
    width: 44px;
    height: 44px;
  }
  .pack-pill {
    min-height: 40px;
    padding: 8px 14px;
  }
  .studio-stage {
    min-height: clamp(420px, 66svh, 620px);
  }
  .bag-rig {
    width: 292px;
    height: 292px;
    margin-left: -146px;
    margin-top: -158px;
  }
  .peek-icon { width: 56px; height: 56px; border-radius: 13px; }
  .peek-icon--bidon { top: 102px; left: 82px; }
  .peek-icon--marbles { top: 105px; right: 82px; }
  .spilled-app { width: 76px; height: 76px; border-radius: 18px; }
  .spilled-pill { height: 40px; padding: 0 16px; font-size: 14px; }
  .spilled-pill--email { font-size: 11.5px; }

  .inspector-inner {
    position: relative;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px 20px 18px;
  }
  .inspector-left {
    flex: none;
    align-items: flex-start;
    gap: 12px;
    padding-right: 40px;
  }
  .inspector-title {
    flex-wrap: wrap;
    gap: 2px 10px;
  }
  .inspector-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .action-btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 8px 15px;
  }
  .inspector-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    font-size: 22px;
  }
}

@media (pointer: coarse) {
  .theme-btn {
    width: 44px;
    height: 44px;
  }
  .inspector-close {
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
