*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --text: #2c3034;
  --muted: #5c636a;
  --border: #e5e7eb;
  --link: #2563eb;
  --link-hover: #1d4ed8;
  --award: #c0392b;
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

/* Fixed 2D CraftBot VLA background canvas */
#craftbot-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.topbar__brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}

.topbar__brand:hover {
  color: var(--text);
  text-decoration: none;
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 1.15rem;
}

.topbar__controls {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0.35rem;
}

.playground-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.72rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  color: #1e3a8a;
  background: rgba(239, 246, 255, 0.92);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.playground-toggle:hover {
  background: #dbeafe;
  border-color: #3b82f6;
  transform: translateY(-1px);
}

.playground-toggle[aria-pressed="true"] {
  color: #ffffff;
  background: #2563eb;
  border-color: #1d4ed8;
  box-shadow: 0 3px 12px rgba(37, 99, 235, 0.28);
}

.playground-toggle__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.22);
}

.craftbot-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.craftbot-icon-btn:hover {
  color: var(--text);
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.topbar__nav a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.topbar__nav a:hover {
  color: var(--text);
  text-decoration: none;
}

/* Main two-column layout */
.layout {
  position: relative;
  z-index: 2;
  max-width: 1120px;
  margin: 2rem auto 15rem;
  padding: 0 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 2.25rem;
  transition: opacity 0.32s ease, transform 0.32s ease;
}

body.playground-active .layout {
  opacity: 0;
  transform: translateY(14px) scale(0.99);
  pointer-events: none;
}

/* Left sidebar */
.sidebar {
  flex: 0 0 225px;
  position: sticky;
  top: 4.5rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.045);
}

.avatar {
  width: 155px;
  height: auto;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: block;
  margin-bottom: 1rem;
}

.sidebar__name {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  line-height: 1.25;
}

.sidebar__bio {
  margin: 0 0 1.1rem;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}

.sidebar__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.9rem;
}

.sidebar__links li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
}

.sidebar__links svg {
  width: 16px;
  height: 16px;
  fill: var(--muted);
  flex-shrink: 0;
}

.sidebar__links a {
  color: var(--text);
}

.sidebar__links a:hover {
  color: var(--link);
}

/* Main content */
.content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 1.65rem 2rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.045);
}

.section {
  scroll-margin-top: 4.5rem;
}

.section + .section {
  margin-top: 2.75rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.section__title {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.content p {
  margin: 0 0 0.9rem;
}

/* Publications */
.pub-intro {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.pub-list {
  display: flex;
  flex-direction: column;
}

.pub-item {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.pub-item:first-child {
  padding-top: 0.25rem;
}

.pub-item:last-child {
  border-bottom: none;
}

.pub-item__teaser {
  flex: 0 0 260px;
  max-width: 260px;
}

.pub-item__teaser a {
  display: block;
}

.pub-item__teaser img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.pub-item__teaser img:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.pub-item__body {
  flex: 1 1 auto;
  min-width: 0;
}

.pub-item__title {
  margin: 0 0 0.35rem;
  font-size: 1.08rem;
  line-height: 1.35;
}

.pub-item__title a {
  color: var(--text);
}

.pub-item__title a:hover {
  color: var(--link);
}

.pub-item__authors {
  margin: 0 0 0.25rem !important;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text);
}

.pub-item__venue {
  margin: 0 0 0.65rem !important;
  font-size: 0.92rem;
  color: var(--muted);
}

.pub-item__award {
  color: var(--award);
  font-weight: 700;
}

.pub-item__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  display: inline-block;
  padding: 0.28rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid #d1d5db;
  border-radius: 5px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--bg-subtle);
  border-color: #9ca3af;
}

/* Subtle CraftBot note inside sidebar (never overlaps publications) */
.sidebar__hint {
  margin: 1rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--muted);
}

/* Interactive VLA Playground Dock */
.craftbot-dock {
  position: fixed;
  top: 4.35rem;
  left: 50%;
  transform: translateX(-50%) translateY(-14px);
  z-index: 25;
  width: min(940px, calc(100vw - 2rem));
  padding: 0.85rem 1.05rem;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

body.playground-active .craftbot-dock {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.craftbot-dock__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}

.craftbot-dock__title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: #e2e8f0;
}

