@font-face {
  font-family: "SF Mono";
  src: url("fonts/SF-Mono-Regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "SF Mono";
  src: url("fonts/SF-Mono-Bold.otf") format("opentype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #eeeeee;
  --paper: #ffffff;
  --surface: #eeeeee;
  --ink: #111111;
  --muted: #757575;
  --rule: #d5d5d5;
  --symbol-rule: #d5d5d5;
  --invert: #111111;
  --invert-text: #ffffff;
  --chat-blue: #0068e8;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #080808;
  --paper: #111111;
  --surface: #1b1b1b;
  --ink: #f2f2f2;
  --muted: #969696;
  --rule: #444444;
  --symbol-rule: #f2f2f2;
  --invert: #f2f2f2;
  --invert-text: #111111;
}

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

html {
  scroll-behavior: smooth;
  background: var(--page);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 18px;
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
a,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-transform: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
dl,
dd {
  margin: 0;
}

strong {
  font-weight: 400;
}

small {
  color: var(--muted);
  font: inherit;
}

[hidden] {
  display: none !important;
}

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

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

.site-canvas {
  min-height: 100vh;
  padding: 50px;
  background: var(--page);
}

.portfolio-frame {
  width: min(680px, 100%);
  min-height: calc(100vh - 100px);
  margin: 0 auto;
  padding: 42px;
  border: 1px solid var(--ink);
  background: var(--paper);
}

.profile-tools,
.tool-actions,
.section-heading,
.build-head,
.footer,
.dialog-head,
.dialog-foot,
.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.avatar {
  display: block;
  width: 46px;
  height: 46px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
  object-fit: cover;
}

.tool-actions {
  gap: 7px;
}

.tool-actions button {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--rule);
}

.tool-actions button:last-child {
  width: 44px;
  padding: 0;
}

.tool-actions button:hover,
.tool-actions button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.identity {
  padding: 54px 0 46px;
}

.identity-name {
  margin-bottom: 0;
  font-size: 12px;
  line-height: 18px;
  font-weight: 700;
}

.bridge {
  margin-top: 14px;
  font-weight: 400;
}

.role-line {
  max-width: 67ch;
  margin-top: 12px;
  color: var(--muted);
}

.primary-action {
  display: flex;
  min-height: 80px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--invert);
  background: var(--invert);
  color: var(--invert-text);
}

.primary-action span:first-child,
.primary-action strong,
.primary-action small {
  display: block;
}

.primary-action small {
  margin-top: 6px;
  color: currentColor;
  opacity: 0.7;
}

.primary-action:hover,
.primary-action:focus-visible {
  opacity: 0.85;
}

.social-row {
  display: flex;
  gap: 7px;
  margin-top: 11px;
}

.symbol-link {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--symbol-rule);
  background: var(--paper);
}

.symbol-link svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.symbol-link:hover,
.symbol-link:focus-visible {
  border-color: var(--ink);
  background: var(--surface);
  color: var(--ink);
}

