/* mok interactive prototype experience — overlay (portfolio home) and page (/mok/play)
   Layout: panel + device centred as one group on desktop; panel becomes a chip row on tablets; app goes full-page on phones. */
.mokx {
  --mokx-bg: #EFEBE5;
  --mokx-glow: #F6F2EC;
  --mokx-ink: #141414;
  --mokx-muted: #5A5753;
  --mokx-soft: #404040;
  --mokx-line: #DCD7CF;
  --mokx-chip: #E8E1D5;
  --mokx-card: #FFFFFF;
  --mokx-bar: 56px;
  --mokx-shadow: 0 1px 2px rgba(20,20,20,.05), 0 10px 24px -18px rgba(20,20,20,.35);
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column;
  background: radial-gradient(70% 80% at 58% 52%, var(--mokx-glow) 0%, var(--mokx-bg) 70%) var(--mokx-bg);
  color: var(--mokx-ink);
  font-family: Manrope, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.mokx[hidden] { display: none; }
.mokx *, .mokx *::before, .mokx *::after { box-sizing: border-box; }
.mokx :focus-visible { outline: 2px solid var(--mokx-ink); outline-offset: 3px; }

/* short, subtle entrance */
.mokx { transition: opacity 160ms ease; }
.mokx-device { transition: transform 200ms cubic-bezier(.2,.7,.2,1); }
.mokx.is-entering { opacity: 0; }
.mokx.is-entering .mokx-device { transform: translateY(8px); }
@media (prefers-reduced-motion: reduce) {
  .mokx, .mokx *, .mokx-device { transition: none !important; }
  .mokx.is-entering { opacity: 1; }
  .mokx.is-entering .mokx-device { transform: none; }
}

/* ---------- top bar ---------- */
.mokx-bar {
  flex: none; height: var(--mokx-bar);
  display: flex; align-items: center; gap: 12px;
  padding: 0 clamp(16px, 3vw, 32px);
  border-bottom: 1px solid var(--mokx-line);
  background: var(--mokx-bg);
}
.mokx-id:focus, .mokx-id:focus-visible { outline: none; }
.mokx-id { display: flex; align-items: center; gap: 12px; min-width: 0; margin: 0; font-size: 15px; font-weight: 400; outline: none; }
.mokx-word { font-family: Quicksand, Manrope, system-ui, sans-serif; font-weight: 500; font-size: 20px; letter-spacing: -.01em; line-height: 1; }
.mokx-sep { width: 1px; height: 18px; background: var(--mokx-line); }
.mokx-sub { color: var(--mokx-muted); font-weight: 400; font-size: 14px; white-space: nowrap; }
.mokx-close {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 0; border-radius: 999px; background: transparent; color: var(--mokx-ink);
  font: 400 15px/1 Manrope, system-ui, sans-serif; text-decoration: none; cursor: pointer;
  transition: background-color 160ms ease;
}
.mokx-close:hover { background: var(--mokx-chip); color: var(--mokx-ink); }
.mokx-close:active { background: #DED6C8; }
.mokx-close span[aria-hidden] { font-size: 20px; line-height: 1; }

/* ---------- stage ---------- */
.mokx-stage {
  --mokx-h: min(844px, calc(100dvh - var(--mokx-bar) - 64px));
  flex: 1 1 auto; min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 280px) auto;
  justify-content: center; align-items: center;
  column-gap: clamp(48px, 7vw, 112px);
  padding: 32px clamp(24px, 4vw, 64px);
}

/* ---------- panel ---------- */
.mokx-intro { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mokx-intro h2 {
  margin: 0; font-family: Manrope, system-ui, sans-serif; font-weight: 400;
  font-size: clamp(20px, 1.7vw, 24px); line-height: 1.3; letter-spacing: -.01em; text-wrap: balance; color: var(--mokx-soft);
}
.mokx-intro > p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--mokx-soft); text-wrap: pretty; }
.mokx-starts { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.mokx-start {
  width: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) 18px; grid-template-areas: "t a";
  align-items: center; column-gap: 16px;
  padding: 12px 14px; border: 1px solid transparent; border-radius: 16px;
  background: transparent; color: var(--mokx-ink); text-align: left; cursor: pointer;
  font-family: Manrope, system-ui, sans-serif;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 120ms ease;
}
.mokx-start-t { grid-area: t; font-size: 15px; line-height: 1.3; font-weight: 400; color: var(--mokx-soft); }
.mokx-start[aria-current="true"] .mokx-start-t, .mokx-start:hover:not(:disabled) .mokx-start-t { color: var(--mokx-ink); }
.mokx-start-d { grid-area: d; font-size: 13.5px; line-height: 1.4; font-weight: 500; color: var(--mokx-muted); }
.mokx-start-a { grid-area: a; color: var(--mokx-muted); transition: transform 160ms ease, color 160ms ease; }
.mokx-start:hover:not(:disabled) { background: rgba(255,255,255,.45); }
.mokx-start:hover:not(:disabled) .mokx-start-a { transform: translateX(2px); color: var(--mokx-ink); }
.mokx-start:active:not(:disabled) { transform: scale(.985); background: rgba(255,255,255,.8); }
.mokx-start[aria-current="true"] { background: rgba(255,255,255,.72); }
.mokx-start[aria-current="true"] .mokx-start-a { color: var(--mokx-ink); }
.mokx-start:focus-visible { outline-offset: 2px; }
.mokx-start:disabled { cursor: default; opacity: .45; }

