html { scroll-behavior: smooth; }

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

::selection {
  background: #ffffff;
  color: #000;
}

body {
  margin: 0;
  background: #000;
}


/* ── Background text ───────────────────────── */

#bg-text {
  position: fixed;
  inset: 0;
  z-index: 2;
}

#bg-fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  font-family: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
  font-size: 23px;
  line-height: 1;
  color: #000;
  white-space: pre;
  overflow: hidden;
  user-select: text;
}

.home-block {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: top 0.4s cubic-bezier(0.4,0,0.2,1),
              left 0.4s cubic-bezier(0.4,0,0.2,1),
              transform 0.4s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  width: fit-content;
  align-items: flex-start;
  font-size: 23px;
  user-select: none;
  mix-blend-mode: difference;
}

.home-block.writing-mode {
  top: 32px;
  left: 32px;
  transform: translate(0, 0);
}

.home-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 24px;
}

.home-lines {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 80px;
}

#bg-text p {
  margin: 0;
  font-family: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
  color: #949494;
  line-height: 1;
  text-align: left;
}

#bg-text .home-name {
  color: #f0f0f0;
  font-weight: 500;
}

.home-tag { color: #949494; font-weight: 400; }

#bg-text .home-role { color: #949494; }
#bg-text .home-loc  { color: #949494; }

/* ── Inline links in bg-text ────────────────── */

#bg-text p a {
  color: inherit;
  text-decoration: none;
  pointer-events: all;
}
#bg-text p a:hover { color: inherit; }
#trustai-link:hover { text-decoration: underline; text-underline-offset: 3px; }




/* ── Terminal input ────────────────────────── */

.term-section {
  margin-top: 28px;
  align-self: stretch;
  position: relative;
  min-width: 0;
  transition: min-width 0.4s cubic-bezier(0.4,0,0.2,1);
}

.home-block.writing-mode .term-section {
  min-width: calc(100vw - 64px);
}

.term-rule {
  font-family: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
  color: #949494;
  overflow: hidden;
  white-space: nowrap;
  line-height: 1;
  margin-bottom: 2px;
  margin-top: 2px;
  /* width:0 + min-width:100% means this element contributes 0 to the parent's
     intrinsic-width calculation but still fills the parent visually */
  width: 0;
  min-width: 100%;
}
.term-rule::before {
  content: "────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────";
}

.term-hint {
  font-family: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
  color: #949494;
  position: absolute;
  top: calc(100% + 6px);
  left: calc(1ch + 8px);
  white-space: nowrap;
}

.term-hint--open {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #949494;
  user-select: auto;
}

