/* Load after the original styles; keep the desktop project choreography. */
:root {
  --site-anchor-offset: 76px;
}

html {
  scroll-padding-top: var(--site-anchor-offset);
}

a:focus-visible,
button:focus-visible,
textarea:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--lp-accent);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 1100;
  padding: 10px 16px;
  border: 1px solid var(--lp-border-strong);
  border-radius: var(--radius-8);
  background: var(--background);
  color: var(--lp-text-strong);
  transform: translateY(calc(-100% - 16px));
}

.skip-link:focus {
  transform: none;
}

.nav-links a,
.footer-links a,
.hero-foot > a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.lang-toggle .chip {
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}

.wechat-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  font: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed currentColor;
}

.wechat-trigger:focus-visible .wechat-qr,
.wechat-trigger[aria-expanded="true"] .wechat-qr {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.orbit-pill:focus-visible {
  animation-play-state: paused;
  z-index: 30;
}

.orbit-pill:focus-visible .pill-full {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.proj-card:focus-within .card-float {
  animation-play-state: paused;
}

.proj-card .cc-link:focus-visible {
  outline-offset: 2px;
}

.chat-panel {
  min-height: 0;
  height: 75vh;
  height: 75dvh;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
}

.chat-head,
.chat-foot,
.chat-panel > .divider {
  flex-shrink: 0;
}

.chat-body {
  min-height: 0;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
}

.chat-input {
  min-width: 0;
  font-size: 16px;
}

.chat-input-wrap:focus-within {
  border-color: var(--lp-accent);
}

.send-btn,
.chat-head .icon-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.preset-chips .chip-soft {
  min-height: 44px;
  line-height: 1.5;
  text-align: left;
}

.chat-status,
#chatStatus,
.chat-source {
  color: var(--lp-text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.chat-status:not(:empty) {
  margin-top: 8px;
}

.chat-source {
  display: block;
  margin-top: 6px;
}

.chat-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 8px;
}

#chatStatus {
  flex: 1 1 180px;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

#stopAnswer {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  line-height: 1.5;
  white-space: normal;
}

#stopAnswer[hidden] {
  display: none;
}

.chat-retry {
  display: block;
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  margin-top: 12px;
  line-height: 1.5;
  white-space: normal;
}

.chat-retry[hidden] {
  display: none;
}

@media (max-width: 899px) {
  .proj-card .cc-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }

  .proj-card .cc-links {
    gap: 8px 16px;
  }
}

@media (max-width: 767px) {
  :root {
    --site-anchor-offset: 120px;
  }

  .container {
    padding-inline: 20px;
  }

  .nav-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    height: auto;
    min-height: 104px;
    padding-top: 6px;
    padding-bottom: 4px;
    gap: 0 12px;
  }

  .nav-inner .logo {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .nav-inner .lang-toggle {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .nav-links {
    display: flex;
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    gap: 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    padding: 4px;
    scroll-padding-inline: 4px;
  }

  .nav-links a {
    flex: 1 0 auto;
    justify-content: center;
    min-width: 44px;
    padding-inline: 12px;
    white-space: nowrap;
    border-radius: var(--radius-8);
  }

  .nav-links a:hover,
  .nav-links a:focus-visible {
    background: var(--lp-surface-hover);
  }

  .hero {
    min-height: calc(100svh - 104px);
  }

  .hero-foot {
    align-items: center;
    gap: 4px 16px;
  }

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

  .gzh-orbit {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 440px;
  }

  .orbit-center {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin: 0 auto 8px;
  }

  .gzh-orbit .orbit-pill {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    animation: none;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    width: 100%;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--lp-border-subtle);
    border-radius: var(--radius-16);
    background: var(--background);
    box-shadow: none;
    white-space: normal;
  }

  .gzh-orbit .orbit-pill:hover {
    border-color: var(--lp-border-strong);
  }

  .orbit-pill .pill-word {
    display: none;
  }

  .gzh-orbit .orbit-pill .pill-full {
    display: block;
    position: static;
    width: auto;
    max-width: none;
    min-width: 0;
    padding: 3px 0 0;
    background: transparent;
    color: var(--lp-text-strong);
    border-radius: 0;
    opacity: 1;
    transform: none;
    box-shadow: none;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.7;
    transition: none;
  }
}

@media (max-width: 767px), (max-height: 560px) {
  .chat-overlay {
    top: var(--chat-viewport-offset-top, 0px);
    bottom: auto;
    height: var(--chat-viewport-height, 100vh);
    height: var(--chat-viewport-height, 100dvh);
    padding-top: max(8px, env(safe-area-inset-top));
    padding-right: max(8px, env(safe-area-inset-right));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    padding-left: max(8px, env(safe-area-inset-left));
  }

  .chat-panel {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: var(--radius-16);
  }

  .chat-head {
    padding: 8px 12px 8px 16px;
  }

  .chat-title .sub {
    display: block;
    margin-left: 0;
  }

  .chat-body {
    padding: 16px;
  }

  .chat-foot {
    padding: 8px 12px 12px;
  }

  .chat-foot .preset-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 4px;
    scrollbar-width: thin;
  }

  .chat-foot .preset-chips .chip-soft {
    flex: 0 0 auto;
    max-width: 100%;
  }

  .msg {
    max-width: 92%;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .orbit-pill,
  .card-float,
  .fx-c {
    will-change: auto;
  }

  .orbit-pill:hover,
  .card:hover,
  .btn-mint:hover {
    transform: none;
  }

  .typing {
    opacity: 0.65;
  }

  .hero .title-rainbow,
  .hero .title-rainbow .fx-rb {
    background-image: none !important;
    color: var(--lp-text-strong);
    -webkit-text-fill-color: var(--lp-text-strong);
  }

  #fxTrail {
    display: none;
  }
}
