/* TinySandy – responsive rules (mobile-first base lives in style.css) */

/* Small mobile */
@media (max-width: 399px) {
  .brand-tag {
    display: none;
  }
  .brand-name {
    font-size: 1.2rem;
  }
  .site-header .container {
    gap: 6px;
    padding-inline: 12px;
  }
  .theme-switch {
    width: 56px;
    height: 34px;
  }
  .theme-switch .knob {
    width: 26px;
    height: 26px;
  }
  :root[data-theme="dark"] .theme-switch .knob {
    transform: translateX(22px);
  }
}
/* Mobile */
@media (max-width: 576px) {
  .container {
    padding-inline: 16px;
  }
  .hero {
    padding-top: 28px;
  }
  .hero-art {
    max-width: 260px;
    margin: 4px auto 0;
  }
  .hero-search .search-box {
    padding-left: 12px;
  }
  .hero-search .btn {
    padding-inline: 16px;
  }
  .cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cat-grid.limit-mobile > li:nth-child(n + 7) {
    display: none;
  }
  .cat-card {
    flex-direction: column;
  }
  .recent-panel {
    display: none;
  }
  .feat-row {
    grid-auto-columns: minmax(200px, 72%);
  }
  .tool-card.mobile-row .tc-open {
    display: none;
  }
  .tool-head .ibox {
    width: 44px;
    height: 44px;
  }
  .tool {
    padding: 14px;
  }
}
@media (min-width: 400px) and (max-width: 767px) {
  .cat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .cat-card .chev {
    display: none;
  }
}
/* Tablet and up */
@media (min-width: 577px) {
  .cat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tool-grid.cols-2,
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .feat-row {
    grid-auto-columns: minmax(200px, 31%);
  }
}
@media (min-width: 768px) {
  .cat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .cat-card {
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 16px;
  }
  .cat-card .ibox {
    width: 44px;
    height: 44px;
  }
  .cat-card .chev {
    display: block;
  }
  .cat-card.stack {
    flex-direction: column;
    align-items: flex-start;
  }
  .field.w-half {
    grid-column: span 3;
  }
  .field.w-third {
    grid-column: span 2;
  }
  .two-col {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .hero .container {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }
  .hero-art {
    max-width: none;
  }
  .footer-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(
        0,
        1fr
      ) minmax(0, 1.4fr);
  }
  .tool-card .tc-open {
    display: inline-flex;
  }
  .tool-grid.compact-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
/* Desktop */
@media (min-width: 1024px) {
  .nav-desktop {
    display: block;
  }
  .header-search {
    display: block;
  }
  .menu-btn,
  .mobile-search-btn,
  .bottom-nav {
    display: none !important;
  }
  body.has-bottom-nav {
    padding-bottom: 0;
  }
  .to-top {
    bottom: 24px;
  }
  .cat-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .cat-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 16px 18px;
  }
  .cat-card .chev {
    top: 22px;
    margin-top: 0;
  }
  .cat-card.stack {
    flex-direction: column;
  }
  .tool-grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .home-split {
    grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
  }
  .feat-row {
    grid-auto-flow: row;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-columns: auto;
    overflow: visible;
  }
  .tool-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
  }
  .sidebar {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 16px);
  }
  .related-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tool-grid.compact-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .hero {
    padding: 56px 0 54px;
  }
}
@media (min-width: 1280px) {
  .tool-grid.compact-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
/* narrow: single-row popular list look like the mobile design */
@media (max-width: 576px) {
  .tool-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .tool-grid .tool-card .tc-chev {
    display: block;
  }
}
@media (min-width: 577px) {
  .tool-grid .tool-card:not(.compact) .tc-chev {
    display: none;
  }
  .tool-grid .tool-card:not(.compact) .tc-open {
    display: inline-flex;
  }
}
/* zoom / large text safety */
@media (max-width: 360px) {
  .fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .field,
  .field.w-half,
  .field.w-third {
    grid-column: auto;
  }
  .actions .btn {
    flex: 1 1 100%;
  }
}

@media (max-width: 576px) {
  .hide-m {
    display: none !important;
  }
}

/* header fit */
.saved-btn {
  display: none;
}
.nav-link {
  white-space: nowrap;
}
@media (min-width: 1024px) {
  .saved-btn {
    display: inline-flex;
  }
  .header-search {
    width: 190px;
  }
  .site-header .container {
    gap: 12px;
  }
  .nav-link {
    padding: 8px 9px;
  }
  .brand-name {
    font-size: 1.25rem;
  }
}
@media (min-width: 1200px) {
  .header-search {
    width: 260px;
  }
  .nav-link {
    padding: 8px 12px;
  }
}

/* very narrow phones (320-359px): keep the header on one row without page-level horizontal scroll */
@media (max-width: 359px) {
  .site-header .container {
    gap: 4px;
    padding-inline: 10px;
  }
  .brand {
    gap: 6px;
    min-width: 0;
  }
  .brand img,
  .brand svg {
    width: 34px;
    height: 34px;
  }
  .brand-name {
    font-size: 1.05rem;
  }
  .icon-btn {
    width: 38px;
    height: 38px;
  }
  .theme-switch {
    width: 50px;
    height: 32px;
  }
  .theme-switch .knob {
    width: 24px;
    height: 24px;
    top: 3px;
    left: 3px;
  }
  :root[data-theme="dark"] .theme-switch .knob {
    transform: translateX(18px);
  }
}
