:root {
  --bg: #000000;
  --fg: #ffffff;
  --fg-muted: rgba(255, 255, 255, 0.45);
  --fg-faint: rgb(184, 184, 184);
  --border: rgba(255, 255, 255, 0.14);
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-input: rgba(255, 255, 255, 0.2);
  --panel-bg: rgba(0, 0, 0, 0.45);
  --msg-bg: rgba(255, 255, 255, 0.06);
  --msg-border: rgba(255, 255, 255, 0.5);
  --msg-text: rgba(255, 255, 255, 0.9);
  --btn-bg: #ffffff;
  --btn-fg: #000000;
  --status-border: #0a0a0a;
}

body.white-mode {
  --bg: #ffffff;
  --fg: #000000;
  --fg-muted: rgba(0, 0, 0, 0.5);
  --fg-faint: rgba(0, 0, 0, 0.4);
  --border: rgba(0, 0, 0, 0.14);
  --border-subtle: rgba(0, 0, 0, 0.1);
  --border-input: rgba(0, 0, 0, 0.2);
  --panel-bg: rgba(255, 255, 255, 0.55);
  --msg-bg: rgba(0, 0, 0, 0.05);
  --msg-border: rgba(0, 0, 0, 0.5);
  --msg-text: rgba(0, 0, 0, 0.9);
  --btn-bg: #000000;
  --btn-fg: #ffffff;
  --status-border: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Lock outer viewport so nothing outside the right panel scrolls */
html, body {
  height: 100dvh;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Roboto Mono', monospace;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Top Navigation & Bottom Footer */
header, footer {
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.14em;
}

footer {
  color: var(--fg-faint);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

a {
  color: inherit;
  text-decoration: none;
  opacity: 0.55;
  transition: opacity 0.2s;
}

a:hover { opacity: 1; }

.theme-toggle {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border-input);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
  opacity: 1;
  border-color: var(--fg);
}

/* Expanding Content Section Centered Vertically & Horizontally */
main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 3rem;
}

.content-wrapper {
  width: 100%;
  max-width: 1360px;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  align-items: center;
  gap: 3rem;
}

/* Left section anchor for desktop "Hi There" particle positioning */
.hero-space {
  width: 100%;
  height: 460px;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* Right section: Larger Conversational Card */
.chat-panel {
  position: relative;
  width: 100%;
  max-width: 620px;
  height: 500px;
  max-height: 100%;
  justify-self: center;
  background: var(--panel-bg);
  backdrop-filter: blur(0.3px);
  -webkit-backdrop-filter: blur(0px);
  border: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow: hidden;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

/* Person Profile Header */
.profile-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(0%) contrast(1);
  border: 1px solid var(--border-input);
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

.avatar::after {
  content: "";
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  border: 2px solid var(--status-border);
  transition: border-color 0.25s ease;
}

.profile-info h2 {
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.06em;
}

.profile-info p {
  font-size: 0.74rem;
  font-weight: 300;
  color: var(--fg-muted);
  margin-top: 0.25rem;
}

/* Shared Section Container for Portfolio & Kit */
.section-view {
  position: relative;
  width: 100%;
  max-width: 620px;
  height: 500px;
  max-height: 100%;
  justify-self: center;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow: hidden;
}

.section-top {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
}

.section-title {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Back to Chat Button */
.back-chat-btn {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border-input);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.back-chat-btn:hover {
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-color: var(--btn-bg);
}

/* Scrollable Inner Container: Portfolio Videos */
.video-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.video-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.video-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  background: #000000;
}

.video-wrapper iframe,
.video-wrapper model-viewer {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover
}


.video-info h2 {
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.video-info p {
  font-size: 0.78rem;
  font-weight: 300;
  line-height: 1.6;
  color: var(--fg-muted);
}

.video-info a {
  opacity: 0.85;
  text-decoration: underline;
  color: var(--fg);
}

.video-info a:hover {
  opacity: 1;
}

/* Scrollable Inner Container: Kit Square Buttons Grid (3 per row, 7 total) */
.kit-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.35rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-content: start;
  gap: 0.9rem;
}

.square-tool-btn {
  aspect-ratio: 1 / 1;
  background: var(--msg-bg);
  color: var(--fg);
  border: 1px solid var(--border-input);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem;
  text-align: center;
  opacity: 1;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.square-tool-btn:hover {
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-color: var(--btn-bg);
}

/* Scrollable Inner Container: Chat Messages */
.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.messages > :first-child {
  margin-top: auto;
}

.msg {
  font-size: 0.86rem;
  font-weight: 300;
  line-height: 1.6;
  padding: 1rem 1.2rem;
  max-width: 88%;
}

.msg.incoming {
  align-self: flex-start;
  background: var(--msg-bg);
  border-left: 2px solid var(--msg-border);
  color: var(--msg-text);
}

.msg.typing {
  align-self: flex-start;
  background: var(--msg-bg);
  border-left: 2px solid var(--msg-border);
  color: var(--msg-text);
}

.msg.outgoing {
  align-self: flex-end;
  background: var(--msg-bg);
  border-right: 2px solid var(--msg-border);
  color: var(--msg-text);
}

.msg a {
  opacity: 1;
  text-decoration: underline;
  color: var(--fg);
}

/* Inline Chat Action Buttons (Portfolio, Kit, Contact) */
.msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.chat-action-btn {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border-input);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.chat-action-btn:hover {
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-color: var(--btn-bg);
}

/* Input Bar */
.input-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  border: 1px solid var(--border-input);
  background: var(--bg);
  padding: 0.6rem 0.65rem 0.6rem 1.1rem;
  gap: 0.65rem;
  transition: background-color 0.25s ease, border-color 0.2s ease;
}

.input-row:focus-within {
  border-color: var(--fg);
}

input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--fg);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 300;
  outline: none;
}

input::placeholder {
  color: var(--fg-faint);
}

.send-btn {
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: none;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  padding: 0.65rem 1.15rem;
  cursor: pointer;
  transition: opacity 0.15s, background-color 0.25s ease, color 0.25s ease;
}

.send-btn:hover { opacity: 0.85; }

/* Subtle Custom Scrollbar for Inner Scroll Containers */
.video-container::-webkit-scrollbar,
.kit-grid::-webkit-scrollbar,
.messages::-webkit-scrollbar {
  width: 4px;
}

.video-container::-webkit-scrollbar-thumb,
.kit-grid::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb {
  background: var(--border-input);
}

/* Mobile Layout: "Hi There" renders centered behind the chat panel */
@media (max-width: 860px) {
  header, footer {
    padding: 1.25rem 1.5rem;
  }

  .nav-links {
    gap: 1rem;
  }

  main {
    padding: 0.75rem 1.5rem;
  }

  .content-wrapper {
    grid-template-columns: 1fr;
  }

  .hero-space {
    display: none;
  }

  .chat-panel,
  .section-view {
    max-width: 100%;
    height: 100%;
    max-height: 460px;
    padding: 1.25rem;
  }
}