/* The default is the wide tablet / desktop layout */

/* Narrow tablets: favorites flow into two or three columns */
@media (max-width: 1023px) {
  .favorites { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* Phones: rail becomes a bottom bar */
@media (max-width: 699px) {
  .app { grid-template: "header" auto "content" 1fr "rail" auto / minmax(0, 1fr); }
  .header { padding: 12px 12px 12px 16px; gap: 6px; }
  .home { font-size: 1.2rem; }
  .rail { flex-direction: row; justify-content: space-around; padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); }
  .rail a { width: 64px; height: 44px; border-radius: 999px; }
  .content { margin: 0; padding: 14px; }

  .categories { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .category { min-height: 112px; border-radius: 22px; }

  /* Dissolve the columns so every tile joins one two-column grid */
  .favorites { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 10px; }
  .favorites__column { display: contents; }
  .favorites .camera { grid-column: 1 / -1; height: 200px; }
  .favorites .camera--tall { height: 340px; }

  .grid { gap: 10px; }
  .tile { gap: 10px; padding: 12px; border-radius: 22px; }
  .tile--thermostat > .icon:last-child { display: none; }
}

/* Phones held sideways */
@media (max-height: 520px) {
  .header { padding-top: 8px; padding-bottom: 8px; }
  .rail a { height: 44px; }
  .category { min-height: 100px; }
}

@media (min-width: 700px) {
  .toast { bottom: 28px; }
}
