/* ===== Responsive Design ===== */

/* Tablet — stack the board lists more compactly */
@media (max-width: 1024px) {
  :root {
    --nav-width: 180px;
    --sidebar-width: 200px;
  }

  .home-hero {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .hero-visual {
    min-height: 160px;
  }

  .board-column {
    flex: 0 0 250px;
    width: 250px;
  }

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

  .sidebar-card {
    position: static;
  }
}

/* Mobile — stack everything vertically */
@media (max-width: 768px) {
  :root {
    --nav-width: 100%;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .pane-nav {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .nav-brand {
    margin-bottom: 0;
  }

  .brand-name {
    font-size: var(--font-size-base);
  }

  .nav-links {
    flex-direction: row;
    gap: var(--space-1);
    flex: 0;
    /* A scroll container here collapses to zero width and clips the project dropdown. */
    overflow: visible;
  }

  .nav-item span {
    display: none;
  }

  .nav-item {
    padding: var(--space-2);
  }

  /* The project tree becomes a dropdown under the top bar. */
  .nav-tree {
    position: relative;
  }

  .nav-tree-chevron {
    display: none;
  }

  .nav-tree-children {
    position: absolute;
    top: 100%;
    right: 0;
    width: 220px;
    margin: var(--space-1) 0 0;
    padding: var(--space-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    z-index: 20;
  }

  .nav-tree .nav-subitem span {
    display: inline;
  }

  .nav-footer {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  /* Homepage */
  .home-page {
    padding: var(--space-6) var(--space-4);
  }

  .home-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
  }

  .stat-card {
    padding: var(--space-3) var(--space-2);
  }

  .stat-value {
    font-size: var(--font-size-2xl);
  }

  .feature-list {
    padding-left: 36px;
  }

  .feature-marker {
    margin-left: -32px;
  }

  /* Board */
  .board-page {
    padding: var(--space-3) var(--space-3);
  }

  .board-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .board-columns {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    gap: var(--space-3);
  }

  .board-column {
    flex: 0 0 auto;
    width: 100%;
    max-height: none;
  }

  .column-cards {
    max-height: 400px;
  }

  /* Card detail */
  .card-detail-page {
    padding: var(--space-4);
  }

  .card-detail-layout {
    display: flex;
    flex-direction: column;
  }

  .sidebar-card {
    order: -1;
    position: static;
  }

  .card-detail-title {
    font-size: var(--font-size-xl);
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .home-hero {
    padding-bottom: var(--space-6);
    margin-bottom: var(--space-6);
  }

  .hero-title {
    font-size: var(--font-size-3xl);
  }

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

  .board-columns {
    gap: var(--space-2);
  }
}