.term-hint--open a {
  color: #949494;
  text-decoration: none;
  white-space: pre;
}
.term-hint--open a:hover { color: #f0f0f0; }
.term-cmd-top { color: #afd7ff !important; }

.term-err-icon    { color: #949494; }
.term-err-msg     { color: #892534; }
.term-unknown-msg { color: #949494; }
.term-arg-output  { color: #ffd700; }

.term-hint--table {
  user-select: auto;
  left: 0;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
}

.term-writing-dot {
  color: #f0f0f0;
  flex-shrink: 0;
  padding-top: 5px;
}

.term-writing-table {
  border-collapse: collapse;
  font-family: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
  font-size: inherit;
}

.term-writing-table td {
  padding: 4px 12px;
  border: 1px solid #f0f0f0;
  vertical-align: top;
}

.term-table-link {
  color: #f0f0f0;
  text-decoration: none;
}
.term-table-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.term-table-role { color: #c8c8c8; }

.term-table-meta { color: #f0f0f0; white-space: nowrap; }

.term-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.term-prompt {
  font-family: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
  color: #f0f0f0;
  flex-shrink: 0;
}

.term-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.term-input {
  background: transparent;
  border: none;
  outline: none;
  font-family: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
  font-size: inherit;
  color: #f0f0f0;
  caret-color: transparent;
  width: 100%;
  padding: 0;
}

.term-cursor {
  position: absolute;
  left: 0;
  width: 0.6em;
  height: 1.1em;
  background: #f0f0f0;
  pointer-events: none;
}

/* ── Blog & post pages ──────────────────────── */

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 64px 24px;
  font-family: 'Inter', sans-serif;
}
.page nav { margin-bottom: 48px; font-size: 13px; }
.page nav a { color: #111; text-decoration: none; }
.page nav a:hover { text-decoration: none; }
.page h2 { font-size: 13px; font-weight: 500; color: #888; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 32px; }

.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { padding: 24px 0; border-bottom: 1px solid #eee; }
.post-list li:first-child { border-top: 1px solid #eee; }
.post-list a { font-size: 18px; font-weight: 500; color: #111; text-decoration: none; }
.post-list a:hover { text-decoration: none; }
.post-meta { font-size: 11px; color: #111; margin-top: 4px; }
.post-desc { font-size: 13px; color: #444; margin-top: 8px; line-height: 1.6; }

/* ── Post back nav (above container) ────────── */

.post-nav {
  position: relative;
  z-index: 2;
  max-width: 816px;
  margin: 48px auto 16px;
  padding: 0;
  font-size: 13px;
  color: #888;
  font-family: 'Inter', sans-serif;
}
.post-nav a { color: #888; text-decoration: none; }

/* ── Post page card ─────────────────────────── */

.post-page {
  position: relative;
  z-index: 2;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06), 0 8px 40px rgba(0,0,0,0.08);
  border-radius: 2px;
  max-width: 816px;
  margin: 48px auto;
  padding: 80px 96px 100px;
  min-height: calc(100vh - 96px);
}


/* ── Post body ──────────────────────────────── */

.post-body h1 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
  text-align: center;
  margin: 0 0 16px;
  color: #111;
}

.post-body .authors {
  font-size: 13px;
  text-align: center;
  color: #333;
  margin: 0 0 4px;
}

.post-body .affiliation {
  font-size: 11px;
  text-align: center;
  color: #111;
  margin: 0 0 40px;
}

.post-body .abstract {
  margin: 32px 0 40px;
  padding: 0 16px;
  border-left: 3px solid #eee;
}

.post-body .abstract-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #111;
  margin: 0 0 6px;
}

.post-body .abstract p {
  font-size: 13px;
  line-height: 1.7;
  color: #444;
  margin: 0;
  text-align: left;
}

.post-body p {
  font-size: 15px;
  line-height: 1.8;
  color: #222;
  margin: 0 0 18px;
  text-align: justify;
  hyphens: auto;
}

/* Numbered sections via CSS counter */
.post-body { counter-reset: section; }

.post-body h2 {
  counter-increment: section;
  font-size: 13px;
  font-weight: 700;
  color: #111;
  text-transform: none;
  letter-spacing: 0;
  margin: 40px 0 14px;
}

.post-body h2::before {
  content: counter(section) ". ";
}

.post-body h2.no-counter {
  counter-increment: none;
}
.post-body h2.no-counter::before {
  content: none;
}

/* Equations */
.post-body .katex-display {
  margin: 24px 0;
  overflow-x: auto;
}

.post-body .eq-row {
  display: flex;
  align-items: center;
  margin: 24px 0;
}
.post-body .eq-row > div {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.post-body .eq-row .katex-display {
  margin: 0;
  overflow: visible;
}
.post-body .eq-num {
  font-size: 13px;
  color: #888;
  padding-left: 16px;
  white-space: nowrap;
}

.post-body h3 {
  font-size: 13px;
  font-weight: 700;
  color: #333;
  letter-spacing: 0;
  text-transform: none;
  margin: 28px 0 10px;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 16px 0 8px;
}
.post-body th, .post-body td {
  border: 1px solid #ddd;
  padding: 6px 12px;
  text-align: left;
}
.post-body th {
  background: #f8f8f8;
  font-weight: 600;
}
.post-body td:not(:first-child),
.post-body th:not(:first-child) {
  text-align: center;
}

.fig-caption {
  font-size: 11px;
  color: #777;
  text-align: center;
  margin: 4px 0 28px;
}

.fig-placeholder {
  background: #f7f7f7;
  border: 1px solid #e8e8e8;
  border-radius: 3px;
  padding: 28px;
  text-align: center;
  font-size: 11px;
  color: #aaa;
  margin: 16px 0 4px;
}

.post-body sup {
  font-size: 10px;
  font-weight: 600;
  color: #888;
}

.post-body hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 48px 0 36px;
}

.references {
  font-size: 13px;
  color: #444;
  line-height: 1.7;
  padding-left: 20px;
}
.references li { margin-bottom: 8px; }

.demo-frame {
  width: 100%;
  aspect-ratio: 1;
  border: none;
  border-radius: 4px;
  margin: 32px 0;
  display: block;
}

/* ── PDF pages ──────────────────────────────── */

#pdf-pages {
  margin-top: 0;
}

.pdf-page {
  display: block;
  width: 100%;
  margin-bottom: 2px;
}

/* ── Mobile nav (root page) ──────────────────── */

.mobile-nav {
  display: none;
}

#truu-mobile {
  display: none;
}

@media (max-width: 1024px) {
  /* Reposition home block to top-center */
  .home-block {
    top: 0;
    left: 0;
    transform: none;
    align-items: flex-start;
    width: 100%;
  }
  .home-block.writing-mode {
    top: 0;
    left: 0;
    transform: none;
  }
  .home-block.writing-mode .term-section {
    min-width: 100vw;
  }

  /* Hide terminal on mobile */
  .term-section { display: none; }

  /* Hide desktop sprite on mobile */
  #truu { display: none !important; }

  /* Full-width sprite below buttons — cycles through all frames */
  #truu-mobile {
    display: block;
    width: 100%;
    aspect-ratio: 128 / 80;
    animation: truu-mobile-cycle 3.2s steps(8) infinite;
  }

  @keyframes truu-mobile-cycle {
    from { background-position-x: 0; }
    to   { background-position-x: -800vw; }
  }

  .home-card { gap: 0; padding: 0; width: 100%; }
  .home-lines { padding: 0; height: auto; gap: 0; justify-content: flex-start; width: 100%; }
  #bg-text p { margin: 0; line-height: 1; }
  #bg-text .home-loc { display: none; }
  #bg-text .home-name { font-size: 9.8vw; white-space: nowrap; overflow: hidden; }
  #bg-text .home-role { font-size: 6.2vw; white-space: nowrap; overflow: hidden; }

  /* Giant pixel nav buttons */
  .mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 0;
    align-self: stretch;
  }
  .mobile-btn {
    display: block;
    padding: 20px 0 20px 16px;
    font-family: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
    font-size: 36px;
    font-weight: 700;
    color: #f0f0f0;
    background: #000;
    border: 1px solid #f0f0f0;
    text-decoration: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
  }
  .mobile-btn:active {
    background: #f0f0f0;
    color: #000;
  }
}

/* ── Mobile ─────────────────────────────────── */

@media (max-width: 860px) {
  .post-nav {
    margin: 24px auto 12px;
    padding: 0 28px;
  }
  .post-page {
    padding: 48px 28px 72px;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