/* ---------- device ---------- */
.mokx-device {
  position: relative;
  height: var(--mokx-h);
  width: clamp(360px, calc(var(--mokx-h) * .47), 404px);
  border-radius: 40px; overflow: hidden;
  background: #F0EEEA;
  border: 1px solid rgba(20,20,20,.08);
  box-shadow: 0 0 0 6px rgba(255,255,255,.55), 0 2px 4px rgba(20,20,20,.05), 0 36px 64px -40px rgba(20,20,20,.5);
}
.mokx-frame { display: block; width: 100%; height: 100%; border: 0; background: #F0EEEA; }

/* loading / error */
.mokx-status {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 24px; background: #F0EEEA; text-align: center; font-size: 15px; color: var(--mokx-soft);
}
.mokx-status[hidden] { display: none; }
.mokx-retry { min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--mokx-ink); color: #F7F7F7; font: 600 15px/1 Manrope, system-ui, sans-serif; cursor: pointer; }
.mokx-spin { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--mokx-line); border-top-color: var(--mokx-ink); animation: mokxSpin 800ms linear infinite; }
@keyframes mokxSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .mokx-spin { animation: none; } }

/* ---------- tablets and small laptops: panel becomes a compact row above the device ---------- */
@media (max-width: 959px) {
  .mokx-stage {
    --mokx-h: min(844px, calc(100dvh - var(--mokx-bar) - 168px));
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
    padding: 20px 24px 24px;
  }
  .mokx-intro { align-items: center; text-align: center; gap: 6px; max-width: 640px; }
  .mokx-intro h2 { font-size: 18px; }
  .mokx-intro > p { display: none; }
  .mokx-starts { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
  .mokx-start { width: auto; grid-template-columns: auto 16px; grid-template-areas: "t a"; padding: 10px 14px 10px 16px; border-radius: 999px; border-color: var(--mokx-line); column-gap: 10px; }
  .mokx-start-t { font-size: 14px; }
  .mokx-start-d { display: none; }
  .mokx-start-a { width: 16px; height: 16px; }
}
@media (max-width: 959px) and (max-height: 760px) {
  .mokx-intro h2 { display: none; }
  .mokx-stage { --mokx-h: min(844px, calc(100dvh - var(--mokx-bar) - 112px)); gap: 14px; padding-top: 14px; }
}

/* ---------- phones: full-page app, no device frame; slim back bar outside the app ---------- */
@media (max-width: 599px) {
  .mokx { --mokx-bar: 44px; background: #F0EEEA; }
  .mokx-bar { padding: 0 4px; padding-top: env(safe-area-inset-top); height: calc(var(--mokx-bar) + env(safe-area-inset-top)); }
  .mokx-id { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .mokx-close { margin-left: 0; min-height: 40px; padding: 0 12px; font-size: 14px; }
  .mokx-stage { display: block; padding: 0; }
  .mokx-intro { display: none; }
  .mokx-device { width: 100%; height: 100%; border: 0; border-radius: 0; box-shadow: none; }
  .mokx.is-entering .mokx-device { transform: none; }
}

/* scroll lock for the portfolio behind the overlay */
html.mokx-lock, html.mokx-lock body { overflow: hidden !important; }
html.mokx-lock body { padding-right: var(--mokx-sbw, 0px); }

/* ---------- version switch (desktop only) ---------- */
.mokx-bar { position: relative; }
.mokx-views {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: none; gap: 2px; padding: 3px; border-radius: 999px; background: var(--mokx-chip);
}
@media (min-width: 1024px) { .mokx-views { display: flex; } }
.mokx-view {
  min-height: 36px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent;
  color: var(--mokx-muted); font: 400 14px/1 Manrope, system-ui, sans-serif; cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.mokx-view:hover { color: var(--mokx-ink); }
.mokx-view[aria-pressed="true"] { background: var(--mokx-card); color: var(--mokx-ink); box-shadow: 0 1px 2px rgba(20,20,20,.08); }

/* ---------- web version: a quiet browser-size window ---------- */
.mokx-device[hidden], .mokx-window[hidden] { display: none; }
.mokx-window {
  position: relative; width: 100%; height: 100%; min-height: 0; max-width: 1440px; justify-self: center;
  border-radius: 18px; overflow: hidden; background: #F0EEEA;
  border: 1px solid rgba(20,20,20,.08);
  box-shadow: 0 0 0 6px rgba(255,255,255,.55), 0 2px 4px rgba(20,20,20,.05), 0 36px 64px -40px rgba(20,20,20,.45);
}
.mokx[data-view="web"] .mokx-stage {
  grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); align-items: stretch; justify-content: stretch;
  padding: 24px clamp(24px, 3vw, 48px) 32px;
}
.mokx[data-view="web"] .mokx-intro { display: none; }
@media (min-width: 1440px) {
  .mokx[data-view="web"] .mokx-stage { grid-template-columns: 220px minmax(0, 1440px); justify-content: center; column-gap: 40px; }
  .mokx[data-view="web"] .mokx-intro { display: flex; align-self: center; }
  .mokx[data-view="web"] .mokx-intro h2 { font-size: 20px; }
}
