:root {
  --bg: #fafafa;
  --text: #1d1d1f;
  --muted: #666;
  --line: #d8d8d8;
  --panel: #f1f1f1;
  --link: #1d1d1f;
  --surface: rgba(255, 255, 255, 0.9);
}

body[data-theme="dark"] {
  --bg: #0d0d0f;
  --text: #f2f2f2;
  --muted: #a5a5ab;
  --line: #303036;
  --panel: #151519;
  --link: #f2f2f2;
  --surface: rgba(22, 22, 26, 0.92);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "IBM Plex Mono",
    "SFMono-Regular",
    "SF Mono",
    Monaco,
    Consolas,
    "Liberation Mono",
    "Courier New",
    monospace;
  transition:
    background-color 220ms ease,
    color 220ms ease;
}

body.is-loading {
  overflow: hidden;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
}

.code-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #06080d;
  color: #7dffa8;
  font-size: 0.92rem;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.code-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.code-loader-shell {
  width: min(92vw, 640px);
  border: 1px solid rgba(125, 255, 168, 0.28);
  background: rgba(8, 12, 18, 0.96);
  box-shadow: 0 12px 45px rgba(0, 0, 0, 0.45);
}

.code-loader-bar {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid rgba(125, 255, 168, 0.2);
}

.code-loader-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: rgba(125, 255, 168, 0.7);
}

.code-loader-dot:nth-child(2) {
  opacity: 0.72;
}

.code-loader-dot:nth-child(3) {
  opacity: 0.45;
}

.code-loader-title {
  margin-left: 0.35rem;
  color: rgba(125, 255, 168, 0.8);
  font-size: 0.78rem;
}

.code-loader-body {
  margin: 0;
  padding: 0.95rem 1rem 1rem;
  line-height: 1.65;
}

.code-loader-line {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  white-space: nowrap;
}

.code-loader-prompt {
  color: rgba(125, 255, 168, 0.72);
}

.code-loader-text {
  display: inline-block;
  overflow: hidden;
  width: 0;
  animation: loader-type 1.5s steps(24, end) infinite;
}

.code-loader-caret {
  width: 0.56rem;
  height: 1rem;
  background: #7dffa8;
  animation: loader-blink 0.9s steps(1, end) infinite;
}

@keyframes loader-type {
  0% {
    width: 0;
  }
  35%,
  65% {
    width: 25ch;
  }
  100% {
    width: 0;
  }
}

@keyframes loader-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.2;
  }
}

.site-shell {
  width: min(100% - 2rem, 640px);
  margin: 1.75rem auto 2.5rem;
}

.site-header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  width: fit-content;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 0.2rem;
  background: var(--text);
  color: #fff;
  font-size: 0.68rem;
  line-height: 1;
}

.brand-mark-image {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 0.28rem;
  object-fit: cover;
  display: block;
}

.brand-name {
  letter-spacing: 0.02em;
}

.theme-toggle {
  border: none;
  background: var(--bg);
  color: #000;
  font: inherit;
  width: 6.7rem;
  height: 2rem;
  padding: 0 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  backdrop-filter: blur(10px);
  box-shadow: none;
  transition:
    transform 170ms ease,
    border-color 170ms ease,
    background-color 170ms ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: none;
}

.theme-toggle:active {
  transform: translateY(0);
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 18%, transparent);
}

.theme-icon {
  position: relative;
  font-size: 0.8rem;
  line-height: 1;
  transition:
    opacity 180ms ease,
    transform 220ms cubic-bezier(0.2, 0.9, 0.24, 1);
}

.theme-icon-sun {
  opacity: 1;
}

.theme-icon-moon {
  position: absolute;
  left: 0.75rem;
  opacity: 0;
  transform: translateY(0.12rem) scale(0.84);
}

.theme-mode-label {
  margin-left: 0.45rem;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #000;
}

body[data-theme="dark"] .theme-toggle,
body[data-theme="dark"] .theme-mode-label {
  color: #fff;
}

.theme-toggle[data-mode="dark"] .theme-icon-sun {
  opacity: 0;
  transform: translateY(-0.12rem) scale(0.84);
}

.theme-toggle[data-mode="dark"] .theme-icon-moon {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.site-nav {
  display: flex;
  gap: 1.35rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text);
  text-decoration: none;
  padding-bottom: 0.15rem;
  transition: opacity 150ms ease;
}

.site-nav a:hover {
  opacity: 0.7;
}

