/* ============ Responsive ============ */
.nav-backdrop { display: none; }

@media (max-width: 1060px) {
  .hero-grid,
  .home-grid,
  .article-layout { grid-template-columns: 1fr; }

  .sidebar,
  .article-aside { position: static; }

  .article-aside { order: -1; }

  .header-inner > .search-box { display: none; }

  .blog-stream-topbar {
    grid-template-columns: 1fr;
  }

  .blog-search-actions {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
    max-width: 568px;
    justify-self: stretch;
  }

  .blog-search-box { max-width: none; }

  .home-projects-head,
  .home-projects-layout {
    grid-template-columns: 1fr;
  }

  .home-hot-layout,
  .home-hot-feature {
    grid-template-columns: 1fr;
  }

  .home-hot-feature-media {
    min-height: 220px;
    aspect-ratio: 16 / 8;
  }

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

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

  .home-projects-head {
    gap: 14px;
  }

  .home-project-feature {
    min-height: 0;
  }

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

  .hero-side-visual { max-width: 560px; }
}

@media (max-width: 820px) {
  .header-inner {
    height: auto;
    padding: 18px 0;
    gap: 10px;
  }

  .brand { margin-right: auto; }

  body.nav-open {
    overflow: hidden;
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 29;
    padding: 0;
    border: 0;
    background: rgba(4, 3, 3, 0.56);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .nav-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .site-nav {
    display: grid;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    padding: 10px;
    margin-top: 8px;
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(18, 15, 13, 0.98);
    border: 1px solid var(--border);
    border-radius: 8px;
    backdrop-filter: blur(18px);
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.38);
    gap: 8px;
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(0.985);
    transform-origin: top center;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  }

  html[data-theme="light"] .site-nav {
    background: rgba(255, 252, 248, 0.98);
    border-color: var(--border);
    box-shadow: 0 20px 48px rgba(73, 47, 28, 0.16);
  }

  .site-nav.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .site-nav > a,
  .site-nav .nav-link {
    min-width: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
  }

  .site-nav > a:hover,
  .site-nav > a.is-active,
  .site-nav .nav-link:hover,
  .site-nav .nav-link.is-active {
    color: var(--heading);
    border-color: rgba(224, 111, 42, 0.3);
    background: rgba(224, 111, 42, 0.12);
  }

  html[data-theme="light"] .site-nav > a,
  html[data-theme="light"] .site-nav .nav-link {
    background: rgba(91, 60, 36, 0.025);
  }

  .nav-item {
    display: block;
    min-width: 0;
  }

  .nav-item.has-children {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .nav-item.has-children > .nav-link {
    grid-column: 1 / -1;
  }

  .nav-dropdown {
    grid-column: 1 / -1;
    position: static;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    opacity: 1;
    visibility: visible;
    transform: none;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    min-width: 0;
  }

  .nav-dropdown a {
    min-width: 0;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    padding: 7px 6px;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    text-align: center;
  }

  html[data-theme="light"] .nav-dropdown a:hover { color: var(--heading); background: rgba(224, 111, 42, 0.08); }

  .nav-item.has-children::after { display: none; }

  .nav-item.has-children:hover .nav-dropdown,
  .nav-item.has-children:focus-within .nav-dropdown {
    transform: none;
  }

  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .nav-toggle[aria-expanded="true"] {
    color: var(--blue-light);
    background: rgba(224, 111, 42, 0.1);
  }

  .nav-toggle[aria-expanded="true"] span:first-child {
    transform: translateY(3.5px) rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] span:last-child {
    transform: translateY(-3.5px) rotate(-45deg);
  }

  .hero-slide { padding: 60px 0 30px; }

  .hero-copy h1 {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .blog-main-toolbar {
    grid-template-columns: 1fr;
  }

  /* 移动端隐藏文章侧栏 (目录 + 文章信息) — 阅读时不被打扰 */
  .article-aside { display: none !important; }

  .post-card {
    grid-template-columns: 1fr;
  }

  .post-card-media {
    aspect-ratio: 16 / 9;
    min-height: 0;
  }

  .filter-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .article-neighbors { grid-template-columns: 1fr; }

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

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-meta { align-self: flex-end; }

  .article-meta > span::after { display: none; }
}

@media (max-width: 360px) {
  .site-nav,
  .nav-item.has-children,
  .nav-dropdown {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .flux-container { width: min(100% - 24px, var(--max)); }

  .form-grid-three { grid-template-columns: 1fr; }

  .comment-form-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .github-comment-user {
    width: 100%;
    max-width: none;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .github-comment-user-main {
    flex: 1 1 calc(100% - 50px);
  }

  .github-comment-logout {
    width: 100%;
    margin-left: 44px;
  }

  .side-card,
  .article-toc-panel,
  .article-info,
  .comment-form-panel,
  .empty-panel { padding: 18px; }

  .hero-copy h1 { font-size: clamp(32px, 8vw, 44px); }

  .home-projects-section {
    padding: 54px 0 32px;
  }

  .home-toys-section {
    padding: 48px 0 42px;
  }

  .home-hot-section {
    padding: 16px 0 34px;
  }

  .home-projects-head,
  .home-hot-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .home-projects-more,
  .home-hot-more {
    width: fit-content;
  }

  .home-hot-feature,
  .home-hot-card {
    padding: 14px;
  }

  .home-hot-feature-media {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .home-hot-feature-meta {
    margin-bottom: 16px;
  }

  .home-hot-card {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
  }

  .home-hot-rank {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .home-toys-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .home-media-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .home-media-more {
    width: fit-content;
  }

  .home-media-group {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 0;
  }

  .home-media-group-head {
    min-height: 0;
  }

  .home-media-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .media-card-grid {
    grid-template-columns: 1fr;
  }

  .home-media-chip,
  .media-card {
    min-height: 0;
    padding: 14px;
  }

  .home-media-chip {
    padding: 12px;
  }

  .home-media-chip strong {
    font-size: 15px;
  }

  .home-toys-more {
    width: fit-content;
  }

  .home-toys-grid {
    grid-template-columns: 1fr;
  }

  .home-toy-card {
    min-height: 0;
    padding: 14px;
  }

  .home-toy-visual {
    height: 120px;
  }

  .home-project-grid {
    grid-template-columns: 1fr;
  }

  .home-project-feature,
  .home-project-card {
    padding: 18px;
  }

  .home-project-feature-meta {
    margin-bottom: 26px;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .blog-search-actions {
    max-width: none;
    width: 100%;
    min-width: 0;
  }
}

/* ============ Compact mobile home ============ */
@media (max-width: 600px) {
  .site-footer .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
    padding-bottom: 64px;
  }

  .site-footer .footer-copy {
    min-width: 0;
    flex-wrap: nowrap;
  }

  .site-footer .footer-copy > span:not(.footer-title) {
    display: none;
  }

  .site-footer .footer-title {
    flex: 0 0 auto;
    font-size: 13px;
    white-space: nowrap;
  }

  .site-footer .footer-meta {
    align-self: auto;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .site-footer .footer-record {
    gap: 4px;
    font-size: 11px;
  }

  .home-projects-section,
  .home-games-section,
  .home-hot-section,
  .home-media-section,
  .home-toys-section {
    padding: 30px 0;
  }

  .home-projects-section .home-projects-head,
  .home-games-section .home-games-head,
  .home-hot-section .home-hot-head,
  .home-media-section .home-media-head,
  .home-toys-section .home-toys-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
    margin-bottom: 16px;
  }

  .home-projects-section .section-tag,
  .home-games-section .section-tag,
  .home-hot-section .section-tag,
  .home-media-section .section-tag,
  .home-toys-section .section-tag {
    margin-bottom: 8px;
  }

  .home-projects-section .home-projects-head h2,
  .home-games-section .home-games-head h2,
  .home-hot-section .home-hot-head h2,
  .home-media-section .home-media-head h2,
  .home-toys-section .home-toys-head h2 {
    font-size: 24px;
    line-height: 1.16;
  }

  .home-projects-copy,
  .home-games-section .home-games-head p,
  .home-hot-section .home-hot-head p,
  .home-media-section .home-media-head p,
  .home-toys-section .home-toys-head p {
    display: none;
  }

  .home-projects-more,
  .home-games-more,
  .home-hot-more,
  .home-media-more,
  .home-toys-more,
  .home-project-cta {
    width: auto;
    height: 34px;
    padding: 0 11px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* Projects: one featured item plus two compact secondary cards. */
  .home-projects-section .home-projects-layout {
    gap: 10px;
  }

  .home-projects-section .home-project-feature {
    min-height: 0;
    padding: 16px;
  }

  .home-projects-section .home-project-feature-meta {
    margin-bottom: 12px;
    font-size: 10px;
  }

  .home-projects-section .home-project-feature h3 {
    font-size: 24px;
  }

  .home-projects-section .home-project-feature p {
    margin-top: 9px;
    font-size: 13px;
    line-height: 1.55;
    -webkit-line-clamp: 2;
  }

  .home-projects-section .home-project-feature .home-project-tags {
    display: none;
  }

  .home-projects-section .home-project-cta {
    margin-top: 14px;
  }

  .home-projects-section .home-project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .home-projects-section .home-project-grid .home-project-card:nth-child(n+3) {
    display: none;
  }

  .home-projects-section .home-project-card {
    min-height: 132px;
    padding: 13px;
  }

  .home-projects-section .home-project-card h3 {
    font-size: 15px;
    line-height: 1.3;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .home-projects-section .home-project-card p {
    display: none;
  }

  .home-projects-section .home-project-card-tags {
    gap: 4px;
    margin-top: 10px;
  }

  .home-projects-section .home-project-card-tags > span {
    padding: 3px 6px;
    font-size: 10px;
  }

  .home-projects-section .home-project-card-tags > span:nth-child(n+3) {
    display: none;
  }

  .home-projects-section .home-project-open {
    margin-top: 9px;
    font-size: 10px;
  }

  /* Games: keep both releases visible in a compact two-column row. */
  .home-games-section .home-games-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .home-games-section .home-game-card {
    min-height: 0;
    padding: 10px;
  }

  .home-games-section .home-game-visual {
    height: 82px;
    border-radius: 8px;
  }

  .home-games-section .home-game-body {
    padding-top: 9px;
  }

  .home-games-section .home-game-meta {
    margin-bottom: 5px;
    font-size: 10px;
  }

  .home-games-section .home-game-body h3 {
    min-height: 36px;
    font-size: 14px;
    line-height: 1.3;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .home-games-section .home-game-body p,
  .home-games-section .home-game-tags {
    display: none;
  }

  .home-games-section .home-game-actions {
    gap: 5px 10px;
    margin-top: auto;
    padding-top: 8px;
  }

  .home-games-section .home-game-open {
    font-size: 10px;
  }

  /* Blog: compact horizontal lead card and two supporting posts. */
  .home-hot-section .home-hot-layout {
    gap: 10px;
  }

  .home-hot-section .home-hot-feature {
    grid-template-columns: 108px minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
    padding: 10px;
  }

  .home-hot-section .home-hot-feature-media {
    min-height: 126px;
    height: 100%;
    aspect-ratio: auto;
    border-radius: 8px;
  }

  .home-hot-section .home-hot-feature-meta {
    margin-bottom: 6px;
    font-size: 10px;
  }

  .home-hot-section .home-hot-feature h3 {
    font-size: 15px;
    line-height: 1.35;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .home-hot-section .home-hot-feature p {
    display: none;
  }

  .home-hot-section .home-hot-tags {
    gap: 4px;
    padding-top: 8px;
  }

  .home-hot-section .home-hot-tags > span:not(:last-child) {
    display: none;
  }

  .home-hot-section .home-hot-tags > span {
    padding: 3px 6px;
    font-size: 10px;
  }

  .home-hot-section .home-hot-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .home-hot-section .home-hot-list .home-hot-card:nth-child(n+3) {
    display: none;
  }

  .home-hot-section .home-hot-card {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
  }

  .home-hot-section .home-hot-rank {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 11px;
  }

  .home-hot-section .home-hot-card h3 {
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .home-hot-section .home-hot-card-meta {
    gap: 5px;
    margin-top: 5px;
    font-size: 9px;
  }

  .home-hot-section .home-hot-card p {
    display: none;
  }

  /* Media: keep account coverage but remove repeated type/role copy. */
  .home-media-section .home-media-group {
    gap: 7px;
    padding: 10px 0;
  }

  .home-media-section .home-media-group-head {
    gap: 0;
  }

  .home-media-section .home-media-group-head h3 {
    font-size: 15px;
  }

  .home-media-section .home-media-group-head p,
  .home-media-section .home-media-platform,
  .home-media-section .home-media-chip small {
    display: none;
  }

  .home-media-section .home-media-links {
    gap: 8px;
  }

  .home-media-section .home-media-chip {
    min-height: 48px;
    gap: 8px;
    padding: 8px;
  }

  .home-media-section .media-platform-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .home-media-section .media-platform-icon svg {
    width: 17px;
    height: 17px;
  }

  .home-media-section .home-media-copy {
    gap: 0;
  }

  .home-media-section .home-media-chip strong {
    font-size: 13px;
    white-space: nowrap;
  }

  /* Toys: two columns, previews retained, secondary copy removed. */
  .home-toys-section .home-toys-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .home-toys-section .home-toy-card {
    min-height: 0;
    padding: 10px;
  }

  .home-toys-section .home-toy-visual {
    height: 78px;
    border-radius: 8px;
  }

  .home-toys-section .home-toy-card--dino .home-toy-visual img {
    width: 60px;
  }

  .home-toys-section .home-toy-body {
    padding-top: 9px;
  }

  .home-toys-section .home-toy-body h3 {
    font-size: 14px;
    line-height: 1.3;
  }

  .home-toys-section .home-toy-body p,
  .home-toys-section .home-toy-tags {
    display: none;
  }

  .home-toys-section .home-toy-open {
    margin-top: 8px;
    font-size: 10px;
  }
}