.craftbot-dock__status {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  color: #38bdf8;
  background: rgba(30, 41, 59, 0.9);
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.craftbot-dock__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.craftbot-form {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.craftbot-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.42rem 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: #f8fafc;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 8px;
  outline: none;
}

.craftbot-input::placeholder {
  color: #94a3b8;
}

.craftbot-input:focus {
  border-color: #38bdf8;
}

.craftbot-send-btn {
  padding: 0.42rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  background: #2563eb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.craftbot-send-btn:hover {
  background: #1d4ed8;
}

.craftbot-dock__Toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.craftbot-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.craftbot-chip {
  padding: 0.24rem 0.58rem;
  font-size: 0.74rem;
  font-weight: 500;
  color: #cbd5e1;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.craftbot-chip:hover {
  color: #ffffff;
  border-color: #60a5fa;
  background: rgba(37, 99, 235, 0.28);
}

.craftbot-chip.is-active {
  color: #ffffff;
  background: #2563eb;
  border-color: #3b82f6;
}

.craftbot-chip--warn:hover {
  border-color: #f87171;
  background: rgba(239, 68, 68, 0.22);
}

.craftbot-dock__rows {
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
}

.craftbot-brushes-label {
  display: inline-block;
  min-width: 68px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  margin-right: 0.1rem;
}

/* Mobile World Windows (hidden on desktop, open panoramic gaps on mobile) */
.world-window {
  display: none;
}

/* Responsive */
@media (max-width: 820px) {
  .layout {
    flex-direction: column;
    gap: 0;
    padding: 0 0.85rem;
    margin-top: 0.9rem;
    margin-bottom: 21rem;
  }

  .sidebar {
    position: static;
    flex: none;
    width: 100%;
    padding: 1rem 1.1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.1rem;
    background: rgba(255, 255, 255, 0.84);
  }

  .content {
    width: 100%;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    box-shadow: none;
  }

  .section {
    padding: 1.2rem 1.15rem;
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 14px;
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.05);
  }

  .section + .section {
    margin-top: 0;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(226, 232, 240, 0.92);
  }

  .world-window {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    width: 100%;
    pointer-events: none;
    padding: 0.45rem 0.25rem;
  }

  .world-window--hero {
    height: 235px;
  }

  .world-window--mid {
    height: 215px;
  }

  .world-window__badge {
    display: inline-block;
    padding: 0.24rem 0.62rem;
    font-size: 0.72rem;
    color: #334155;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(203, 213, 225, 0.8);
    border-radius: 999px;
  }

  .avatar {
    width: 76px;
    height: auto;
    margin-bottom: 0;
  }

  .sidebar__links {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.45rem 1rem;
    width: 100%;
  }

  .sidebar__hint {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar__inner {
    padding: 0.6rem 0.85rem;
    gap: 0.5rem;
  }

  .topbar__brand {
    font-size: 0.98rem;
  }

  .topbar__nav {
    gap: 0.55rem;
  }

  .topbar__nav > a {
    font-size: 0.86rem;
  }

  .playground-toggle {
    padding: 0.28rem 0.58rem;
    font-size: 0.76rem;
  }

  .craftbot-dock {
    top: 3.6rem;
    width: calc(100vw - 1rem);
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
  }

  .craftbot-dock__top {
    gap: 0.4rem;
    margin-bottom: 0.45rem;
  }

  .craftbot-dock__title {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.78rem;
  }

  .craftbot-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .craftbot-chips::-webkit-scrollbar {
    display: none;
  }

  .craftbot-chip {
    flex-shrink: 0;
    font-size: 0.71rem;
    padding: 0.22rem 0.52rem;
  }

  .craftbot-brushes-label {
    min-width: 52px;
    flex-shrink: 0;
    font-size: 0.68rem;
  }

  .pub-item {
    flex-direction: column;
    gap: 0.85rem;
  }

  .pub-item__teaser {
    flex: none;
    max-width: 100%;
    width: 100%;
  }
}