.site-nav a.is-active {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.page-content {
  padding: 2rem 0 3rem;
}

.section-block {
  margin-top: 2.8rem;
}

.section-title {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.intro-block h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.45rem, 2.4vw, 1.8rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: 0;
}

.flicker-line {
  display: inline-block;
  color: #000;
  text-shadow: none;
  animation: cursor-flicker 2s steps(1, end) infinite;
  transform: translateZ(0);
}

.role-line,
.lead,
.body-copy,
.links-list {
  margin: 0 0 1.25rem;
  font-size: 0.98rem;
  line-height: 1.8;
}

.command-trigger {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 0.52rem 0.8rem;
  font: inherit;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease;
}

.command-trigger:hover {
  background: color-mix(in srgb, var(--panel) 68%, transparent);
  transform: translateY(-1px);
}

.command-trigger-key {
  color: var(--muted);
  font-size: 0.76rem;
}

.company-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.company-logo {
  width: 0.9rem;
  height: 0.9rem;
  flex: 0 0 auto;
  display: inline-block;
}

.feature-panel {
  margin-top: 1rem;
}

.feature-art {
  position: relative;
  min-height: 29rem;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.feature-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 29rem;
  object-fit: cover;
  object-position: center 32%;
}

.live-project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.live-project-card {
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 100% 0%, rgba(132, 154, 255, 0.12), transparent 45%),
    var(--panel);
  padding: 0.9rem;
  text-decoration: none;
  color: var(--text);
  min-height: 12.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform 180ms ease, border-color 180ms ease;
}

.live-project-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--text) 16%, var(--line));
}

.live-project-status {
  width: fit-content;
  font-size: 0.68rem;
  line-height: 1;
  border-radius: 999px;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--line);
}

.live-project-status.is-building {
  background: rgba(95, 136, 255, 0.12);
}

.live-project-status.is-live {
  background: rgba(56, 198, 122, 0.14);
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
}

.live-project-status.is-live::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #2ac76a;
  box-shadow: 0 0 0.35rem rgba(42, 199, 106, 0.55);
  animation: live-dot-pulse 2.6s ease-in-out infinite;
}

.live-project-status.is-experiment {
  background: rgba(213, 152, 39, 0.14);
}

.live-project-name {
  margin: 0;
  font-size: 1rem;
}

.live-project-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.89rem;
  line-height: 1.7;
}

.live-project-meta {
  margin: auto 0 0;
  font-size: 0.73rem;
  color: var(--muted);
}

.thinking-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.thinking-list li {
  border-left: 2px solid var(--line);
  padding-left: 0.7rem;
  font-size: 0.92rem;
  line-height: 1.7;
}

.build-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.build-log-item {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.8rem;
  padding: 0.78rem 0;
  border-bottom: 1px solid var(--line);
}

.build-log-date {
  color: var(--muted);
  font-size: 0.76rem;
}

.build-log-text {
  color: var(--text);
  font-size: 0.9rem;
}