.build-activity {
  display: block;
  margin-top: 11px;
  padding: 14px 15px;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.build-activity:hover {
  background: var(--surface);
}

.build-head {
  width: 100%;
}

.build-grid {
  display: grid;
  grid-template-rows: repeat(7, 8px);
  grid-template-columns: repeat(53, minmax(0, 1fr));
  grid-auto-flow: column;
  gap: 2px;
  margin: 12px 0;
}

.build-cell {
  display: block;
  background: var(--surface);
}

.build-cell.is-empty {
  visibility: hidden;
}

.build-cell.level-1 {
  background: color-mix(in srgb, var(--ink) 24%, var(--paper));
}

.build-cell.level-2 {
  background: color-mix(in srgb, var(--ink) 48%, var(--paper));
}

.build-cell.level-3 {
  background: color-mix(in srgb, var(--ink) 72%, var(--paper));
}

.build-cell.level-4 {
  background: var(--ink);
}

.page-index {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 11px;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.page-index a,
.page-index button {
  display: grid;
  min-height: 44px;
  place-items: center;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-index a:hover,
.page-index button:hover {
  background: var(--ink);
  color: var(--paper);
}

.section-block {
  scroll-margin-top: 20px;
  margin-top: 42px;
}

.section-heading {
  min-height: 50px;
  margin-bottom: 11px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--ink);
}

.section-heading strong,
.section-heading small {
  display: block;
}

.section-heading small {
  margin-top: 4px;
}

.section-heading > span {
  align-self: flex-start;
  color: var(--muted);
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.operator-control {
  min-height: 66px;
  padding: 10px 15px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

.operator-control:first-child {
  grid-column: 1 / -1;
}

.operator-control strong,
.operator-control span {
  display: block;
}

.operator-control span {
  margin-top: 4px;
  color: var(--muted);
}

.operator-control:hover,
.operator-control.is-active {
  background: var(--ink);
  color: var(--paper);
}

.operator-control:hover span,
.operator-control.is-active span {
  color: currentColor;
  opacity: 0.7;
}

.system-trace {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr)) minmax(86px, 1.05fr) repeat(2, minmax(82px, 1fr)) minmax(92px, 1.12fr);
  margin-top: 11px;
  overflow-x: auto;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  scrollbar-color: var(--ink) var(--surface);
}

.system-stage {
  min-height: 88px;
  padding: 9px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.system-stage small,
.system-stage strong {
  display: block;
}

.system-stage strong {
  margin-top: 14px;
}

.system-stage[data-active="false"] {
  color: var(--muted);
  background: var(--surface);
}

.system-stage[data-active="true"] {
  color: var(--ink);
  background: var(--paper);
}

[data-selected-operator="agent"] .system-stage[data-active="true"] {
  color: var(--paper);
  background: var(--ink);
}

.system-context,
.empty-state {
  padding: 10px 15px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  color: var(--muted);
}

.project-list {
  display: grid;
  gap: 11px;
}

.project-card {
  border: 1px solid var(--rule);
}

.project-card summary,
.qa-item summary {
  list-style: none;
}

.project-card summary::-webkit-details-marker,
.qa-item summary::-webkit-details-marker {
  display: none;
}

.project-card summary {
  display: grid;
  min-height: 62px;
  grid-template-columns: 26px minmax(0, 1fr) 84px 10px;
  gap: 10px;
  align-items: center;
  padding: 10px 15px;
  cursor: pointer;
}

.project-card summary:hover,
.project-card details[open] > summary {
  background: var(--surface);
}

.project-card:first-child details[open] > summary,
.project-card[data-project-id="api-cli-mcp"] details[open] > summary {
  background: var(--ink);
  color: var(--paper);
}

.project-card details[open] > summary .project-index,
.project-card details[open] > summary .project-status {
  color: currentColor;
  opacity: 0.75;
}

.project-card:first-child details[open] > summary small,
.project-card[data-project-id="api-cli-mcp"] details[open] > summary small {
  color: currentColor;
  opacity: 0.75;
}

.project-index,
.project-status {
  color: var(--muted);
}

.project-summary-copy,
.project-summary-copy strong,
.project-summary-copy small {
  display: block;
}

.project-summary-copy small {
  margin-top: 4px;
  color: var(--muted);
}

.project-status {
  text-align: right;
}

.drawer-mark::before {
  content: "+";
}

details[open] > summary .drawer-mark::before {
  content: "−";
}

.project-body {
  padding: 18px;
  border-top: 1px solid var(--rule);
  background: var(--paper);
}

.project-meta {
  gap: 16px;
  margin-bottom: 14px;
  color: var(--muted);
}

.project-meta span:last-child {
  text-align: right;
}

.project-body dl {
  border-top: 1px solid var(--rule);
}

.project-body dl > div {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}

.project-body dt {
  font-weight: 400;
}

.project-body dd {
  color: var(--ink);
}

.skill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 0;
}

.skill-row span {
  padding: 4px 7px;
  border: 1px solid var(--rule);
}

.evidence-links {
  border-top: 1px solid var(--rule);
}

.evidence-links a {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--rule);
}

.evidence-links a:hover,
.writing-row:hover {
  color: var(--ink);
  background: var(--surface);
}

.proof-grid,
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.proof-cell,
.about-grid > div {
  min-height: 112px;
  padding: 14px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.proof-cell strong,
.proof-cell span,
.proof-cell small,
.about-grid strong,
.about-grid p {
  display: block;
}

.proof-cell strong {
  font-size: 12px;
  line-height: 18px;
}

.proof-cell span {
  margin-top: 14px;
}

.proof-cell:hover {
  color: var(--paper);
  background: var(--ink);
}

.proof-cell:hover small {
  color: currentColor;
  opacity: 0.7;
}

.writing-list {
  display: grid;
  gap: 11px;
}

.writing-row {
  display: grid;
  min-height: 62px;
  grid-template-columns: minmax(0, 1fr) 112px 10px;
  gap: 10px;
  align-items: center;
  padding: 10px 15px;
  border: 1px solid var(--rule);
}

.writing-row strong,
.writing-row small {
  display: block;
}

.writing-row small {
  margin-top: 4px;
  color: var(--muted);
}

.writing-category {
  color: var(--muted);
  text-align: right;
}

.about-grid > div p {
  margin-top: 10px;
  color: var(--muted);
}

.about-copy {
  padding: 18px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.ask-section {
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.ask-trigger {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin-top: 0;
  padding: 10px 15px;
  border: 1px solid var(--rule);
  border-radius: 999px;
}

.ask-trigger:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--surface);
}

.js .qa-fallback {
  display: none;
}

.qa-fallback {
  margin-top: 11px;
  border-top: 1px solid var(--rule);
}

.qa-item {
  border-bottom: 1px solid var(--rule);
}

.qa-item summary {
  min-height: 52px;
  padding: 10px 12px;
  cursor: pointer;
}

.qa-answer {
  padding: 0 12px 14px;
}

.qa-answer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.qa-answer a {
  padding: 6px 8px;
  border: 1px solid var(--rule);
}

.footer {
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 56px;
  padding-top: 0;
  border-top: 0;
}

.footer a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ask-dialog {
  width: min(1240px, calc(100vw - 100px));
  height: min(900px, calc(100vh - 100px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.ask-dialog::backdrop {
  background: rgb(238 238 238 / 0.94);
}

html[data-theme="dark"] .ask-dialog::backdrop {
  background: rgb(8 8 8 / 0.94);
}

.dialog-frame {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: 42px;
  border: 1px solid var(--ink);
  background: var(--paper);
}

.dialog-frame:focus {
  outline: none;
}

.dialog-head {
  justify-content: space-between;
}

.dialog-head button,
.dialog-foot button {
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dialog-content {
  flex: 1;
  padding: 46px 0 30px;
  overflow-y: auto;
}

#dialog-title {
  font-weight: 700;
}

.dialog-prompt {
  width: max-content;
  max-width: 80%;
  margin-top: 18px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: 30px 30px 30px 6px;
  font-size: 12px;
  line-height: 18px;
}

.dialog-questions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 26px;
}

.dialog-questions .qa-item {
  width: 100%;
  max-width: none;
  border: 0;
}

.dialog-questions .qa-item summary {
  width: fit-content;
  max-width: 88%;
  min-height: 44px;
  margin-left: auto;
  padding: 10px 14px;
  background: var(--chat-blue);
  color: #ffffff;
  border-radius: 30px 30px 6px 30px;
  text-align: right;
}

.dialog-questions .qa-answer {
  padding: 0;
  border: 0;
  background: transparent;
}

.dialog-questions .answer-bubble {
  width: min(80%, 740px);
  margin-top: 11px;
  padding: 14px;
  background: var(--surface);
  border-radius: 6px 30px 30px 30px;
}

.dialog-questions .answer-bubble small {
  display: block;
  margin-bottom: 6px;
}

.dialog-questions .qa-answer nav {
  display: grid;
  width: 100%;
  gap: 11px;
  margin-top: 11px;
}

.dialog-questions .qa-answer a {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.dialog-foot {
  border-top: 1px solid var(--ink);
  color: var(--muted);
}

@media (max-width: 720px) {
  .site-canvas {
    padding: 10px;
  }

  .portfolio-frame {
    min-height: calc(100vh - 20px);
    padding: 20px;
  }

  .avatar {
    width: 35px;
    height: 35px;
  }

  .tool-actions button:first-child {
    display: none;
  }

  .identity {
    padding: 40px 0 30px;
  }

  .page-index {
    grid-template-columns: repeat(3, 1fr);
  }

  .operator-grid,
  .proof-grid,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .operator-control:first-child {
    grid-column: auto;
  }

  .project-card summary {
    grid-template-columns: 24px minmax(0, 1fr) 10px;
  }

  .project-status {
    display: none;
  }

  .project-body {
    padding: 14px;
  }

  .project-body dl > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .writing-row {
    grid-template-columns: minmax(0, 1fr) 10px;
  }

  .writing-category {
    display: none;
  }

  .ask-dialog {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }

  .dialog-frame {
    padding: 20px;
  }

  .dialog-content {
    padding-top: 40px;
  }

  .dialog-prompt,
  .dialog-questions .qa-item summary {
    max-width: 96%;
  }

  .dialog-questions .answer-bubble {
    width: 92%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