.reveal-on-scroll {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 280ms ease, transform 280ms ease;
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.stat-card {
  margin: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0.75rem;
}

.stat-label {
  margin: 0 0 0.45rem;
  font-size: 0.73rem;
  color: var(--muted);
}

.stat-value {
  margin: 0;
  font-size: 0.9rem;
}

.playground-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.play-card {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0.9rem;
}

.play-label {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.play-title {
  margin: 0;
  font-size: 0.95rem;
}

.play-copy {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.75;
}

.motion-stage {
  position: relative;
  border: 1px solid var(--line);
  min-height: 17rem;
  background: radial-gradient(circle at 20% 20%, rgba(156, 161, 255, 0.2), transparent 45%), #070a12;
  overflow: hidden;
  isolation: isolate;
}

.motion-glow {
  position: absolute;
  inset: -40%;
  background:
    conic-gradient(from 40deg, rgba(130, 145, 255, 0.38), rgba(61, 227, 188, 0.22), rgba(212, 95, 255, 0.24), rgba(130, 145, 255, 0.38));
  filter: blur(12px);
  animation: sweep 11s linear infinite;
  opacity: 0.95;
}

.motion-stage::before,
.motion-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.motion-stage::before {
  background:
    linear-gradient(transparent 0%, rgba(125, 255, 249, 0.1) 48%, transparent 52%),
    repeating-linear-gradient(
      to bottom,
      rgba(178, 243, 255, 0.1) 0 1px,
      transparent 1px 4px
    );
  mix-blend-mode: screen;
  animation: scan 4.8s linear infinite;
}

.motion-stage::after {
  background: radial-gradient(circle at 80% 18%, rgba(167, 169, 255, 0.4), transparent 32%);
  animation: pulse-orbit 3.4s ease-in-out infinite;
}

.motion-panel {
  position: absolute;
  inset: auto 1rem 1rem 1rem;
  border: 1px solid rgba(154, 175, 255, 0.35);
  background: rgba(8, 14, 25, 0.7);
  backdrop-filter: blur(6px);
  padding: 0.75rem;
  z-index: 2;
}

.motion-model,
.motion-web {
  position: absolute;
  inset: 0;
}

.motion-model {
  z-index: 1;
}

.motion-web {
  z-index: 1;
  opacity: 0.62;
}

.motion-chips {
  position: absolute;
  top: 0.8rem;
  left: 0.8rem;
  z-index: 2;
  display: inline-flex;
  gap: 0.45rem;
}

.motion-chips span {
  font-size: 0.62rem;
  padding: 0.22rem 0.36rem;
  border: 1px solid rgba(154, 175, 255, 0.35);
  background: rgba(5, 11, 22, 0.6);
  color: rgba(191, 239, 255, 0.88);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.motion-line {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(193, 238, 255, 0.92);
  text-shadow: 0 0 8px rgba(110, 214, 255, 0.28);
}

.motion-line + .motion-line {
  margin-top: 0.2rem;
}

.stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.stack-tag {
  border: 1px solid var(--line);
  font-size: 0.76rem;
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  background: var(--panel);
}

.links-list {
  padding-left: 1.2rem;
}

.icon-links {
  list-style: none;
  padding-left: 0;
  margin-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.icon-links li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.icon-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  min-height: 1.4rem;
}

.icon-links a:hover {
  text-decoration: underline;
}

.link-icon {
  width: 0.95rem;
  height: 0.95rem;
  flex: 0 0 auto;
  display: inline-block;
}

.gallery-section {
  margin-top: 2rem;
}

.projects-section {
  margin-top: 2rem;
}

.projects-list {
  margin-top: 0.35rem;
}

.project-link {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.55rem 0;
  text-decoration: none;
  flex-wrap: wrap;
  line-height: 1.65;
}

.project-logo {
  width: 0.95rem;
  height: 0.95rem;
  flex: 0 0 auto;
  display: block;
}

.project-prefix,
.project-name,
.project-tagline-inline {
  font-size: 0.98rem;
}

.project-name {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.project-tagline-inline {
  color: var(--text);
}

.gallery-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  line-height: 1.4;
  font-weight: 700;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.gallery-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--panel);
}

.site-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-contact {
  margin-top: 0.55rem;
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: grid;
  place-items: start center;
  padding: 14vh 1rem 1rem;
  background: rgba(7, 8, 12, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 170ms ease, visibility 170ms ease;
}

.command-palette.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.command-dialog {
  width: min(100%, 640px);
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.25);
}

.command-header {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.command-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.command-input.is-indicating {
  caret-color: transparent;
}

.command-input:focus {
  outline: none;
}

.command-list {
  list-style: none;
  margin: 0;
  padding: 0.3rem;
  max-height: 50vh;
  overflow: auto;
}

.command-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  padding: 0.62rem 0.66rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.command-item:hover,
.command-item.is-active {
  background: var(--panel);
}

.command-empty {
  padding: 0.8rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.quick-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  z-index: 9300;
  display: none;
}

.quick-toast {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 0.48rem 0.72rem;
  font-size: 0.78rem;
  z-index: 9400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.quick-toast.is-visible {
  opacity: 1;
}

body.easter-on .brand-name {
  letter-spacing: 0.08em;
}

body.easter-on .motion-glow {
  animation-duration: 3.5s;
}

body.easter-on .motion-stage::before {
  animation-duration: 2.4s;
}

@keyframes cursor-flicker {
  0%,
  49.999% {
    opacity: 1;
    text-shadow: none;
  }
  50%,
  100% {
    opacity: 0;
    text-shadow: none;
  }
}

@keyframes sweep {
  from {
    transform: rotate(0deg) scale(1.15);
  }
  to {
    transform: rotate(360deg) scale(1.15);
  }
}

@keyframes scan {
  from {
    transform: translateY(-65%);
  }
  to {
    transform: translateY(65%);
  }
}

@keyframes pulse-orbit {
  0%,
  100% {
    opacity: 0.38;
    transform: scale(1);
  }
  50% {
    opacity: 0.72;
    transform: scale(1.06);
  }
}

@keyframes live-dot-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.92;
  }
  50% {
    transform: scale(1.22);
    opacity: 0.6;
  }
}

@media (max-width: 640px) {
  .site-shell {
    width: min(100% - 1.25rem, 640px);
  }

  .header-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .feature-art {
    min-height: 22rem;
  }

  .feature-image {
    min-height: 22rem;
    object-position: center 28%;
  }

  .image-grid {
    grid-template-columns: 1fr;
  }

  .project-link {
    align-items: flex-start;
  }

  .live-project-grid,
  .playground-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .quick-fab {
    display: inline-grid;
    place-items: center;
  }

  .command-trigger {
    display: none;
  }

  .section-block {
    margin-top: 2.2rem;
  }

  .theme-toggle {
    width: 100%;
    max-width: 8.2rem;
  }

  .build-log-item {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .motion-stage {
    min-height: 14.5rem;
  }

  .motion-panel {
    inset: auto 0.7rem 0.7rem 0.7rem;
    padding: 0.58rem;
  }

  .motion-line {
    font-size: 0.72rem;
  }
}

@media (min-width: 641px) and (max-width: 940px) {
  .live-project-grid,
  .playground-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
